#50390 - triton - Tue Aug 09, 2005 3:01 am
Hi folks, I'm new to gba programming and when I finished what was available w/ gbaguy's new tutorials, I tried putting together a game myself. I just wanted to see if i could incorporate a sprite, background and music together. It compiled successfully but unfortunately it didn't run on VBA. I checked the i/o reader and apparently the display contoller is set to forced blank. I don't know why that is and hopes someone can figure things out from my code. "main" , "palette" and "sprite" are all linked from C arrays.
@beginning
.arm
.text
.global main
start:
ldr r10, =0x40000bc @dma_1 for soundfifo
ldr r11, =0x40000c0 @dma 1 dest
ldr r12, =0x40000c4 @dma word count
ldr r7, =0x40000d4 @dma3 for convenient use later
ldr r8, =0x40000d8
ldr r9, =0x40000dc
ldr r0, =0x4000000
ldrh r1, =0x1400 @sprites and bg1
strh r1, [r0]
bg_setup:
ldr r0, =0x400000c
ldrh r1, =0x1480 @600a000 screnbase 6000000 char base block
strh r1, [r0] @256 *256 text background
SND:
ldr r1, =0x4000084 @enable all circuits
ldrh r0, =0x0080
strh r0, [r1]
snd_cnt:
ldr r0, =0x4000080
ldr r1, =0x0b040000 @snd_cnt_l + h fifo a, timer0/reset
str r1, [r0] @ disable snd channels 1-4
snd_timer:
ldr r0, =0x4000100
ldrh r1, =0xfd06 @22050 hz
strh r1, [r0]
ldr r4, =0x4000102
ldrh r3, =0x0080
snd_dma:
ldr r0, =main
str r0, [r10]
ldr r1, =0x40000a0
str r1, [r11]
ldr r1, =0xb2000000
tim_dma:
str r1, [r12]
strh r3, [r4]
BG:
bg_pal:
ldr r0, =bgpal
str r0, [r7] @dma
ldr r0, =0x5000000
str r0, [r8]
ldr r0, =0x94000080 @128 words during vblank
str r0, [r9]
bg_data:
ldr r0, =bg1
str r0, [r7]
ldr r0, =0x6000000
str r0, [r8]
ldr r0, =0x94002000 @vblank 8192 words/ tiledata
bg_map:
ldr r0, =bgmap
str r0, [r7]
ldr r0, =0x600a000
str r0, [r8]
ldr r0, =0x94000200 @512 words on vblank bits 12, 13
str r0, [r9]
SPR:
ldr r0, =0x7000000
ldr r1, =0x200ac00a @att 0 & 1 10y + x
str r1, [r0], #4 @oam
ldrh r1, =0x0000
strh r1, [r0]
.ltorg
spr_pal:
ldr r0, =palette
str r0, [r7]
ldr r0, =0x5000200
str r0, [r8]
ldr r0, =0x94000080 @ 128 words
str r0, [r9]
charmem:
ldr r0, =sprite
str r0, [r7]
ldr r0, =0x6010000
str r0, [r8]
ldr r0, =0x94000200 @512 words
str r0, [r9]
inf:
b inf
.ltorg
bg1:
.incbin "bg1.bin"
bgmap:
.incbin "bg1.map"
bgpal:
.incbin "bg1.pal"
@end of file
@beginning
.arm
.text
.global main
start:
ldr r10, =0x40000bc @dma_1 for soundfifo
ldr r11, =0x40000c0 @dma 1 dest
ldr r12, =0x40000c4 @dma word count
ldr r7, =0x40000d4 @dma3 for convenient use later
ldr r8, =0x40000d8
ldr r9, =0x40000dc
ldr r0, =0x4000000
ldrh r1, =0x1400 @sprites and bg1
strh r1, [r0]
bg_setup:
ldr r0, =0x400000c
ldrh r1, =0x1480 @600a000 screnbase 6000000 char base block
strh r1, [r0] @256 *256 text background
SND:
ldr r1, =0x4000084 @enable all circuits
ldrh r0, =0x0080
strh r0, [r1]
snd_cnt:
ldr r0, =0x4000080
ldr r1, =0x0b040000 @snd_cnt_l + h fifo a, timer0/reset
str r1, [r0] @ disable snd channels 1-4
snd_timer:
ldr r0, =0x4000100
ldrh r1, =0xfd06 @22050 hz
strh r1, [r0]
ldr r4, =0x4000102
ldrh r3, =0x0080
snd_dma:
ldr r0, =main
str r0, [r10]
ldr r1, =0x40000a0
str r1, [r11]
ldr r1, =0xb2000000
tim_dma:
str r1, [r12]
strh r3, [r4]
BG:
bg_pal:
ldr r0, =bgpal
str r0, [r7] @dma
ldr r0, =0x5000000
str r0, [r8]
ldr r0, =0x94000080 @128 words during vblank
str r0, [r9]
bg_data:
ldr r0, =bg1
str r0, [r7]
ldr r0, =0x6000000
str r0, [r8]
ldr r0, =0x94002000 @vblank 8192 words/ tiledata
bg_map:
ldr r0, =bgmap
str r0, [r7]
ldr r0, =0x600a000
str r0, [r8]
ldr r0, =0x94000200 @512 words on vblank bits 12, 13
str r0, [r9]
SPR:
ldr r0, =0x7000000
ldr r1, =0x200ac00a @att 0 & 1 10y + x
str r1, [r0], #4 @oam
ldrh r1, =0x0000
strh r1, [r0]
.ltorg
spr_pal:
ldr r0, =palette
str r0, [r7]
ldr r0, =0x5000200
str r0, [r8]
ldr r0, =0x94000080 @ 128 words
str r0, [r9]
charmem:
ldr r0, =sprite
str r0, [r7]
ldr r0, =0x6010000
str r0, [r8]
ldr r0, =0x94000200 @512 words
str r0, [r9]
inf:
b inf
.ltorg
bg1:
.incbin "bg1.bin"
bgmap:
.incbin "bg1.map"
bgpal:
.incbin "bg1.pal"
@end of file