| Author | Topic: Patch to always boot into BASIC. (Read 1,626 times) |
tlr Wizard's Apprentice
     member is offline
Joined: Nov 2005 Posts: 844 Location: Stockholm/Sweden
|  | Patch to always boot into BASIC. « Thread Started on Dec 29, 2005, 2:15pm » | |
Patch $00F9AE in the ROM with $00 (was $04 before). This will make the check for the ctrl-key always true, and thus boot into basic automatically.
I tested it with flash-20051228, "Program Single Byte" and it works fine. (my unit is a DTV2 PAL from batch: 051005)
Edit: I should mention here that this patch is not reversible with the same method.
As always this is done on your own risk! If you have another version, or get it wrong the DTV may become permanently unbootable. Note: Do _not_ do sector erase on sector 00!
Code:F9A5 A9 7F LDA #$7F F9A7 8D 00 DC STA $DC00 ;Check <CTRL> F9AA AD 01 DC LDA $DC01 F9AD 29 04 AND #$04 F9AF D0 13 BNE $F9C4 ;no, auto boot F9B1 58 CLI ;yes, jump into basic |
|
...becomes...
Code:F9A5 A9 7F LDA #$7F F9A7 8D 00 DC STA $DC00 ;Check <CTRL> F9AA AD 01 DC LDA $DC01 F9AD 29 04 AND #$00 F9AF D0 13 BNE $F9C4 ;no, auto boot F9B1 58 CLI ;yes, jump into basic |
|
| |
|
David Murray Moderator
     member is offline
