Skip to content

Commit e523336

Browse files
authored
Merge pull request #242 from davidgiven/neo
Fix some more neo6502 BDOS issues.
2 parents f1ca11f + 09c2df5 commit e523336

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

src/arch/neo6502/neo6502.S

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,10 @@ zproc bdos_DELETEFILE
365365
lda #FUNC_FILE_DELETE
366366
jsr neo_file_func_blocking
367367
lda CP_ERRNO
368-
zbreakif ne
368+
zif ne
369+
sec
370+
bra delete_exit
371+
zendif
369372

370373
; Find the next file.
371374

@@ -379,10 +382,7 @@ zproc bdos_DELETEFILE
379382
jsr bdos_FINDNEXT
380383
zuntil cs
381384

382-
; Something went wrong.
383-
384-
sec
385-
bra delete_exit
385+
; Successful exit.
386386

387387
delete_success:
388388
clc
@@ -1204,6 +1204,9 @@ file_table_offsets:
12041204
offset = offset + 1
12051205
.endr
12061206

1207+
; Note that closed files get be preempted in the file table at any point, so if
1208+
; you call get_file_table_entry after this the filename may become overwritten!
1209+
12071210
zproc get_closed_file_table_entry
12081211
jsr get_file_table_entry
12091212

@@ -1226,6 +1229,9 @@ zendproc
12261229
zproc open_file_table_entry
12271230
phx
12281231

1232+
lda ptr+0
1233+
pha
1234+
12291235
stz CP_ERRNO
12301236
lda file_table+FT_ATTRIBS, x
12311237
zif eq
@@ -1235,8 +1241,17 @@ zproc open_file_table_entry
12351241
jsr do_open_file_table_entry
12361242
zendif
12371243

1238-
; Update the LRU list.
1244+
pla
1245+
jsr update_lru_list
1246+
1247+
plx
1248+
rts
1249+
zendproc
12391250

1251+
; Pushes the file index (i.e. the Morpheus file handle) to the head of the LRU list.
1252+
1253+
zproc update_lru_list
1254+
sta ptr+0
12401255
ldx #NUM_FILES-1
12411256
ldy #NUM_FILES-1
12421257
zrepeat
@@ -1250,8 +1265,6 @@ zproc open_file_table_entry
12501265
zuntil mi
12511266
lda ptr+0
12521267
sta file_table_lru
1253-
1254-
plx
12551268
rts
12561269
zendproc
12571270

0 commit comments

Comments
 (0)