11; .....................PROGRAM HEADER FOR PROJECT BUILDER....................
22
33; TITLE DEVLOAD to load device drivers from command line.
4- ; FORMAT EXE ; *** changed to COM in 3.12/newer ***
5- ; VERSION 3.21
4+ ; FORMAT COM
5+ ; VERSION 3.22
66; CODE 80x86
7- ; OPTIONS /ML ; *** NASM -o devload.com in 3.21/newer ***
8- ; TIME CHECK
9- ; DATE 12/3/92 - 31/3/98
7+ ; BUILD NASM -o devload.com in 3.21/newer ***
108; AUTHOR David Woodhouse
119
1210; (C) 1992, 1993 David Woodhouse.
1614
1715
1816; Devload - a tool to load DOS device drivers from the command line
19- ; Copyright (c) 1992-2008 David Woodhouse and Eric Auer
17+ ; Copyright (c) 1992-2011 David Woodhouse and Eric Auer
2018;
2119; This program is free software; you can redistribute it and/or modify
2220; it under the terms of the GNU General Public License as published by
182180; driver needs at least. Tuned messages again.
183181; GNU GPL info (see infradead.org) added here.
184182
183+ ; Version 3.22 14/7/2011 - Jeremy: if error testing umb size don't fall
184+ ; through and do double allocations, 2nd failing
185+
185186; .............................IMPROVEMENT IDEAS.............................
186187
187188
@@ -272,7 +273,6 @@ relenvok: push cs
272273 int 21h
273274 mov [ OldAllocStr at ], ax
274275
275- mov bx , 0ffffh ; max. amount 1 MB if loading LOW
276276 mov bp , 1 ; default: no special UMB link state
277277
278278 test byte [ ModeFlag ], UMBFlag
@@ -284,12 +284,15 @@ relenvok: push cs
284284 ; (4xh is only UMB, 00h is low only)
285285 ; (x0h first, x1h best, x2h last fit)
286286 int 21h
287+ jc lowload ; TODO print message, no UMB available
287288 mov ax , 5802h ; get UMB link state
288289 int 21h
290+ xor ah , ah
289291 mov bp , ax ; store link state (AL is 1 if linked)
290292 mov ax , 5803h ; set UMB link state (!)
291293 mov bx , 1 ; make UMBs part of the DOS mem chain!
292294 int 21h
295+ jc lowload ; assume no UMB available
293296; mov bx,0fffh ; never desire > 64k of UMBs
294297 mov bx , 7fffh ; ask unrealistic size UMB
295298 mov ah , 48h
@@ -303,14 +306,13 @@ relenvok: push cs
303306 mov ax , 5801h ; set new alloc strat: UMB first
304307 mov bx , 80h ; (8xh is try UMB first, low 2nd)
305308 int 21h
306- mov bx , 0ffffh ; ask unrealistic size, 1 MB
307309
308310lowload: ; *** end of added code ***
309311
310312 ; Find out how much memory is available by asking for stupid amounts.
311313
312314 mov ah , 48h
313- ; mov bx,0FFFFh ; now depends on load location
315+ mov bx , 0FFFFh ; ask unrealistic size, 1 MB
314316 int 21h
315317
316318 ; In MS-DOS version 6 and below, this will always fail, but check
@@ -333,6 +335,7 @@ sizeok: mov ah,48h
333335 jnc grablowok
334336
335337 ; *** added because of UMB alloc strat ***
338+ push ax ; store error code for alloc
336339 mov ax , 5801h ; set (here: restore) alloc strat
337340 mov bx ,[ OldAllocStr at ]
338341 mov bh , 0 ; sanitize
@@ -342,6 +345,7 @@ sizeok: mov ah,48h
342345 mov ax , 5803h ; set UMB link state (!)
343346 mov bx , 0 ; remove UMBs from chain again
344347 int 21h
348+ pop ax ; restore error code from alloc
345349keepumbs: ; *** end of added part ***
346350
347351 ; Failed to grab memory - print error and exit.
@@ -1557,13 +1561,13 @@ TooBigMsg db "Error: Driver overflowed memory allocation."
15571561
15581562 ; Error cause messages.
15591563
1564+ Err1 db 'h - invalid request)' , 13 , 10 , 24h
15601565Err2 db 'h - File not found)' , 13 , 10 , 24h
15611566Err3 db "h - Dir not found)" , 13 , 10 , 24h
15621567Err5 db 'h - Access denied)' , 13 , 10 , 24h
15631568Err7 db 'h - MCB bad)' , 13 , 10 , 24h ; MCB destroyed, Arena header bad
15641569Err8 db 'h - Out of memory)' , 13 , 10 , 24h
15651570Err9 db 'h - MCB not found)' , 13 , 10 , 24h
1566- ErrBadFile db 'h - File read error)' , 13 , 10 , 24h
15671571; *** db ' PLEASE INFORM THE AUTHOR!',13,10,24h
15681572; ErrB db 'h - Format invalid)',13,10,24h
15691573 ; FreeDOS only returns error 0b, DE_INVLDFMT, if you
@@ -1574,7 +1578,7 @@ BadSwitchMsg2 db ')',13,10,24h
15741578
15751579
15761580ErrTable dw ErrUnknown ; no error
1577- dw ErrBadFile ; function nr. bad / unsupported
1581+ dw Err1 ; function nr. bad / unsupported
15781582 dw Err2 ; file not found
15791583 dw Err3 ; path / dir not found
15801584 dw ErrUnknown ; <-- too many files open
@@ -1651,11 +1655,11 @@ LASTBYTE equ $
16511655
16521656; ................DATA WHICH ISN'T NEEDED AFTER RELOCATION...................
16531657
1654- SignOnMsg db 'DEVLOAD v3.21 - load DOS device drivers '
1658+ SignOnMsg db 'DEVLOAD v3.22 - load DOS device drivers '
16551659 db '- license' ; db '- free -'
16561660 db ' GNU General Public License 2' , 13 , 10
1657- db '(c) 1992-2008 David Woodhouse [email protected] ' 1658- db 'Eric Auer [email protected] ' , 13 , 10 1661+ db '(c) 1992-2011 David Woodhouse, Eric Auer '
1662+ db '(FreeDOS.org) ' , 13 , 10
16591663 db 13 , 10 , 24h
16601664%if 0
16611665 db 'DEVLOAD v3.21 (C) 1992-1996 David Woodhouse '
@@ -2461,6 +2465,6 @@ BREAKPOINT1: ; ret far ; *** Arrowsoft ASM screws up retf / ret far
24612465; db STACKLEN dup (?)
24622466; SSeg ends
24632467
2464- end ; *** can be Main for .exe version ***
2468+ ; end ; *** can be Main for .exe version ***
24652469
24662470
0 commit comments