mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-06-10 10:29:36 +00:00
541 lines
18 KiB
Plaintext
541 lines
18 KiB
Plaintext
Resolved forward reference irq to __interrupt(hardware_clobber) void irq()
|
|
Inlined call vicSelectGfxBank::$0 = call toDd00(vicSelectGfxBank::gfx)
|
|
|
|
CONTROL FLOW GRAPH SSA
|
|
|
|
void main()
|
|
main: scope:[main] from __start
|
|
asm { sei }
|
|
*PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK
|
|
*PROCPORT = PROCPORT_RAM_IO
|
|
*((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL
|
|
*VICII_CONTROL1 = *VICII_CONTROL1 | $80
|
|
*RASTER = 0
|
|
*IRQ_ENABLE = IRQ_RASTER
|
|
*HARDWARE_IRQ = &irq
|
|
asm { cli }
|
|
to:main::@1
|
|
main::@1: scope:[main] from main main::@2
|
|
if(true) goto main::@2
|
|
to:main::@return
|
|
main::@2: scope:[main] from main::@1
|
|
*BORDER_COLOR = ++ *BORDER_COLOR
|
|
to:main::@1
|
|
main::@return: scope:[main] from main::@1
|
|
return
|
|
to:@return
|
|
|
|
__interrupt(hardware_clobber) void irq()
|
|
irq: scope:[irq] from
|
|
call do_irq
|
|
to:irq::@1
|
|
irq::@1: scope:[irq] from irq
|
|
to:irq::@return
|
|
irq::@return: scope:[irq] from irq::@1
|
|
return
|
|
to:@return
|
|
|
|
void do_irq()
|
|
do_irq: scope:[do_irq] from irq
|
|
*BG_COLOR = WHITE
|
|
*BG_COLOR = BLACK
|
|
*IRQ_STATUS = IRQ_RASTER
|
|
to:do_irq::@return
|
|
do_irq::@return: scope:[do_irq] from do_irq
|
|
return
|
|
to:@return
|
|
|
|
void __start()
|
|
__start: scope:[__start] from
|
|
call main
|
|
to:__start::@1
|
|
__start::@1: scope:[__start] from __start
|
|
to:__start::@return
|
|
__start::@return: scope:[__start] from __start::@1
|
|
return
|
|
to:@return
|
|
|
|
SYMBOL TABLE SSA
|
|
__constant char * const BG_COLOR = (char *)$d021
|
|
__constant const char BLACK = 0
|
|
__constant char * const BORDER_COLOR = (char *)$d020
|
|
__constant struct MOS6526_CIA * const CIA1 = (struct MOS6526_CIA *)$dc00
|
|
__constant const char CIA_INTERRUPT_CLEAR_ALL = $7f
|
|
__constant void (** const HARDWARE_IRQ)() = (void (**)())$fffe
|
|
__constant char * const IRQ_ENABLE = (char *)$d01a
|
|
__constant const char IRQ_RASTER = 1
|
|
__constant char * const IRQ_STATUS = (char *)$d019
|
|
__constant char OFFSET_STRUCT_MOS6526_CIA_INTERRUPT = $d
|
|
__constant char * const PROCPORT = (char *)1
|
|
__constant char * const PROCPORT_DDR = (char *)0
|
|
__constant const char PROCPORT_DDR_MEMORY_MASK = 7
|
|
__constant const char PROCPORT_RAM_IO = 5
|
|
__constant char * const RASTER = (char *)$d012
|
|
__constant char * const VICII_CONTROL1 = (char *)$d011
|
|
__constant const char WHITE = 1
|
|
void __start()
|
|
void do_irq()
|
|
__interrupt(hardware_clobber) void irq()
|
|
void main()
|
|
|
|
Adding number conversion cast (unumber) $80 in *VICII_CONTROL1 = *VICII_CONTROL1 | $80
|
|
Adding number conversion cast (unumber) 0 in *RASTER = 0
|
|
Successful SSA optimization PassNAddNumberTypeConversions
|
|
Inlining cast *RASTER = (unumber)0
|
|
Successful SSA optimization Pass2InlineCast
|
|
Simplifying constant pointer cast (char *) 53266
|
|
Simplifying constant pointer cast (char *) 53280
|
|
Simplifying constant pointer cast (char *) 53281
|
|
Simplifying constant pointer cast (char *) 53265
|
|
Simplifying constant pointer cast (char *) 53273
|
|
Simplifying constant pointer cast (char *) 53274
|
|
Simplifying constant pointer cast (char *) 0
|
|
Simplifying constant pointer cast (char *) 1
|
|
Simplifying constant pointer cast (struct MOS6526_CIA *) 56320
|
|
Simplifying constant pointer cast (void (**)()) 65534
|
|
Simplifying constant integer cast $80
|
|
Simplifying constant integer cast 0
|
|
Successful SSA optimization PassNCastSimplification
|
|
Finalized unsigned number type (char) $80
|
|
Finalized unsigned number type (char) 0
|
|
Successful SSA optimization PassNFinalizeNumberTypeConversions
|
|
if() condition always true - replacing block destination [9] if(true) goto main::@2
|
|
Successful SSA optimization Pass2ConstantIfs
|
|
Removing unused block main::@return
|
|
Successful SSA optimization Pass2EliminateUnusedBlocks
|
|
Removing unused procedure __start
|
|
Removing unused procedure block __start
|
|
Removing unused procedure block __start::@1
|
|
Removing unused procedure block __start::@return
|
|
Successful SSA optimization PassNEliminateEmptyStart
|
|
Adding NOP phi() at start of irq
|
|
Adding NOP phi() at start of irq::@1
|
|
Adding NOP phi() at start of main::@1
|
|
CALL GRAPH
|
|
Calls in [irq] to do_irq:1
|
|
|
|
Created 0 initial phi equivalence classes
|
|
Coalesced down to 0 phi equivalence classes
|
|
Culled Empty Block label irq::@1
|
|
Culled Empty Block label main::@1
|
|
Renumbering block main::@2 to main::@1
|
|
Adding NOP phi() at start of irq
|
|
|
|
FINAL CONTROL FLOW GRAPH
|
|
|
|
__interrupt(hardware_clobber) void irq()
|
|
irq: scope:[irq] from
|
|
[0] phi()
|
|
[1] call do_irq
|
|
to:irq::@return
|
|
irq::@return: scope:[irq] from irq
|
|
[2] return
|
|
to:@return
|
|
|
|
void main()
|
|
main: scope:[main] from
|
|
asm { sei }
|
|
[4] *PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK
|
|
[5] *PROCPORT = PROCPORT_RAM_IO
|
|
[6] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL
|
|
[7] *VICII_CONTROL1 = *VICII_CONTROL1 | $80
|
|
[8] *RASTER = 0
|
|
[9] *IRQ_ENABLE = IRQ_RASTER
|
|
[10] *HARDWARE_IRQ = &irq
|
|
asm { cli }
|
|
to:main::@1
|
|
main::@1: scope:[main] from main main::@1
|
|
[12] *BORDER_COLOR = ++ *BORDER_COLOR
|
|
to:main::@1
|
|
|
|
void do_irq()
|
|
do_irq: scope:[do_irq] from irq
|
|
[13] *BG_COLOR = WHITE
|
|
[14] *BG_COLOR = BLACK
|
|
[15] *IRQ_STATUS = IRQ_RASTER
|
|
to:do_irq::@return
|
|
do_irq::@return: scope:[do_irq] from do_irq
|
|
[16] return
|
|
to:@return
|
|
|
|
|
|
VARIABLE REGISTER WEIGHTS
|
|
void do_irq()
|
|
__interrupt(hardware_clobber) void irq()
|
|
void main()
|
|
|
|
Initial phi equivalence classes
|
|
Complete equivalence classes
|
|
REGISTER UPLIFT POTENTIAL REGISTERS
|
|
Statement [2] return [ ] ( [ ] { } ) always clobbers reg byte a reg byte x reg byte y
|
|
Statement [4] *PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [5] *PROCPORT = PROCPORT_RAM_IO [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [6] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [7] *VICII_CONTROL1 = *VICII_CONTROL1 | $80 [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [8] *RASTER = 0 [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [9] *IRQ_ENABLE = IRQ_RASTER [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [10] *HARDWARE_IRQ = &irq [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [13] *BG_COLOR = WHITE [ ] ( do_irq:1 [ ] { } ) always clobbers reg byte a
|
|
Statement [14] *BG_COLOR = BLACK [ ] ( do_irq:1 [ ] { } ) always clobbers reg byte a
|
|
Statement [15] *IRQ_STATUS = IRQ_RASTER [ ] ( do_irq:1 [ ] { } ) always clobbers reg byte a
|
|
|
|
REGISTER UPLIFT SCOPES
|
|
Uplift Scope [MOS6526_CIA]
|
|
Uplift Scope [MOS6569_VICII]
|
|
Uplift Scope [MOS6581_SID]
|
|
Uplift Scope [main]
|
|
Uplift Scope [irq]
|
|
Uplift Scope [do_irq]
|
|
Uplift Scope []
|
|
|
|
Uplifting [MOS6526_CIA] best 423 combination
|
|
Uplifting [MOS6569_VICII] best 423 combination
|
|
Uplifting [MOS6581_SID] best 423 combination
|
|
Uplifting [main] best 423 combination
|
|
Uplifting [irq] best 423 combination
|
|
Uplifting [do_irq] best 423 combination
|
|
Uplifting [] best 423 combination
|
|
Interrupt procedure irq clobbers AnzPS
|
|
|
|
ASSEMBLER BEFORE OPTIMIZATION
|
|
// File Comments
|
|
// A minimal working raster hardware IRQ with clobber-based register savings
|
|
/// @file
|
|
/// Commodore 64 Registers and Constants
|
|
/// @file
|
|
/// The MOS 6526 Complex Interface Adapter (CIA)
|
|
///
|
|
/// http://archive.6502.org/datasheets/mos_6526_cia_recreated.pdf
|
|
// Upstart
|
|
// Commodore 64 PRG executable file
|
|
.file [name="irq-hardware-clobber-jsr.prg", type="prg", segments="Program"]
|
|
.segmentdef Program [segments="Basic, Code, Data"]
|
|
.segmentdef Basic [start=$0801]
|
|
.segmentdef Code [start=$80d]
|
|
.segmentdef Data [startAfter="Code"]
|
|
.segment Basic
|
|
:BasicUpstart(main)
|
|
// Global Constants & labels
|
|
/// Value that disables all CIA interrupts when stored to the CIA Interrupt registers
|
|
.const CIA_INTERRUPT_CLEAR_ALL = $7f
|
|
/// VICII IRQ Status/Enable Raster
|
|
// @see #IRQ_ENABLE #IRQ_STATUS
|
|
/// 0 | RST| Reaching a certain raster line. The line is specified by writing
|
|
/// | | to register 0xd012 and bit 7 of $d011 and internally stored by
|
|
/// | | the VIC for the raster compare. The test for reaching the
|
|
/// | | interrupt raster line is done in cycle 0 of every line (for line
|
|
/// | | 0, in cycle 1).
|
|
.const IRQ_RASTER = 1
|
|
/// Mask for PROCESSOR_PORT_DDR which allows only memory configuration to be written
|
|
.const PROCPORT_DDR_MEMORY_MASK = 7
|
|
/// RAM in 0xA000, 0xE000 I/O in 0xD000
|
|
.const PROCPORT_RAM_IO = 5
|
|
/// The colors of the C64
|
|
.const BLACK = 0
|
|
.const WHITE = 1
|
|
.const OFFSET_STRUCT_MOS6526_CIA_INTERRUPT = $d
|
|
/// $D012 RASTER Raster counter
|
|
.label RASTER = $d012
|
|
/// $D020 Border Color
|
|
.label BORDER_COLOR = $d020
|
|
/// $D021 Background Color 0
|
|
.label BG_COLOR = $d021
|
|
/// $D011 Control Register #1
|
|
/// - Bit#0-#2: YSCROLL Screen Soft Scroll Vertical
|
|
/// - Bit#3: RSEL Switch betweem 25 or 24 visible rows
|
|
/// RSEL| Display window height | First line | Last line
|
|
/// ----+--------------------------+-------------+----------
|
|
/// 0 | 24 text lines/192 pixels | 55 ($37) | 246 ($f6)
|
|
/// 1 | 25 text lines/200 pixels | 51 ($33) | 250 ($fa)
|
|
/// - Bit#4: DEN Switch VIC-II output on/off
|
|
/// - Bit#5: BMM Turn Bitmap Mode on/off
|
|
/// - Bit#6: ECM Turn Extended Color Mode on/off
|
|
/// - Bit#7: RST8 9th Bit for $D012 Rasterline counter
|
|
/// Initial Value: %10011011
|
|
.label VICII_CONTROL1 = $d011
|
|
/// VIC II IRQ Status Register
|
|
.label IRQ_STATUS = $d019
|
|
/// VIC II IRQ Enable Register
|
|
.label IRQ_ENABLE = $d01a
|
|
/// Processor port data direction register
|
|
.label PROCPORT_DDR = 0
|
|
/// Processor Port Register controlling RAM/ROM configuration and the datasette
|
|
.label PROCPORT = 1
|
|
/// The CIA#1: keyboard matrix, joystick #1/#2
|
|
.label CIA1 = $dc00
|
|
/// The vector used when the HARDWARE serves IRQ interrupts
|
|
.label HARDWARE_IRQ = $fffe
|
|
.segment Code
|
|
// irq
|
|
// Interrupt Routine
|
|
irq: {
|
|
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
|
|
sta rega+1
|
|
// [1] call do_irq
|
|
jsr do_irq
|
|
jmp __breturn
|
|
// irq::@return
|
|
__breturn:
|
|
// [2] return
|
|
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
|
|
rega:
|
|
lda #0
|
|
rti
|
|
}
|
|
// main
|
|
main: {
|
|
// asm { sei }
|
|
sei
|
|
// [4] *PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK -- _deref_pbuc1=vbuc2
|
|
// Disable kernal & basic
|
|
lda #PROCPORT_DDR_MEMORY_MASK
|
|
sta.z PROCPORT_DDR
|
|
// [5] *PROCPORT = PROCPORT_RAM_IO -- _deref_pbuc1=vbuc2
|
|
lda #PROCPORT_RAM_IO
|
|
sta.z PROCPORT
|
|
// [6] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL -- _deref_pbuc1=vbuc2
|
|
// Disable CIA 1 Timer IRQ
|
|
lda #CIA_INTERRUPT_CLEAR_ALL
|
|
sta CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT
|
|
// [7] *VICII_CONTROL1 = *VICII_CONTROL1 | $80 -- _deref_pbuc1=_deref_pbuc1_bor_vbuc2
|
|
// Set raster line to $100
|
|
lda #$80
|
|
ora VICII_CONTROL1
|
|
sta VICII_CONTROL1
|
|
// [8] *RASTER = 0 -- _deref_pbuc1=vbuc2
|
|
lda #0
|
|
sta RASTER
|
|
// [9] *IRQ_ENABLE = IRQ_RASTER -- _deref_pbuc1=vbuc2
|
|
// Enable Raster Interrupt
|
|
lda #IRQ_RASTER
|
|
sta IRQ_ENABLE
|
|
// [10] *HARDWARE_IRQ = &irq -- _deref_qprc1=pprc2
|
|
// Set the IRQ routine
|
|
lda #<irq
|
|
sta HARDWARE_IRQ
|
|
lda #>irq
|
|
sta HARDWARE_IRQ+1
|
|
// asm { cli }
|
|
cli
|
|
jmp __b1
|
|
// main::@1
|
|
__b1:
|
|
// [12] *BORDER_COLOR = ++ *BORDER_COLOR -- _deref_pbuc1=_inc__deref_pbuc1
|
|
inc BORDER_COLOR
|
|
jmp __b1
|
|
}
|
|
// do_irq
|
|
do_irq: {
|
|
// [13] *BG_COLOR = WHITE -- _deref_pbuc1=vbuc2
|
|
lda #WHITE
|
|
sta BG_COLOR
|
|
// [14] *BG_COLOR = BLACK -- _deref_pbuc1=vbuc2
|
|
lda #BLACK
|
|
sta BG_COLOR
|
|
// [15] *IRQ_STATUS = IRQ_RASTER -- _deref_pbuc1=vbuc2
|
|
// Acknowledge the IRQ
|
|
lda #IRQ_RASTER
|
|
sta IRQ_STATUS
|
|
jmp __breturn
|
|
// do_irq::@return
|
|
__breturn:
|
|
// [16] return
|
|
rts
|
|
}
|
|
// File Data
|
|
|
|
ASSEMBLER OPTIMIZATIONS
|
|
Removing instruction jmp __breturn
|
|
Removing instruction jmp __b1
|
|
Removing instruction jmp __breturn
|
|
Succesful ASM optimization Pass5NextJumpElimination
|
|
Removing instruction __breturn:
|
|
Succesful ASM optimization Pass5RedundantLabelElimination
|
|
Removing instruction __breturn:
|
|
Succesful ASM optimization Pass5UnusedLabelElimination
|
|
|
|
FINAL SYMBOL TABLE
|
|
__constant char * const BG_COLOR = (char *) 53281
|
|
__constant const char BLACK = 0
|
|
__constant char * const BORDER_COLOR = (char *) 53280
|
|
__constant struct MOS6526_CIA * const CIA1 = (struct MOS6526_CIA *) 56320
|
|
__constant const char CIA_INTERRUPT_CLEAR_ALL = $7f
|
|
__constant void (** const HARDWARE_IRQ)() = (void (**)()) 65534
|
|
__constant char * const IRQ_ENABLE = (char *) 53274
|
|
__constant const char IRQ_RASTER = 1
|
|
__constant char * const IRQ_STATUS = (char *) 53273
|
|
__constant char OFFSET_STRUCT_MOS6526_CIA_INTERRUPT = $d
|
|
__constant char * const PROCPORT = (char *) 1
|
|
__constant char * const PROCPORT_DDR = (char *) 0
|
|
__constant const char PROCPORT_DDR_MEMORY_MASK = 7
|
|
__constant const char PROCPORT_RAM_IO = 5
|
|
__constant char * const RASTER = (char *) 53266
|
|
__constant char * const VICII_CONTROL1 = (char *) 53265
|
|
__constant const char WHITE = 1
|
|
void do_irq()
|
|
__interrupt(hardware_clobber) void irq()
|
|
void main()
|
|
|
|
|
|
|
|
FINAL ASSEMBLER
|
|
Score: 294
|
|
|
|
// File Comments
|
|
// A minimal working raster hardware IRQ with clobber-based register savings
|
|
/// @file
|
|
/// Commodore 64 Registers and Constants
|
|
/// @file
|
|
/// The MOS 6526 Complex Interface Adapter (CIA)
|
|
///
|
|
/// http://archive.6502.org/datasheets/mos_6526_cia_recreated.pdf
|
|
// Upstart
|
|
// Commodore 64 PRG executable file
|
|
.file [name="irq-hardware-clobber-jsr.prg", type="prg", segments="Program"]
|
|
.segmentdef Program [segments="Basic, Code, Data"]
|
|
.segmentdef Basic [start=$0801]
|
|
.segmentdef Code [start=$80d]
|
|
.segmentdef Data [startAfter="Code"]
|
|
.segment Basic
|
|
:BasicUpstart(main)
|
|
// Global Constants & labels
|
|
/// Value that disables all CIA interrupts when stored to the CIA Interrupt registers
|
|
.const CIA_INTERRUPT_CLEAR_ALL = $7f
|
|
/// VICII IRQ Status/Enable Raster
|
|
// @see #IRQ_ENABLE #IRQ_STATUS
|
|
/// 0 | RST| Reaching a certain raster line. The line is specified by writing
|
|
/// | | to register 0xd012 and bit 7 of $d011 and internally stored by
|
|
/// | | the VIC for the raster compare. The test for reaching the
|
|
/// | | interrupt raster line is done in cycle 0 of every line (for line
|
|
/// | | 0, in cycle 1).
|
|
.const IRQ_RASTER = 1
|
|
/// Mask for PROCESSOR_PORT_DDR which allows only memory configuration to be written
|
|
.const PROCPORT_DDR_MEMORY_MASK = 7
|
|
/// RAM in 0xA000, 0xE000 I/O in 0xD000
|
|
.const PROCPORT_RAM_IO = 5
|
|
/// The colors of the C64
|
|
.const BLACK = 0
|
|
.const WHITE = 1
|
|
.const OFFSET_STRUCT_MOS6526_CIA_INTERRUPT = $d
|
|
/// $D012 RASTER Raster counter
|
|
.label RASTER = $d012
|
|
/// $D020 Border Color
|
|
.label BORDER_COLOR = $d020
|
|
/// $D021 Background Color 0
|
|
.label BG_COLOR = $d021
|
|
/// $D011 Control Register #1
|
|
/// - Bit#0-#2: YSCROLL Screen Soft Scroll Vertical
|
|
/// - Bit#3: RSEL Switch betweem 25 or 24 visible rows
|
|
/// RSEL| Display window height | First line | Last line
|
|
/// ----+--------------------------+-------------+----------
|
|
/// 0 | 24 text lines/192 pixels | 55 ($37) | 246 ($f6)
|
|
/// 1 | 25 text lines/200 pixels | 51 ($33) | 250 ($fa)
|
|
/// - Bit#4: DEN Switch VIC-II output on/off
|
|
/// - Bit#5: BMM Turn Bitmap Mode on/off
|
|
/// - Bit#6: ECM Turn Extended Color Mode on/off
|
|
/// - Bit#7: RST8 9th Bit for $D012 Rasterline counter
|
|
/// Initial Value: %10011011
|
|
.label VICII_CONTROL1 = $d011
|
|
/// VIC II IRQ Status Register
|
|
.label IRQ_STATUS = $d019
|
|
/// VIC II IRQ Enable Register
|
|
.label IRQ_ENABLE = $d01a
|
|
/// Processor port data direction register
|
|
.label PROCPORT_DDR = 0
|
|
/// Processor Port Register controlling RAM/ROM configuration and the datasette
|
|
.label PROCPORT = 1
|
|
/// The CIA#1: keyboard matrix, joystick #1/#2
|
|
.label CIA1 = $dc00
|
|
/// The vector used when the HARDWARE serves IRQ interrupts
|
|
.label HARDWARE_IRQ = $fffe
|
|
.segment Code
|
|
// irq
|
|
// Interrupt Routine
|
|
irq: {
|
|
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
|
|
sta rega+1
|
|
// do_irq()
|
|
// [1] call do_irq
|
|
jsr do_irq
|
|
// irq::@return
|
|
// }
|
|
// [2] return
|
|
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
|
|
rega:
|
|
lda #0
|
|
rti
|
|
}
|
|
// main
|
|
main: {
|
|
// asm
|
|
// asm { sei }
|
|
sei
|
|
// *PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK
|
|
// [4] *PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK -- _deref_pbuc1=vbuc2
|
|
// Disable kernal & basic
|
|
lda #PROCPORT_DDR_MEMORY_MASK
|
|
sta.z PROCPORT_DDR
|
|
// *PROCPORT = PROCPORT_RAM_IO
|
|
// [5] *PROCPORT = PROCPORT_RAM_IO -- _deref_pbuc1=vbuc2
|
|
lda #PROCPORT_RAM_IO
|
|
sta.z PROCPORT
|
|
// CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR_ALL
|
|
// [6] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL -- _deref_pbuc1=vbuc2
|
|
// Disable CIA 1 Timer IRQ
|
|
lda #CIA_INTERRUPT_CLEAR_ALL
|
|
sta CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT
|
|
// *VICII_CONTROL1 |=$80
|
|
// [7] *VICII_CONTROL1 = *VICII_CONTROL1 | $80 -- _deref_pbuc1=_deref_pbuc1_bor_vbuc2
|
|
// Set raster line to $100
|
|
lda #$80
|
|
ora VICII_CONTROL1
|
|
sta VICII_CONTROL1
|
|
// *RASTER = $00
|
|
// [8] *RASTER = 0 -- _deref_pbuc1=vbuc2
|
|
lda #0
|
|
sta RASTER
|
|
// *IRQ_ENABLE = IRQ_RASTER
|
|
// [9] *IRQ_ENABLE = IRQ_RASTER -- _deref_pbuc1=vbuc2
|
|
// Enable Raster Interrupt
|
|
lda #IRQ_RASTER
|
|
sta IRQ_ENABLE
|
|
// *HARDWARE_IRQ = &irq
|
|
// [10] *HARDWARE_IRQ = &irq -- _deref_qprc1=pprc2
|
|
// Set the IRQ routine
|
|
lda #<irq
|
|
sta HARDWARE_IRQ
|
|
lda #>irq
|
|
sta HARDWARE_IRQ+1
|
|
// asm
|
|
// asm { cli }
|
|
cli
|
|
// main::@1
|
|
__b1:
|
|
// (*BORDER_COLOR)++;
|
|
// [12] *BORDER_COLOR = ++ *BORDER_COLOR -- _deref_pbuc1=_inc__deref_pbuc1
|
|
inc BORDER_COLOR
|
|
jmp __b1
|
|
}
|
|
// do_irq
|
|
do_irq: {
|
|
// *BG_COLOR = WHITE
|
|
// [13] *BG_COLOR = WHITE -- _deref_pbuc1=vbuc2
|
|
lda #WHITE
|
|
sta BG_COLOR
|
|
// *BG_COLOR = BLACK
|
|
// [14] *BG_COLOR = BLACK -- _deref_pbuc1=vbuc2
|
|
lda #BLACK
|
|
sta BG_COLOR
|
|
// *IRQ_STATUS = IRQ_RASTER
|
|
// [15] *IRQ_STATUS = IRQ_RASTER -- _deref_pbuc1=vbuc2
|
|
// Acknowledge the IRQ
|
|
lda #IRQ_RASTER
|
|
sta IRQ_STATUS
|
|
// do_irq::@return
|
|
// }
|
|
// [16] return
|
|
rts
|
|
}
|
|
// File Data
|
|
|