home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / programming / asm_programming / DUMP.LST < prev    next >
File List  |  1990-10-04  |  10KB  |  282 lines

  1. Microsoft (R) Macro Assembler Version 5.10                  10/4/90 04:18:49
  2.                                                              Page     1-1
  3.  
  4.  
  5.                 ; DUMP.ASM: Dump Utility
  6.                 
  7.                 ; ------Macros--------------------------
  8.                 
  9.                 doscall macro   x
  10.                         mov     ah,x
  11.                         int     21h
  12.                         endm
  13.                 
  14.                 outchar macro   x
  15.                         mov     dl,x
  16.                         doscall 2
  17.                         endm
  18.                 
  19.  0000                code    segment
  20.  0100                        org     100h
  21.                         assume  cs:code,ds:code
  22.  0100  EB 23 90            start:  jmp     begin
  23.                 
  24.                 ; ------Variables----------------------
  25.                 
  26.  0103  0000            fcount  dw      0
  27.  0105  00            eofflag db      0
  28.  0106  46 69 6C 65 20 6E    fnfmsg  db      'File not Found$'
  29.        6F 74 20 46 6F 75    
  30.        6E 64 24            
  31.  0115  30 31 32 33 34 35    hexchar db      '0123456789ABCDEF'
  32.        36 37 38 39 41 42    
  33.        43 44 45 46        
  34.                 
  35.                 ; ----- main loop -------------
  36.                 
  37.  0125  BA 005C            begin:  mov     dx,5ch          ; fcb prepared 
  38.                 by DOS
  39.                         doscall 0fh             ; open file
  40.  0128  B4 0F                 1            mov     ah,0fh 
  41.  012A  CD 21                 1            int     21h 
  42.  012C  3C FF                    cmp     al,0ffh         ; if ffh then 
  43.  012E  75 0A                    jne     d1              ; file not foun
  44.                 d
  45.  0130  BA 0106 R                mov     dx,offset fnfmsg
  46.                         doscall 9               ; display messa
  47.                 ge
  48.  0133  B4 09                 1            mov     ah,9 
  49.  0135  CD 21                 1            int     21h 
  50.  0137  EB 1E 90                    jmp     exit            ; end
  51.                 
  52.                 ; if file is present begin by reading 
  53.                 ; data in DTA at offset 80h
  54.                 
  55.  013A  BA 005C            d1:     mov     dx,5ch
  56.                         doscall 14h             ; read data blo
  57.                 ck (128 bytes)
  58.  013D  B4 14                 1            mov     ah,14h 
  59. Microsoft (R) Macro Assembler Version 5.10                  10/4/90 04:18:49
  60.                                                              Page     1-2
  61.  
  62.  
  63.  013F  CD 21                 1            int     21h 
  64.  0141  3C 01                    cmp     al,1            ; if end of fil
  65.                 e
  66.  0143  74 12                    je      exit            ; end
  67.  0145  3C 03                    cmp     al,3            ; if partial bl
  68.                 ock
  69.  0147  75 04                    jne     d2              ; display file 
  70.                 and end
  71.  0149  FE 06 0105 R                inc     eofflag         
  72.  014D  E8 0159 R        d2:     call    outrec          ; display 128 b
  73.                 ytes of DTA
  74.  0150  80 3E 0105 R 01                cmp     eofflag,1       ; EOF?
  75.  0155  75 E3                    jne     d1              ; if not, jump 
  76.                 to top
  77.  0157  CD 20            exit:   int     20h
  78.                 
  79.  0159                outrec  proc    near
  80.  0159  BD 0080                    mov     bp,80h          ; bp points to 
  81.                 beginning of DTA
  82.  015C  E8 018C R        or1:    call    outcnt
  83.  015F  E8 01A7 R                call    outhex
  84.  0162  E8 01CD R                call    outasci
  85.                         outchar 13
  86.  0165  B2 0D                 1            mov     dl,13 
  87.  0167  B4 02                 2            mov     ah,2 
  88.  0169  CD 21                 2            int     21h 
  89.                         outchar 10
  90.  016B  B2 0A                 1            mov     dl,10 
  91.  016D  B4 02                 2            mov     ah,2 
  92.  016F  CD 21                 2            int     21h 
  93.  0171  83 C5 10                    add     bp,16           ; position base
  94.                  pointer
  95.  0174  83 06 0103 R 10                add     fcount,16       ; and file coun
  96.                 ter
  97.  0179  81 FD 0100                cmp     bp,100h         ; finished afte
  98.                 r 128 bytes 
  99.  017D  75 DD                    jne     or1
  100.                         outchar 13
  101.  017F  B2 0D                 1            mov     dl,13 
  102.  0181  B4 02                 2            mov     ah,2 
  103.  0183  CD 21                 2            int     21h 
  104.                         outchar 10
  105.  0185  B2 0A                 1            mov     dl,10 
  106.  0187  B4 02                 2            mov     ah,2 
  107.  0189  CD 21                 2            int     21h 
  108.  018B  C3                    ret
  109.  018C                outrec  endp
  110.                 
  111.  018C                outcnt  proc    near        ; outcnt displa
  112.                 ys the memory address
  113.  018C  A1 0103 R                mov     ax,fcount       ; in hex as MSB
  114.                  LSB:
  115.  018F  8A C4                    mov     al,ah           ; switch for di
  116.                 splay
  117. Microsoft (R) Macro Assembler Version 5.10                  10/4/90 04:18:49
  118.                                                              Page     1-3
  119.  
  120.  
  121.  0191  E8 01E7 R                call    outbyte 
  122.  0194  A1 0103 R                mov     ax,fcount  
  123.  0197  E8 01E7 R                call    outbyte
  124.                         outchar ':'             ; separate with
  125.                  :
  126.  019A  B2 3A                 1            mov     dl,':' 
  127.  019C  B4 02                 2            mov     ah,2 
  128.  019E  CD 21                 2            int     21h 
  129.                         outchar ' '
  130.  01A0  B2 20                 1            mov     dl,' ' 
  131.  01A2  B4 02                 2            mov     ah,2 
  132.  01A4  CD 21                 2            int     21h 
  133.  01A6  C3                    ret
  134.  01A7                outcnt  endp
  135.                 
  136.  01A7                outhex  proc    near        ; outhex displa
  137.                 ys a hex dump
  138.  01A7  BE 0000                    mov     si,0  
  139.  01AA  8A 02            oh1:    mov     al,[bp+si]      ; read byte
  140.  01AC  E8 01E7 R                call    outbyte         ; and display
  141.                         outchar ' '
  142.  01AF  B2 20                 1            mov     dl,' ' 
  143.  01B1  B4 02                 2            mov     ah,2 
  144.  01B3  CD 21                 2            int     21h 
  145.  01B5  46                    inc     si
  146.  01B6  83 FE 08                    cmp     si,8            ; add extra spa
  147.                 ce between 
  148.  01B9  75 06                    jne     oh2             ; bytes 7 and 8
  149.                  for clarity
  150.                         outchar ' '
  151.  01BB  B2 20                 1            mov     dl,' ' 
  152.  01BD  B4 02                 2            mov     ah,2 
  153.  01BF  CD 21                 2            int     21h 
  154.  01C1  83 FE 10            oh2:    cmp     si,16           ; if si = 16 th
  155.                 en return
  156.  01C4  75 E4                    jne     oh1
  157.                         outchar ' '             ; separate with
  158.                  a space
  159.  01C6  B2 20                 1            mov     dl,' ' 
  160.  01C8  B4 02                 2            mov     ah,2 
  161.  01CA  CD 21                 2            int     21h 
  162.  01CC  C3                    ret
  163.  01CD                outhex  endp
  164.                 
  165.  01CD                outasci proc    near        ; outasci displ
  166.                 ays the ASCII characters
  167.  01CD  BE 0000                    mov     si,0            ; prepare oa1 l
  168.                 oop
  169.  01D0  8A 12            oa1:    mov     dl,[bp+si]      ; read characte
  170.                 r
  171.  01D2  80 E2 7F                    and     dl,7fh          ; set MSB = 0
  172.  01D5  80 FA 20                    cmp     dl,20h          ; if char can b
  173.                 e printed then 
  174.  01D8  73 02                    jae     oa2             ; jump to oa2
  175. Microsoft (R) Macro Assembler Version 5.10                  10/4/90 04:18:49
  176.                                                              Page     1-4
  177.  
  178.  
  179.  01DA  B2 2E                    mov     dl,'.'        ; else print .
  180.  01DC                oa2:    doscall 2               ; print charact
  181.                 er
  182.  01DC  B4 02                 1            mov     ah,2 
  183.  01DE  CD 21                 1            int     21h 
  184.  01E0  46                    inc     si              
  185.  01E1  83 FE 10                    cmp     si,16        ; when performe
  186.                 d 16 times, end
  187.  01E4  75 EA                    jne     oa1
  188.  01E6  C3                    ret
  189.  01E7                outasci endp
  190.                 
  191.  01E7                outbyte proc    near        ; output char. 
  192.                 to screen
  193.  01E7  BB 0115 R                mov     bx,offset hexchar
  194.  01EA  50                    push    ax 
  195.  01EB  24 F0                    and     al,0f0h    
  196.  01ED  B1 04                    mov     cl,4     
  197.  01EF  D2 C0                    rol     al,cl  
  198.  01F1  D7                    xlat               ; translate int
  199.                 o hex
  200.  01F2  8A D0                    mov     dl,al  
  201.                         doscall 2        ; display
  202.  01F4  B4 02                 1            mov     ah,2 
  203.  01F6  CD 21                 1            int     21h 
  204.  01F8  58                    pop     ax   
  205.  01F9  24 0F                    and     al,0fh
  206.  01FB  D7                    xlat            ; translate int
  207.                 o hex
  208.  01FC  8A D0                    mov     dl,al
  209.                         doscall 2        ; display
  210.  01FE  B4 02                 1            mov     ah,2 
  211.  0200  CD 21                 1            int     21h 
  212.  0202  C3                    ret
  213.  0203                outbyte endp
  214.                 
  215.  0203                code    ends
  216.                         end     start
  217.  
  218. Microsoft (R) Macro Assembler Version 5.10                  10/4/90 04:18:49
  219.                                                              Symbols-1
  220.  
  221.  
  222. Macros:
  223.  
  224.         N a m e            Lines
  225.  
  226. DOSCALL  . . . . . . . . . . . .         2
  227. OUTCHAR  . . . . . . . . . . . .         2
  228.  
  229. Segments and Groups:
  230.  
  231.                 N a m e             Length     Align    Combine Class
  232.  
  233. CODE . . . . . . . . . . . . . .      0203    PARA    NONE    
  234.  
  235. Symbols:            
  236.  
  237.                 N a m e             Type     Value     Attr
  238.  
  239. BEGIN  . . . . . . . . . . . . .      L NEAR    0125    CODE
  240.  
  241. D1 . . . . . . . . . . . . . . .      L NEAR    013A    CODE
  242. D2 . . . . . . . . . . . . . . .      L NEAR    014D    CODE
  243.  
  244. EOFFLAG  . . . . . . . . . . . .      L BYTE    0105    CODE
  245. EXIT . . . . . . . . . . . . . .      L NEAR    0157    CODE
  246.  
  247. FCOUNT . . . . . . . . . . . . .      L WORD    0103    CODE
  248. FNFMSG . . . . . . . . . . . . .      L BYTE    0106    CODE
  249.  
  250. HEXCHAR  . . . . . . . . . . . .      L BYTE    0115    CODE
  251.  
  252. OA1  . . . . . . . . . . . . . .      L NEAR    01D0    CODE
  253. OA2  . . . . . . . . . . . . . .      L NEAR    01DC    CODE
  254. OH1  . . . . . . . . . . . . . .      L NEAR    01AA    CODE
  255. OH2  . . . . . . . . . . . . . .      L NEAR    01C1    CODE
  256. OR1  . . . . . . . . . . . . . .      L NEAR    015C    CODE
  257. OUTASCI  . . . . . . . . . . . .      N PROC    01CD    CODE    Length = 001A
  258. OUTBYTE  . . . . . . . . . . . .      N PROC    01E7    CODE    Length = 001C
  259. OUTCNT . . . . . . . . . . . . .      N PROC    018C    CODE    Length = 001B
  260. OUTHEX . . . . . . . . . . . . .      N PROC    01A7    CODE    Length = 0026
  261. OUTREC . . . . . . . . . . . . .      N PROC    0159    CODE    Length = 0033
  262.  
  263. START  . . . . . . . . . . . . .      L NEAR    0100    CODE
  264.  
  265. @CPU . . . . . . . . . . . . . .      TEXT  0101h        
  266. @FILENAME  . . . . . . . . . . .      TEXT  dump        
  267. @VERSION . . . . . . . . . . . .      TEXT  510        
  268.  
  269. Microsoft (R) Macro Assembler Version 5.10                  10/4/90 04:18:49
  270.                                                              Symbols-2
  271.  
  272.  
  273.  
  274.     126 Source  Lines
  275.     174 Total   Lines
  276.      27 Symbols
  277.  
  278.   47812 + 283623 Bytes symbol space free
  279.  
  280.       0 Warning Errors
  281.       0 Severe  Errors
  282.