further IO stack refactoring

This commit is contained in:
FeralChild64 committed 2019-10-29 17:03:13 +01:00
1 parent 6fa2c5b570
commit e9140607bc
41 files changed
+131 -82

No files matched your search

+11 -5
View File
@@ -11,16 +11,20 @@ SRCDIR_BASIC = $(SRCDIR_COMMON) \
SRCDIR_KERNAL = $(SRCDIR_COMMON) \
c64/kernal \
c64/kernal/,stubs \
c64/kernal/assets \
c64/kernal/jumptable \
c64/kernal/iec \
c64/kernal/init \
c64/kernal/interrupts \
c64/kernal/iostack \
c64/kernal/jumptable \
c64/kernal/keyboard \
c64/kernal/memory \
c64/kernal/print \
c64/kernal/rom_revision \
c64/kernal/screen \
c64/kernal/stubs
c64/kernal/time
SRC_TOOLS = $(wildcard src/tools/*.c,src/tools/*.cc)
@@ -65,14 +69,16 @@ GIT_COMMIT:= $(shell git log -1 --pretty='%h' | tr '[:lower:]' '[:upper:]')
.PHONY: all clean updatebin
all: $(STD_TARGET_LIST) $(EXT_TARGET_LIST)
all:
$(MAKE) -j64 --output-sync=target $(STD_TARGET_LIST) $(EXT_TARGET_LIST)
clean:
@rm -rf build
updatebin: $(STD_TARGET_LIST) $(TOOL_RELEASE)
updatebin:
$(MAKE) -j64 --output-sync=target $(STD_TARGET_LIST) $(TOOL_RELEASE)
$(TOOL_RELEASE) -i ./build -o ./bin basic_generic.rom kernal_generic.rom basic_testing.rom kernal_testing.rom basic_mega65.rom kernal_mega65.rom basic_ultimate64.rom kernal_ultimate64.rom
cp build/chargen.rom bin/chargen.rom
cp build/chargen.rom bin/chargen.rom
# Rules - tools
+6 -5
View File
@@ -40,9 +40,10 @@
// I/O devices
#define CONFIG_IEC // please keep enabled for now
// #define CONFIG_TAPE // please keep disabled for now
// #define CONFIG_RS_232 // please keep disabled for now
#define CONFIG_IEC // please keep enabled for now
// #define CONFIG_TAPE_NORMAL // please keep disabled for now
// #define CONFIG_TAPE_TURBO // please keep disabled for now
// #define CONFIG_RS232_USERPORT // please keep disabled for now
// Multiple SID support
@@ -62,8 +63,8 @@
// #define CONFIG_LEGACY_SCNKEY
#define CONFIG_KEYBOARD_C128
#define CONFIG_KEYBOARD_C128_CAPS_LOCK
// #define CONFIG_KEYBOARD_C65 // untested
// #define CONFIG_KEYBOARD_C65_CAPS_LOCK // untested
// #define CONFIG_KEYBOARD_C65 // untested
// #define CONFIG_KEYBOARD_C65_CAPS_LOCK // untested
// #define CONFIG_KEY_REPEAT_DEFAULT
// #define CONFIG_KEY_REPEAT_ALWAYS
#define CONFIG_KEY_FAST_SCAN
+7 -6
View File
@@ -42,9 +42,10 @@
// I/O devices
#define CONFIG_IEC // please keep enabled for now
// #define CONFIG_TAPE // please keep disabled for now
// #define CONFIG_RS_232 // please keep disabled for now
#define CONFIG_IEC // please keep enabled for now
// #define CONFIG_TAPE_NORMAL // please keep disabled for now
// #define CONFIG_TAPE_TURBO // please keep disabled for now
// #define CONFIG_RS232_USERPORT // please keep disabled for now
// Multiple SID support
@@ -53,7 +54,7 @@
.const CONFIG_SID_2ND_ADDRESS = $D440
// #define CONFIG_SID_3RD
.const CONFIG_SID_3RD_ADDRESS = $D420
.const CONFIG_SID_3RD_ADDRESS = $D480
// #define CONFIG_SID_D4XX
// #define CONFIG_SID_D5XX
@@ -64,8 +65,8 @@
// #define CONFIG_LEGACY_SCNKEY
// #define CONFIG_KEYBOARD_C128
// #define CONFIG_KEYBOARD_C128_CAPS_LOCK
#define CONFIG_KEYBOARD_C65 // untested
#define CONFIG_KEYBOARD_C65_CAPS_LOCK // untested
#define CONFIG_KEYBOARD_C65 // untested
#define CONFIG_KEYBOARD_C65_CAPS_LOCK // untested
// #define CONFIG_KEY_REPEAT_DEFAULT
// #define CONFIG_KEY_REPEAT_ALWAYS
#define CONFIG_KEY_FAST_SCAN
+7 -6
View File
@@ -41,9 +41,10 @@
// I/O devices
#define CONFIG_IEC // please keep enabled for now
// #define CONFIG_TAPE // please keep disabled for now
// #define CONFIG_RS_232 // please keep disabled for now
#define CONFIG_IEC // please keep enabled for now
// #define CONFIG_TAPE_NORMAL // please keep disabled for now
// #define CONFIG_TAPE_TURBO // please keep disabled for now
// #define CONFIG_RS232_USERPORT // please keep disabled for now
// Multiple SID support
@@ -51,7 +52,7 @@
#define CONFIG_SID_2ND
.const CONFIG_SID_2ND_ADDRESS = $D420
// #define CONFIG_SID_3RD
#define CONFIG_SID_3RD
.const CONFIG_SID_3RD_ADDRESS = $D440
// #define CONFIG_SID_D4XX
@@ -63,8 +64,8 @@
#define CONFIG_LEGACY_SCNKEY
// #define CONFIG_KEYBOARD_C128
// #define CONFIG_KEYBOARD_C128_CAPS_LOCK
// #define CONFIG_KEYBOARD_C65 // untested
// #define CONFIG_KEYBOARD_C65_CAPS_LOCK // untested
// #define CONFIG_KEYBOARD_C65 // untested
// #define CONFIG_KEYBOARD_C65_CAPS_LOCK // untested
// #define CONFIG_KEY_REPEAT_DEFAULT
// #define CONFIG_KEY_REPEAT_ALWAYS
#define CONFIG_KEY_FAST_SCAN
+7 -5
View File
@@ -40,9 +40,10 @@
// I/O devices
#define CONFIG_IEC // please keep enabled for now
// #define CONFIG_TAPE // please keep disabled for now
// #define CONFIG_RS_232 // please keep disabled for now
#define CONFIG_IEC // please keep enabled for now
// #define CONFIG_TAPE_NORMAL // please keep disabled for now
// #define CONFIG_TAPE_TURBO // please keep disabled for now
// #define CONFIG_RS232_USERPORT // please keep disabled for now
// Multiple SID support
@@ -62,8 +63,8 @@
// #define CONFIG_LEGACY_SCNKEY
// #define CONFIG_KEYBOARD_C128
// #define CONFIG_KEYBOARD_C128_CAPS_LOCK
// #define CONFIG_KEYBOARD_C65 // untested
// #define CONFIG_KEYBOARD_C65_CAPS_LOCK // untested
// #define CONFIG_KEYBOARD_C65 // untested
// #define CONFIG_KEYBOARD_C65_CAPS_LOCK // untested
// #define CONFIG_KEY_REPEAT_DEFAULT
// #define CONFIG_KEY_REPEAT_ALWAYS
#define CONFIG_KEY_FAST_SCAN
@@ -92,6 +93,7 @@
.const CONFIG_KEYCMD_F13 = @""
.const CONFIG_KEYCMD_F14 = @""
// Eye candy
#define CONFIG_COLORS_BRAND
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.
-6
View File
@@ -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
+30
View File
@@ -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.
+41
View File
@@ -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