rework in CBDOS
This commit is contained in:
1 parent
f7ea553ff8
commit
13c6759904
30 files changed
+485
-412
No files matched your search
@@ -13,20 +13,34 @@
|
|||||||
|
|
||||||
!addr MAGICSTR = $8000 ; magic string; if not matching, DOS considered non-functional
|
!addr MAGICSTR = $8000 ; magic string; if not matching, DOS considered non-functional
|
||||||
|
|
||||||
|
; Register storage
|
||||||
|
|
||||||
|
!addr REG_A = $8005
|
||||||
|
!addr REG_X = $8006
|
||||||
|
!addr REG_Y = $8007
|
||||||
|
!addr REG_Z = $8008
|
||||||
|
|
||||||
|
; Reserved: $8009 - $800C
|
||||||
|
|
||||||
; General DOS configuration
|
; General DOS configuration
|
||||||
|
|
||||||
!addr UNIT_SDCARD = $8005 ; unit number for device, 0 = none
|
!addr UNIT_SDCARD = $800D ; unit number for device, 0 = none
|
||||||
!addr UNIT_FLOPPY = $8006 ; as above
|
!addr UNIT_FLOPPY = $800E ; as above
|
||||||
!addr UNIT_RAMDISK = $8007 ; as above
|
!addr UNIT_RAMDISK = $800F ; as above
|
||||||
|
|
||||||
; General DOS status
|
; General DOS status
|
||||||
|
|
||||||
!addr IDX1_LISTENER = $8008 ; listener idx, >=$80 = none
|
!addr IDX1_LISTENER = $8010 ; listener idx, >=$80 = none
|
||||||
!addr IDX2_LISTENER = $8009 ; listener idx * 2, >=$80 = none - for calling routines via vector table
|
!addr IDX2_LISTENER = $8011 ; listener idx * 2, >=$80 = none - for calling routines via vector table
|
||||||
!addr IDX1_TALKER = $800A ; talker idx, >=$80 = none
|
!addr IDX1_TALKER = $8012 ; talker idx, >=$80 = none
|
||||||
!addr IDX2_TALKER = $800B ; talker idx * 2, >=$80 = none - for calling routines via vector table
|
!addr IDX2_TALKER = $8013 ; talker idx * 2, >=$80 = none - for calling routines via vector table
|
||||||
|
|
||||||
; Free space: $800C-$8069
|
; Free space: $8014-$8063
|
||||||
|
|
||||||
|
!addr XX_MODE = $8064 ; current mode (0 = none, 1 = receiving command/file name)
|
||||||
|
!addr SD_MODE = $8064 ; - SD card
|
||||||
|
!addr FD_MODE = $8065 ; - floppy
|
||||||
|
!addr RD_MODE = $8066 ; - ram disk
|
||||||
|
|
||||||
!addr XX_CHANNEL = $8067 ; current channel
|
!addr XX_CHANNEL = $8067 ; current channel
|
||||||
!addr SD_CHANNEL = $8067 ; - SD card
|
!addr SD_CHANNEL = $8067 ; - SD card
|
||||||
|
|||||||
@@ -5,11 +5,11 @@
|
|||||||
!word dos_UNITCHK
|
!word dos_UNITCHK
|
||||||
!word dos_UNITSET
|
!word dos_UNITSET
|
||||||
!word dos_UNITNUM
|
!word dos_UNITNUM
|
||||||
!word dos_ACPTR
|
!word msg_ACPTR
|
||||||
!word dos_CIOUT
|
!word msg_CIOUT
|
||||||
!word dos_LISTEN
|
!word msg_LISTEN
|
||||||
!word dos_SECOND
|
!word msg_SECOND
|
||||||
!word dos_TALK
|
!word msg_TALK
|
||||||
!word dos_TKSA
|
!word msg_TKSA
|
||||||
!word dos_UNTLK
|
!word msg_UNTLK
|
||||||
!word dos_UNLSN
|
!word msg_UNLSN
|
||||||
@@ -8,5 +8,4 @@ dev_fd_cmd_CLOSE:
|
|||||||
|
|
||||||
; XXX provide implementation
|
; XXX provide implementation
|
||||||
|
|
||||||
sec
|
jmp dos_EXIT_SEC
|
||||||
jmp dos_SECOND_done
|
|
||||||
@@ -8,5 +8,4 @@ dev_fd_cmd_OPEN:
|
|||||||
|
|
||||||
; XXX provide implementation
|
; XXX provide implementation
|
||||||
|
|
||||||
sec
|
jmp dos_EXIT_SEC
|
||||||
jmp dos_SECOND_done
|
|
||||||
@@ -11,6 +11,7 @@ dev_fd_init:
|
|||||||
ldx #$00
|
ldx #$00
|
||||||
stx FD_STATUS_IDX
|
stx FD_STATUS_IDX
|
||||||
stx FD_CMDFN_IDX
|
stx FD_CMDFN_IDX
|
||||||
|
stx FD_MODE
|
||||||
dex
|
dex
|
||||||
@1:
|
@1:
|
||||||
inx
|
inx
|
||||||
|
|||||||
@@ -8,5 +8,4 @@ dev_rd_cmd_CLOSE:
|
|||||||
|
|
||||||
; XXX provide implementation
|
; XXX provide implementation
|
||||||
|
|
||||||
sec
|
jmp dos_EXIT_SEC
|
||||||
jmp dos_SECOND_done
|
|
||||||
@@ -8,5 +8,4 @@ dev_rd_cmd_OPEN:
|
|||||||
|
|
||||||
; XXX provide implementation
|
; XXX provide implementation
|
||||||
|
|
||||||
sec
|
jmp dos_EXIT_SEC
|
||||||
jmp dos_SECOND_done
|
|
||||||
@@ -11,6 +11,7 @@ dev_rd_init:
|
|||||||
ldx #$00
|
ldx #$00
|
||||||
stx RD_STATUS_IDX
|
stx RD_STATUS_IDX
|
||||||
stx RD_CMDFN_IDX
|
stx RD_CMDFN_IDX
|
||||||
|
stx RD_MODE
|
||||||
dex
|
dex
|
||||||
@1:
|
@1:
|
||||||
inx
|
inx
|
||||||
|
|||||||
@@ -8,5 +8,4 @@ dev_sd_cmd_CLOSE:
|
|||||||
|
|
||||||
; XXX provide implementation
|
; XXX provide implementation
|
||||||
|
|
||||||
sec
|
jmp dos_EXIT
|
||||||
jmp dos_SECOND_done
|
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
dev_sd_cmd_OPEN:
|
dev_sd_cmd_OPEN:
|
||||||
|
|
||||||
; XXX provide implementation
|
lda #$01 ; mode: receive command or file name
|
||||||
|
sta SD_MODE
|
||||||
|
|
||||||
sec
|
jmp dos_EXIT
|
||||||
jmp dos_SECOND_done
|
|
||||||
@@ -11,6 +11,7 @@ dev_sd_init:
|
|||||||
ldx #$00
|
ldx #$00
|
||||||
stx SD_STATUS_IDX
|
stx SD_STATUS_IDX
|
||||||
stx SD_CMDFN_IDX
|
stx SD_CMDFN_IDX
|
||||||
|
stx SD_MODE
|
||||||
dex
|
dex
|
||||||
@1:
|
@1:
|
||||||
inx
|
inx
|
||||||
|
|||||||
@@ -1,80 +0,0 @@
|
|||||||
|
|
||||||
;
|
|
||||||
; Implementation of ACPTR command. For detailed description see 'm65dos_bridge.s' file.
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
dos_ACPTR: ; does not have to preserve .X
|
|
||||||
|
|
||||||
ldx IDX1_TALKER
|
|
||||||
bmi dos_ACPTR_fail
|
|
||||||
|
|
||||||
lda XX_CHANNEL, X
|
|
||||||
cmp #$0F
|
|
||||||
beq dos_ACPTR_status
|
|
||||||
|
|
||||||
; XXX providde implementation for non-status streams
|
|
||||||
|
|
||||||
jmp dos_ACPTR_fail
|
|
||||||
|
|
||||||
dos_ACPTR_status:
|
|
||||||
|
|
||||||
ldx IDX2_TALKER
|
|
||||||
jsr (dos_ACPTR_getsts_table, X)
|
|
||||||
sta TBTCNT ; byte return
|
|
||||||
beq dos_ACPTR_reset_status
|
|
||||||
|
|
||||||
clc
|
|
||||||
rts
|
|
||||||
|
|
||||||
dos_ACPTR_fail:
|
|
||||||
|
|
||||||
; XXX set error code
|
|
||||||
|
|
||||||
sec
|
|
||||||
rts
|
|
||||||
|
|
||||||
dos_ACPTR_reset_status:
|
|
||||||
|
|
||||||
lda IDX1_TALKER
|
|
||||||
jsr dos_status_00
|
|
||||||
|
|
||||||
; FALLTROUGH
|
|
||||||
|
|
||||||
dos_ACPTR_eoi:
|
|
||||||
|
|
||||||
jsr kernalstatus_EOI
|
|
||||||
|
|
||||||
clc
|
|
||||||
rts
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; Sending bytes from the status string
|
|
||||||
|
|
||||||
dos_ACPTR_getsts_SD: ; get next byte of status - SD card
|
|
||||||
|
|
||||||
ldx SD_STATUS_IDX
|
|
||||||
inc SD_STATUS_IDX
|
|
||||||
lda SD_STATUS_STR,x
|
|
||||||
rts
|
|
||||||
|
|
||||||
dos_ACPTR_getsts_FD: ; get next byte of status - floppy
|
|
||||||
|
|
||||||
ldx FD_STATUS_IDX
|
|
||||||
inc FD_STATUS_IDX
|
|
||||||
lda FD_STATUS_STR,x
|
|
||||||
rts
|
|
||||||
|
|
||||||
dos_ACPTR_getsts_RD: ; get next byte of status - ram disk
|
|
||||||
|
|
||||||
ldx RD_STATUS_IDX
|
|
||||||
inc RD_STATUS_IDX
|
|
||||||
lda RD_STATUS_STR,x
|
|
||||||
rts
|
|
||||||
|
|
||||||
dos_ACPTR_getsts_table:
|
|
||||||
|
|
||||||
!word dos_ACPTR_getsts_SD
|
|
||||||
!word dos_ACPTR_getsts_FD
|
|
||||||
!word dos_ACPTR_getsts_RD
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
|
|
||||||
;
|
|
||||||
; Implementation of ACPTR command. For detailed description see 'm65dos_bridge.s' file.
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
dos_CIOUT:
|
|
||||||
|
|
||||||
pha
|
|
||||||
phx
|
|
||||||
|
|
||||||
; XXX handle cases of transferring data
|
|
||||||
|
|
||||||
; Receive command/file name byte
|
|
||||||
|
|
||||||
ldx IDX2_TALKER
|
|
||||||
jsr (dos_CIOUT_putcmdfn_table, X)
|
|
||||||
|
|
||||||
plx
|
|
||||||
pla
|
|
||||||
|
|
||||||
clc
|
|
||||||
rts
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; Receiving command/file name
|
|
||||||
|
|
||||||
dos_CIOUT_putcmdfn_SD: ; get next byte of status - SD card
|
|
||||||
|
|
||||||
ldx SD_CMDFN_IDX
|
|
||||||
sta SD_CMDFN_IDX,x
|
|
||||||
inx
|
|
||||||
bpl @1
|
|
||||||
ldx #$7F
|
|
||||||
@1:
|
|
||||||
lda #$00
|
|
||||||
sta SD_CMDFN_IDX,x
|
|
||||||
rts
|
|
||||||
|
|
||||||
dos_CIOUT_putcmdfn_FD: ; get next byte of status - floppy
|
|
||||||
|
|
||||||
ldx FD_CMDFN_IDX
|
|
||||||
sta FD_CMDFN_IDX,x
|
|
||||||
inx
|
|
||||||
bpl @1
|
|
||||||
ldx #$7F
|
|
||||||
@1:
|
|
||||||
lda #$00
|
|
||||||
sta FD_CMDFN_IDX,x
|
|
||||||
rts
|
|
||||||
|
|
||||||
dos_CIOUT_putcmdfn_RD: ; get next byte of status - ram disk
|
|
||||||
|
|
||||||
ldx RD_CMDFN_IDX
|
|
||||||
sta RD_CMDFN_IDX,x
|
|
||||||
inx
|
|
||||||
bpl @1
|
|
||||||
ldx #$7F
|
|
||||||
@1:
|
|
||||||
lda #$00
|
|
||||||
sta RD_CMDFN_IDX,x
|
|
||||||
rts
|
|
||||||
|
|
||||||
dos_CIOUT_putcmdfn_table:
|
|
||||||
|
|
||||||
!word dos_CIOUT_putcmdfn_SD
|
|
||||||
!word dos_CIOUT_putcmdfn_FD
|
|
||||||
!word dos_CIOUT_putcmdfn_RD
|
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
|
||||||
|
; Helper routines for entering/exiting the context
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
dos_ENTER: ; enter DOS context
|
||||||
|
|
||||||
|
sta REG_A
|
||||||
|
stx REG_X
|
||||||
|
sty REG_Y
|
||||||
|
stz REG_Z
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
dos_EXIT_SEC: ; exit DOS context with Carry set
|
||||||
|
|
||||||
|
sec
|
||||||
|
bra dos_EXIT_common
|
||||||
|
|
||||||
|
dos_EXIT: ; exit DOS context with Carry clear
|
||||||
|
|
||||||
|
clc
|
||||||
|
|
||||||
|
; FALLTROUGH
|
||||||
|
|
||||||
|
dos_EXIT_common:
|
||||||
|
|
||||||
|
ldz REG_Z
|
||||||
|
ldy REG_Y
|
||||||
|
ldx REG_X
|
||||||
|
lda REG_A
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
dos_EXIT_A_SEC: ; exit DOS context with Carry set, return .A
|
||||||
|
|
||||||
|
sec
|
||||||
|
bra dos_EXIT_A_common
|
||||||
|
|
||||||
|
dos_EXIT_A: ; exit DOS context with Carry clear, return .A
|
||||||
|
|
||||||
|
clc
|
||||||
|
|
||||||
|
; FALLTROUGH
|
||||||
|
|
||||||
|
dos_EXIT_A_common:
|
||||||
|
|
||||||
|
ldz REG_Z
|
||||||
|
ldy REG_Y
|
||||||
|
ldx REG_X
|
||||||
|
|
||||||
|
rts
|
||||||
@@ -12,10 +12,6 @@
|
|||||||
|
|
||||||
dos_status_00: ; OK
|
dos_status_00: ; OK
|
||||||
|
|
||||||
pha
|
|
||||||
phx
|
|
||||||
phy
|
|
||||||
|
|
||||||
; Set status byte pointer to the beginning
|
; Set status byte pointer to the beginning
|
||||||
|
|
||||||
tax
|
tax
|
||||||
@@ -76,11 +72,6 @@ dos_status_00: ; OK
|
|||||||
|
|
||||||
; End
|
; End
|
||||||
|
|
||||||
ply
|
|
||||||
plx
|
|
||||||
pla
|
|
||||||
|
|
||||||
clc ; mark status as OK
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,9 +10,10 @@
|
|||||||
|
|
||||||
dos_INIT:
|
dos_INIT:
|
||||||
|
|
||||||
|
jsr dos_ENTER
|
||||||
|
|
||||||
; Set the magic string 'CBDOS'
|
; Set the magic string 'CBDOS'
|
||||||
|
|
||||||
phx
|
|
||||||
ldx #$04
|
ldx #$04
|
||||||
@1:
|
@1:
|
||||||
lda dos_magicstr, x
|
lda dos_magicstr, x
|
||||||
@@ -20,8 +21,6 @@ dos_INIT:
|
|||||||
dex
|
dex
|
||||||
bpl @1
|
bpl @1
|
||||||
|
|
||||||
plx
|
|
||||||
|
|
||||||
; Set default device numbers
|
; Set default device numbers
|
||||||
|
|
||||||
lda #CONFIG_UNIT_SDCARD
|
lda #CONFIG_UNIT_SDCARD
|
||||||
@@ -45,4 +44,6 @@ dos_INIT:
|
|||||||
jsr dev_fd_init
|
jsr dev_fd_init
|
||||||
jsr dev_rd_init
|
jsr dev_rd_init
|
||||||
|
|
||||||
rts
|
; Exit DOS context
|
||||||
|
|
||||||
|
jmp dos_EXIT
|
||||||
@@ -1,110 +0,0 @@
|
|||||||
|
|
||||||
;
|
|
||||||
; Implementation of LISTEN/UNLSN/TALK/UNTLK commands.
|
|
||||||
; For detailed description see 'm65dos_bridge.s' file.
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
; LISTEN
|
|
||||||
|
|
||||||
dos_LISTEN:
|
|
||||||
|
|
||||||
pha
|
|
||||||
and #$1F
|
|
||||||
beq dos_fail_TALK_LISTEN ; branch if device 0 (used to denote lack of device)
|
|
||||||
|
|
||||||
cmp UNIT_SDCARD
|
|
||||||
bne @1
|
|
||||||
|
|
||||||
lda #$00
|
|
||||||
bra dos_LISTEN_success
|
|
||||||
@1:
|
|
||||||
cmp UNIT_FLOPPY
|
|
||||||
bne @2
|
|
||||||
|
|
||||||
lda #$01
|
|
||||||
bra dos_LISTEN_success
|
|
||||||
@2:
|
|
||||||
cmp UNIT_RAMDISK
|
|
||||||
bne dos_fail_TALK_LISTEN
|
|
||||||
|
|
||||||
lda #$02
|
|
||||||
|
|
||||||
; FALLTROUGH
|
|
||||||
|
|
||||||
dos_LISTEN_success:
|
|
||||||
|
|
||||||
sta IDX1_LISTENER
|
|
||||||
asl
|
|
||||||
sta IDX2_LISTENER
|
|
||||||
|
|
||||||
; XXX should we reset XX_CMDFN_IDX ?
|
|
||||||
|
|
||||||
bra dos_common_LSN_TALK_UN
|
|
||||||
|
|
||||||
; TALK
|
|
||||||
|
|
||||||
dos_TALK:
|
|
||||||
|
|
||||||
pha
|
|
||||||
and #$1F
|
|
||||||
beq dos_fail_TALK_LISTEN ; branch if device 0 (used to denote lack of device)
|
|
||||||
|
|
||||||
cmp UNIT_SDCARD
|
|
||||||
bne @1
|
|
||||||
|
|
||||||
lda #$00
|
|
||||||
bra dos_TALK_success
|
|
||||||
@1:
|
|
||||||
cmp UNIT_FLOPPY
|
|
||||||
bne @2
|
|
||||||
|
|
||||||
lda #$01
|
|
||||||
bra dos_TALK_success
|
|
||||||
@2:
|
|
||||||
cmp UNIT_RAMDISK
|
|
||||||
bne dos_fail_TALK_LISTEN
|
|
||||||
|
|
||||||
lda #$02
|
|
||||||
|
|
||||||
; FALLTROUGH
|
|
||||||
|
|
||||||
dos_TALK_success:
|
|
||||||
|
|
||||||
sta IDX1_TALKER
|
|
||||||
asl
|
|
||||||
sta IDX2_TALKER
|
|
||||||
|
|
||||||
bra dos_common_LSN_TALK_UN
|
|
||||||
|
|
||||||
dos_fail_TALK_LISTEN:
|
|
||||||
|
|
||||||
pla
|
|
||||||
lda #K_ERR_DEVICE_NOT_FOUND
|
|
||||||
sec
|
|
||||||
rts
|
|
||||||
|
|
||||||
; UNLSN / UNTLK
|
|
||||||
|
|
||||||
dos_UNLSN:
|
|
||||||
|
|
||||||
pha
|
|
||||||
lda #$FF
|
|
||||||
sta IDX1_LISTENER
|
|
||||||
sta IDX2_LISTENER
|
|
||||||
bra dos_common_LSN_TALK_UN
|
|
||||||
|
|
||||||
dos_UNTLK:
|
|
||||||
|
|
||||||
pha
|
|
||||||
lda #$FF
|
|
||||||
sta IDX1_TALKER
|
|
||||||
sta IDX2_TALKER
|
|
||||||
|
|
||||||
; FALLTROUGH
|
|
||||||
|
|
||||||
dos_common_LSN_TALK_UN:
|
|
||||||
|
|
||||||
pla
|
|
||||||
clc
|
|
||||||
rts
|
|
||||||
@@ -8,9 +8,6 @@ dos_MEMCHK:
|
|||||||
|
|
||||||
; Check for magic string
|
; Check for magic string
|
||||||
|
|
||||||
pha
|
|
||||||
phx
|
|
||||||
|
|
||||||
ldx #$04
|
ldx #$04
|
||||||
@1:
|
@1:
|
||||||
lda MAGICSTR, x
|
lda MAGICSTR, x
|
||||||
@@ -19,14 +16,10 @@ dos_MEMCHK:
|
|||||||
dex
|
dex
|
||||||
bpl @1
|
bpl @1
|
||||||
|
|
||||||
plx
|
|
||||||
pla
|
|
||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@fail:
|
@fail:
|
||||||
|
|
||||||
plx
|
|
||||||
pla
|
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
|
|
||||||
;
|
|
||||||
; Implementation of SECOND/TKSA commands.
|
|
||||||
; For detailed description see 'm65dos_bridge.s' file.
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
dos_SECOND:
|
|
||||||
|
|
||||||
pha
|
|
||||||
phx
|
|
||||||
phy
|
|
||||||
|
|
||||||
; First store the channel
|
|
||||||
|
|
||||||
tay
|
|
||||||
and #$0F ; support channels 0-15, like 1541 drive
|
|
||||||
|
|
||||||
ldx IDX1_LISTENER
|
|
||||||
bmi dos_SECOND_done ; do nothing if no listener
|
|
||||||
sta XX_CHANNEL, x ; store channel
|
|
||||||
|
|
||||||
; Determine command type
|
|
||||||
|
|
||||||
tya
|
|
||||||
and #$F0
|
|
||||||
|
|
||||||
cmp #$F0
|
|
||||||
beq dos_SECOND_OPEN
|
|
||||||
cmp #$E0
|
|
||||||
beq dos_SECOND_CLOSE
|
|
||||||
|
|
||||||
; XXX provide implementation
|
|
||||||
|
|
||||||
bra dos_SECOND_done
|
|
||||||
|
|
||||||
dos_SECOND_OPEN:
|
|
||||||
|
|
||||||
ldx IDX2_LISTENER
|
|
||||||
jmp (dos_cmd_OPEN_vectable, x)
|
|
||||||
|
|
||||||
dos_SECOND_CLOSE:
|
|
||||||
|
|
||||||
ldx IDX2_LISTENER
|
|
||||||
jmp (dos_cmd_CLOSE_vectable, x)
|
|
||||||
|
|
||||||
dos_SECOND_done:
|
|
||||||
|
|
||||||
ply
|
|
||||||
bra dos_TKSA_done ; reuse part of TKSA code
|
|
||||||
|
|
||||||
|
|
||||||
dos_TKSA:
|
|
||||||
|
|
||||||
pha
|
|
||||||
phx
|
|
||||||
|
|
||||||
and #$0F ; support channels 0-15, like 1541 drive
|
|
||||||
|
|
||||||
ldx IDX1_TALKER
|
|
||||||
bmi dos_TKSA_done ; do nothing if no taalker
|
|
||||||
sta XX_CHANNEL, x ; store channel
|
|
||||||
|
|
||||||
; FALLTROUGH
|
|
||||||
|
|
||||||
dos_TKSA_done:
|
|
||||||
|
|
||||||
plx
|
|
||||||
pla
|
|
||||||
clc
|
|
||||||
rts
|
|
||||||
@@ -6,10 +6,12 @@
|
|||||||
|
|
||||||
dos_UNITCHK:
|
dos_UNITCHK:
|
||||||
|
|
||||||
|
jsr dos_ENTER
|
||||||
|
|
||||||
; Check if memory content is not damaged
|
; Check if memory content is not damaged
|
||||||
|
|
||||||
jsr dos_MEMCHK
|
jsr dos_MEMCHK
|
||||||
bcs dos_UNITCHK_none
|
bcs dos_UNITCHK_fail
|
||||||
|
|
||||||
; Check for unit
|
; Check for unit
|
||||||
|
|
||||||
@@ -22,10 +24,9 @@ dos_UNITCHK:
|
|||||||
|
|
||||||
; FALLTROUGH
|
; FALLTROUGH
|
||||||
|
|
||||||
dos_UNITCHK_none:
|
dos_UNITCHK_fail:
|
||||||
|
|
||||||
sec
|
jmp dos_EXIT_SEC
|
||||||
rts
|
|
||||||
|
|
||||||
dos_UNITCHK_sdcard:
|
dos_UNITCHK_sdcard:
|
||||||
|
|
||||||
@@ -45,12 +46,4 @@ dos_UNITCHK_ramdisk:
|
|||||||
|
|
||||||
lda #$02
|
lda #$02
|
||||||
|
|
||||||
clc
|
jmp dos_EXIT_A
|
||||||
rts
|
|
||||||
|
|
||||||
dos_UNITCHK_mem_fail:
|
|
||||||
|
|
||||||
plx
|
|
||||||
pla
|
|
||||||
sec
|
|
||||||
rts
|
|
||||||
@@ -6,10 +6,13 @@
|
|||||||
|
|
||||||
dos_UNITNUM:
|
dos_UNITNUM:
|
||||||
|
|
||||||
|
jsr dos_ENTER
|
||||||
|
|
||||||
; Check if memory content is not damaged
|
; Check if memory content is not damaged
|
||||||
|
|
||||||
jsr dos_MEMCHK
|
jsr dos_MEMCHK
|
||||||
bcs dos_UNITNUM_none
|
bcs dos_UNITNUM_fail
|
||||||
|
lda REG_A
|
||||||
|
|
||||||
; Check what kind of device was requested
|
; Check what kind of device was requested
|
||||||
|
|
||||||
@@ -22,12 +25,11 @@ dos_UNITNUM:
|
|||||||
|
|
||||||
; FALLTROUGH
|
; FALLTROUGH
|
||||||
|
|
||||||
dos_UNITNUM_none:
|
dos_UNITNUM_fail:
|
||||||
|
|
||||||
lda #$00
|
lda #$00
|
||||||
|
|
||||||
sec
|
jmp dos_EXIT_A_SEC
|
||||||
rts
|
|
||||||
|
|
||||||
dos_UNITNUM_sdcard:
|
dos_UNITNUM_sdcard:
|
||||||
|
|
||||||
@@ -42,13 +44,12 @@ dos_UNITNUM_floppy:
|
|||||||
dos_UNITNUM_ramdisk:
|
dos_UNITNUM_ramdisk:
|
||||||
|
|
||||||
lda UNIT_RAMDISK
|
lda UNIT_RAMDISK
|
||||||
bra dos_UNITNUM_common
|
|
||||||
|
; FALLTROUGH
|
||||||
|
|
||||||
dos_UNITNUM_common:
|
dos_UNITNUM_common:
|
||||||
|
|
||||||
cmp #$00
|
cmp #$00
|
||||||
beq dos_UNITNUM_none
|
beq dos_UNITNUM_fail
|
||||||
|
|
||||||
clc
|
|
||||||
rts
|
|
||||||
|
|
||||||
|
jmp dos_EXIT_A
|
||||||
@@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
dos_UNITSET:
|
dos_UNITSET:
|
||||||
|
|
||||||
|
jsr dos_ENTER
|
||||||
|
|
||||||
; Check if memory content is not damaged
|
; Check if memory content is not damaged
|
||||||
|
|
||||||
jsr dos_MEMCHK
|
jsr dos_MEMCHK
|
||||||
@@ -18,14 +20,13 @@ dos_UNITSET:
|
|||||||
|
|
||||||
cmp #$00
|
cmp #$00
|
||||||
beq dos_UNITSET_sdcard
|
beq dos_UNITSET_sdcard
|
||||||
; XXX devioces below are not implemented yet
|
; XXX devices below are not implemented yet
|
||||||
; cmp #$01
|
; cmp #$01
|
||||||
; beq dos_UNITSET_floppy
|
; beq dos_UNITSET_floppy
|
||||||
; cmp #$02
|
; cmp #$02
|
||||||
; beq dos_UNITSET_ramdisk
|
; beq dos_UNITSET_ramdisk
|
||||||
|
|
||||||
sec
|
jmp dos_EXIT_SEC
|
||||||
rts
|
|
||||||
|
|
||||||
dos_UNITSET_sdcard:
|
dos_UNITSET_sdcard:
|
||||||
|
|
||||||
@@ -45,7 +46,4 @@ dos_UNITSET_ramdisk:
|
|||||||
|
|
||||||
stx UNIT_RAMDISK
|
stx UNIT_RAMDISK
|
||||||
|
|
||||||
; FALLTROUGH
|
jmp dos_EXIT
|
||||||
|
|
||||||
clc
|
|
||||||
rts
|
|
||||||
@@ -4,14 +4,14 @@
|
|||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
dos_cmd_OPEN_vectable:
|
dos_cmd_OPEN_vectab:
|
||||||
|
|
||||||
!word dev_sd_cmd_OPEN
|
!word dev_sd_cmd_OPEN
|
||||||
!word dev_fd_cmd_OPEN
|
!word dev_fd_cmd_OPEN
|
||||||
!word dev_rd_cmd_OPEN
|
!word dev_rd_cmd_OPEN
|
||||||
|
|
||||||
|
|
||||||
dos_cmd_CLOSE_vectable:
|
dos_cmd_CLOSE_vectab:
|
||||||
|
|
||||||
!word dev_sd_cmd_CLOSE
|
!word dev_sd_cmd_CLOSE
|
||||||
!word dev_fd_cmd_CLOSE
|
!word dev_fd_cmd_CLOSE
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
|
||||||
|
;
|
||||||
|
; Implementation of ACPTR command. For detailed description see 'm65dos_bridge.s' file.
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
msg_ACPTR:
|
||||||
|
|
||||||
|
jsr dos_ENTER
|
||||||
|
|
||||||
|
; Check if there is a talker active
|
||||||
|
|
||||||
|
ldx IDX1_TALKER
|
||||||
|
bmi msg_ACPTR_fail
|
||||||
|
|
||||||
|
; Check if active channel is status one
|
||||||
|
|
||||||
|
lda XX_CHANNEL, X
|
||||||
|
cmp #$0F
|
||||||
|
beq msg_ACPTR_status
|
||||||
|
|
||||||
|
; XXX providde implementation for non-status channels
|
||||||
|
|
||||||
|
jmp msg_ACPTR_fail
|
||||||
|
|
||||||
|
msg_ACPTR_status:
|
||||||
|
|
||||||
|
ldx IDX2_TALKER
|
||||||
|
jmp (msg_ACPTR_status_vectab, X)
|
||||||
|
|
||||||
|
msg_ACPTR_status_SD: ; get next byte of status - SD card
|
||||||
|
|
||||||
|
ldx SD_STATUS_IDX
|
||||||
|
inc SD_STATUS_IDX
|
||||||
|
lda SD_STATUS_STR,x
|
||||||
|
bra msg_ACPTR_status_got
|
||||||
|
|
||||||
|
msg_ACPTR_status_FD: ; get next byte of status - floppy
|
||||||
|
|
||||||
|
ldx FD_STATUS_IDX
|
||||||
|
inc FD_STATUS_IDX
|
||||||
|
lda FD_STATUS_STR,x
|
||||||
|
bra msg_ACPTR_status_got
|
||||||
|
|
||||||
|
msg_ACPTR_status_RD: ; get next byte of status - ram disk
|
||||||
|
|
||||||
|
ldx RD_STATUS_IDX
|
||||||
|
inc RD_STATUS_IDX
|
||||||
|
lda RD_STATUS_STR,x
|
||||||
|
|
||||||
|
; FALLTROUGH
|
||||||
|
|
||||||
|
msg_ACPTR_status_got:
|
||||||
|
|
||||||
|
sta TBTCNT ; byte return
|
||||||
|
beq msg_ACPTR_reset_status
|
||||||
|
|
||||||
|
jmp dos_EXIT
|
||||||
|
|
||||||
|
msg_ACPTR_fail:
|
||||||
|
|
||||||
|
; XXX set error code
|
||||||
|
|
||||||
|
jmp dos_EXIT_SEC
|
||||||
|
|
||||||
|
msg_ACPTR_reset_status:
|
||||||
|
|
||||||
|
lda IDX1_TALKER
|
||||||
|
jsr dos_status_00
|
||||||
|
|
||||||
|
; FALLTROUGH
|
||||||
|
|
||||||
|
msg_ACPTR_eoi:
|
||||||
|
|
||||||
|
jsr kernalstatus_EOI
|
||||||
|
jmp dos_EXIT_SEC
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; Vector tables for jumps
|
||||||
|
|
||||||
|
msg_ACPTR_status_vectab:
|
||||||
|
|
||||||
|
!word msg_ACPTR_status_SD
|
||||||
|
!word msg_ACPTR_status_FD
|
||||||
|
!word msg_ACPTR_status_RD
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
|
||||||
|
;
|
||||||
|
; Implementation of ACPTR command. For detailed description see 'm65dos_bridge.s' file.
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
msg_CIOUT:
|
||||||
|
|
||||||
|
jsr dos_ENTER
|
||||||
|
|
||||||
|
; Check operation mode
|
||||||
|
|
||||||
|
ldx IDX1_LISTENER
|
||||||
|
lda XX_MODE, x
|
||||||
|
|
||||||
|
cmp #$01
|
||||||
|
bne @1
|
||||||
|
|
||||||
|
; Receiving command or file name
|
||||||
|
|
||||||
|
ldx IDX2_TALKER
|
||||||
|
jmp (msg_CIOUT_cmdfn_vectab, X)
|
||||||
|
@1:
|
||||||
|
; XXX handle cases of transferring data
|
||||||
|
|
||||||
|
jmp dos_EXIT_SEC
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; Receiving command/file name
|
||||||
|
|
||||||
|
msg_CIOUT_cmdfn_SD: ; get next byte of status - SD card
|
||||||
|
|
||||||
|
ldx SD_CMDFN_IDX
|
||||||
|
sta SD_CMDFN_IDX,x
|
||||||
|
inx
|
||||||
|
bpl @1
|
||||||
|
ldx #$7F
|
||||||
|
@1:
|
||||||
|
lda #$00
|
||||||
|
sta SD_CMDFN_IDX,x
|
||||||
|
jmp dos_EXIT
|
||||||
|
|
||||||
|
msg_CIOUT_cmdfn_FD: ; get next byte of status - floppy
|
||||||
|
|
||||||
|
ldx FD_CMDFN_IDX
|
||||||
|
sta FD_CMDFN_IDX,x
|
||||||
|
inx
|
||||||
|
bpl @1
|
||||||
|
ldx #$7F
|
||||||
|
@1:
|
||||||
|
lda #$00
|
||||||
|
sta FD_CMDFN_IDX,x
|
||||||
|
jmp dos_EXIT
|
||||||
|
|
||||||
|
msg_CIOUT_cmdfn_RD: ; get next byte of status - ram disk
|
||||||
|
|
||||||
|
ldx RD_CMDFN_IDX
|
||||||
|
sta RD_CMDFN_IDX,x
|
||||||
|
inx
|
||||||
|
bpl @1
|
||||||
|
ldx #$7F
|
||||||
|
@1:
|
||||||
|
lda #$00
|
||||||
|
sta RD_CMDFN_IDX,x
|
||||||
|
jmp dos_EXIT
|
||||||
|
|
||||||
|
msg_CIOUT_cmdfn_vectab:
|
||||||
|
|
||||||
|
!word msg_CIOUT_cmdfn_SD
|
||||||
|
!word msg_CIOUT_cmdfn_FD
|
||||||
|
!word msg_CIOUT_cmdfn_RD
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
|
||||||
|
;
|
||||||
|
; Implementation of LISTEN commands.
|
||||||
|
; For detailed description see 'm65dos_bridge.s' file.
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
msg_LISTEN:
|
||||||
|
|
||||||
|
jsr dos_ENTER
|
||||||
|
|
||||||
|
and #$1F
|
||||||
|
beq msg_LISTEN_fail ; branch if device 0 (used to denote lack of device)
|
||||||
|
|
||||||
|
cmp UNIT_SDCARD
|
||||||
|
bne @1
|
||||||
|
|
||||||
|
; LISTEN on SD card
|
||||||
|
|
||||||
|
lda #$00
|
||||||
|
bra msg_LISTEN_success
|
||||||
|
@1:
|
||||||
|
cmp UNIT_FLOPPY
|
||||||
|
bne @2
|
||||||
|
|
||||||
|
; LISTEN on floppy
|
||||||
|
|
||||||
|
lda #$01
|
||||||
|
bra msg_LISTEN_success
|
||||||
|
@2:
|
||||||
|
cmp UNIT_RAMDISK
|
||||||
|
bne msg_LISTEN_fail
|
||||||
|
|
||||||
|
; LISTEN on ram disk
|
||||||
|
|
||||||
|
lda #$02
|
||||||
|
|
||||||
|
; FALLTROUGH
|
||||||
|
|
||||||
|
msg_LISTEN_success:
|
||||||
|
|
||||||
|
sta IDX1_LISTENER
|
||||||
|
asl
|
||||||
|
sta IDX2_LISTENER
|
||||||
|
|
||||||
|
; XXX should we reset XX_CMDFN_IDX ?
|
||||||
|
|
||||||
|
jmp dos_EXIT
|
||||||
|
|
||||||
|
msg_LISTEN_fail:
|
||||||
|
|
||||||
|
lda #K_ERR_DEVICE_NOT_FOUND
|
||||||
|
|
||||||
|
jmp dos_EXIT_A_SEC
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
|
||||||
|
;
|
||||||
|
; Implementation of SECOND command.
|
||||||
|
; For detailed description see 'm65dos_bridge.s' file.
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
msg_SECOND:
|
||||||
|
|
||||||
|
jsr dos_ENTER
|
||||||
|
|
||||||
|
; First store the channel
|
||||||
|
|
||||||
|
tay
|
||||||
|
and #$0F ; support channels 0-15, like 1541 drive
|
||||||
|
|
||||||
|
ldx IDX1_LISTENER
|
||||||
|
bmi msg_SECOND_done ; do nothing if no listener
|
||||||
|
sta XX_CHANNEL, x ; store channel
|
||||||
|
|
||||||
|
; Determine command type
|
||||||
|
|
||||||
|
tya
|
||||||
|
and #$F0
|
||||||
|
|
||||||
|
cmp #$F0
|
||||||
|
beq msg_SECOND_OPEN
|
||||||
|
cmp #$E0
|
||||||
|
beq msg_SECOND_CLOSE
|
||||||
|
|
||||||
|
; XXX provide implementation
|
||||||
|
|
||||||
|
; FALLTROUGH
|
||||||
|
|
||||||
|
msg_SECOND_done:
|
||||||
|
|
||||||
|
jmp dos_EXIT
|
||||||
|
|
||||||
|
msg_SECOND_OPEN:
|
||||||
|
|
||||||
|
lda #$00
|
||||||
|
sta XX_CMDFN_IDX, x ; reset the index to the command/filename
|
||||||
|
ldx IDX2_LISTENER
|
||||||
|
jmp (dos_cmd_OPEN_vectab, x)
|
||||||
|
|
||||||
|
msg_SECOND_CLOSE:
|
||||||
|
|
||||||
|
ldx IDX2_LISTENER
|
||||||
|
jmp (dos_cmd_CLOSE_vectab, x)
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
|
||||||
|
;
|
||||||
|
; Implementation of TALK commands.
|
||||||
|
; For detailed description see 'm65dos_bridge.s' file.
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
msg_TALK:
|
||||||
|
|
||||||
|
jsr dos_ENTER
|
||||||
|
|
||||||
|
and #$1F
|
||||||
|
beq msg_TALK_fail ; branch if device 0 (used to denote lack of device)
|
||||||
|
|
||||||
|
cmp UNIT_SDCARD
|
||||||
|
bne @1
|
||||||
|
|
||||||
|
; TALK on SD card
|
||||||
|
|
||||||
|
lda #$00
|
||||||
|
bra msg_TALK_success
|
||||||
|
@1:
|
||||||
|
cmp UNIT_FLOPPY
|
||||||
|
bne @2
|
||||||
|
|
||||||
|
; TALK on floppy
|
||||||
|
|
||||||
|
lda #$01
|
||||||
|
bra msg_TALK_success
|
||||||
|
@2:
|
||||||
|
cmp UNIT_RAMDISK
|
||||||
|
bne msg_TALK_fail
|
||||||
|
|
||||||
|
; TALK on ram disk
|
||||||
|
|
||||||
|
lda #$02
|
||||||
|
|
||||||
|
; FALLTROUGH
|
||||||
|
|
||||||
|
msg_TALK_success:
|
||||||
|
|
||||||
|
sta IDX1_TALKER
|
||||||
|
asl
|
||||||
|
sta IDX2_TALKER
|
||||||
|
|
||||||
|
jmp dos_EXIT
|
||||||
|
|
||||||
|
msg_TALK_fail:
|
||||||
|
|
||||||
|
lda #K_ERR_DEVICE_NOT_FOUND
|
||||||
|
|
||||||
|
jmp dos_EXIT_A_SEC
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
;
|
||||||
|
; Implementation of TKSA commands.
|
||||||
|
; For detailed description see 'm65dos_bridge.s' file.
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
msg_TKSA:
|
||||||
|
|
||||||
|
jsr dos_ENTER
|
||||||
|
|
||||||
|
and #$0F ; support channels 0-15, like 1541 drive
|
||||||
|
|
||||||
|
ldx IDX1_TALKER
|
||||||
|
bmi msg_TKSA_done ; do nothing if no taalker
|
||||||
|
sta XX_CHANNEL, x ; store channel
|
||||||
|
|
||||||
|
; FALLTROUGH
|
||||||
|
|
||||||
|
msg_TKSA_done:
|
||||||
|
|
||||||
|
jmp dos_EXIT
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
;
|
||||||
|
; Implementation of UNLSN/UNTLK messages.
|
||||||
|
; For detailed description see 'm65dos_bridge.s' file.
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
msg_UNLSN:
|
||||||
|
|
||||||
|
jsr dos_ENTER
|
||||||
|
|
||||||
|
lda #$FF
|
||||||
|
sta IDX1_LISTENER
|
||||||
|
sta IDX2_LISTENER
|
||||||
|
|
||||||
|
jmp dos_EXIT
|
||||||
|
|
||||||
|
msg_UNTLK:
|
||||||
|
|
||||||
|
jsr dos_ENTER
|
||||||
|
|
||||||
|
sta IDX1_TALKER
|
||||||
|
sta IDX2_TALKER
|
||||||
|
|
||||||
|
jmp dos_EXIT
|
||||||
Reference in new issue
Block a user