various IEC and DOS wedge fixes
This commit is contained in:
1 parent
431e5384a2
commit
fea097e795
4 files changed
+33
-28
No files matched your search
+25
-20
@@ -18,9 +18,6 @@ wedge_dos:
|
|||||||
ldy #$00
|
ldy #$00
|
||||||
lda (basic_current_statement_ptr), y
|
lda (basic_current_statement_ptr), y
|
||||||
beq wedge_dos_status
|
beq wedge_dos_status
|
||||||
cmp #$20
|
|
||||||
beq wedge_dos_status
|
|
||||||
;; XXX consider SYNTAX ERROR if anything besides spaces is there
|
|
||||||
|
|
||||||
;; Check if asked for a directory
|
;; Check if asked for a directory
|
||||||
cmp #$24
|
cmp #$24
|
||||||
@@ -28,15 +25,14 @@ wedge_dos:
|
|||||||
*
|
*
|
||||||
;; Check if asked to change drive number, or if it is a regular command
|
;; Check if asked to change drive number, or if it is a regular command
|
||||||
cmp #$30
|
cmp #$30
|
||||||
bmi wedge_dos_command ; char code before 0
|
bcc wedge_dos_command ; char code before 0
|
||||||
cmp #$3A
|
cmp #$3A
|
||||||
bpl wedge_dos_command ; char code after 9
|
bcs wedge_dos_command ; char code after 9
|
||||||
iny
|
iny
|
||||||
lda (basic_current_statement_ptr), y
|
lda (basic_current_statement_ptr), y
|
||||||
beq wedge_dos_change_drive ; end of buffer
|
beq wedge_dos_change_drive ; end of buffer
|
||||||
cmp #$20
|
cmp #$20
|
||||||
beq wedge_dos_change_drive
|
beq wedge_dos_change_drive
|
||||||
;; XXX consider SYNTAX ERROR if anything besides spaces is there
|
|
||||||
jmp -
|
jmp -
|
||||||
|
|
||||||
wedge_dos_command:
|
wedge_dos_command:
|
||||||
@@ -45,24 +41,27 @@ wedge_dos_command:
|
|||||||
lda #$00 ; empty file name
|
lda #$00 ; empty file name
|
||||||
jsr JSETNAM
|
jsr JSETNAM
|
||||||
jsr via_IOPEN
|
jsr via_IOPEN
|
||||||
bcc +
|
bcs wedge_dos_basic_error
|
||||||
jmp do_DEVICE_NOT_PRESENT_error
|
|
||||||
*
|
*
|
||||||
;; Set channel for output
|
;; Set channel for output
|
||||||
ldx #$0F
|
ldx #$0F
|
||||||
jsr via_ICKOUT
|
jsr via_ICKOUT
|
||||||
*
|
bcs wedge_dos_basic_error
|
||||||
jsr JREADST ; retrieve errors
|
|
||||||
;; XXX error in case of status != 0
|
|
||||||
*
|
*
|
||||||
;; XXX this loop does not seem to work, check it
|
|
||||||
jsr basic_fetch_and_consume_character
|
jsr basic_fetch_and_consume_character
|
||||||
|
cmp #$00
|
||||||
beq +
|
beq +
|
||||||
|
|
||||||
jsr via_IBSOUT
|
jsr via_IBSOUT
|
||||||
;; XXX check errors here
|
bcs wedge_dos_basic_error
|
||||||
jmp -
|
jmp -
|
||||||
*
|
*
|
||||||
;; XXX check status - print it if not OK
|
;; Finalize command
|
||||||
|
lda #$0D
|
||||||
|
jsr via_IBSOUT
|
||||||
|
bcs wedge_dos_basic_error
|
||||||
|
|
||||||
|
;; XXX close here, check status - print it if not OK
|
||||||
;; Clean-up and exit
|
;; Clean-up and exit
|
||||||
jmp wedge_dos_clean_exit
|
jmp wedge_dos_clean_exit
|
||||||
|
|
||||||
@@ -92,15 +91,15 @@ wedge_dos_status:
|
|||||||
lda #$00 ; empty file name
|
lda #$00 ; empty file name
|
||||||
jsr JSETNAM
|
jsr JSETNAM
|
||||||
jsr via_IOPEN
|
jsr via_IOPEN
|
||||||
bcc +
|
bcs wedge_dos_basic_error
|
||||||
jmp do_DEVICE_NOT_PRESENT_error
|
|
||||||
*
|
|
||||||
;; Set channel for input
|
;; Set channel for input
|
||||||
ldx #$0F
|
ldx #$0F
|
||||||
jsr via_ICHKIN
|
jsr via_ICHKIN
|
||||||
|
bcs wedge_dos_basic_error
|
||||||
*
|
*
|
||||||
jsr JREADST ; retrieve errors
|
jsr JREADST ; retrieve errors
|
||||||
;; XXX error in case of status != 0
|
;; XXX error in case of status != EOF
|
||||||
;; Print out everything retrieved from the drive
|
;; Print out everything retrieved from the drive
|
||||||
bne +
|
bne +
|
||||||
jsr via_IBASIN
|
jsr via_IBASIN
|
||||||
@@ -117,8 +116,6 @@ wedge_dos_status:
|
|||||||
wedge_dos_directory:
|
wedge_dos_directory:
|
||||||
|
|
||||||
;; XXX - implement this
|
;; XXX - implement this
|
||||||
jsr printf
|
|
||||||
.byte "DBG: DIR", 0
|
|
||||||
jmp do_NOT_IMPLEMENTED_error
|
jmp do_NOT_IMPLEMENTED_error
|
||||||
|
|
||||||
wedge_dos_clean_exit:
|
wedge_dos_clean_exit:
|
||||||
@@ -126,4 +123,12 @@ wedge_dos_clean_exit:
|
|||||||
jsr via_ICLRCH
|
jsr via_ICLRCH
|
||||||
jmp basic_end_of_line
|
jmp basic_end_of_line
|
||||||
|
|
||||||
|
wedge_dos_basic_error:
|
||||||
|
tax
|
||||||
|
dex
|
||||||
|
jsr do_basic_error
|
||||||
|
jsr via_ICLALL
|
||||||
|
jsr via_ICLRCH
|
||||||
|
jmp basic_end_of_line
|
||||||
|
|
||||||
;; END wedge support
|
;; END wedge support
|
||||||
@@ -61,8 +61,10 @@ chkin_set_device:
|
|||||||
;; Common part for booth CHKIN and CKOUT
|
;; Common part for booth CHKIN and CKOUT
|
||||||
|
|
||||||
chkinout_end:
|
chkinout_end:
|
||||||
|
tax
|
||||||
pla
|
pla
|
||||||
tay
|
tay
|
||||||
|
txa
|
||||||
rts
|
rts
|
||||||
|
|
||||||
chkinout_file_not_open:
|
chkinout_file_not_open:
|
||||||
|
|||||||
+5
-6
@@ -42,7 +42,7 @@ load:
|
|||||||
lda current_device_number
|
lda current_device_number
|
||||||
and #$FC
|
and #$FC
|
||||||
beq lvs_illegal_device_number ; device number below 4, not an IEC device
|
beq lvs_illegal_device_number ; device number below 4, not an IEC device
|
||||||
|
|
||||||
;; Device numbers above 30 are also illegal (see https://www.pagetable.com/?p=1031),
|
;; Device numbers above 30 are also illegal (see https://www.pagetable.com/?p=1031),
|
||||||
;; as the protocol combines device number with command code int one byte,
|
;; as the protocol combines device number with command code int one byte,
|
||||||
;; above 30 it is no longer possible (UNLISTEN and UNTALK codes prevent using
|
;; above 30 it is no longer possible (UNLISTEN and UNTALK codes prevent using
|
||||||
@@ -56,7 +56,7 @@ load:
|
|||||||
;; http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
|
;; http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
|
||||||
;; p13, 16; also p16 tells us this routine doesn't mess with the file table
|
;; p13, 16; also p16 tells us this routine doesn't mess with the file table
|
||||||
;; in the C64, only in the drive.
|
;; in the C64, only in the drive.
|
||||||
|
|
||||||
;; Call device to LISTEN (p16)
|
;; Call device to LISTEN (p16)
|
||||||
lda current_device_number
|
lda current_device_number
|
||||||
jsr listen
|
jsr listen
|
||||||
@@ -67,6 +67,8 @@ load:
|
|||||||
sta BSOUR
|
sta BSOUR
|
||||||
jsr iec_tx_command
|
jsr iec_tx_command
|
||||||
bcs lvs_load_verify_error
|
bcs lvs_load_verify_error
|
||||||
|
jsr iec_tx_command_finalize
|
||||||
|
bcs lvs_load_verify_error
|
||||||
|
|
||||||
;; Send filename (p16)
|
;; Send filename (p16)
|
||||||
ldy #0
|
ldy #0
|
||||||
@@ -97,7 +99,6 @@ load_filename_sent:
|
|||||||
;; Command device to unlisten to indicate end of file name. (p16)
|
;; Command device to unlisten to indicate end of file name. (p16)
|
||||||
jsr unlsn
|
jsr unlsn
|
||||||
bcs lvs_load_verify_error
|
bcs lvs_load_verify_error
|
||||||
jsr iec_set_idle ;; XXX is it needed?
|
|
||||||
|
|
||||||
;; Now command device to talk (p16)
|
;; Now command device to talk (p16)
|
||||||
lda current_device_number
|
lda current_device_number
|
||||||
@@ -162,12 +163,10 @@ load_loop:
|
|||||||
lda #$E0
|
lda #$E0
|
||||||
sta BSOUR
|
sta BSOUR
|
||||||
jsr iec_tx_command
|
jsr iec_tx_command
|
||||||
|
jsr iec_tx_command_finalize
|
||||||
|
|
||||||
;; Tell drive to unlisten
|
;; Tell drive to unlisten
|
||||||
jsr unlsn
|
jsr unlsn
|
||||||
|
|
||||||
;; Set IEC status back to idle
|
|
||||||
jsr iec_set_idle
|
|
||||||
|
|
||||||
;; Return last address
|
;; Return last address
|
||||||
jmp lvs_return_last_address
|
jmp lvs_return_last_address
|
||||||
+1
-2
@@ -30,8 +30,7 @@ open:
|
|||||||
|
|
||||||
ldy LDTND
|
ldy LDTND
|
||||||
cpy #$0A
|
cpy #$0A
|
||||||
bcs +
|
bcc open_has_space
|
||||||
bmi open_has_space
|
|
||||||
*
|
*
|
||||||
;; Table is full
|
;; Table is full
|
||||||
jmp kernalerror_TOO_MANY_OPEN_FILES
|
jmp kernalerror_TOO_MANY_OPEN_FILES
|
||||||
|
|||||||
Reference in new issue
Block a user