Skip to content

Commit fa314db

Browse files
committed
correct location of out of bounds CDS array check (fix LASTDRIVE check)
git-svn-id: http://svn.code.sf.net/p/fdos/code/trunk@139 d9247ac3-808d-4053-b241-f1a6b6229609
1 parent d445ee7 commit fa314db

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

devload.asm

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@
192192
; i.e. what drive letter to assign device
193193
; Set exit # (errorlevel) to drive# assigned
194194

195+
; Version 3.25 05/8/2011 - Jeremy: fix bug where initial CDS not checked,
196+
; adjust return codes to account for char devices
197+
195198
; .............................IMPROVEMENT IDEAS.............................
196199

197200

@@ -560,14 +563,16 @@ noprintladdr: mov ah,52h
560563
mul ah
561564
; loop until free entry is found
562565
CDSinuse:
563-
add bx,ax
564-
test byte [es:bx+44h], 0C0h ; CDS[AX].flags & 0C00h != 0 then drive in use
565-
jz CDSfound
566-
; increment to next CDS entry
567-
inc byte [LastDrUsed]
566+
add bx,ax ; update pointer into CDS array
567+
; check that we don't exceed CDS array bounds (> LASTDRIVE)
568568
mov al,[LastDrive]
569569
cmp al,[LastDrUsed]
570570
jbe nofreeCDS
571+
; test flags (CDS[BX].flags) in current CDS entry to see if in use
572+
test byte [es:bx+44h], 0C0h
573+
jz CDSfound
574+
; increment to next CDS entry
575+
inc byte [LastDrUsed]
571576
mov al,[LDrSize]
572577
cbw
573578
jmp CDSinuse

0 commit comments

Comments
 (0)