home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 162_01 / xlong.mac < prev   
Text File  |  1985-08-21  |  1KB  |  54 lines

  1. ;    file xlong.mac
  2.     NAME    ('XLONG')
  3.     INCLUDE DEQ.MAC
  4.     EXTRN    CMDBYT,CMDIO
  5.     EXTRN    FLSD.B,FLRD,FLDR
  6.     .Z80
  7. LMODCC: ; Long modulo command chain
  8.     DB    PXL,RDL,RDL,XY.L,RDL,PXL
  9.     DB    RDL,XY.L,.LDIV,.LMUL,.LSUB,0
  10.  
  11. L.mod::
  12.     LD    HL,LMODCC
  13.     LD    (COMSTR),HL
  14.  
  15.     EQUJPS    ,FLSD.B,FLRD,LR.CIO,FLDR
  16.  
  17. SAVA:    DB    0
  18. SAVIX:    DW    0
  19. COMSTR: DW    0    ; Points to current string of commands
  20.  
  21. ; The following segment labelled 'LR.CIO'
  22. ; pumps a chain of instructions to the AM9511 device,
  23. ; producing in this application a long modulo result.
  24. ; This segment substitutes itself for the
  25. ; single command handler labelled 'CMDIO' (external),
  26. ; while using 'CMDIO' from inside a loop.
  27.  
  28. LR.CIO: LD    (SAVIX),IX    ; save contents of IX
  29.     LD    (SAVA),A    ; save accumulator
  30.     LD    IX,TOLP     ; addr of 'top of loop'
  31.     LD    IY,(COMSTR)    ; command chain/string
  32. TOLP:
  33.     LD    A,(IY + 0)    ; get next command byte
  34.     LD    (CMDBYT),A    ; to where CMDIO will find it
  35.     INC    IY        ; advance the pointer
  36.     CP    0        ; compare A to zero
  37.     JR    Z,EXLP        ; if true, exit from loop
  38.     JP    CMDIO        ; then loop back to TOLP
  39. EXLP:
  40.     LD    IX,(SAVIX)    ; restore IX
  41.     LD    A,(SAVA)    ; restore A
  42.     JP    (IX)        ; just like CMDIO exit
  43.     .8080
  44.     END
  45. 
  46.  
  47.  
  48.  
  49.  to TOLP
  50. EXLP:
  51.     LD    IX,(SAVIX)    ; restore IX
  52.     LD    A,(SAVA)    ; restore A
  53.     JP    (IX)        ; just like CMDIO exit
  54.     .8080