Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Recursive gem in PDP-11 assembler: convert binary value in R0 into ASCII:-

  CNV10: MOV R0,-(SP)    ;Converts binary value 
         CLR R0          ;in R0 to ASCII in buffer
  1$:    INC R0          ;pointed to R1
         SUB #10.,@SP
         BGE 1$
         ADD #72,@SP
         DEC R0
         BEQ 2$
         CALL CNV10
  2$:    MOVB (SP)+,(R1)+
         RETURN


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: