diff --git a/apps/ls.asm b/apps/ls.asm index d50375a4..878d6927 100644 --- a/apps/ls.asm +++ b/apps/ls.asm @@ -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 - jmp print_string \ exits - -success: lda cpm_fcb+1 cmp #' ' bne no_fill_wildcards diff --git a/src/bdos/filesystem.S b/src/bdos/filesystem.S index 758f438e..00c6d9b0 100644 --- a/src/bdos/filesystem.S +++ b/src/bdos/filesystem.S @@ -55,6 +55,8 @@ zproc internal_ENDSYS pha tya pha + txa + pha lda old_fcb_drive zif_pl @@ -62,6 +64,8 @@ zproc internal_ENDSYS sta (param), y ; restore user FCB zendif + pla + tax pla tay pla @@ -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 @@ -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 @@ -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 diff --git a/src/ccp.S b/src/ccp.S index afc60463..00749063 100644 --- a/src/ccp.S +++ b/src/ccp.S @@ -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.