I noted the calculations part for RTWE.
Well, actually here's a simple code that places red tulips under you when you're outside.
L+R+A
Code:
94000130 FCFE0000
023FF090 012FFF11
E0000000 00000048
E28F2001 E12FFF12
68244C0D 00D222A9
68231AA4 68A20B5B
3B100B52 210F3A10
4019240F 4014091B
00490912 025B0164
186402D2 18E418A4
22004902 4770530A
021C6DEC 021E3124
023FF090 E3520003
D2000000 00000000
Noted Source (you can probably understand this Demonic)
Code:
.set LRA, 0x301
/* Make our activator line
* activator is L+R+A
*/
.long 0x94000130
.short 0x0,0 !LRA
.long 0x23FF090, 0x12FFF11
.long 0xE0000000, Code_End-Code_Begin
Code_Begin:
@Convert to THUMB
add r2, pc, #0x1
bx r2
.thumb
ldr r4, Coordinates
ldr r4, [r4]
mov r2, #0xA9
lsl r2, #3
sub r4, r2
ldr r3, [r4] @r3 now holds x coordinate
/*shift to get only 2 digits
*and divide those digits by 2
*so we get the number of slots
*/
lsr r3, #0xD
ldr r2, [r4, #8] @r2 now holds y coordinate
lsr r2, #0xD
/*subtract #16 because the first acre
*is above/to the left of the wall
*so we dont need to use those slots
*/
sub r3, #0x10
sub r2, #0x10
BeginDivision:
mov r1, #0xF
mov r4, #0xF
/* this will divide by #16 (#0x10)
* so we can get acres
* r1 holds remainder
* r3 holds quotient
*/
DivideX:
and r1, r3, r1
lsr r3, #4
/* r4 holds remainder
* r2 holds quotient
*/
DivideY:
and r4, r2, r4
lsr r2, #4
/* this will multiply the results
* each X single slot increments by 0x2
* so multiply that by 0x2
* each Y single slot increments by 0x20 (#32)
* because to increment 1 Y you need 0x10 X (0x10 * 0x2)
* each X acre increments by #512 (0x200)
* 16*16 slots in each acre, 256*2 is #512
* each Y acre increments by #2048 (0x800)
* to increment 1 Y acre you need 1 X row
* which is 256*4 = 1024*2 = #2048
* so multiply by #2048
*/
lsl r1, #1
lsl r4, #5
lsl r3, #9
lsl r2, #0xB
@now, add the results together to get offset
add r4, r1
add r4, r2
add r4, r3
ldr r1, Map
mov r2, #0
@store item in slot1 + offset
strh r2, [r1,r4]
bx lr
.arm
Coordinates:
.long 0x21C6DEC
Map:
.long 0x21E3124
Code_End:
.align 3
.long 0x23FF090, 0xE3520003
.long 0xD2000000, 0x00000000
If you compile the ASM source, compile it under nitrohax, and copy everything except the c2 line at the top.