Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some BDOS and CCP issues. #200

Merged
merged 5 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 2 additions & 27 deletions apps/ls.asm
Original file line number Diff line number Diff line change
Expand Up @@ -36,35 +36,10 @@ endcondx=tmp+3
.zp pfile, 2
.zp pfile2, 2

.label print_string

start:
.expand 1

ldy #BDOS_GET_CURRENT_DRIVE
jsr BDOS
sta tmp

lda cpm_fcb
beq keepcur

sta tmp
dec tmp \ fcb.dr - 1

keepcur:
lda tmp
ldy #BDOS_SELECT_DRIVE
jsr BDOS

ldy #BDOS_GET_CURRENT_DRIVE
jsr BDOS

cmp tmp
beq success

lda #<error
ldx #>error
jmp print_string \ exits

success:
lda cpm_fcb+1
cmp #' '
bne no_fill_wildcards
Expand Down
26 changes: 25 additions & 1 deletion src/bdos/filesystem.S
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,17 @@ zproc internal_ENDSYS
pha
tya
pha
txa
pha

lda old_fcb_drive
zif_pl
ldy #FCB_DR
sta (param), y ; restore user FCB
zendif

pla
tax
pla
tay
pla
Expand Down Expand Up @@ -1597,10 +1601,22 @@ zproc allocate_unused_block
sta temp+3

zloop
; Bounds check.

lda temp+2
cmp blocks_on_disk+0
bcc not_out_of_bounds

lda temp+3
cmp blocks_on_disk+1
bcs disk_full_error

not_out_of_bounds:
lda temp+2
sta temp+0
lda temp+3
sta temp+1

jsr get_bitmap_status
and #$01
zbreakif_eq
Expand All @@ -1623,6 +1639,15 @@ zproc allocate_unused_block
rts
zendproc

zproc disk_full_error
lda #<1f
ldx #>1f
jmp harderror
1:
.ascii "BDOS: disk full"
.byte 13, 10, 0
zendproc

; Sets a drive as being readonly.

zproc bdos_SETDRIVEREADONLY
Expand Down Expand Up @@ -1818,7 +1843,6 @@ NOINIT
filesystem_state_start:
find_first_count: .byte 0
active_drive: .byte 0 ; drive currently being worked on
old_drive: .byte 0 ; if the drive has been overridden by the FCB
old_fcb_drive: .byte 0 ; drive in user FCB on entry
write_protect_vector: .word 0
login_vector: .word 0
Expand Down
11 changes: 1 addition & 10 deletions src/ccp.S
Original file line number Diff line number Diff line change
Expand Up @@ -386,17 +386,8 @@ zproc entry_DIR
zuntil_mi
zendif

; Set the drive.

ldx userfcb+FCB_DR
dex
zif_mi
ldx drive
zendif
txa
jsr bdos_SELECTDISK

; Find number of files to print per line

jsr set_dirlen

; Start iterating.
Expand Down
Loading