Nukey Shay Posted January 20, 2004 Share Posted January 20, 2004 I've attached a rough assembly file. Undoubtedly, some tags need to be discovered before the file can be completely relocatable. But you should be able to make changes that do not change the addresses of the bitmaps at the end of the file. All of those MUST occur exactly where they originated from until the indirect tags can be discovered...in order to add/subtract lines at will. I identifed the START tag at the end of the file for you...START = high byte Note: Changing the little X's in the bitmaps will have no effect (because they are just comments)...you need to change the $ hex values right next to ".byte" When you edit it, be sure to save it as an MS-DOS text file (i.e. unformatted). Then to convert it back into a binary called freehack.bin (for example)...enter this: dasm freeway.asm -f3 -ofreehack.bin (note the -f3 and -o next to the filename) Try it out without changing anything first...then do a file compare to see if any differences exist freeway.zip Quote Link to comment Share on other sites More sharing options...
vb_master Posted January 21, 2004 Author Share Posted January 21, 2004 I'm using Distella 3.0 I donno if that matters? Quote Link to comment Share on other sites More sharing options...
vb_master Posted January 21, 2004 Author Share Posted January 21, 2004 Ok I downgraded to v2 and I used the color chart to modify COLUP0 and COLUP1 to be 5A and 5B. When I compile with DASM, it works and now when I run it through the car, score and characters and black, I mean -- when I just get run over by a car, it justs rolls over me like nothing happened. Weird... Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted January 21, 2004 Share Posted January 21, 2004 Noooo! I'm sorry. COLUP0 is always $06 and COLUP1 is always $07. You can't change those values up at the top...those are the ram ADDRESSES that the colors are saved to. So farther down in the program, values are loaded into one of the registers (like A, X, or Y), and then saved to those. That creates the color. Here's an example... LDA LFD00,x;load accumulator with a value STA COLUP0;save it to ram address $06 LDA LFD01,x;load the accumulator with the next value STA COLUP1;and save it to ram address $07 What is happening here is that the X register is being used as an offset to fetch values from a table at LFD00...and the values that are there are passed to the player color ram addresses. So in order to change the colors, you need to backtrack where the program is getting it's information (at LFD00 in this example). Sometimes, it would be getting it's info from ANOTHER ram address...which means that you would have to backtrack to see where an instruction saves a value to THAT ram address. And etc. etc. So why does the disassembly even say COLUP1 and COLUP0? Why not just say 7 and 6? Because it makes it easier to see where those colors are being saved Quote Link to comment Share on other sites More sharing options...
vb_master Posted January 21, 2004 Author Share Posted January 21, 2004 So where do I go to change the player colors in the dissasemble? Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted January 21, 2004 Share Posted January 21, 2004 Most likely a data table that holds the colors (those .byte lines). Hang on and I'll see if I can find it. Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted January 21, 2004 Share Posted January 21, 2004 Think I've found it... LF011: LDA LF6F0,X;4 EOR $86 ;3 AND $87 ;3 STA $88,X ;4 CPX #$04 ;2 BCS LF020 ;2 STA COLUP0,X;4 . . . . LF6F0: .byte $4A;f6f0 | X X X | .byte $1E;f6f1 | XXXX | .byte $0C;f6f2 | XX | .byte $06;f6f3 | XX | .byte $00;f6f4 | | .byte $08;f6f5 | X | The table LF6F0 is read by the above routine. Those values are also used by something else...so I dunno if they can be changed in the table itself just by looking at this part of the program. There might be more as well... Try hacking those values in the .byte lines (note - changing the placement of the X's will have no effect...these are comments only. Hack the $ value instead). Quote Link to comment Share on other sites More sharing options...
vb_master Posted January 21, 2004 Author Share Posted January 21, 2004 The $1E modifies the color of the person and the road stripe! Its cool to see a purple road stripe! Now... Where would I find the sound of the chicken being hit by a car? I want to make it sound like he's yelling/swearing. Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted January 21, 2004 Share Posted January 21, 2004 The same method...look for areas of the program that is saving values to the sound registers (like AUDF0)...and then locate the table or routine that holds the values saved there. Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted January 21, 2004 Share Posted January 21, 2004 The end of routine LF2E3 holds very high-pitched sound... PHA ;3 AND #$03 ;2 ADC #$02 ;2 STA AUDF0,X;4 PLA ;4 LDY #$04 ;2 See that AND? It's stripping away all high values...keeping only byte values contained in the first 2 bits (which would be values 0 to 3). Then, a value of 2 is added in the next line (ADC #$02). So what would happen if you changed that #$02 to something higher? It will make a lower sound High values = low pitched sound, low values = high pitched sound. Quote Link to comment Share on other sites More sharing options...
vb_master Posted January 21, 2004 Author Share Posted January 21, 2004 Very neat, I changed the #$02 to #$07, Now I will have to find the right pitch for the scream. Can I make the on-off-on pattern be in a different pattern? I have learned alot today. Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted January 21, 2004 Share Posted January 21, 2004 To do that you would need to either change the instructions or find an area of memory that you can jump to (that will hold your new routine). Then instead of doing all the calculations right at the memory address above, JSR to your routine. When the program encounters an RTS instruction there, it will return right to the spot that it left from. This is getting beyond simple hacking and more into actual 6502 coding...so you might want to read some of those tutorials to discover what those instructions do. Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted January 21, 2004 Share Posted January 21, 2004 Freeway is only 2k though. You can turn it into a 4k rom by adding this to the assembly... LF800: .ds 2042,0 ORG $fffa .byte $00,$00,<START,>START,$40,$80 I just added a "fill" command, and copied the vectors to be at the end of the file. In the original routine, instead of having the AND and ADC instructions, you can use JSR LF800 / NOP instead. Try this assembly...the routine is already moved. What is important is that X is not changed in whatever routine you make at LF800. You can use the A and Y registers...since they are loaded with a new values below the original sound routine anyway. When the routine does an RTS, the value that you want for the sound should be sitting in the accumulator. Whatever instructions are added, must be subtracted from the byte count in the .ds line...if you add 4 instructions at 2 bytes each, you must subtract 8 from the number there (so the rom will be an exact 4096 bytes). If you compile it and it is suddenly 4099 for example, you didn't lower the number enough. That's almost 2k of routines you can add. But you'll still need to make sure that you don't waste too much time at any point there. fw.zip Quote Link to comment Share on other sites More sharing options...
vb_master Posted January 22, 2004 Author Share Posted January 22, 2004 With the 4k build I can't find the PHA ;3 AND #$03 ;2 ADC #$02 ;2 STA AUDF0,X;4 PLA ;4 LDY #$04 ;2 Routine Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted January 22, 2004 Share Posted January 22, 2004 That's because I split it (so you can change it around). The routine is waaaay at the end PHA ;3 ; AND #$03 ;2 do not compile these ... ; ADC #$02 ;2 ...in order to use the added JSR instead :) JSR LF800 ;3 NOP ;2 ...NOP takes care of the leftover byte STA AUDF0,X;4 PLA ;4 LDY #$04 ;2 See that JSR and NOP? That took the space previously used by the two instructions that are altering the accumulator...and instead is jumping to the start of the next 2k bank... LF800: AND #$03 ;2 ADC #$02 ;2 RTS .ds 2037,0 So you can try using combinations of SBC, ASL, ROL, anything that changes the accumulator. Stick an RTS at the end, and it will jump right back to store it in the AUDF0 hardware register Be sure to subtract the number of bytes you add from the .ds instruction below it - that one fills up the rest of the memory. It's best to patch code in this manner (by replacing values) since the game will probably contain lookup tables that Distella did not label. Putting your replacement code in unused bytes will keep the game from getting pointers from the wrong memory addresses and crashing/garbled. Quote Link to comment Share on other sites More sharing options...
vb_master Posted January 22, 2004 Author Share Posted January 22, 2004 Huh? Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted January 22, 2004 Share Posted January 22, 2004 lol You don't really need to know how it works unless you want to learn 650x coding proper...just that it works. See those instructions at LF800? Suppose you erased them and typed this instead: LF800: ORA #$FD SEC SBC $EE LSR RTS That routine is 2 bytes longer than the length of the original...so you'll also need to change the .ds line... .ds 2035,0 Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted January 22, 2004 Share Posted January 22, 2004 If you do want to learn 6502 programming, I suggest looking at the Machine Language For Beginners link...it can explain programming much better than I ever could. Quote Link to comment Share on other sites More sharing options...
vb_master Posted January 22, 2004 Author Share Posted January 22, 2004 Now it works! Ok now when I assemble it, It assembles, and it works in PCAE with out the .ds 2034,0 command! It also comes out to 5kb and 6kb with the .ds, and with the .ds command, it crashes in PCAE? Woah! Quote Link to comment Share on other sites More sharing options...
vb_master Posted January 25, 2004 Author Share Posted January 25, 2004 Ok here it is. Enjoy! afreehack22.zip Quote Link to comment Share on other sites More sharing options...
StanJr Posted January 25, 2004 Share Posted January 25, 2004 Looking good. Is it finished? Interesting that you chose to make the person sideways. I assume a vertical person was a bit too squat to look good? Hope your dad likes it! Quote Link to comment Share on other sites More sharing options...
uosipa llamxew Posted January 25, 2004 Share Posted January 25, 2004 LOL! I think the noise that your guy makes when he gets hit is hilarious! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.