various cleanups

This commit is contained in:
FeralChild64 committed 2019-10-11 18:14:12 +02:00
1 parent ce8c84a20c
commit f522b82219
36 files changed
+114 -124

No files matched your search

+8 -1
View File
@@ -48,8 +48,15 @@ If unsure - select this one.
Choose if your CPU supports the Western Design Center 65C02 instruction set, like: Choose if your CPU supports the Western Design Center 65C02 instruction set, like:
* WDC 65C02 - used in the Turbo Master accelerator * WDC 65C02 - used in the Turbo Master accelerator
It enables some speed/size code optimizations.
### `CONFIG_CPU_CSG_65CE02`
Choose if your CPU supports the Commodore Semiconductor Group 65CE02 instruction set, like:
* CSG 65CE02 * CSG 65CE02
* CSG 4510 - used in the Commodore 65 prototypes * CSG 4510 - microcontroller used in the Commodore 65 prototypes
It enables some speed/size code optimizations. It enables some speed/size code optimizations.
+7 -4
View File
@@ -192,16 +192,22 @@ build/newc65.rom: build/kernal_mega65.rom build/basic_mega65.rom build/chargen.r
# Rules - tests # Rules - tests
.PHONY: test test_generic test_mega65 test_ultimate64 test_hybrid test_m65 test_xemu testremote testsimilarity .PHONY: test test_generic test_generic_x128 test_mega65 test_mega65_xemu test_ultimate64 test_hybrid test_m65 testremote testsimilarity
test: test_generic test: test_generic
test_generic: build/kernal_generic.rom build/basic_generic.rom build/symbols_generic.vs test_generic: build/kernal_generic.rom build/basic_generic.rom build/symbols_generic.vs
x64 -kernal build/kernal_generic.rom -basic build/basic_generic.rom -moncommands build/symbols_generic.vs -8 empty.d64 x64 -kernal build/kernal_generic.rom -basic build/basic_generic.rom -moncommands build/symbols_generic.vs -8 empty.d64
test_generic_x128: build/kernal_generic.rom build/basic_generic.rom build/symbols_generic.vs
x128 -go64 -kernal64 build/kernal_generic.rom -basic64 build/basic_generic.rom -moncommands build/symbols_generic.vs -8 empty.d64
test_mega65: build/kernal_mega65.rom build/basic_mega65.rom build/symbols_mega65.vs test_mega65: build/kernal_mega65.rom build/basic_mega65.rom build/symbols_mega65.vs
x64 -kernal build/kernal_mega65.rom -basic build/basic_mega65.rom -moncommands build/symbols_mega65.vs -8 empty.d64 x64 -kernal build/kernal_mega65.rom -basic build/basic_mega65.rom -moncommands build/symbols_mega65.vs -8 empty.d64
test_mega65_xemu: build/newc65.rom
../xemu/build/bin/xc65.native -dmarev 2 -rom build/newc65.rom
test_ultimate64: build/kernal_ultimate64.rom build/basic_ultimate64.rom build/symbols_ultimate64.vs test_ultimate64: build/kernal_ultimate64.rom build/basic_ultimate64.rom build/symbols_ultimate64.vs
x64 -kernal build/kernal_ultimate64.rom -basic build/basic_ultimate64.rom -moncommands build/symbols_ultimate64.vs -8 empty.d64 x64 -kernal build/kernal_ultimate64.rom -basic build/basic_ultimate64.rom -moncommands build/symbols_ultimate64.vs -8 empty.d64
@@ -217,9 +223,6 @@ test_hybrid: build/kernal_hybrid.rom build/symbols_hybrid.vs
test_m65: build/newc65.rom test_m65: build/newc65.rom
m65 -b ../mega65-core/bin/mega65r1.bit -k ../mega65-core/bin/KICKUP.M65 -R build/newc65.rom -4 m65 -b ../mega65-core/bin/mega65r1.bit -k ../mega65-core/bin/KICKUP.M65 -R build/newc65.rom -4
test_xemu: build/newc65.rom
../xemu/build/bin/xc65.native -dmarev 2 -rom build/newc65.rom
testremote: build/kernal_generic.rom build/basic_generic.rom build/symbols_generic.vs testremote: build/kernal_generic.rom build/basic_generic.rom build/symbols_generic.vs
x64 -kernal build/kernal_generic.rom -basic build/basic_generic.rom -moncommands build/symbols_generic.vs -remotemonitor x64 -kernal build/kernal_generic.rom -basic build/basic_generic.rom -moncommands build/symbols_generic.vs -remotemonitor
+1 -1
View File
@@ -29,7 +29,7 @@ The following ROM features are currently missing:
* tape support * tape support
* RS-232 support * RS-232 support
* breaking Kernal routines with RUN/STOP key * breaking Kernal routines with RUN/STOP key
* NMI andling is incomplete * NMI handling is incomplete
# API status # API status
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1
View File
@@ -17,6 +17,7 @@
#define CONFIG_CPU_MOS_6502 #define CONFIG_CPU_MOS_6502
// #define CONFIG_CPU_WDC_65C02 // #define CONFIG_CPU_WDC_65C02
// #define CONFIG_CPU_CSG_65CE02
// #define CONFIG_CPU_WDC_65816 // #define CONFIG_CPU_WDC_65816
+1
View File
@@ -17,6 +17,7 @@
#define CONFIG_CPU_MOS_6502 #define CONFIG_CPU_MOS_6502
// #define CONFIG_CPU_WDC_65C02 // #define CONFIG_CPU_WDC_65C02
// #define CONFIG_CPU_CSG_65CE02
// #define CONFIG_CPU_WDC_65816 // #define CONFIG_CPU_WDC_65816
+1
View File
@@ -17,6 +17,7 @@
#define CONFIG_CPU_MOS_6502 #define CONFIG_CPU_MOS_6502
// #define CONFIG_CPU_WDC_65C02 // #define CONFIG_CPU_WDC_65C02
// #define CONFIG_CPU_CSG_65CE02
// #define CONFIG_CPU_WDC_65816 // #define CONFIG_CPU_WDC_65816
+4 -1
View File
@@ -57,6 +57,9 @@
#if CONFIG_CPU_WDC_65C02 #if CONFIG_CPU_WDC_65C02
.eval selected++ .eval selected++
#endif #endif
#if CONFIG_CPU_CSG_65CE02
.eval selected++
#endif
#if CONFIG_CPU_WDC_65816 #if CONFIG_CPU_WDC_65816
.eval selected++ .eval selected++
#endif #endif
@@ -85,7 +88,7 @@
// Handle processor configuration // Handle processor configuration
#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_WDC_65816 #if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_CSG_65CE02 || CONFIG_CPU_WDC_65816
#define HAS_BCD_SAFE_INTERRUPTS #define HAS_BCD_SAFE_INTERRUPTS
#define HAS_BCD_SAFE_RESET #define HAS_BCD_SAFE_RESET
+8 -8
View File
@@ -4,9 +4,9 @@
// //
.pseudocommand _phx .pseudocommand phx_trash_a
{ {
#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_WDC_65816 #if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_CSG_65CE02 || CONFIG_CPU_WDC_65816
phx phx
#else #else
txa txa
@@ -14,9 +14,9 @@
#endif #endif
} }
.pseudocommand _phy .pseudocommand phy_trash_a
{ {
#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_WDC_65816 #if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_CSG_65CE02 || CONFIG_CPU_WDC_65816
phy phy
#else #else
tya tya
@@ -24,9 +24,9 @@
#endif #endif
} }
.pseudocommand _plx .pseudocommand plx_trash_a
{ {
#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_WDC_65816 #if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_CSG_65CE02 || CONFIG_CPU_WDC_65816
plx plx
#else #else
pla pla
@@ -34,9 +34,9 @@
#endif #endif
} }
.pseudocommand _ply .pseudocommand ply_trash_a
{ {
#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_WDC_65816 #if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_CSG_65CE02 || CONFIG_CPU_WDC_65816
ply ply
#else #else
pla pla
+3
View File
@@ -64,6 +64,9 @@
.label VIC_SP5COL = $D02C .label VIC_SP5COL = $D02C
.label VIC_SP6COL = $D02D .label VIC_SP6COL = $D02D
.label VIC_SP7COL = $D02E .label VIC_SP7COL = $D02E
.label VIC_XSCAN = $D02F // C128 only
.label VIC_CLKRATE = $D030 // C128 only
// SID registers // SID registers
+6 -51
View File
@@ -104,51 +104,22 @@
.label CNTDN = $A5 // -- NOT IMPLEMENTED -- .label CNTDN = $A5 // -- NOT IMPLEMENTED --
.label BUFPNT = $A6 // -- NOT IMPLEMENTED -- .label BUFPNT = $A6 // -- NOT IMPLEMENTED --
.label INBIT = $A7 // -- NOT IMPLEMENTED -- .label INBIT = $A7 // -- NOT IMPLEMENTED --
#if !CONFIG_SCNKEY_TWW_CTR
#if CONFIG_SCNKEY_TWW_CTR
// Reuse RS232 variables, since they should not be used by other things.
// Carefully avoid $A7 which is used by 64NET
.label KeyQuantity = $A8 // 1 byte
.label BufferNew = $A9 // 3 bytes
#else
.label BITCI = $A8 // -- NOT IMPLEMENTED -- .label BITCI = $A8 // -- NOT IMPLEMENTED --
.label RINONE = $A9 // -- NOT IMPLEMENTED -- .label RINONE = $A9 // -- NOT IMPLEMENTED --
.label RIDDATA = $AA // -- NOT IMPLEMENTED -- .label RIDDATA = $AA // -- NOT IMPLEMENTED --
.label RIPRTY = $AB // -- NOT IMPLEMENTED -- .label RIPRTY = $AB // -- NOT IMPLEMENTED --
#endif #endif
.label SAL = $AC // $AC-$AD -- NOT IMPLEMENTED -- (implemented screen part) .label SAL = $AC // $AC-$AD -- NOT IMPLEMENTED -- (implemented screen part)
.label EAL = $AE // $AE-$AF -- NOT IMPLEMENTED -- [!] used also by screen editor, for temporary color storage when scrolling .label EAL = $AE // $AE-$AF -- NOT IMPLEMENTED -- [!] used also by screen editor, for temporary color storage when scrolling
.label CMP0 = $B0 // $B0-$B1 temporary tape storage, [!] here used for BRK instruction address .label CMP0 = $B0 // $B0-$B1 temporary tape storage, [!] here used for BRK instruction address
.label TAPE1 = $B2 // $B2-$B3 tape buffer pointer .label TAPE1 = $B2 // $B2-$B3 tape buffer pointer
#if !CONFIG_SCNKEY_TWW_CTR
#if CONFIG_SCNKEY_TWW_CTR
// Reuse RS232 variables, since they should not be used by other things.
// This one should be initialized in cinit to $FF
.label BufferQuantity = $B4 // 1 byte
#else
.label BITTS = $B4 // -- NOT IMPLEMENTED -- .label BITTS = $B4 // -- NOT IMPLEMENTED --
#endif #endif
.label NXTBIT = $B5 // -- NOT IMPLEMENTED -- .label NXTBIT = $B5 // -- NOT IMPLEMENTED --
#if !CONFIG_SCNKEY_TWW_CTR
#if CONFIG_SCNKEY_TWW_CTR
// Reuse RS232 variables, since they should not be used by other things.
// Carefully avoiding $A7 which is used by 64NET
.label TempZP = $B6 // 1 byte
#else
.label RODATA = $B6 // -- NOT IMPLEMENTED -- .label RODATA = $B6 // -- NOT IMPLEMENTED --
#endif #endif
.label FNLEN = $B7 // current file name length .label FNLEN = $B7 // current file name length
@@ -200,13 +171,8 @@
.label BUF = $200 // $200-$250, BASIC line editor input buffer (81 bytes) .label BUF = $200 // $200-$250, BASIC line editor input buffer (81 bytes)
#if CONFIG_SCNKEY_TWW_CTR
// $250-$258 is the 81st - 88th characters in BASIC input, a carry over from VIC-20 // $250-$258 is the 81st - 88th characters in BASIC input, a carry over from VIC-20
// and not used on C64, so safe for us to use, probably. // and not used on C64 - they are used if CONFIG_SCNKEY_TWW_CTR is enabled.
.label ScanResult = $250 // 8 bytes
#endif
// [!] XXX document $251-$258 usage // [!] XXX document $251-$258 usage
.label LAT = $259 // $259-$262, logical file numbers (table, 10 bytes) .label LAT = $259 // $259-$262, logical file numbers (table, 10 bytes)
@@ -228,25 +194,14 @@
.label KEYLOG = $28F // $28F-$290 routine to setup keyboard decoding .label KEYLOG = $28F // $28F-$290 routine to setup keyboard decoding
.label MODE = $291 // flag, is case switch allowed .label MODE = $291 // flag, is case switch allowed
.label AUTODN = $292 // -- NOT IMPLEMENTED -- screen scroll disable .label AUTODN = $292 // -- NOT IMPLEMENTED -- screen scroll disable
#if !CONFIG_SCNKEY_TWW_CTR
#if CONFIG_SCNKEY_TWW_CTR
// Reuse RS232 variables, since they should not be used by other things.
// This one should be initialized in cinit to $FF
.label BufferOld = $293 // 3 bytes
.label Buffer = $297 // 4 bytes
#else
.label M51CRT = $293 // -- NOT IMPLEMENTED -- mock 6551 .label M51CRT = $293 // -- NOT IMPLEMENTED -- mock 6551
.label M51CDR = $294 // -- NOT IMPLEMENTED -- mock 6551 .label M51CDR = $294 // -- NOT IMPLEMENTED -- mock 6551
.label M51AJB = $295 // $295-$296 -- NOT IMPLEMENTED -- mock 6551 .label M51AJB = $295 // $295-$296 -- NOT IMPLEMENTED -- mock 6551
.label RSSTAT = $297 // -- NOT IMPLEMENTED -- mock 6551, RS-232 status .label RSSTAT = $297 // -- NOT IMPLEMENTED -- mock 6551, RS-232 status
.label BITNUM = $298 // -- NOT IMPLEMENTED -- .label BITNUM = $298 // -- NOT IMPLEMENTED --
.label BAUDOF = $299 // $299-$29A -- NOT IMPLEMENTED -- .label BAUDOF = $299 // $299-$29A -- NOT IMPLEMENTED --
#endif #endif
.label RIDBE = $29B // -- NOT IMPLEMENTED -- .label RIDBE = $29B // -- NOT IMPLEMENTED --
.label RIDBS = $29C // -- NOT IMPLEMENTED -- .label RIDBS = $29C // -- NOT IMPLEMENTED --
.label RODBS = $29D // -- NOT IMPLEMENTED -- .label RODBS = $29D // -- NOT IMPLEMENTED --
@@ -275,7 +230,7 @@
#if SEGMENT_BASIC #if SEGMENT_BASIC
.label shift_mem_up = tiny_nmi_handler + shift_mem_up_routine - tiny_nmi_handler_routine .label shift_mem_up = tiny_nmi_handler + shift_mem_up_routine - tiny_nmi_handler_routine
.label shift_mem_down = tiny_nmi_handler + shift_mem_down_routine - tiny_nmi_handler_routine .label shift_mem_down = tiny_nmi_handler + shift_mem_down_routine - tiny_nmi_handler_routine
#endif // SEGMENT_BASIC #endif
#endif // CONFIG_MEMORY_MODEL_60K #endif // CONFIG_MEMORY_MODEL_60K
+2 -2
View File
@@ -8,7 +8,7 @@ STROUT:
sty FRESPC+1 sty FRESPC+1
sta FRESPC+0 sta FRESPC+0
_phx phx_trash_a
// Get offset ready // Get offset ready
ldy #$00 ldy #$00
@@ -28,6 +28,6 @@ STROUT:
iny iny
bne !- bne !-
!: !:
pla // XXX can we use _plx here? pla // XXX can we use plx_trash_a here?
tax tax
rts rts
+2 -2
View File
@@ -2,7 +2,7 @@
basic_do_error: basic_do_error:
// Save error number // Save error number
_phx phx_trash_a
// Print ? at start // Print ? at start
jsr print_return jsr print_return
@@ -10,7 +10,7 @@ basic_do_error:
jsr JCHROUT jsr JCHROUT
// Print main part of error message // Print main part of error message
_plx plx_trash_a
jsr print_packed_message jsr print_packed_message
// Print ERROR at end // Print ERROR at end
+2 -2
View File
@@ -100,7 +100,7 @@ list_not_quote:
// Save registers // Save registers
tax tax
pha pha
_phy phy_trash_a
// Get pointer to compressed keyword list // Get pointer to compressed keyword list
lda #<packed_keywords lda #<packed_keywords
@@ -118,7 +118,7 @@ list_not_quote:
ldy #$ff ldy #$ff
jsr packed_word_search jsr packed_word_search
_ply ply_trash_a
pla pla
cmp #$8f cmp #$8f
+1 -1
View File
@@ -5,7 +5,7 @@
print_integer: print_integer:
pha pha
_phx phx_trash_a
// Clear temporary output // Clear temporary output
lda #$00 lda #$00
+8 -8
View File
@@ -32,13 +32,13 @@ packed_message_search:
found_message_in_token_stream: found_message_in_token_stream:
// Now print each word in the message // Now print each word in the message
_phy phy_trash_a
lda packed_message_tokens,y lda packed_message_tokens,y
cmp #$ff cmp #$ff
beq !+ beq !+
jsr print_packed_word jsr print_packed_word
jsr print_space jsr print_space
_ply ply_trash_a
iny iny
bne found_message_in_token_stream bne found_message_in_token_stream
!: !:
@@ -137,14 +137,14 @@ next_packed_word_char:
tax tax
// Save Y so it doesn't get clobbered by CHROUT // Save Y so it doesn't get clobbered by CHROUT
_phy phy_trash_a
// X=1-14 = first 14 chars, so subtract one // X=1-14 = first 14 chars, so subtract one
lda packed_message_chars-1,x lda packed_message_chars-1,x
jsr JCHROUT jsr JCHROUT
// See if there is a char in the low nybl to print // See if there is a char in the low nybl to print
_ply ply_trash_a
lda (FRESPC),y lda (FRESPC),y
and #$0f and #$0f
beq end_of_packed_word beq end_of_packed_word
@@ -154,7 +154,7 @@ next_packed_word_char:
has_lo_nybl_char: has_lo_nybl_char:
// We need to print the low nybl char as well // We need to print the low nybl char as well
tax tax
_phy phy_trash_a
// Skip lower nybls of $F or $0 in nybl packed // Skip lower nybls of $F or $0 in nybl packed
// bytes, as these do not encode characters // bytes, as these do not encode characters
@@ -168,7 +168,7 @@ has_nybl:
lda packed_message_chars-1,x lda packed_message_chars-1,x
jsr JCHROUT jsr JCHROUT
!: !:
_ply ply_trash_a
// FALLTHROUGH // FALLTHROUGH
no_lo_nybl_char: no_lo_nybl_char:
@@ -198,7 +198,7 @@ next_is_literal_char:
unpack_literal_char: unpack_literal_char:
// Output the literal char, and ready for next char // Output the literal char, and ready for next char
iny iny
_phy phy_trash_a
lda (FRESPC),y lda (FRESPC),y
jsr JCHROUT jsr JCHROUT
pla pla
@@ -215,6 +215,6 @@ is_uncommon_char:
// We need to print the low nybl char as well // We need to print the low nybl char as well
tax tax
_phy phy_trash_a
jmp has_nybl jmp has_nybl
+1 -1
View File
@@ -232,7 +232,7 @@ wedge_dos_clean_exit:
wedge_dos_basic_error: wedge_dos_basic_error:
pha pha
jsr JCLALL jsr JCLALL
_plx plx_trash_a
dex dex
jmp do_basic_error jmp do_basic_error
+2 -2
View File
@@ -1,8 +1,9 @@
// Key board matrixes: unshifted, shifted, control and C= modified // Key board matrixes: unshifted, shifted, control and C= modified
// 64 bytes for each // 64 bytes for each
keyboard_matrixes: keyboard_matrix:
// Unshifted matrix built by refering to // Unshifted matrix built by refering to
// Compute's Mapping the 64 p38-39 // Compute's Mapping the 64 p38-39
// and C64 PRG pages 379-381 // and C64 PRG pages 379-381
@@ -69,4 +70,3 @@ keyboard_matrix_lookup:
.byte $C0 // Vendor + SHIFT .byte $C0 // Vendor + SHIFT
.byte $80 // Vendor+ CTRL .byte $80 // Vendor+ CTRL
.byte $80 // Vendor + CTRL + SHIFT .byte $80 // Vendor + CTRL + SHIFT
+1 -1
View File
@@ -14,7 +14,7 @@
chkin_real: chkin_real:
// Store Y for preservation // Store Y for preservation
_phy phy_trash_a
// Reset status // Reset status
jsr kernalstatus_reset jsr kernalstatus_reset
+5 -5
View File
@@ -44,7 +44,7 @@ chrin_done_fail:
chrin_keyboard: chrin_keyboard:
// Save X // Save X
_phx phx_trash_a
chrin_repeat: chrin_repeat:
@@ -64,7 +64,7 @@ chrin_repeat:
// Return carriage return and clear pending input flag // Return carriage return and clear pending input flag
lda #$00 lda #$00
sta CRSW sta CRSW
_plx plx_trash_a
clc clc
lda #$0d lda #$0d
rts rts
@@ -72,7 +72,7 @@ chrin_repeat:
not_end_of_input: not_end_of_input:
// Return next byte of waiting input and advance index // Return next byte of waiting input and advance index
tay tay
_plx plx_trash_a
lda (LXSP),y lda (LXSP),y
jsr screen_code_to_petscii jsr screen_code_to_petscii
inc CRSW inc CRSW
@@ -123,7 +123,7 @@ read_from_keyboard:
sta CRSW sta CRSW
// Return first char of line // Return first char of line
ldy #$00 ldy #$00
_plx plx_trash_a
lda (LXSP),y lda (LXSP),y
jsr screen_code_to_petscii jsr screen_code_to_petscii
clc clc
@@ -133,7 +133,7 @@ empty_line:
// For an empty line, just return the carriage return // For an empty line, just return the carriage return
// (and don't forget to actually print the carriage return, so that // (and don't forget to actually print the carriage return, so that
// the cursor advances and screen scrolls as required) // the cursor advances and screen scrolls as required)
_plx plx_trash_a
clc clc
lda #$0d lda #$0d
rts rts
+2 -2
View File
@@ -12,7 +12,7 @@
clall_real: clall_real:
// Store .Y register // Store .Y register
_phy phy_trash_a
// Original routine probably just sets LDTND to 0, but this is not really safe, // Original routine probably just sets LDTND to 0, but this is not really safe,
// so we actually close all the channels; at least IDE64 does the same for // so we actually close all the channels; at least IDE64 does the same for
@@ -26,7 +26,7 @@ clall_real:
jmp !- jmp !-
!: !:
// Restore .Y register // Restore .Y register
_ply ply_trash_a
// 'C64 Programmers Reference Guide', page 281, claims it calls CLRCHN too // 'C64 Programmers Reference Guide', page 281, claims it calls CLRCHN too
jsr CLRCHN jsr CLRCHN
+8 -8
View File
@@ -17,8 +17,8 @@ CHROUT:
// don't get modified, in agreement with C64 PRG's // don't get modified, in agreement with C64 PRG's
// description of CHROUT) // description of CHROUT)
_phx phx_trash_a
_phy phy_trash_a
php php
@@ -45,8 +45,8 @@ chrout_done_fail:
plp plp
// Restore X and Y // Restore X and Y
_ply ply_trash_a
_plx plx_trash_a
sec // indicate failure sec // indicate failure
rts rts
@@ -56,8 +56,8 @@ chrout_done_unknown_device:
plp plp
// Restore X and Y // Restore X and Y
_ply ply_trash_a
_plx plx_trash_a
// End wioth error // End wioth error
jmp lvs_device_not_found_error jmp lvs_device_not_found_error
@@ -67,8 +67,8 @@ chrout_done_success:
plp plp
// Restore X and Y // Restore X and Y
_ply ply_trash_a
_plx plx_trash_a
lda SCHAR lda SCHAR
clc // indicate success clc // indicate success
+4 -4
View File
@@ -14,8 +14,8 @@ iec_return_success:
lda #$00 lda #$00
sta C3PO sta C3PO
// Restore registers // Restore registers
_ply ply_trash_a
_plx plx_trash_a
// Report success // Report success
clc clc
rts rts
@@ -28,7 +28,7 @@ iec_return_DEVICE_NOT_FOUND:
lda #$00 lda #$00
sta C3PO sta C3PO
// Restore registers // Restore registers
_ply ply_trash_a
_plx plx_trash_a
// Report error // Report error
jmp kernalerror_DEVICE_NOT_FOUND jmp kernalerror_DEVICE_NOT_FOUND
+2 -2
View File
@@ -7,8 +7,8 @@
iec_rx_byte: iec_rx_byte:
// Store .X and .Y on the stack - preserve them // Store .X and .Y on the stack - preserve them
_phx phx_trash_a
_phy phy_trash_a
// Timing is critical here - execute on disabled IRQs // Timing is critical here - execute on disabled IRQs
// The best practice would be to do PHP first, but it seems this is not // The best practice would be to do PHP first, but it seems this is not
+2 -2
View File
@@ -5,8 +5,8 @@
iec_turnaround_to_listen: iec_turnaround_to_listen:
// Store .X and .Y on the stack - preserve them // Store .X and .Y on the stack - preserve them
_phx phx_trash_a
_phy phy_trash_a
// Timing is critical here - execute on disabled IRQs // Timing is critical here - execute on disabled IRQs
php php
+2 -2
View File
@@ -5,8 +5,8 @@
iec_turnaround_to_talk: iec_turnaround_to_talk:
// Store .X and .Y on the stack - preserve them // Store .X and .Y on the stack - preserve them
_phx phx_trash_a
_phy phy_trash_a
// Timing is critical here - execute on disabled IRQs // Timing is critical here - execute on disabled IRQs
php php
+2 -2
View File
@@ -10,8 +10,8 @@
iec_tx_byte: iec_tx_byte:
// Store .X and .Y on the stack - preserve them // Store .X and .Y on the stack - preserve them
_phx phx_trash_a
_phy phy_trash_a
// Notify all devices that we are going to send a byte // Notify all devices that we are going to send a byte
// and it is going to be a data byte (released ATN) // and it is going to be a data byte (released ATN)
+2 -2
View File
@@ -10,8 +10,8 @@
iec_tx_command: iec_tx_command:
// Store .X and .Y on the stack - preserve them // Store .X and .Y on the stack - preserve them
_phx phx_trash_a
_phy phy_trash_a
// Notify all devices that we are going to send a byte // Notify all devices that we are going to send a byte
// and it is going to be a command (pulled ATN) // and it is going to be a command (pulled ATN)
+2 -2
View File
@@ -6,8 +6,8 @@
iec_tx_command_finalize: iec_tx_command_finalize:
// Store .X and .Y on the stack - preserve them // Store .X and .Y on the stack - preserve them
_phx phx_trash_a
_phy phy_trash_a
// Give device some time to complete command reception, release ATN, // Give device some time to complete command reception, release ATN,
// give it some time again before (possible) next command // give it some time again before (possible) next command
@@ -12,7 +12,7 @@ return_from_interrupt:
// Restore registers and return // Restore registers and return
// Sequence according to Compute's Mapping the 64 p73 // Sequence according to Compute's Mapping the 64 p73
_ply ply_trash_a
_plx plx_trash_a
pla pla
rti rti
@@ -6,8 +6,8 @@ default_nmi_handler:
// Save registers, sequence according to Compute's Mapping the Commodore 64, page 73 // Save registers, sequence according to Compute's Mapping the Commodore 64, page 73
pha pha
_phx phx_trash_a
_phy phy_trash_a
// XXX: RS-232 support is not implemented // XXX: RS-232 support is not implemented
+2 -2
View File
@@ -11,8 +11,8 @@ hw_entry_irq:
// Save registers, sequence according to Compute's Mapping the Commodore 64, page 73 // Save registers, sequence according to Compute's Mapping the Commodore 64, page 73
pha pha
_phx phx_trash_a
_phy phy_trash_a
#if CONFIG_CPU_MOS_6502 && CONFIG_BCD_SAFE_INTERRUPTS #if CONFIG_CPU_MOS_6502 && CONFIG_BCD_SAFE_INTERRUPTS
cld // clear decimal flag to allow using it without disabling interrupts cld // clear decimal flag to allow using it without disabling interrupts
+18 -2
View File
@@ -50,6 +50,22 @@
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Low memory variables
// Reuse RS232 variables, since they should not be used by other things.
// Carefully avoid $A7 which is used by 64NET
.label KeyQuantity = $A8 // 1 byte
.label BufferNew = $A9 // 3 bytes
.label TempZP = $B6 // 1 byte
// These should be initialized in CINIT to $FF
.label BufferQuantity = $B4 // 1 byte
.label BufferOld = $293 // 3 bytes
.label Buffer = $297 // 4 bytes
// $250-$258 is the 81st - 88th characters in BASIC input, a carry over from VIC-20
// and not used on C64, so safe for us to use, probably.
.label ScanResult = $250 // 8 bytes
// Operational Variables // Operational Variables
.const MaxKeyRollover = 3 .const MaxKeyRollover = 3
@@ -102,7 +118,7 @@ accept_key:
and #$3f and #$3f
ora keyboard_matrix_lookup,x ora keyboard_matrix_lookup,x
tax tax
lda keyboard_matrixes,x lda keyboard_matrix,x
// But don't insert $00 characters // But don't insert $00 characters
beq sk_nokey beq sk_nokey
@@ -519,4 +535,4 @@ KeyRepeatWait:
jmp ConsiderNextKey jmp ConsiderNextKey
#endif // #if CONFIG_SCNKEY_TWW_CTR #endif // CONFIG_SCNKEY_TWW_CTR