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 > gas newb

#8828 - jhorvath - Mon Jul 21, 2003 4:17 am

hello,

i'm having a bit of trouble ..(on account of my ignorance , nothing real technical), with gas.

all i'm trying to do (don't laugh...) is set the video mode and put a little red pixel on the screen (gbaguy's asm tut)

now i find that everything is well and good if i supply actual numeric values , ie:

ldr r1,=0x04000000

however if i try to use a variable, say ..

ldr r1,=REG_DISPCNT

..that would have been defined in my gba.s as

.data
REG_DISPCNT : .word 0x04000000
{..a lot more like the line above..}
.pool
.end

possibly something is wrong with the way i *define* my variables. i had them defined differently, then i read someone's post about putting variables in ram (or something) so i changed the file to this...anyway...

i guess what i'm wondering is ..does there seem anything wrong with an *.include* file with a layout as my gba.s (see above), and if so does anyone have a quick explanation , or possibly a file they could send me for reference.

thanks in advance,
_________________
/* jhorvath */

#8830 - slip - Mon Jul 21, 2003 8:03 am

Hey, by the looks of it you are declaring REG_DISPCNT as data and not as a macro.
It looks like your not using the screen.h file that gbaguy says to in his tutorial. The line of code that defines the macro looks like this

@define REG_DISPCNT 0x04000000

I hope that helps. I'm no expert I only started asm last week. But I had no problems with gbaguy's tutorial with the pixel. Go back and download screen.h and see how you go =)
good luck
_________________
[url="http://www.ice-d.com"]www.ice-d.com[/url]

#8831 - sgstair - Mon Jul 21, 2003 8:10 am

Well, definitely your problem is that you're declaring your REG_DISPCNT as data, though I have no personal experience with @define, I use .EQU
(ex: .EQU REG_DISPCNT, 0x04000000 )

In fact I'm not sure @define even works, as @ is the character that comments out the rest of the line.

slip: you may have mistaken a comment for the actual define :)

Anyhow, good luck, ASM is a valuable tool for those who can master it :)

-Stephen
_________________
http://blog.akkit.org/ - http://www.akkit.org/dswifi/

#8833 - tom - Mon Jul 21, 2003 9:08 am

@define is goldroad syntax.
guess i'm repeating myself, but you really shouldn't use goldroad =)

use the .equ method as described by sgstair

#8846 - jhorvath - Mon Jul 21, 2003 6:09 pm

.equ works (though i'm sure you already new that :) )

thanks alot folks,

p.s. i've been a gnu man since i started using linux... if there's a gnu way of doing something, that's usually how i get it done, with the exception of vim ;) of course (hence no goldroad for me...plus no goldroad natively on linux anyway).

thanks again
_________________
/* jhorvath */