Users browsing this thread: 2 Guest(s)
Assembly Programming

#27
Posts: 3,971
Threads: 279
Thanks Received: 238
Thanks Given: 58
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
Well I managed to create two list of item bet/won/monster faced for my WOB colosseum and the WOR colosseum. I made a second list at F1/FAA0 to F1/FD9F. Each data for each item bet is 4 bytes long: the first byte is the monster number, second byte is unknown (it's always $40), third byte is the item won and last byte is a flag to mask the item name (like when you face shadow).

The data related to the colosseum is in C3. Normally, there is this code:

Code:
C3/AF46:    202CB2      JSR $B22C      (Determine prize and monster based on item bet)

It's a jump at C3/B22C to determine the item won/monster to fight.

Now this is what I did:

Code:
C3/AF46:    2091F0      JSR $F091      (Jump where there is empty space in C3)

C3/F091:    22E0FBF1    JSL $F1FBE0   (Jump where there is even more empty space in F1)
C3/F095:    60        RTS                (return to C3/AF49)

I jump twice to get to F1 where there is empty space. Then I did this:

Code:
F1/FBE0:    E220        SEP #$20       (8 bit memory/accum.)
F1/FBE2:    AF941E7E    LDA $7E1E94   (Load event byte containing the WOR event bit (1E94:4))
F1/FBE6:    2910        AND #$10         (check if bit 4 is set)
F1/FBE8:    D022        BNQ $FC0C        (Branch to F1/FC0C if not equal to 0)

I check if we are in the WOR with the event bit 1E94:4 that is set when you start in the WOR. Now the command AND compare bit to bit 2 values. 0 AND 0 = 0, 0 AND 1 = 0, 1 AND 1 = 1. So since the event byte is the 5th bit on the byte, I compared the byte to $10(16). so as an example it could be this: 10010110 AND 00010000. No matter what the event bytes has as value, if bit 4 is set, the result will always be 00010000. If the bit is clear the result will be 00000000.

Depending of the result I branch to F1/FC0C or the game continue reading the code as follow:
Code:
F1/FBEA:    7B          TDC           (zero A)
F1/FBEB:    AD0502      LDA $0205       (Load item bet)    
F1/FBEE:    C220        REP #$20      (Set 16 bit memory/accum.)
F1/FBF0:    0A          ASL A           (multiply by 2 the item number)
F1/FBF1:    0A          ASL A           (multiply by 2 the item number)
F1/FBF2:    AA          TAX           (Transfer item number to X)
F1/FBF3:    E220        SEP #$20      (Set 8 bit memory/accum.)
F1/FBF5:    BFA0FAF1    LDA $F1FAA0,X  (Load monster to face)
F1/FBF9:    8D0602      STA $0206       (Store monster to face)
F1/FBFC:    BFA2FAF1    LDA $F1FAA2,X  (Load item to win)
F1/FC00:    8D0702      STA $0207       (Store item to win)
F1/FC03:    BFA3FAF1    LDA $F1FAA3,X  (Load masked item to win flag)
F1/FC07:    8D0902      STA $0209       (Store masked item to win flag)
F1/FC0A:    8020        BRA $FC3D   (branch always to F1/FC3D)

F1/FC0C:    7B          TDC           (zero A)
F1/FC0D:    AD0502      LDA $0205       (Load item bet in A)
F1/FC10:    C220        REP #$20       (Set 16 bit memory/accum.)
F1/FC12:    0A          ASL A           (multiply by 2 the item number)
F1/FC13:    0A          ASL A           (multiply by 2 the item number)
F1/FC14:    AA          TAX           (Transfer item number to X)
F1/FC15:    E220        SEP #$20       (Set 8 bit memory/accum.)
F1/FC17:    BF00B6DF    LDA $DFB600,X  (Load monster to face)
F1/FC1B:    8D0602      STA $0206       (Store monster to face)
F1/FC1F:    BF02B6DF    LDA $DFB602,X  (Load item to win)
F1/FC23:    8D0702      STA $0207       (Store item to win)
F1/FC26:    BF03B6DF    LDA $DFB603,X  (Load masked item to win flag)
F1/FC3A:    8D0902      STA $0209       (Store masked item to win flag)
F1/FC3D:    6B          RTL           (return to C3/F095)

Now this is pretty well explained so I won't go through it but the game will load the monster and item won of one of the two lists depending of the prior branching and will return in the previous subroutine to load the colosseum battle screen. What is important is that you can check for event bits using the AND command and branch if the result is equal to 0 (BEQ) or brach if the result is not equal to 0 (BNQ). The commands BEQ, BNQ or BRA need as parameter the number of bytes from after the command up to where you want to branch.

You could even have a third colosseum list if a certain event has occured...There are many possibilities.
  Find
Quote  
[-] The following 1 user says Thank You to madsiur for this post:
  • Gi Nattak (02-20-2021)



Messages In This Thread
Assembly Programming - by the_randomizer - 01-06-2012, 05:51 PM
RE: Assembly Programming - by Angelo26 - 01-12-2012, 08:50 PM
RE: Assembly Programming - by the_randomizer - 01-12-2012, 09:33 PM
RE: Assembly Programming - by madsiur - 01-15-2012, 03:01 AM
RE: Assembly Programming - by JCE3000GT - 01-16-2012, 04:40 PM
RE: Assembly Programming - by madsiur - 01-16-2012, 05:32 PM
RE: Assembly Programming - by JCE3000GT - 01-16-2012, 08:17 PM
RE: Assembly Programming - by madsiur - 01-23-2012, 02:47 AM
RE: Assembly Programming - by madsiur - 02-04-2012, 02:38 PM
RE: Assembly Programming - by madsiur - 03-25-2012, 04:32 AM
RE: Assembly Programming - by SSJ Rick - 03-25-2012, 01:05 PM
RE: Assembly Programming - by madsiur - 04-20-2012, 01:56 AM
RE: Assembly Programming - by Marketa Lazarova - 08-16-2016, 11:17 AM
RE: Assembly Programming - by seibaby - 08-16-2016, 01:21 PM
RE: Assembly Programming - by PinkMawile - 09-24-2016, 03:55 PM

Forum Jump:

Users browsing this thread: 2 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite