adapted to Kick Assembler, some documentation update

This commit is contained in:
FeralChild64 committed 2019-09-07 12:35:21 +02:00
1 parent ae23dbae7b
commit de27124b4f
198 files changed
+4181 -3976

No files matched your search

@@ -1,9 +1,10 @@
default_irq_handler:
default_irq_handler:
jsr blink_cursor
jsr JSCNKEY
jsr JUDTIM ; update jiffy clock
jsr JUDTIM // update jiffy clock
;; Acknowledge CIA interrupt and return
// Acknowledge CIA interrupt and return
jmp clear_cia1_interrupt_flag_and_return_from_interrupt
@@ -1,11 +1,11 @@
;; https://csdb.dk/forums/index.php?roomid=11&topicid=5776
;; Clear the CIA1 interrupt flag, and then fall through to
;; the return from interrupt routine
// https://csdb.dk/forums/index.php?roomid=11&topicid=5776
// Clear the CIA1 interrupt flag, and then fall through to
// the return from interrupt routine
clear_cia1_interrupt_flag_and_return_from_interrupt:
;; We have free choice of LDA, LDX or LDY to achieve this goal
;; in 3 bytes and minimum cycles. Thus we randomly choose LDY.
LDY $DC0D
// We have free choice of LDA, LDX or LDY to achieve this goal
// in 3 bytes and minimum cycles. Thus we randomly choose LDY.
ldy CIA1_ICR
;; FALL THROUGH to $EA81
// FALL THROUGH to $EA81
@@ -1,18 +1,20 @@
;; The IRQ is a commonly messed with thing on the C64,
;; so we need to handle entry points that are commonly
;; relied upon, including:
;; $EA31 - Standard IRQ routine
;; $EA61 - Check keyboard, but don't update timer? https://github.com/cc65/cc65/issues/324
;; $EA81 - https://www.lemon64.com/forum/viewtopic.php?t=2112&sid=6ea01982b26da69783120a7923ca46fb
;; Also the $0314 vector is widely used (e.g., https://www.lemon64.com/forum/viewtopic.php?t=2112&sid=6ea01982b26da69783120a7923ca46fb)
// The IRQ is a commonly messed with thing on the C64,
// so we need to handle entry points that are commonly
// relied upon, including:
// $EA31 - Standard IRQ routine
// $EA61 - Check keyboard, but don't update timer? https://github.com/cc65/cc65/issues/324
// $EA81 - https://www.lemon64.com/forum/viewtopic.php?t=2112&sid=6ea01982b26da69783120a7923ca46fb
// Also the $0314 vector is widely used (e.g., https://www.lemon64.com/forum/viewtopic.php?t=2112&sid=6ea01982b26da69783120a7923ca46fb)
return_from_interrupt:
;; Restore registers and return
;; Sequence according to Compute's Mapping the 64 p73
// Restore registers and return
// Sequence according to Compute's Mapping the 64 p73
pla
tay
pla
tax
pla
rti
@@ -1,34 +1,33 @@
default_nmi_handler:
;; Implemented according to Compute's Mapping the Commodore 64, page 74
;; and to https://www.c64-wiki.com/wiki/Interrupt
// Implemented according to Compute's Mapping the Commodore 64, page 74
// and to https://www.c64-wiki.com/wiki/Interrupt
;; 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
txa
pha
tya
pha
;; XXX: RS-232 support is not implemented
// XXX: RS-232 support is not implemented
;; XXX confirm NMIs from CIA, or no other NMI will arrive!
// XXX confirm NMIs from CIA, or no other NMI will arrive!
jsr cartridge_check
bcc +
bcc !+
jmp (ICART_WARM_START)
*
!:
;; According to C64 Wiki, if STOP key is pressed, the routine assumes warm start request
// According to C64 Wiki, if STOP key is pressed, the routine assumes warm start request
jsr JSTOP
bcs +
jmp return_from_interrupt ; no STOP pressed
*
;; STOP + RESTORE - clean the address of the BRK instruction (it's not BRK) first
bcs !+
jmp return_from_interrupt // no STOP pressed
!:
// STOP + RESTORE - clean the address of the BRK instruction (it's not BRK) first
lda #$00
sta CMP0+0
sta CMP0+1
jmp (CBINV)
@@ -1,13 +1,13 @@
default_brk_handler:
;; Implemented according to Compute's Mapping the Commodore 64, pages 73-74
// Implemented according to Compute's Mapping the Commodore 64, pages 73-74
sei ; disable IRQs, to be sure they won't interfere
sei // disable IRQs, to be sure they won't interfere
jsr JRESTOR
jsr JIOINIT
jsr CINT_BRK
jsr cint_brk
cli
+16 -16
View File
@@ -1,38 +1,38 @@
irq_handler:
;; The IRQ is a commonly messed with thing on the C64,
;; so we need to handle entry points that are commonly
;; relied upon, including:
;; $EA31 - Standard IRQ routine
;; $EA61 - Check keyboard, but don't update timer? https://github.com/cc65/cc65/issues/324
;; $EA81 - https://www.lemon64.com/forum/viewtopic.php?t=2112&sid=6ea01982b26da69783120a7923ca46fb
;; Also the $0314 vector is widely used (e.g., https://www.lemon64.com/forum/viewtopic.php?t=2112&sid=6ea01982b26da69783120a7923ca46fb)
// The IRQ is a commonly messed with thing on the C64,
// so we need to handle entry points that are commonly
// relied upon, including:
// $EA31 - Standard IRQ routine
// $EA61 - Check keyboard, but don't update timer? https://github.com/cc65/cc65/issues/324
// $EA81 - https://www.lemon64.com/forum/viewtopic.php?t=2112&sid=6ea01982b26da69783120a7923ca46fb
// Also the $0314 vector is widely used (e.g., https://www.lemon64.com/forum/viewtopic.php?t=2112&sid=6ea01982b26da69783120a7923ca46fb)
;; 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
txa
pha
tya
pha
;; Check if caused by BRK
// Check if caused by BRK
tsx
lda $0104, x ; get the pre-interrupt processor state
lda $0104, x // get the pre-interrupt processor state
and #$10
bne irq_handler_brk
;; Not caused by BRK - call interrupt routine (only if initialised)
// Not caused by BRK - call interrupt routine (only if initialised)
lda CINV
ora CINV+1
beq +
beq !+
jmp (CINV)
*
;; Vector not initialized - call default interrupt routine
!:
// Vector not initialized - call default interrupt routine
jmp default_irq_handler
irq_handler_brk:
;; Store BRK adddress, to be displayed
// Store BRK adddress, to be displayed
sec
lda $0105, x
sbc #$02
@@ -41,6 +41,6 @@ irq_handler_brk:
sbc #$00
sta CMP0+1
;; Interrupt caused by BRK
// Interrupt caused by BRK
jmp (CBINV)
+5 -5
View File
@@ -1,17 +1,17 @@
nmi_handler:
sei ;; don't allow IRQ to interfere, see https://www.c64-wiki.com/wiki/Interrupt
sei // don't allow IRQ to interfere, see https://www.c64-wiki.com/wiki/Interrupt
;; Call interrupt routine (only if initialised)
// Call interrupt routine (only if initialised)
pha
lda NMINV
ora NMINV+1
beq +
beq !+
pla
jmp (NMINV)
*
;; Vector not initialized - call default interrupt routine
!:
// Vector not initialized - call default interrupt routine
pla
jmp default_nmi_handler