rework for the initial CBDOS
This commit is contained in:
1 parent
82729bb621
commit
92d1ad0177
13 files changed
+349
-85
No files matched your search
@@ -33,6 +33,8 @@
|
||||
;; #CONFIG# IEC_JIFFYDOS_BLANK NO
|
||||
;; #CONFIG# IEC_BURST_M65 NO ; please keep disabled for now
|
||||
|
||||
;; #CONFIG# UNIT_SDCARD 20 ; do not change for now
|
||||
|
||||
|
||||
; --- Tape deck configuration
|
||||
|
||||
|
||||
@@ -20,3 +20,7 @@
|
||||
!addr UNIT_SDCARD = $05
|
||||
!addr UNIT_FLOPPY = $06
|
||||
!addr UNIT_RAMDISK = $07
|
||||
|
||||
; General DOS status
|
||||
|
||||
!addr UNIT_HANDLER = $08
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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'
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -7,16 +7,17 @@
|
||||
|
||||
|
||||
!addr VDOS_INIT = $4020 + 0 * 2
|
||||
!addr VDOS_CHKUNIT = $4020 + 1 * 2
|
||||
!addr VDOS_SETUNIT = $4020 + 2 * 2
|
||||
!addr VDOS_ACPTR = $4020 + 3 * 2
|
||||
!addr VDOS_CIOUT = $4020 + 4 * 2
|
||||
!addr VDOS_LISTEN = $4020 + 5 * 2
|
||||
!addr VDOS_SECOND = $4020 + 6 * 2
|
||||
!addr VDOS_TALK = $4020 + 7 * 2
|
||||
!addr VDOS_TKSA = $4020 + 8 * 2
|
||||
!addr VDOS_UNTLK = $4020 + 9 * 2
|
||||
!addr VDOS_UNLSN = $4020 + 10 * 2
|
||||
!addr VDOS_UNITCHK = $4020 + 1 * 2
|
||||
!addr VDOS_UNITSET = $4020 + 2 * 2
|
||||
!addr VDOS_UNITNUM = $4020 + 3 * 2
|
||||
!addr VDOS_ACPTR = $4020 + 4 * 2
|
||||
!addr VDOS_CIOUT = $4020 + 5 * 2
|
||||
!addr VDOS_LISTEN = $4020 + 6 * 2
|
||||
!addr VDOS_SECOND = $4020 + 7 * 2
|
||||
!addr VDOS_TALK = $4020 + 8 * 2
|
||||
!addr VDOS_TKSA = $4020 + 9 * 2
|
||||
!addr VDOS_UNTLK = $4020 + 10 * 2
|
||||
!addr VDOS_UNLSN = $4020 + 11 * 2
|
||||
|
||||
|
||||
m65dos_init:
|
||||
@@ -27,24 +28,34 @@ m65dos_init:
|
||||
jsr (VDOS_INIT)
|
||||
bra m65dos_end_1
|
||||
|
||||
m65dos_chkunit: ; XXX expose to BASIC
|
||||
m65dos_unitchk: ; XXX expose to BASIC
|
||||
|
||||
; Checks is the unit number is supported by the internal DOS
|
||||
; Input: .A - unit number to check
|
||||
; Output: Carry set if not supported, otherwise .A contains unit type (0 = SD card, 1 = internal floppy, 2 = RAM disk)
|
||||
|
||||
jsr map_DOS_1
|
||||
jsr (VDOS_CHKUNIT)
|
||||
jsr (VDOS_UNITCHK)
|
||||
bra m65dos_end_1
|
||||
|
||||
m65dos_setunit: ; XXX expose to BASIC
|
||||
m65dos_unitset: ; XXX expose to BASIC
|
||||
|
||||
; Set the unit number
|
||||
; Input: .A - unit number, .X - unit type (as in m65dos_chkunit)
|
||||
; Input: .X - unit number, .A - unit type (as in m65dos_chkunit)
|
||||
; Output: Carry set means error
|
||||
|
||||
jsr map_DOS_1
|
||||
jsr (VDOS_SETUNIT)
|
||||
jsr (VDOS_UNITSET)
|
||||
bra m65dos_end_1
|
||||
|
||||
m65dos_unitnum: ; XXX expose to BASIC
|
||||
|
||||
; Set the unit number
|
||||
; Input: .A - unit type (as in m65dos_chkunit)
|
||||
; Output: .A - unit number, Carry set means error
|
||||
|
||||
jsr map_DOS_1
|
||||
jsr (VDOS_UNITNUM)
|
||||
bra m65dos_end_1
|
||||
|
||||
m65dos_acptr:
|
||||
|
||||
@@ -12,7 +12,7 @@ m65dos_detect:
|
||||
; Output: Carry set if not supported, if supported IECPROTO isset to IEC_ROMDOS
|
||||
|
||||
pha
|
||||
jsr m65dos_chkunit
|
||||
jsr m65dos_unitchk
|
||||
bcs @1
|
||||
|
||||
lda #IEC_ROMDOS
|
||||
|
||||
@@ -16,8 +16,8 @@ SETFLS:
|
||||
; There are 6 sane ways to implement this routine,
|
||||
; I hope this one will not cause similarity to CBM code
|
||||
|
||||
sta LA
|
||||
sty SA
|
||||
stx FA
|
||||
sta LA ; logical number
|
||||
sty SA ; secondary address
|
||||
stx FA ; unit number
|
||||
|
||||
rts
|
||||
Reference in new issue
Block a user