Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
51
Task/Bitmap/ARM-Assembly/bitmap.arm
Normal file
51
Task/Bitmap/ARM-Assembly/bitmap.arm
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
Bitmap_FloodFill:
|
||||
;input:
|
||||
;r0 = color to fill screen with (15-bit color)
|
||||
STMFD sp!,{r0-r12,lr}
|
||||
|
||||
MOV R2,#160
|
||||
MOV R4,#0x06000000
|
||||
outerloop_floodfill:
|
||||
MOV R1,#240 ;restore inner loop counter
|
||||
innerloop_floodfill:
|
||||
strH r0,[r4]
|
||||
add r4,r4,#2 ;next pixel
|
||||
subs r1,r1,#1 ;decrement loop counter
|
||||
bne innerloop_floodfill
|
||||
subs r2,r2,#1
|
||||
bne outerloop_floodfill
|
||||
|
||||
LDMFD sp!,{r0-r12,pc}
|
||||
|
||||
Bitmap_Locate:
|
||||
;given x and y coordinates, offsets vram addr to that pixel on screen.
|
||||
;input:
|
||||
;r0 = x
|
||||
;r1 = y
|
||||
;output: r2 = vram area
|
||||
STMFD sp!,{r4-r12,lr}
|
||||
mov r2,#0x06000000 ;vram base
|
||||
|
||||
|
||||
mov r4,#240*2 ;240 pixels across, 2 bytes per pixel
|
||||
mul r1,r4,r1
|
||||
add r2,r2,r1 ;add y*480
|
||||
add r2,r2,r0,lsl #1 ;add x*2
|
||||
LDMFD sp!,{r4-r12,pc}
|
||||
|
||||
Bitmap_StorePixel:
|
||||
;input: r3 = color
|
||||
;r0 = x
|
||||
;r1 = y
|
||||
bl Bitmap_Locate
|
||||
strH r3,[r2] ;store the pixel color in video memory
|
||||
bx lr
|
||||
|
||||
Bitmap_GetPixel:
|
||||
;retrieves the color of the pixel at [r2] and stores its color value in r3.
|
||||
;r0 = x
|
||||
;r1 = y
|
||||
;output in r3
|
||||
bl Bitmap_Locate
|
||||
ldrH r3,[r2]
|
||||
bx lr
|
||||
Loading…
Add table
Add a link
Reference in a new issue