mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-01-12 11:31:11 +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.
|
||||
void main() {
|
||||
// Initialize decimal-mode and stack
|
||||
asm {
|
||||
cld
|
||||
ldx #$ff
|
||||
txs
|
||||
}
|
||||
|
||||
// Initialize the video & audio
|
||||
disableVideoOutput();
|
||||
disableAudioOutput();
|
||||
@ -23,20 +23,20 @@ void main() {
|
||||
// Clear RAM - since it has all variables and the stack it is necesary to do it inline
|
||||
char i=0;
|
||||
do {
|
||||
(MEMORY+0x000)[i] = 0;
|
||||
(MEMORY+0x100)[i] = 0;
|
||||
(MEMORY+0x200)[i] = 0;
|
||||
(MEMORY+0x300)[i] = 0;
|
||||
(MEMORY+0x400)[i] = 0;
|
||||
(MEMORY+0x500)[i] = 0;
|
||||
(MEMORY+0x600)[i] = 0;
|
||||
(MEMORY+0x700)[i] = 0;
|
||||
(MEMORY+0x000)[i] = 0;
|
||||
(MEMORY+0x100)[i] = 0;
|
||||
(MEMORY+0x200)[i] = 0;
|
||||
(MEMORY+0x300)[i] = 0;
|
||||
(MEMORY+0x400)[i] = 0;
|
||||
(MEMORY+0x500)[i] = 0;
|
||||
(MEMORY+0x600)[i] = 0;
|
||||
(MEMORY+0x700)[i] = 0;
|
||||
} while (++i);
|
||||
waitForVBlank();
|
||||
// Now the PPU is ready.
|
||||
|
||||
initPaletteData();
|
||||
initSpriteData();
|
||||
initPalette();
|
||||
initSpriteBuffer();
|
||||
enableVideoOutput();
|
||||
|
||||
// Infinite loop
|
||||
@ -48,11 +48,8 @@ void main() {
|
||||
// NMI Called when the PPU refreshes the screen (also known as the V-Blank period)
|
||||
interrupt(hardware_stack) void vblank() {
|
||||
|
||||
// Refresh DRAM-stored sprite data before it decays.
|
||||
// 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;
|
||||
// Transfer the entire sprite buffer to the PPU
|
||||
transferSpriteBufferToPpu();
|
||||
|
||||
// Freeze the button positions.
|
||||
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
|
||||
struct ObjectAttribute {
|
||||
char y;
|
||||
@ -125,8 +95,16 @@ void moveLuigiLeft() {
|
||||
OAM_BUFFER[3].x--;
|
||||
}
|
||||
|
||||
// Initialize OAM (Object Attribute Memory) Buffer
|
||||
void initSpriteData() {
|
||||
// DMA transfer the entire sprite buffer to the PPU
|
||||
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;
|
||||
do {
|
||||
((char*)OAM_BUFFER)[i] = ((char*)SPRITES)[i];
|
||||
@ -142,6 +120,33 @@ struct ObjectAttribute SPRITES[] = {
|
||||
{ 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
|
||||
#pragma data_seg(Tiles)
|
||||
export char TILES[] = kickasm(resource "smb1_chr.bin") {{
|
||||
|
@ -32,12 +32,12 @@
|
||||
.const OFFSET_STRUCT_RICOH_2A03_DMC_FREQ = $10
|
||||
.const OFFSET_STRUCT_RICOH_2C02_PPUMASK = 1
|
||||
.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_2A03_OAMDMA = $14
|
||||
.const OFFSET_STRUCT_RICOH_2A03_JOY1 = $16
|
||||
.const OFFSET_STRUCT_RICOH_2C02_PPUADDR = 6
|
||||
.const OFFSET_STRUCT_RICOH_2C02_PPUDATA = 7
|
||||
.const OFFSET_STRUCT_OBJECTATTRIBUTE_X = 3
|
||||
.const SIZEOF_BYTE = 1
|
||||
// $3000-$3EFF $0F00 Mirrors of $2000-$2EFF
|
||||
// $3F00-$3F1F $0020 Palette RAM indexes
|
||||
@ -69,6 +69,7 @@
|
||||
// RESET Called when the NES is reset, including when it is turned on.
|
||||
main: {
|
||||
// asm
|
||||
// Initialize decimal-mode and stack
|
||||
cld
|
||||
ldx #$ff
|
||||
txs
|
||||
@ -121,11 +122,11 @@ main: {
|
||||
// while(!(PPU->PPUSTATUS&0x80))
|
||||
cmp #0
|
||||
beq waitForVBlank2
|
||||
// initPaletteData()
|
||||
// initPalette()
|
||||
// Now the PPU is ready.
|
||||
jsr initPaletteData
|
||||
// initSpriteData()
|
||||
jsr initSpriteData
|
||||
jsr initPalette
|
||||
// initSpriteBuffer()
|
||||
jsr initSpriteBuffer
|
||||
// PPU->PPUCTRL = 0b10000000
|
||||
lda #$80
|
||||
sta PPU
|
||||
@ -136,8 +137,8 @@ main: {
|
||||
// Infinite loop
|
||||
jmp __b2
|
||||
}
|
||||
// Initialize OAM (Object Attribute Memory) Buffer
|
||||
initSpriteData: {
|
||||
// Initialize OAM (Object Attribute Memory) Buffer with the SPRITE data
|
||||
initSpriteBuffer: {
|
||||
ldx #0
|
||||
__b1:
|
||||
// ((char*)OAM_BUFFER)[i] = ((char*)SPRITES)[i]
|
||||
@ -151,7 +152,7 @@ initSpriteData: {
|
||||
rts
|
||||
}
|
||||
// Copy palette values to PPU
|
||||
initPaletteData: {
|
||||
initPalette: {
|
||||
// asm
|
||||
// Reset the high/low latch to "high"
|
||||
lda PPU_PPUSTATUS
|
||||
@ -187,12 +188,9 @@ vblank: {
|
||||
tya
|
||||
pha
|
||||
// PPU->OAMADDR = 0
|
||||
// Refresh DRAM-stored sprite data before it decays.
|
||||
// Set OAM start address to sprite#0
|
||||
lda #0
|
||||
sta PPU+OFFSET_STRUCT_RICOH_2C02_OAMADDR
|
||||
// APU->OAMDMA = >OAM_BUFFER
|
||||
// Set the high byte (02) of the RAM address and start the DMA transfer to OAM memory
|
||||
lda #>OAM_BUFFER
|
||||
sta APU+OFFSET_STRUCT_RICOH_2A03_OAMDMA
|
||||
// APU->JOY1 = 1
|
||||
@ -255,9 +253,9 @@ moveLuigiRight: {
|
||||
rts
|
||||
}
|
||||
.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
|
||||
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
|
||||
TILES:
|
||||
.import binary "smb1_chr.bin"
|
||||
|
@ -52,11 +52,11 @@ main::waitForVBlank2_@1: scope:[main] from main::waitForVBlank2 main::waitForVB
|
||||
to:main::@3
|
||||
main::@3: scope:[main] from main::waitForVBlank2_@1
|
||||
[27] phi()
|
||||
[28] call initPaletteData
|
||||
[28] call initPalette
|
||||
to:main::@4
|
||||
main::@4: scope:[main] from main::@3
|
||||
[29] phi()
|
||||
[30] call initSpriteData
|
||||
[30] call initSpriteBuffer
|
||||
to:main::enableVideoOutput1
|
||||
main::enableVideoOutput1: scope:[main] from main::@4
|
||||
[31] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) $80
|
||||
@ -66,81 +66,86 @@ main::@2: scope:[main] from main::@2 main::enableVideoOutput1
|
||||
[33] phi()
|
||||
to:main::@2
|
||||
|
||||
(void()) initSpriteData()
|
||||
initSpriteData: scope:[initSpriteData] from main::@4
|
||||
(void()) initSpriteBuffer()
|
||||
initSpriteBuffer: scope:[initSpriteBuffer] from main::@4
|
||||
[34] phi()
|
||||
to:initSpriteData::@1
|
||||
initSpriteData::@1: scope:[initSpriteData] from initSpriteData initSpriteData::@1
|
||||
[35] (byte) initSpriteData::i#2 ← phi( initSpriteData/(byte) 0 initSpriteData::@1/(byte) initSpriteData::i#1 )
|
||||
[36] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER + (byte) initSpriteData::i#2) ← *((byte*)(const struct ObjectAttribute*) SPRITES + (byte) initSpriteData::i#2)
|
||||
[37] (byte) initSpriteData::i#1 ← ++ (byte) initSpriteData::i#2
|
||||
[38] if((byte) initSpriteData::i#1!=(byte) 4*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) goto initSpriteData::@1
|
||||
to:initSpriteData::@return
|
||||
initSpriteData::@return: scope:[initSpriteData] from initSpriteData::@1
|
||||
to:initSpriteBuffer::@1
|
||||
initSpriteBuffer::@1: scope:[initSpriteBuffer] from initSpriteBuffer initSpriteBuffer::@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) initSpriteBuffer::i#2) ← *((byte*)(const struct ObjectAttribute*) SPRITES + (byte) initSpriteBuffer::i#2)
|
||||
[37] (byte) initSpriteBuffer::i#1 ← ++ (byte) initSpriteBuffer::i#2
|
||||
[38] if((byte) initSpriteBuffer::i#1!=(byte) 4*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) goto initSpriteBuffer::@1
|
||||
to:initSpriteBuffer::@return
|
||||
initSpriteBuffer::@return: scope:[initSpriteBuffer] from initSpriteBuffer::@1
|
||||
[39] return
|
||||
to:@return
|
||||
|
||||
(void()) initPaletteData()
|
||||
initPaletteData: scope:[initPaletteData] from main::@3
|
||||
(void()) initPalette()
|
||||
initPalette: scope:[initPalette] from main::@3
|
||||
asm { ldaPPU_PPUSTATUS }
|
||||
[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
|
||||
to:initPaletteData::@1
|
||||
initPaletteData::@1: scope:[initPaletteData] from initPaletteData initPaletteData::@2
|
||||
[43] (byte) initPaletteData::i#2 ← phi( initPaletteData/(byte) 0 initPaletteData::@2/(byte) initPaletteData::i#1 )
|
||||
[44] if((byte) initPaletteData::i#2<(byte) $20*(const byte) SIZEOF_BYTE) goto initPaletteData::@2
|
||||
to:initPaletteData::@return
|
||||
initPaletteData::@return: scope:[initPaletteData] from initPaletteData::@1
|
||||
to:initPalette::@1
|
||||
initPalette::@1: scope:[initPalette] from initPalette initPalette::@2
|
||||
[43] (byte) initPalette::i#2 ← phi( initPalette/(byte) 0 initPalette::@2/(byte) initPalette::i#1 )
|
||||
[44] if((byte) initPalette::i#2<(byte) $20*(const byte) SIZEOF_BYTE) goto initPalette::@2
|
||||
to:initPalette::@return
|
||||
initPalette::@return: scope:[initPalette] from initPalette::@1
|
||||
[45] return
|
||||
to:@return
|
||||
initPaletteData::@2: scope:[initPaletteData] from initPaletteData::@1
|
||||
[46] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← *((const byte*) PALETTE + (byte) initPaletteData::i#2)
|
||||
[47] (byte) initPaletteData::i#1 ← ++ (byte) initPaletteData::i#2
|
||||
to: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) initPalette::i#2)
|
||||
[47] (byte) initPalette::i#1 ← ++ (byte) initPalette::i#2
|
||||
to:initPalette::@1
|
||||
|
||||
interrupt(HARDWARE_STACK)(void()) vblank()
|
||||
vblank: scope:[vblank] from
|
||||
[48] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_OAMADDR) ← (byte) 0
|
||||
[49] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA) ← >(const nomodify struct ObjectAttribute*) OAM_BUFFER
|
||||
[50] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 1
|
||||
[51] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 0
|
||||
[52] (byte~) vblank::$1 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1
|
||||
[53] if((byte) 0==(byte~) vblank::$1) goto vblank::@1
|
||||
[48] phi()
|
||||
to:vblank::transferSpriteBufferToPpu1
|
||||
vblank::transferSpriteBufferToPpu1: scope:[vblank] from vblank
|
||||
[49] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_OAMADDR) ← (byte) 0
|
||||
[50] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA) ← >(const nomodify struct ObjectAttribute*) OAM_BUFFER
|
||||
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
|
||||
vblank::@2: scope:[vblank] from vblank
|
||||
[54] phi()
|
||||
[55] call moveLuigiRight
|
||||
vblank::@2: scope:[vblank] from vblank::@4
|
||||
[55] phi()
|
||||
[56] call moveLuigiRight
|
||||
to:vblank::@1
|
||||
vblank::@1: scope:[vblank] from vblank vblank::@2
|
||||
[56] (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
|
||||
vblank::@1: scope:[vblank] from vblank::@2 vblank::@4
|
||||
[57] (byte~) vblank::$3 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1
|
||||
[58] if((byte) 0==(byte~) vblank::$3) goto vblank::@return
|
||||
to:vblank::@3
|
||||
vblank::@3: scope:[vblank] from vblank::@1
|
||||
[58] phi()
|
||||
[59] call moveLuigiLeft
|
||||
[59] phi()
|
||||
[60] call moveLuigiLeft
|
||||
to:vblank::@return
|
||||
vblank::@return: scope:[vblank] from vblank::@1 vblank::@3
|
||||
[60] return
|
||||
[61] return
|
||||
to:@return
|
||||
|
||||
(void()) moveLuigiLeft()
|
||||
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) 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) 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)
|
||||
[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)
|
||||
[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)
|
||||
[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)
|
||||
[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
|
||||
moveLuigiLeft::@return: scope:[moveLuigiLeft] from moveLuigiLeft
|
||||
[65] return
|
||||
[66] return
|
||||
to:@return
|
||||
|
||||
(void()) moveLuigiRight()
|
||||
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) 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) 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)
|
||||
[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)
|
||||
[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)
|
||||
[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)
|
||||
[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
|
||||
moveLuigiRight::@return: scope:[moveLuigiRight] from moveLuigiRight
|
||||
[70] return
|
||||
[71] 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 to_nomodify void()**) VECTORS[] = { &interrupt(HARDWARE_STACK)(void()) vblank(), &(void()) main(), (void()*) 0 }
|
||||
(void()) initPaletteData()
|
||||
(label) initPaletteData::@1
|
||||
(label) initPaletteData::@2
|
||||
(label) initPaletteData::@return
|
||||
(byte) initPaletteData::i
|
||||
(byte) initPaletteData::i#1 reg byte x 2002.0
|
||||
(byte) initPaletteData::i#2 reg byte x 1334.6666666666667
|
||||
(void()) initSpriteData()
|
||||
(label) initSpriteData::@1
|
||||
(label) initSpriteData::@return
|
||||
(byte) initSpriteData::i
|
||||
(byte) initSpriteData::i#1 reg byte x 1501.5
|
||||
(byte) initSpriteData::i#2 reg byte x 2002.0
|
||||
(void()) initPalette()
|
||||
(label) initPalette::@1
|
||||
(label) initPalette::@2
|
||||
(label) initPalette::@return
|
||||
(byte) initPalette::i
|
||||
(byte) initPalette::i#1 reg byte x 2002.0
|
||||
(byte) initPalette::i#2 reg byte x 1334.6666666666667
|
||||
(void()) initSpriteBuffer()
|
||||
(label) initSpriteBuffer::@1
|
||||
(label) initSpriteBuffer::@return
|
||||
(byte) initSpriteBuffer::i
|
||||
(byte) initSpriteBuffer::i#1 reg byte x 1501.5
|
||||
(byte) initSpriteBuffer::i#2 reg byte x 2002.0
|
||||
(void()) main()
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
@ -101,11 +101,13 @@ interrupt(HARDWARE_STACK)(void()) vblank()
|
||||
(label) vblank::@1
|
||||
(label) vblank::@2
|
||||
(label) vblank::@3
|
||||
(label) vblank::@4
|
||||
(label) vblank::@return
|
||||
(label) vblank::transferSpriteBufferToPpu1
|
||||
|
||||
reg byte x [ main::i#2 main::i#1 ]
|
||||
reg byte x [ initSpriteData::i#2 initSpriteData::i#1 ]
|
||||
reg byte x [ initPaletteData::i#2 initPaletteData::i#1 ]
|
||||
reg byte x [ initSpriteBuffer::i#2 initSpriteBuffer::i#1 ]
|
||||
reg byte x [ initPalette::i#2 initPalette::i#1 ]
|
||||
reg byte a [ main::waitForVBlank1_$0 ]
|
||||
reg byte a [ main::waitForVBlank2_$0 ]
|
||||
reg byte a [ vblank::$1 ]
|
||||
|
Loading…
x
Reference in New Issue
Block a user