home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol165 / dummp.asm < prev    next >
Encoding:
Assembly Source File  |  1984-07-09  |  3.2 KB  |  213 lines

  1.  
  2.  
  3. ;    -----------------------------------------------------------
  4. ;    DUMP.COM is a utility provided by Digital Research in their
  5. ;    CP/M package. However, it is convenient to supplement the
  6. ;    original program with some additional features, as well as
  7. ;    cleaning up the code which is based on their PL/M compiler.
  8. ;    Accordingly, the display line formed from a serial address
  9. ;    and sixteen hexadecimal bytes is supplemented by the ASCII
  10. ;    interpretation of these same bytes, as is done by DDT.
  11. ;
  12. ;            DUMMP.ASM   Copyright (C) 1983
  13. ;            Universidad Autonoma de Puebla
  14. ;                  September 22, 1983
  15. ;
  16. ;    [Harold V. McIntosh, 22 September 1983]
  17. ;    -----------------------------------------------------------
  18.  
  19.  
  20. BDOS    equ    0005H    ;BDOS entry point
  21.  
  22. TFCB    equ    5CH    ;FILE CONTROL BLOCK ADDRESS
  23. TSIZ    equ    80H    ;size of input buffer
  24. TBUF    equ    80H    ;input buffer address
  25.  
  26. ;    Non-graphic characters
  27.  
  28. CR    equ    0DH    ;carriage return
  29. LF    equ    0AH    ;line feed
  30.  
  31.  
  32. ;    -------------
  33.     org    0100H
  34. ;    -------------
  35.  
  36. begn:    lxi    h,0000
  37.     dad    sp
  38.     shld    stak
  39.     lxi    sp,stak
  40.     lda    TFCB+1
  41.     cpi    ' '
  42.     jz    tuto
  43.     lxi    h,TFCB+9
  44.     mov    a,m
  45.     cpi    ' '
  46.     jnz    yext
  47.     mvi    m,'C'
  48.     inx    h
  49.     mvi    m,'O'
  50.     inx    h
  51.     mvi    m,'M'
  52. yext:    call    opef
  53.     lxi    b,0000    ;byte counter, kept in BC
  54.  
  55. loop:    call    rdsk
  56.     ora    a
  57.     jnz    gbye
  58.     call    wbuf
  59.     call    break    ;check for manual interruption
  60.     rrc
  61.     jnc    loop
  62.     lxi    d,dint
  63.     call    mssg
  64. gbye:    call    crlf
  65.     lhld    stak
  66.     sphl
  67.     ret
  68.  
  69. wbuf:    lxi    h,TBUF
  70.     call    wfor
  71. wfor:    call    wtwo
  72. wtwo:    call    wone
  73. wone:    call    word
  74.     call    dubl
  75.     mov    a,c
  76.     adi    16
  77.     mov    c,a
  78.     mov    a,b
  79.     aci    0
  80.     mov    b,a
  81.     push    h
  82.     call    hlin
  83.     call    sngl
  84.     pop    h
  85.     call    alin
  86.     jmp    crlf
  87.  
  88. hlin:    call    heig
  89. heig:    call    hfor
  90. hfor:    call    htwo
  91. htwo:    call    hone
  92. hone:    mov    a,m
  93.     call    byte
  94.     mvi    a,' '
  95.     call    cona
  96.     inx    h
  97.     ret
  98.  
  99. alin:    call    aeig
  100. aeig:    call    afor
  101. afor:    call    atwo
  102. atwo    call    aone
  103. aone:    mov    a,m
  104.     call    prpr
  105.     inx    h
  106.     ret
  107.  
  108. ;    SUBROUTINES
  109.  
  110. break:    push    h
  111.     push    d
  112.     push    b
  113.     mvi    c,11    ;(0B) console status
  114.     call    BDOS
  115.     push    psw
  116.     rrc
  117.     jnc    brk
  118.     mvi    c,1    ;(01) read console
  119.     call    BDOS
  120. brk:    pop    psw
  121.     pop    b
  122.     pop    d
  123.     pop    h
  124.     ret
  125.  
  126. dubl:    call    sngl
  127. sngl:    mvi    a,' '
  128.     jmp    cona
  129.  
  130. crlf:    mvi    a,CR
  131.     call    cona
  132.     mvi    a,LF
  133.     jmp    cona
  134.  
  135. word:    mov    a,b
  136.     call    byte
  137.     mov    a,c
  138. byte:    push    psw
  139.     rrc
  140.     rrc
  141.     rrc
  142.     rrc
  143.     call    nibl
  144.     pop    psw
  145. nibl:    ani    0FH
  146.     adi    90H
  147.     daa
  148.     aci    40H
  149.     daa
  150. cona:    push    h
  151.     push    d
  152.     push    b
  153.     mvi    c,2    ;(02) char to console
  154.     mov    e,a
  155.     call    BDOS
  156.     pop    b
  157.     pop    d
  158.     pop    h
  159.     ret
  160.  
  161. ;    Print printables, put dot for rest.
  162.  
  163. prpr:    cpi    07FH    ;rubout
  164.     jnc    prdo
  165.     cpi    ' '
  166.     jnc    cona
  167. prdo:    mvi    a,'.'
  168.     jmp    cona
  169.  
  170. mssg:    mvi    c,9    ;(09) print buffer
  171.     jmp    BDOS
  172.  
  173. opef:    xra    a    ;ZERO TO ACCUM
  174.     sta    TFCB+32    ;CLEAR CURRENT RECORD
  175.     lxi    d,TFCB
  176.     mvi    c,15    ;(0F) open file
  177.     call    BDOS
  178.     inr    a
  179.     rnz
  180.     lxi    d,nfil
  181.     call    mssg
  182.     jmp    gbye
  183.  
  184. rdsk:    push    h
  185.     push    d
  186.     push    b
  187.     lxi    d,TFCB
  188.     mvi    c,20    ;(14) read one record
  189.     call    BDOS
  190.     pop    b
  191.     pop    d
  192.     pop    h
  193.     ret
  194.  
  195. tuto:    lxi    d,logo
  196.     call    mssg
  197.     jmp    gbye
  198.  
  199. nfil:    db    CR,LF,'Requested file not present.$'
  200. dint:    db    'Dump interrupted.$'
  201. logo:    db    CR,LF,'File Dump/ICUAP/September 22, 1983.',CR,LF,CR,LF
  202.     db    '    DUMMP [D:]FILE[.EXT]',CR,LF,CR,LF
  203.     db    'will allow viewing of FILE on the console. If .EXT',CR,LF
  204.     db    'is not given, .CMD is assumed. Sixteen bytes will',CR,LF
  205.     db    'be shown first in hexadecimal, then in ASCII, for',CR,LF
  206.     db    'each line. Press any key to stop the display.',CR,LF
  207.     db    '$'
  208.  
  209.     ds    16
  210. stak    ds    2
  211.  
  212.     end
  213.