Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rngaddress EQU 0200F440h
- ;Flashman Chips
- flashmanchipcount EQU 4h
- flashmanchipreturnaddr EQU 0xb672ah
- teamfamily EQU 26h
- areafamily EQU 0h
- stagefamily EQU 4h
- trumpyfamily EQU 3Fh
- input equ whitevanilla.gba ; Put the name of your ROM here
- fspace equ 0x10 ; Put the ROM free space offset here
- .gba
- .open input,output.gba,8000000h
- .org fspace+8000000h
- .align 2
- rngRoutine:
- ldr r0, [rngaddress]
- blt return
- loadRandomChip:
- push {r14}
- bl rngRoutine ;GET RNG result AND PUT INTO r0
- pop {r15}
- mov r1, flashmanchipcount ;number of chips in selection list
- swi 6; Divide
- ldr r0,=@@chipLookupTable ;Load address of chip lookup table (defined below)
- mov r2,0x03 ; Load r2 with 3
- mul r1,r2 ;Multiple the modulo result by the size of the structs (3 bytes) - this will provide an offset into the chip lookup table
- add r0,r0,r1 ;calculate the address using the offset, store in r0
- ldrb r3, [r0,0x02] ;load byte from *r0 (offset 2 forward) into r3 (dmg)
- ldrb r1, [r0,0x01] ;load byte from *r0 (offset 1 forward) into r1 (sublevel)
- ldrb r0, [r0,0x00] ;load byte from *r0 (direct addr) into r0 (family)
- ldrb r2,[r5,16h] ; ...this is actually the object's alliance enemy/allied
- b flashmanchipreturnaddr ;return to chip usage code (flashman)
- .pool
- @@chipLookupTable:
- .byte teamfamily, 0h, 0h
- .byte areafamily, 0h, 10h
- .byte stagefamily, 4h, 0h
- .byte trumpyfamily, 1h, 0h
- .close
- ; eof
Advertisement
Add Comment
Please, Sign In to add comment