Skip to content

Commit

Permalink
Fix critical bug in sys_ClearDeviceTable
Browse files Browse the repository at this point in the history
  • Loading branch information
beckadamtheinventor committed Oct 20, 2024
1 parent f932259 commit 85f8a78
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion bos.inc
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ macro device_file? flags, type, version, intsource
end repeat
macro export? jumpno, function
if function > 0
store $C9: byte at $$+jumpno
store $C3: byte at $$+jumpno
store function: 3 at $$+jumpno+1
end if
end macro
Expand Down
2 changes: 1 addition & 1 deletion build_bos_inc.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def build_bos_inc():
end repeat
macro export? jumpno, function
if function > 0
store $C9: byte at $$+jumpno
store $C3: byte at $$+jumpno
store function: 3 at $$+jumpno+1
end if
end macro
Expand Down
2 changes: 1 addition & 1 deletion src/data/adrive/src/fs/bin/include/bos.inc
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ macro device_file? flags, type, version, intsource
end repeat
macro export? jumpno, function
if function > 0
store $C9: byte at $$+jumpno
store $C3: byte at $$+jumpno
store function: 3 at $$+jumpno+1
end if
end macro
Expand Down
2 changes: 1 addition & 1 deletion src/data/adrive/src/fs/lib/include/bos.inc
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ macro device_file? flags, type, version, intsource
end repeat
macro export? jumpno, function
if function > 0
store $C9: byte at $$+jumpno
store $C3: byte at $$+jumpno
store function: 3 at $$+jumpno+1
end if
end macro
Expand Down
2 changes: 1 addition & 1 deletion src/data/buildno.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.19.2000 alpha
1.19.2100 alpha
2 changes: 1 addition & 1 deletion src/include/bos.inc
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ macro device_file? flags, type, version, intsource
end repeat
macro export? jumpno, function
if function > 0
store $C9: byte at $$+jumpno
store $C3: byte at $$+jumpno
store function: 3 at $$+jumpno+1
end if
end macro
Expand Down
2 changes: 1 addition & 1 deletion src/sys/AppendDeviceTable.asm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ sys_AppendDeviceTable:
.entryhl:
push iy
ld iy,open_device_table
ld b,open_device_table.len / 4 - 1
ld b,open_device_table.len / 4
.check_next:
ld a,(iy)
or a,a
Expand Down
19 changes: 12 additions & 7 deletions src/sys/ClearDeviceTable.asm
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,24 @@
;@NOTE Each device table entry is 4 bytes. 1 byte flags, 3 byte file descriptor.
sys_ClearDeviceTable:
push iy
ld iy,open_device_table
ld b,open_device_table.len / 4 - 1
ld iy,open_device_table-4
ld b,open_device_table.len / 4
.loop:
lea iy,iy+4
ld a,(iy)
or a,a
jr nz,.close_dev
lea iy,iy+4
.next:
djnz .loop
pop iy
ret
.close_dev:
push iy
ld hl,(iy+1)
push iy,bc
ld de,(iy+1)
sbc hl,hl
ld (iy),l
ld (iy+1),hl
ex hl,de
call drv_DeinitDevice.entryhl
pop iy
jr .loop
pop bc,iy
jr .next
2 changes: 1 addition & 1 deletion src/sys/SearchDeviceTable.asm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sys_SearchDeviceTable:
.entryhl:
push iy
ld iy,open_device_table
ld b,open_device_table.len / 4 - 1
ld b,open_device_table.len / 4
.check_loop:
ld a,(iy)
ld de,(iy+1)
Expand Down

0 comments on commit 85f8a78

Please sign in to comment.