Jump to content

screw assembly


Crimson Red
 Share

Recommended Posts

@thumb

.org 0x01051400
	#add r2,0x04
               #strb r2,[r2,0x0202bd80]

Trying to write instructions to add 0x04 to register 2, then store that byte at the memory offset 0x0202bd80. and I'm trying to have this be written at 0x01051400 (though that's not too important, I can just copy/paste it). I don't know if this is right, don't think it's right, and for some reason all the programs I normally use to compile assembly hacks have gone ape-shit on me and just won't do it. >_____>

Edited by Strawhat Luffy
Link to comment
Share on other sites

Uhh... as in trigger a "memory hack" with an event?

I remember making this video for someone who needed to get conditions, maybe it could be useful for you since it uses an ASM command that I had:

Ignore the "Contitions" I was half asleep when I made this.

.thumb

.org 0x1010000
ldr r1, =0x202BC38
mov r0, #0x40
strb r0, [r1, #0]
bx lr

TEX6 0x7 [0,0] 0x9A5 // Ask to switch Text speed to "Fast"
Waitfortextbox
IFYN 0x01
ASMC 0x9010001 //Sets text speed to "Fast"
ENIF 0x01

From your ASM, you're telling it to store the byte in r2... in an address supposedly loaded at r2 AND THEN add 0x0202bd80 to make an address. Which... will definitely cause problems.

You would need another register for that address.

Edited by shadowofchaos
Link to comment
Share on other sites

Yep. STRB Rd, [Rb, #x] stores Rd at (value in Rb) + x. The available range for x is quite small, btw, putting an address in there won't do it.

Use LDR to put the address 0x0202bd80 into another register, and then use STRB using that register as Rb and an offset of 0. You can supply a full address value like that to LDR by prefacing it with '='; this is a pseudo-opcode - the assembler will put the address value after the function (in the "pool"), and turn the LDR instruction into LDR PC, <some offset> such that it indexes the constant correctly.

Link to comment
Share on other sites

Ah, well, my patience for the month has been worn out, I have no desire to throw myself into an abyss of poorly documented programming for more than a couple hours a month. >_> thanks anyhow, I might come back to this later.

Link to comment
Share on other sites

GBATEK is pretty thorough, honestly. Assembly programming is something of a specialized skill, though. Especially with THUMB - single opcodes really don't do very much, so it can really exercise your problem-solving skills trying to get anything meaningful accomplished. (That said, the results can be very impressive; e.g. a decompressor for my improved text compression that fits in the space of the original routine, or ryru's half-body and 4th stats screen work, or any of soc's one-offs.)

Edited by zahlman
Link to comment
Share on other sites

GBATEK is more of a reference or guide than a tutorial or detailed explanation. For average people like me, GBATEK is no more than a listing of details on how the GBA hardware works/where certain data is, and a list of available programming opcodes or instructions or whatever. It'd be like giving a person a list of ingredients and what each one is used for, then expecting them to cook something without a recipe. Most people probably couldn't just take the ingredients and come up with a delicious meal--given just the ingredients and what they are used for, they wouldn't know how to use them, or with what, or in what order, under what circumstances, and how to put everything together.

If a person is smart then maybe s/he can make sense of that stuff and just come up with his/her own recipe, but those people have to understand that it's not normal or even feasible, forget easy, for an average person to do something like that on their own...

Hopefully I made my point XP. I'd say more but... too tired... *falls asleep8

Link to comment
Share on other sites

Yeah, I hear you, it's just that ASM programming is pretty much always just gonna be like that. Honestly, programming in any language is. You're not going to learn (much about) how to sprite from a tutorial, either. :/ (Or at least, you might, but it's still going to seem unbearably tedious until you get some experience. Unless I just suck...)

Anyway, gl;hf next time you try it.

Edited by zahlman
Link to comment
Share on other sites

Just saying, Formal training in programming helps every now or then, but determination helps more than that. I learned ASM out of sheer determination myself, at least, and I don't find myself to be outstanding. :)

And I don't think you lack intuitions, your code was very close to the real deal as it was. You just lack confidence in your basics. :)

And to be honest I think a tutorial for ASM might be more helpful than a tutorial on spriting. XD Since spriting is an art, and ASM is a programming language, and thus more technical.

Edited by Ryrumeli
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...