home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / program / compiler / fasbin21 / beispiel.asm next >
Assembly Source File  |  1992-11-18  |  371b  |  25 lines

  1. ; a short 8031 assembler example
  2.  
  3.     include "regdef.asm"
  4.  
  5. ; BINBCD
  6. ; Convert 8-bit binary variable in accumulator to 3-digit packed BCD format
  7. ; Hundred's place left in variable HUND,
  8. ; ten's and one's places in TENONE.
  9. ;
  10. HUND    equ    21h
  11. TENONE    equ    22h
  12.  
  13. BINBCD    mov    b,#100
  14.     div    ab
  15.     mov    HUND,a
  16.     xch    A,B
  17.     div    ab
  18.     
  19.     swap     a
  20.     add    a,b
  21.     mov    TENONE,a
  22.     ret
  23. ;
  24.  
  25.