Improved "The Hobbit"
Improved "The Hobbit"
Instead of polluting the "flood fill" thread, I'm making a new one for The Hobbit.
So ISS provided me with a DSK version of the game, which allowed me to do some horrible horrible things such as "patching the ROM" (by copying to overlay ram first) to install tables to speed up the rendering.
Then I added a more appropriate font.
And finally I experimented with an intro sequence.
All that is still very much work in progress.
So ISS provided me with a DSK version of the game, which allowed me to do some horrible horrible things such as "patching the ROM" (by copying to overlay ram first) to install tables to speed up the rendering.
Then I added a more appropriate font.
And finally I experimented with an intro sequence.
All that is still very much work in progress.
Re: Improved "The Hobbit"
Brilliant! This will be not just a "face-lift" but whole new experience. Thanks for working on it!
Re: Improved "The Hobbit"
This is epic, Dbug!!!!
- HigashiJun
- Flying Officer
- Posts: 205
- Joined: Tue Dec 10, 2019 9:29 am
- Location: Tokyo (Japan)
Re: Improved "The Hobbit"
It looks fantastic! Well done!
Re: Improved "The Hobbit"
One issue, I realized, is that the original game allowed you to save and load the adventure, will have to see if I can somewhat get that working of the floppy.
- Silicebit.
- Flight Lieutenant
- Posts: 313
- Joined: Thu Jan 12, 2006 10:18 pm
- Location: Madrid, Spain
- Contact:
Re: Improved "The Hobbit"
Wow, great Dbug!
Maybe you should patch save and load routines to work on floppy. A few remarks about this here: https://forum.defence-force.org/viewtop ... =20&t=1225
Oric user since 1984. YouTube
Re: Improved "The Hobbit"
Damn, totally forgot we already discussed thatSilicebit. wrote: ↑Wed Mar 02, 2022 6:18 pm Wow, great Dbug!
Maybe you should patch save and load routines to work on floppy. A few remarks about this here: https://forum.defence-force.org/viewtop ... =20&t=1225
I wonder how difficult it would be to get a "range breakpoint" in Oricutron, like instead of just "break if reaching $xxxx" instead have "break if any access is done between $xxxx and $yyyy", would make it possible to find any access to the ROM (possibly have an option to only enable that when not called from an IRQ, to avoid breaking on every single system IRQ code)
- Silicebit.
- Flight Lieutenant
- Posts: 313
- Joined: Thu Jan 12, 2006 10:18 pm
- Location: Madrid, Spain
- Contact:
Re: Improved "The Hobbit"
In a quick glance i seen this for the save command, i hope this help you.
727C JSR $040E
....
....
040E JMP $E65E <---- OUTPUT BYTE TO CASSETTE
727C JSR $040E
....
....
040E JMP $E65E <---- OUTPUT BYTE TO CASSETTE
Oric user since 1984. YouTube
- Silicebit.
- Flight Lieutenant
- Posts: 313
- Joined: Thu Jan 12, 2006 10:18 pm
- Location: Madrid, Spain
- Contact:
Re: Improved "The Hobbit"
A few interesting lines of code about The Hobbit.
Code: Select all
]; 0400 4C 7C 04 JMP $047C
]; 0403 78 SEI
]; 0404 FC ???
]; 0405 4C 35 E7 JMP SyncTape
]; 0408 4C C9 E6 JMP GetTapeByte
]; 040B 4C 5A E7 JMP WriteLeader
]; 040E 4C 5E E6 JMP PutTapeByte
]; 0411 4C 6A E7 JMP SetupTape
]; 0414 4C AA F9 JMP ResetVIA
]; 0417 20 11 04 JSR $0411
]; 041A 20 05 04 JSR $0405
]; 041D 20 08 04 JSR $0408
]; 0420 C9 24 CMP #$24
]; 0422 D0 F9 BNE $041D
]; 0424 A0 09 LDY #$09
]; 0426 20 08 04 JSR $0408
]; 0429 99 35 00 STA $0035,Y
]; 042C 88 DEY
]; 042D D0 F7 BNE $0426
Oric user since 1984. YouTube
Re: Improved "The Hobbit"
Interesting, looks like the JMP at the top are patched to other values for ROM 1.0 or 1.1.
In your disassembly you have:
in mine I have:
Looks like you have the Oric Atmos addresses and me the Oric 1 ones.
After that the code is classic:
- Setup Tape
- Sync
- Read bytes (the $16 $16 ...) until we get a $24
- Read 9 bytes and store them in $35-$35-9
As far as I can see, $35 is a safe area which is for both ROM 1.0 and 1.1 used for buffers:
In your disassembly you have:
Code: Select all
]; 0405 4C 35 E7 JMP SyncTape
]; 0408 4C C9 E6 JMP GetTapeByte
]; 040B 4C 5A E7 JMP WriteLeader
]; 040E 4C 5E E6 JMP PutTapeByte
]; 0411 4C 6A E7 JMP SetupTape
]; 0414 4C AA F9 JMP ResetVIA
Code: Select all
0405 4C 96 E6 JMP $E696
0408 4C 30 E6 JMP $E630
040B 4C BA E6 JMP $E6BA
040E 4C C6 E5 JMP $E5C6
0411 4C CA E6 JMP $E6CA
0414 4C 60 F9 JMP $F960
After that the code is classic:
- Setup Tape
- Sync
- Read bytes (the $16 $16 ...) until we get a $24
- Read 9 bytes and store them in $35-$35-9
As far as I can see, $35 is a safe area which is for both ROM 1.0 and 1.1 used for buffers:
Code: Select all
$35-$84 Input buffer. (79 bytes)
$35-$48 Name of program required for CLOAD (V1.0 only).
$49-$5D Name of program just loaded (V1.0 only).
$5F,$60 Start address of data to/from tape (V1.0 only).
$61,$62 End address of data to/from tape (V1.0 only).
$63 1 when using AUTO else 0 (V1.0 only).
$64 0 for Basic, 1 for machine code (Vl.0 only).
$67 Tape speed - 0 fast, 1 slow (Vl.0 only).
Re: Improved "The Hobbit"
So I dug a bit more, the saving code is around $72xx, and as far as I can see there is a checksum system.
So with a bit of commenting, we get these two routines:
The saving routine
The loading code:
So with a bit of commenting, we get these two routines:
The saving routine
Code: Select all
SaveGame
7245 20 11 04 JSR _ROMSetupTape ; $0411
7248 20 0B 04 JSR _ROM_WriteLeader ; 040B
724B A0 09 LDY #$09
loop_write_9_bytes
724D B9 36 00 LDA $0036,Y
7250 20 0E 04 JSR _ROM_PutTapeByte ; $040E
7253 88 DEY
7254 10 F7 BPL loop_write_9_bytes ; $724D
write_zero
7256 A9 00 LDA #$00
7258 20 0E 04 JSR _ROM_PutTapeByte ; $040E
725B A0 00 LDY #$00
725D 84 3B STY $3B
loop_write_data
725F B1 37 LDA ($37),Y
7261 20 0E 04 JSR _ROM_PutTapeByte ; $040E
7264 B1 37 LDA ($37),Y
7266 45 3B EOR $3B
7268 85 3B STA $3B
726A E6 37 INC $37
726C D0 02 BNE $7270
726E E6 38 INC $38
7270 A5 37 LDA $37
7272 C5 39 CMP $39
7274 A5 38 LDA $38
7276 E5 3A SBC $3A
7278 90 E5 BCC loop_write_data ; $725F
write_checksum
727A A5 3B LDA $3B
727C 20 0E 04 JSR _ROM_PutTapeByte ; $040E
delay
727F A2 40 LDX #$40
7281 A0 00 LDY #$00
delay_loop
7283 88 DEY
7284 D0 FD BNE delay_loop ; $7283
7286 CA DEX
7287 D0 FA BNE delay_loop ; $7283
7289 20 14 04 JSR _ROM_ResetVIA ; $0414
728C A5 6C LDA $6C
728E 8D 4D 02 STA $024D
7291 18 CLC
7292 60 RTS
Code: Select all
LoadGame
0417 20 11 04 JSR _ROMSetupTape ; $0411
041A 20 05 04 JSR _ROMSyncTape ; $0405
loop_read_sync
041D 20 08 04 JSR _ROM_GetTapeByte ; $0408
0420 C9 24 CMP #$24
0422 D0 F9 BNE loop_read_sync ; $041D
0424 A0 09 LDY #$09
loop_read_9_bytes
0426 20 08 04 JSR _ROM_GetTapeByte ; $0408
0429 99 35 00 STA $0035,Y
042C 88 DEY
042D D0 F7 BNE loop_read_9_bytes ; $0426
loop_wait_for_zero
042F 20 08 04 JSR _ROM_GetTapeByte ; $0408
0432 D0 FB BNE loop_wait_for_zero ;$042F
0434 A8 TAY
0435 85 3B STA $3B
0437 A5 37 LDA $37
0439 85 32 STA $32
043B A5 38 LDA $38
043D 85 33 STA $33
043F 20 08 04 JSR _ROM_GetTapeByte ; $0408
0442 B0 22 BCS return_carry_set ; $0466
0444 91 37 STA ($37),Y
0446 45 3B EOR $3B
0448 85 3B STA $3B
044A E6 37 INC $37
044C D0 02 BNE $0450
044E E6 38 INC $38
0450 A5 37 LDA $37
0452 C5 39 CMP $39
0454 A5 38 LDA $38
0456 E5 3A SBC $3A
0458 90 E5 BCC $043F
read_checksum
045A 20 08 04 JSR _ROM_GetTapeByte ; $0408
045D C5 3B CMP $3B
045F D0 05 BNE return_carry_set ; $0466
0461 20 14 04 JSR _ROM_ResetVIA ; $0414
return_carry_clear
0464 18 CLC ; OK
0465 60 RTS
return_carry_set
0466 38 SEC ; Error
0467 60 RTS
- Silicebit.
- Flight Lieutenant
- Posts: 313
- Joined: Thu Jan 12, 2006 10:18 pm
- Location: Madrid, Spain
- Contact:
Re: Improved "The Hobbit"
Well, "The Hobbit" on tape has a loader, this is the first part to load and loads from $0400 to $0501. Once it runs, it checks whether it is on an Oric-1 or an Atmos. By default, the jump table to the save and load routines points to the Oric-1 ROM, but if the loader detects that it is on an Atmos, then it changes the jump table. That part of the code is also used by the main program for the Load and Save commands.
Here the loader before and after it run.
Here the loader before and after it run.
Code: Select all
; *********************
; * *
; * The Hobbit loader *
; * before it run *
; * *
; *********************
;
]; 0400 4C 7C 04 JMP $047C
]; 0403 70 FC BVS $0401
]; 0405 4C 96 E6 JMP $E696
]; 0408 4C 30 E6 JMP $E630
]; 040B 4C BA E6 JMP $E6BA
]; 040E 4C C6 E5 JMP $E5C6
]; 0411 4C CA E6 JMP $E6CA
]; 0414 4C 60 F9 JMP $F960
]; 0417 20 11 04 JSR $0411
]; 041A 20 05 04 JSR $0405
]; 041D 20 08 04 JSR $0408
]; 0420 C9 24 CMP #$24
]; 0422 D0 F9 BNE $041D
]; 0424 A0 09 LDY #$09
]; 0426 20 08 04 JSR $0408
]; 0429 99 35 00 STA $0035,Y
]; 042C 88 DEY
]; 042D D0 F7 BNE $0426
]; 042F 20 08 04 JSR $0408
]; 0432 D0 FB BNE $042F
]; 0434 A8 TAY
]; 0435 85 3B STA $3B
]; 0437 A5 37 LDA $37
]; 0439 85 32 STA $32
]; 043B A5 38 LDA $38
]; 043D 85 33 STA $33
]; 043F 20 08 04 JSR $0408
]; 0442 B0 22 BCS $0466
]; 0444 91 37 STA ($37),Y
]; 0446 45 3B EOR $3B
]; 0448 85 3B STA $3B
]; 044A E6 37 INC $37
]; 044C D0 02 BNE $0450
]; 044E E6 38 INC $38
]; 0450 A5 37 LDA $37
]; 0452 C5 39 CMP $39
]; 0454 A5 38 LDA $38
]; 0456 E5 3A SBC $3A
]; 0458 90 E5 BCC $043F
]; 045A 20 08 04 JSR $0408
]; 045D C5 3B CMP $3B
]; 045F D0 05 BNE $0466
]; 0461 20 14 04 JSR $0414
]; 0464 18 CLC
]; 0465 60 RTS
]; 0466 38 SEC
]; 0467 60 RTS
]; 0468 78 SEI
]; 0469 FC ???
]; 046A 4C 35 E7 JMP SyncTape (Atmos)
]; 046D 4C C9 E6 JMP GetTapeByte (Atmos)
]; 0470 4C 5A E7 JMP WriteLeader (Atmos)
]; 0473 4C 5E E6 JMP PutTapeByte (Atmos)
]; 0476 4C 6A E7 JMP SetupTape (Atmos)
]; 0479 4C AA F9 JMP ResetVIA (Atmos)
]; 047C 78 SEI
]; 047D A9 7F LDA #$7F
]; 047F 8D 0E 03 STA VIA_IER
]; 0482 AD 78 FC LDA CharSet ; Check if it is on Oric-1 or Atmos
]; 0485 D0 10 BNE $0497 ; If is an Oric-1 nothing is changed
]; 0487 A9 7C LDA #$7C
]; 0489 8D 9A 04 STA $049A
]; 048C A0 14 LDY #$14
]; 048E B9 67 04 LDA $0467,Y
]; 0491 99 02 04 STA $0402,Y
]; 0494 88 DEY
]; 0495 D0 F7 BNE $048E
]; 0497 A2 0C LDX #$0C
]; 0499 20 3C F7 JSR $F73C
]; 049C A0 00 LDY #$00
]; 049E 8C A3 BB STY $BBA3
]; 04A1 8C AA BB STY $BBAA
]; 04A4 A0 21 LDY #$21
]; 04A6 B9 CC 04 LDA $04CC,Y
]; 04A9 99 4B BC STA $BC4B,Y
]; 04AC 88 DEY
]; 04AD 10 F7 BPL $04A6
]; 04AF A2 03 LDX #$03 ; Number of parts to load "3"
]; 04B1 86 40 STX $40
]; 04B3 20 17 04 JSR $0417
]; 04B6 B0 07 BCS $04BF
]; 04B8 C6 40 DEC $40
]; 04BA D0 F7 BNE $04B3
]; 04BC 6C 32 00 JMP ($0032)
]; 04BF A0 0A LDY #$0A
]; 04C1 B9 EE 04 LDA $04EE,Y
]; 04C4 99 19 BD STA $BD19,Y
]; 04C7 88 DEY
]; 04C8 10 F7 BPL $04C1
]; 04CA 30 FE BMI $04CA
]; 04CC 50 6C BVC $053A
]; 04CE 65 61 ADC $61
]; 04D0 73 65 RRA ($65),Y
]; 04D2 20 77 61 JSR $6177
]; 04D5 69 74 ADC #$74
]; 04D7 20 77 68 JSR $6877
]; 04DA 69 6C ADC #$6C
]; 04DC 65 20 ADC $20
]; 04DE 54 48 DOP $48,X
]; 04E0 45 20 EOR $20
]; 04E2 48 PHA
]; 04E3 4F 42 42 SRE $4242
]; 04E6 49 54 EOR #$54
]; 04E8 20 6C 6F JSR $6F6C
]; 04EB 61 64 ADC ($64,X)
]; 04ED 73 0C RRA ($0C),Y
]; 04EF 54 41 DOP $41,X
]; 04F1 50 45 BVC $0538
]; 04F3 20 45 52 JSR $5245
]; 04F6 52 JAM
]; 04F7 4F 52 SRE $4C52
]; 04F9 4C AA F9 JMP ResetVIA
]; 04FC 78 SEI
]; 04FD A9 7F LDA #$7F
]; 04FF 8D 67 00 STA $0067
Code: Select all
; *********************
; * *
; * The Hobbit loader *
; * after it run on *
; * Atmos *
; * *
; *********************
;
]; 0400 4C 7C 04 JMP $047C
]; 0403 78 SEI
]; 0404 FC ???
]; 0405 4C 35 E7 JMP SyncTape
]; 0408 4C C9 E6 JMP GetTapeByte
]; 040B 4C 5A E7 JMP WriteLeader
]; 040E 4C 5E E6 JMP PutTapeByte
]; 0411 4C 6A E7 JMP SetupTape
]; 0414 4C AA F9 JMP ResetVIA
]; 0417 20 11 04 JSR $0411
]; 041A 20 05 04 JSR $0405
]; 041D 20 08 04 JSR $0408
]; 0420 C9 24 CMP #$24
]; 0422 D0 F9 BNE $041D
]; 0424 A0 09 LDY #$09
]; 0426 20 08 04 JSR $0408
]; 0429 99 35 00 STA $0035,Y
]; 042C 88 DEY
]; 042D D0 F7 BNE $0426
]; 042F 20 08 04 JSR $0408
]; 0432 D0 FB BNE $042F
]; 0434 A8 TAY
]; 0435 85 3B STA $3B
]; 0437 A5 37 LDA $37
]; 0439 85 32 STA $32
]; 043B A5 38 LDA $38
]; 043D 85 33 STA $33
]; 043F 20 08 04 JSR $0408
]; 0442 B0 22 BCS $0466
]; 0444 91 37 STA ($37),Y
]; 0446 45 3B EOR $3B
]; 0448 85 3B STA $3B
]; 044A E6 37 INC $37
]; 044C D0 02 BNE $0450
]; 044E E6 38 INC $38
]; 0450 A5 37 LDA $37
]; 0452 C5 39 CMP $39
]; 0454 A5 38 LDA $38
]; 0456 E5 3A SBC $3A
]; 0458 90 E5 BCC $043F
]; 045A 20 08 04 JSR $0408
]; 045D C5 3B CMP $3B
]; 045F D0 05 BNE $0466
]; 0461 20 14 04 JSR $0414
]; 0464 18 CLC
]; 0465 60 RTS
]; 0466 38 SEC
]; 0467 60 RTS
]; 0468 78 SEI
]; 0469 FC ???
]; 046A 4C 35 E7 JMP SyncTape
]; 046D 4C C9 E6 JMP GetTapeByte
]; 0470 4C 5A E7 JMP WriteLeader
]; 0473 4C 5E E6 JMP PutTapeByte
]; 0476 4C 6A E7 JMP SetupTape
]; 0479 4C AA F9 JMP ResetVIA
]; 047C 78 SEI
]; 047D A9 7F LDA #$7F
]; 047F 8D 0E 03 STA VIA_IER
]; 0482 AD 78 FC LDA CharSet
]; 0485 D0 10 BNE $0497
]; 0487 A9 7C LDA #$7C
]; 0489 8D 9A 04 STA $049A
]; 048C A0 14 LDY #$14
]; 048E B9 67 04 LDA $0467,Y
]; 0491 99 02 04 STA $0402,Y
]; 0494 88 DEY
]; 0495 D0 F7 BNE $048E
]; 0497 A2 0C LDX #$0C
]; 0499 20 7C F7 JSR Char2Scr
]; 049C A0 00 LDY #$00
]; 049E 8C A3 BB STY $BBA3
]; 04A1 8C AA BB STY $BBAA
]; 04A4 A0 21 LDY #$21
]; 04A6 B9 CC 04 LDA $04CC,Y
]; 04A9 99 4B BC STA $BC4B,Y
]; 04AC 88 DEY
]; 04AD 10 F7 BPL $04A6
]; 04AF A2 03 LDX #$03
]; 04B1 86 40 STX $40
]; 04B3 20 17 04 JSR $0417
]; 04B6 B0 07 BCS $04BF
]; 04B8 C6 40 DEC $40
]; 04BA D0 F7 BNE $04B3
]; 04BC 6C 32 00 JMP ($0032)
]; 04BF A0 0A LDY #$0A
]; 04C1 B9 EE 04 LDA $04EE,Y
]; 04C4 99 19 BD STA $BD19,Y
]; 04C7 88 DEY
]; 04C8 10 F7 BPL $04C1
]; 04CA 30 FE BMI $04CA
]; 04CC 50 6C BVC $053A
]; 04CE 65 61 ADC $61
]; 04D0 73 65 RRA ($65),Y
]; 04D2 20 77 61 JSR $6177
]; 04D5 69 74 ADC #$74
]; 04D7 20 77 68 JSR $6877
]; 04DA 69 6C ADC #$6C
]; 04DC 65 20 ADC $20
]; 04DE 54 48 DOP $48,X
]; 04E0 45 20 EOR $20
]; 04E2 48 PHA
]; 04E3 4F 42 42 SRE $4242
]; 04E6 49 54 EOR #$54
]; 04E8 20 6C 6F JSR $6F6C
]; 04EB 61 64 ADC ($64,X)
]; 04ED 73 0C RRA ($0C),Y
]; 04EF 54 41 DOP $41,X
]; 04F1 50 45 BVC $0538
]; 04F3 20 45 52 JSR $5245
]; 04F6 52 JAM
]; 04F7 4F 52 SRE $4C52
]; 04F9 4C AA F9 JMP ResetVIA
]; 04FC 78 SEI
]; 04FD A9 7F LDA #$7F
]; 04FF 8D 67 00 STA $0067
Oric user since 1984. YouTube
- Silicebit.
- Flight Lieutenant
- Posts: 313
- Joined: Thu Jan 12, 2006 10:18 pm
- Location: Madrid, Spain
- Contact:
Re: Improved "The Hobbit"
More stuff. Jumps from the main program to the hosted table from $0405 to $0414.
I hope this can help.
Code: Select all
7302 JSR $0405 SyncTape
91EC JSR $0405 SyncTape
7305 JSR $0408 GetTapeByte
730E JSR $0408 "
7317 JSR $0408 "
7328 JSR $0408 "
7345 JSR $0408 "
91EF JSR $0408 "
91F8 JSR $0408 "
9201 JSR $0408 "
9211 JSR $0408 "
922C JSR $0408 GetTapeByte
7248 JSR $040B WriteLeader
7250 JSR $040E PutTapeByte
7258 JSR $040E "
7261 JSR $040E "
727C JSR $040E PutTapeByte
7245 JSR $0411 SetupTape
72FF JSR $0411 SetupTape
91E9 JSR $0411 SetupTape
7289 JSR $0414 ResetVIA
734C JSR $0414 ResetVIA
9233 JSR $0414 ResetVIA
Oric user since 1984. YouTube
Re: Improved "The Hobbit"
As far as I can see, the code is saving data in multiple blocks.
- from 00BE to 00D6 - 24
- from 1B1A to 2070 - 1366
- from 28CC to 2BBD - 753
- from 211A to 26E2 - 1480
-------------------------- = 3623 bytes
- from 00BE to 00D6 - 24
- from 1B1A to 2070 - 1366
- from 28CC to 2BBD - 753
- from 211A to 26E2 - 1480
-------------------------- = 3623 bytes