![[avatar]](http://galaxy22.dyndns.org/david-avatar.jpg)
Joined: Dec 2004 Gender: Male  Posts: 1,563 Location: Kennedale, TX
|  | Re: Patch to always boot into BASIC. « Reply #1 on Dec 29, 2005, 2:25pm » | |
Oh man.. it is too bad your flash program won't work on the hummer. When I get home tonight I'm going to work furiously to make it work in color mode in BASIC. I reviewed the long programming info file on the DTV2 and I think I know what I need to set to get color out of the unit. I'd love to reprogram the thing to boot to BASIC and boot to color.
| |
|
tlr Wizard's Apprentice
     member is offline
Joined: Nov 2005 Posts: 844 Location: Stockholm/Sweden
|  | Re: Patch to always boot into BASIC. « Reply #2 on Dec 29, 2005, 2:31pm » | |
Quote:| Oh man.. it is too bad your flash program won't work on the hummer. When I get home tonight I'm going to work furiously to make it work in color mode in BASIC. I reviewed the long programming info file on the DTV2 and I think I know what I need to set to get color out of the unit. I'd love to reprogram the thing to boot to BASIC and boot to color. |
|
I think that the "program single byte" function will work on the hummer. The rom image is probably not exactly the same on the hummer though, so the patch could be fatal! The 'D' dump sector and 'S' save data functions should be safe though. If you dump sector 00 and save it to a file (offset $000000 to $010000) and send it here, I can examine it and provide a patch.
| |
|
David Murray Moderator
     member is offline
![[avatar]](http://galaxy22.dyndns.org/david-avatar.jpg)
Joined: Dec 2004 Gender: Male  Posts: 1,563 Location: Kennedale, TX
|  | Re: Patch to always boot into BASIC. « Reply #3 on Dec 29, 2005, 11:02pm » | |
Okay, I got the dump for you. I would email it to you but your email isn't listed on here. So I made you a link for it:
http://galaxy22.dyndns.org/misc/hummerdtv/hummer.bin
It is from $0000 to $FFFF as requested. I'd actually look into hacking it myself but I am not 100% sure where the kernel code starts so I'd be kind of lost. I'm sure at one point I knew where the 6510 started executing code, but I forgot.
Also, I'd prefer, at this point, not to upload an entire kernel. The reason is, I discovered a few weeks ago that a demo I downloaded was corrupt. I think it happened over the X1541 cable. But the file was the right length and everything. Took me a week to figure out that was the problem. So unless I had some way to verify the integrity, I'd prefer to just change a few bytes here and there as you did.
I'd also be interested if you have made any documentation on how you were putting experimental kernels into a different memory block and trying them. I think that would be good for me because I am probably going to want to heck at the kernel myself. But I'll certainly want to try it first.
Just in case I screw it up, I stopped by RadioShack and picked up another Hummer today.
| |
|
tlr Wizard's Apprentice
     member is offline
Joined: Nov 2005 Posts: 844 Location: Stockholm/Sweden
|  | Re: Patch to always boot into BASIC. « Reply #4 on Dec 30, 2005, 4:12am » | |
Quote:Okay, I got the dump for you. I would email it to you but your email isn't listed on here. So I made you a link for it:
http://galaxy22.dyndns.org/misc/hummerdtv/hummer.bin
It is from $0000 to $FFFF as requested. I'd actually look into hacking it myself but I am not 100% sure where the kernel code starts so I'd be kind of lost. I'm sure at one point I knew where the 6510 started executing code, but I forgot. |
|
Ok, thanks! I think it was discussed here that we should avoid posting ROM dumps (athough that probably mostly refers to the actual game data). Best if you remove the file now, as I have downloaded it.
The locations of the various parts are listed on my flash page.
Your dump is missing 1 byte at the end, though I'm very certain that it should be $FF.
BTW, do you have some info that I may identify the rom with? e.g Batch Number, date at the end of the directory listing, etc...
Quote:| Also, I'd prefer, at this point, not to upload an entire kernel. The reason is, I discovered a few weeks ago that a demo I downloaded was corrupt. I think it happened over the X1541 cable. But the file was the right length and everything. Took me a week to figure out that was the problem. So unless I had some way to verify the integrity, I'd prefer to just change a few bytes here and there as you did. |
|
Note that using the "program single byte" function, you can only set '1'-bits to '0'-bits, not the other way around. (this is a limitation of the flash technology). To patch the roms, you must first mirror it to ram using the 'D' (dump) function, then 'L' (load data) on top of it. Next comes the really dangerous part. You must erase the sector (does not work on hummers yet, different flash), and then reprogram it with all the data.
Quote:I'd also be interested if you have made any documentation on how you were putting experimental kernels into a different memory block and trying them. I think that would be good for me because I am probably going to want to heck at the kernel myself. But I'll certainly want to try it first.
Just in case I screw it up, I stopped by RadioShack and picked up another Hummer today. |
|
This involves using the $D100 register to select a different 64Kb bank for the kernal rom. Setting this to $41 will map the kernal rom from ram at $01e000, Setting it to $40 will map it from the normal ram at $e000, making the ram and rom at $e000-$ffff equivalent. I could probably make a small utility for this.
| |
|
tlr Wizard's Apprentice
     member is offline
Joined: Nov 2005 Posts: 844 Location: Stockholm/Sweden
|  | Re: Patch to always boot into BASIC. « Reply #5 on Dec 30, 2005, 6:40am » | |
The same patch for the hummer game: I have not tested this at all, as I don't have a Hummer game! DTVLOAD will be permanently disabled, and the original HUMMER game wont start. You can probably load "HUMMER" from basic and run it if you like.
Patch $00F992 in the ROM with $00 (was $04 before). This will make the check for the ctrl-key always true, and thus start DTVLOAD automatically. Patch $00FAC0 in the ROM with $00 (was $40 before). This will make the check for any key in DTVLOAD true by default and skip directly to basic after printing the DTVLOAD string.
The patch is not reversible with the same method.
As always this is done on your own risk! If you have another version, or get it wrong the DTV may become permanently unbootable. Note: Do _not_ do sector erase on sector 00!
Code:F989 A9 7F LDA #$7F F98B 8D 00 DC STA $DC00 ;Check <CTRL> F98E AD 01 DC LDA $DC01 F991 29 04 AND #$04 F993 D0 03 BNE $F998 ;no, auto boot F995 4C 62 FA JMP $FA62 ;yes, jump into dtv load |
|
Code:FABD A5 C5 LDA $C5 ;Matrix Coordinate of last key pressed FABF C9 40 CMP #$40 ;Key pressed? ($40 means no key) FAC1 D0 6C BNE $FB2F ;Yes, continue to basic. FAC3 A5 01 LDA $01 ;no, check for DTVLOAD |
|
...becomes...
Code:F989 A9 7F LDA #$7F F98B 8D 00 DC STA $DC00 ;Check <CTRL> F98E AD 01 DC LDA $DC01 F991 29 04 AND #$00 F993 D0 03 BNE $F998 ;no, auto boot F995 4C 62 FA JMP $FA62 ;yes, jump into dtv load |
|
Code:FABD A5 C5 LDA $C5 ;Matrix Coordinate of last key pressed FABF C9 40 CMP #$00 ;Key pressed? ($40 means no key) FAC1 D0 6C BNE $FB2F ;Yes, continue to basic. FAC3 A5 01 LDA $01 ;no, check for DTVLOAD |
|
Note that on the hummer, the basic starting code just hard sets the video mode, probably to the wrong value for the production units.
Code:FA62 A2 01 LDX #$01 FA64 8E 3F D0 STX $D03F FA67 A9 00 LDA #$00 FA69 8D 40 D0 STA $D040 FA6C A9 01 LDA #$01 FA6E 8D 4F D0 STA $D04F FA71 A9 07 LDA #$07 FA73 8D 4E D0 STA $D04E FA76 A0 02 LDY #$02 FA78 A2 02 LDX #$02 FA7A B9 9E FB LDA $FB9E,Y FA7D 9D 41 D0 STA $D041,X FA80 88 DEY FA81 CA DEX FA82 10 F6 BPL $FA7A FA84 A9 00 LDA #$00 FA86 8D 3F D0 STA $D03F
FB9E 1C 13 2A .BYTE $1C,$13,$2A |
|
Could you do this and send me the result?
Code:POKE 56579,0 PRINT PEEK(56577) POKE 0,47 PRINT PEEK(1)
|
|
Also If you know the frequency of the Crystal on your board it would be very helpful.
| |
|
David Murray Moderator
     member is offline
![[avatar]](http://galaxy22.dyndns.org/david-avatar.jpg)
Joined: Dec 2004 Gender: Male  Posts: 1,563 Location: Kennedale, TX
|  | Re: Patch to always boot into BASIC. « Reply #6 on Dec 30, 2005, 9:43am » | |
TLR, It worked!!!!
I was pretty scared to try it. I actually opened a monitor and verified all the instructions you were looking at to make sure they were the same on my unit (maybe the file had been corrupted or something) So After a long time of checking everything, I tried it and it worked perfectly. It boots to BASIC and doesn't even wait for me to press a key at the prompt.
Now.. for the other information you wanted.
My crystal is a 32.7272 the last thiing on the directory listing is this: 2005 08 22 03:16:34
I haven't had a chance to work with the video/color issue yet. I didn't get home until late yesterday.. I'm off work today and plan on messing with that some.
So, let me get this right. Your code will program a byte on my ATMEL chip, but it won't erase one? Is that the problem?
| |
|
tlr Wizard's Apprentice
     member is offline
Joined: Nov 2005 Posts: 844 Location: Stockholm/Sweden
|  | Re: Patch to always boot into BASIC. « Reply #7 on Dec 30, 2005, 10:53am » | |
Quote:TLR, It worked!!!!
I was pretty scared to try it. I actually opened a monitor and verified all the instructions you were looking at to make sure they were the same on my unit (maybe the file had been corrupted or something) So After a long time of checking everything, I tried it and it worked perfectly. It boots to BASIC and doesn't even wait for me to press a key at the prompt. |
|
Great! 
Quote:Now.. for the other information you wanted.
My crystal is a 32.7272 the last thiing on the directory listing is this: 2005 08 22 03:16:34
I haven't had a chance to work with the video/color issue yet. I didn't get home until late yesterday.. I'm off work today and plan on messing with that some.
So, let me get this right. Your code will program a byte on my ATMEL chip, but it won't erase one? Is that the problem? |
|
It will also erase blocks, but because it assumes a different layout of the sectors it might erase an area different from what you'd expect. Pretty dangerous, ehh?
| |
|
tufty Newbie
 member is offline
Joined: Dec 2005 Posts: 20
|  | Re: Patch to always boot into BASIC. « Reply #8 on Dec 30, 2005, 11:20am » | |
Quote:| So, let me get this right. Your code will program a byte on my ATMEL chip, but it won't erase one? Is that the problem? |
|
When you erase, you have to erase by sector. This sets every byte in the sector to its unprogrammed state of 0xFF. You can then program the bits of the bytes you want to program to 0. Once a bit is flipped to zero, you can't set if back to one except by erasing the sector.
So. The hack works because all you are doing is setting a byte originally set to 0x04 to 0x00 (i.e. set bit 2 to 0) . If you needed to set the byte in question to, say, 0x02, you would have to erase the sector and reprogram, because that would involve flipping bit 2 to zero and bit 1 to one.
Simon
| |
|
huckle Full Member
   member is offline
Joined: Dec 2005 Posts: 103
|  | Re: Patch to always boot into BASIC. « Reply #9 on Jan 2, 2006, 6:21pm » | |
I've just patched my pal unit to boot straight into basic. that was pretty scary! Excellent stuff though, TLR. Thanks
| |
|
tlr Wizard's Apprentice
     member is offline
Joined: Nov 2005 Posts: 844 Location: Stockholm/Sweden
|  | Re: Patch to always boot into BASIC. « Reply #10 on Jan 2, 2006, 6:22pm » | |
Quote:I've just patched my pal unit to boot straight into basic. that was pretty scary! Excellent stuff though, TLR. Thanks
|
|
You're welcome!
| |
| |
|