mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-01-13 03:30:17 +00:00
Improved NES demo code slightly.
This commit is contained in:
parent
6c3ba36459
commit
0d15872d6f
@ -6,12 +6,12 @@
|
|||||||
|
|
||||||
// RESET Called when the NES is reset, including when it is turned on.
|
// RESET Called when the NES is reset, including when it is turned on.
|
||||||
void main() {
|
void main() {
|
||||||
|
// Initialize decimal-mode and stack
|
||||||
asm {
|
asm {
|
||||||
cld
|
cld
|
||||||
ldx #$ff
|
ldx #$ff
|
||||||
txs
|
txs
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize the video & audio
|
// Initialize the video & audio
|
||||||
disableVideoOutput();
|
disableVideoOutput();
|
||||||
disableAudioOutput();
|
disableAudioOutput();
|
||||||
@ -35,8 +35,8 @@ void main() {
|
|||||||
waitForVBlank();
|
waitForVBlank();
|
||||||
// Now the PPU is ready.
|
// Now the PPU is ready.
|
||||||
|
|
||||||
initPaletteData();
|
initPalette();
|
||||||
initSpriteData();
|
initSpriteBuffer();
|
||||||
enableVideoOutput();
|
enableVideoOutput();
|
||||||
|
|
||||||
// Infinite loop
|
// Infinite loop
|
||||||
@ -48,11 +48,8 @@ void main() {
|
|||||||
// NMI Called when the PPU refreshes the screen (also known as the V-Blank period)
|
// NMI Called when the PPU refreshes the screen (also known as the V-Blank period)
|
||||||
interrupt(hardware_stack) void vblank() {
|
interrupt(hardware_stack) void vblank() {
|
||||||
|
|
||||||
// Refresh DRAM-stored sprite data before it decays.
|
// Transfer the entire sprite buffer to the PPU
|
||||||
// Set OAM start address to sprite#0
|
transferSpriteBufferToPpu();
|
||||||
PPU->OAMADDR = 0;
|
|
||||||
// Set the high byte (02) of the RAM address and start the DMA transfer to OAM memory
|
|
||||||
APU->OAMDMA = >OAM_BUFFER;
|
|
||||||
|
|
||||||
// Freeze the button positions.
|
// Freeze the button positions.
|
||||||
APU->JOY1 = 1;
|
APU->JOY1 = 1;
|
||||||
@ -70,33 +67,6 @@ interrupt(hardware_stack) void vblank() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy palette values to PPU
|
|
||||||
void initPaletteData() {
|
|
||||||
// Reset the high/low latch to "high"
|
|
||||||
asm { lda PPU_PPUSTATUS }
|
|
||||||
// Write the high byte of PPU Palette address
|
|
||||||
PPU->PPUADDR = >PPU_PALETTE;
|
|
||||||
// Write the low byte of PPU Palette address
|
|
||||||
PPU->PPUADDR = <PPU_PALETTE;
|
|
||||||
// Write to PPU
|
|
||||||
for(char i=0;i<sizeof(PALETTE);i++)
|
|
||||||
PPU->PPUDATA = PALETTE[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
char PALETTE[0x20] = {
|
|
||||||
// Background palettes
|
|
||||||
0x0f, 0x31, 0x32, 0x33,
|
|
||||||
0x0f, 0x35, 0x36, 0x37,
|
|
||||||
0x0f, 0x39, 0x3a, 0x3b,
|
|
||||||
0x0f, 0x3d, 0x3e, 0x0f,
|
|
||||||
// Sprite palettes (selected by the attribute bits 0-1 of the sprites)
|
|
||||||
0x0f, 0x1c, 0x15, 0x14,
|
|
||||||
0x0f, 0x02, 0x38, 0x3c,
|
|
||||||
0x0f, 0x30, 0x37, 0x1a, // Luigi-like colors
|
|
||||||
0x0f, 0x0f, 0x0f, 0x0f // All black
|
|
||||||
};
|
|
||||||
|
|
||||||
// Sprite Object Attribute Memory Structure
|
// Sprite Object Attribute Memory Structure
|
||||||
struct ObjectAttribute {
|
struct ObjectAttribute {
|
||||||
char y;
|
char y;
|
||||||
@ -125,8 +95,16 @@ void moveLuigiLeft() {
|
|||||||
OAM_BUFFER[3].x--;
|
OAM_BUFFER[3].x--;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize OAM (Object Attribute Memory) Buffer
|
// DMA transfer the entire sprite buffer to the PPU
|
||||||
void initSpriteData() {
|
inline void transferSpriteBufferToPpu() {
|
||||||
|
// Set OAM start address to sprite#0
|
||||||
|
PPU->OAMADDR = 0;
|
||||||
|
// Set the high byte (02) of the RAM address and start the DMA transfer to OAM memory
|
||||||
|
APU->OAMDMA = >OAM_BUFFER;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize OAM (Object Attribute Memory) Buffer with the SPRITE data
|
||||||
|
void initSpriteBuffer() {
|
||||||
char i=0;
|
char i=0;
|
||||||
do {
|
do {
|
||||||
((char*)OAM_BUFFER)[i] = ((char*)SPRITES)[i];
|
((char*)OAM_BUFFER)[i] = ((char*)SPRITES)[i];
|
||||||
@ -142,6 +120,33 @@ struct ObjectAttribute SPRITES[] = {
|
|||||||
{ 136, 0x39, 0b00000010, 136 } // Sprite 3
|
{ 136, 0x39, 0b00000010, 136 } // Sprite 3
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Copy palette values to PPU
|
||||||
|
void initPalette() {
|
||||||
|
// Reset the high/low latch to "high"
|
||||||
|
asm { lda PPU_PPUSTATUS }
|
||||||
|
// Write the high byte of PPU Palette address
|
||||||
|
PPU->PPUADDR = >PPU_PALETTE;
|
||||||
|
// Write the low byte of PPU Palette address
|
||||||
|
PPU->PPUADDR = <PPU_PALETTE;
|
||||||
|
// Write to PPU
|
||||||
|
for(char i=0;i<sizeof(PALETTE);i++)
|
||||||
|
PPU->PPUDATA = PALETTE[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
char PALETTE[0x20] = {
|
||||||
|
// Background palettes
|
||||||
|
0x0f, 0x31, 0x32, 0x33,
|
||||||
|
0x0f, 0x35, 0x36, 0x37,
|
||||||
|
0x0f, 0x39, 0x3a, 0x3b,
|
||||||
|
0x0f, 0x3d, 0x3e, 0x0f,
|
||||||
|
// Sprite palettes (selected by the attribute bits 0-1 of the sprites)
|
||||||
|
0x0f, 0x1c, 0x15, 0x14,
|
||||||
|
0x0f, 0x02, 0x38, 0x3c,
|
||||||
|
0x0f, 0x30, 0x37, 0x1a, // Luigi-like colors
|
||||||
|
0x0f, 0x0f, 0x0f, 0x0f // All black
|
||||||
|
};
|
||||||
|
|
||||||
// Tiles
|
// Tiles
|
||||||
#pragma data_seg(Tiles)
|
#pragma data_seg(Tiles)
|
||||||
export char TILES[] = kickasm(resource "smb1_chr.bin") {{
|
export char TILES[] = kickasm(resource "smb1_chr.bin") {{
|
||||||
|
@ -32,12 +32,12 @@
|
|||||||
.const OFFSET_STRUCT_RICOH_2A03_DMC_FREQ = $10
|
.const OFFSET_STRUCT_RICOH_2A03_DMC_FREQ = $10
|
||||||
.const OFFSET_STRUCT_RICOH_2C02_PPUMASK = 1
|
.const OFFSET_STRUCT_RICOH_2C02_PPUMASK = 1
|
||||||
.const OFFSET_STRUCT_RICOH_2C02_PPUSTATUS = 2
|
.const OFFSET_STRUCT_RICOH_2C02_PPUSTATUS = 2
|
||||||
|
.const OFFSET_STRUCT_RICOH_2A03_JOY1 = $16
|
||||||
|
.const OFFSET_STRUCT_OBJECTATTRIBUTE_X = 3
|
||||||
.const OFFSET_STRUCT_RICOH_2C02_OAMADDR = 3
|
.const OFFSET_STRUCT_RICOH_2C02_OAMADDR = 3
|
||||||
.const OFFSET_STRUCT_RICOH_2A03_OAMDMA = $14
|
.const OFFSET_STRUCT_RICOH_2A03_OAMDMA = $14
|
||||||
.const OFFSET_STRUCT_RICOH_2A03_JOY1 = $16
|
|
||||||
.const OFFSET_STRUCT_RICOH_2C02_PPUADDR = 6
|
.const OFFSET_STRUCT_RICOH_2C02_PPUADDR = 6
|
||||||
.const OFFSET_STRUCT_RICOH_2C02_PPUDATA = 7
|
.const OFFSET_STRUCT_RICOH_2C02_PPUDATA = 7
|
||||||
.const OFFSET_STRUCT_OBJECTATTRIBUTE_X = 3
|
|
||||||
.const SIZEOF_BYTE = 1
|
.const SIZEOF_BYTE = 1
|
||||||
// $3000-$3EFF $0F00 Mirrors of $2000-$2EFF
|
// $3000-$3EFF $0F00 Mirrors of $2000-$2EFF
|
||||||
// $3F00-$3F1F $0020 Palette RAM indexes
|
// $3F00-$3F1F $0020 Palette RAM indexes
|
||||||
@ -69,6 +69,7 @@
|
|||||||
// RESET Called when the NES is reset, including when it is turned on.
|
// RESET Called when the NES is reset, including when it is turned on.
|
||||||
main: {
|
main: {
|
||||||
// asm
|
// asm
|
||||||
|
// Initialize decimal-mode and stack
|
||||||
cld
|
cld
|
||||||
ldx #$ff
|
ldx #$ff
|
||||||
txs
|
txs
|
||||||
@ -121,11 +122,11 @@ main: {
|
|||||||
// while(!(PPU->PPUSTATUS&0x80))
|
// while(!(PPU->PPUSTATUS&0x80))
|
||||||
cmp #0
|
cmp #0
|
||||||
beq waitForVBlank2
|
beq waitForVBlank2
|
||||||
// initPaletteData()
|
// initPalette()
|
||||||
// Now the PPU is ready.
|
// Now the PPU is ready.
|
||||||
jsr initPaletteData
|
jsr initPalette
|
||||||
// initSpriteData()
|
// initSpriteBuffer()
|
||||||
jsr initSpriteData
|
jsr initSpriteBuffer
|
||||||
// PPU->PPUCTRL = 0b10000000
|
// PPU->PPUCTRL = 0b10000000
|
||||||
lda #$80
|
lda #$80
|
||||||
sta PPU
|
sta PPU
|
||||||
@ -136,8 +137,8 @@ main: {
|
|||||||
// Infinite loop
|
// Infinite loop
|
||||||
jmp __b2
|
jmp __b2
|
||||||
}
|
}
|
||||||
// Initialize OAM (Object Attribute Memory) Buffer
|
// Initialize OAM (Object Attribute Memory) Buffer with the SPRITE data
|
||||||
initSpriteData: {
|
initSpriteBuffer: {
|
||||||
ldx #0
|
ldx #0
|
||||||
__b1:
|
__b1:
|
||||||
// ((char*)OAM_BUFFER)[i] = ((char*)SPRITES)[i]
|
// ((char*)OAM_BUFFER)[i] = ((char*)SPRITES)[i]
|
||||||
@ -151,7 +152,7 @@ initSpriteData: {
|
|||||||
rts
|
rts
|
||||||
}
|
}
|
||||||
// Copy palette values to PPU
|
// Copy palette values to PPU
|
||||||
initPaletteData: {
|
initPalette: {
|
||||||
// asm
|
// asm
|
||||||
// Reset the high/low latch to "high"
|
// Reset the high/low latch to "high"
|
||||||
lda PPU_PPUSTATUS
|
lda PPU_PPUSTATUS
|
||||||
@ -187,12 +188,9 @@ vblank: {
|
|||||||
tya
|
tya
|
||||||
pha
|
pha
|
||||||
// PPU->OAMADDR = 0
|
// PPU->OAMADDR = 0
|
||||||
// Refresh DRAM-stored sprite data before it decays.
|
|
||||||
// Set OAM start address to sprite#0
|
|
||||||
lda #0
|
lda #0
|
||||||
sta PPU+OFFSET_STRUCT_RICOH_2C02_OAMADDR
|
sta PPU+OFFSET_STRUCT_RICOH_2C02_OAMADDR
|
||||||
// APU->OAMDMA = >OAM_BUFFER
|
// APU->OAMDMA = >OAM_BUFFER
|
||||||
// Set the high byte (02) of the RAM address and start the DMA transfer to OAM memory
|
|
||||||
lda #>OAM_BUFFER
|
lda #>OAM_BUFFER
|
||||||
sta APU+OFFSET_STRUCT_RICOH_2A03_OAMDMA
|
sta APU+OFFSET_STRUCT_RICOH_2A03_OAMDMA
|
||||||
// APU->JOY1 = 1
|
// APU->JOY1 = 1
|
||||||
@ -255,9 +253,9 @@ moveLuigiRight: {
|
|||||||
rts
|
rts
|
||||||
}
|
}
|
||||||
.segment Data
|
.segment Data
|
||||||
PALETTE: .byte $f, $31, $32, $33, $f, $35, $36, $37, $f, $39, $3a, $3b, $f, $3d, $3e, $f, $f, $1c, $15, $14, $f, 2, $38, $3c, $f, $30, $37, $1a, $f, $f, $f, $f
|
|
||||||
// Small Luigi Sprite Data
|
// Small Luigi Sprite Data
|
||||||
SPRITES: .byte $80, $36, 2, $80, $80, $37, 2, $88, $88, $38, 2, $80, $88, $39, 2, $88
|
SPRITES: .byte $80, $36, 2, $80, $80, $37, 2, $88, $88, $38, 2, $80, $88, $39, 2, $88
|
||||||
|
PALETTE: .byte $f, $31, $32, $33, $f, $35, $36, $37, $f, $39, $3a, $3b, $f, $3d, $3e, $f, $f, $1c, $15, $14, $f, 2, $38, $3c, $f, $30, $37, $1a, $f, $f, $f, $f
|
||||||
.segment Tiles
|
.segment Tiles
|
||||||
TILES:
|
TILES:
|
||||||
.import binary "smb1_chr.bin"
|
.import binary "smb1_chr.bin"
|
||||||
|
@ -52,11 +52,11 @@ main::waitForVBlank2_@1: scope:[main] from main::waitForVBlank2 main::waitForVB
|
|||||||
to:main::@3
|
to:main::@3
|
||||||
main::@3: scope:[main] from main::waitForVBlank2_@1
|
main::@3: scope:[main] from main::waitForVBlank2_@1
|
||||||
[27] phi()
|
[27] phi()
|
||||||
[28] call initPaletteData
|
[28] call initPalette
|
||||||
to:main::@4
|
to:main::@4
|
||||||
main::@4: scope:[main] from main::@3
|
main::@4: scope:[main] from main::@3
|
||||||
[29] phi()
|
[29] phi()
|
||||||
[30] call initSpriteData
|
[30] call initSpriteBuffer
|
||||||
to:main::enableVideoOutput1
|
to:main::enableVideoOutput1
|
||||||
main::enableVideoOutput1: scope:[main] from main::@4
|
main::enableVideoOutput1: scope:[main] from main::@4
|
||||||
[31] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) $80
|
[31] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) $80
|
||||||
@ -66,81 +66,86 @@ main::@2: scope:[main] from main::@2 main::enableVideoOutput1
|
|||||||
[33] phi()
|
[33] phi()
|
||||||
to:main::@2
|
to:main::@2
|
||||||
|
|
||||||
(void()) initSpriteData()
|
(void()) initSpriteBuffer()
|
||||||
initSpriteData: scope:[initSpriteData] from main::@4
|
initSpriteBuffer: scope:[initSpriteBuffer] from main::@4
|
||||||
[34] phi()
|
[34] phi()
|
||||||
to:initSpriteData::@1
|
to:initSpriteBuffer::@1
|
||||||
initSpriteData::@1: scope:[initSpriteData] from initSpriteData initSpriteData::@1
|
initSpriteBuffer::@1: scope:[initSpriteBuffer] from initSpriteBuffer initSpriteBuffer::@1
|
||||||
[35] (byte) initSpriteData::i#2 ← phi( initSpriteData/(byte) 0 initSpriteData::@1/(byte) initSpriteData::i#1 )
|
[35] (byte) initSpriteBuffer::i#2 ← phi( initSpriteBuffer/(byte) 0 initSpriteBuffer::@1/(byte) initSpriteBuffer::i#1 )
|
||||||
[36] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER + (byte) initSpriteData::i#2) ← *((byte*)(const struct ObjectAttribute*) SPRITES + (byte) initSpriteData::i#2)
|
[36] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER + (byte) initSpriteBuffer::i#2) ← *((byte*)(const struct ObjectAttribute*) SPRITES + (byte) initSpriteBuffer::i#2)
|
||||||
[37] (byte) initSpriteData::i#1 ← ++ (byte) initSpriteData::i#2
|
[37] (byte) initSpriteBuffer::i#1 ← ++ (byte) initSpriteBuffer::i#2
|
||||||
[38] if((byte) initSpriteData::i#1!=(byte) 4*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) goto initSpriteData::@1
|
[38] if((byte) initSpriteBuffer::i#1!=(byte) 4*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) goto initSpriteBuffer::@1
|
||||||
to:initSpriteData::@return
|
to:initSpriteBuffer::@return
|
||||||
initSpriteData::@return: scope:[initSpriteData] from initSpriteData::@1
|
initSpriteBuffer::@return: scope:[initSpriteBuffer] from initSpriteBuffer::@1
|
||||||
[39] return
|
[39] return
|
||||||
to:@return
|
to:@return
|
||||||
|
|
||||||
(void()) initPaletteData()
|
(void()) initPalette()
|
||||||
initPaletteData: scope:[initPaletteData] from main::@3
|
initPalette: scope:[initPalette] from main::@3
|
||||||
asm { ldaPPU_PPUSTATUS }
|
asm { ldaPPU_PPUSTATUS }
|
||||||
[41] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← >(const nomodify byte*) PPU_PALETTE
|
[41] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← >(const nomodify byte*) PPU_PALETTE
|
||||||
[42] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte) 0
|
[42] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte) 0
|
||||||
to:initPaletteData::@1
|
to:initPalette::@1
|
||||||
initPaletteData::@1: scope:[initPaletteData] from initPaletteData initPaletteData::@2
|
initPalette::@1: scope:[initPalette] from initPalette initPalette::@2
|
||||||
[43] (byte) initPaletteData::i#2 ← phi( initPaletteData/(byte) 0 initPaletteData::@2/(byte) initPaletteData::i#1 )
|
[43] (byte) initPalette::i#2 ← phi( initPalette/(byte) 0 initPalette::@2/(byte) initPalette::i#1 )
|
||||||
[44] if((byte) initPaletteData::i#2<(byte) $20*(const byte) SIZEOF_BYTE) goto initPaletteData::@2
|
[44] if((byte) initPalette::i#2<(byte) $20*(const byte) SIZEOF_BYTE) goto initPalette::@2
|
||||||
to:initPaletteData::@return
|
to:initPalette::@return
|
||||||
initPaletteData::@return: scope:[initPaletteData] from initPaletteData::@1
|
initPalette::@return: scope:[initPalette] from initPalette::@1
|
||||||
[45] return
|
[45] return
|
||||||
to:@return
|
to:@return
|
||||||
initPaletteData::@2: scope:[initPaletteData] from initPaletteData::@1
|
initPalette::@2: scope:[initPalette] from initPalette::@1
|
||||||
[46] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← *((const byte*) PALETTE + (byte) initPaletteData::i#2)
|
[46] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← *((const byte*) PALETTE + (byte) initPalette::i#2)
|
||||||
[47] (byte) initPaletteData::i#1 ← ++ (byte) initPaletteData::i#2
|
[47] (byte) initPalette::i#1 ← ++ (byte) initPalette::i#2
|
||||||
to:initPaletteData::@1
|
to:initPalette::@1
|
||||||
|
|
||||||
interrupt(HARDWARE_STACK)(void()) vblank()
|
interrupt(HARDWARE_STACK)(void()) vblank()
|
||||||
vblank: scope:[vblank] from
|
vblank: scope:[vblank] from
|
||||||
[48] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_OAMADDR) ← (byte) 0
|
[48] phi()
|
||||||
[49] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA) ← >(const nomodify struct ObjectAttribute*) OAM_BUFFER
|
to:vblank::transferSpriteBufferToPpu1
|
||||||
[50] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 1
|
vblank::transferSpriteBufferToPpu1: scope:[vblank] from vblank
|
||||||
[51] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 0
|
[49] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_OAMADDR) ← (byte) 0
|
||||||
[52] (byte~) vblank::$1 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1
|
[50] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA) ← >(const nomodify struct ObjectAttribute*) OAM_BUFFER
|
||||||
[53] if((byte) 0==(byte~) vblank::$1) goto vblank::@1
|
to:vblank::@4
|
||||||
|
vblank::@4: scope:[vblank] from vblank::transferSpriteBufferToPpu1
|
||||||
|
[51] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 1
|
||||||
|
[52] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 0
|
||||||
|
[53] (byte~) vblank::$1 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1
|
||||||
|
[54] if((byte) 0==(byte~) vblank::$1) goto vblank::@1
|
||||||
to:vblank::@2
|
to:vblank::@2
|
||||||
vblank::@2: scope:[vblank] from vblank
|
vblank::@2: scope:[vblank] from vblank::@4
|
||||||
[54] phi()
|
[55] phi()
|
||||||
[55] call moveLuigiRight
|
[56] call moveLuigiRight
|
||||||
to:vblank::@1
|
to:vblank::@1
|
||||||
vblank::@1: scope:[vblank] from vblank vblank::@2
|
vblank::@1: scope:[vblank] from vblank::@2 vblank::@4
|
||||||
[56] (byte~) vblank::$3 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1
|
[57] (byte~) vblank::$3 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1
|
||||||
[57] if((byte) 0==(byte~) vblank::$3) goto vblank::@return
|
[58] if((byte) 0==(byte~) vblank::$3) goto vblank::@return
|
||||||
to:vblank::@3
|
to:vblank::@3
|
||||||
vblank::@3: scope:[vblank] from vblank::@1
|
vblank::@3: scope:[vblank] from vblank::@1
|
||||||
[58] phi()
|
[59] phi()
|
||||||
[59] call moveLuigiLeft
|
[60] call moveLuigiLeft
|
||||||
to:vblank::@return
|
to:vblank::@return
|
||||||
vblank::@return: scope:[vblank] from vblank::@1 vblank::@3
|
vblank::@return: scope:[vblank] from vblank::@1 vblank::@3
|
||||||
[60] return
|
[61] return
|
||||||
to:@return
|
to:@return
|
||||||
|
|
||||||
(void()) moveLuigiLeft()
|
(void()) moveLuigiLeft()
|
||||||
moveLuigiLeft: scope:[moveLuigiLeft] from vblank::@3
|
moveLuigiLeft: scope:[moveLuigiLeft] from vblank::@3
|
||||||
[61] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X)
|
[62] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X)
|
||||||
[62] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE)
|
[63] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE)
|
||||||
[63] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE)
|
[64] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE)
|
||||||
[64] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE)
|
[65] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE)
|
||||||
to:moveLuigiLeft::@return
|
to:moveLuigiLeft::@return
|
||||||
moveLuigiLeft::@return: scope:[moveLuigiLeft] from moveLuigiLeft
|
moveLuigiLeft::@return: scope:[moveLuigiLeft] from moveLuigiLeft
|
||||||
[65] return
|
[66] return
|
||||||
to:@return
|
to:@return
|
||||||
|
|
||||||
(void()) moveLuigiRight()
|
(void()) moveLuigiRight()
|
||||||
moveLuigiRight: scope:[moveLuigiRight] from vblank::@2
|
moveLuigiRight: scope:[moveLuigiRight] from vblank::@2
|
||||||
[66] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X)
|
[67] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X)
|
||||||
[67] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE)
|
[68] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE)
|
||||||
[68] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE)
|
[69] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE)
|
||||||
[69] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE)
|
[70] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE)
|
||||||
to:moveLuigiRight::@return
|
to:moveLuigiRight::@return
|
||||||
moveLuigiRight::@return: scope:[moveLuigiRight] from moveLuigiRight
|
moveLuigiRight::@return: scope:[moveLuigiRight] from moveLuigiRight
|
||||||
[70] return
|
[71] return
|
||||||
to:@return
|
to:@return
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -60,19 +60,19 @@
|
|||||||
(const byte*) TILES[] = kickasm {{ .import binary "smb1_chr.bin"
|
(const byte*) TILES[] = kickasm {{ .import binary "smb1_chr.bin"
|
||||||
}}
|
}}
|
||||||
(const to_nomodify void()**) VECTORS[] = { &interrupt(HARDWARE_STACK)(void()) vblank(), &(void()) main(), (void()*) 0 }
|
(const to_nomodify void()**) VECTORS[] = { &interrupt(HARDWARE_STACK)(void()) vblank(), &(void()) main(), (void()*) 0 }
|
||||||
(void()) initPaletteData()
|
(void()) initPalette()
|
||||||
(label) initPaletteData::@1
|
(label) initPalette::@1
|
||||||
(label) initPaletteData::@2
|
(label) initPalette::@2
|
||||||
(label) initPaletteData::@return
|
(label) initPalette::@return
|
||||||
(byte) initPaletteData::i
|
(byte) initPalette::i
|
||||||
(byte) initPaletteData::i#1 reg byte x 2002.0
|
(byte) initPalette::i#1 reg byte x 2002.0
|
||||||
(byte) initPaletteData::i#2 reg byte x 1334.6666666666667
|
(byte) initPalette::i#2 reg byte x 1334.6666666666667
|
||||||
(void()) initSpriteData()
|
(void()) initSpriteBuffer()
|
||||||
(label) initSpriteData::@1
|
(label) initSpriteBuffer::@1
|
||||||
(label) initSpriteData::@return
|
(label) initSpriteBuffer::@return
|
||||||
(byte) initSpriteData::i
|
(byte) initSpriteBuffer::i
|
||||||
(byte) initSpriteData::i#1 reg byte x 1501.5
|
(byte) initSpriteBuffer::i#1 reg byte x 1501.5
|
||||||
(byte) initSpriteData::i#2 reg byte x 2002.0
|
(byte) initSpriteBuffer::i#2 reg byte x 2002.0
|
||||||
(void()) main()
|
(void()) main()
|
||||||
(label) main::@1
|
(label) main::@1
|
||||||
(label) main::@2
|
(label) main::@2
|
||||||
@ -101,11 +101,13 @@ interrupt(HARDWARE_STACK)(void()) vblank()
|
|||||||
(label) vblank::@1
|
(label) vblank::@1
|
||||||
(label) vblank::@2
|
(label) vblank::@2
|
||||||
(label) vblank::@3
|
(label) vblank::@3
|
||||||
|
(label) vblank::@4
|
||||||
(label) vblank::@return
|
(label) vblank::@return
|
||||||
|
(label) vblank::transferSpriteBufferToPpu1
|
||||||
|
|
||||||
reg byte x [ main::i#2 main::i#1 ]
|
reg byte x [ main::i#2 main::i#1 ]
|
||||||
reg byte x [ initSpriteData::i#2 initSpriteData::i#1 ]
|
reg byte x [ initSpriteBuffer::i#2 initSpriteBuffer::i#1 ]
|
||||||
reg byte x [ initPaletteData::i#2 initPaletteData::i#1 ]
|
reg byte x [ initPalette::i#2 initPalette::i#1 ]
|
||||||
reg byte a [ main::waitForVBlank1_$0 ]
|
reg byte a [ main::waitForVBlank1_$0 ]
|
||||||
reg byte a [ main::waitForVBlank2_$0 ]
|
reg byte a [ main::waitForVBlank2_$0 ]
|
||||||
reg byte a [ vblank::$1 ]
|
reg byte a [ vblank::$1 ]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user