further IO stack refactoring
This commit is contained in:
1 parent
6fa2c5b570
commit
e9140607bc
41 files changed
+131
-82
No files matched your search
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,6 +0,0 @@
|
||||
|
||||
// Our implementation is longer than the original one,
|
||||
// placing it here would cause a collision with OPEN
|
||||
|
||||
CLRCHN:
|
||||
jmp clrchn_real
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
CIOUT:
|
||||
|
||||
#if CONFIG_IEC
|
||||
|
||||
pha
|
||||
lda C3PO
|
||||
bne ciout_send_byte
|
||||
@@ -35,3 +37,9 @@ ciout_send_byte:
|
||||
inc C3PO // iec_tx_byte sets it to 0, but we still have something to send
|
||||
jmp ciout_store_in_buffer
|
||||
|
||||
#else
|
||||
|
||||
sec // indicate failure
|
||||
rts
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,30 @@
|
||||
|
||||
//
|
||||
// IEC part of the CLRCHN routine
|
||||
//
|
||||
|
||||
|
||||
#if CONFIG_IEC
|
||||
|
||||
|
||||
clrchn_iec:
|
||||
|
||||
// Check input device
|
||||
lda DFLTN
|
||||
jsr iec_check_devnum_oc
|
||||
bcs !+
|
||||
|
||||
// It was IEC device - send UNTALK first
|
||||
jsr UNTLK
|
||||
!:
|
||||
// Check output device
|
||||
lda DFLTO
|
||||
jsr iec_check_devnum_oc
|
||||
|
||||
// If it was IEC device - send UNLSN first
|
||||
bcc_far UNLSN
|
||||
|
||||
rts
|
||||
|
||||
|
||||
#endif // CONFIG_IEC
|
||||
@@ -9,26 +9,22 @@
|
||||
//
|
||||
|
||||
|
||||
clrchn_real:
|
||||
CLRCHN:
|
||||
|
||||
#if CONFIG_IEC
|
||||
jsr clrchn_iec
|
||||
#else
|
||||
nop // just to prevent double label
|
||||
#endif
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
// Handle IEC input device
|
||||
lda DFLTN
|
||||
jsr iec_check_devnum_oc
|
||||
bcs !+
|
||||
// Previous device was IEC one - send UNTALK first
|
||||
jsr UNTLK
|
||||
!:
|
||||
// Restore output device to default
|
||||
lda DFLTO
|
||||
jsr iec_check_devnum_oc
|
||||
bcs !+
|
||||
// Handle IEC output device
|
||||
jsr UNLSN
|
||||
!:
|
||||
clrchn_reset: // entry needed by setup_vicii
|
||||
|
||||
// Set input device number to keyboard
|
||||
lda #$00
|
||||
sta DFLTN
|
||||
|
||||
// Set output device number to screen
|
||||
lda #$03
|
||||
sta DFLTO
|
||||
File renamed without changes.
@@ -1,29 +1,12 @@
|
||||
|
||||
//
|
||||
// Official Kernal routine, described in:
|
||||
//
|
||||
// - [RG64] C64 Programmer's Reference Guide - page 303
|
||||
// - [CM64] Compute's Mapping the Commodore 64 - pages 27, 232
|
||||
//
|
||||
// CPU registers that has to be preserved (see [RG64]): .Y
|
||||
// Keyboard part of the UDTIM routine, has to preserve .Y
|
||||
//
|
||||
|
||||
UDTIM:
|
||||
|
||||
// Update jiffy clock. The whole day is $4F1A00 jiffies (24 hours * 60 minutes * 60 seconds * 60 jiffies),
|
||||
// after this time we have to reset the clock.
|
||||
udtim_keyboard:
|
||||
|
||||
inc TIME+0
|
||||
bne udtim_update_stkey // done with clock
|
||||
inc TIME+1
|
||||
bne udtim_clock_rollover
|
||||
inc TIME+2
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
udtim_update_stkey: // entry to be used when interrupts are disabled
|
||||
|
||||
// According to [CM64], page 27, another action we have to perform is to copy
|
||||
// According to [CM64], page 27, the action we have to perform is to copy
|
||||
// the last row of keyboard to RAM, so that various routines can detect the STOP
|
||||
// key press. But something as simple as this would have created warm restart
|
||||
// with M+N+SPACE+RESTORE due to ghosting - so the original ROM has to provide
|
||||
@@ -65,17 +48,3 @@ udtim_update_stkey: // entry to be used when interrupts are disabled
|
||||
// unable to, for example, read the space bar status.
|
||||
|
||||
rts
|
||||
|
||||
udtim_clock_rollover:
|
||||
|
||||
// At this point TIME+0 contains 0
|
||||
lda TIME+1
|
||||
cmp #$1A
|
||||
bne udtim_update_stkey // done with clock
|
||||
lda TIME+2
|
||||
cmp #$4F
|
||||
bne udtim_update_stkey // done with clock
|
||||
lda #$00
|
||||
sta TIME+2
|
||||
sta TIME+1
|
||||
beq udtim_update_stkey // done with clock - will always jump
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,41 @@
|
||||
|
||||
//
|
||||
// Official Kernal routine, described in:
|
||||
//
|
||||
// - [RG64] C64 Programmer's Reference Guide - page 303
|
||||
// - [CM64] Compute's Mapping the Commodore 64 - pages 27, 232
|
||||
//
|
||||
// CPU registers that has to be preserved (see [RG64]): .Y
|
||||
//
|
||||
|
||||
UDTIM:
|
||||
|
||||
// Update jiffy clock. The whole day is $4F1A00 jiffies
|
||||
// (24 hours * 60 minutes * 60 seconds * 60 jiffies),
|
||||
// after this time we have to reset the clock.
|
||||
|
||||
inc TIME+0
|
||||
bne udtim_time_done // done with clock
|
||||
inc TIME+1
|
||||
bne udtim_clock_rollover
|
||||
inc TIME+2
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
udtim_time_done:
|
||||
|
||||
jmp udtim_keyboard
|
||||
|
||||
udtim_clock_rollover:
|
||||
|
||||
// At this point TIME+0 contains 0
|
||||
lda TIME+1
|
||||
cmp #$1A
|
||||
bne udtim_time_done // done with clock
|
||||
lda TIME+2
|
||||
cmp #$4F
|
||||
bne udtim_time_done // done with clock
|
||||
lda #$00
|
||||
sta TIME+2
|
||||
sta TIME+1
|
||||
beq udtim_time_done // done with clock - will always jump
|
||||
Reference in new issue
Block a user