|
2 | 2 |
|
3 | 3 | ; TITLE DEVLOAD to load device drivers from command line. |
4 | 4 | ; FORMAT COM |
5 | | -; VERSION 3.22 |
| 5 | +; VERSION 3.23 |
6 | 6 | ; CODE 80x86 |
7 | 7 | ; BUILD NASM -o devload.com in 3.21/newer *** |
8 | 8 | ; AUTHOR David Woodhouse |
|
183 | 183 | ; Version 3.22 14/7/2011 - Jeremy: if error testing umb size don't fall |
184 | 184 | ; through and do double allocations, 2nd failing |
185 | 185 |
|
| 186 | +; Version 3.23 02/8/2011 - Jeremy: don't overwrite CDS in use by non-block |
| 187 | +; driver |
| 188 | + |
186 | 189 | ; .............................IMPROVEMENT IDEAS............................. |
187 | 190 |
|
188 | 191 |
|
@@ -527,10 +530,36 @@ noprintladdr: mov ah,52h |
527 | 530 |
|
528 | 531 | ; DS:TopCSeg, ES:InvarSeg |
529 | 532 |
|
530 | | - ; Fetch LastDrUsed and LastDrive from 'invar' (list of lists) |
| 533 | + ; Fetch nBlkDev and LastDrive from 'invar' (list of lists) |
531 | 534 |
|
532 | 535 | mov ax,[es:bx+20h] |
533 | | - mov word [LastDrUsed],ax |
| 536 | + mov word [nBlkDev],ax ; *** updates nBlkDev & LastDrive |
| 537 | + |
| 538 | + ; Determine 1st free CDS entry |
| 539 | + push bx |
| 540 | + push es |
| 541 | + |
| 542 | + ; Get pointer to LASTDRIVE array (Current Directory Structure - CDS). |
| 543 | + les bx,[es:bx+16h] |
| 544 | + |
| 545 | + ; Calculate offset in CDS array of next free entry (>= current # of block devices) |
| 546 | + dec al ; AX set earlier to nBlkDev, -1 for zero based |
| 547 | + mov [LastDrUsed], al ; default to assume only block drivers have CDS entry |
| 548 | + mov ah,[LDrSize] |
| 549 | + mul ah |
| 550 | + ; loop until free entry is found |
| 551 | +CDSinuse: |
| 552 | + add bx,ax |
| 553 | + inc byte [LastDrUsed] |
| 554 | + test byte [es:bx+44h], 0C0h ; CDS[AX].flags & 0C00h != 0 then drive in use |
| 555 | + jz CDSfound |
| 556 | + ; increment to next CDS entry |
| 557 | + mov al,[LDrSize] |
| 558 | + cbw |
| 559 | + jmp CDSinuse |
| 560 | +CDSfound: |
| 561 | + pop es |
| 562 | + pop bx |
534 | 563 |
|
535 | 564 | ; Fetch max. sector size from 'invar' (list of lists) |
536 | 565 |
|
@@ -765,11 +794,11 @@ noblocks: mov bl,[CharsDone] |
765 | 794 | inc dx |
766 | 795 | chnoplural: int 21h |
767 | 796 |
|
768 | | - ; Insert new LastDrUsed into 'invar'. (list of lists) |
| 797 | + ; Insert new nBlkDev into 'invar'. (list of lists) |
769 | 798 |
|
770 | 799 | noprintnuminst: les bx,[Invar] |
771 | 800 |
|
772 | | - mov al,[LastDrUsed] |
| 801 | + mov al,[nBlkDev] |
773 | 802 | mov byte [es:bx+20h],al |
774 | 803 |
|
775 | 804 | ; Restore driver size in paragraphs. |
@@ -1303,9 +1332,9 @@ secsizeok: mov al,[cs:LastDrUsed] |
1303 | 1332 | jnz ldrok |
1304 | 1333 | jmp ldrerr |
1305 | 1334 |
|
1306 | | - ; Increase LastDrUsed. |
| 1335 | + ; Increase nBlkDev. |
1307 | 1336 |
|
1308 | | -ldrok: inc byte [cs:LastDrUsed] |
| 1337 | +ldrok: inc byte [cs:nBlkDev] |
1309 | 1338 |
|
1310 | 1339 | ; Store absolute block no. and block no. in device. |
1311 | 1340 |
|
@@ -1615,6 +1644,7 @@ EmptyPath dw 0 |
1615 | 1644 |
|
1616 | 1645 | NameBuffer times 80h db 0 ; resb 80h |
1617 | 1646 | |
| 1647 | +nBlkDev db 0 ; resb 1 |
1618 | 1648 | LastDrUsed db 0 ; resb 1 |
1619 | 1649 | LastDrive db 0 ; resb 1 |
1620 | 1650 |
|
@@ -1655,7 +1685,7 @@ LASTBYTE equ $ |
1655 | 1685 |
|
1656 | 1686 | ; ................DATA WHICH ISN'T NEEDED AFTER RELOCATION................... |
1657 | 1687 |
|
1658 | | -SignOnMsg db 'DEVLOAD v3.22 - load DOS device drivers ' |
| 1688 | +SignOnMsg db 'DEVLOAD v3.23 - load DOS device drivers ' |
1659 | 1689 | db '- license' ; db '- free -' |
1660 | 1690 | db ' GNU General Public License 2',13,10 |
1661 | 1691 | db '(c) 1992-2011 David Woodhouse, Eric Auer ' |
|
0 commit comments