#112921 - Rockviech - Thu Dec 21, 2006 5:39 pm
Good evening,
im just searching for an arm assembler.
i only found gas, of which i havent found a windows version.
is there any other free one?
would appriciate it.
greetings
Last edited by Rockviech on Fri Dec 22, 2006 7:25 pm; edited 1 time in total
#112923 - OOPMan - Thu Dec 21, 2006 5:57 pm
Erm...
There's one included with devkitPro...
It's called arm-eabi-as.exe on windows...
_________________
"My boot, your face..." - Attributed to OOPMan, Emperor of Eroticon VI
You can find my NDS homebrew projects here...
#112927 - jenswa - Thu Dec 21, 2006 6:14 pm
Try a search for "goldroad arm assembler".
It's an free arm assembler for the gba. But my gues is that you are looking for one which does ds, right?
_________________
It seems this wasn't lost after all.
#112931 - Rockviech - Thu Dec 21, 2006 6:46 pm
@jenswa, right
@OOPMan oh man i forgot devkitarm, thanks ... any site with commands?
so which assembler is this now? could use some referenzes about syntax and so on...
#112933 - tepples - Thu Dec 21, 2006 7:01 pm
The assembler in devkitARM is GNU ''as''. See Using as, the free manual.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#112945 - Rockviech - Thu Dec 21, 2006 9:34 pm
ok thanks, i will have a look
now i have a object file as output, but what are the executables for nds?
#112946 - Sausage Boy - Thu Dec 21, 2006 9:41 pm
Take a look at devkitARM/ds_rules. The makefile stages there apply to assembly programs as well. It might be easiest to simply use a template included with devkitPro, and switch the .c files for .s files.
_________________
"no offense, but this is the gayest game ever"
#112952 - OOPMan - Thu Dec 21, 2006 11:10 pm
That would probably work best...
_________________
"My boot, your face..." - Attributed to OOPMan, Emperor of Eroticon VI
You can find my NDS homebrew projects here...
#113038 - Rockviech - Fri Dec 22, 2006 2:17 pm
ok, got it working. thanks
#113071 - Rockviech - Fri Dec 22, 2006 7:31 pm
Ok, now i have the problem, i dunno how to start.
i found this site: http://nocash.emubase.de/gbatek.htm
ok, im trying to understand this now
check this site
http://nocash.emubase.de/gbatek.htm#keypadinput
4000130h is the key status
bit 0 is key a
now if i do
cmp 4000130h,0
is this checking if key a is pressed this single frame?
second, i havent found anything about displaying text, would be awsome if i would get this working first, any tutorials / referenzes to look at?
#113073 - strager - Fri Dec 22, 2006 7:44 pm
Rockviech wrote: |
4000130h is the key status
bit 0 is key a
now if i do
cmp 4000130h,0
is this checking if key a is pressed this single frame? |
I don't believe that is valid ARM syntax.
To check for key input, you must first read the key register into a register. Then check the value. Also, I recommend using tst for bit testing.
As such:
Code: |
mov r0, #0x04000000 ; Register base address
add r0, r0, #0x0130 ; REG_KEYINPUT offset
ldrh r0, [r0] ; Read
tst r0, #1 ; & KEY_A
; conditional code here
|
Be sure to check the syntax of an instruction before trying it out. You'd want to fully understand what you're typing, and not assume the compiler will transfer your language into 'real' assembly.
#113076 - Rockviech - Fri Dec 22, 2006 8:04 pm
thanks, i think i understood this:
why [ ]?
and ldrh means half word, 16 bit,i have to use it here because KEYINPUT is 16 bit long?
and for Code: |
mov r0, #0x04000000 |
isnt this also possible?
Code: |
mov r0, #0x04000130h |
ok, to the displaying text stuff
i used objdump for asm output, and the iprintf part says
isnt pc the counter register?
and whats #36?
sorry if im asking to much....
#113078 - Mighty Max - Fri Dec 22, 2006 8:30 pm
Rockviech wrote: |
thanks, i think i understood this:
why [ ]?
|
[] indicates that r0 is used as the address to load from.
Quote: |
and ldrh means half word, 16 bit,i have to use it here because KEYINPUT is 16 bit long?
|
Yes.
Quote: |
and for Code: | mov r0, #0x04000000 |
isnt this also possible?
Code: | mov r0, #0x04000130h |
|
No it isnt. Every instruction is encoded as one word. Therefor it does not contain enough space to contain the instruction and a complete word immediate.
However, you can do LDR r0,=0x04000130h
(it will internally create a word somewhere in the codesegment it loads from, like in your next question)
Quote: |
ok, to the displaying text stuff
i used objdump for asm output, and the iprintf part says
isnt pc the counter register?
and whats #36?
|
It translates:
Load register r0 from word at address (pc + 36)
pc is an alias for r15, which is the program counter (better: pointer to the last prefetched opcode) which is actually two instructions infront of actual execution.
If the above LDR was executed from address 0. The word on address 44 would have been read.
_________________
GBAMP Multiboot
#113080 - strager - Fri Dec 22, 2006 8:43 pm
Rockviech wrote: |
thanks, i think i understood this:
why [ ]?
and ldrh means half word, 16 bit,i have to use it here because KEYINPUT is 16 bit long?
|
According to GBATEK, the syntax is:
GBATEK wrote: |
...
6-5 Opcode (0-3)
When Bit 20 L=0 (Store) (and Doubleword Load/Store):
0: Reserved for SWP instruction (see ARM.12 Single Data Swap)
1: STR{cond}H Rd,<Address> ;Store halfword [a]=Rd
2: LDR{cond}D Rd,<Address> ;Load Doubleword R(d)=[a], R(d+1)=[a+4]
3: STR{cond}D Rd,<Address> ;Store Doubleword [a]=R(d), [a+4]=R(d+1)
When Bit 20 L=1 (Load):
0: Reserved.
1: LDR{cond}H Rd,<Address> ;Load Unsigned halfword (zero-extended)
2: LDR{cond}SB Rd,<Address> ;Load Signed byte (sign extended)
3: LDR{cond}SH Rd,<Address> ;Load Signed halfword (sign extended)
...
Instruction Formats for <Address>
An expression which generates an address:
<expression> ;an immediate used as address
;*** restriction: must be located in range PC+/-255+8, if so,
;*** assembler will calculate offset and use PC (R15) as base.
Pre-indexed addressing specification:
[Rn] ;offset = zero
[Rn, <#{+/-}expression>]{!} ;offset = immediate
[Rn, {+/-}Rm]{!} ;offset = register
Post-indexed addressing specification:
[Rn], <#{+/-}expression> ;offset = immediate
[Rn], {+/-}Rm ;offset = register
Whereas...
{!} exclamation mark ("!") indicates write-back (Rn will be updated).
|
Bolded part explains your question about the brackets.
The REG_KEYINPUT register is 16 bits wide, and a "word" is 32 its wide. Thus, a half-word (16-bit) read would be enough.
Rockviech wrote: |
and for Code: | mov r0, #0x04000000 |
isnt this also possible?
Code: | mov r0, #0x04000130h |
|
According to GBATEK:
GBATEK wrote: |
Second Operand (Op2)
This may be a shifted register, or a shifted immediate. See Bit 25 and 11-0.
Unshifted Register: Specify Op2 as "Rm", assembler converts to "Rm,LSL#0".
Shifted Register: Specify as "Rm,SSS#Is" or "Rm,SSS Rs" (SSS=LSL/LSR/ASR/ROR).
Immediate: Specify as 32bit value, for example: "#000NN000h", assembler should automatically convert into "#0NNh,ROR#0ssh" as far as possible (ie. as far as a section of not more than 8bits of the immediate is non-zero). |
This means that you can only move an immediate if it is 8 bits wide and (optionally) shifted.
Rockviech wrote: |
ok, to the displaying text stuff
i used objdump for asm output, and the iprintf part says
isnt pc the counter register?
and whats #36?
sorry if im asking to much.... |
(Better you read Mighty Max's description than mine.)
That is used often by the compiler to grab an immediate without calculating it. What the code does it tell the processor to read 36 bytes ahead of the next instruction (not sure if this is 100% accurate). 36 is the offset, in bytes (or words?), to the register. At that address is the immediate, which is loaded into r0.
For more information on ldr, read GBATEK.
#113123 - Rockviech - Sat Dec 23, 2006 11:50 am
thanks to you 2
im not english so i have a dictionary here to translate the words i dont know.
offset = distance ?
so if i have 36 bytes offset, it means it reads 36bytes + the 8 bytes = offset of 44bytes?
ok, now one thing i dont understand is how to load the string? and is there an interrupt to write something?
Code: |
textHello dcb "HelloWorld",0
ldr r0, [textHello] @something like this?
|
so next thing is i have to load each byte and put it to screen?
on x86 assembly it was lodsb
some pseudo code:
Code: |
loadsinglebyte
checkifzero
ifso -> jump end
call interrupt to write
jump to begin ->next byte
|
hope someone can help me
#113128 - Mighty Max - Sat Dec 23, 2006 1:05 pm
Rockviech wrote: |
thanks to you 2
im not english so i have a dictionary here to translate the words i dont know.
offset = distance ?
so if i have 36 bytes offset, it means it reads 36bytes + the 8 bytes = offset of 44bytes?
|
Basically yes.
Quote: |
ok, now one thing i dont understand is how to load the string? and is there an interrupt to write something?
Code: |
textHello dcb "HelloWorld",0
ldr r0, [textHello] @something like this?
|
|
Code: |
stringName:
.asciz "Some string ...."
(...)
LDR r0,=stringName
|
Quote: |
so next thing is i have to load each byte and put it to screen?
on x86 assembly it was lodsb
|
Code: |
LDR r12,=stringName
stringHandlingLoop:
LDRB r0,[r12],1 @ meaning load byte from r12, and afterwards increase r12 by 1
CMPS r0,#0
BLNE someFunctionToWorkWithTheCharWeHaveRead
BNE stringHandlingLoop
continue:
|
_________________
GBAMP Multiboot
#113155 - Rockviech - Sat Dec 23, 2006 7:55 pm
thanks mighty, youre a big help
Code: |
BLNE someFunctionToWorkWithTheCharWeHaveRead
BNE stringHandlingLoop
|
well thats exactly what im searching :)
i havent found anything about putting something to the screen
#113157 - Mighty Max - Sat Dec 23, 2006 8:06 pm
You might want to take a look at the functions ndslib has for accessing the screen and call them. (arm9/video.h)
Or you got to write everything yourself. There is no predefined function to access on the DS. Your program would need to access the hardware directly via the HW registers at 0x04000000 (and up) and the video memory (depending on how you set up the screen)
_________________
GBAMP Multiboot
#113161 - kusma - Sat Dec 23, 2006 9:23 pm
Rockviech wrote: |
thanks mighty, youre a big help
well thats exactly what im searching :)
i havent found anything about putting something to the screen |
The DS has no text console, but you can use the tiled backgrounds and tilesets as a text console and a font. You'll have to upload the font yourself.
#113163 - Rockviech - Sat Dec 23, 2006 9:40 pm
forget that post, ill have a look into video.h
#113212 - Puyo - Sun Dec 24, 2006 1:00 pm
Doesn`t DS have any built-in font? How about the one used in PictoChat?
#113213 - OOPMan - Sun Dec 24, 2006 1:30 pm
That's part of the firmware, which isn't quite the same as the NDS (It's a part of the NDS, but not the only part :-)
I don't know if anyone has dug that far into the firmware...
_________________
"My boot, your face..." - Attributed to OOPMan, Emperor of Eroticon VI
You can find my NDS homebrew projects here...