various cleanups
This commit is contained in:
1 parent
ce8c84a20c
commit
f522b82219
36 files changed
+114
-124
No files matched your search
@@ -1,8 +1,9 @@
|
||||
|
||||
// Key board matrixes: unshifted, shifted, control and C= modified
|
||||
// 64 bytes for each
|
||||
|
||||
|
||||
keyboard_matrixes:
|
||||
keyboard_matrix:
|
||||
// Unshifted matrix built by refering to
|
||||
// Compute's Mapping the 64 p38-39
|
||||
// and C64 PRG pages 379-381
|
||||
@@ -69,4 +70,3 @@ keyboard_matrix_lookup:
|
||||
.byte $C0 // Vendor + SHIFT
|
||||
.byte $80 // Vendor+ CTRL
|
||||
.byte $80 // Vendor + CTRL + SHIFT
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
chkin_real:
|
||||
|
||||
// Store Y for preservation
|
||||
_phy
|
||||
phy_trash_a
|
||||
|
||||
// Reset status
|
||||
jsr kernalstatus_reset
|
||||
|
||||
@@ -44,7 +44,7 @@ chrin_done_fail:
|
||||
chrin_keyboard:
|
||||
|
||||
// Save X
|
||||
_phx
|
||||
phx_trash_a
|
||||
|
||||
chrin_repeat:
|
||||
|
||||
@@ -64,7 +64,7 @@ chrin_repeat:
|
||||
// Return carriage return and clear pending input flag
|
||||
lda #$00
|
||||
sta CRSW
|
||||
_plx
|
||||
plx_trash_a
|
||||
clc
|
||||
lda #$0d
|
||||
rts
|
||||
@@ -72,7 +72,7 @@ chrin_repeat:
|
||||
not_end_of_input:
|
||||
// Return next byte of waiting input and advance index
|
||||
tay
|
||||
_plx
|
||||
plx_trash_a
|
||||
lda (LXSP),y
|
||||
jsr screen_code_to_petscii
|
||||
inc CRSW
|
||||
@@ -123,7 +123,7 @@ read_from_keyboard:
|
||||
sta CRSW
|
||||
// Return first char of line
|
||||
ldy #$00
|
||||
_plx
|
||||
plx_trash_a
|
||||
lda (LXSP),y
|
||||
jsr screen_code_to_petscii
|
||||
clc
|
||||
@@ -133,7 +133,7 @@ empty_line:
|
||||
// For an empty line, just return the carriage return
|
||||
// (and don't forget to actually print the carriage return, so that
|
||||
// the cursor advances and screen scrolls as required)
|
||||
_plx
|
||||
plx_trash_a
|
||||
clc
|
||||
lda #$0d
|
||||
rts
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
clall_real:
|
||||
|
||||
// Store .Y register
|
||||
_phy
|
||||
phy_trash_a
|
||||
|
||||
// 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
|
||||
@@ -26,7 +26,7 @@ clall_real:
|
||||
jmp !-
|
||||
!:
|
||||
// Restore .Y register
|
||||
_ply
|
||||
ply_trash_a
|
||||
|
||||
// 'C64 Programmers Reference Guide', page 281, claims it calls CLRCHN too
|
||||
jsr CLRCHN
|
||||
|
||||
@@ -17,8 +17,8 @@ CHROUT:
|
||||
// don't get modified, in agreement with C64 PRG's
|
||||
// description of CHROUT)
|
||||
|
||||
_phx
|
||||
_phy
|
||||
phx_trash_a
|
||||
phy_trash_a
|
||||
|
||||
php
|
||||
|
||||
@@ -45,8 +45,8 @@ chrout_done_fail:
|
||||
plp
|
||||
|
||||
// Restore X and Y
|
||||
_ply
|
||||
_plx
|
||||
ply_trash_a
|
||||
plx_trash_a
|
||||
|
||||
sec // indicate failure
|
||||
rts
|
||||
@@ -56,8 +56,8 @@ chrout_done_unknown_device:
|
||||
plp
|
||||
|
||||
// Restore X and Y
|
||||
_ply
|
||||
_plx
|
||||
ply_trash_a
|
||||
plx_trash_a
|
||||
|
||||
// End wioth error
|
||||
jmp lvs_device_not_found_error
|
||||
@@ -67,8 +67,8 @@ chrout_done_success:
|
||||
plp
|
||||
|
||||
// Restore X and Y
|
||||
_ply
|
||||
_plx
|
||||
ply_trash_a
|
||||
plx_trash_a
|
||||
|
||||
lda SCHAR
|
||||
clc // indicate success
|
||||
|
||||
@@ -14,8 +14,8 @@ iec_return_success:
|
||||
lda #$00
|
||||
sta C3PO
|
||||
// Restore registers
|
||||
_ply
|
||||
_plx
|
||||
ply_trash_a
|
||||
plx_trash_a
|
||||
// Report success
|
||||
clc
|
||||
rts
|
||||
@@ -28,7 +28,7 @@ iec_return_DEVICE_NOT_FOUND:
|
||||
lda #$00
|
||||
sta C3PO
|
||||
// Restore registers
|
||||
_ply
|
||||
_plx
|
||||
ply_trash_a
|
||||
plx_trash_a
|
||||
// Report error
|
||||
jmp kernalerror_DEVICE_NOT_FOUND
|
||||
@@ -7,8 +7,8 @@
|
||||
iec_rx_byte:
|
||||
|
||||
// Store .X and .Y on the stack - preserve them
|
||||
_phx
|
||||
_phy
|
||||
phx_trash_a
|
||||
phy_trash_a
|
||||
|
||||
// Timing is critical here - execute on disabled IRQs
|
||||
// The best practice would be to do PHP first, but it seems this is not
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
iec_turnaround_to_listen:
|
||||
|
||||
// Store .X and .Y on the stack - preserve them
|
||||
_phx
|
||||
_phy
|
||||
phx_trash_a
|
||||
phy_trash_a
|
||||
|
||||
// Timing is critical here - execute on disabled IRQs
|
||||
php
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
iec_turnaround_to_talk:
|
||||
|
||||
// Store .X and .Y on the stack - preserve them
|
||||
_phx
|
||||
_phy
|
||||
phx_trash_a
|
||||
phy_trash_a
|
||||
|
||||
// Timing is critical here - execute on disabled IRQs
|
||||
php
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
iec_tx_byte:
|
||||
|
||||
// Store .X and .Y on the stack - preserve them
|
||||
_phx
|
||||
_phy
|
||||
phx_trash_a
|
||||
phy_trash_a
|
||||
|
||||
// Notify all devices that we are going to send a byte
|
||||
// and it is going to be a data byte (released ATN)
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
iec_tx_command:
|
||||
|
||||
// Store .X and .Y on the stack - preserve them
|
||||
_phx
|
||||
_phy
|
||||
phx_trash_a
|
||||
phy_trash_a
|
||||
|
||||
// Notify all devices that we are going to send a byte
|
||||
// and it is going to be a command (pulled ATN)
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
iec_tx_command_finalize:
|
||||
|
||||
// Store .X and .Y on the stack - preserve them
|
||||
_phx
|
||||
_phy
|
||||
phx_trash_a
|
||||
phy_trash_a
|
||||
|
||||
// Give device some time to complete command reception, release ATN,
|
||||
// give it some time again before (possible) next command
|
||||
|
||||
@@ -12,7 +12,7 @@ return_from_interrupt:
|
||||
// Restore registers and return
|
||||
// Sequence according to Compute's Mapping the 64 p73
|
||||
|
||||
_ply
|
||||
_plx
|
||||
ply_trash_a
|
||||
plx_trash_a
|
||||
pla
|
||||
rti
|
||||
@@ -6,8 +6,8 @@ default_nmi_handler:
|
||||
|
||||
// Save registers, sequence according to Compute's Mapping the Commodore 64, page 73
|
||||
pha
|
||||
_phx
|
||||
_phy
|
||||
phx_trash_a
|
||||
phy_trash_a
|
||||
|
||||
// XXX: RS-232 support is not implemented
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ hw_entry_irq:
|
||||
|
||||
// Save registers, sequence according to Compute's Mapping the Commodore 64, page 73
|
||||
pha
|
||||
_phx
|
||||
_phy
|
||||
phx_trash_a
|
||||
phy_trash_a
|
||||
|
||||
#if CONFIG_CPU_MOS_6502 && CONFIG_BCD_SAFE_INTERRUPTS
|
||||
cld // clear decimal flag to allow using it without disabling interrupts
|
||||
|
||||
@@ -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
|
||||
.const MaxKeyRollover = 3
|
||||
|
||||
@@ -102,7 +118,7 @@ accept_key:
|
||||
and #$3f
|
||||
ora keyboard_matrix_lookup,x
|
||||
tax
|
||||
lda keyboard_matrixes,x
|
||||
lda keyboard_matrix,x
|
||||
// But don't insert $00 characters
|
||||
beq sk_nokey
|
||||
|
||||
@@ -519,4 +535,4 @@ KeyRepeatWait:
|
||||
jmp ConsiderNextKey
|
||||
|
||||
|
||||
#endif // #if CONFIG_SCNKEY_TWW_CTR
|
||||
#endif // CONFIG_SCNKEY_TWW_CTR
|
||||
Reference in new issue
Block a user