dos33fsprogs/games/tfv
2023-05-13 00:52:17 -04:00
..
graphics_battle tfv: rotate into battle! 2021-01-19 13:51:00 -05:00
graphics_credits tfv: add in credits 2021-01-14 01:28:18 -05:00
graphics_map fix some more miscompiles 2021-01-05 23:59:08 -05:00
graphics_title tfv: get the "story" sort of working 2021-02-03 00:50:16 -05:00
music double: update music 2023-05-13 00:52:17 -04:00
battle_sprites.inc tfv: let you select target of attacks 2021-01-17 20:11:21 -05:00
c00_scrn_offsets.s tfv: rotozoom into battle 2021-01-19 11:02:56 -05:00
common_defines.inc
credits_sprites.inc tfv: add in credits 2021-01-14 01:28:18 -05:00
credits.s tfv: fix missing parts of build 2021-01-20 16:34:58 -05:00
decompress_fast_v2.s
delay_a.s tfv: add in credits 2021-01-14 01:28:18 -05:00
draw_menu.s
flying_mode7.s
flying_sprites.inc
gr_copy.s
gr_fast_clear.s
gr_hlin.s tfv: initial inventory/info screen 2021-02-10 13:16:52 -05:00
gr_hline.s tfv: add in credits 2021-01-14 01:28:18 -05:00
gr_offsets.s
gr_pageflip.s
gr_put_num.s tfv: add sprite color mask support 2021-01-18 14:00:30 -05:00
gr_putsprite_crop.s tfv: more work on battle 2021-01-11 15:20:43 -05:00
gr_putsprite_mask.s tfv: add sprite color mask support 2021-01-18 14:00:30 -05:00
gr_putsprite.s
gr_vlin.s
hardware.inc
hello.bas tfv: bump to version 007 2021-02-11 23:55:16 -05:00
help_flying.s
help_overworld.s
init_vars.s tfv: wasn't initing some vars properly 2021-01-19 14:44:35 -05:00
interrupt_handler.s tfv: play music during battle 2021-01-19 14:39:37 -05:00
joystick.s
keyboard.s fix some more miscompiles 2021-01-05 23:59:08 -05:00
load_game.s tfv: get info screen printing actual data 2021-02-11 23:54:45 -05:00
loader.s tfv: add story graphics 2021-01-29 00:00:53 -05:00
long_wait.s tfv: split off hero drawing code 2021-01-17 16:12:06 -05:00
Makefile tfv: initial inventory/info screen 2021-02-10 13:16:52 -05:00
mockingboard.s tfv: add in credits 2021-01-14 01:28:18 -05:00
move_letters.s tfv: add in credits 2021-01-14 01:28:18 -05:00
multiply_fast.s tfv: get rotate always working 2021-01-19 12:20:53 -05:00
NOTES
play_music.s tfv: also play victory music 2021-01-19 16:27:24 -05:00
pt3_lib_core.s tfv: play music during battle 2021-01-19 14:39:37 -05:00
pt3_lib_init.s tfv: play music during battle 2021-01-19 14:39:37 -05:00
pt3_lib_irq_handler.s tfv: play music during battle 2021-01-19 14:39:37 -05:00
pt3_lib_mockingboard_detect.s tfv: play music during battle 2021-01-19 14:39:37 -05:00
pt3_lib_mockingboard_setup.s tfv: play music during battle 2021-01-19 14:39:37 -05:00
README tfv: also play victory music 2021-01-19 16:27:24 -05:00
rotate_intro.s tfv: get rotate always working 2021-01-19 12:20:53 -05:00
rotozoom.s tfv: update rotozoom code to newest 2021-01-20 16:41:19 -05:00
select_item.s made an attempt to check in all missing files 2021-01-05 23:30:41 -05:00
sound_effects.s tfv: split off hero drawing code 2021-01-17 16:12:06 -05:00
speaker_tone.s tfv: split off menu from battle code 2021-01-17 13:54:29 -05:00
text_print.s tfv: battle: menus almost in place 2021-01-12 00:44:03 -05:00
tfv_battle_attack.s tfv: optimize attack a bit 2021-01-18 15:35:12 -05:00
tfv_battle_boss.s tfv: split off summons 2021-01-17 15:22:30 -05:00
tfv_battle_draw_hero.s tfv: get info screen printing actual data 2021-02-11 23:54:45 -05:00
tfv_battle_enemy.s tfv: work on name entry 2021-01-20 16:36:26 -05:00
tfv_battle_limit.s tfv: update limits 2021-01-18 20:36:05 -05:00
tfv_battle_magic.s tfv: magic: put sword away when casting magic 2021-01-18 23:45:47 -05:00
tfv_battle_menu.s tfv: get info screen printing actual data 2021-02-11 23:54:45 -05:00
tfv_battle_summons.s tfv: summons now cost MP 2021-01-18 16:06:54 -05:00
tfv_battle.s tfv: get info screen printing actual data 2021-02-11 23:54:45 -05:00
tfv_drawmap.s
tfv_flying.s tfv: add in credits 2021-01-14 01:28:18 -05:00
tfv_game_over.s
tfv_info.s tfv: get info screen printing actual data 2021-02-11 23:54:45 -05:00
tfv_opener.s tfv: play music during battle 2021-01-19 14:39:37 -05:00
tfv_overworld.s tfv: initial inventory/info screen 2021-02-10 13:16:52 -05:00
tfv_sprites.inc tfv: add battle pose 2021-01-18 23:35:44 -05:00
tfv_textentry.s tfv: battle actually uses entered name 2021-02-07 15:13:07 -05:00
tfv_title.s tfv: name entry works 2021-02-07 01:03:23 -05:00
tfv_world.s tfv: get info screen printing actual data 2021-02-11 23:54:45 -05:00
tfv.dsk tfv: bump to version 007 2021-02-11 23:55:16 -05:00
TODO tfv: fix missing parts of build 2021-01-20 16:34:58 -05:00
vapor_lock.s tfv: add in credits 2021-01-14 01:28:18 -05:00
wait_keypressed.s
zp.inc tfv: get info screen printing actual data 2021-02-11 23:54:45 -05:00

                               Talbot Fantasy 7

                           by Deater (Vince Weaver)

                               vince@deater.net
                    http://www.deater.net/weave/vmwprod/tfv/

Background
~~~~~~~~~~

What you've always wanted, a poorly done FF7 clone for the Apple II.

Yes, I'm using the 40x40 15-color Low-resolution graphics mode of
the Apple II. This means the game could in theory run on the original
Apple II released in 1977 (if you had been fabulously rich enough to
populate all 48k of RAM). 






Memory Map
~~~~~~~~~~
$00	zero page
$01	stack
$02-$03	??
$04-$07	lores page 1
$08-$0b	lores page 2
$0c-$0f	background graphics
$10-$1f	??
$20-???	code			AE-20 = 36.4k
$AE-$B5 music buffer		2k
$B6-$BD multiply tables		2k
$BE-$BF ??
$C0-$CF I/O
$D0-$FF ROM





Mode7 Optimization Notes
~~~~~~~~~~~~~~~~~~~~~~~~


Original implementation:
	Multiplying 1.0 * 2.0 = 2.0, took 707 cycles
	Multiplying ff.ff * ff.ff = 0.0, took 761 cycles

	Cycles: flying=               162
	Cycles: getkey=                46
	Cycles: page_flip=             26
	Cycles: multiply=          88,179
	Cycles: mode7=             76,077
	Cycles: lookup_map=        33,920
	Cycles: put_sprite=         2,561
	==================================
	Total =                   200,971
	Frame Rate = 4.98 fps

Update Multiply to use zero page addresses:
	Multiplying 1.0 * 2.0 = 2.0, took 616 cycles
	Multiplying ff.ff * ff.ff = 0.0, took 664 cycles

	Cycles: flying=              162
	Cycles: getkey=               46
	Cycles: page_flip=            26
	Cycles: multiply=         76,561
	Cycles: mode7=            76,077
	Cycles: lookup_map=       33,920
	Cycles: put_sprite=        2,561
	===================================
	Total =                  189,353
	Frame Rate = 5.28 fps

Update to use "fast multiply" w 2kB squares table lookup:
	Multiplying 1.0 * 2.0 = 2.0, took 228 cycles
	Multiplying ff.ff * ff.ff = 0.0, took 272 cycles

	Cycles: flying=              162
	Cycles: getkey=               46
	Cycles: page_flip=            26
	Cycles: multiply=         27,041
	Cycles: mode7=            76,077
	Cycles: lookup_map=       33,920
	Cycles: put_sprite=        2,561
	=================================
	Total =                  139,833
	Frame Rate = 7.15 fps

Update to optimize fast multiply (reusing NUM1H, return results in register)
	Multiplying 1.0 * 2.0 = 2.0, took 234 cycles
	Multiplying ff.ff * ff.ff = 0.0, took 278 cycles

	Cycles: flying=              162
	Cycles: getkey=               46
        Cycles: page_flip=            26
        Cycles: multiply=         24,935
        Cycles: mode7=            73,925
        Cycles: lookup_map=       33,920
        Cycles: put_sprite=        2,561
	=================================
        Total =                  135,575
	Frame Rate = 7.38 fps

Add a cache to lookup_map

	Cycles: flying=              162
	Cycles: getkey=               46
	Cycles: page_flip=            26
	Cycles: multiply=         24,935
	Cycles: mode7=            73,445
	Cycles: lookup_map=       24,649
	Cycles: put_sprite=        2,561
	=================================
	Total =                  125,824
	Frame Rate = 7.95 fps

Don't draw sky every frame

	Cycles: flying=              162
	Cycles: getkey=               46
	Cycles: page_flip=            26
	Cycles: multiply=         24,935
	Cycles: mode7=            69,099
	Cycles: lookup_map=       24,649
	Cycles: put_sprite=        2,561
	=================================
	Total =                  121,478
	Frame Rate = 8.23 fps

Move checking if over water out of critical section

	Cycles: flying=              187
	Cycles: getkey=               46
	Cycles: page_flip=            26
	Cycles: multiply=         24,935
	Cycles: mode7=            54,374
	Cycles: lookup_map=       24,712
	Cycles: put_sprite=        2,561
	=================================
	Total =                  106,841
	Frame Rate = 9.36 fps

Move to 40x40 mode

	Cycles: flying=              187
	Cycles: getkey=               46
	Cycles: page_flip=            26
	Cycles: multiply=         49,613
	Cycles: mode7=           123,701
	Cycles: lookup_map=       48,847
	Cycles: put_sprite=        2,561
	=================================
	Total =                  224,981
	Frame Rate = 4.44 fps

Remove some unnecessary zero page copies in the mode7 code
	Cycles: flying=              187
	Cycles: getkey=               46
	Cycles: page_flip=            26
	Cycles: multiply=         49,613
	Cycles: mode7=           141,269
	Cycles: lookup_map=       21,718
	Cycles: put_sprite=        2,561
	================================
	Total =                  215,420
	Frame Rate = 4.64 fps

A few more minor cleanups in the Y loop
	Cycles: flying=             187
	Cycles: getkey=              46
	Cycles: page_flip=           26
	Cycles: multiply=        49,613
	Cycles: mode7=          140,858
	Cycles: lookup_map=      21,718
	Cycles: put_sprite=       2,561
	===============================
	Total =                 215,009
	Frame Rate = 4.65 fps

Add some self-modifying code to inner loop:
	Cycles: flying=             187
	Cycles: getkey=              46
	Cycles: page_flip=           26
	Cycles: multiply=        49,613
	Cycles: mode7=          131,610
	Cycles: lookup_map=      21,718
	Cycles: put_sprite=       2,561
	================================
	Total =                 205,761
	Frame Rate = 4.86 fps

More self-modifying code, also move SCREEN_X to X register
	Cycles: flying=             187
	Cycles: getkey=              46
	Cycles: page_flip=           26
	Cycles: multiply=        49,613
	Cycles: mode7=          118,034
	Cycles: lookup_map=      22,747
	Cycles: put_sprite=       2,561
	================================
	Total =                 193,214
	Frame Rate = 5.18 fps

Remove unneeded precision in the 8.8 x 8.8 fixed point multiply
	Cycles: flying=             187
	Cycles: getkey=              46
	Cycles: page_flip=           26
	Cycles: multiply=        43,588
	Cycles: mode7=          118,034
	Cycles: lookup_map=      22,747
	Cycles: put_sprite=       2,561
	================================
	Total =                 187,189
	Frame Rate = 5.34 fps

In-line unsigned multiply inside of signed multiply (save 12 cycles)
	Multiplying 1.0 * 2.0 = 2.0, took 198 cycles
	Multiplying ff.ff * ff.ff = 0.0, took 218 cycles

	Cycles: flying=             187
	Cycles: getkey=              46
	Cycles: page_flip=           26
	Cycles: multiply=        40,888
	Cycles: mode7=          118,034
	Cycles: lookup_map=      22,747
	Cycles: put_sprite=       2,561
	================================
	Total =                 184,489
	Frame Rate = 5.42 fps


Have loop counter count down from 40 instead of count up (avoid compare)
	Cycles: flying=             187
	Cycles: getkey=              46
	Cycles: page_flip=           26
	Cycles: multiply=        40,888
	Cycles: mode7=          115,538
	Cycles: lookup_map=      22,747
	Cycles: put_sprite=       2,561
	================================
	Total =                 181,993
	Frame Rate = 5.49 fps

Move spacez updates out of line and also do some self modifying code
	Cycles: flying=             187
	Cycles: getkey=              46
	Cycles: page_flip=           26
	Cycles: multiply=        40,680
	Cycles: mode7=          114,830
	Cycles: lookup_map=      22,747
	Cycles: put_sprite=       2,561
	================================
	Total =                 181,077
	Frame Rate = 5.52 fps

Re-arranged multiply result register to allow more optimization.
This looks like a pessimization, but it's because the cycle counting code
	had been undercounting and missed a few add routines :(

	Cycles: flying=             187
	Cycles: getkey=              46
	Cycles: page_flip=           26
	Cycles: multiply=        40,680
	Cycles: mode7=          115,150
	Cycles: lookup_map=      22,747
	Cycles: put_sprite=       2,561
	================================
	Total =                 181,397
	Frame Rate = 5.51 fps

Make lookup_map inline.  Again it looks like an impressive speedup
but some of this was fixing the cycle count estimates.

	Cycles: flying=             187
	Cycles: getkey=              46
	Cycles: page_flip=           26
	Cycles: multiply=        40,680
	Cycles: mode7=          111,882
	Cycles: lookup_map=      19,872
	Cycles: put_sprite=       2,561
	================================
	Total =                 175,254
	Frame Rate = 5.71 fps



Each cycle removed from inner X loop saves
	32*40=1280 cycles