I am learning ASM and I wanna make a simple code, like, an inventory slot modifier or something. Can someone help? *coughdemonicdrew&shawncough* :p
Printable View
I am learning ASM and I wanna make a simple code, like, an inventory slot modifier or something. Can someone help? *coughdemonicdrew&shawncough* :p
:P well
First of all, you need to understand how ASM works. Basically any ASM code you make is gonna load something, mess with that, and then store it somewhere, or some variation of that.
To load something you use a "ldr" operation. You can think of it as standing for "load directly into register"
To load a byte, youd use ldrb, a halfword would use ldrh, and a word would use ldr
A code like, 121D88FE 0000XXXX is a 16 bit write. So, to make this in ASM
ldr r0, =0x21D88FE @load where the value will be written to (in this case slot 1 address)
ldrh r1, =0x1566 @load 16bit value to write
strh r1, [r0] @store 0x1566 into 0x21D88FE
bx lr @this ends the code
Okay, I understand the registers and ldr things and all, but what's with the x's? ;p
XXXX is just the item hex, replace it with whatever item you want XD
Nonono, just the simple 1 x in...
=0x21D88FE
Do you have someone that teaches you via PM or IRC yet? If not, I'm sure Demonic or I could help. I think dboy would be happy to help too. It is much more efficient than posting on the forum every time you have a question.
The x is just part of the address. Don't question it.
If you mean the x like:
That x is basically a notation used to show that its in hex because you could do this:Code:sub r5, #0x10
sub r1, #0x10
Its still telling the code to subtract r5 and r1 by the same amount since 0x10[hex]=#16[decimal]Code:sub r5, #16
sub r1, #16
But for a simple item slot code, I would do this:
(It would be best to use ards codetypes for simple one line codes though)Code:ldr r0, InventorySlot1 //load the inventory slot1
ldrh r1, BlueFeather //since items are 16bits, load the value with ldrh
strh r1, [r0] //store the bluefeather into inventoryslot1 and use strh since the bluefeather is a 16bit we store the 16bit
bx lr //End the Code
InventorySlot1:
.long 0x21D88FE //Define the Literals, for acww 1.0 this is the first slot of the inventory address
BlueFeather:
.short 0x13FF //this is the blue feather hex
Isn't assembly super fun?! lul.
I think I'm starting to get it... :p