
=== Trace listing source: srdmulti.lst
     1                                  ;
     2                                  ;       ReSizeable RAMDisk device driver
     3                                  ;
     4                                  ;       Copyright (C) 1992-1996, 2005 Marko Kohtala
     5                                  ;       Released under GNU GPL, read the file 'COPYING' for more information
     6                                  
     7                                  [list -]
    13                                  [list +]
    14                                  
    15                                  %define DR_ATTRIBUTES DHATTR_NOFAT | DHATTR_OPENCLOSE
    16                                  
    17                                  
    18                                  ;**************************************************************************
    19                                  ;
    20                                  ;                Device driver start and the structures
    21                                  ;
    22                                  ;**************************************************************************
    23                                  
=== Switch to base=000000h -> "D_SEG"
    24                                  section D_SEG
    25                                  
    26                                  ;                org     0
    27                                  ; The following is to be considered as both a device driver header and
    28                                  ; as a starting point for the configuration table. This driver will be
    29                                  ; identified by its segment address and this structure must be at offset
    30                                  ; 0.
    31                                  
    32                                                  ; Device driver header
     0 00000000 FFFFFFFF                drhdr_next      dd      -1              ; Pointer to next device (now last)
     0 00000004 0028                    drhdr_attr      dw      DR_ATTRIBUTES
     0 00000006 [1A00]                  drhdr_strategy  dw      j_strategy	; Offset to strategy function
     0 00000008 [1D00]                  drhdr_commands  dw      commands	; Offset to commands function
     0 0000000A 01                      drhdr_units     db      1               ; Number of units
    38                                  
    39                                  dr_volume       label byte
     0 0000000B 535244                  dr_ID           db 'SRD'                ; SRDISK signature (3 char)
     0 0000000E 4D554C54                dr_memory       db "MULT"		; Memory type identifier (4 char)
     0 00000012 322E3130                dr_version      db SRD_VERSION          ; Device driver version (4 char)
     0 00000016 00                                      db 0                    ; null to end volume label
     0 00000017 FF                      dr_v_format     db -1			; Configuration format version
     0 00000018 FFFF                    dr_conf         dw -1			; Pointer to drive configuration
    46                                  
     0 0000001A E9C343                  j_strategy:	fill 3, 90h, jmp strategy
    48                                  commands:
     0 0000001D 2EC41E[4E00]            	les bx, [cs:req_ptr]
     0 00000022 26C747030381            	mov word [es:bx + rhStatus], ERROR | DONE | UNKNOWN_COMMAND
     0 00000028 CB                      	retf
    52                                  
    53                                  %define MSGLIST
    54                                  %define BINLIST
    55                                  
    56                                  %macro payload 2.nolist
    57                                   %xdefine MSGLIST MSGLIST, %%message:, {asciz %1}
    58                                   %xdefine BINLIST BINLIST, %%payload:, {incbin %2}, {align 16, db 38}, %%payload_end:
    59                                  	dw %%message
    60                                  	dw %%payload
    61                                  	dw words(%%payload_end - %%payload)
    62                                  %endmacro
    63                                  
    64                                  	struc TABLEENTRY
     0 00000000 ????                    teName:		resw 1
     0 00000002 ????                    tePayload:	resw 1
     0 00000004 ????                    teAmountWords:	resw 1
    68                                  	endstruc
    69                                  
    70                                  %macro multiline 1-*.nolist
    71                                   %rep %0
    72                                  	%1
    73                                    %rotate 1
    74                                   %endrep
    75                                  %endmacro
    76                                  
     0 00000029 00                      	align 2, db 0
    78                                  table:
    79                                  		; first entry is also default
     0 0000002A [5200][7000]C006        	payload "XMS", "srdxms.sys"
     0 00000030 [5600][F00D]6805        	payload "XMSS", "srdxmss.sys"
     0 00000036 [5B00][C018]2807        	payload "EMS", "srdems.sys"
     0 0000003C [5F00][1027]0007        	payload "EMS3", "srdems3.sys"
     0 00000042 [6400][1035]D005        	payload "EMSS", "srdemss.sys"
     0 00000048 [6900][B040]9801        	payload "DUMMY", "srdummy.sys"
    86                                  .end:
    87                                  
     0 0000004E 00000000                req_ptr         dd 0                    ; Request structure pointer
    89                                  
     0 00000052 584D5300584D535300      multiline MSGLIST
     0 0000005B 454D5300454D533300
     0 00000064 454D53530044554D4D
     0 0000006D 5900
    91                                  
     0 0000006F 00                      	align 16, db 0
    93 00000070 <bin D71h>26-           multiline BINLIST
    93 00000DF0 <rep Fh><bin AC7h>-     
     0 000018C0 26<rep 9h>              
    93 000018C0 <bin E48h>26-           
    93 00003510 <rep 8h><bin E00h>-     
    93 00003510 <bin B9Eh>26-           
    93 000040B0 <rep 2h><bin 32Ch>-     
     0 000043DC 26<rep 4h>              
    94                                  
    95                                  strategy:
     0 000043E0 2E891E[4E00]                            mov word ptr [cs:req_ptr],bx
     0 000043E5 2E8C06[5000]                            mov word ptr [cs:req_ptr+2],es
    98                                  
     0 000043EA 9C                                      pushf
     0 000043EB 50                                      push ax
     0 000043EC 53                                      push bx
     0 000043ED 51                                      push cx
     0 000043EE 52                                      push dx
     0 000043EF 56                                      push si
     0 000043F0 57                                      push di
     0 000043F1 1E                                      push ds
     0 000043F2 06                                      push es
   108                                  
     0 000043F3 FC                                      cld
     0 000043F4 2EC536[4E00]            		lds si, [cs:req_ptr]
     0 000043F9 807C0200                                cmp byte [si + rhFunction], 0
     0 000043FD 7418                                    je .init
   113                                  			; NC
     0 000043FF C744030381                              mov word [si + rhStatus], ERROR | DONE | UNKNOWN_COMMAND
   115                                  .chain:
     0 00004404 F9                      		stc
   117                                  .ret_NC:
     0 00004405 07                                      pop es
     0 00004406 1F                                      pop ds
     0 00004407 5F                                      pop di
     0 00004408 5E                                      pop si
     0 00004409 5A                                      pop dx
     0 0000440A 59                                      pop cx
     0 0000440B 5B                                      pop bx
     0 0000440C 58                                      pop ax
     0 0000440D 7306                                    jnc .retf
     0 0000440F 9D                                      popf
     0 00004410 EA00000000                              jmp 0:0
   129                                  .chainlink: equ $ - 4
   130                                  .retf:
     0 00004415 9D                      		popf
     0 00004416 CB                      		retf
   133                                  
   134                                  .init:
     0 00004417 0E                      		push cs
     0 00004418 07                      		pop es
     0 00004419 BB[2A00]                		mov bx, table		; es:bx -> first/default entry
   138                                  
     0 0000441C C57412                  		lds si, [si + irParamAddress]	; Pointer to cmd line
     0 0000441F AC                      .irc1:           lodsb                           ; Skip over the driver name
     0 00004420 3C09                                    cmp al,9 ;tab
     0 00004422 7408                                    je .irc2
     0 00004424 3C20                                    cmp al,' '
     0 00004426 7404                                    je .irc2
     0 00004428 77F5                                    ja .irc1
     0 0000442A EB6F                                    jmp .default
   147                                  .irc2:
     0 0000442C E88500                  .irc_narg:       call irc_skip_space
   149                                  
     0 0000442F 3C20                                    cmp al,' '                      ; Every ctrl character ends
     0 00004431 7268                                    jb .default
     0 00004433 3C2F                    		cmp al, '/'
     0 00004435 7464                    		je .default
     0 00004437 3C61                    		cmp al, 'a'
     0 00004439 7206                    		jb @F
     0 0000443B 3C7A                    		cmp al, 'z'
     0 0000443D 7702                    		ja @F
     0 0000443F 2C20                    		sub al, 20h
   159                                  @@:
     0 00004441 3C41                    		cmp al, 'A'
     0 00004443 722B                    		jb .error
     0 00004445 3C60                    		cmp al, '`'
     0 00004447 7727                    		ja .error
     0 00004449 803C3A                  		cmp byte [si], ':'
     0 0000444C 744D                    		je .default
     0 0000444E 4E                      		dec si
     0 0000444F 89F2                    		mov dx, si
   168                                  .match:
     0 00004451 268B3F                  		mov di, [es:bx + teName]
   170                                  .loop:
     0 00004454 AC                      		lodsb
     0 00004455 24DF                    		and al, ~20h
     0 00004457 AE                      		scasb
     0 00004458 750B                    		jne .next
     0 0000445A 26803D00                		cmp byte [es:di], 0
     0 0000445E 75F4                    		jne .loop
     0 00004460 AC                      		lodsb
     0 00004461 3C20                    		cmp al, 32
     0 00004463 762B                    		jbe .found
   180                                  .next:
     0 00004465 89D6                    		mov si, dx
     0 00004467 83C306                  		add bx, TABLEENTRY_size
     0 0000446A 81FB[4E00]              		cmp bx, table.end
     0 0000446E 72E1                    		jb .match
   185                                  .error:
     0 00004470 0E                      		push cs
     0 00004471 1F                      		pop ds
     0 00004472 BA[BE44]                		mov dx, msg.error
     0 00004475 B409                    		mov ah, 09h
     0 00004477 CD21                    		int 21h
   191                                  
     0 00004479 31C0                                    xor ax, ax			; NC
     0 0000447B C51E[4E00]                              lds bx, [req_ptr]
     0 0000447F 88470D                  		mov [bx + irUnits],al		; Zero the number of drives
     0 00004482 89470E                                  mov word ptr [bx + irEndAddress],ax
     0 00004485 8C4F10                  		mov word ptr [bx + irEndAddress + 2],cs
     0 00004488 C747030001                              mov word [bx + rhStatus], DONE
     0 0000448D E975FF                  		jmp .ret_NC
   199                                  
   200                                  .found:
     0 00004490 4E                      		dec si				; -> after matched name
     0 00004491 87F2                    		xchg si, dx			; si -> matched name, dx -> after
   203                                  @@:
     0 00004493 C60420                  		mov byte [si], 32		; write a blank
     0 00004496 46                      		inc si
     0 00004497 39D6                    		cmp si, dx			; loop for name
     0 00004499 72F8                    		jb @B				; if si -> below the -> after name
   208                                  .default:
     0 0000449B 0E                      		push cs
     0 0000449C 1F                      		pop ds
     0 0000449D 8B4F04                  		mov cx, [bx + teAmountWords]
     0 000044A0 8B7702                  		mov si, [bx + tePayload]	; ds:si -> payload
     0 000044A3 31FF                    		xor di, di			; es:di -> destination
     0 000044A5 F3A5                    		rep movsw			; place payload
     0 000044A7 A10600                  		mov ax, [dhStrategy]
     0 000044AA A3[1144]                		mov word [.chainlink], ax
     0 000044AD 8C0E[1344]              		mov word [.chainlink + 2], cs
     0 000044B1 E950FF                  		jmp .chain
   219                                  
   220                                  irc_skip_space  proc near
     0 000044B4 AC                      ircs1:          lodsb
     0 000044B5 3C20                                    cmp al,' '
     0 000044B7 74FB                                    je ircs1
     0 000044B9 3C09                                    cmp al,9 ;tab
     0 000044BB 74F7                                    je ircs1
     0 000044BD C3                                      ret
   227                                  irc_skip_space  endp
   228                                  
   229                                  msg:
     0 000044BE 0D0A526553697A6561      .error:		db 0Dh, 0Ah, 'ReSizeable RAMDisk '
     0 000044C7 626C652052414D4469
     0 000044D0 736B20
     0 000044D3 284D756C746929                          db '(Multi)'
     0 000044DA 2076657273696F6E20                      db ' version ', SRD_VERSION, '. '
     0 000044E3 322E31302E20
     0 000044E9 436F70797269676874                      db 'Copyright (c) 2005 Marko Kohtala.'
     0 000044F2 202863292032303035
     0 000044FB 204D61726B6F204B6F
     0 00004504 6874616C612E
     0 0000450A 0D0A                                    db 0Dh, 0Ah
     0 0000450C 52414D4469736B3A20      		ascic "RAMDisk: Invalid device driver type specified. Unloading.",13,10
     0 00004515 496E76616C69642064
     0 0000451E 657669636520647269
     0 00004527 766572207479706520
     0 00004530 737065636966696564
     0 00004539 2E20556E6C6F616469
     0 00004542 6E672E0D0A24
   236                                  
   237                                  %ifidni __OUTPUT_FORMAT__, obj
=== Switch to base=004550h -> "STACK"
   238                                  section STACK stack
   239 00000000 <res 200h>              	resb 512			; to silence linker warning
   240                                  %endif
