Post Reply 
 
Thread Rating:
  • 1 Votes - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Gorgar lane change hack
05-08-2012, 11:10 AM
Post: #1
Gorgar lane change hack
Hello everybody
two of my friend ask me to do a lane change hack for the gorgar rom.
I wonder if it not already existing.
if not.
Maybe I could use a little help to know what routine are executed when a switch is activated in gorgar.
In fact even if I have work on sys 11 rom, I have never been able to figure how a routine is executed when a switch is activated. ( where the routine start and how the routine is selected etc.)

I think a gorgar rom with lane change will be a great improvement
thanks
Find all posts by this user
Quote this message in a reply
05-08-2012, 01:06 PM
Post: #2
RE: Gorgar lane change hack
No one's done this one yet. It's been asked about along with Flash to have the lane change, but I think it would make it a little bit too easy to get 3x every ball.

At rate, most system 6 roms have their switch matrix table starting at $60f5, with the first 2 bytes the routine the game goes to, and the next 2 bytes are a parameter/script location. If the next 2 bytes are 00 00, the first 2 point to straight 6800 assembly routine. If the first 2 bytes are in the $7xxx range, and the next 2 bytes are 00 00, usually that's a canned switch routine for a system switch that's the same in all games. If the first 2 bytes are in $7xxx range and the next 2 bytes are in the $6xxx range, that's usually a switch handler with parameters, the parameter list starting at the $6xxx.

One problem with the way WMS did the switch table is that whatever the last switch is used in the matrix, it just ends and something else (usually one of the switch scripts or parameter values) is immediately after it. So, you'll have to shift those script parameters somewhere else and adjust the pointers to insert your lane change switch (either on the flipper mech or on the cabinet switch; none currently exists there.) You can look at Firepower's lane change code which is at $63d9 and modify it to work with gorgar. The actual lane change code is very simple although to make it bulletproof (most WMS games do not allow lanes to score/add lamps when they were JUST completed) you have to take that into account.

Gorgar's switch matrix ends at $61a4, you'd probably want to add the lane change switch as the next switch Col 6 Row 4, shifting the parameters that are there somewhere else. Not sure if there's an overall counter as to the # of switch matrix table entries; there might be to prevent a romset in another game doing something random if there happened to be a higher switch # there.

The blank space in Gorgar starts at $65a7; change the parameters at $61a5 to go here instead. You'll need 4 bytes to add the next switch in col6, and the current data at $61a5 is for col2 row1's switch. (just one byte). Col2 Row2's switch uses data from $61a6-61ac, so that should be moved (and pointer adjusted) as well.

Now add the routine's new handler to $61a5 as 67 00 00 00 - making your routine at $6700 with parameters 00 00. Write your lane change routine at $6700, and using Jmp $7062 to exit (this is the universal exit routine for system 6)

Your lane change routine will need to not only rotate the lamps but also rotate whatever stores the status of the lamps, if separate. You'll have to preserve the contents of the rest of the lamp column.

Good luck. When you're successful, this technique will apply to the other system 6 games that could use a lane change option as well. The games with 2x/3x only I don't think really benefit from this lane change upgrade, but a lot of people have asked me as well for Flash, Gorgar, and Time Warp. I find it more fun to nudge to collect in those games.
Find all posts by this user
Quote this message in a reply
05-09-2012, 06:50 AM
Post: #3
RE: Gorgar lane change hack
Looking further into this, WMS does use a parameter to cap the # of the switches, it's at $6044 in the game rom. So for gorgar, $2c is there, you need to make it $2d so that the switch matrix scan will not stop at switch 44. If you plan on adding 2 switches to each of the 2 flippers $2e will do it, so that you can lane change both directions, but if you want to match the way WMS did it with firepower/similar games from that era, they only rotated to the right.
Find all posts by this user
Quote this message in a reply
05-10-2012, 10:19 AM (This post was last modified: 05-10-2012 10:20 AM by Francis.)
Post: #4
RE: Gorgar lane change hack
Hello Ralph
As usual than you for your Help, its Greatly Greatly appreciated.
For the switch matrix, I think I'm gonna ssimplify the job a lot by taking the existing switch on the machine wich are the "slam tilt" and the "playfield tilt", wich I dont think they are of any use for a Home use only gorgar.
I'm really not sure that those lamp are stored somehwere in the rom. But I will have a look at this.
Thanks again, I'll keep you in touch.
P.S.
for your info
I will do one switch that does the A-B-C lane change
and another that are gonna do the D-E Lane change
Find all posts by this user
Quote this message in a reply
05-10-2012, 01:31 PM
Post: #5
RE: Gorgar lane change hack
Yeah, reusing those switches is a viable and easy way to do it - to ensure that you're not introducing some other bug. If you look for the save player status routine, you will find out quickly if the lamps (if they carry over) are stored somewhere else or not, either in the player status restore you will see it copied not only to the lamp matrix but to some other locaiton (or if you look at the code for completing A-B-C)

