mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-01-11 20:30:08 +00:00
Added IRQ to mega65 memory banking example.
This commit is contained in:
parent
b1e465b72b
commit
5b2f43a40c
@ -1,4 +1,4 @@
|
||||
// SID music located in another bank being played using memory mapping on MEGA65
|
||||
// SID music located in another bank being played in a raster IRQ using memory mapping on the MEGA65
|
||||
// Music is Cybernoid II by Jeroen Tel released in 1988 by Hewson https://csdb.dk/sid/?id=28140
|
||||
// SID relocated using http://www.linusakesson.net/software/sidreloc/index.php
|
||||
#pragma target(mega65)
|
||||
@ -8,6 +8,20 @@
|
||||
void main() {
|
||||
// Stop IRQ's
|
||||
asm { sei }
|
||||
// Map memory to BANK 0 : 0x00XXXX - giving access to I/O
|
||||
memoryRemap(0,0,0);
|
||||
// Enable MEGA65 features
|
||||
VICIII->KEY = 0x47;
|
||||
VICIII->KEY = 0x53;
|
||||
// Enable 48MHz fast mode
|
||||
VICIV->CONTROLB |= 0x40;
|
||||
VICIV->CONTROLC |= 0x40;
|
||||
// no kernal or BASIC rom visible
|
||||
*PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK;
|
||||
*PROCPORT = PROCPORT_RAM_IO;
|
||||
// open sideborder
|
||||
VICIV->SIDBDRWD_LO = 1;
|
||||
|
||||
// Remap [$4000-$5fff] to point to [$10000-$11fff]
|
||||
memoryRemapBlock(0x40, 0x100);
|
||||
// Transfer banked code/data to upper memory ($11000)
|
||||
@ -18,29 +32,50 @@ void main() {
|
||||
// Reset memory mapping
|
||||
memoryRemap(0,0,0);
|
||||
|
||||
// Pointer to (unmapped) $4000 used for overwriting to demonstrate the mapping works
|
||||
char* mem_destroy = MUSIC;
|
||||
|
||||
for(;;) {
|
||||
// Overwrite data in the unmapped memory where the music is mapped in (to demonstrate that mapping works)
|
||||
*mem_destroy = 0;
|
||||
if(++mem_destroy==MUSIC_END) mem_destroy = MUSIC;
|
||||
// Wait for the raster
|
||||
while(VICII->RASTER!=0xff) ;
|
||||
// Color border
|
||||
(VICII->BORDER_COLOR)++;
|
||||
// Remap memory to put music at $4000
|
||||
memoryRemapBlock(0x40, 0x100);
|
||||
// Play remapped SID
|
||||
(*musicPlay)();
|
||||
// Reset memory mapping
|
||||
memoryRemap(0,0,0);
|
||||
// Color border
|
||||
(VICII->BORDER_COLOR)--;
|
||||
// Wait for the raster
|
||||
while(VICII->RASTER==0xff) ;
|
||||
}
|
||||
// Set up raster interrupts C64 style
|
||||
// Disable CIA 1 Timer IRQ
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
// Set raster line to 0xff
|
||||
VICII->RASTER = 0xff;
|
||||
VICII->CONTROL1 &= 0x7f;
|
||||
// Enable Raster Interrupt
|
||||
VICII->IRQ_ENABLE = IRQ_RASTER;
|
||||
// Set the IRQ routine
|
||||
*HARDWARE_IRQ = &irq;
|
||||
|
||||
// Enable IRQ
|
||||
asm { cli }
|
||||
|
||||
// Loop forever - while copying unmapped MUSIC memory to screen (to demonstrate that mapping works)
|
||||
for(;;)
|
||||
for(char i=0;i<240;i++)
|
||||
DEFAULT_SCREEN[i] = MUSIC[i];
|
||||
|
||||
}
|
||||
|
||||
// Index used to destroy unmapped music memory (to demonstrate that mapping works)
|
||||
volatile char mem_destroy_i = 0;
|
||||
|
||||
// Raster IRQ routine
|
||||
interrupt(hardware_stack) void irq() {
|
||||
// Acknowledge the IRQ
|
||||
VICII->IRQ_STATUS = IRQ_RASTER;
|
||||
// Overwrite data in the unmapped memory where the music is mapped in (to demonstrate that mapping works)
|
||||
MUSIC[mem_destroy_i++]++;
|
||||
// Wait for the raster
|
||||
while(VICII->RASTER!=0xff) ;
|
||||
// Color border
|
||||
(VICII->BORDER_COLOR)++;
|
||||
// Remap memory to put music at $4000
|
||||
memoryRemapBlock(0x40, 0x100);
|
||||
// Play remapped SID
|
||||
(*musicPlay)();
|
||||
// Reset memory mapping
|
||||
memoryRemap(0,0,0);
|
||||
// Wait for the raster
|
||||
while(VICII->RASTER==0xff) ;
|
||||
// Color border
|
||||
(VICII->BORDER_COLOR)--;
|
||||
}
|
||||
|
||||
// Array containing the banked upper memory code/data to be transferred to upper memory before execution
|
||||
@ -48,7 +83,7 @@ char upperCodeData[] = kickasm {{
|
||||
.segmentout [segments="Banked"]
|
||||
}};
|
||||
|
||||
// Code and data to be put into upper memory, which will be banked into $4000
|
||||
// Code and data to be put into upper memory, which will be banked into $4000 by mempry mapping
|
||||
#pragma code_seg(CodeBanked)
|
||||
#pragma data_seg(DataBanked)
|
||||
|
||||
@ -57,10 +92,8 @@ __address(0x4000) char MUSIC[] = kickasm(resource "Cybernoid_II_4000.sid") {{
|
||||
.const music = LoadSid("Cybernoid_II_4000.sid")
|
||||
.fill music.size, music.getData(i)
|
||||
}};
|
||||
|
||||
// Address after the end of the music
|
||||
char * const MUSIC_END = 0x5200;
|
||||
|
||||
// Pointer to the music init routine
|
||||
void()* musicInit = (void()*) MUSIC;
|
||||
// Pointer to the music play routine
|
||||
|
@ -1,4 +1,4 @@
|
||||
// SID music located in another bank being played using memory mapping on MEGA65
|
||||
// SID music located in another bank being played in a raster IRQ using memory mapping on the MEGA65
|
||||
// Music is Cybernoid II by Jeroen Tel released in 1988 by Hewson https://csdb.dk/sid/?id=28140
|
||||
// SID relocated using http://www.linusakesson.net/software/sidreloc/index.php
|
||||
.cpu _45gs02
|
||||
@ -14,27 +14,154 @@
|
||||
.segment Basic
|
||||
.byte $0a, $20, $0a, $00, $fe, $02, $20, $30, $00 // 10 BANK 0
|
||||
.byte $15, $20, $14, $00, $9e, $20 // 20 SYS
|
||||
.text toIntString(main) // NNNN
|
||||
.text toIntString(__start) // NNNN
|
||||
.byte $00, $00, $00 //
|
||||
// Value that disables all CIA interrupts when stored to the CIA Interrupt registers
|
||||
.const CIA_INTERRUPT_CLEAR = $7f
|
||||
// Bits for the VICII IRQ Status/Enable Registers
|
||||
.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
|
||||
.const OFFSET_STRUCT_MOS4569_VICIII_KEY = $2f
|
||||
.const OFFSET_STRUCT_MEGA65_VICIV_CONTROLB = $31
|
||||
.const OFFSET_STRUCT_MEGA65_VICIV_CONTROLC = $54
|
||||
.const OFFSET_STRUCT_MEGA65_VICIV_SIDBDRWD_LO = $5c
|
||||
.const OFFSET_STRUCT_MOS6526_CIA_INTERRUPT = $d
|
||||
.const OFFSET_STRUCT_MOS6569_VICII_RASTER = $12
|
||||
.const OFFSET_STRUCT_MOS6569_VICII_CONTROL1 = $11
|
||||
.const OFFSET_STRUCT_MOS6569_VICII_IRQ_ENABLE = $1a
|
||||
.const OFFSET_STRUCT_MOS6569_VICII_IRQ_STATUS = $19
|
||||
.const OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR = $20
|
||||
// Processor port data direction register
|
||||
.label PROCPORT_DDR = 0
|
||||
// Processor Port Register controlling RAM/ROM configuration and the datasette
|
||||
.label PROCPORT = 1
|
||||
// The VIC-II MOS 6567/6569
|
||||
.label VICII = $d000
|
||||
// The VIC III MOS 4567/4569
|
||||
.label VICIII = $d000
|
||||
// The VIC IV
|
||||
.label VICIV = $d000
|
||||
// Default address of screen character matrix
|
||||
.label DEFAULT_SCREEN = $800
|
||||
// The CIA#1: keyboard matrix, joystick #1/#2
|
||||
.label CIA1 = $dc00
|
||||
// The vector used when the HARDWARE serves IRQ interrupts
|
||||
.label HARDWARE_IRQ = $fffe
|
||||
// Address after the end of the music
|
||||
.label MUSIC_END = $5200
|
||||
// Pointer to the music init routine
|
||||
.label musicInit = MUSIC
|
||||
// Pointer to the music play routine
|
||||
.label musicPlay = MUSIC+3
|
||||
// Index used to destroy unmapped music memory (to demonstrate that mapping works)
|
||||
.label mem_destroy_i = $a
|
||||
.segment Code
|
||||
__start: {
|
||||
// mem_destroy_i = 0
|
||||
lda #0
|
||||
sta.z mem_destroy_i
|
||||
jsr main
|
||||
rts
|
||||
}
|
||||
// Raster IRQ routine
|
||||
irq: {
|
||||
pha
|
||||
txa
|
||||
pha
|
||||
tya
|
||||
pha
|
||||
// VICII->IRQ_STATUS = IRQ_RASTER
|
||||
// Acknowledge the IRQ
|
||||
lda #IRQ_RASTER
|
||||
sta VICII+OFFSET_STRUCT_MOS6569_VICII_IRQ_STATUS
|
||||
// MUSIC[mem_destroy_i++]++;
|
||||
ldx.z mem_destroy_i
|
||||
inc MUSIC,x
|
||||
inc.z mem_destroy_i
|
||||
// Wait for the raster
|
||||
__b1:
|
||||
// while(VICII->RASTER!=0xff)
|
||||
lda #$ff
|
||||
cmp VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER
|
||||
bne __b1
|
||||
// (VICII->BORDER_COLOR)++;
|
||||
inc VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR
|
||||
// memoryRemapBlock(0x40, 0x100)
|
||||
// Remap memory to put music at $4000
|
||||
jsr memoryRemapBlock
|
||||
// (*musicPlay)()
|
||||
// Play remapped SID
|
||||
jsr musicPlay
|
||||
// memoryRemap(0,0,0)
|
||||
// Reset memory mapping
|
||||
lda #<0
|
||||
sta.z memoryRemap.upperPageOffset
|
||||
sta.z memoryRemap.upperPageOffset+1
|
||||
ldz #0
|
||||
sta.z memoryRemap.lowerPageOffset
|
||||
sta.z memoryRemap.lowerPageOffset+1
|
||||
jsr memoryRemap
|
||||
// Wait for the raster
|
||||
__b3:
|
||||
// while(VICII->RASTER==0xff)
|
||||
lda #$ff
|
||||
cmp VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER
|
||||
beq __b3
|
||||
// (VICII->BORDER_COLOR)--;
|
||||
dec VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR
|
||||
// }
|
||||
pla
|
||||
tay
|
||||
pla
|
||||
tax
|
||||
pla
|
||||
rti
|
||||
}
|
||||
main: {
|
||||
.label dst = 2
|
||||
.label src = 4
|
||||
// Pointer to (unmapped) $4000 used for overwriting to demonstrate the mapping works
|
||||
.label mem_destroy = 6
|
||||
// asm
|
||||
// Stop IRQ's
|
||||
sei
|
||||
// memoryRemap(0,0,0)
|
||||
// Map memory to BANK 0 : 0x00XXXX - giving access to I/O
|
||||
lda #<0
|
||||
sta.z memoryRemap.upperPageOffset
|
||||
sta.z memoryRemap.upperPageOffset+1
|
||||
ldz #0
|
||||
sta.z memoryRemap.lowerPageOffset
|
||||
sta.z memoryRemap.lowerPageOffset+1
|
||||
jsr memoryRemap
|
||||
// VICIII->KEY = 0x47
|
||||
// Enable MEGA65 features
|
||||
lda #$47
|
||||
sta VICIII+OFFSET_STRUCT_MOS4569_VICIII_KEY
|
||||
// VICIII->KEY = 0x53
|
||||
lda #$53
|
||||
sta VICIII+OFFSET_STRUCT_MOS4569_VICIII_KEY
|
||||
// VICIV->CONTROLB |= 0x40
|
||||
// Enable 48MHz fast mode
|
||||
lda #$40
|
||||
ora VICIV+OFFSET_STRUCT_MEGA65_VICIV_CONTROLB
|
||||
sta VICIV+OFFSET_STRUCT_MEGA65_VICIV_CONTROLB
|
||||
// VICIV->CONTROLC |= 0x40
|
||||
lda #$40
|
||||
ora VICIV+OFFSET_STRUCT_MEGA65_VICIV_CONTROLC
|
||||
sta VICIV+OFFSET_STRUCT_MEGA65_VICIV_CONTROLC
|
||||
// *PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK
|
||||
// no kernal or BASIC rom visible
|
||||
lda #PROCPORT_DDR_MEMORY_MASK
|
||||
sta PROCPORT_DDR
|
||||
// *PROCPORT = PROCPORT_RAM_IO
|
||||
lda #PROCPORT_RAM_IO
|
||||
sta PROCPORT
|
||||
// VICIV->SIDBDRWD_LO = 1
|
||||
// open sideborder
|
||||
lda #1
|
||||
sta VICIV+OFFSET_STRUCT_MEGA65_VICIV_SIDBDRWD_LO
|
||||
// memoryRemapBlock(0x40, 0x100)
|
||||
// Remap [$4000-$5fff] to point to [$10000-$11fff]
|
||||
jsr memoryRemapBlock
|
||||
@ -69,59 +196,44 @@ main: {
|
||||
sta.z memoryRemap.lowerPageOffset
|
||||
sta.z memoryRemap.lowerPageOffset+1
|
||||
jsr memoryRemap
|
||||
lda #<MUSIC
|
||||
sta.z mem_destroy
|
||||
lda #>MUSIC
|
||||
sta.z mem_destroy+1
|
||||
// CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR
|
||||
// Set up raster interrupts C64 style
|
||||
// Disable CIA 1 Timer IRQ
|
||||
lda #CIA_INTERRUPT_CLEAR
|
||||
sta CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT
|
||||
// VICII->RASTER = 0xff
|
||||
// Set raster line to 0xff
|
||||
lda #$ff
|
||||
sta VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER
|
||||
// VICII->CONTROL1 &= 0x7f
|
||||
lda #$7f
|
||||
and VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL1
|
||||
sta VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL1
|
||||
// VICII->IRQ_ENABLE = IRQ_RASTER
|
||||
// Enable Raster Interrupt
|
||||
lda #IRQ_RASTER
|
||||
sta VICII+OFFSET_STRUCT_MOS6569_VICII_IRQ_ENABLE
|
||||
// *HARDWARE_IRQ = &irq
|
||||
// Set the IRQ routine
|
||||
lda #<irq
|
||||
sta HARDWARE_IRQ
|
||||
lda #>irq
|
||||
sta HARDWARE_IRQ+1
|
||||
// asm
|
||||
// Enable IRQ
|
||||
cli
|
||||
__b4:
|
||||
// *mem_destroy = 0
|
||||
// Overwrite data in the unmapped memory where the music is mapped in (to demonstrate that mapping works)
|
||||
lda #0
|
||||
tay
|
||||
sta (mem_destroy),y
|
||||
// if(++mem_destroy==MUSIC_END)
|
||||
inw.z mem_destroy
|
||||
lda.z mem_destroy+1
|
||||
cmp #>MUSIC_END
|
||||
bne __b10
|
||||
lda.z mem_destroy
|
||||
cmp #<MUSIC_END
|
||||
bne __b10
|
||||
lda #<MUSIC
|
||||
sta.z mem_destroy
|
||||
lda #>MUSIC
|
||||
sta.z mem_destroy+1
|
||||
__b10:
|
||||
// Wait for the raster
|
||||
// while(VICII->RASTER!=0xff)
|
||||
lda #$ff
|
||||
cmp VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER
|
||||
bne __b10
|
||||
// (VICII->BORDER_COLOR)++;
|
||||
inc VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR
|
||||
// memoryRemapBlock(0x40, 0x100)
|
||||
// Remap memory to put music at $4000
|
||||
jsr memoryRemapBlock
|
||||
// (*musicPlay)()
|
||||
// Play remapped SID
|
||||
jsr musicPlay
|
||||
// memoryRemap(0,0,0)
|
||||
// Reset memory mapping
|
||||
lda #<0
|
||||
sta.z memoryRemap.upperPageOffset
|
||||
sta.z memoryRemap.upperPageOffset+1
|
||||
ldz #0
|
||||
sta.z memoryRemap.lowerPageOffset
|
||||
sta.z memoryRemap.lowerPageOffset+1
|
||||
jsr memoryRemap
|
||||
// (VICII->BORDER_COLOR)--;
|
||||
dec VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR
|
||||
// Wait for the raster
|
||||
__b7:
|
||||
// while(VICII->RASTER==0xff)
|
||||
lda #$ff
|
||||
cmp VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER
|
||||
beq __b7
|
||||
// for(char i=0;i<240;i++)
|
||||
cpx #$f0
|
||||
bcc __b5
|
||||
ldx #0
|
||||
jmp __b4
|
||||
__b5:
|
||||
// DEFAULT_SCREEN[i] = MUSIC[i]
|
||||
lda MUSIC,x
|
||||
sta DEFAULT_SCREEN,x
|
||||
// for(char i=0;i<240;i++)
|
||||
inx
|
||||
jmp __b4
|
||||
__b2:
|
||||
// *dst++ = *src++
|
||||
@ -180,16 +292,16 @@ memoryRemapBlock: {
|
||||
// - If block 5 ($a000-$bfff) is remapped it will point to upperPageOffset*$100 + $a000.
|
||||
// - If block 6 ($c000-$dfff) is remapped it will point to upperPageOffset*$100 + $c000.
|
||||
// - If block 7 ($e000-$ffff) is remapped it will point to upperPageOffset*$100 + $e000.
|
||||
// memoryRemap(byte register(Z) remapBlocks, word zp(8) lowerPageOffset, word zp($a) upperPageOffset)
|
||||
// memoryRemap(byte register(Z) remapBlocks, word zp(6) lowerPageOffset, word zp(8) upperPageOffset)
|
||||
memoryRemap: {
|
||||
.label aVal = $fc
|
||||
.label xVal = $fd
|
||||
.label yVal = $fe
|
||||
.label zVal = $ff
|
||||
.label __1 = $c
|
||||
.label __6 = $d
|
||||
.label lowerPageOffset = 8
|
||||
.label upperPageOffset = $a
|
||||
.label __1 = $b
|
||||
.label __6 = $c
|
||||
.label lowerPageOffset = 6
|
||||
.label upperPageOffset = 8
|
||||
// <lowerPageOffset
|
||||
lda.z lowerPageOffset
|
||||
// *aVal = <lowerPageOffset
|
||||
|
@ -1,81 +1,122 @@
|
||||
|
||||
(void()) __start()
|
||||
__start: scope:[__start] from
|
||||
[0] phi()
|
||||
to:__start::__init1
|
||||
__start::__init1: scope:[__start] from __start
|
||||
[1] (volatile byte) mem_destroy_i ← (byte) 0
|
||||
to:__start::@1
|
||||
__start::@1: scope:[__start] from __start::__init1
|
||||
[2] phi()
|
||||
[3] call main
|
||||
to:__start::@return
|
||||
__start::@return: scope:[__start] from __start::@1
|
||||
[4] return
|
||||
to:@return
|
||||
|
||||
interrupt(HARDWARE_STACK)(void()) irq()
|
||||
irq: scope:[irq] from
|
||||
[5] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_IRQ_STATUS) ← (const nomodify byte) IRQ_RASTER
|
||||
[6] *((const byte*) MUSIC + (volatile byte) mem_destroy_i) ← ++ *((const byte*) MUSIC + (volatile byte) mem_destroy_i)
|
||||
[7] (volatile byte) mem_destroy_i ← ++ (volatile byte) mem_destroy_i
|
||||
to:irq::@1
|
||||
irq::@1: scope:[irq] from irq irq::@1
|
||||
[8] if(*((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_RASTER)!=(byte) $ff) goto irq::@1
|
||||
to:irq::@2
|
||||
irq::@2: scope:[irq] from irq::@1
|
||||
[9] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) ← ++ *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR)
|
||||
[10] call memoryRemapBlock
|
||||
to:irq::@5
|
||||
irq::@5: scope:[irq] from irq::@2
|
||||
[11] call *((const void()*) musicPlay)
|
||||
[12] call memoryRemap
|
||||
to:irq::@3
|
||||
irq::@3: scope:[irq] from irq::@3 irq::@5
|
||||
[13] if(*((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_RASTER)==(byte) $ff) goto irq::@3
|
||||
to:irq::@4
|
||||
irq::@4: scope:[irq] from irq::@3
|
||||
[14] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) ← -- *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR)
|
||||
to:irq::@return
|
||||
irq::@return: scope:[irq] from irq::@4
|
||||
[15] return
|
||||
to:@return
|
||||
|
||||
(void()) main()
|
||||
main: scope:[main] from
|
||||
main: scope:[main] from __start::@1
|
||||
asm { sei }
|
||||
[1] call memoryRemapBlock
|
||||
[17] call memoryRemap
|
||||
to:main::@6
|
||||
main::@6: scope:[main] from main
|
||||
[18] *((byte*)(const nomodify struct MOS4569_VICIII*) VICIII+(const byte) OFFSET_STRUCT_MOS4569_VICIII_KEY) ← (byte) $47
|
||||
[19] *((byte*)(const nomodify struct MOS4569_VICIII*) VICIII+(const byte) OFFSET_STRUCT_MOS4569_VICIII_KEY) ← (byte) $53
|
||||
[20] *((byte*)(const nomodify struct MEGA65_VICIV*) VICIV+(const byte) OFFSET_STRUCT_MEGA65_VICIV_CONTROLB) ← *((byte*)(const nomodify struct MEGA65_VICIV*) VICIV+(const byte) OFFSET_STRUCT_MEGA65_VICIV_CONTROLB) | (byte) $40
|
||||
[21] *((byte*)(const nomodify struct MEGA65_VICIV*) VICIV+(const byte) OFFSET_STRUCT_MEGA65_VICIV_CONTROLC) ← *((byte*)(const nomodify struct MEGA65_VICIV*) VICIV+(const byte) OFFSET_STRUCT_MEGA65_VICIV_CONTROLC) | (byte) $40
|
||||
[22] *((const nomodify byte*) PROCPORT_DDR) ← (const nomodify byte) PROCPORT_DDR_MEMORY_MASK
|
||||
[23] *((const nomodify byte*) PROCPORT) ← (const nomodify byte) PROCPORT_RAM_IO
|
||||
[24] *((byte*)(const nomodify struct MEGA65_VICIV*) VICIV+(const byte) OFFSET_STRUCT_MEGA65_VICIV_SIDBDRWD_LO) ← (byte) 1
|
||||
[25] call memoryRemapBlock
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@2
|
||||
[2] (byte*) main::src#2 ← phi( main::@2/(byte*) main::src#1 main/(const byte*) upperCodeData )
|
||||
[2] (byte*) main::dst#2 ← phi( main::@2/(byte*) main::dst#1 main/(const byte*) MUSIC )
|
||||
[3] if((byte*) main::dst#2<(const nomodify byte*) MUSIC_END) goto main::@2
|
||||
main::@1: scope:[main] from main::@2 main::@6
|
||||
[26] (byte*) main::src#2 ← phi( main::@2/(byte*) main::src#1 main::@6/(const byte*) upperCodeData )
|
||||
[26] (byte*) main::dst#2 ← phi( main::@2/(byte*) main::dst#1 main::@6/(const byte*) MUSIC )
|
||||
[27] if((byte*) main::dst#2<(const nomodify byte*) MUSIC_END) goto main::@2
|
||||
to:main::@3
|
||||
main::@3: scope:[main] from main::@1
|
||||
[4] call *((const void()*) musicInit)
|
||||
[5] call memoryRemap
|
||||
to:main::@4
|
||||
main::@4: scope:[main] from main::@3 main::@7
|
||||
[6] (byte*) main::mem_destroy#3 ← phi( main::@3/(const byte*) MUSIC main::@7/(byte*) main::mem_destroy#5 )
|
||||
[7] *((byte*) main::mem_destroy#3) ← (byte) 0
|
||||
[8] (byte*) main::mem_destroy#1 ← ++ (byte*) main::mem_destroy#3
|
||||
[9] if((byte*) main::mem_destroy#1!=(const nomodify byte*) MUSIC_END) goto main::@10
|
||||
to:main::@5
|
||||
main::@10: scope:[main] from main::@4
|
||||
[10] phi()
|
||||
to:main::@5
|
||||
main::@5: scope:[main] from main::@10 main::@4 main::@5
|
||||
[11] (byte*) main::mem_destroy#5 ← phi( main::@10/(byte*) main::mem_destroy#1 main::@5/(byte*) main::mem_destroy#5 main::@4/(const byte*) MUSIC )
|
||||
[12] if(*((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_RASTER)!=(byte) $ff) goto main::@5
|
||||
to:main::@6
|
||||
main::@6: scope:[main] from main::@5
|
||||
[13] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) ← ++ *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR)
|
||||
[14] call memoryRemapBlock
|
||||
to:main::@8
|
||||
main::@8: scope:[main] from main::@6
|
||||
[15] call *((const void()*) musicPlay)
|
||||
[16] call memoryRemap
|
||||
to:main::@9
|
||||
main::@9: scope:[main] from main::@8
|
||||
[17] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) ← -- *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR)
|
||||
[28] call *((const void()*) musicInit)
|
||||
[29] call memoryRemap
|
||||
to:main::@7
|
||||
main::@7: scope:[main] from main::@7 main::@9
|
||||
[18] if(*((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_RASTER)==(byte) $ff) goto main::@7
|
||||
main::@7: scope:[main] from main::@3
|
||||
[30] *((byte*)(const nomodify struct MOS6526_CIA*) CIA1+(const byte) OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) ← (const nomodify byte) CIA_INTERRUPT_CLEAR
|
||||
[31] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_RASTER) ← (byte) $ff
|
||||
[32] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_CONTROL1) ← *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_CONTROL1) & (byte) $7f
|
||||
[33] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_IRQ_ENABLE) ← (const nomodify byte) IRQ_RASTER
|
||||
[34] *((const nomodify void()**) HARDWARE_IRQ) ← &interrupt(HARDWARE_STACK)(void()) irq()
|
||||
asm { cli }
|
||||
to:main::@4
|
||||
main::@4: scope:[main] from main::@4 main::@5 main::@7
|
||||
[36] (byte) main::i#2 ← phi( main::@4/(byte) 0 main::@5/(byte) main::i#1 )
|
||||
[37] if((byte) main::i#2<(byte) $f0) goto main::@5
|
||||
to:main::@4
|
||||
main::@5: scope:[main] from main::@4
|
||||
[38] *((const nomodify byte*) DEFAULT_SCREEN + (byte) main::i#2) ← *((const byte*) MUSIC + (byte) main::i#2)
|
||||
[39] (byte) main::i#1 ← ++ (byte) main::i#2
|
||||
to:main::@4
|
||||
main::@2: scope:[main] from main::@1
|
||||
[19] *((byte*) main::dst#2) ← *((byte*) main::src#2)
|
||||
[20] (byte*) main::dst#1 ← ++ (byte*) main::dst#2
|
||||
[21] (byte*) main::src#1 ← ++ (byte*) main::src#2
|
||||
[40] *((byte*) main::dst#2) ← *((byte*) main::src#2)
|
||||
[41] (byte*) main::dst#1 ← ++ (byte*) main::dst#2
|
||||
[42] (byte*) main::src#1 ← ++ (byte*) main::src#2
|
||||
to:main::@1
|
||||
|
||||
(void()) memoryRemapBlock((byte) memoryRemapBlock::blockPage , (word) memoryRemapBlock::memoryPage)
|
||||
memoryRemapBlock: scope:[memoryRemapBlock] from main main::@6
|
||||
[22] phi()
|
||||
[23] call memoryRemap
|
||||
memoryRemapBlock: scope:[memoryRemapBlock] from irq::@2 main::@6
|
||||
[43] phi()
|
||||
[44] call memoryRemap
|
||||
to:memoryRemapBlock::@return
|
||||
memoryRemapBlock::@return: scope:[memoryRemapBlock] from memoryRemapBlock
|
||||
[24] return
|
||||
[45] return
|
||||
to:@return
|
||||
|
||||
(void()) memoryRemap((byte) memoryRemap::remapBlocks , (word) memoryRemap::lowerPageOffset , (word) memoryRemap::upperPageOffset)
|
||||
memoryRemap: scope:[memoryRemap] from main::@3 main::@8 memoryRemapBlock
|
||||
[25] (word) memoryRemap::upperPageOffset#3 ← phi( main::@8/(byte) 0 main::@3/(byte) 0 memoryRemapBlock/(const word) memoryRemapBlock::pageOffset#0 )
|
||||
[25] (byte) memoryRemap::remapBlocks#3 ← phi( main::@8/(byte) 0 main::@3/(byte) 0 memoryRemapBlock/(const byte) memoryRemapBlock::blockBits#0 )
|
||||
[25] (word) memoryRemap::lowerPageOffset#3 ← phi( main::@8/(byte) 0 main::@3/(byte) 0 memoryRemapBlock/(const word) memoryRemapBlock::pageOffset#0 )
|
||||
[26] (byte~) memoryRemap::$0 ← < (word) memoryRemap::lowerPageOffset#3
|
||||
[27] *((const byte*) memoryRemap::aVal) ← (byte~) memoryRemap::$0
|
||||
[28] (byte~) memoryRemap::$1 ← (byte) memoryRemap::remapBlocks#3 << (byte) 4
|
||||
[29] (byte~) memoryRemap::$2 ← > (word) memoryRemap::lowerPageOffset#3
|
||||
[30] (byte~) memoryRemap::$3 ← (byte~) memoryRemap::$2 & (byte) $f
|
||||
[31] (byte~) memoryRemap::$4 ← (byte~) memoryRemap::$1 | (byte~) memoryRemap::$3
|
||||
[32] *((const byte*) memoryRemap::xVal) ← (byte~) memoryRemap::$4
|
||||
[33] (byte~) memoryRemap::$5 ← < (word) memoryRemap::upperPageOffset#3
|
||||
[34] *((const byte*) memoryRemap::yVal) ← (byte~) memoryRemap::$5
|
||||
[35] (byte~) memoryRemap::$6 ← (byte) memoryRemap::remapBlocks#3 & (byte) $f0
|
||||
[36] (byte~) memoryRemap::$7 ← > (word) memoryRemap::upperPageOffset#3
|
||||
[37] (byte~) memoryRemap::$8 ← (byte~) memoryRemap::$7 & (byte) $f
|
||||
[38] (byte~) memoryRemap::$9 ← (byte~) memoryRemap::$6 | (byte~) memoryRemap::$8
|
||||
[39] *((const byte*) memoryRemap::zVal) ← (byte~) memoryRemap::$9
|
||||
memoryRemap: scope:[memoryRemap] from irq::@5 main main::@3 memoryRemapBlock
|
||||
[46] (word) memoryRemap::upperPageOffset#4 ← phi( irq::@5/(byte) 0 main/(byte) 0 main::@3/(byte) 0 memoryRemapBlock/(const word) memoryRemapBlock::pageOffset#0 )
|
||||
[46] (byte) memoryRemap::remapBlocks#4 ← phi( irq::@5/(byte) 0 main/(byte) 0 main::@3/(byte) 0 memoryRemapBlock/(const byte) memoryRemapBlock::blockBits#0 )
|
||||
[46] (word) memoryRemap::lowerPageOffset#4 ← phi( irq::@5/(byte) 0 main/(byte) 0 main::@3/(byte) 0 memoryRemapBlock/(const word) memoryRemapBlock::pageOffset#0 )
|
||||
[47] (byte~) memoryRemap::$0 ← < (word) memoryRemap::lowerPageOffset#4
|
||||
[48] *((const byte*) memoryRemap::aVal) ← (byte~) memoryRemap::$0
|
||||
[49] (byte~) memoryRemap::$1 ← (byte) memoryRemap::remapBlocks#4 << (byte) 4
|
||||
[50] (byte~) memoryRemap::$2 ← > (word) memoryRemap::lowerPageOffset#4
|
||||
[51] (byte~) memoryRemap::$3 ← (byte~) memoryRemap::$2 & (byte) $f
|
||||
[52] (byte~) memoryRemap::$4 ← (byte~) memoryRemap::$1 | (byte~) memoryRemap::$3
|
||||
[53] *((const byte*) memoryRemap::xVal) ← (byte~) memoryRemap::$4
|
||||
[54] (byte~) memoryRemap::$5 ← < (word) memoryRemap::upperPageOffset#4
|
||||
[55] *((const byte*) memoryRemap::yVal) ← (byte~) memoryRemap::$5
|
||||
[56] (byte~) memoryRemap::$6 ← (byte) memoryRemap::remapBlocks#4 & (byte) $f0
|
||||
[57] (byte~) memoryRemap::$7 ← > (word) memoryRemap::upperPageOffset#4
|
||||
[58] (byte~) memoryRemap::$8 ← (byte~) memoryRemap::$7 & (byte) $f
|
||||
[59] (byte~) memoryRemap::$9 ← (byte~) memoryRemap::$6 | (byte~) memoryRemap::$8
|
||||
[60] *((const byte*) memoryRemap::zVal) ← (byte~) memoryRemap::$9
|
||||
asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }
|
||||
to:memoryRemap::@return
|
||||
memoryRemap::@return: scope:[memoryRemap] from memoryRemap
|
||||
[41] return
|
||||
[62] return
|
||||
to:@return
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,8 @@
|
||||
(const nomodify struct MOS6526_CIA*) CIA1 = (struct MOS6526_CIA*) 56320
|
||||
(const nomodify byte) CIA_INTERRUPT_CLEAR = (byte) $7f
|
||||
(const nomodify byte*) DEFAULT_SCREEN = (byte*) 2048
|
||||
(const nomodify void()**) HARDWARE_IRQ = (void()**) 65534
|
||||
(const nomodify byte) IRQ_RASTER = (byte) 1
|
||||
(byte) MEGA65_VICIV::ALPHADELAY
|
||||
(byte) MEGA65_VICIV::B0PIX
|
||||
(byte) MEGA65_VICIV::B0_ADDR
|
||||
@ -286,49 +291,71 @@
|
||||
.fill music.size, music.getData(i)
|
||||
}}
|
||||
(const nomodify byte*) MUSIC_END = (byte*) 20992
|
||||
(const byte) OFFSET_STRUCT_MEGA65_VICIV_CONTROLB = (byte) $31
|
||||
(const byte) OFFSET_STRUCT_MEGA65_VICIV_CONTROLC = (byte) $54
|
||||
(const byte) OFFSET_STRUCT_MEGA65_VICIV_SIDBDRWD_LO = (byte) $5c
|
||||
(const byte) OFFSET_STRUCT_MOS4569_VICIII_KEY = (byte) $2f
|
||||
(const byte) OFFSET_STRUCT_MOS6526_CIA_INTERRUPT = (byte) $d
|
||||
(const byte) OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR = (byte) $20
|
||||
(const byte) OFFSET_STRUCT_MOS6569_VICII_CONTROL1 = (byte) $11
|
||||
(const byte) OFFSET_STRUCT_MOS6569_VICII_IRQ_ENABLE = (byte) $1a
|
||||
(const byte) OFFSET_STRUCT_MOS6569_VICII_IRQ_STATUS = (byte) $19
|
||||
(const byte) OFFSET_STRUCT_MOS6569_VICII_RASTER = (byte) $12
|
||||
(const nomodify byte*) PROCPORT = (byte*) 1
|
||||
(const nomodify byte*) PROCPORT_DDR = (byte*) 0
|
||||
(const nomodify byte) PROCPORT_DDR_MEMORY_MASK = (byte) 7
|
||||
(const nomodify byte) PROCPORT_RAM_IO = (byte) 5
|
||||
(const nomodify struct MOS6569_VICII*) VICII = (struct MOS6569_VICII*) 53248
|
||||
(const nomodify struct MOS4569_VICIII*) VICIII = (struct MOS4569_VICIII*) 53248
|
||||
(const nomodify struct MEGA65_VICIV*) VICIV = (struct MEGA65_VICIV*) 53248
|
||||
(void()) __start()
|
||||
(label) __start::@1
|
||||
(label) __start::@return
|
||||
(label) __start::__init1
|
||||
interrupt(HARDWARE_STACK)(void()) irq()
|
||||
(label) irq::@1
|
||||
(label) irq::@2
|
||||
(label) irq::@3
|
||||
(label) irq::@4
|
||||
(label) irq::@5
|
||||
(label) irq::@return
|
||||
(void()) main()
|
||||
(label) main::@1
|
||||
(label) main::@10
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@5
|
||||
(label) main::@6
|
||||
(label) main::@7
|
||||
(label) main::@8
|
||||
(label) main::@9
|
||||
(byte*) main::dst
|
||||
(byte*) main::dst#1 dst zp[2]:2 11.0
|
||||
(byte*) main::dst#2 dst zp[2]:2 14.666666666666666
|
||||
(byte*) main::mem_destroy
|
||||
(byte*) main::mem_destroy#1 mem_destroy zp[2]:6 11.0
|
||||
(byte*) main::mem_destroy#3 mem_destroy zp[2]:6 61.5
|
||||
(byte*) main::mem_destroy#5 mem_destroy zp[2]:6 39.25
|
||||
(byte*) main::dst#1 dst zp[2]:2 101.0
|
||||
(byte*) main::dst#2 dst zp[2]:2 134.66666666666666
|
||||
(byte) main::i
|
||||
(byte) main::i#1 reg byte x 202.0
|
||||
(byte) main::i#2 reg byte x 468.3333333333334
|
||||
(byte*) main::src
|
||||
(byte*) main::src#1 src zp[2]:4 22.0
|
||||
(byte*) main::src#2 src zp[2]:4 8.25
|
||||
(byte*) main::src#1 src zp[2]:4 202.0
|
||||
(byte*) main::src#2 src zp[2]:4 75.75
|
||||
(volatile byte) mem_destroy_i loadstore zp[1]:10 5.0
|
||||
(void()) memoryRemap((byte) memoryRemap::remapBlocks , (word) memoryRemap::lowerPageOffset , (word) memoryRemap::upperPageOffset)
|
||||
(byte~) memoryRemap::$0 reg byte a 2002.0
|
||||
(byte~) memoryRemap::$1 zp[1]:12 667.3333333333334
|
||||
(byte~) memoryRemap::$1 zp[1]:11 667.3333333333334
|
||||
(byte~) memoryRemap::$2 reg byte a 2002.0
|
||||
(byte~) memoryRemap::$3 reg byte a 2002.0
|
||||
(byte~) memoryRemap::$4 reg byte a 2002.0
|
||||
(byte~) memoryRemap::$5 reg byte a 2002.0
|
||||
(byte~) memoryRemap::$6 zp[1]:13 667.3333333333334
|
||||
(byte~) memoryRemap::$6 zp[1]:12 667.3333333333334
|
||||
(byte~) memoryRemap::$7 reg byte a 2002.0
|
||||
(byte~) memoryRemap::$8 reg byte a 2002.0
|
||||
(byte~) memoryRemap::$9 reg byte a 2002.0
|
||||
(label) memoryRemap::@return
|
||||
(const byte*) memoryRemap::aVal = (byte*) 252
|
||||
(word) memoryRemap::lowerPageOffset
|
||||
(word) memoryRemap::lowerPageOffset#3 lowerPageOffset zp[2]:8 500.5
|
||||
(word) memoryRemap::lowerPageOffset#4 lowerPageOffset zp[2]:6 500.5
|
||||
(byte) memoryRemap::remapBlocks
|
||||
(byte) memoryRemap::remapBlocks#3 reg byte z 200.2
|
||||
(byte) memoryRemap::remapBlocks#4 reg byte z 200.2
|
||||
(word) memoryRemap::upperPageOffset
|
||||
(word) memoryRemap::upperPageOffset#3 upperPageOffset zp[2]:10 182.0
|
||||
(word) memoryRemap::upperPageOffset#4 upperPageOffset zp[2]:8 182.0
|
||||
(const byte*) memoryRemap::xVal = (byte*) 253
|
||||
(const byte*) memoryRemap::yVal = (byte*) 254
|
||||
(const byte*) memoryRemap::zVal = (byte*) 255
|
||||
@ -349,17 +376,18 @@
|
||||
|
||||
zp[2]:2 [ main::dst#2 main::dst#1 ]
|
||||
zp[2]:4 [ main::src#2 main::src#1 ]
|
||||
zp[2]:6 [ main::mem_destroy#3 main::mem_destroy#5 main::mem_destroy#1 ]
|
||||
zp[2]:8 [ memoryRemap::lowerPageOffset#3 ]
|
||||
reg byte z [ memoryRemap::remapBlocks#3 ]
|
||||
zp[2]:10 [ memoryRemap::upperPageOffset#3 ]
|
||||
reg byte x [ main::i#2 main::i#1 ]
|
||||
zp[2]:6 [ memoryRemap::lowerPageOffset#4 ]
|
||||
reg byte z [ memoryRemap::remapBlocks#4 ]
|
||||
zp[2]:8 [ memoryRemap::upperPageOffset#4 ]
|
||||
zp[1]:10 [ mem_destroy_i ]
|
||||
reg byte a [ memoryRemap::$0 ]
|
||||
zp[1]:12 [ memoryRemap::$1 ]
|
||||
zp[1]:11 [ memoryRemap::$1 ]
|
||||
reg byte a [ memoryRemap::$2 ]
|
||||
reg byte a [ memoryRemap::$3 ]
|
||||
reg byte a [ memoryRemap::$4 ]
|
||||
reg byte a [ memoryRemap::$5 ]
|
||||
zp[1]:13 [ memoryRemap::$6 ]
|
||||
zp[1]:12 [ memoryRemap::$6 ]
|
||||
reg byte a [ memoryRemap::$7 ]
|
||||
reg byte a [ memoryRemap::$8 ]
|
||||
reg byte a [ memoryRemap::$9 ]
|
||||
|
Loading…
x
Reference in New Issue
Block a user