simple mode 3 asm example
e.g. it does not work correctly as i only seem to be able to write to the whole screen on half of it?
needs goldroad assembler to compile
Code:
;; ------------------------------------------------------------
;;
;; Basic asm example
;;
@arm
;; ------------------------------------------------------------
;; program entry point
b gba_main
;; ------------------------------------------------------------
;;
;; variables
video_buffer @DCD 0x06000000 ; Screen memory address
display_control @DCD 0x04000000 ; Display register
color_white @DCD 0x0000FFFF ; White
mode3 @DCD 0x00000003 ; mode 3 (240x160x16bit)
bg @DCD 0x00000400 ; background 2
x @DCD 0x00000078 ; x (120)
y @DCD 0x00000050 ; y (80)
width @DCD 0x000000F0 ; screen width (240 px)
gba_main:
; set up screen
ldr r6,[display_control] ; Setup VideoMode
ldr r1,[bg]
ldr r2,[mode3]
orr r1,r1,r2
str r1,[r6]
; test putpixel ( video_buffer[y *width + x]=color )
ldr r0,[video_buffer] ;address of VRAM
ldr r1,[color_white]
ldr r2,[y]
ldr r3,[x]
ldr r4,[width]
mul r5,r2,r4
add r6,r5,r3
str r1,[r0,r6] ;store r1 in r0 with offset r6
; loop forever
loopforever:
b loopforever
Bookmarks