Of course for maximum confusion the a-b-c rollovers are all the goofy WMS script.
Find all posts by this user
Quote this message in a reply
05-11-2012, 12:16 PM (This post was last modified: 05-11-2012 12:18 PM by Francis.)
Post: #6
RE: Gorgar lane change hack
I check the gorgar rom and with your help Ralph I'm close to my goal.
I check the BLackout roms for the lane change and there is a part of the code I dont understand.
I tried to add the code I understand in the Gorgar rom, when I press the switch the lane change correctly but when I press a switch for a lane, the game Bug.

So my question is to help understand the part of the Blackout code that I dont understand what it does exactly

here is the code


****************
Part that I dont understand

63BB: 8D E9 bsr $63A6


63A6: 7E 79 BF jmp $79BF
79BF: D6 78 ldb $0078
79C1: C5 03 bitb #$03
79C3: 26 01 bne $79C6
if we jump 79C6: 33 pulb
79C7: 33 pulb
79C8: 7E 70 62 jmp $7062 // end of routine
79C5: 39 rts


63BD: 86 4C lda #$4C // 4C is in A
63BF: BD 77 7C jsr $777C /// I dont understand that routine


777C: 36 psha
777D: 37 pshb
777E: 4D tsta // we test if a = 0
777F: 27 17 beq $7798 // we branch if A is not equal to 0
7781: 2B 07 bmi $778A
7783: 8D 17 bsr $779C


779C: BD 79 53 jsr $7953 // Its a routine that increase X to 0019 if A = 4C


7953: DF 88 stx $0088
7955: CE 00 10 ldx #$0010
7958: C6 01 ldb #$01
795A: 4A deca // on decrease A et on
795B: 2B DF bmi $793C // as long as A is positive we decrease //793C = RTS
795D: 58 aslb
795E: 26 FA bne $795A
7960: 08 inx // we increase X when B = 0
7961: 20 F5 bra $7958


779F: 17 tba
77A0: E4 00 andb (x+$00) // in this case X = 0019
77A2: A4 0A anda (x+$0A) // X= 0019 + 0A = 0023
77A4: DE 88 ldx $0088
77A6: 4D tsta
77A7: 39 rts


7787: 5D tstb
7788: 20 0F bra $7799
7799: 33 pulb
779A: 32 pula
779B: 39 rts


63C2: 26 1D bne $63E1 // $63E1 = end of routine
63C4: 96 51 lda $0051
63C6: 26 19 bne $63E1
63C8: 86 06 lda #$06 // A = 06
63CA: 97 51 sta $0051 // we store A in 0051 no idea why!

******************
here is the part of the routine I understand (lower) (I try to put only that part in the gorgar rom, it change lane like it does but it bugg later when I press the switch for an ABC lamp

63CC: 96 13 lda $0013 // we load the adress of the lamp row that contains the lamp change
63CE: 16 tab
63CF: C4 C7 andb #$C7 // B now contains only the bites that are not the ABC lanes
63D1: 84 38 anda #$38 // A now contains only the ABC lanes bites
63D3: 27 0C beq $63E1 // if the mamp ABC are equals to 0 = end of routines
63D5: 85 20 bita #$20 // on test le Bit 20 (the third lamp)
63D7: 27 02 beq $63DB // if the third lamp is closed, we jump to 63DB:
63D9: 8A 04 ora #$04 // or inclusive // on met le bit dans le
63DB: 48 asla // we change the lane change
63DC: 84 38 anda #$38 // we remove the lamp that are not from the ABC lane
63DE: 1B aba // we add A and B (A now contains ABC lanes + the other lamps)
63DF: 97 13 sta $0013 // we stack A into the right row
63E1: 7E 70 62 jmp $7062 // end of routine
Find all posts by this user
Quote this message in a reply
05-11-2012, 03:09 PM (This post was last modified: 05-11-2012 03:11 PM by RalphButler.)
Post: #7
RE: Gorgar lane change hack
First part is an 'active game check' - game checks to make sure you're actively playing a game before it allows the rest of the switch routine to run. All early solid state games have something similar to this (although some had some quirks - for instance on Stern Hot hand if the special lamp is lit and you run over it, it awards a free game as if you earned it. Since their attract mode normally never lights that lamp, it wasn't an issue until I monkeyed with the attract mode)

;active game check

79BF: D6 78 ldb $78
79C1: C5 03 bitb #$03
79C3: 26 01 bne $79C6
79C5: 39 rts ;in an active game, continue as normal

79C6: 33 pulb ;not an active game,
79C7: 33 pulb ;pull return address off stack
79C8: 7E 70 62 jmp $7062 ;and continue

======

Second part, not a clue on first glance - but it's safe to assume that anything that's in the $7000-$7fff range is some kind of OS routine that almost all (if not all) games use/can use. Wouldn't think that would all be needed for what you're trying to accomplish.

If you start the game and don't use lane change at all, do the ABC lanes work properly? If they don't something got very screwed up in the mod because you shouldn't have to modify the actual rollover routine at all.

I just tested it out in pinmame and it does appear that Gorgar just uses the lamp byte at $12 to control this - bits as follows: EDCB Axxx (making ABC just xxCB Axxx). You have the wrong location if you're using $13 for this - that's the next column (4) of lamps.

Here's what I came up with to use, it tested ok. Give this a try

;gorgar lane change

jsr $79bf ;active game check
lda $12
tab ;preserve a in b
andb #$c7 ;strip everything not ABC
anda #$38 ;mask out anything not ABC
beq exit ;nothing is lit, change nothing
cmpa #$38 ;all lit?
beq exit ;all lit, change nothing

asla
bita #$40 ;test to see if C lit
beq cwasntlit
ora #$08 ;light A if C lit
cwasntlit:
anda #$38 ;strip everything not ABC
aba ;combine with other values
sta $12 ;save combined byte
exit:
jmp $7062
Find all posts by this user
Quote this message in a reply
05-15-2012, 05:45 AM
Post: #8
RE: Gorgar lane change hack
Yes its wokring!
I change a little bit the routine you came with but its working now. Thanks Ralph
I'll test it and came with the final code later
Find all posts by this user
Quote this message in a reply
05-15-2012, 10:54 AM
Post: #9
RE: Gorgar lane change hack
Here is the modification I have made on the gamerom of Gorgar
The routine is doing a lane change for A-B-C and one for D-E

610D: 65A9 0000 ; slam tilt LaneSwitch routine was 643C I change it for 65A9

;begin of routine for the lane change
; first part do the lane change for A-B-C
65A9: BD 79 BF jsr $79BF ;active game check
65AC: 96 12 lda $0012 load the lamps
65AE: 16 tab ;preserve A in B
65AF: C4 C7 andb #$C7// ;keep everything not ABC
65B1: 84 38 anda #$38 / ;mask out anything not ABC
65B3: 27 09 beq $65BE // if lamps are not lit exit // go to ABA
65B5: 85 20 bita #$20 // we test if the third lamp is lit
65B7: 27 02 beq $65BB // we test the bit if its empty we skip next instruction
65B9: 8A 04 ora #$04 // or inclusive we put a 1 into the lamp before the A
65BB: 48 asla //
65BC: 84 38 anda #$38 //
65BE: 1B aba // A = A + B

// begin routine for lane change D-E
65BF: 16 tab ;preserve A in B // now A and B the lamp value
65C0: C4 3F andb #$3F //;keep everything exept D-E
65C2: 84 C0 anda #$C0 / ;mask out anything not D-E
65C4: 27 09 beq $65CF //if lamps are not lit exit // we go to add A and B
65C6: 85 80 bita #$80// on test le Bit 20 (the last lamp)
65C8: 27 04 beq $65CE // si le bit est 20 vide on plus loin
65CA: 8A 20 ora #$20 //We put a 1 into the C lamp
65CC: 84 60 anda #$60 //;strip everything not D and C, I dont want to mess with the ASLA later
65CE: 48 asla // we move the bit ledt
65CF: 1B aba // add A and B // no need to do Anda
65D0: 97 12 sta $0012 // we stack the lamp into the lamp matrix
65D2: 7E 70 62 jmp $7062 // / end of routine
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 2 Guest(s)