Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Hello World by Seru-kun/LuigiBlood for GBA.
- .gba
- .create hello.gba,0x08000000
- .org 0x08000000
- .area 0x080000BE ;Header Area
- header:
- .arm
- b rom_start ;Start the ROM
- .incbin nintendo.bin
- .db "HELLO WORLD " ;Game Title
- .db "HOME" ;Game Code
- .db "01" ;Maker Code
- .db 0x96 ;Fixed Value
- .db 0x00 ;GBA Model
- .db 0x00 ;Normal Cart
- .fill 7 ;Reserved Area
- .db 0 ;Version: 0.0
- .db 0xFF ;Checksum, must be replaced
- .fill 2
- .endarea
- rom_start:
- .arm
- ldr r0,=rom_start2|1
- bx r0
- .pool
- rom_start2:
- .thumb
- mov r0,0x80
- lsl r0,r0,8
- mov r1,0x01
- eor r0,r1
- lsl r0,r0,12 ;r0=0x08001000
- mov r1,0x06
- lsl r1,r1,24 ;r1=0x06000000
- mov r2,0x01
- lsl r2,r2,8 ;r2=0x100
- bl uploadDMA1
- b rom_start3
- uploadDMA1:
- .thumb
- ;Inputs:
- ;r0=SourceAddr
- ;r1=DestAddr
- ;r2=Size (Bytes)
- mov r3,0x04
- lsl r3,r3,24
- mov r4,0xBC
- eor r3,r4 ;r3=0x040000BC
- str r0,[r3] ;Put r0 data to 0x040000BC
- eor r3,r4
- mov r4,0xC0
- eor r3,r4 ;r3=0x040000C0
- str r1,[r3] ;Put r1 data to 0x040000C0
- eor r3,r4
- mov r4,0xC4
- eor r3,r4
- lsr r2,r2,1 ;r3=0x040000C4
- strh r2,[r3] ;Put r2 data to 0x040000C4
- eor r3,r4
- mov r4,0xC7
- eor r3,r4
- mov r4,0x80
- strb r4,[r3] ;Begin DMA Channel 1
- mov r15,r14 ;Return
- rom_start3:
- .thumb
- ;Set Palette
- mov r0,0xFF
- eor r1,r0
- lsl r1,r1,8
- eor r1,r0
- lsl r1,r1,16 ;r1=0xFFFF0000
- mov r0,0x05
- lsl r0,r0,4*6 ;r0=0x05000000
- str r1,[r0] ;Put 0xFFFF0000 to address 0x05000000
- ;Set BG1 Map to 0x06000800
- mov r1,0x01
- lsl r1,r1,8 ;r1=0x0100
- mov r0,0x04
- lsl r0,r0,4*6
- mov r2,0x08
- eor r0,r2 ;r0=0x04000008
- strh r1,[r0] ;Put 0x0100 to address 0x04000008
- ;Set BG1 Tile Map
- mov r0,0x08
- lsl r0,r0,4*4
- mov r1,0x11
- eor r0,r1
- lsl r0,r0,4*2 ;r0=0x08001100
- mov r1,0x06
- lsl r1,r1,4*6
- mov r2,0x80
- lsl r2,r2,4
- eor r1,r2 ;r1=0x06000800
- mov r2,22 ;r2=22
- bl uploadDMA1
- mov r0,0x01
- lsl r0,r0,8 ;r0=0x0100
- mov r1,0x04
- lsl r1,r1,4*6 ;r1=0x04000000
- strh r0,[r1] ;Remove Force Blank and activate BG1
- @@loop:
- b @@loop
- .org 0x08001000
- GFXData:
- .incbin hello.bin
- TileMap:
- .dh 0x0001,0x0002,0x0003,0x0003,0x0004 ;HELLO
- .dh 0x0000 ;space
- .dh 0x0005,0x0004,0x0006,0x0003,0x0007 ;WORLD
- .close
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement