• R/O
  • SSH
  • HTTPS

oricsdk: 提交


Commit MetaInfo

修訂1580 (tree)
時間2022-03-29 02:07:03
作者dbug

Log Message

The Hobbit Improved - Version 1.7
- Added the possibility to toggle the new Font off and on.
- Replaced some hardcoded hex values by some definitions in common.h
- The version number is now clearly indicated on the title page

Change Summary

差異

--- users/dbug/UpgradeTime/TheHobbit/common.h (revision 1579)
+++ users/dbug/UpgradeTime/TheHobbit/common.h (revision 1580)
@@ -14,8 +14,18 @@
1414 ;
1515 #define BASIC_KEY $2df ; Latest key from keyboard, bit 7 set if valid
1616
17+#define BASIC_FOR $C855 ; Location of the FOR instruction in ROM (overwritten by _Div6 and _Mod6)
18+#define BASIC_CIRCLE $F37F ; Location of the CIRCLE instruction in ROM (overwritten by _HiresAddrLow and _HiresAddrHigh)
19+
1720 ;
1821 ; Communication between the intro and the game passes through the very last bytes of RAM before the ROM
1922 ;
23+#define FlagCharsetStyle $bffd ; If zero, will use the original charset of the game (the one in the Oric ROM)
2024 #define FlagPlayImproved $bffe ; If zero, will play the non modified original version
2125 #define FlagPlayMusic $bfff ; If zero, will not have any sound or music (only impact the intros so far)
26+
27+;
28+; The Hobbit memory locations of interest
29+;
30+#define Hobbit_ComputeScreenAddress $7A22
31+
--- users/dbug/UpgradeTime/TheHobbit/intro.s (revision 1579)
+++ users/dbug/UpgradeTime/TheHobbit/intro.s (revision 1580)
@@ -55,8 +55,12 @@
5555 lda #MessageImproved-MessageOriginal
5656 sta FlagPlayImproved
5757
58+ lda #MessageCharsetModified-MessageCharsetOriginal
59+ sta FlagCharsetStyle
60+
5861 jsr StartMusic
5962 jsr SwitchToHires
63+ jsr MakeRomFontCopy
6064
6165 jsr PrintMessages
6266
@@ -153,6 +157,19 @@
153157 .)
154158
155159 .(
160+ ; Patch the message to indicate the select character set
161+ ldy FlagCharsetStyle
162+ ldx #0
163+loop
164+ lda MessageCharsetOriginal,y
165+ sta MessageCharsetOldNew,x
166+ iny
167+ inx
168+ cpx #MessageCharsetModified-MessageCharsetOriginal
169+ bne loop
170+ .)
171+
172+ .(
156173 ; Display the options text
157174 ldx #MessageOptionsEnd-MessageOptions
158175 loop
@@ -163,11 +180,21 @@
163180 .)
164181
165182 .(
183+ ; Display the second set of options
184+ ldx #MessageOptionsCharsetEnd-MessageOptionsCharset
185+loop
186+ lda MessageOptionsCharset-1,x
187+ sta $bb80+40*27+0-1,x
188+ dex
189+ bne loop
190+ .)
191+
192+ .(
166193 ; Display the blinking "press space to play"
167194 ldx #MessagePressEnd-MessagePressPlay
168195 loop
169196 lda MessagePressPlay-1,x
170- sta $bb80+40*27+8-1,x
197+ sta $bb80+40*25+8-1,x
171198 dex
172199 bne loop
173200 .)
@@ -188,6 +215,17 @@
188215 MessageOriginal .byt 1,"Original",3
189216 MessageImproved .byt 2,"Improved",3
190217
218+MessageOptionsCharset
219+ .byt 3,"[C] Use the"
220+MessageCharsetOldNew
221+ .byt " Modified Character set"
222+ .byt 4,"v1.7"
223+MessageOptionsCharsetEnd
224+
225+MessageCharsetOriginal .byt 1,"Original",3
226+MessageCharsetModified .byt 2,"Medieval",3
227+
228+
191229 MessagePressPlay
192230 .byt 12,4,"Press [SPACE] to play" ; Blue blinking text
193231 MessagePressEnd
@@ -227,6 +265,15 @@
227265 jmp continue
228266 skip_version_toggle
229267
268+ cmp #"C"+128 ; "C" to toggle between original and modified character sets
269+ bne skip_charset_toggle
270+ lda FlagCharsetStyle
271+ eor #MessageCharsetModified-MessageCharsetOriginal ; Lenght of the Original/Modified message
272+ sta FlagCharsetStyle
273+ jsr SwapHiresFont
274+ jmp continue
275+skip_charset_toggle
276+
230277 ; Entual other options
231278 jmp continue
232279
@@ -295,16 +342,64 @@
295342 rts
296343 .)
297344
345+MakeRomFontCopy
346+.(
347+ ; ROM Font is stored from $FC78 to $FF77 = 768 bytes = 3*256
348+ ; We recopy whatever is in the original RAM version of from (from $B400 to $B7FF) to the ROM area.
349+ ; The first 32 characters are skipped because they are not actually displayable.
350+ ldx #0
351+loop_copy_font
352+ lda $FC78+256*0,x
353+ sta _ExtraFontCopy+8*32+256*0,x
354+ lda $FC78+256*1,x
355+ sta _ExtraFontCopy+8*32+256*1,x
356+ lda $FC78+256*2,x
357+ sta _ExtraFontCopy+8*32+256*2,x
358+ dex
359+ bne loop_copy_font
360+ rts
361+.)
298362
363+SwapHiresFont
364+.(
365+ ldx #0
366+loop_copy_font
367+ lda $9800+8*32+256*0,x
368+ ldy _ExtraFontCopy+8*32+256*0,x
369+ sta _ExtraFontCopy+8*32+256*0,x
370+ tya
371+ sta $9800+8*32+256*0,x
372+
373+ lda $9800+8*32+256*1,x
374+ ldy _ExtraFontCopy+8*32+256*1,x
375+ sta _ExtraFontCopy+8*32+256*1,x
376+ tya
377+ sta $9800+8*32+256*1,x
378+
379+ lda $9800+8*32+256*2,x
380+ ldy _ExtraFontCopy+8*32+256*2,x
381+ sta _ExtraFontCopy+8*32+256*2,x
382+ tya
383+ sta $9800+8*32+256*2,x
384+
385+ dex
386+ bne loop_copy_font
387+ rts
388+ rts
389+.)
390+
391+
299392 ClearVideo
300393 .(
301394 ; Clean the entire screen area from $A000 to $BFFF with zeroes (BLACK INK attribute)
302395 sei
303396
304- lda FlagPlayImproved
397+ lda FlagPlayImproved ; Temporarily save the flags at the end of the memory because they are going to be wiped out
305398 pha
306- lda FlagPlayMusic ; Temporarily save the flags at the end of the memory because they are going to be wiped out
399+ lda FlagPlayMusic
307400 pha
401+ lda FlagCharsetStyle
402+ pha
308403
309404 lda #<$a000
310405 sta tmp0+0
@@ -325,6 +420,8 @@
325420 bne next_page
326421
327422 pla
423+ sta FlagCharsetStyle
424+ pla
328425 sta FlagPlayMusic
329426 pla
330427 sta FlagPlayImproved
@@ -1419,6 +1516,8 @@
14191516 _EmptySourceScanLine .dsb 256 ; Only zeroes, can be used for special effects
14201517 _EmptyDestinationScanLine .dsb 256 ; Only zeroes, can be used for special effects
14211518
1519+_ExtraFontCopy .dsb 768 ; Used to do the fancy font swap
1520+
14221521 ; Just so log code to check how large this patch data has become
14231522 _End
14241523 #echo Intro size:
--- users/dbug/UpgradeTime/TheHobbit/patch.s (revision 1579)
+++ users/dbug/UpgradeTime/TheHobbit/patch.s (revision 1580)
@@ -15,6 +15,7 @@
1515 ; Added a menu to toggle the sound ON/OFF
1616 ; Added a menu to allow the player to start the original version of the game
1717 ; Fixed the brief flash of white corruption appearing when the game starts by clearing the entire video memory area
18+; - 1.7 - 2022-03-28 [Dbug] Added a menu option to allow switching between the original and custom fonts
1819 ;
1920 ; TODO list:
2021 ; - Modify the SAVE and LOAD code to use the floppy disk instead of tape
@@ -41,14 +42,6 @@
4142 *= $924E
4243
4344 StartPatch
44- ; Check the top of memory flags to see if the user wants to install the improved edition patch
45- lda FlagPlayImproved
46- bne install_patch
47- ; Looks like the user wants to try the original unmodified game!
48- jmp start_game
49-
50-install_patch
51-;pause jmp pause ; Uncomment to stop auto-running
5245 sei ; We need to disable the IRQ at least during the ROM to RAM copy
5346
5447 copy_rom_to_ram
@@ -84,8 +77,32 @@
8477 inc tmp0+1
8578 bne loop_external
8679 .)
87-
8880
81+copy_ram_font_to_rom
82+ .(
83+ ; ROM Font is stored from $FC78 to $FF77 = 768 bytes = 3*256
84+ ; We recopy whatever is in the original RAM version of from (from $B400 to $B7FF) to the ROM area.
85+ ; The first 32 characters are skipped because they are not actually displayable.
86+ ldx #0
87+loop_patch
88+ lda $B400+8*32+256*0,x
89+ sta $fc78+256*0-8,x
90+ lda $B400+8*32+256*1,x
91+ sta $fc78+256*1-8,x
92+ lda $B400+8*32+256*2,x
93+ sta $fc78+256*2-8,x
94+ dex
95+ bne loop_patch
96+ .)
97+
98+ ; Check the top of memory flags to see if the user wants to install the improved edition patch
99+ lda FlagPlayImproved
100+ bne install_patch
101+ ; Looks like the user wants to try the original unmodified game!
102+ jmp start_game
103+
104+install_patch
105+
89106 generate_tables
90107 .(
91108 ; Generate the scanline table
@@ -138,28 +155,11 @@
138155 ldx #SizeComputeScreenAddress
139156 loop_patch
140157 lda ComputeScreenAddress-1,x
141- sta $7A22-1,x
158+ sta Hobbit_ComputeScreenAddress-1,x
142159 dex
143160 bne loop_patch
144161 .)
145162
146-copy_ram_font_to_rom
147- .(
148- ; ROM Font is stored from $FC78 to $FF77 = 768 bytes = 3*256
149- ; We recopy whatever is in the original RAM version of from (from $B400 to $B7FF) to the ROM area.
150- ; The first 32 characters are skipped because they are not actually displayable.
151- ldx #0
152-loop_patch
153- lda $B400+8*32+256*0,x
154- sta $fc78+256*0-8,x
155- lda $B400+8*32+256*1,x
156- sta $fc78+256*1-8,x
157- lda $B400+8*32+256*2,x
158- sta $fc78+256*2-8,x
159- dex
160- bne loop_patch
161- .)
162-
163163 clear_video
164164 .(
165165 ; Clean the entire screen area from $A000 to $BFFF with zeroes (BLACK INK attribute) to avoid the nasty white garbage flash on startup
@@ -188,7 +188,7 @@
188188
189189 ComputeScreenAddress
190190 .(
191- * = $7A22 ; This routine is assembled at a different address than the rest of the program
191+ * = Hobbit_ComputeScreenAddress ; This routine is assembled at a different address than the rest of the program
192192 begin
193193 ; Mul 40
194194 ldx $31
@@ -212,7 +212,7 @@
212212
213213
214214 ; And some final information string, so we can easily find which version people are swapping around
215- .byt "Improved Hobbit v1.6 - Please report any issue to dbug@defence-force.org"
215+ .byt "Improved Hobbit v1.7 - Please report any issue to dbug@defence-force.org"
216216
217217 ; Just so log code to check how large this patch data has become
218218 EndPatch
@@ -221,11 +221,11 @@
221221
222222 .bss
223223
224- *= $C855 ; Erase the FOR command
224+ *= BASIC_FOR ; Erase the FOR command
225225 _Div6 .dsb 256 ; Values divided by 6
226226 _Mod6 .dsb 256 ; Values modulo 6
227227
228- *= $F37F ; Erase the CIRCLE command
228+ *= BASIC_CIRCLE ; Erase the CIRCLE command
229229 _HiresAddrLow .dsb 128 ; Values multiplied by 40 + a000
230230 _HiresAddrHigh .dsb 128 ; Values multiplied by 40 + a000
231231
Show on old repository browser