@@ -489,7 +489,7 @@ fileerr: pop ax
489489
490490allocerr: call PrintError
491491
492- ; Indicate error in exit code
492+ ; Indicate error (driver not loaded) in exit code
493493prexit:
494494 mov al , 255
495495
@@ -764,13 +764,10 @@ somedone: push cs
764764 jz noprintldrmsg
765765
766766 mov al , byte [ LastDrUsed ]
767- inc al
768767 mov ah , byte [ LastDrive ]
769768
770769 mov byte [ LDMsgA ], byte 'A' - 1 ; explicit byte 3.16
771- ; nop ; mimick ASM
772770 mov byte [ LDMsgB ], byte 'A' - 1 ; explicit byte 3.16
773- ; nop ; mimick ASM
774771
775772 add byte [ LDMsgA ], al
776773 add byte [ LDMsgB ], ah
@@ -858,7 +855,8 @@ noprintsize: or bx,bx
858855
859856 ; Length of driver is zero, so exit now.
860857
861- jmp exit
858+ mov dx , NotLoadedMsg
859+ jmp prexit ; ***
862860
863861 ; Check whether it fits in the allocated block.
864862
@@ -1023,7 +1021,7 @@ fill0s: xor al,al
10231021 rep stosb
10241022
10251023stayexit:
1026- mov al , [ LastDrUsed ] ; set exit code
1024+ mov al , [ ExitCode ] ; set exit code
10271025 test byte [ ModeFlag ], QuietFlag ; *** new 3.15
10281026 jnz stay2exit ; new 3.15
10291027 mov dx , StayingMsg
@@ -1363,9 +1361,20 @@ secsizeok: mov al,[cs:LastDrUsed]
13631361 jnz ldrok
13641362 jmp ldrerr
13651363
1366- ; Increase nBlkDev.
1364+ ; Increase count of block devices and update to next free CDS entry
1365+
1366+ ldrok:
13671367
1368- ldrok: inc byte [ cs :nBlkDev ]
1368+ inc byte [ cs :nBlkDev ]
1369+ inc byte [ cs :LastDrUsed ] ; point to next available drive *** TODO fixme
1370+
1371+ ; If 1st block device loaded, store drive letter for returned exit code
1372+ test byte [ cs :ExitCode ], 0
1373+ jnz notfirst
1374+ mov byte [ cs :ExitCode ], al ; al=LastDrUsed where A=0,...,Z=25
1375+ inc byte [ cs :ExitCode ] ; A=1, ..., Z=26
1376+
1377+ notfirst:
13691378
13701379 ; Store absolute block no. and block no. in device.
13711380
@@ -1426,6 +1435,7 @@ noprintblhmsg: lds bx,[Invar]
14261435 ; Calculate offset in array of entry for this drive.
14271436
14281437 mov al ,[ cs :LastDrUsed ]
1438+ dec al
14291439 mov ah ,[ cs :LDrSize ]
14301440 mul ah
14311441 add bx , ax
@@ -1602,6 +1612,7 @@ LDrErrMsg db '0 drives skipped - LASTDRIVE overflow.',13,10,24h
16021612AskEndMsg db 13 , 10 , 'No drives or Ints - unload (Y/N) ? $'
16031613NoFreeCDSMsg db 'Error: free drive letter not found, increase LASTDRIVE' , 13 , 10 , '$'
16041614SSizeErrMsg db 'Sector size too large.' , 13 , 10 , 24h
1615+ NotLoadedMsg db 'Driver not loaded' , 13 , 10 , '$'
16051616
16061617 ; Error messages.
16071618
@@ -1679,6 +1690,8 @@ nBlkDev db 0 ; resb 1 ; Note: nBlkDev & LastDrive
16791690LastDrive db 0 ; resb 1 ; must be together as loaded from LoL together
16801691LastDrUsed db 2 ; default to C:, may be overridden by cmd line option
16811692
1693+ ExitCode db 0 ; default to 0 for char devices, 1=A to 26=Z for 1st block device loaded
1694+
16821695OldAllocStr at dw 0 ; resw 1 ; DOS allocation strategy
16831696BlockSize dw 0 ; resw 1
16841697WantedParas dw 0 ; minimum paragraphs or RAM to load driver
@@ -1716,7 +1729,7 @@ LASTBYTE equ $
17161729
17171730; ................DATA WHICH ISN'T NEEDED AFTER RELOCATION...................
17181731
1719- SignOnMsg db 'DEVLOAD v3.24 - load DOS device drivers '
1732+ SignOnMsg db 'DEVLOAD v3.25 - load DOS device drivers '
17201733 db '- license' ; db '- free -'
17211734 db ' GNU General Public License 2' , 13 , 10
17221735 db '(c) 1992-2011 David Woodhouse, Eric Auer '
0 commit comments