started work on RS-232 implementation

This commit is contained in:
FeralChild64 committed 2019-10-29 17:42:48 +01:00
1 parent 9f4c399158
commit 83d2511221
14 files changed
+165 -43

No files matched your search

+26 -27
View File
@@ -5,7 +5,7 @@
// - [RG64] C64 Programmer's Reference Guide - page 275 (CHKIN) / 276 (CKOUT)
// - [CM64] Compute's Mapping the Commodore 64 - page 229
//
// CPU registers that has to be preserved (see [RG64]): .Y, possibly .A (XXX - see [CM64], page 213)
// CPU registers that has to be preserved (see [RG64]): .Y, .A (see [CM64], page 213)
//
@@ -13,7 +13,8 @@
chkin_real:
// Store Y for preservation
// Store registers for preservation
pha
phy_trash_a
// Reset status
@@ -37,7 +38,7 @@ chkin_real:
lda LAT, Y
cmp #$01
beq chkinout_file_not_input
beq chkin_file_not_input
#if CONFIG_IEC
@@ -58,47 +59,41 @@ chkin_real:
chkin_set_device:
lda FAT,Y
sta DFLTN
clc // for success
// FALLTROUGH
// Common part for booth CHKIN and CKOUT
// XXX add CPU-dependent optimizations here
chkinout_end:
tax
ply_trash_a
pla
tay
txa
clc // indicate success
rts
chkin_file_not_input: // XXX move this out of common section
ply_trash_a
pla
jmp kernalerror_FILE_NOT_INPUT
chkinout_file_not_open:
ply_trash_a
pla
tay
jmp kernalerror_FILE_NOT_OPEN
chkinout_device_not_present:
ply_trash_a
pla
tay
jsr kernalstatus_DEVICE_NOT_FOUND
jmp kernalerror_DEVICE_NOT_FOUND
chkinout_file_not_input:
pla
tay
jmp kernalerror_FILE_NOT_INPUT
chkinout_file_not_output:
pla
tay
jmp kernalerror_FILE_NOT_OUTPUT
// CKOUT implementation
ckout_real:
// Store Y for preservation
tya
// Store registers for preservation
pha
phy_trash_a
// Reset status
jsr kernalstatus_reset
@@ -118,19 +113,19 @@ ckout_real:
beq chkinout_device_not_present // RS-232 not implemented
cmp #$00
beq chkinout_file_not_output // cannot output to keyboard - XXX check real ROM behaviour
beq ckout_file_not_output // cannot output to keyboard - XXX check real ROM behaviour
// Fail if the file is open for reading (secondary address 0)
lda LAT, Y
beq chkinout_file_not_output
beq ckout_file_not_output
#if CONFIG_IEC
// For IEC devices, send LISTEN + SECOND first
lda FAT,Y
jsr iec_check_devnum_oc
bcs chkout_set_device
bcs ckout_set_device
jsr LISTEN
bcs chkinout_device_not_present // don't set DFLTO in case of failure
@@ -141,9 +136,13 @@ ckout_real:
#endif // CONFIG_IEC
chkout_set_device:
ckout_set_device:
lda FAT,Y
sta DFLTO
clc // for success
jmp chkinout_end
ckout_file_not_output:
ply_trash_a
pla
jmp kernalerror_FILE_NOT_OUTPUT