home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols200 / vol276 / zcpr3cmd.lbr / POKE.CMD < prev    next >
OS/2 REXX Batch file  |  1986-06-11  |  1KB  |  75 lines

  1. ;section 5I
  2. ;command: POKE
  3. ;Written by Richard Conn, modified by Bob Logan
  4. ;
  5. ;function:  Place Values into Memory
  6. ;
  7. ;forms:
  8. ;    poke startadr val1 val2 ...    (hex values)
  9. ;    poke startadr "message  (converts message into appropriate hex)
  10.  
  11. POKE    EQU    $
  12.  
  13.     .phase    Z3CMD
  14.  
  15. PO_E:
  16.     LD    HL,TBUFF+1    ;pt to first char
  17.     CALL    SKSP        ;skip to non-blank
  18.     JP    Z,ERROR        ;arg error
  19.     CALL    PHEX        ;convert to number
  20.     CALL    PRINTC
  21.     DB    ' Pok','e'+80H
  22.     CALL    PADRAT        ;print at message
  23.  
  24. ; loop for storing hex values sequentially via poke
  25. POKE1:
  26.     PUSH    DE        ;save address
  27.     CALL    SKSP        ;skip to non-blank
  28.     JR    Z,BACK        ;done
  29.     CP    '"'        ;quoted text?
  30.     JR    Z,POKE2
  31.     CALL    PHEX        ;get number
  32.     LD    A,E        ;get low
  33.     POP    DE        ;get address
  34.     LD    (DE),A        ;store number
  35.     INC    DE        ;pt to next
  36.     JR    POKE1
  37.  
  38. BACK:
  39.     POP    DE
  40.     RET
  41.  
  42. ; store ascii chars
  43. POKE2:
  44.     POP    DE        ;get next address
  45.     INC    HL        ;pt to next char
  46. POKE3:
  47.     LD    A,(HL)        ;get next char
  48.     OR    A        ;done?
  49.     RET    Z
  50.     LD    (DE),A        ;put char
  51.     INC    HL        ;pt to next
  52.     INC    DE
  53.     JR    POKE3
  54.  
  55. ; print address message
  56. ;   print address in de
  57. PADRAT:
  58.     CALL    PRINT3
  59.     DB    ' ','@'+80H
  60.     LD    A,D        ;print high
  61.     CALL    PASHC
  62.     LD    A,E        ;print low
  63.     JP    PAHC
  64.  
  65. ;get hex number from command line
  66. PHEX:
  67.     CALL    HNUM11
  68.     EX    DE,HL
  69.     RET
  70.  
  71.     PO_L    EQU    $-PO_E
  72.  
  73.     .dephase
  74.  
  75.