home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / asmutl / asmlib2.lbr / PBUFF.AYM / PBUFF.AYM
Encoding:
Text File  |  1994-05-31  |  1.8 KB  |  126 lines

  1. ;----------------------------------------------------------------
  2. ; This is a module in the PL/I-80 utility library
  3. ;
  4. ; This module must print 080 of memory pointed to by a PL/I pointer
  5. ;
  6. ;    Written By     Richard Holmes  09-12-84
  7. ;    Last update    Richard Holmes  09-12-84
  8. ;----------------------------------------------------------------
  9. ;
  10.     name    'pbuff'
  11.     public    pbuff
  12.     extrn    getp2
  13. ;
  14.     maclib    z80
  15. bdos    equ    5
  16. cr    equ    0dh
  17. lf    equ    0ah
  18. ;
  19. pbuff:
  20.     lxi    d,1000h
  21.     call    getp2            ; fetch the pointer
  22.     xchg                ; load into HL
  23.     mvi    b,8            ; lines
  24.     mvi    c,0
  25. pbuff1:
  26.     call    crlf
  27.     mov    a,c
  28.     call    dsp$hex
  29.     call    space2
  30.     call    pline
  31.     mov    a,c
  32.     adi    16
  33.     mov    c,a            ; update the address field
  34.     lxi    d,16
  35.     dad    d            ; -> next memory
  36.     djnz    pbuff1
  37.     ret
  38. ;
  39. pline:
  40.     push    b
  41.     push    h
  42.     mvi    b,16            ; 16 hex bytes
  43. pl1:
  44.     mov    a,m
  45.     call    dsp$hex            ; display hex byte
  46.     call    space
  47.     mov    a,b
  48.     cpi    9
  49.     jrnz    pl2
  50.     mvi    a,'-'
  51.     call    conout
  52.     call    space
  53. pl2:
  54.     inx    h            ; next memory address
  55.     djnz    pl1
  56.     call    space3
  57.     pop    h
  58.     push    h
  59. ; Do the ascii now
  60.     mvi    b,16
  61. pl3:
  62.     mov    a,m
  63.     cpi    07eh
  64.     jnc    not$asc
  65.     cpi    ' '
  66.     jnc    na1            ; print as ascii
  67. ;
  68. not$asc:
  69.     mvi    a,'.'
  70. na1:
  71.     call    conout
  72.     inx    h
  73.     djnz    pl3
  74. ;
  75.     pop    h
  76.     pop    b
  77.     ret
  78. ;
  79. ; Display A as a double hex digit
  80. ;
  81. dsp$hex:
  82.     push    psw
  83.     ani    0f0h            ; mask off bottom
  84.     rar
  85.     rar
  86.     rar
  87.     rar
  88.     call    nib$asc
  89.     call    conout
  90.     pop    psw
  91.     ani    0fh
  92.     call    nib$asc
  93.     jmp    conout
  94. ;
  95. nib$asc:
  96.     ani    0fh
  97.     adi    090h
  98.     daa
  99.     aci    040h
  100.     daa
  101.     ret
  102. ;
  103. crlf:
  104.     mvi    a,cr
  105.     call    conout
  106.     mvi    a,lf
  107.     jr    conout
  108. space3:
  109.     mvi    a,' '
  110.     call    conout
  111. space2:
  112.     mvi    a,' '
  113.     call    conout
  114. space:
  115.     mvi    a,' '
  116. conout:
  117.     push    h
  118.     push    d
  119.     push    b
  120.     mov    e,a
  121.     mvi    c,02            ; output function
  122.     call    bdos
  123.     pop    b
  124.     pop    d
  125.     pop    h
  126.     ret