home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 4: Demo 1 / almathera_demo1.bin / commercial / asmonedemo / asm-one / examples / binaryconv.s next >
Text File  |  1995-03-16  |  540b  |  26 lines

  1. ;************************
  2. ;*   A little example   *
  3. ;************************
  4.  
  5. ; Enter the debugger and AddWatch on the BUFFER of String type.
  6. ; Press Arrow Down to single step the program. To enter the
  7. ; subroutine press Arrow Left.
  8. ; The hexvalue $1231 in D0 will slowly be converted into the
  9. ; binary number %1001000110001
  10.  
  11. J:    MOVE.L    #$1231,D0
  12.     LEA.L    BUFFER(PC),A0
  13.  
  14. .AGAIN:    MOVE.L    D0,-(A7)
  15.     LSR.L    #1,D0
  16.     BEQ.S    .FINI
  17.     BSR.S    .AGAIN
  18. .FINI:    MOVE.L    (A7)+,D0
  19.     AND.W    #1,D0
  20.     MOVEQ    #'0',D1
  21.     ADD.W    D0,D1
  22.     MOVE.B    D1,(A0)+
  23.     RTS
  24.  
  25. BUFFER:    DCB.B    100,0
  26.