rework for the initial CBDOS

This commit is contained in:
FeralChild64 committed 2021-02-03 16:05:07 +01:00
1 parent 82729bb621
commit 92d1ad0177
13 files changed
+349 -85

No files matched your search

+4
View File
@@ -20,3 +20,7 @@
!addr UNIT_SDCARD = $05
!addr UNIT_FLOPPY = $06
!addr UNIT_RAMDISK = $07
; General DOS status
!addr UNIT_HANDLER = $08
+3 -2
View File
@@ -2,8 +2,9 @@
; A vector table to integrate DOS with the MEGA65 Kernal
!word dos_INIT
!word dos_CHKUNIT
!word dos_SETUNIT
!word dos_UNITCHK
!word dos_UNITSET
!word dos_UNITNUM
!word dos_ACPTR
!word dos_CIOUT
!word dos_LISTEN
+156
View File
@@ -0,0 +1,156 @@
;
; DOS error codes and strings
;
; XXX get rid of unnecessary error messages
dos_err_init_sdcard:
!pet "m65 dos sdcard", 0
dos_err_init_floppy:
!pet "m65 dos floppy", 0
dos_err_init_ramdisk:
!pet "m65 dos ram disk", 0
; List compiled from various manuals (CBM 1571, CBM 1581, CMD FD4000, MSD Super Disk, IDE64)
dos_err_00: ; not an error
!pet "ok", 0
dos_err_01: ; not an error
!pet "files scratched", 0
dos_err_02: ; not an error
!pet "partition selected", 0
dos_err_20: ; header not found
dos_err_21: ; no data addres mark
dos_err_22: ; block not found
dos_err_23: ; data error
dos_err_27: ; header error
!pet "read error", 0
dos_err_25:
!pet "write error", 0
dos_err_26:
!pet "write protect on", 0
dos_err_29:
!pet "disk changed", 0
dos_err_30: ; invalid characters in command
dos_err_31: ; unrecognized command
dos_err_32: ; command too long
dos_err_33: ; illegal file name
dos_err_34: ; missing file name
!pet "syntax error", 0
dos_err_39:
!pet "file not found", 0
dos_err_49: ; disk formatted, but format not supported
!pet "invalid format", 0
dos_err_50:
!pet "record not present", 0
dos_err_51:
!pet "overflow in record", 0
dos_err_52:
!pet "file too large", 0
dos_err_60:
!pet "write file open", 0
dos_err_61:
!pet "file not open", 0
dos_err_62:
!pet "file not found", 0
dos_err_63:
!pet "file exists", 0
dos_err_64:
!pet "file type mismatch", 0
dos_err_65:
!pet "no block", 0
dos_err_66:
!pet "illegal track and sector", 0
dos_err_67:
!pet "illegal system t or s", 0
dos_err_70:
!pet "no channel", 0
dos_err_71:
!pet "directory error", 0
dos_err_72:
!pet "partition full", 0
dos_err_73:
!pet "dos mismatch", 0
dos_err_74:
!pet "drive not ready", 0
dos_err_75:
!pet "format error", 0
dos_err_76:
!pet "controller error", 0
dos_err_77:
!pet "selected partition illegal", 0
dos_err_78:
!pet "system error", 0
dos_err_79: ; SD2IEC compatible
!pet "image invalid", 0
+5
View File
@@ -3,6 +3,11 @@
; Initializes DOS. For detailed description see 'm65dos_bridge.s' file
;
!set CONFIG_UNIT_FLOPPY = 0 ; XXX floppy not supported yet
!set CONFIG_UNIT_RAMDISK = 0 ; XXX RAM disk not supported yet
dos_INIT:
; Set the magic string 'CBDOS'
+32
View File
@@ -0,0 +1,32 @@
;
; Check if DOS memory is not overwritten
;
dos_MEMCHK:
; Check for magic string
pha
phx
ldx #$04
@1:
lda MAGICSTR, x
cmp dos_magicstr, x
bne @fail
dex
bpl @1
plx
pla
clc
rts
@fail:
plx
pla
sec
rts
-42
View File
@@ -1,42 +0,0 @@
;
; Unit number handling. For detailed description see 'm65dos_bridge.s' file
;
dos_SETUNIT:
; XXX check if .X is valid
cmp #$00
beq dos_SETUNIT_sdcard
cmp #$01
beq dos_SETUNIT_floppy
cmp #$02
beq dos_SETUNIT_ramdisk
sec
rts
dos_SETUNIT_sdcard:
stx UNIT_SDCARD
+skip_2_bytes_trash_nvz
; FALLTROUGH
dos_SETUNIT_floppy:
stx UNIT_FLOPPY
+skip_2_bytes_trash_nvz
; FALLTROUGH
dos_SETUNIT_ramdisk:
stx UNIT_RAMDISK
; FALLTROUGH
clc
rts
@@ -4,58 +4,51 @@
;
dos_CHKUNIT:
dos_UNITCHK:
; Check for magic string
; Check if memory content is not damaged
pha
phx
ldx #$04
@1:
lda MAGICSTR, x
cmp dos_magicstr, x
bne dos_CHKUNIT_mem_fail
dex
bpl @1
plx
pla
jsr dos_MEMCHK
bcs dos_UNITCHK_none
; Check for unit
cmp UNIT_SDCARD
beq dos_CHKUNIT_sdcard
beq dos_UNITCHK_sdcard
cmp UNIT_FLOPPY
beq dos_CHKUNIT_floppy
beq dos_UNITCHK_floppy
cmp UNIT_RAMDISK
beq dos_CHKUNIT_ramdisk
beq dos_UNITCHK_ramdisk
; FALLTROUGH
dos_UNITCHK_none:
sec
rts
dos_CHKUNIT_sdcard:
dos_UNITCHK_sdcard:
lda #$00
+skip_2_bytes_trash_nvz
; FALLTROUGH
dos_CHKUNIT_floppy:
dos_UNITCHK_floppy:
lda #$01
+skip_2_bytes_trash_nvz
; FALLTROUGH
dos_CHKUNIT_ramdisk:
dos_UNITCHK_ramdisk:
lda #$02
clc
rts
dos_CHKUNIT_mem_fail:
dos_UNITCHK_mem_fail:
plx
pla
+53
View File
@@ -0,0 +1,53 @@
;
; Unit number handling. For detailed description see 'm65dos_bridge.s' file
;
dos_UNITNUM:
; Check if memory content is not damaged
jsr dos_MEMCHK
bcs dos_UNITNUM_none
; Check what kind of device was requested
cmp #$00
beq dos_UNITNUM_sdcard
cmp #$01
beq dos_UNITNUM_floppy
cmp #$02
beq dos_UNITNUM_ramdisk
lda #$00
; FALLTROUGH
dos_UNITNUM_none:
sec
rts
dos_UNITNUM_sdcard:
lda UNIT_SDCARD
+skip_2_bytes_trash_nvz
dos_UNITNUM_floppy:
lda UNIT_FLOPPY
+skip_2_bytes_trash_nvz
dos_UNITNUM_ramdisk:
lda UNIT_RAMDISK
cmp #$00
beq dos_UNITNUM_none
clc
rts
+49
View File
@@ -0,0 +1,49 @@
;
; Unit number handling. For detailed description see 'm65dos_bridge.s' file
;
dos_UNITSET:
; Check if memory content is not damaged
jsr dos_MEMCHK
bcc @1
rts
@1:
; Check what kind of device was requested
cmp #$00
beq dos_UNITSET_sdcard
; XXX devioces below are not implemented yet
; cmp #$01
; beq dos_UNITSET_floppy
; cmp #$02
; beq dos_UNITSET_ramdisk
sec
rts
dos_UNITSET_sdcard:
stx UNIT_SDCARD
+skip_2_bytes_trash_nvz
; FALLTROUGH
dos_UNITSET_floppy:
stx UNIT_FLOPPY
+skip_2_bytes_trash_nvz
; FALLTROUGH
dos_UNITSET_ramdisk:
stx UNIT_RAMDISK
; FALLTROUGH
clc
rts