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 > Compile ASM source?

#131067 - Sithviperx - Sun Jun 10, 2007 8:13 pm

Hello everyone, please excuse my ignorance in this matter, but I'm trying to figure out how to "Compile" this ASM code into an Action Replay code. I am also supposed to add something called "Arctan" to it, but I probably lack the technical expertise for that too.

There is already an AR version of the code out, but it is limited in what it can do, the source version is fully able to be used (As long as I add "Arctan"). I would post the code here, but I think thats asking a bit much of you guys to compile it for me. (Unless of course you want to do that for me)

A link/guide on how to do this would really be helpful as my google searches have returned nothing relevant.

Thanks in advance

#131078 - Dwedit - Sun Jun 10, 2007 10:19 pm

We can't help you if you don't post the code you need compiled.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."

#131100 - Sithviperx - Mon Jun 11, 2007 2:01 am

Code:
.org $37fbacc
ldr pc, Target

.org $37fbad4
Target:
.long 0x2000000

037FBACC E59FF000
037FBAD4 02000000

037FBACC E3A00005 //Disabler for reloading test script
037FBAD4 E12FFF1C

.org $2000000
ldr r0, CustomStack
stmdb r0!, {r1-r11, lr}
sub r0, #0x4
ldrb r3, [r0]
sub r1, r0, #0x4
ldr r2, [r1]
ldr r4, IOFetch
ldrh r4, [r4]
and r4, r4, #0x8
cmp r4, #0x0
bne NoIncrement
cmp r2, #0x1
beq There
add r3, #0x1
mov r2, #0x1
str r2, [r1]
b There
NoIncrement:
mov r2, #0x0
str r2, [r1]
There:
and r3, r3, #0x3
strb r3, [r0]
mov r2, #0xf30
ldr r1, Who
ldr r1, [r1]
cmp r1, r3
beq AimAtSelf
mul r0, r1, r2
mul r5, r3, r2
ldr r4, Base
add r5, r5, r4
add r4, r4, r0
ldr r8, [r4]
ldr r9, [r5]
sub r8, r9, r8
ldr r9, [r4, #0x4]
ldr r10, [r5, #0x4]
sub r9, r10, r9
ldr r10, [r4, #0x8]
ldr r3, [r5, #0x8]
sub r10, r10, r3
ldr r2, CorrectionScalarTwo
mov r0, #0x0
mov r1, #0x0
smlal r1, r0, r2, r9
lsr r1, r1, #0x10
lsl r0, r0, #0x10
add r9, r0, r1
mov r3, r8
bl Sixteen
mov r3, r9
bl Sixteen
mov r3, r10
bl Sixteen
b Seventeen
Sixteen:
and r6, r3, #0x80000000
cmp r6, #0x0
rsbne r3, r3, #0x0
orr r3, r3, #0x4000
mov r6, #0x0
Eighteen:
and r7, r3, #0x80000000
cmp r7, #0x0
bne Shift
lsl r3, r3, #0x1
add r6, #0x1
b Eighteen
Shift:
rsb r6, r6, #0x11
asr r8, r8, r6
asr r9, r9, r6
asr r10, r10, r6
bx lr
Seventeen:
cmp r8, #0x0
beq DivByZero
and r6, r8, #0x80000000
lsl r0, r10, #0x10
mov r1, r8
swi #0x90000
mul r0, r8, r8
ldr r1, CorrectionScalar
ldr r2, TestOne
mov r11, #0x6
cmp r3, r2
blt Divide
lsl r11, #0x10
eor r1, r1, r11
lsr r11, #0x10
add r11, #0x7
ldr r2, TestTwo
cmp r3, r2
blt Divide
lsl r11, #0x10
eor r1, r1, r11
lsr r11, #0x10
add r11, #0x3
ldr r2, TestThree
cmp r3, r2
blt Divide
lsl r11, #0x10
eor r1, r1, r11
Divide:
swi #0x90000
lsl r0, r0, #0x10
swi #0xd0000
cmp r6, #0x0
rsbne r0, r0, #0x0
mov r8, r0
DivByZero:
mul r0, r8, r8
mul r1, r10, r10
add r0, r0, r1
swi #0xd0000
mov r1, r9
and r6, r1, #0x80000000
cmp r6, #0x0
rsbne r1, r1, #0x0
orr r11, r0, #0x4000
mov r3, #0x0
Nineteen:
and r2, r11, #0x80000000
cmp r2, #0x0
bne Swerve
lsl r11, r11, #0x1
add r3, #0x1
b Nineteen
Swerve:
rsb r3, r3, #0x11
asr r0, r0, r3
asr r1, r1, r3
bl Arctan
and r7, r0, #0x8000
cmp r7, #0x0
eorne r0, r0, #0x8000
lsr r0, r0, #0x1
cmp r6, #0x0
rsbne r0, r0, #0x0
str r0, [r4, #0x84]
mov r0, r8
mov r1, r10
and r6, r0, #0x80000000
cmp r6, #0x0
rsbne r0, r0, #0x0
and r7, r1, #0x80000000
cmp r7, #0x0
rsbne r1, r1, #0x0
bl Arctan
and r11, r0, #0x8000
cmp r11, #0x0
eorne r0, r0, #0x8000
lsr r0, r0, #0x2
cmp r7, #0x0
rsbeq r0, r0, #0x0
str r0, [r4, #0x88]
ldr r2, [r4, #0x80]
and r3, r2, #0x80000000
cmp r6, r3
beq OldTilt
rsb r2, r2, #0x0
OldTilt:
str r2, [r4, #0x80]
AimAtSelf:
ldr r0, CustomStack
sub r0, #0x30
ldmia r0!, {r1-r11, lr}
mov r0, #0x5
ldr r12, Return
bx r12
CustomStack:
.long 0x2004000
IOFetch:
.long 0x4000130
Who:
.long 0x20d9cb8
Base:
.long 0x20da730
CorrectionScalar:
.long 0x39e28
CorrectionScalarTwo:
.long 0x5e28
TestOne:
.long 0x1186e
TestTwo:
.long 0x20867
TestThree:
.long 0x41c1b
Return:
.long 0x37fbb2c

If you want the Arctan, rip it from the AR code.


Note: Not my code. And remember there is a note beside some of the code at the top.

Need to compile this to Action Replay code and add "Arctan" which apparently already resides in this AR code:

Code:
E2000000 00000488
E59F02D8 E9204FFE
E2400004 E5903000
E2401004 E5912000
E59F42C4 E1D440B0
E2044008 E3540000
1A000005 E3520001
0A000005 E2833001
E3A02001 E5812000
EA000001 E3A02000
E5812000 E59F7294
E5D71000 E2411001
E1510003 AA000000
E3A03000 E5C03000
E3A02EF3 E59F1278
E5911000 E0000291
E0050293 E59F426C
E0855004 E0844000
E3A03000 E3A06000
E7948006 E7959006
E1580009 02833001
E2866004 E356000C
0A000000 EAFFFFF7
E3530003 0A000083
E59F8234 E3A09055
E1A09409 E2899057
E1A09409 E289902A
E1A09409 E28990A9
E0288009 E1A01101
E0811008 E1D110B0
E1A01281 E3A080AB
E1A08608 E2888079
E1A08208 E2888006
E1A08408 E28880A5
E0211008 E1510008
1A00006C E5948000
E5959000 E0498008
E5949004 E595A004
E04A9009 E594A008
E5953008 E04AA003
E1A03008 EB000004
E1A03009 EB000002
E1A0300A EB000000
EA00000F E2036102
E3560000 12633000
E3833901 E3A06000
E2037102 E3570000
1A000002 E1A03083
E2866001 EAFFFFF9
E2666011 E1A08658
E1A09659 E1A0A65A
E12FFF1E E0000898
E0010A9A E0800001
EF0D0000 E1A01009
E2016102 E3560000
12611000 E380B901
E3A03000 E20B2102
E3520000 1A000002
E1A0B08B E2833001
EAFFFFF9 E2633011
E1A00350 E1A01351
EB000044 E2007902
E3570000 12200902
E1A00120 E3560000
12600000 E59FB0DC
E24BB038 E92B000B
E1A00800 E3A01F63
E1A01401 E2811F86
EF090000 E1A02000
E8BB000B E1A01000
E0000091 E1A01002
EF090000 E5840084
E1A00008 E1A0100A
E2006102 E3560000
12600000 E2017102
E3570000 12611000
EB000026 E200B902
E35B0000 12200902
E1A00120 E3570000
02600000 E59FB064
E24BB038 E92B000B
E1A00800 E3A01011
E1A01601 E2811FAA
EF090000 E1A02000
E8BB000B E1A01000
E0000091 E1A01002
EF090000 E5840088
E5942080 E2023102
E1560003 0A000000
E2622000 E5842080
E59F0010 E2400030
E8B04FFE E3A00000
EE070F90 E12FFF1E
02004000 04000130
020E7900 020D9CB8
020DA730 57595185
E28F2001 E12FFF12
2900B5F0 2800D106
2000DB01 2080E049
E0460200 D1072800
DB022900 02002040
20C0E03F E03C0200
03921C02 039B1C0B
424D4244 02362640
29000077 2800DB1B
4288DB0F 1C01DB06
F0001C18 F000F82D
E026F855 F0001C10
F000F827 1A30F84F
428CE01F 1C01DBF6
F0001C18 F000F81D
1838F845 2800E015
42ACDC09 1C10DCF3
F812F000 F83AF000
1A3019F6 42A8E009
1C01DBF5 F0001C18
F000F807 19FFF82F
BCF01838 4718BC08
4718A300 E2113102
42611000 E033C040
22600000 E1B02001
E15200A0 91A02082
3AFFFFFC E1500002
E0A33003 20400002
E1320001 11A020A2
1AFFFFF9 E1A01000
E1A00003 E1B0C08C
22600000 42611000
E12FFF1E 4718A300
E0010090 E1A01741
E2611000 E3A030A9
E0030391 E1A03743
E2833E39 E0030391
E1A03743 E2833C09
E283301C E0030391
E1A03743 E2833C0F
E28330B6 E0030391
E1A03743 E2833C16
E28330AA E0030391
E1A03743 E2833A02
E2833081 E0030391
E1A03743 E2833C36
E2833051 E0030391
E1A03743 E2833CA2
E28330F9 E0000093
E1A00840 E12FFF1E
02088344 E59F0000
02088348 E12FFF10
0208834C 02000000


To clarify. The source of this works on Wifi, the Action Replay version does not. In order to use the source, I need to compile it and add "Arctan" by ripping it from the AR code. I'm not asking you guys to do it for me, but some help would be appreciated.

#131120 - keldon - Mon Jun 11, 2007 10:12 am

http://nocash.emubase.de/gbatek.htm#biosfunctions

You can find out the ARM7TDMI opcodes; can't seem to find the link for it.

#131132 - tepples - Mon Jun 11, 2007 12:04 pm

It has something to do with 'arm-eabi-as -a', right?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.