gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

ASM > Pixels Aren't Displaying

#174618 - nathanpc - Fri Jul 02, 2010 1:13 am

Hello,
I'm trying to plot pixels, side-by-side. Something like this dots: ..., without any space between them. Then I've done this:
Code:
.arm
.text
.global main

.macro plot_pixel x, y, color
    mov r0, #0x6000000
    mov r1, \color
    ldr r2, =(\x+\y*240)*2
    str r1, [r0, r2]
.endm

main:
    mov r0, #0x4000000
    mov r1, #0x400
    add r1, r1, #3
    str r1, [r0]

    plot_pixel 119, 80, #0x1F
    plot_pixel 120, 80, #0x03E0
    plot_pixel 121, 80, #0x7C00

infin:
    b infin

But when I tried to emulate this, what I got was this:
[Images not permitted - Click here to view it]
What I should do?

Best Regards,
Nathan Paulino Campos
_________________
Reading Tonc and trying to remind my very old C knowledge.

Just bought a GameBoy Advance SP one of those cartridges to put the ROMs for onboard debug.

#174620 - Cearn - Fri Jul 02, 2010 6:32 am

str stores words (32-bit), not halfwords (16-bit). You need strh.

#174623 - nathanpc - Fri Jul 02, 2010 10:35 am

Ahh, now I understood. I've found the str and strh part at my ARM Assembly book. :)

Thanks very much!
_________________
Reading Tonc and trying to remind my very old C knowledge.

Just bought a GameBoy Advance SP one of those cartridges to put the ROMs for onboard debug.

#174632 - Dwedit - Sat Jul 03, 2010 2:46 am

If you don't have a copy already, grab this:
http://www.eecs.umich.edu/~panalyzer/pdfs/ARM_doc.pdf (1.3MB, 268 page PDF)
It's the ARM7TDMI data sheet, with tons of information on all the ARM and THUMB instructions.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."

#174648 - nathanpc - Mon Jul 05, 2010 12:02 am

Thanks very much! This will be handy. ;)
_________________
Reading Tonc and trying to remind my very old C knowledge.

Just bought a GameBoy Advance SP one of those cartridges to put the ROMs for onboard debug.