diff --git a/monkey/Makefile b/monkey/Makefile index 9e573ae7..4c03119f 100644 --- a/monkey/Makefile +++ b/monkey/Makefile @@ -58,7 +58,9 @@ monkey.o: monkey.s zp.inc hardware.inc common_defines.inc \ monkey_actions.s update_bottom.s \ guy.brush \ monkey_lookout.s monkey_poster.s monkey_dock.s monkey_bar.s \ - monkey_town.s monkey_map.s + monkey_town.s monkey_map.s monkey_church.s monkey_mansion_path.s \ + monkey_mansion.s monkey_zipline.s \ + monkey_bar_inside1.s monkey_bar_inside2.s ca65 -o monkey.o monkey.s -l monkey.lst graphics/graphics.inc: diff --git a/monkey/TODO b/monkey/TODO index 6de8af1f..78686dab 100644 --- a/monkey/TODO +++ b/monkey/TODO @@ -1,7 +1,28 @@ -game: -+ click on verbs -+ actions for all the nouns +overall: + + have big/small/tiny guybrush + + better bounds checking on paths +hook up actions: + + scumm bar1 + +animations: + + fire in scumm bar + + impt pirate drinking + + guy on chandelier + + dog? + +hookup rooms: + + church + + path to mansion + + mansion + + voodoo lady + +cutscenes: + + chapter intro + + lechuck + +zipline: + + if you use pole you climb the ladder bigger changes: diff --git a/monkey/common_defines.inc b/monkey/common_defines.inc index 811d98ec..d5199671 100644 --- a/monkey/common_defines.inc +++ b/monkey/common_defines.inc @@ -12,19 +12,17 @@ VERB_PUSH = 7 VERB_PULL = 8 VERB_WALK = 9 - - ;=============================================== ; level data structure definitions ;=============================================== LOCATION_BACKGROUND=0 ; background -LOCATION_WALK_X_LEFT=2 -LOCATION_WALK_X_RIGHT=3 -LOCATION_WALK_Y_TOP=4 -LOCATION_WALK_Y_BOTTOM=5 -LOCATION_NUM_AREAS=6 -LOCATION_AREAS=7 ; each area 8 in size +LOCATION_DESTINATION = 2 +LOCATION_EXIT = 4 +LOCATION_BOUNDS = 6 +LOCATION_SIZE = 8 +LOCATION_NUM_AREAS=9 +LOCATION_AREAS=10 ; each area 8 in size ;================================ @@ -46,3 +44,9 @@ MONKEY_DOCK = 2 MONKEY_BAR = 3 MONKEY_TOWN = 4 MONKEY_MAP = 5 +MONKEY_BAR_INSIDE1 = 6 +MONKEY_BAR_INSIDE2 = 7 +MONKEY_CHURCH = 8 +MONKEY_MANSION_PATH = 9 +MONKEY_MANSION = 10 +MONKEY_ZIPLINE = 11 diff --git a/monkey/graphics/Makefile b/monkey/graphics/Makefile index de957de5..2b4b5bf6 100644 --- a/monkey/graphics/Makefile +++ b/monkey/graphics/Makefile @@ -10,7 +10,8 @@ all: graphics.inc graphics.inc: \ lookout.lzsa poster.lzsa dock.lzsa bar.lzsa town.lzsa map.lzsa \ - bar_inside1.lzsa bar_inside2.lzsa + bar_inside1.lzsa bar_inside2.lzsa zipline.lzsa \ + church.lzsa mansion.lzsa mansion_path.lzsa echo "lookout_lzsa: .incbin \"lookout.lzsa\"" > graphics.inc echo "poster_lzsa: .incbin \"poster.lzsa\"" >> graphics.inc echo "dock_lzsa: .incbin \"dock.lzsa\"" >> graphics.inc @@ -19,6 +20,10 @@ graphics.inc: \ echo "map_lzsa: .incbin \"map.lzsa\"" >> graphics.inc echo "bar_inside1_lzsa: .incbin \"bar_inside1.lzsa\"" >> graphics.inc echo "bar_inside2_lzsa: .incbin \"bar_inside2.lzsa\"" >> graphics.inc + echo "zipline_lzsa: .incbin \"zipline.lzsa\"" >> graphics.inc + echo "church_lzsa: .incbin \"church.lzsa\"" >> graphics.inc + echo "mansion_lzsa: .incbin \"mansion.lzsa\"" >> graphics.inc + echo "mansion_path_lzsa: .incbin \"mansion_path.lzsa\"" >> graphics.inc %.gr: %.png $(PNG2GR) $< $@ diff --git a/monkey/graphics/church.png b/monkey/graphics/church.png new file mode 100644 index 00000000..8dad73c9 Binary files /dev/null and b/monkey/graphics/church.png differ diff --git a/monkey/graphics/mansion.png b/monkey/graphics/mansion.png new file mode 100644 index 00000000..a32d64c4 Binary files /dev/null and b/monkey/graphics/mansion.png differ diff --git a/monkey/graphics/mansion_path.png b/monkey/graphics/mansion_path.png new file mode 100644 index 00000000..08963fed Binary files /dev/null and b/monkey/graphics/mansion_path.png differ diff --git a/monkey/graphics/zipline.png b/monkey/graphics/zipline.png new file mode 100644 index 00000000..e904c66f Binary files /dev/null and b/monkey/graphics/zipline.png differ diff --git a/monkey/hello.bas b/monkey/hello.bas index d4b25fbf..9ea91b0a 100644 --- a/monkey/hello.bas +++ b/monkey/hello.bas @@ -1,5 +1,5 @@ 5 HOME -10 PRINT "LOADING MONKEY V0.02" +10 PRINT "LOADING MONKEY V0.03" 20 PRINT:PRINT 40 PRINT "CONTROLS: " 42 PRINT " MOVE CURSOR : ARROWS OR WASD" diff --git a/monkey/keyboard.s b/monkey/keyboard.s index dfe5ad2a..c6a7b161 100644 --- a/monkey/keyboard.s +++ b/monkey/keyboard.s @@ -428,41 +428,8 @@ destination_y_is_positive: and #$FE ; has to be even sta DESTINATION_Y - - ; FIXME: this should be a jump table - lda LOCATION - cmp #MONKEY_LOOKOUT - beq set_destination_lookout - cmp #MONKEY_POSTER - beq set_destination_poster - cmp #MONKEY_DOCK - beq set_destination_dock - cmp #MONKEY_BAR - beq set_destination_bar - cmp #MONKEY_TOWN - beq set_destination_town - cmp #MONKEY_MAP - beq set_destination_map - -set_destination_lookout: - jsr lookout_adjust_destination - jmp done_set_destination -set_destination_poster: - jsr poster_adjust_destination - jmp done_set_destination -set_destination_dock: - jsr dock_adjust_destination - jmp done_set_destination -set_destination_bar: - jsr bar_adjust_destination - jmp done_set_destination -set_destination_town: - jsr town_adjust_destination - jmp done_set_destination -set_destination_map: - jsr map_adjust_destination - jmp done_set_destination - +set_destination_smc: + jsr $0000 done_set_destination: rts @@ -478,10 +445,12 @@ change_location: ; reset graphics bit SET_GR - ; reset pointer to not visible, centered + ; reset pointer to not visible lda #0 sta ANIMATE_FRAME sta CURSOR_VISIBLE + +; don't center? ; lda #20 ; sta CURSOR_X ; sta CURSOR_Y @@ -500,10 +469,39 @@ change_location: sta LOCATION_STRUCT_H + ;========================== + ; update level info + + ldy #LOCATION_DESTINATION + lda (LOCATION_STRUCT_L),Y + sta set_destination_smc+1 + iny + lda (LOCATION_STRUCT_L),Y + sta set_destination_smc+2 + + ldy #LOCATION_EXIT + lda (LOCATION_STRUCT_L),Y + sta check_exit_smc+1 + iny + lda (LOCATION_STRUCT_L),Y + sta check_exit_smc+2 + + ldy #LOCATION_BOUNDS + lda (LOCATION_STRUCT_L),Y + sta keep_in_bounds_smc+1 + iny + lda (LOCATION_STRUCT_L),Y + sta keep_in_bounds_smc+2 + + + ldy #LOCATION_SIZE + lda (LOCATION_STRUCT_L),Y + sta GUYBRUSH_SIZE + ;========================== ; load new background - ldy #0 + ldy #LOCATION_BACKGROUND lda (LOCATION_STRUCT_L),Y sta LZSA_SRC_LO diff --git a/monkey/leveldata_monkey.inc b/monkey/leveldata_monkey.inc index 88f22592..8eb68052 100644 --- a/monkey/leveldata_monkey.inc +++ b/monkey/leveldata_monkey.inc @@ -4,13 +4,17 @@ locations: .word location0,location1,location2,location3 - .word location4,location5 + .word location4,location5,location6,location7 + .word location8,location9,location10,location11 + ; MONKEY_LOOKOUT -- lookout tower location0: .word lookout_lzsa ; background - .byte 18,40 ; walking range X - .byte 16,48 ; walking range Y + .word lookout_adjust_destination ; destination + .word lookout_check_exit ; exit + .word lookout_check_bounds ; bounds check + .byte GUYBRUSH_BIG ; size .byte 3 ; num areas .byte 12,15 ; x @@ -31,8 +35,10 @@ location0: ; MONKEY_POSTER -- house with poster location1: .word poster_lzsa ; background - .byte 18,40 ; walking range X - .byte 16,48 ; walking range Y + .word poster_adjust_destination ; destination + .word poster_check_exit ; exit + .word lookout_check_bounds ; bounds check + .byte GUYBRUSH_BIG ; size .byte 2 ; num areas .byte 0,5 ; x @@ -48,8 +54,10 @@ location1: ; MONKEY_DOCK -- dock location2: .word dock_lzsa ; background - .byte 18,40 ; walking range X - .byte 16,48 ; walking range Y + .word dock_adjust_destination ; destination + .word dock_check_exit ; exit + .word lookout_check_bounds ; bounds check + .byte GUYBRUSH_BIG ; size .byte 1 ; num areas .byte 12,16 ; x @@ -60,20 +68,30 @@ location2: ; MONKEY_BAR -- scumm bar location3: .word bar_lzsa ; background - .byte 18,40 ; walking range X - .byte 16,48 ; walking range Y - .byte 1 ; num areas + .word bar_adjust_destination ; destination + .word bar_check_exit ; exit + .word bar_keep_in_bounds ; bounds check + .byte GUYBRUSH_BIG ; size + .byte 2 ; num areas .byte 9,14 ; x .byte 20,32 ; y .word door_string ; name .word door_action-1 ; action + .byte 36,40 ; x + .byte 14,34 ; y + .word archway_string ; name + .word archway_action-1 ; action + + ; MONKEY_TOWN -- downtown location4: .word town_lzsa ; background - .byte 18,40 ; walking range X - .byte 16,48 ; walking range Y + .word town_adjust_destination ; destination + .word town_check_exit ; exit + .word lookout_check_bounds ; bounds check + .byte GUYBRUSH_BIG ; size .byte 8 ; num areas .byte 33,38 ; x @@ -120,8 +138,10 @@ location4: ; MONKEY_MAP -- melee map location5: .word map_lzsa ; background - .byte 18,40 ; walking range X - .byte 16,48 ; walking range Y + .word map_adjust_destination ; destination + .word map_check_exit ; exit + .word lookout_check_bounds ; bounds check + .byte GUYBRUSH_TINY ; size .byte 7 ; num areas .byte 32,33 ; x @@ -159,7 +179,170 @@ location5: .word village_string ; name .word map_action-1 ; action -string_data: + +; MONKEY_BAR_INSIDE1 -- inside bar, lots going on +location6: + .word bar_inside1_lzsa ; background + .word bar_inside1_adjust_destination ; destination + .word bar_inside1_check_exit ; exit + .word lookout_check_bounds ; bounds check + .byte GUYBRUSH_BIG ; size + .byte 7 ; num areas + + .byte 0,10 ; x + .byte 34,40 ; y + .word pirate_string ; name + .word bar1_pirate_action-1 ; action + + .byte 4,9 ; x + .byte 16,32 ; y + .word door_string ; name + .word bar1_door_action-1 ; action + + .byte 10,15 ; x + .byte 22,32 ; y + .word pirate_string ; name + .word bar1_pirate_action-1 ; action + + .byte 16,20 ; x + .byte 22,34 ; y + .word pirates_string ; name + .word bar1_pirate_action-1 ; action + + .byte 21,35 ; x + .byte 22,38 ; y + .word pirate_string ; name + .word bar1_pirate_action-1 ; action + + .byte 37,40 ; x + .byte 14,30 ; y + .word curtain_string ; name + .word curtain_action-1 ; action + + .byte 35,40 ; x + .byte 30,38 ; y + .word dog_string ; name + .word bar1_dog_action-1 ; action + + + + +; MONKEY_BAR_INSIDE2 -- three pirates +location7: + .word bar_inside2_lzsa ; background + .word bar_inside2_adjust_destination ; destination + .word bar_inside2_check_exit ; exit + .word bar_inside2_check_bounds ; bounds check + .byte GUYBRUSH_BIG ; size + .byte 4 ; num areas + + .byte 0,3 ; x + .byte 12,34 ; y + .word curtain_string ; name + .word curtain_action-1 ; action + + .byte 7,20 ; x + .byte 22,32 ; y + .word impt_pirate_string ; name + .word impt_pirate_action-1 ; action + + .byte 23,28 ; x + .byte 20,28 ; y + .word fireplace_string ; name + .word fireplace_action-1 ; action + + .byte 34,38 ; x + .byte 18,36 ; y + .word door_string ; name + .word bar2_door_action-1 ; action + +; MONKEY_CHURCH -- outside the church +location8: + .word church_lzsa ; background + .word church_adjust_destination ; destination + .word church_check_exit ; exit + .word lookout_check_bounds ; bounds check + .byte GUYBRUSH_BIG ; size + .byte 1 ; num areas + + .byte 9,14 ; x + .byte 20,32 ; y + .word door_string ; name + .word door_action-1 ; action + +; MONKEY_MANSION_PATH -- path to the mansion +location9: + .word mansion_path_lzsa ; background + .word mansion_path_adjust_destination ; destination + .word mansion_path_check_exit ; exit + .word lookout_check_bounds ; bounds check + .byte GUYBRUSH_BIG ; size + .byte 1 ; num areas + + .byte 9,14 ; x + .byte 20,32 ; y + .word door_string ; name + .word door_action-1 ; action + +; MONKEY_MANSION -- governor's mansion +location10: + .word mansion_lzsa ; background + .word mansion_adjust_destination ; destination + .word mansion_check_exit ; exit + .word lookout_check_bounds ; bounds check + .byte GUYBRUSH_BIG ; size + .byte 1 ; num areas + + .byte 9,14 ; x + .byte 20,32 ; y + .word door_string ; name + .word door_action-1 ; action + +; MONKEY_ZIPLINE -- hook's zipline +location11: + .word zipline_lzsa ; background + .word zipline_adjust_destination ; destination + .word zipline_check_exit ; exit + .word lookout_check_bounds ; bounds check + .byte GUYBRUSH_BIG ; size + .byte 3 ; num areas + + .byte 30,36 ; x + .byte 10,36 ; y + .word pole_string ; name + .word pole_action-1 ; action + + .byte 19,30 ; x + .byte 4,16 ; y + .word cable_string ; name + .word cable_action-1 ; action + + .byte 0,15 ; x + .byte 4,28 ; y + .word sign_string ; name + .word sign_action-1 ; action + +; common strings + +door_string: .byte 20,20,"DOOR",0 +pirate_string: .byte 20,20,"PIRATE",0 +pirates_string: .byte 20,20,"PIRATES",0 + +; zipline strings +pole_string: .byte 20,20,"POLE",0 +cable_string: .byte 20,20,"CABLE",0 +sign_string: .byte 20,20,"SIGN",0 + +; bar strings + +; lookout strings + +lookout_string: .byte 20,20,"LOOKOUT",0 +path_string: .byte 20,20,"PATH",0 +stairs_string: .byte 20,20,"STAIRS",0 + +; map strings + house_string: .byte 18,20,"HOUSE",0 lights_string: .byte 17,20,"LIGHTS",0 clearing_string:.byte 16,20,"CLEARING",0 @@ -168,16 +351,25 @@ shore_string: .byte 18,20,"SHORE",0 lookout_point_string: .byte 13,20,"LOOKOUT POINT",0 village_string: .byte 16,20,"VILLAGE",0 -lookout_string: .byte 20,20,"LOOKOUT",0 -path_string: .byte 20,20,"PATH",0 -stairs_string: .byte 20,20,"STAIRS",0 +; inside_bar2 strings +dog_string: .byte 20,20,"DOG",0 + +; inside_bar2 strings + +curtain_string: .byte 20,20,"CURTAIN",0 +impt_pirate_string: .byte 20,20,"IMPORTANT PIRATES",0 +fireplace_string: .byte 20,20,"FIREPLACE",0 + +; poster strings cliffside_string: .byte 20,20,"CLIFFSIDE",0 -poster_string: .byte 20,20,"POSTER",0 +poster_string: .byte 20,20,"POSTER",0 + +; dock strings moon_string: .byte 20,20,"MOON",0 -door_string: .byte 20,20,"DOOR",0 +; town strings archway_string: .byte 20,20,"ARCHWAY",0 clock_string: .byte 20,20,"CLOCK",0 diff --git a/monkey/monkey.s b/monkey/monkey.s index f07350fc..21aaba68 100644 --- a/monkey/monkey.s +++ b/monkey/monkey.s @@ -50,6 +50,7 @@ monkey_start: ; set up initial location +; lda #MONKEY_BAR_INSIDE2 lda #MONKEY_LOOKOUT sta LOCATION @@ -93,6 +94,8 @@ game_loop: beq animate_flame cmp #MONKEY_BAR beq do_draw_bar_door + cmp #MONKEY_ZIPLINE + beq do_draw_sign jmp nothing_special @@ -104,6 +107,10 @@ do_draw_bar_door: jsr draw_bar_door jmp nothing_special +do_draw_sign: + jsr draw_sign + jmp nothing_special + nothing_special: @@ -211,6 +218,8 @@ really_draw_guybrush: beq do_draw_wall cmp #MONKEY_POSTER beq do_draw_house + cmp #MONKEY_BAR + beq do_draw_building jmp nothing_foreground @@ -222,6 +231,11 @@ do_draw_house: jsr draw_house jmp nothing_foreground +do_draw_building: + jsr draw_bar_fg_building + jmp nothing_foreground + + nothing_foreground: @@ -255,46 +269,20 @@ nothing_foreground: jsr handle_keypress + ;==================================== + ; keep in bounds + ;==================================== + +keep_in_bounds_smc: + jsr $0000 + ;==================================== ; check if exiting room ;==================================== - ; FIXME: this should be a jump table +check_exit_smc: + jsr $0000 - lda LOCATION - cmp #MONKEY_LOOKOUT - beq check_exit_lookout - cmp #MONKEY_POSTER - beq check_exit_poster - cmp #MONKEY_DOCK - beq check_exit_dock - cmp #MONKEY_BAR - beq check_exit_bar - cmp #MONKEY_TOWN - beq check_exit_town - cmp #MONKEY_MAP - beq check_exit_map - -check_exit_lookout: - jsr lookout_check_exit - jmp done_check_exit -check_exit_poster: - jsr poster_check_exit - jmp done_check_exit -check_exit_dock: - jsr dock_check_exit - jmp done_check_exit -check_exit_bar: - jsr bar_check_exit - jmp done_check_exit -check_exit_town: - jsr town_check_exit - jmp done_check_exit -check_exit_map: - jsr map_check_exit - jmp done_check_exit - -done_check_exit: ;==================================== ; inc frame count ;==================================== @@ -342,12 +330,20 @@ really_exit: .include "common_sprites.inc" .include "guy.brush" + ; Locations + .include "monkey_lookout.s" .include "monkey_poster.s" .include "monkey_dock.s" .include "monkey_bar.s" .include "monkey_town.s" .include "monkey_map.s" + .include "monkey_church.s" + .include "monkey_zipline.s" + .include "monkey_mansion.s" + .include "monkey_mansion_path.s" + .include "monkey_bar_inside1.s" + .include "monkey_bar_inside2.s" .include "monkey_actions.s" .include "update_bottom.s" diff --git a/monkey/monkey_actions.s b/monkey/monkey_actions.s index a561e7c5..72af271c 100644 --- a/monkey/monkey_actions.s +++ b/monkey/monkey_actions.s @@ -126,6 +126,8 @@ cant_pick_up: .byte 10,21,"I CAN'T PICK THAT UP.",0 not_special: .byte 1,21,"I DON'T SEE ANYTHING SPECIAL ABOUT IT.",0 +for_what: +.byte 15,21,"FOR WHAT?",0 ;============================= ; can't do anything with path diff --git a/monkey/monkey_bar.s b/monkey/monkey_bar.s index 2ffda784..1d0f3eeb 100644 --- a/monkey/monkey_bar.s +++ b/monkey/monkey_bar.s @@ -1,5 +1,12 @@ ; if x<5 goto DOCK at 34,20 + ;=========================== + ; check if exit bar screen + ;=========================== + ; if x<5 goto DOCK at 34,20 + ; if x>35 goto TOWN + ; if 9building_sprite + sta INH + + lda #27 + sta XPOS + lda #16 + sta YPOS + + jsr put_sprite_crop + +done_draw_bar_fg_building: + rts + +building_sprite: + .byte 13,7 + .byte $77,$22,$9d,$00,$9d,$00,$22,$22,$22,$00,$00,$00,$0A + .byte $77,$25,$25,$25,$25,$25,$22,$22,$22,$00,$00,$00,$00 + .byte $77,$22,$22,$22,$22,$22,$22,$22,$02,$00,$00,$90,$90 + .byte $A7,$72,$02,$02,$02,$00,$00,$00,$00,$00,$00,$09,$09 + .byte $AA,$77,$00,$00,$00,$00,$00,$00,$00,$60,$60,$d9,$dd + .byte $AA,$77,$00,$00,$00,$00,$60,$00,$60,$06,$00,$66,$dd + .byte $AA,$77,$00,$60,$26,$66,$02,$06,$00,$00,$60,$22,$00 diff --git a/monkey/monkey_bar_inside1.s b/monkey/monkey_bar_inside1.s new file mode 100644 index 00000000..30acc83c --- /dev/null +++ b/monkey/monkey_bar_inside1.s @@ -0,0 +1,112 @@ +; stuff regarding 1st room in scumm bar + + ; if x<5 goto MONKEY_BAR at 10,20 + ; if x>35 goto MONKEY_BAR_INSIDE2 at 5,20 + +bar_inside1_check_exit: + + lda GUYBRUSH_X + cmp #5 + bcc bar_inside1_to_bar + cmp #35 + bcs bar_inside1_to_bar_inside2 + bcc bar_inside1_no_exit + +bar_inside1_to_bar: + lda #MONKEY_BAR + sta LOCATION + lda #10 + sta GUYBRUSH_X + sta DESTINATION_X + lda #20 + sta GUYBRUSH_Y + sta DESTINATION_Y + lda #DIR_DOWN + sta GUYBRUSH_DIRECTION + jsr change_location + jmp bar_inside1_no_exit + +bar_inside1_to_bar_inside2: + lda #MONKEY_BAR_INSIDE2 + sta LOCATION + lda #3 + sta GUYBRUSH_X + sta DESTINATION_X + lda #20 + sta GUYBRUSH_Y + lda #24 + sta DESTINATION_Y + jsr change_location + jmp bar_inside1_no_exit + +bar_inside1_no_exit: + rts + + + + ;================================= + ;================================= + ; bar_inside1 adjust destination + ;================================= + ;================================= +bar_inside1_adjust_destination: + ; just make Y always 20 + +mb1_check_y: + ; if x < 28, Y must be between 16 and 18 + ; if x < 35, Y must be between 8 and 28 + +mb1_y_too_small: + lda #20 + sta DESTINATION_Y + +done_mb1_adjust: + rts + + + + +;draw_house: + +; lda #wall_sprite +; sta INH + +; lda #18 +; sta XPOS +; lda #22 +; sta YPOS + +; jsr put_sprite_crop + +; rts + +;house_sprite: + + + ;=================================== + ;=================================== + ; actions + ;=================================== + ;=================================== + +;============================= +bar1_pirate_action: + lda #VERB_WALK + sta CURRENT_VERB + rts + +;============================= +bar1_door_action: + lda #VERB_WALK + sta CURRENT_VERB + rts + +;============================= +bar1_dog_action: + lda #VERB_WALK + sta CURRENT_VERB + rts + + diff --git a/monkey/monkey_bar_inside2.s b/monkey/monkey_bar_inside2.s new file mode 100644 index 00000000..a1c03aa6 --- /dev/null +++ b/monkey/monkey_bar_inside2.s @@ -0,0 +1,203 @@ +; stuff regarding 2nd room of scumm bar + + ; if x<4 goto MONKEY_BAR_INSIDE1 at 34,20 + +bar_inside2_check_exit: + + lda GUYBRUSH_X + cmp #4 + bcc bar_inside2_to_bar_inside1 +; cmp #35 +; bcs bar_inside2_to_bar + bcs bar_inside2_no_exit + + +bar_inside2_to_bar_inside1: + lda GUYBRUSH_DIRECTION + cmp #DIR_LEFT + bne bar_inside2_no_exit + + lda #MONKEY_BAR_INSIDE1 + sta LOCATION + lda #34 + sta GUYBRUSH_X + sta DESTINATION_X + lda #20 + sta GUYBRUSH_Y + sta DESTINATION_Y + jsr change_location + jmp bar_inside2_no_exit + +bar_inside2_no_exit: + rts + + ;================================ + ;================================ + ; bar_inside2 adjust destination + ;================================ + ;================================ +bar_inside2_adjust_destination: + ; just make Y always 24 + + lda #24 + sta DESTINATION_Y + + lda DESTINATION_X + cmp #33 + bcc done_mb2_adjust + + lda #33 + sta DESTINATION_X + + +done_mb2_adjust: + rts + + + ;================================ + ;================================ + ; bar_inside2 check bounds + ;================================ + ;================================ +bar_inside2_check_bounds: + ; just make Y always 20 + + rts + +;draw_house: + +; lda #wall_sprite +; sta INH + +; lda #18 +; sta XPOS +; lda #22 +; sta YPOS + +; jsr put_sprite_crop + +; rts + +;house_sprite: + + + ;=================================== + ;=================================== + ; actions + ;=================================== + ;=================================== + + +;============================= +bar2_door_action: +bar2_door_nothing: + lda #VERB_WALK + sta CURRENT_VERB + rts + + + ;============================= +fireplace_action: + lda CURRENT_VERB + asl + tay + + lda fireplace_actions,Y + cmp #$ff + beq fireplace_nothing + + sta MESSAGE_L + lda fireplace_actions+1,Y + sta MESSAGE_H + + jmp do_display_message + +fireplace_nothing: + lda #VERB_WALK + sta CURRENT_VERB + rts + +fireplace_actions: + .word $FFFF ; give + .word doesnt_open ; open + .word doesnt_work ; close + .word cant_pick_up ; pick_up + .word fireplace_look ; look_at + .word $FFFF ; talk_to + .word for_what ; use + .word icant_move ; push + .word icant_move ; pull + +fireplace_look: +.byte 18,21,"COZY.",0 + + +;============================= +impt_pirate_action: + lda CURRENT_VERB + asl + tay + + lda impt_pirate_actions,Y + cmp #$ff + beq impt_pirate_nothing + + sta MESSAGE_L + lda impt_pirate_actions+1,Y + sta MESSAGE_H + + jmp do_display_message + +impt_pirate_nothing: + lda #VERB_WALK + sta CURRENT_VERB + rts + +impt_pirate_actions: + .word $FFFF ; give + .word $FFFF ; open + .word $FFFF ; close + .word $FFFF ; pick_up + .word impt_pirate_look ; look_at + .word impt_pirate_look ; talk_to + .word $FFFF ; use + .word $FFFF ; push + .word $FFFF ; pull + +impt_pirate_look: +.byte 8,21,"WHAT BE YE WANTIN' BOY?",0 + + ;============================= +curtain_action: + lda CURRENT_VERB + asl + tay + + lda curtain_actions,Y + cmp #$ff + beq curtain_nothing + + sta MESSAGE_L + lda curtain_actions+1,Y + sta MESSAGE_H + + jmp do_display_message + +curtain_nothing: + lda #VERB_WALK + sta CURRENT_VERB + rts + +curtain_actions: + .word $FFFF ; give + .word doesnt_open ; open + .word doesnt_work ; close + .word cant_pick_up ; pick_up + .word not_special ; look_at + .word $FFFF ; talk_to + .word for_what ; use + .word icant_move ; push + .word icant_move ; pull + diff --git a/monkey/monkey_church.s b/monkey/monkey_church.s new file mode 100644 index 00000000..0a11126b --- /dev/null +++ b/monkey/monkey_church.s @@ -0,0 +1,84 @@ +; stuff regarding the church + + + ; if x<4 goto MONKEY_MANSION_PATH at + ; if x>35 goto MONKEY_CHURCH at + +church_check_exit: + + lda GUYBRUSH_X + cmp #4 + bcc church_to_mansion_path + cmp #35 + bcs church_to_town + bcc church_no_exit + +church_to_mansion_path: + lda #MONKEY_MANSION_PATH + sta LOCATION + lda #34 + sta GUYBRUSH_X + sta DESTINATION_X + lda #20 + sta GUYBRUSH_Y + sta DESTINATION_Y + jsr change_location + jmp church_no_exit + +church_to_town: + lda #MONKEY_TOWN + sta LOCATION + lda #5 + sta GUYBRUSH_X + sta DESTINATION_X + lda #20 + sta GUYBRUSH_Y + sta DESTINATION_Y + jsr change_location + jmp church_no_exit + +church_no_exit: + rts + + + + ;========================== + ;========================== + ; church adjust destination + ;========================== + ;========================== +church_adjust_destination: + ; just make Y always 20 + +ch_check_y: + ; if x < 28, Y must be between 16 and 18 + ; if x < 35, Y must be between 8 and 28 + +ch_y_too_small: + lda #20 + sta DESTINATION_Y + +done_ch_adjust: + rts + + + + +;draw_house: + +; lda #wall_sprite +; sta INH + +; lda #18 +; sta XPOS +; lda #22 +; sta YPOS + +; jsr put_sprite_crop + +; rts + +;house_sprite: + diff --git a/monkey/monkey_lookout.s b/monkey/monkey_lookout.s index ab5a6b34..2eb59472 100644 --- a/monkey/monkey_lookout.s +++ b/monkey/monkey_lookout.s @@ -102,6 +102,10 @@ done_ld_adjust: +lookout_check_bounds: + rts + + draw_fire: lda FRAMEL and #$18 diff --git a/monkey/monkey_mansion.s b/monkey/monkey_mansion.s new file mode 100644 index 00000000..908fe5dc --- /dev/null +++ b/monkey/monkey_mansion.s @@ -0,0 +1,68 @@ +; stuff regarding the governor's mansion + + ; if x>35 goto MONKEY_MANSION_PATH at + +mansion_check_exit: + + lda GUYBRUSH_X + cmp #35 + bcs mansion_to_mansion_path + bcc mansion_no_exit + +mansion_to_mansion_path: + lda #MONKEY_MANSION_PATH + sta LOCATION + lda #5 + sta GUYBRUSH_X + sta DESTINATION_X + lda #20 + sta GUYBRUSH_Y + sta DESTINATION_Y + jsr change_location + jmp mansion_no_exit + +mansion_no_exit: + rts + + + + ;========================== + ;========================== + ; mansion adjust destination + ;========================== + ;========================== +mansion_adjust_destination: + ; just make Y always 20 + +mn_check_y: + ; if x < 28, Y must be between 16 and 18 + ; if x < 35, Y must be between 8 and 28 + +mn_y_too_small: + lda #20 + sta DESTINATION_Y + +done_mn_adjust: + rts + + + + +;draw_house: + +; lda #wall_sprite +; sta INH + +; lda #18 +; sta XPOS +; lda #22 +; sta YPOS + +; jsr put_sprite_crop + +; rts + +;house_sprite: + diff --git a/monkey/monkey_mansion_path.s b/monkey/monkey_mansion_path.s new file mode 100644 index 00000000..b795d829 --- /dev/null +++ b/monkey/monkey_mansion_path.s @@ -0,0 +1,84 @@ +; stuff regarding path to mansion + + + ; if x<4 goto MONKEY_MANSION + ; if x>35 goto MONKEY_CHURCH + +mansion_path_check_exit: + + lda GUYBRUSH_X + cmp #4 + bcc mansion_path_to_mansion + cmp #35 + bcs mansion_path_to_church + bcc mansion_path_no_exit + +mansion_path_to_mansion: + lda #MONKEY_MANSION + sta LOCATION + lda #34 + sta GUYBRUSH_X + sta DESTINATION_X + lda #20 + sta GUYBRUSH_Y + sta DESTINATION_Y + jsr change_location + jmp mansion_path_no_exit + +mansion_path_to_church: + lda #MONKEY_CHURCH + sta LOCATION + lda #5 + sta GUYBRUSH_X + sta DESTINATION_X + lda #20 + sta GUYBRUSH_Y + sta DESTINATION_Y + jsr change_location + jmp mansion_path_no_exit + +mansion_path_no_exit: + rts + + + + ;========================== + ;========================== + ; mansion_path adjust destination + ;========================== + ;========================== +mansion_path_adjust_destination: + ; just make Y always 20 + +mh_check_y: + ; if x < 28, Y must be between 16 and 18 + ; if x < 35, Y must be between 8 and 28 + +mh_y_too_small: + lda #20 + sta DESTINATION_Y + +done_mh_adjust: + rts + + + + +;draw_house: + +; lda #wall_sprite +; sta INH + +; lda #18 +; sta XPOS +; lda #22 +; sta YPOS + +; jsr put_sprite_crop + +; rts + +;house_sprite: + diff --git a/monkey/monkey_map.s b/monkey/monkey_map.s index 61e5066e..0cd6a58a 100644 --- a/monkey/monkey_map.s +++ b/monkey/monkey_map.s @@ -1,13 +1,22 @@ + ; 11, 22 = lookout + ; 10, 24 = poster + ; 25, 4 = zipline map_check_exit: lda GUYBRUSH_X cmp #11 - bne map_no_exit + beq check_lookout + cmp #10 + beq check_poster + cmp #25 + beq check_zipline + rts + +check_lookout: lda GUYBRUSH_Y cmp #22 bne map_no_exit - map_to_lookout: lda #MONKEY_LOOKOUT sta LOCATION @@ -22,9 +31,48 @@ map_to_lookout: sta GUYBRUSH_DIRECTION jsr change_location +check_poster: + lda GUYBRUSH_Y + cmp #24 + bne map_no_exit +map_to_poster: + lda #MONKEY_POSTER + sta LOCATION + lda #4 + sta GUYBRUSH_X + sta DESTINATION_X + lda #20 + sta GUYBRUSH_Y + sta DESTINATION_Y + lda #DIR_DOWN + sta GUYBRUSH_DIRECTION + jsr change_location + +check_zipline: + lda GUYBRUSH_Y + cmp #4 + bne map_no_exit +map_to_zipline: + lda #MONKEY_ZIPLINE + sta LOCATION + lda #4 + sta GUYBRUSH_X + sta DESTINATION_X + lda #26 + sta GUYBRUSH_Y + sta DESTINATION_Y + lda #DIR_RIGHT + sta GUYBRUSH_DIRECTION + jsr change_location + map_no_exit: rts + + + + + map_adjust_destination: ; x between 6 and 30 diff --git a/monkey/monkey_town.s b/monkey/monkey_town.s index ce9644cb..1ee73075 100644 --- a/monkey/monkey_town.s +++ b/monkey/monkey_town.s @@ -1,7 +1,16 @@ +; right side of downtown village + + ;======================= + ; check exit + ;======================= + ; town_check_exit: lda GUYBRUSH_X + cmp #5 ; temporary + bcc town_to_church + cmp #32 bcc town_no_exit @@ -26,10 +35,29 @@ town_to_bar: lda #DIR_LEFT sta GUYBRUSH_DIRECTION jsr change_location + jmp town_no_exit + +town_to_church: + lda #MONKEY_CHURCH + sta LOCATION + lda #34 + sta GUYBRUSH_X + sta DESTINATION_X + lda #20 + sta GUYBRUSH_Y + sta DESTINATION_Y + + lda #DIR_LEFT + sta GUYBRUSH_DIRECTION + jsr change_location town_no_exit: rts + ;======================= + ; adjust destination + ;======================= + town_adjust_destination: ; if x<32, y must be >22 @@ -62,6 +90,11 @@ done_tn_adjust: rts + ;======================= + ; adjust bounds + ;======================= +town_check_bounds: + rts ;draw_town_door: diff --git a/monkey/monkey_zipline.s b/monkey/monkey_zipline.s new file mode 100644 index 00000000..675ffa5c --- /dev/null +++ b/monkey/monkey_zipline.s @@ -0,0 +1,189 @@ +; stuff regarding the zipline + + ; if x<4 goto MONKEY_MAP at 23,4 + +zipline_check_exit: + + lda GUYBRUSH_X + cmp #4 + bcc zipline_to_map + bcs zipline_no_exit + +zipline_to_map: + lda #MONKEY_MAP + sta LOCATION + lda #23 + sta GUYBRUSH_X + sta DESTINATION_X + lda #4 + sta GUYBRUSH_Y + sta DESTINATION_Y + jsr change_location + +zipline_no_exit: + rts + + + + ;========================== + ;========================== + ; zipline adjust destination + ;========================== + ;========================== +zipline_adjust_destination: + ; just make Y always 26 + +zp_check_y: + +zp_y_too_small: + lda #26 + sta DESTINATION_Y + +done_zp_adjust: + rts + + +draw_sign: + lda FRAMEL + and #$10 + beq done_draw_sign + + + lda #sign_sprite + sta INH + + lda #0 + sta XPOS + lda #4 + sta YPOS + + jsr put_sprite_crop +done_draw_sign: + rts + +sign_sprite: + .byte 16,11 + .byte $dA,$1A,$AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA,$d1,$AA,$AA,$AA + .byte $AA,$AA,$Ad,$A1,$Ad,$A1,$dA,$1A,$AA,$AA,$AA,$AA,$1A,$Ad,$1A,$AA + .byte $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA,$Ad,$A1,$dA,$1A,$Ad,$AA,$Ad,$1A + .byte $AA,$Ad,$1A,$AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA,$dA + .byte $AA,$AA,$Ad,$dA,$1A,$dA,$1A,$dA,$AA,$AA,$AA,$AA,$AA,$dA,$1A,$AA + .byte $A1,$Ad,$A1,$1A,$dA,$1A,$AA,$AA,$A1,$Ad,$A1,$Ad,$1A,$AA,$AA,$AA + .byte $AA,$AA,$1d,$AA,$AA,$AA,$1d,$AA,$AA,$dA,$1A,$Ad,$AA,$AA,$AA,$AA + .byte $AA,$AA,$Ad,$A1,$dA,$A1,$Ad,$AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA + .byte $AA,$A1,$Ad,$AA,$1A,$Ad,$A1,$AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA + .byte $AA,$dA,$AA,$AA,$AA,$AA,$1d,$AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA + .byte $AA,$1A,$dA,$A1,$Ad,$1A,$dA,$AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA + +;============================= + +sign_action: + lda CURRENT_VERB + asl + tay + + lda sign_actions,Y + cmp #$ff + beq sign_nothing + + sta MESSAGE_L + lda sign_actions+1,Y + sta MESSAGE_H + + jmp do_display_message + +sign_nothing: + lda #VERB_WALK + sta CURRENT_VERB + rts + + +sign_actions: + .word $FFFF ; give + .word doesnt_open ; open + .word doesnt_work ; close + .word cant_pick_up ; pick_up + .word sign_look ; look_at + .word $FFFF ; talk_to + .word doesnt_work ; use + .word icant_move ; push + .word icant_move ; pull + + + +sign_look: .byte 2,21,"GAUDY BUT IN A CHEERFUL SORT OF WAY",0 + +;============================= + +cable_action: + lda CURRENT_VERB + asl + tay + + lda cable_actions,Y + cmp #$ff + beq cable_nothing + + sta MESSAGE_L + lda cable_actions+1,Y + sta MESSAGE_H + + jmp do_display_message + +cable_nothing: + lda #VERB_WALK + sta CURRENT_VERB + rts + + +cable_actions: + .word $FFFF ; give + .word doesnt_open ; open + .word doesnt_work ; close + .word cant_pick_up ; pick_up + .word cable_look ; look_at + .word $FFFF ; talk_to + .word $FFFF ; use + .word icant_move ; push + .word icant_move ; pull + +cable_look: .byte 1,21,"HMM I THINK IT COULD SUPPORT MY WEIGHT",0 + +;============================= + +pole_action: + lda CURRENT_VERB + asl + tay + + lda pole_actions,Y + cmp #$ff + beq pole_nothing + + sta MESSAGE_L + lda pole_actions+1,Y + sta MESSAGE_H + + jmp do_display_message + +pole_nothing: + lda #VERB_WALK + sta CURRENT_VERB + rts + + +pole_actions: + .word $FFFF ; give + .word doesnt_open ; open + .word doesnt_work ; close + .word cant_pick_up ; pick_up + .word pole_look ; look_at + .word $FFFF ; talk_to + .word $FFFF ; use ; FIXME, use pool climbs ladder + .word icant_move ; push + .word icant_move ; pull + + +pole_look: .byte 6,21,"IT'S JUST LIKE THE OTHER ONE",0 diff --git a/monkey/zp.inc b/monkey/zp.inc index bce36676..825313a0 100644 --- a/monkey/zp.inc +++ b/monkey/zp.inc @@ -110,6 +110,11 @@ DISPLAY_MESSAGE = $95 MESSAGE_L = $96 MESSAGE_H = $97 +GUYBRUSH_SIZE = $98 + GUYBRUSH_BIG = 0 + GUYBRUSH_SMALL = 1 + GUYBRUSH_TINY = 2 + ; done game puzzle state diff --git a/tfv/Makefile b/tfv/Makefile index de169cb5..f6550945 100644 --- a/tfv/Makefile +++ b/tfv/Makefile @@ -8,39 +8,15 @@ ARTDIR = ./art all: tfv.dsk -$(PNG2RLE): - cd ../gr-utils && make - $(DOS33): cd ../dos33fs-utils && make -tfv.dsk: $(DOS33) TFV +tfv.dsk: $(DOS33) TFV HELLO + $(DOS33) -y tfv.dsk SAVE A HELLO $(DOS33) -y tfv.dsk BSAVE -a 0x1000 TFV # $(DOS33) -y tfv.dsk BSAVE -a 0x2000 HIGHWIND.ED # $(DOS33) -y tfv.dsk BSAVE -a 0x2000 FIGHTING.ED - -tfv_backgrounds.inc: $(PNG2RLE) \ - $(ARTDIR)/title.png $(ARTDIR)/map.png \ - $(ARTDIR)/landing.png $(ARTDIR)/harfco.png \ - $(ARTDIR)/belair.png \ - $(ARTDIR)/math_office.png $(ARTDIR)/video_hr.png \ - $(ARTDIR)/collegep.png \ - $(ARTDIR)/umcp.png \ - $(ARTDIR)/dining.png $(ARTDIR)/metro.png $(ARTDIR)/talbot.png - $(PNG2RLE) asm $(ARTDIR)/title.png title_rle > tfv_backgrounds.inc - $(PNG2RLE) asm $(ARTDIR)/map.png map_rle >> tfv_backgrounds.inc - $(PNG2RLE) asm $(ARTDIR)/landing.png landing_rle >> tfv_backgrounds.inc - $(PNG2RLE) asm $(ARTDIR)/harfco.png harfco_rle >> tfv_backgrounds.inc - $(PNG2RLE) asm $(ARTDIR)/belair.png belair_rle >> tfv_backgrounds.inc - $(PNG2RLE) asm $(ARTDIR)/math_office.png math_office_rle >> tfv_backgrounds.inc - $(PNG2RLE) asm $(ARTDIR)/video_hr.png video_hr_rle >> tfv_backgrounds.inc - $(PNG2RLE) asm $(ARTDIR)/collegep.png collegep_rle >> tfv_backgrounds.inc - $(PNG2RLE) asm $(ARTDIR)/umcp.png umcp_rle >> tfv_backgrounds.inc - $(PNG2RLE) asm $(ARTDIR)/dining.png dining_rle >> tfv_backgrounds.inc - $(PNG2RLE) asm $(ARTDIR)/metro.png metro_rle >> tfv_backgrounds.inc - $(PNG2RLE) asm $(ARTDIR)/talbot.png talbot_rle >> tfv_backgrounds.inc - ### TFV: tfv.o @@ -49,9 +25,9 @@ TFV: tfv.o tfv.o: tfv.s \ tfv_flying.s tfv_info.s tfv_opener.s tfv_title.s \ tfv_textentry.s tfv_worldmap.s \ - tfv_backgrounds.inc tfv_sprites.inc tfv_zp.inc \ + graphics_map/tfv_backgrounds.inc tfv_sprites.inc tfv_zp.inc \ ../asm_routines/multiply_fast.s \ - ../asm_routines/gr_fast_clear.s \ + gr_fast_clear.s \ ../asm_routines/pageflip.s \ ../asm_routines/gr_setpage.s \ ../asm_routines/keypress.s \ @@ -63,7 +39,16 @@ tfv.o: tfv.s \ ../asm_routines/gr_unrle.s ca65 -o tfv.o tfv.s -l tfv.lst +graphics_map/tfv_backgrounds.inc: + cd graphics_map && make +### + +HELLO: hello.bas + ../asoft_basic-utils/tokenize_asoft < hello.bas > HELLO + + +### clean: rm -f *~ TITLE.GR *.o *.lst ED TFV diff --git a/tfv/art/title.png b/tfv/art/title.png deleted file mode 100644 index 9b343846..00000000 Binary files a/tfv/art/title.png and /dev/null differ diff --git a/tfv/decompress_fast_v2.s b/tfv/decompress_fast_v2.s new file mode 100644 index 00000000..fb2f24ad --- /dev/null +++ b/tfv/decompress_fast_v2.s @@ -0,0 +1,370 @@ +; note -- modified by Vince Weaver to assemble with ca65 +; in this case, A = page to decompress to +; getsrc_smc+1, getsrc_smc+2 is src location + +; ----------------------------------------------------------------------------- +; Decompress raw LZSA2 block. +; Create one with lzsa -r -f2 +; +; in: +; * LZSA_SRC_LO and LZSA_SRC_HI contain the compressed raw block address +; * LZSA_DST_LO and LZSA_DST_HI contain the destination buffer address +; +; out: +; * LZSA_DST_LO and LZSA_DST_HI contain the last decompressed byte address, +1 +; +; ----------------------------------------------------------------------------- +; Backward decompression is also supported, use lzsa -r -b -f2 +; To use it, also define BACKWARD_DECOMPRESS=1 before including this code! +; +; in: +; * LZSA_SRC_LO/LZSA_SRC_HI must contain the address of the last byte of compressed data +; * LZSA_DST_LO/LZSA_DST_HI must contain the address of the last byte of the destination buffer +; +; out: +; * LZSA_DST_LO/LZSA_DST_HI contain the last decompressed byte address, -1 +; +; ----------------------------------------------------------------------------- +; +; Copyright (C) 2019 Emmanuel Marty, Peter Ferrie +; +; This software is provided 'as-is', without any express or implied +; warranty. In no event will the authors be held liable for any damages +; arising from the use of this software. +; +; Permission is granted to anyone to use this software for any purpose, +; including commercial applications, and to alter it and redistribute it +; freely, subject to the following restrictions: +; +; 1. The origin of this software must not be misrepresented; you must not +; claim that you wrote the original software. If you use this software +; in a product, an acknowledgment in the product documentation would be +; appreciated but is not required. +; 2. Altered source versions must be plainly marked as such, and must not be +; misrepresented as being the original software. +; 3. This notice may not be removed or altered from any source distribution. +; ----------------------------------------------------------------------------- + +;NIBCOUNT = $FC ; zero-page location for temp offset + +decompress_lzsa2_fast: + + sta LZSA_DST_HI + + ldy #$00 + sty LZSA_DST_LO + sty NIBCOUNT + +decode_token: + jsr getsrc ; read token byte: XYZ|LL|MMM + pha ; preserve token on stack + + and #$18 ; isolate literals count (LL) + beq no_literals ; skip if no literals to copy + cmp #$18 ; LITERALS_RUN_LEN_V2? + bcc prepare_copy_literals ; if less, count is directly embedded in token + + jsr getnibble ; get extra literals length nibble + ; add nibble to len from token + adc #$02 ; (LITERALS_RUN_LEN_V2) minus carry + cmp #$12 ; LITERALS_RUN_LEN_V2 + 15 ? + bcc prepare_copy_literals_direct ; if less, literals count is complete + + jsr getsrc ; get extra byte of variable literals count + ; the carry is always set by the CMP above + ; GETSRC doesn't change it + sbc #$EE ; overflow? + jmp prepare_copy_literals_direct + +prepare_copy_literals_large: + ; handle 16 bits literals count + ; literals count = directly these 16 bits + jsr getlargesrc ; grab low 8 bits in X, high 8 bits in A + tay ; put high 8 bits in Y + bcs prepare_copy_literals_high ; (*same as JMP PREPARE_COPY_LITERALS_HIGH but shorter) + +prepare_copy_literals: + lsr ; shift literals count into place + lsr + lsr + +prepare_copy_literals_direct: + tax + bcs prepare_copy_literals_large ; if so, literals count is large + +prepare_copy_literals_high: + txa + beq copy_literals + iny + +copy_literals: + jsr getput ; copy one byte of literals + dex + bne copy_literals + dey + bne copy_literals + +no_literals: + pla ; retrieve token from stack + pha ; preserve token again + asl + bcs repmatch_or_large_offset ; 1YZ: rep-match or 13/16 bit offset + + asl ; 0YZ: 5 or 9 bit offset + bcs offset_9_bit + + ; 00Z: 5 bit offset + + ldx #$FF ; set offset bits 15-8 to 1 + + jsr getcombinedbits ; rotate Z bit into bit 0, read nibble for bits 4-1 + ora #$E0 ; set bits 7-5 to 1 + bne got_offset_lo ; go store low byte of match offset and prepare match + +offset_9_bit: ; 01Z: 9 bit offset + ;;asl ; shift Z (offset bit 8) in place + rol + rol + and #$01 + eor #$FF ; set offset bits 15-9 to 1 + bne got_offset_hi ; go store high byte, read low byte of match offset and prepare match + ; (*same as JMP GOT_OFFSET_HI but shorter) + +repmatch_or_large_offset: + asl ; 13 bit offset? + bcs repmatch_or_16bit ; handle rep-match or 16-bit offset if not + + ; 10Z: 13 bit offset + + jsr getcombinedbits ; rotate Z bit into bit 8, read nibble for bits 12-9 + adc #$DE ; set bits 15-13 to 1 and substract 2 (to substract 512) + bne got_offset_hi ; go store high byte, read low byte of match offset and prepare match + ; (*same as JMP GOT_OFFSET_HI but shorter) + +repmatch_or_16bit: ; rep-match or 16 bit offset + ;;ASL ; XYZ=111? + bmi rep_match ; reuse previous offset if so (rep-match) + + ; 110: handle 16 bit offset + jsr getsrc ; grab high 8 bits +got_offset_hi: + tax + jsr getsrc ; grab low 8 bits +got_offset_lo: + sta OFFSLO ; store low byte of match offset + stx OFFSHI ; store high byte of match offset + +rep_match: +.ifdef BACKWARD_DECOMPRESS + + ; Backward decompression - substract match offset + + sec ; add dest + match offset + lda putdst+1 ; low 8 bits +OFFSLO = *+1 + sbc #$AA + sta copy_match_loop+1 ; store back reference address + lda putdst+2 +OFFSHI = *+1 + sbc #$AA ; high 8 bits + sta copy_match_loop+2 ; store high 8 bits of address + sec + +.else + + ; Forward decompression - add match offset + + clc ; add dest + match offset + lda putdst+1 ; low 8 bits +OFFSLO = *+1 + adc #$AA + sta copy_match_loop+1 ; store back reference address +OFFSHI = *+1 + lda #$AA ; high 8 bits + adc putdst+2 + sta copy_match_loop+2 ; store high 8 bits of address +.endif + + pla ; retrieve token from stack again + and #$07 ; isolate match len (MMM) + adc #$01 ; add MIN_MATCH_SIZE_V2 and carry + cmp #$09 ; MIN_MATCH_SIZE_V2 + MATCH_RUN_LEN_V2? + bcc prepare_copy_match ; if less, length is directly embedded in token + + jsr getnibble ; get extra match length nibble + ; add nibble to len from token + adc #$08 ; (MIN_MATCH_SIZE_V2 + MATCH_RUN_LEN_V2) minus carry + cmp #$18 ; MIN_MATCH_SIZE_V2 + MATCH_RUN_LEN_V2 + 15? + bcc prepare_copy_match ; if less, match length is complete + + jsr getsrc ; get extra byte of variable match length + ; the carry is always set by the CMP above + ; GETSRC doesn't change it + sbc #$E8 ; overflow? + +prepare_copy_match: + tax + bcc prepare_copy_match_y ; if not, the match length is complete + beq decompression_done ; if EOD code, bail + + ; Handle 16 bits match length + jsr getlargesrc ; grab low 8 bits in X, high 8 bits in A + tay ; put high 8 bits in Y + +prepare_copy_match_y: + txa + beq copy_match_loop + iny + +copy_match_loop: + lda $AAAA ; get one byte of backreference + jsr putdst ; copy to destination + +.ifdef BACKWARD_DECOMPRESS + + ; Backward decompression -- put backreference bytes backward + + lda copy_match_loop+1 + beq getmatch_adj_hi +getmatch_done: + dec copy_match_loop+1 + +.else + + ; Forward decompression -- put backreference bytes forward + + inc copy_match_loop+1 + beq getmatch_adj_hi +getmatch_done: + +.endif + + dex + bne copy_match_loop + dey + bne copy_match_loop + jmp decode_token + +.ifdef BACKWARD_DECOMPRESS + +getmatch_adj_hi: + dec copy_match_loop+2 + jmp getmatch_done + +.else + +getmatch_adj_hi: + inc copy_match_loop+2 + jmp getmatch_done +.endif + +getcombinedbits: + eor #$80 + asl + php + + jsr getnibble ; get nibble into bits 0-3 (for offset bits 1-4) + plp ; merge Z bit as the carry bit (for offset bit 0) +combinedbitz: + rol ; nibble -> bits 1-4; carry(!Z bit) -> bit 0 ; carry cleared +decompression_done: + rts + +getnibble: +NIBBLES = *+1 + lda #$AA + lsr NIBCOUNT + bcc need_nibbles + and #$0F ; isolate low 4 bits of nibble + rts + +need_nibbles: + inc NIBCOUNT + jsr getsrc ; get 2 nibbles + sta NIBBLES + lsr + lsr + lsr + lsr + sec + rts + +.ifdef BACKWARD_DECOMPRESS + + ; Backward decompression -- get and put bytes backward + +getput: + jsr getsrc +putdst: +LZSA_DST_LO = *+1 +LZSA_DST_HI = *+2 + sta $AAAA + lda putdst+1 + beq putdst_adj_hi + dec putdst+1 + rts + +putdst_adj_hi: + dec putdst+2 + dec putdst+1 + rts + +getlargesrc: + jsr getsrc ; grab low 8 bits + tax ; move to X + ; fall through grab high 8 bits + +getsrc: +LZSA_SRC_LO = *+1 +LZSA_SRC_HI = *+2 + lda $AAAA + pha + lda getsrc+1 + beq getsrc_adj_hi + dec getsrc+1 + pla + rts + +getsrc_adj_hi: + dec getsrc+2 + dec getsrc+1 + pla + rts + +.else + + ; Forward decompression -- get and put bytes forward + +getput: + jsr getsrc +putdst: +LZSA_DST_LO = *+1 +LZSA_DST_HI = *+2 + sta $AAAA + inc putdst+1 + beq putdst_adj_hi + rts + +putdst_adj_hi: + inc putdst+2 + rts + +getlargesrc: + jsr getsrc ; grab low 8 bits + tax ; move to X + ; fall through grab high 8 bits + +getsrc: +getsrc_smc: +LZSA_SRC_LO = *+1 +LZSA_SRC_HI = *+2 + lda $AAAA + inc getsrc+1 + beq getsrc_adj_hi + rts + +getsrc_adj_hi: + inc getsrc+2 + rts +.endif + diff --git a/tfv/gr_fast_clear.s b/tfv/gr_fast_clear.s new file mode 100644 index 00000000..8cc8d152 --- /dev/null +++ b/tfv/gr_fast_clear.s @@ -0,0 +1,201 @@ +clear_screens: + ;=================================== + ; Clear top/bottom of page 0 + ;=================================== + + lda #$0 + sta DRAW_PAGE + jsr clear_top + jsr clear_bottom + + ;=================================== + ; Clear top/bottom of page 1 + ;=================================== + + lda #$4 + sta DRAW_PAGE + jsr clear_top + jsr clear_bottom + + rts + + + + + ;========================================================= + ; clear_top + ;========================================================= + ; clear DRAW_PAGE + ; original = 14,558 cycles(?) 15ms, 70Hz + ; OPTIMIZED MAX (page0,48rows): 45*120+4+6 = 5410 = 5.4ms 185Hz + ; (pageX,40rows): 50*120+4+6 = 6010 = 6.0ms 166Hz + ; 50*120+4+6+37 = 6055 = 6.0ms 166Hz +clear_top: + lda #0 ; 2 +clear_top_a: + sta COLOR ; 3 + clc ; 2 + lda DRAW_PAGE ; 3 + + adc #4 ; 2 + sta __ctf+2 ; 3 + sta __ctf+5 ; 3 + adc #1 ; 2 + sta __ctf+8 ; 3 + sta __ctf+11 ; 3 + adc #1 ; 2 + sta __ctf2+2 ; 3 + sta __ctf2+5 ; 3 + adc #1 ; 2 + sta __ctf2+8 ; 3 + sta __ctf2+11 ; 3 + + + ldy #120 ; 2 + lda COLOR ; 3 +clear_top_fast_loop: +__ctf: + sta $400,Y ; 5 + sta $480,Y ; 5 + sta $500,Y ; 5 + sta $580,Y ; 5 + + cpy #80 ; 2 + bpl no_draw_bottom ; 2nt/3 +__ctf2: + sta $600,Y ; 5 + sta $680,Y ; 5 + sta $700,Y ; 5 + sta $780,Y ; 5 +no_draw_bottom: + + dey ; 2 + bpl clear_top_fast_loop ; 2nt/3 + + rts ; 6 + + + + + ;========================================================= + ; clear_bottom + ;========================================================= + ; clear bottom of draw page + +clear_bottom: + clc ; 2 + lda DRAW_PAGE ; 3 + + adc #6 ; 2 + sta __cbf2+2 ; 3 + sta __cbf2+5 ; 3 + adc #1 ; 2 + sta __cbf2+8 ; 3 + sta __cbf2+11 ; 3 + + + ldy #120 ; 2 + lda #$a0 ; Normal Space ; 2 +clear_bottom_fast_loop: +__cbf2: + sta $600,Y ; 5 + sta $680,Y ; 5 + sta $700,Y ; 5 + sta $780,Y ; 5 + + dey ; 2 + cpy #80 ; 2 + bpl clear_bottom_fast_loop ; 2nt/3 + + rts ; 6 + + +;clear_screens_notext: + ;=================================== + ; Clear top/bottom of page 0 + ;=================================== + +; lda #$0 +; sta DRAW_PAGE +; jsr clear_all + + ;=================================== + ; Clear top/bottom of page 1 + ;=================================== + +; lda #$4 +; sta DRAW_PAGE +; jsr clear_all + +; rts + + +clear_bottoms: + + lda DRAW_PAGE + pha + + ;=================================== + ; Clear bottom of page 0 + ;=================================== + + lda #$0 + sta DRAW_PAGE + jsr clear_bottom + + ;=================================== + ; Clear bottom of page 1 + ;=================================== + + lda #$4 + sta DRAW_PAGE + jsr clear_bottom + + pla + sta DRAW_PAGE + + rts + + + ;========================================================= + ; clear_all + ;========================================================= + ; clear 48 rows + +clear_all: + clc ; 2 + lda DRAW_PAGE ; 3 + + adc #4 ; 2 + sta __caf+2 ; 3 + sta __caf+5 ; 3 + adc #1 ; 2 + sta __caf+8 ; 3 + sta __caf+11 ; 3 + adc #1 ; 2 + sta __caf2+2 ; 3 + sta __caf2+5 ; 3 + adc #1 ; 2 + sta __caf2+8 ; 3 + sta __caf2+11 ; 3 + + + ldy #120 ; 2 +clear_all_color: + lda #' '|$80 ; 2 +clear_all_fast_loop: +__caf: + sta $400,Y ; 5 + sta $480,Y ; 5 + sta $500,Y ; 5 + sta $580,Y ; 5 +__caf2: + sta $600,Y ; 5 + sta $680,Y ; 5 + sta $700,Y ; 5 + sta $780,Y ; 5 + + dey ; 2 + bpl clear_all_fast_loop ; 2nt/3 + + rts ; 6 diff --git a/tfv/art/Apple II Lowres.gpl b/tfv/graphics_map/Apple II Lowres.gpl similarity index 100% rename from tfv/art/Apple II Lowres.gpl rename to tfv/graphics_map/Apple II Lowres.gpl diff --git a/tfv/graphics_map/Makefile b/tfv/graphics_map/Makefile new file mode 100644 index 00000000..d6e334bc --- /dev/null +++ b/tfv/graphics_map/Makefile @@ -0,0 +1,33 @@ +include ../../Makefile.inc + +PNG2RLE = ../../gr-utils/png2rle +PNG2GR = ../../gr-utils/png2gr +LZSA = ~/research/lzsa/lzsa/lzsa + +tfv_backgrounds.inc: \ + title.lzsa map.lzsa landing.lzsa harfco.lzsa \ + belair.lzsa math_office.lzsa video_hr.lzsa \ + collegep.lzsa umcp.lzsa dining.lzsa metro.lzsa \ + talbot.lzsa + echo "title_lzsa: .incbin \"title.lzsa\"" > tfv_backgrounds.inc + echo "map_lzsa: .incbin \"map.lzsa\"" >> tfv_backgrounds.inc + echo "landing_lzsa: .incbin \"landing.lzsa\"" >> tfv_backgrounds.inc + echo "harfco_lzsa: .incbin \"harfco.lzsa\"" >> tfv_backgrounds.inc + echo "belair_lzsa: .incbin \"belair.lzsa\"" >> tfv_backgrounds.inc + echo "math_office_lzsa: .incbin \"math_office.lzsa\"" >> tfv_backgrounds.inc + echo "video_hr_lzsa: .incbin \"video_hr.lzsa\"" >> tfv_backgrounds.inc + echo "collegep_lzsa: .incbin \"collegep.lzsa\"" >> tfv_backgrounds.inc + echo "umcp_lzsa: .incbin \"umcp.lzsa\"" >> tfv_backgrounds.inc + echo "dining_lzsa: .incbin \"dining.lzsa\"" >> tfv_backgrounds.inc + echo "metro_lzsa: .incbin \"metro.lzsa\"" >> tfv_backgrounds.inc + echo "talbot_lzsa: .incbin \"talbot.lzsa\"" >> tfv_backgrounds.inc + +%.gr: %.png + $(PNG2GR) $< $@ + +%.lzsa: %.gr + $(LZSA) -r -f2 $< $@ + +clean: + rm -f *~ tfv_backgrounds.inc + diff --git a/tfv/art/ap_calculus.png b/tfv/graphics_map/ap_calculus.png similarity index 100% rename from tfv/art/ap_calculus.png rename to tfv/graphics_map/ap_calculus.png diff --git a/tfv/art/belair.png b/tfv/graphics_map/belair.png similarity index 100% rename from tfv/art/belair.png rename to tfv/graphics_map/belair.png diff --git a/tfv/art/collegep.png b/tfv/graphics_map/collegep.png similarity index 100% rename from tfv/art/collegep.png rename to tfv/graphics_map/collegep.png diff --git a/tfv/art/concept/worldmap.piskel b/tfv/graphics_map/concept/worldmap.piskel similarity index 100% rename from tfv/art/concept/worldmap.piskel rename to tfv/graphics_map/concept/worldmap.piskel diff --git a/tfv/art/concept/worldmap.png b/tfv/graphics_map/concept/worldmap.png similarity index 100% rename from tfv/art/concept/worldmap.png rename to tfv/graphics_map/concept/worldmap.png diff --git a/tfv/art/deutsch.png b/tfv/graphics_map/deutsch.png similarity index 100% rename from tfv/art/deutsch.png rename to tfv/graphics_map/deutsch.png diff --git a/tfv/art/dining.png b/tfv/graphics_map/dining.png similarity index 100% rename from tfv/art/dining.png rename to tfv/graphics_map/dining.png diff --git a/tfv/art/fountain.png b/tfv/graphics_map/fountain.png similarity index 100% rename from tfv/art/fountain.png rename to tfv/graphics_map/fountain.png diff --git a/tfv/art/harfco.png b/tfv/graphics_map/harfco.png similarity index 100% rename from tfv/art/harfco.png rename to tfv/graphics_map/harfco.png diff --git a/tfv/art/homeroom.png b/tfv/graphics_map/homeroom.png similarity index 100% rename from tfv/art/homeroom.png rename to tfv/graphics_map/homeroom.png diff --git a/tfv/art/jc.png b/tfv/graphics_map/jc.png similarity index 100% rename from tfv/art/jc.png rename to tfv/graphics_map/jc.png diff --git a/tfv/art/jc_hallway.png b/tfv/graphics_map/jc_hallway.png similarity index 100% rename from tfv/art/jc_hallway.png rename to tfv/graphics_map/jc_hallway.png diff --git a/tfv/art/jc_office.png b/tfv/graphics_map/jc_office.png similarity index 100% rename from tfv/art/jc_office.png rename to tfv/graphics_map/jc_office.png diff --git a/tfv/art/landing.png b/tfv/graphics_map/landing.png similarity index 100% rename from tfv/art/landing.png rename to tfv/graphics_map/landing.png diff --git a/tfv/art/map.png b/tfv/graphics_map/map.png similarity index 100% rename from tfv/art/map.png rename to tfv/graphics_map/map.png diff --git a/tfv/art/math_office.png b/tfv/graphics_map/math_office.png similarity index 100% rename from tfv/art/math_office.png rename to tfv/graphics_map/math_office.png diff --git a/tfv/art/metro.png b/tfv/graphics_map/metro.png similarity index 100% rename from tfv/art/metro.png rename to tfv/graphics_map/metro.png diff --git a/tfv/art/mirror_lake.png b/tfv/graphics_map/mirror_lake.png similarity index 100% rename from tfv/art/mirror_lake.png rename to tfv/graphics_map/mirror_lake.png diff --git a/tfv/art/patriot_room.png b/tfv/graphics_map/patriot_room.png similarity index 100% rename from tfv/art/patriot_room.png rename to tfv/graphics_map/patriot_room.png diff --git a/tfv/art/puzzle.png b/tfv/graphics_map/puzzle.png similarity index 100% rename from tfv/art/puzzle.png rename to tfv/graphics_map/puzzle.png diff --git a/tfv/art/sprites.piskel b/tfv/graphics_map/sprites.piskel similarity index 100% rename from tfv/art/sprites.piskel rename to tfv/graphics_map/sprites.piskel diff --git a/tfv/art/sprites.png b/tfv/graphics_map/sprites.png similarity index 100% rename from tfv/art/sprites.png rename to tfv/graphics_map/sprites.png diff --git a/tfv/art/talbot.png b/tfv/graphics_map/talbot.png similarity index 100% rename from tfv/art/talbot.png rename to tfv/graphics_map/talbot.png diff --git a/tfv/art/title.piskel b/tfv/graphics_map/title.piskel similarity index 100% rename from tfv/art/title.piskel rename to tfv/graphics_map/title.piskel diff --git a/tfv/graphics_map/title.png b/tfv/graphics_map/title.png new file mode 100644 index 00000000..bfdc128f Binary files /dev/null and b/tfv/graphics_map/title.png differ diff --git a/tfv/art/umcp.png b/tfv/graphics_map/umcp.png similarity index 100% rename from tfv/art/umcp.png rename to tfv/graphics_map/umcp.png diff --git a/tfv/art/video_hr.png b/tfv/graphics_map/video_hr.png similarity index 100% rename from tfv/art/video_hr.png rename to tfv/graphics_map/video_hr.png diff --git a/tfv/art/waterfall.png b/tfv/graphics_map/waterfall.png similarity index 100% rename from tfv/art/waterfall.png rename to tfv/graphics_map/waterfall.png diff --git a/tfv/hardware.inc b/tfv/hardware.inc new file mode 100644 index 00000000..905b8dd8 --- /dev/null +++ b/tfv/hardware.inc @@ -0,0 +1,98 @@ +;; HARDWARE LOCATIONS + +KEYPRESS = $C000 +KEYRESET = $C010 + +;; SOFT SWITCHES +CLR80COL = $C000 ; PAGE0/PAGE1 normal +SET80COL = $C001 ; PAGE0/PAGE1 switches PAGE0 in Aux instead +EIGHTYCOLOFF = $C00C +EIGHTYCOLON = $C00D +TBCOLOR = $C022 ; IIgs text foreground / background colors +NEWVIDEO = $C029 ; IIgs graphics modes +SPEAKER = $C030 +CLOCKCTL = $C034 ; bits 0-3 are IIgs border color +SET_GR = $C050 +SET_TEXT = $C051 +FULLGR = $C052 +TEXTGR = $C053 +PAGE0 = $C054 +PAGE1 = $C055 +LORES = $C056 ; Enable LORES graphics +HIRES = $C057 ; Enable HIRES graphics +AN3 = $C05E ; Annunciator 3 + + + + + + + +PADDLE_BUTTON0 = $C061 +PADDL0 = $C064 +PTRIG = $C070 + +;; BASIC ROUTINES + +NORMAL = $F273 + +;; MONITOR ROUTINES + +HLINE = $F819 ;; HLINE Y,$2C at A +VLINE = $F828 ;; VLINE A,$2D at Y +CLRSCR = $F832 ;; Clear low-res screen +CLRTOP = $F836 ;; clear only top of low-res screen +SETCOL = $F864 ;; COLOR=A +ROM_TEXT2COPY = $F962 ;; iigs +TEXT = $FB36 +TABV = $FB5B ;; VTAB to A +ROM_MACHINEID = $FBB3 ;; iigs +BELL = $FBDD ;; ring the bell +BASCALC = $FBC1 ;; +VTAB = $FC22 ;; VTAB to CV +HOME = $FC58 ;; Clear the text screen +WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us +CROUT1 = $FD8B +SETINV = $FE80 ;; INVERSE +SETNORM = $FE84 ;; NORMAL +COUT = $FDED ;; output A to screen +COUT1 = $FDF0 ;; output A to screen + + + + + + + +COLOR_BLACK = 0 +COLOR_RED = 1 +COLOR_DARKBLUE = 2 +COLOR_PURPLE = 3 +COLOR_DARKGREEN = 4 +COLOR_GREY = 5 +COLOR_MEDIUMBLUE = 6 +COLOR_LIGHTBLUE = 7 +COLOR_BROWN = 8 +COLOR_ORANGE = 9 +COLOR_GREY2 = 10 +COLOR_PINK = 11 +COLOR_LIGHTGREEN = 12 +COLOR_YELLOW = 13 +COLOR_AQUA = 14 +COLOR_WHITE = 15 + +COLOR_BOTH_BLACK = $00 +COLOR_BOTH_RED = $11 +COLOR_BOTH_DARKBLUE = $22 +COLOR_BOTH_DARKGREEN = $44 +COLOR_BOTH_GREY = $55 +COLOR_BOTH_MEDIUMBLUE = $66 +COLOR_BOTH_LIGHTBLUE = $77 +COLOR_BOTH_BROWN = $88 +COLOR_BOTH_ORANGE = $99 +COLOR_BOTH_PINK = $BB +COLOR_BOTH_LIGHTGREEN = $CC +COLOR_BOTH_YELLOW = $DD +COLOR_BOTH_AQUA = $EE +COLOR_BOTH_WHITE = $FF + diff --git a/tfv/multiply_fast.s b/tfv/multiply_fast.s new file mode 100644 index 00000000..ccebde03 --- /dev/null +++ b/tfv/multiply_fast.s @@ -0,0 +1,351 @@ +; Fast mutiply + + +; Note for our purposes we only care about 8.8 x 8.8 fixed point +; with 8.8 result, which means we only care about the middle two bytes +; of the 32 bit result. So we disable generation of the high and low byte +; to save some cycles. + +; +; The old routine took around 700 cycles for a 16bitx16bit=32bit mutiply +; This routine, at an expense of 2kB of looku tables, takes around 250 +; If you reuse a term the next time this drops closer to 200 + +; This routine was described by Stephen Judd and found +; in The Fridge and in the C=Hacking magazine +; http://codebase64.org/doku.php?id=base:seriously_fast_multiplication + +; The key thing to note is that +; (a+b)^2 (a-b)^2 +; a*b = ------- - -------- +; 4 4 +; So if you have tables of the squares of 0..511 you can lookup and subtract +; instead of multiplying. + +; Table generation: I:0..511 +; square1_lo = <((I*I)/4) +; square1_hi = >((I*I)/4) +; square2_lo = <(((I-255)*(I-255))/4) +; square2_hi = >(((I-255)*(I-255))/4) + +; Note: DOS3.3 starts at $9600 + +.ifndef square1_lo +square1_lo = $8E00 +square1_hi = $9000 +square2_lo = $9200 +square2_hi = $9400 +.endif + +; for(i=0;i<512;i++) { +; square1_lo[i]=((i*i)/4)&0xff; +; square1_hi[i]=(((i*i)/4)>>8)&0xff; +; square2_lo[i]=( ((i-255)*(i-255))/4)&0xff; +; square2_hi[i]=(( ((i-255)*(i-255))/4)>>8)&0xff; +; } + +init_multiply_tables: + + ; Build the add tables + + ldx #$00 + txa + .byte $c9 ; CMP #immediate - skip TYA and clear carry flag +lb1: tya + adc #$00 ; 0 +ml1: sta square1_hi,x ; square1_hi[0]=0 + tay ; y=0 + cmp #$40 ; subtract 64 and update flags (c=0) + txa ; a=0 + ror ; rotate +ml9: adc #$00 ; add 0 + sta ml9+1 ; update add value + inx ; x=1 +ml0: sta square1_lo,x ; square1_lo[0]=1 + bne lb1 ; if not zero, loop + inc ml0+2 ; increment values + inc ml1+2 ; increment values + clc ; c=0 + iny ; y=1 + bne lb1 ; loop + + ; Build the subtract tables based on the existing one + + ldx #$00 + ldy #$ff +second_table: + lda square1_hi+1,x + sta square2_hi+$100,x + lda square1_hi,x + sta square2_hi,y + lda square1_lo+1,x + sta square2_lo+$100,x + lda square1_lo,x + sta square2_lo,y + dey + inx + bne second_table + + + rts + + +; Fast 16x16 bit unsigned multiplication, 32-bit result +; Input: NUM1H:NUM1L * NUM2H:NUM2L +; Result: RESULT3:RESULT2:RESULT1:RESULT0 +; +; Does self-modifying code to hard-code NUM1H:NUM1L into the code +; carry=0: re-use previous NUM1H:NUM1L +; carry=1: reload NUM1H:NUM1L (58 cycles slower) +; +; clobbered: RESULT, X, A, C +; Allocation setup: T1,T2 and RESULT preferably on Zero-page. +; +; NUM1H (x_i), NUM1L (x_f) +; NUM2H (y_i), NUM2L (y_f) + +; NUM1L * NUM2L = AAaa +; NUM1L * NUM2H = BBbb +; NUM1H * NUM2L = CCcc +; NUM1H * NUM2H = DDdd +; +; AAaa +; BBbb +; CCcc +; + DDdd +; ---------- +; RESULT + +;fixed_16x16_mul_unsigned: + +multiply: + + bcc num1_same_as_last_time ; 2nt/3 + + ;============================ + ; Set up self-modifying code + ; this changes the code to be hard-coded to multiply by NUM1H:NUM1L + ;============================ + + lda NUM1L ; load the low byte ; 3 + sta sm1a+1 ; 3 + sta sm3a+1 ; 3 + sta sm5a+1 ; 3 + sta sm7a+1 ; 3 + eor #$ff ; invert the bits for subtracting ; 2 + sta sm2a+1 ; 3 + sta sm4a+1 ; 3 + sta sm6a+1 ; 3 + sta sm8a+1 ; 3 + lda NUM1H ; load the high byte ; 3 + sta sm1b+1 ; 3 + sta sm3b+1 ; 3 + sta sm5b+1 ; 3 +; sta sm7b+1 ; + eor #$ff ; invert the bits for subtractin ; 2 + sta sm2b+1 ; 3 + sta sm4b+1 ; 3 + sta sm6b+1 ; 3 +; sta sm8b+1 ; + ;=========== + ; 52 + +num1_same_as_last_time: + + ;========================== + ; Perform NUM1L * NUM2L = AAaa + ;========================== + + ldx NUM2L ; (low le) ; 3 + sec ; 2 +sm1a: + lda square1_lo,x ; 4 +sm2a: + sbc square2_lo,x ; 4 + + ; a is _aa + +; sta RESULT+0 ; + +sm3a: + lda square1_hi,x ; 4 +sm4a: + sbc square2_hi,x ; 4 + ; a is _AA + sta _AA+1 ; 3 + ;=========== + ; 24 + + ; Perform NUM1H * NUM2L = CCcc + sec ; 2 +sm1b: + lda square1_lo,x ; 4 +sm2b: + sbc square2_lo,x ; 4 + ; a is _cc + sta _cc+1 ; 3 +sm3b: + lda square1_hi,x ; 4 +sm4b: + sbc square2_hi,x ; 4 + ; a is _CC + sta _CC+1 ; 3 + ;=========== + ; 24 + + ;========================== + ; Perform NUM1L * NUM2H = BBbb + ;========================== + ldx NUM2H ; 3 + sec ; 2 +sm5a: + lda square1_lo,x ; 4 +sm6a: + sbc square2_lo,x ; 4 + ; a is _bb + sta _bb+1 ; 3 + +sm7a: + lda square1_hi,x ; 4 +sm8a: + sbc square2_hi,x ; 4 + ; a is _BB + sta _BB+1 ; 3 + ;=========== + ; 27 + + ;========================== + ; Perform NUM1H * NUM2H = DDdd + ;========================== + sec ; 2 +sm5b: + lda square1_lo,x ; 4 +sm6b: + sbc square2_lo,x ; 4 + ; a is _dd + sta _dd+1 ; 3 +;sm7b: +; lda square1_hi,x ; +;sm8b: +; sbc square2_hi,x ; + ; a = _DD +; sta RESULT+3 ; + ;=========== + ; 13 + + ;=========================================== + ; Add the separate multiplications together + ;=========================================== + + clc ; 2 +_AA: + lda #0 ; loading _AA ; 2 +_bb: + adc #0 ; adding in _bb ; 2 + sta RESULT+1 ; 3 + ;========== + ; 9 + ; product[2]=_BB+_CC+c + +_BB: + lda #0 ; loading _BB ; 2 +_CC: + adc #0 ; adding in _CC ; 2 + sta RESULT+2 ; 3 + ;=========== + ; 7 + + ; product[3]=_DD+c + +; bcc dd_no_carry1 ; +; inc RESULT+3 ; + clc ; 2 + ;============= + ; 2 +dd_no_carry1: + + ; product[1]=_AA+_bb+_cc + +_cc: + lda #0 ; load _cc ; 2 + adc RESULT+1 ; 3 + sta RESULT+1 ; 3 + + ; product[2]=_BB+_CC+_dd+c + +_dd: + lda #0 ; load _dd ; 2 + adc RESULT+2 ; 3 + sta RESULT+2 ; 3 + + ;=========== + ; 16 + ; product[3]=_DD+c + + +; bcc dd_no_carry2 ; +; inc RESULT+3 ; + + ;============= + ; 0 + +dd_no_carry2: + +; *z_i=product[1]; +; *z_f=product[0]; + +; rts ; 6 + + + ;================= + ; Signed multiply + ;================= + +;multiply: + +; jsr fixed_16x16_mul_unsigned ; 6 + + lda NUM1H ; x_i ; 3 + ;=========== + ; 12 + + + bpl x_positive ;^3/2nt + + sec ; 2 + lda RESULT+2 ; 3 + sbc NUM2L ; 3 + sta RESULT+2 ; 3 +; lda RESULT+3 ; +; sbc NUM2H ; +; sta RESULT+3 ; + ;============ + ; 10 + +x_positive: + + lda NUM2H ; y_i ; 3 + ;============ + ; ; 6 + + bpl y_positive ;^3/2nt + + + sec ; 2 + lda RESULT+2 ; 3 + sbc NUM1L ; 3 + sta RESULT+2 ; 3 +; lda RESULT+3 ; +; sbc NUM1H ; +; sta RESULT+3 ; + ;=========== + ; 10 + +y_positive: + ldx RESULT+2 ; *z_i=product[2]; ; 3 + lda RESULT+1 ; *z_f=product[1]; ; 3 + + rts ; 6 + ;========== + ; 12 + diff --git a/tfv/tfv.s b/tfv/tfv.s index 69b2eecf..23754a5a 100644 --- a/tfv/tfv.s +++ b/tfv/tfv.s @@ -1,4 +1,5 @@ .include "tfv_zp.inc" +.include "hardware.inc" ;================================ ; Clear screen and setup graphics @@ -90,7 +91,7 @@ exit: .include "tfv_worldmap.s" .include "tfv_info.s" -.include "../asm_routines/gr_fast_clear.s" +.include "gr_fast_clear.s" .include "../asm_routines/gr_hlin.s" .include "../asm_routines/pageflip.s" .include "../asm_routines/gr_setpage.s" @@ -100,7 +101,8 @@ exit: .include "../asm_routines/memset.s" .include "../asm_routines/gr_vlin.s" .include "../asm_routines/gr_copy.s" -.include "../asm_routines/gr_unrle.s" +;.include "../asm_routines/gr_unrle.s" +.include "decompress_fast_v2.s" .include "../asm_routines/gr_offsets.s" ;=============================================== @@ -115,4 +117,4 @@ name: .include "tfv_sprites.inc" -.include "tfv_backgrounds.inc" +.include "graphics_map/tfv_backgrounds.inc" diff --git a/tfv/tfv_backgrounds.inc b/tfv/tfv_backgrounds.inc deleted file mode 100644 index 1ec99919..00000000 --- a/tfv/tfv_backgrounds.inc +++ /dev/null @@ -1,419 +0,0 @@ -title_rle: .byte $28 ; ysize=40 - .byte $00, $A0,$19,$20, $AF,$00, $22, $A3,$66, $22, $62 - .byte $66, $62, $22, $66, $A3,$22, $66, $26 - .byte $62, $22, $62, $26, $62, $22, $A3,$66 - .byte $22, $55, $00, $A3,$11, $44, $A3,$22, $44 - .byte $A3,$22, $00,$00, $22,$22, $66, $22,$22, $66, $62 - .byte $66, $22, $66, $A3,$22, $66, $26, $62 - .byte $22, $66, $22, $66, $22,$22, $66, $22,$22 - .byte $55, $00, $01, $11, $41, $44, $42 - .byte $22, $42, $44, $42, $22, $02, $00,$00 - .byte $22,$22, $66, $22,$22, $66, $22, $66, $22 - .byte $A3,$66, $22, $66, $62, $26, $22, $26 - .byte $62, $26, $22,$22, $66, $22,$22, $55, $00,$00 - .byte $11, $A3,$44, $22, $A3,$44, $22, $A3,$00, $02 - .byte $A0,$18,$52, $55, $AE,$00, $A0,$1E,$60, $AA,$00, $66, $A3,$22 - .byte $66, $26, $22, $26, $66, $22, $26 - .byte $66, $22, $66, $A3,$22, $66, $26, $22 - .byte $26, $66, $26, $62,$62, $66, $22, $66 - .byte $22, $66, $55, $A9,$00, $66, $22, $26 - .byte $66,$66, $22, $26, $22, $66, $22, $62 - .byte $26, $22, $66,$66, $22, $66,$66, $22, $26 - .byte $22, $66, $22, $26,$26, $66, $62, $26 - .byte $62, $66, $55, $A9,$00, $66, $22, $A3,$66 - .byte $22, $66, $22, $66, $22, $66, $62 - .byte $22, $66,$66, $22, $66,$66, $22, $66, $22 - .byte $66, $26,$26, $22, $66,$66, $22, $66,$66, $55 - .byte $A9,$00, $06, $A0,$1D,$56, $55, $A3,$00, $10, $A0,$24,$00 - .byte $10, $00, $10, $11, $01, $A5,$00, $A8,$CC - .byte $40, $A9,$00, $D0, $0D, $00, $D0, $0D - .byte $00, $D0, $A5,$00, $11, $AA,$00, $04, $A4,$54 - .byte $CC,$CC, $44, $55, $A6,$00, $D0, $DD, $D0,$D0 - .byte $DD, $D0,$D0, $DD, $D0, $A3,$00, $01,$01, $11 - .byte $01,$01, $AC,$00, $CC,$CC, $44, $54, $55, $A6,$00 - .byte $DD, $A7,$BB, $DD, $A4,$00, $10, $11, $10 - .byte $AC,$00, $CC,$CC, $44, $54, $55, $A7,$00, $DD - .byte $BB, $BF, $B0, $BB, $BF, $B0, $BB - .byte $DD, $A3,$00, $10, $A3,$11, $10, $AA,$00, $CC,$CC - .byte $44, $54, $55, $A8,$00, $DD, $DB, $BB - .byte $3B, $33, $BB,$BB, $DB, $DD, $A3,$00, $01,$01 - .byte $11, $01,$01, $AA,$00, $CC,$CC, $44, $55, $A9,$00 - .byte $DD,$DD, $A5,$BB, $DD,$DD, $A5,$00, $11, $AC,$00, $CC,$CC - .byte $44, $55, $A9,$00, $0D, $00, $BB, $A3,$B1 - .byte $BB, $00, $0D, $A4,$00, $BB,$BB, $AC,$00, $0C - .byte $4C, $44, $55, $AC,$00, $BB,$BB, $A6,$00, $20 - .byte $22, $2B, $0B, $AE,$00, $05,$05, $A9,$00, $20 - .byte $A6,$22, $A3,$20, $22,$22, $02, $A9,$00 - .byte $A1 -map_rle: .byte $28 ; ysize=40 - .byte $A0,$23,$66, $46, $06, $A5,$66, $56, $AE,$66, $E6 - .byte $A4,$66, $77, $FF, $F6, $A8,$66, $46, $A3,$44 - .byte $A3,$66, $E6, $56, $55, $56, $E6, $AB,$66 - .byte $6E, $66, $6E, $66,$66, $67, $A4,$6F, $A7,$66 - .byte $4F, $47, $4F, $44, $AB,$66, $A0,$17,$D6, $A3,$66 - .byte $64, $A3,$44, $46, $A8,$66, $DD, $A7,$FF, $4F - .byte $A5,$FF, $8F, $88, $8F, $FF, $7F, $77 - .byte $07, $77, $07, $77, $DD, $A3,$66, $E6 - .byte $A3,$E4, $E6, $A7,$66, $DD, $A6,$FF, $F4, $84 - .byte $F4, $A4,$FF, $8F, $A3,$FF, $7F, $77, $A3,$75 - .byte $77, $DD, $AF,$66, $DD, $AC,$CF, $A3,$C8, $A3,$CF - .byte $A5,$C7, $DD, $AA,$66, $E6, $A4,$66, $DD, $CC,$CC - .byte $4C, $A3,$CC, $77, $A6,$CC, $8C, $88, $8C - .byte $CC, $4C, $A5,$44, $DD, $A9,$66, $6E, $66 - .byte $6E, $A3,$66, $DD, $CC, $4C, $44, $4C - .byte $CC, $22, $A3,$FF, $22, $A3,$CC, $8C, $A3,$CC - .byte $C4, $A5,$44, $DD, $AC,$66, $E6, $66,$66, $DD - .byte $CC,$CC, $C8, $CC,$CC, $C2, $C7,$C7, $CF, $C2,$C2 - .byte $CC, $A3,$C8, $A3,$CC, $C8, $CC, $C8, $CC - .byte $C8, $DD, $AB,$66, $6E, $66, $6E, $66 - .byte $DD, $4C, $84, $C4, $AA,$CC, $8C, $88 - .byte $8C, $CC, $4C, $A5,$44, $DD, $AF,$66, $DD - .byte $C4, $CC, $88, $AA,$CC, $8C, $A3,$CC, $A6,$44 - .byte $DD, $66,$66, $55, $56, $66,$66, $55, $A8,$66 - .byte $DD, $A5,$CC, $A5,$9C, $CC, $1C, $A3,$C8, $1C - .byte $CC,$CC, $84, $C4, $84, $C4, $84, $DD - .byte $66,$66, $55, $66, $65, $56, $55, $A8,$66 - .byte $DD, $A3,$CC, $4C,$4C, $99, $49, $44, $99,$99 - .byte $CC, $11, $C1, $1C, $C1, $11, $A7,$CC - .byte $DD, $66,$66, $65, $A3,$66, $65, $66,$66, $6E - .byte $E6, $6E, $A3,$66, $DD, $CC,$CC, $44, $C8 - .byte $8C, $99, $94, $44, $94, $99, $CC - .byte $C1, $A3,$CC, $C1, $A7,$CC, $DD, $A3,$66, $16 - .byte $91, $16, $A4,$66, $EE, $A4,$66, $6D, $A4,$DC - .byte $D8, $D9,$D9, $D4, $D9,$D9, $DC,$DC, $8C, $88 - .byte $8E, $EE, $A7,$DC, $6D, $A3,$66, $69, $99 - .byte $69, $A3,$66, $05, $55, $66, $55, $65 - .byte $A0,$1C,$66, $86, $96, $99, $96, $86, $66,$66 - .byte $A4,$65, $A0,$1F,$66, $99, $A0,$1B,$66, $E6, $6E, $E6 - .byte $A9,$66, $69, $A0,$2B,$66 - .byte $A1 -landing_rle: .byte $28 ; ysize=40 - .byte $A3,$66, $56, $A0,$27,$66, $55, $F5, $A0,$26,$66, $55 - .byte $FF, $F5, $A0,$25,$66, $55, $FF,$FF, $F5, $A0,$24,$66 - .byte $55, $A3,$FF, $F5, $A0,$20,$66, $CC, $2C, $CC - .byte $55, $AF,$F5, $A4,$22, $A0,$12,$CC, $62, $22, $55 - .byte $FF, $A3,$11, $44, $A3,$22, $44, $A3,$22, $A3,$FF - .byte $A5,$22, $A0,$11,$CC, $22, $26, $55, $FF,$FF, $11 - .byte $A3,$44, $22, $A3,$44, $22, $A4,$FF, $A6,$22, $A0,$10,$CC - .byte $26,$26, $55, $FF,$FF, $F1, $A3,$F4, $F2, $A3,$F4 - .byte $F2, $FF, $8F,$8F, $FF, $A7,$22, $AF,$CC, $62 - .byte $26, $55, $AA,$5F, $FF,$FF, $88,$88, $FF, $A8,$22 - .byte $AE,$CC, $22, $C2, $55, $A9,$FF, $55, $FF,$FF - .byte $88,$88, $AA,$FF, $AF,$CC, $A3,$C5, $85, $A9,$C5, $85,$85 - .byte $A4,$C5, $85, $A5,$C5, $A0,$11,$CC, $C8, $A9,$CC, $A4,$85 - .byte $A4,$CC, $C8, $A0,$1E,$CC, $A6,$85, $A0,$FF,$CC, $A5,$CC - .byte $A1 -harfco_rle: .byte $28 ; ysize=40 - .byte $A5,$00, $A0,$1D,$5A, $77, $A9,$00, $F0, $00, $A0,$1B,$5A - .byte $77, $A3,$00, $F0, $A3,$00, $F0, $A0,$17,$00, $F0 - .byte $A0,$15,$00, $0F, $A0,$19,$00, $F0, $A0,$16,$00, $0F, $A0,$17,$00 - .byte $A0,$28,$22, $A0,$1D,$77, $72, $AA,$22, $A0,$1F,$77, $72, $A8,$22 - .byte $A0,$21,$77, $72, $A6,$22, $A0,$11,$77, $07, $77, $A5,$07 - .byte $77, $00, $77, $07, $A7,$77, $A5,$22, $AC,$77 - .byte $57, $00, $57, $00, $57, $00, $57 - .byte $A5,$00, $57, $00, $57, $00, $57, $A7,$77 - .byte $A4,$22, $AB,$77, $75, $55, $50, $A3,$55, $50 - .byte $A9,$55, $50, $55, $75, $A7,$77, $A3,$22, $A0,$25,$77 - .byte $A3,$22, $A0,$24,$77, $27, $A3,$22, $A0,$24,$77, $A4,$22, $A0,$22,$77 - .byte $27, $A5,$22, $A0,$21,$77, $27, $A6,$22, $A0,$20,$77, $27 - .byte $A7,$22, $A0,$1F,$77, $27, $A8,$22, $A0,$1E,$77, $27, $A9,$22 - .byte $A1 -belair_rle: .byte $28 ; ysize=40 - .byte $AA,$00, $05, $57, $75, $57, $75, $57 - .byte $75, $57, $75, $57, $75, $57, $75 - .byte $57, $75, $57, $75, $57, $75, $57 - .byte $05, $AB,$00, $70, $A9,$00, $05, $AF,$57, $05 - .byte $A5,$00, $0D, $D0, $A5,$00, $07, $7F, $07 - .byte $A5,$00, $70, $F7, $70, $A0,$17,$00, $DD, $AE,$00 - .byte $07, $A0,$17,$00, $0D, $AD,$00, $70, $A0,$1C,$00, $60 - .byte $E6, $60, $A7,$00, $07, $7F, $07, $A6,$00 - .byte $50, $A6,$85, $50, $AE,$00, $06, $AC,$00, $A5,$50 - .byte $A8,$88, $A0,$10,$00, $50,$50, $20, $A3,$22, $92, $D9 - .byte $A3,$50, $88, $98, $88, $98, $55, $88 - .byte $89, $88, $08,$08, $88, $89, $88, $A3,$50 - .byte $A6,$40, $A7,$50, $20, $A3,$22, $92, $D9, $0D - .byte $D9, $A3,$00, $A4,$88, $55, $A3,$88, $00,$00, $A3,$88 - .byte $A3,$00, $A6,$74, $A7,$00, $22,$22, $92, $D9, $0D - .byte $D9, $9D, $D9, $A9,$00, $08, $88, $00,$00 - .byte $88, $08, $A4,$00, $77, $07, $E7,$E7, $07 - .byte $77, $A7,$00, $88, $D9, $0D, $D9, $9D - .byte $D9, $0D, $D9, $A0,$13,$00, $77, $00, $EE,$EE - .byte $00, $77, $A7,$00, $88, $D9, $9D, $D9 - .byte $0D, $D9, $9D, $09, $A0,$13,$00, $77,$77, $EE,$EE - .byte $77,$77, $A4,$00, $D0, $10, $00, $88, $D9 - .byte $0D, $D9, $00, $09, $A0,$1F,$00, $DD, $11 - .byte $01, $88, $D9, $9D, $09, $A0,$21,$00, $DD - .byte $00,$00, $08, $09, $A0,$20,$00, $40, $44, $04 - .byte $DD, $04, $44, $A0,$23,$00, $A5,$04, $A0,$A0,$00 - .byte $A1 -math_office_rle: .byte $28 ; ysize=40 - .byte $A0,$19,$00, $AF,$44, $A0,$19,$00, $44, $FF, $4F, $F4 - .byte $44,$44, $F4, $FF, $F4, $44,$44, $FF, $F4 - .byte $44, $FF, $A0,$19,$00, $44, $FF, $4F, $F4 - .byte $44, $4F, $44, $FF, $44, $4F, $44 - .byte $FF, $44, $4F, $FF, $A0,$19,$00, $44, $4F,$4F - .byte $A4,$44, $4F, $A3,$44, $4F, $44,$44, $4F, $A0,$19,$00 - .byte $AF,$44, $AB,$00, $80,$80, $A7,$00, $B8, $88, $00,$00 - .byte $0A, $AF,$07, $AB,$00, $88, $BB, $B0, $A5,$00 - .byte $0B, $BB, $88, $A4,$00, $B8, $88, $AE,$00 - .byte $88, $B8, $A7,$00, $88, $FB, $A7,$00, $2B - .byte $A4,$00, $0B, $BB, $88, $AE,$00, $88, $BB - .byte $0B, $A6,$00, $F8, $FF, $F0, $A5,$00, $44 - .byte $22, $A5,$00, $FF, $08, $80, $AD,$00, $88 - .byte $F0, $A7,$00, $7F, $11, $7F, $A4,$70, $11 - .byte $74, $72, $A3,$70, $11, $7F,$7F, $A6,$70, $A9,$00 - .byte $77, $7F, $B0, $A4,$00, $70, $77,$77, $71 - .byte $A5,$77, $71, $A5,$77, $71, $A6,$77, $57, $55 - .byte $A9,$00, $4F,$4F, $A4,$00, $A0,$16,$57, $55, $05, $55 - .byte $A8,$00, $04, $B4, $04,$04, $A3,$00, $55, $05,$05 - .byte $55, $05, $B5, $A4,$05, $D5, $A5,$05, $B5 - .byte $A4,$05, $55, $00,$00, $55, $A9,$00, $8F, $80 - .byte $A4,$00, $55, $00,$00, $55, $00, $08,$08, $00,$00 - .byte $08,$08, $A4,$00, $08,$08, $A4,$00, $55, $00,$00, $55 - .byte $AF,$00, $55, $00,$00, $55, $A0,$11,$00, $55, $00,$00 - .byte $55, $AF,$00, $55, $A0,$14,$00, $55, $A0,$12,$00, $05 - .byte $A0,$14,$00, $05, $A0,$82,$00 - .byte $A1 -video_hr_rle: .byte $28 ; ysize=40 - .byte $A0,$20,$00, $77, $A6,$57, $77, $A0,$20,$00, $77, $55,$55 - .byte $15, $A3,$55, $77, $A0,$20,$00, $77, $55, $51 - .byte $11, $A3,$55, $77, $A0,$20,$00, $77, $55,$55, $11 - .byte $A3,$55, $77, $A0,$13,$00, $50, $55,$55, $50, $A9,$00 - .byte $77, $55, $A3,$51, $55,$55, $77, $A3,$00, $A6,$70 - .byte $A3,$00, $DD, $BD, $A5,$00, $B0, $BB, $88 - .byte $A4,$00, $80,$80, $A4,$00, $77, $7C, $A6,$77, $00,$00 - .byte $70, $A4,$77, $87, $88, $A3,$00, $DD, $BB - .byte $0B, $A5,$00, $BB, $08, $A3,$00, $B0, $BB - .byte $88, $A9,$00, $05, $50, $00,$00, $74, $47 - .byte $44, $77,$77, $87, $00, $88, $A3,$00, $DD - .byte $FF, $A6,$00, $22,$22, $A4,$00, $BB, $08, $AB,$00 - .byte $05, $77, $99,$99, $74, $77, $87, $00,$00 - .byte $88, $A3,$00, $DD, $FF, $0F, $0B, $00,$00 - .byte $B0, $20, $22,$22, $A4,$00, $11, $AD,$00, $77 - .byte $79,$79, $77, $87, $00, $E0,$E0, $88, $A3,$00 - .byte $0D, $8F, $A6,$00, $52,$52, $00,$00, $0B, $01 - .byte $11, $AD,$00, $A3,$77, $87, $00, $D0, $DE - .byte $EE, $88, $A4,$07, $88, $A6,$07, $55,$55, $A4,$07 - .byte $44, $AD,$07, $77,$77, $87, $00, $30, $3D - .byte $DD, $8E, $08, $A3,$00, $08, $B8, $08 - .byte $A5,$00, $55,$55, $A4,$00, $44, $A9,$00, $B6,$B6, $E0 - .byte $00, $77, $08, $00, $22,$22, $33, $8D - .byte $08, $A5,$00, $BB, $A6,$00, $55,$55, $A4,$00, $44 - .byte $A8,$00, $0B, $BB,$BB, $EE, $00, $08, $00 - .byte $10, $12, $22, $83, $08, $A6,$00, $08,$08 - .byte $A4,$00, $A3,$08, $A3,$00, $08,$08, $A9,$00, $60, $6B - .byte $0E, $00,$00, $40, $41, $11, $82, $08 - .byte $A0,$19,$00, $78, $A3,$88, $80, $A3,$66, $00, $19 - .byte $99, $44, $11, $88, $A0,$1A,$00, $88, $87 - .byte $78, $A3,$88, $86, $66, $00, $11, $99 - .byte $44, $88, $A0,$1B,$00, $A3,$88, $87, $78, $8B - .byte $86, $88, $80, $11, $99, $88, $A0,$1C,$00 - .byte $A5,$88, $77, $A3,$87, $11, $88, $A0,$1D,$00, $A5,$88 - .byte $77, $A4,$88, $A0,$1F,$00, $08, $A3,$88, $77, $A3,$88 - .byte $A1 -collegep_rle: .byte $28 ; ysize=40 - .byte $A0,$21,$66, $F6,$F6, $A8,$66, $F6,$F6, $A3,$FF, $F6, $A0,$15,$66 - .byte $F6, $A5,$FF, $F6, $A6,$66, $6F, $5F, $FF - .byte $F5, $A3,$FF, $A5,$66, $76, $A4,$56, $76, $A4,$56 - .byte $76, $A3,$66, $5F,$5F, $A3,$FF, $5F,$5F, $6F, $A8,$66 - .byte $A4,$65, $A5,$66, $A3,$17, $1A,$1A, $17, $F7, $17 - .byte $1A,$1A, $A3,$17, $A3,$66, $65,$65, $6F,$6F, $A0,$14,$66, $1F - .byte $FF, $1F, $4F, $1F, $FF, $1F, $FF - .byte $1F, $4F, $1F, $FF, $1F, $AD,$66, $AE,$CC - .byte $11, $FF, $11, $84, $11, $FF, $00 - .byte $FF, $11, $84, $11, $FF, $11, $A0,$1B,$CC - .byte $C7, $CF, $C7, $C8, $C7, $CF, $C0 - .byte $CF, $C7, $C8, $C7, $CF, $C7, $A0,$1E,$CC - .byte $5C, $15,$15, $55, $15,$15, $5C, $A0,$21,$CC, $55 - .byte $11, $55, $51, $55, $11, $55, $A0,$21,$CC - .byte $C5, $51, $A3,$55, $51, $C5, $A5,$CC, $5C - .byte $AA,$88, $AB,$CC, $FC, $FF, $5C, $CC, $DC - .byte $A8,$8C, $A5,$CC, $88, $77, $7E, $A8,$EE, $AA,$CC - .byte $8F, $FF,$FF, $85, $ED, $A9,$EE, $E8,$E8, $DC - .byte $CC,$CC, $88, $77,$77, $85, $58, $98, $A5,$88 - .byte $A9,$CC, $9C, $88,$88, $48, $58, $88, $8E - .byte $AA,$EE, $ED, $DC, $CC, $88, $77,$77, $88 - .byte $85, $A3,$58, $55, $58,$58, $A8,$CC, $8C, $98 - .byte $A3,$88, $48, $88, $58, $8E, $AA,$EE, $DD - .byte $CC, $C8, $77,$77, $88,$88, $55, $88,$88, $85 - .byte $88,$88, $A7,$CC, $8C, $89, $88,$88, $89, $A4,$88 - .byte $85, $88, $AB,$EE, $A3,$C7, $C8, $88, $55 - .byte $A3,$88, $48,$48, $A6,$CC, $8C, $89, $98, $88 - .byte $98, $88, $84, $A3,$88, $85, $88, $58 - .byte $A6,$EE, $DE, $CE, $A7,$CC, $55, $48, $44,$44 - .byte $49, $44, $A8,$CC, $A5,$C8, $A6,$88, $A5,$EE, $DD - .byte $CD, $A7,$CC, $4C, $44,$44, $49, $A3,$44, $A0,$11,$DD - .byte $ED, $A5,$EE, $A0,$11,$DD, $A0,$10,$77, $E7, $A5,$EE, $A0,$12,$77 - .byte $A0,$28,$22 - .byte $A1 -umcp_rle: .byte $28 ; ysize=40 - .byte $A0,$1D,$66, $A3,$F6, $76, $A3,$56, $A0,$10,$66, $96,$96, $AD,$66 - .byte $F6, $7F, $FF, $7F, $57, $75, $57 - .byte $77, $55, $AF,$66, $99, $DD,$DD, $99, $A8,$66 - .byte $F6, $7F, $F7, $7F, $A3,$77, $75, $57 - .byte $75, $55,$55, $65, $AB,$66, $F6, $76, $56 - .byte $66, $99, $DD,$DD, $99, $A8,$66, $6F, $F7 - .byte $A3,$77, $57, $55,$55, $A3,$65, $AA,$66, $FF, $7F - .byte $FF, $77, $55, $65, $66,$66, $69,$69, $A0,$2B,$66 - .byte $A7,$46, $A0,$1C,$66, $44, $A3,$66, $A9,$D4, $A0,$12,$66, $16 - .byte $66, $F6, $66, $16, $A3,$66, $A3,$44, $66,$66 - .byte $DD, $5D, $DD,$DD, $5D, $DD,$DD, $5D, $DD - .byte $66,$66, $86,$86, $46, $A8,$66, $D6,$D6, $A3,$66, $51 - .byte $56, $5F, $56, $51, $66,$66, $64,$64, $84 - .byte $64,$64, $66, $DD, $D5, $DD, $4D, $44 - .byte $4D, $DD, $D5, $DD, $66, $86, $88 - .byte $84, $44,$44, $A5,$66, $6D,$6D, $1D,$1D, $CC, $5C - .byte $A7,$55, $5C, $CC,$CC, $88, $A3,$CC, $DD, $5D - .byte $DD,$DD, $8D, $DD,$DD, $5D, $DD, $CC, $C8 - .byte $88, $A3,$44, $C0, $08, $58, $50, $0C - .byte $CC,$CC, $11,$11, $CC, $1F, $FF, $A5,$1F, $FF - .byte $1F, $CC,$CC, $88, $A3,$CC, $DD, $D5, $DD,$DD - .byte $88, $DD,$DD, $D5, $DD, $CC,$CC, $C8,$C8, $C4 - .byte $CC,$CC, $C0, $08, $58, $50, $05, $55 - .byte $11, $10, $CC, $11, $FF, $10, $11 - .byte $10, $11, $10, $FF, $11, $A0,$17,$CC, $00 - .byte $08, $58, $50, $05, $51, $11, $CC - .byte $11, $FF, $10, $11, $88, $11, $10 - .byte $FF, $11, $A0,$18,$CC, $00, $58,$58, $50, $00 - .byte $51, $CC, $11, $7F, $71,$71, $78, $71,$71 - .byte $7F, $11, $A0,$19,$CC, $00, $88,$88, $00, $05 - .byte $CC, $A9,$C7, $A9,$CC, $A3,$5C, $AD,$CC, $C0, $05 - .byte $85,$85, $00, $A0,$11,$CC, $5C, $E5, $A3,$EE, $E5 - .byte $5C, $AC,$CC, $00, $58,$58, $50, $A0,$11,$CC, $FF - .byte $75,$75, $A4,$55, $AC,$CC, $C0, $00, $88,$88, $A0,$10,$CC - .byte $44,$44, $47,$47, $A3,$45, $44,$44, $AC,$CC, $00, $05 - .byte $85, $A0,$10,$CC, $44, $D4, $9D, $D4, $44 - .byte $34, $D3, $34, $44, $AD,$CC, $00, $08 - .byte $AF,$CC, $A3,$44, $CD, $A3,$44, $C3, $A3,$44, $AC,$CC - .byte $C0, $00 - .byte $A1 -dining_rle: .byte $28 ; ysize=40 - .byte $88, $A3,$98, $88,$88, $98, $88,$88, $98,$98, $88,$88 - .byte $A3,$98, $88, $98,$98, $88, $A3,$98, $A4,$88, $98 - .byte $88, $98, $88, $A3,$98, $88, $98, $88 - .byte $98, $88, $98, $88,$88, $99, $88,$88, $99 - .byte $88, $99, $88, $99, $98, $89, $88 - .byte $99, $88, $98, $88, $99, $98, $88,$88 - .byte $99, $A5,$88, $89, $98, $89, $88, $99 - .byte $88, $99, $88, $99, $88, $99, $88 - .byte $99, $88,$88, $99, $88,$88, $99, $89, $99 - .byte $88, $99, $88, $99, $88, $99, $98 - .byte $99, $88, $99, $98, $88,$88, $99, $A6,$88 - .byte $99, $88,$88, $99, $98, $99, $88, $99 - .byte $98, $99, $88, $99, $A5,$88, $08, $D8 - .byte $08, $D8, $F8, $18, $F8, $18, $A7,$88 - .byte $A3,$98, $88, $A3,$98, $88, $A3,$98, $88, $98 - .byte $88,$88, $98, $88, $A3,$98, $A5,$88, $DD, $00 - .byte $DD, $0D, $F1,$F1, $1F,$1F, $A7,$88, $99, $98 - .byte $99, $88, $99, $88, $99, $88,$88, $99 - .byte $88,$88, $99,$99, $98, $99, $88,$88, $99, $A6,$88 - .byte $00, $DD, $00, $D0, $11, $FF, $11 - .byte $FF, $A7,$88, $99, $A3,$88, $99, $98, $99 - .byte $88, $98, $99, $98, $88, $99, $88 - .byte $89, $99, $88,$88, $99, $A0,$2C,$88, $58,$58, $A8,$88 - .byte $00, $B0, $A0,$1B,$88, $58, $55, $BB, $B8 - .byte $A7,$88, $00, $BB, $8B, $88, $68, $A3,$88 - .byte $78, $A3,$88, $08,$08, $A4,$88, $08,$08, $A9,$88, $85,$85 - .byte $BB, $A3,$88, $66, $A4,$88, $00, $22, $88,$88 - .byte $FF, $A3,$88, $77, $57,$57, $B7, $BB, $00 - .byte $A3,$57, $B7, $BB, $00, $A7,$57, $A3,$08, $11,$11 - .byte $08, $77, $66,$66, $77, $A4,$08, $22, $02 - .byte $A3,$05, $08,$08, $77, $A3,$5A, $FB, $F0, $55 - .byte $A3,$5A, $2B, $00, $A7,$5A, $A3,$00, $11,$11, $A4,$77 - .byte $A5,$00, $52, $A7,$00, $0A,$0A, $7A, $7F,$7F, $75 - .byte $7A, $6A, $72,$72, $70, $A3,$5A, $B8, $88 - .byte $5A,$5A, $A3,$00, $81, $A4,$77, $A6,$00, $5A, $A7,$00 - .byte $70, $87, $88,$88, $78, $77,$77, $99, $77,$77 - .byte $66, $77, $70, $0B, $BB, $88, $A5,$00 - .byte $A4,$57, $A7,$00, $08,$08, $A5,$00, $07, $AA,$77, $7F - .byte $77, $7B, $04, $44, $08, $70, $A4,$00 - .byte $55, $88, $A0,$12,$00, $07, $87, $A7,$07, $87 - .byte $07, $00, $20, $24, $00, $77, $A4,$00 - .byte $55, $08,$08, $A0,$12,$00, $88, $A7,$00, $88, $00,$00 - .byte $22, $77, $07, $77, $A4,$00, $55, $A0,$14,$00 - .byte $08, $A7,$00, $08, $00, $08,$08, $07, $00 - .byte $07, $A0,$79,$00 - .byte $A1 -metro_rle: .byte $28 ; ysize=40 - .byte $A0,$1F,$66, $A9,$55, $A3,$66, $A4,$F6, $AA,$66, $11, $66 - .byte $16,$16, $66, $76, $A8,$66, $55, $22,$22, $25,$25 - .byte $A4,$55, $66,$66, $6F, $A4,$7F, $77, $A9,$66, $69,$69 - .byte $19,$19, $69, $77, $A8,$66, $55, $A5,$22, $25 - .byte $55,$55, $66,$66, $46, $A0,$1C,$66, $55, $A7,$22, $55 - .byte $66, $46, $44, $46, $A8,$66, $A7,$86, $AC,$66 - .byte $55, $A7,$22, $55, $C6, $C4, $84, $C4 - .byte $A3,$C6, $76, $86,$86, $76, $C6, $55, $15 - .byte $A3,$55, $15, $55, $C6, $AA,$56, $C6, $95 - .byte $DD, $A6,$22, $55, $CC,$CC, $C8, $A3,$CC, $77 - .byte $80,$80, $77, $CC,$CC, $55, $11, $51, $15 - .byte $51, $11, $55, $AC,$CC, $55, $DD, $A6,$22 - .byte $55, $A4,$CC, $7C, $77, $80,$80, $77, $FF,$FF - .byte $0C, $55, $51, $A3,$55, $51, $55, $AC,$0C - .byte $55, $DD, $A4,$D2, $22,$22, $55, $A3,$CC, $7C - .byte $77, $08,$08, $78, $F7, $FF, $0F, $A0,$14,$00 - .byte $55, $0D, $DD,$DD, $0D, $A3,$02, $55, $CC,$CC - .byte $7C, $87, $A3,$80, $77, $FF, $0F, $00 - .byte $55, $85, $A0,$14,$00, $99, $A5,$00, $55, $CC - .byte $7C, $07, $A3,$08, $77, $FF,$FF, $00,$00, $55 - .byte $88, $08, $A0,$13,$00, $F9, $30,$30, $F0, $80,$80 - .byte $55, $7C, $87, $A3,$80, $70, $F7, $1F - .byte $FF, $00,$00, $FF,$FF, $00, $80, $A0,$10,$00, $30 - .byte $FF, $F0, $F3,$F3, $FF,$FF, $88, $55, $07 - .byte $A3,$08, $78, $77, $FF, $F1, $FF, $00,$00 - .byte $FF,$FF, $0F, $08, $A0,$10,$00, $0F, $A6,$FF, $88 - .byte $55, $A4,$80, $77, $FF, $1F, $FF, $A3,$00 - .byte $1F,$1F, $A0,$14,$00, $3F,$3F, $0F,$0F, $3F, $38, $55 - .byte $A3,$08, $77, $F7, $FF, $F1, $0F, $A3,$00 - .byte $11,$11, $A0,$1A,$00, $55, $00,$00, $70, $77, $A3,$FF - .byte $A4,$00, $11,$11, $A0,$17,$00, $80, $08, $89, $55 - .byte $88,$88, $77, $FF, $11, $FF, $A5,$00, $A3,$88 - .byte $A0,$16,$00, $08, $88,$88, $55, $00, $77, $F7 - .byte $FF,$FF, $0F, $A0,$21,$00, $55, $70, $77, $A3,$FF - .byte $A0,$22,$00, $55, $77, $A3,$FF, $A0,$23,$00, $55 - .byte $A1 -talbot_rle: .byte $28 ; ysize=40 - .byte $22, $66,$66, $77,$77, $FF, $AC,$77, $55, $00 - .byte $66, $00,$00, $55, $AB,$77, $FF, $A4,$77, $A3,$66 - .byte $77,$77, $FF, $AB,$77, $87, $55, $50,$50, $53,$53 - .byte $55, $87, $AA,$77, $FF, $A4,$77, $A3,$66, $77,$77 - .byte $FF, $A6,$77, $07, $00, $07, $77, $88,$88 - .byte $A4,$85, $8C, $85, $88,$88, $77,$77, $87,$87, $A5,$77 - .byte $FF, $A4,$77, $66, $33, $66, $77,$77, $FF - .byte $A6,$77, $88, $BB, $B7, $77, $88, $77 - .byte $88, $77, $27,$27, $77, $88, $77, $88 - .byte $77, $B7, $BB, $88, $A5,$77, $FF, $A4,$77 - .byte $66,$66, $76, $77,$77, $FF, $A6,$77, $78, $1B - .byte $77,$77, $88, $87, $88, $57, $85,$85, $57 - .byte $88, $87, $88, $77,$77, $5B, $78, $A5,$77 - .byte $FF, $A4,$77, $66,$66, $77,$77, $FF, $A8,$0F, $11 - .byte $1F, $BF, $58, $05,$05, $A4,$0F, $05, $5F - .byte $58, $BF, $5F, $55, $A5,$0F, $B8, $88 - .byte $A4,$77, $66, $A3,$77, $44, $A8,$00, $41, $00,$00 - .byte $88, $A8,$00, $88, $00,$00, $25, $A4,$00, $B7 - .byte $B5, $88, $A4,$77, $66, $77,$77, $47, $C4 - .byte $40, $00,$00, $55, $B5, $A3,$00, $44, $00,$00 - .byte $08, $A6,$00, $90, $95, $08, $00,$00, $22 - .byte $A5,$00, $2B, $00, $FF, $A3,$77, $66, $77,$77 - .byte $44, $CC, $44, $80, $00, $55, $BB - .byte $0B, $00,$00, $08,$08, $A8,$00, $09, $99, $55 - .byte $99, $09, $95, $A3,$00, $B0, $20, $22 - .byte $00, $FF, $A5,$77, $44, $CC, $4C, $C4,$C4 - .byte $40, $00, $4B, $40, $B0, $AC,$00, $99 - .byte $00, $99, $00, $09, $A5,$00, $82, $00 - .byte $FF, $A5,$77, $44, $4C, $C4, $CC, $4C - .byte $04, $00, $44, $A0,$18,$00, $88, $00, $FF - .byte $F7, $A4,$77, $84,$84, $8C,$8C, $44, $00,$00, $55 - .byte $A0,$17,$00, $50, $58, $00,$00, $FF, $A4,$77, $88 - .byte $44,$44, $88, $00, $80,$80, $05,$05, $A0,$18,$00, $5D - .byte $DD, $FF, $A4,$77, $88, $00,$00, $88, $00 - .byte $88, $BB, $B0, $A0,$18,$00, $0B, $BB, $0D - .byte $FF, $A3,$77, $FF, $88, $80,$80, $88, $00 - .byte $88, $4B, $A9,$00, $D0,$D0, $80,$80, $D0,$D0, $AB,$00 - .byte $6B, $00, $0F, $FF, $77,$77, $FF, $A5,$00 - .byte $88, $44, $04, $0B, $A5,$00, $D0, $DD - .byte $A6,$88, $DD, $D0, $A7,$00, $0B, $06, $66 - .byte $00,$00, $FF, $77,$77, $FF, $A6,$00, $22, $A9,$00 - .byte $A6,$0D, $AB,$00, $22, $00,$00, $FF, $77, $FF,$FF - .byte $A6,$00, $82, $80, $A0,$18,$00, $50, $52, $00,$00 - .byte $0F, $F7, $FF, $0F, $A0,$25,$00, $FF,$FF, $A0,$26,$00, $FF - .byte $A1 diff --git a/tfv/tfv_flying.s b/tfv/tfv_flying.s index 44c75aa0..96108807 100644 --- a/tfv/tfv_flying.s +++ b/tfv/tfv_flying.s @@ -1,19 +1,19 @@ ;=========== ; CONSTANTS ;=========== -CONST_SHIPX EQU 15 -CONST_TILE_W EQU 64 -CONST_TILE_H EQU 64 -CONST_MAP_MASK_X EQU (CONST_TILE_W - 1) -CONST_MAP_MASK_Y EQU (CONST_TILE_H - 1) -CONST_LOWRES_W EQU 40 -CONST_LOWRES_H EQU 40 -CONST_BETA_I EQU $ff -CONST_BETA_F EQU $80 -CONST_SCALE_I EQU $14 -CONST_SCALE_F EQU $00 -CONST_LOWRES_HALF_I EQU $ec ; -(LOWRES_W/2) -CONST_LOWRES_HALF_F EQU $00 +CONST_SHIPX = 15 +CONST_TILE_W = 64 +CONST_TILE_H = 64 +CONST_MAP_MASK_X = (CONST_TILE_W - 1) +CONST_MAP_MASK_Y = (CONST_TILE_H - 1) +CONST_LOWRES_W = 40 +CONST_LOWRES_H = 40 +CONST_BETA_I = $ff +CONST_BETA_F = $80 +CONST_SCALE_I = $14 +CONST_SCALE_F = $00 +CONST_LOWRES_HALF_I = $ec ; -(LOWRES_W/2) +CONST_LOWRES_HALF_F = $00 flying_start: @@ -1171,7 +1171,7 @@ water_map: .byte $22,$22,$22,$22, $22,$22,$22,$22 .byte $22,$22,$22,$22, $ee,$22,$22,$22 -.include "../asm_routines/multiply_fast.s" +.include "multiply_fast.s" ; 8.8 fixed point diff --git a/tfv/tfv_info.s b/tfv/tfv_info.s index c30cba5f..005c0994 100644 --- a/tfv/tfv_info.s +++ b/tfv/tfv_info.s @@ -31,16 +31,19 @@ show_map: lda DRAW_PAGE clc - adc #$4 - sta BASH - lda #$00 - sta BASL + adc #$4 ; page to load at? + ; FIXME: really need to load at 0xc and + ; copy + pha - lda #>(map_rle) - sta GBASH - lda #<(map_rle) - sta GBASL - jsr load_rle_gr + lda #<(map_lzsa) + sta getsrc_smc+1 + lda #>(map_lzsa) + sta getsrc_smc+2 + + pla + + jsr decompress_lzsa2_fast ; basic_plot(8+((map_x&0x3)*6)+(tfv_x/6), diff --git a/tfv/tfv_title.s b/tfv/tfv_title.s index 5ea6d020..884580dd 100644 --- a/tfv/tfv_title.s +++ b/tfv/tfv_title.s @@ -5,27 +5,19 @@ title_screen: ;=========================== ; Clear both bottoms - lda #$0 - sta DRAW_PAGE - jsr clear_bottom - - lda #$4 - sta DRAW_PAGE - jsr clear_bottom + jsr clear_bottoms ;============================= - ; Load title_rle + ; Load title + + lda #<(title_lzsa) + sta getsrc_smc+1 + lda #>(title_lzsa) + sta getsrc_smc+2 lda #$0c - sta BASH - lda #$00 - sta BASL ; load image off-screen 0xc00 - lda #>(title_rle) - sta GBASH - lda #<(title_rle) - sta GBASL - jsr load_rle_gr + jsr decompress_lzsa2_fast ;================================= ; copy to both pages diff --git a/tfv/tfv_worldmap.s b/tfv/tfv_worldmap.s index 300d7e96..38ec502e 100644 --- a/tfv/tfv_worldmap.s +++ b/tfv/tfv_worldmap.s @@ -766,11 +766,6 @@ load_map_bg: ; Set target for the background drawing - lda #$0c - sta BASH - lda #$00 - sta BASL ; load image off-screen 0xc00 - ; Check for special cases lda MAP_X @@ -778,33 +773,44 @@ map_harfco: cmp #3 ; if map_x==3, harfco bne map_landing - lda #>(harfco_rle) - sta GBASH - lda #<(harfco_rle) - sta GBASL - jsr load_rle_gr + + lda #<(harfco_lzsa) + sta getsrc_smc+1 + lda #>(harfco_lzsa) + sta getsrc_smc+2 + + lda #$c + + jsr decompress_lzsa2_fast rts map_landing: cmp #5 ; if map_x==5, landing site bne map_collegep - lda #>(landing_rle) - sta GBASH - lda #<(landing_rle) - sta GBASL - jsr load_rle_gr + + lda #<(landing_lzsa) + sta getsrc_smc+1 + lda #>(landing_lzsa) + sta getsrc_smc+2 + + lda #$c + + jsr decompress_lzsa2_fast rts map_collegep: cmp #14 ; if map_x==14, collegep bne map_custom - lda #>(collegep_rle) - sta GBASH - lda #<(collegep_rle) - sta GBASL - jsr load_rle_gr + lda #<(collegep_lzsa) + sta getsrc_smc+1 + lda #>(collegep_lzsa) + sta getsrc_smc+2 + + lda #$c + + jsr decompress_lzsa2_fast rts ;============================ diff --git a/tfv/tfv_zp.inc b/tfv/tfv_zp.inc index 9ae4ab50..b01b6068 100644 --- a/tfv/tfv_zp.inc +++ b/tfv/tfv_zp.inc @@ -1,190 +1,193 @@ -.define EQU = - ;; Zero page monitor routines addresses -WNDLFT EQU $20 -WNDWDTH EQU $21 -WNDTOP EQU $22 -WNDBTM EQU $23 -CH EQU $24 -CV EQU $25 -GBASL EQU $26 -GBASH EQU $27 -BASL EQU $28 -BASH EQU $29 -H2 EQU $2C -V2 EQU $2D -MASK EQU $2E -COLOR EQU $30 -INVFLG EQU $32 +;; LZSA addresses +NIBCOUNT = $00 + +WNDLFT = $20 +WNDWDTH = $21 +WNDTOP = $22 +WNDBTM = $23 +CH = $24 +CV = $25 +GBASL = $26 +GBASH = $27 +BASL = $28 +BASH = $29 +H2 = $2C +V2 = $2D +MASK = $2E +COLOR = $30 +INVFLG = $32 ; More zero-page addresses ; we try not to conflict with anything DOS, MONITOR or BASIC related -COLOR1 EQU $E0 -COLOR2 EQU $E1 -MATCH EQU $E2 -XX EQU $E3 -YY EQU $E4 -YADD EQU $E5 -LOOP EQU $E6 -MEMPTRL EQU $E7 -MEMPTRH EQU $E8 -NAMEL EQU $E9 -NAMEH EQU $EA -NAMEX EQU $EB -CHAR EQU $EC -DISP_PAGE EQU $ED -DRAW_PAGE EQU $EE +COLOR1 = $E0 +COLOR2 = $E1 +MATCH = $E2 +XX = $E3 +YY = $E4 +YADD = $E5 +LOOP = $E6 +MEMPTRL = $E7 +MEMPTRH = $E8 +NAMEL = $E9 +NAMEH = $EA +NAMEX = $EB +CHAR = $EC +DISP_PAGE = $ED +DRAW_PAGE = $EE -FIRST EQU $F0 -LASTKEY EQU $F1 -PADDLE_STATUS EQU $F2 -XPOS EQU $F3 -YPOS EQU $F4 -TEMP EQU $FA -RUN EQU $FA -TEMP2 EQU $FB -TEMPY EQU $FB -INL EQU $FC -INH EQU $FD -OUTL EQU $FE -OUTH EQU $FF +FIRST = $F0 +LASTKEY = $F1 +PADDLE_STATUS = $F2 +XPOS = $F3 +YPOS = $F4 +TEMP = $FA +RUN = $FA +TEMP2 = $FB +TEMPY = $FB +INL = $FC +INH = $FD +OUTL = $FE +OUTH = $FF ;; Flying Routine Only -TURNING EQU $60 -;SCREEN_X EQU $61 ; not used? -SCREEN_Y EQU $62 -ANGLE EQU $63 -HORIZ_SCALE_I EQU $64 -HORIZ_SCALE_F EQU $65 -FACTOR_I EQU $66 -FACTOR_F EQU $67 -DX_I EQU $68 -DX_F EQU $69 -SPACEX_I EQU $6A -SPACEX_F EQU $6B -CX_I EQU $6C -CX_F EQU $6D -DY_I EQU $6E -DY_F EQU $6F -SPACEY_I EQU $70 -SPACEY_F EQU $71 -CY_I EQU $72 -CY_F EQU $73 -TEMP_I EQU $74 -TEMP_F EQU $75 -DISTANCE_I EQU $76 -DISTANCE_F EQU $77 -SPACEZ_I EQU $78 -SPACEZ_F EQU $79 -DRAW_SPLASH EQU $7A -SPEED EQU $7B -SPLASH_COUNT EQU $7C -OVER_LAND EQU $7D -NUM1L EQU $7E -NUM1H EQU $7F -NUM2L EQU $80 -NUM2H EQU $81 -RESULT EQU $82 ; 83,84,85 -NEGATE EQU $86 ; UNUSED? -LAST_SPACEX_I EQU $87 -LAST_SPACEY_I EQU $88 -LAST_MAP_COLOR EQU $89 -DRAW_SKY EQU $8A -COLOR_MASK EQU $8B +TURNING = $60 +;SCREEN_X = $61 ; not used? +SCREEN_Y = $62 +ANGLE = $63 +HORIZ_SCALE_I = $64 +HORIZ_SCALE_F = $65 +FACTOR_I = $66 +FACTOR_F = $67 +DX_I = $68 +DX_F = $69 +SPACEX_I = $6A +SPACEX_F = $6B +CX_I = $6C +CX_F = $6D +DY_I = $6E +DY_F = $6F +SPACEY_I = $70 +SPACEY_F = $71 +CY_I = $72 +CY_F = $73 +TEMP_I = $74 +TEMP_F = $75 +DISTANCE_I = $76 +DISTANCE_F = $77 +SPACEZ_I = $78 +SPACEZ_F = $79 +DRAW_SPLASH = $7A +SPEED = $7B +SPLASH_COUNT = $7C +OVER_LAND = $7D +NUM1L = $7E +NUM1H = $7F +NUM2L = $80 +NUM2H = $81 +RESULT = $82 ; 83,84,85 +NEGATE = $86 ; UNUSED? +LAST_SPACEX_I = $87 +LAST_SPACEY_I = $88 +LAST_MAP_COLOR = $89 +DRAW_SKY = $8A +COLOR_MASK = $8B -SHIPY EQU $E4 +SHIPY = $E4 ;; World Map Only -ODD EQU $7B -DIRECTION EQU $7C -REFRESH EQU $7D -ON_BIRD EQU $7E -MOVED EQU $7F -STEPS EQU $80 -TFV_X EQU $81 -TFV_Y EQU $82 -NEWX EQU $83 -NEWY EQU $84 -MAP_X EQU $85 -GROUND_COLOR EQU $86 +ODD = $7B +DIRECTION = $7C +REFRESH = $7D +ON_BIRD = $7E +MOVED = $7F +STEPS = $80 +TFV_X = $81 +TFV_Y = $82 +NEWX = $83 +NEWY = $84 +MAP_X = $85 +GROUND_COLOR = $86 +.if 0 - -KEYPRESS EQU $C000 -KEYRESET EQU $C010 +KEYPRESS = $C000 +KEYRESET = $C010 ;; SOFT SWITCHES -SET_GR EQU $C050 -SET_TEXT EQU $C051 -FULLGR EQU $C052 -TEXTGR EQU $C053 -PAGE0 EQU $C054 -PAGE1 EQU $C055 -LORES EQU $C056 -HIRES EQU $C057 +SET_GR = $C050 +SET_TEXT = $C051 +FULLGR = $C052 +TEXTGR = $C053 +PAGE0 = $C054 +PAGE1 = $C055 +LORES = $C056 +HIRES = $C057 -PADDLE_BUTTON0 EQU $C061 -PADDL0 EQU $C064 -PTRIG EQU $C070 +PADDLE_BUTTON0 = $C061 +PADDL0 = $C064 +PTRIG = $C070 ;; BASIC ROUTINES -NORMAL EQU $F273 +NORMAL = $F273 ;; MONITOR ROUTINES -HLINE EQU $F819 ;; HLINE Y,$2C at A -VLINE EQU $F828 ;; VLINE A,$2D at Y -CLRSCR EQU $F832 ;; Clear low-res screen -CLRTOP EQU $F836 ;; clear only top of low-res screen -SETCOL EQU $F864 ;; COLOR=A -TEXT EQU $FB36 -TABV EQU $FB5B ;; VTAB to A -BASCALC EQU $FBC1 ;; -VTAB EQU $FC22 ;; VTAB to CV -HOME EQU $FC58 ;; Clear the text screen -WAIT EQU $FCA8 ;; delay 1/2(26+27A+5A^2) us -SETINV EQU $FE80 ;; INVERSE -SETNORM EQU $FE84 ;; NORMAL -COUT EQU $FDED ;; output A to screen -COUT1 EQU $FDF0 ;; output A to screen +HLINE = $F819 ;; HLINE Y,$2C at A +VLINE = $F828 ;; VLINE A,$2D at Y +CLRSCR = $F832 ;; Clear low-res screen +CLRTOP = $F836 ;; clear only top of low-res screen +SETCOL = $F864 ;; COLOR=A +TEXT = $FB36 +TABV = $FB5B ;; VTAB to A +BASCALC = $FBC1 ;; +VTAB = $FC22 ;; VTAB to CV +HOME = $FC58 ;; Clear the text screen +WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us +SETINV = $FE80 ;; INVERSE +SETNORM = $FE84 ;; NORMAL +COUT = $FDED ;; output A to screen +COUT1 = $FDF0 ;; output A to screen -COLOR_BLACK EQU 0 -COLOR_RED EQU 1 -COLOR_DARKBLUE EQU 2 -COLOR_PURPLE EQU 3 -COLOR_DARKGREEN EQU 4 -COLOR_GREY EQU 5 -COLOR_MEDIUMBLUE EQU 6 -COLOR_LIGHTBLUE EQU 7 -COLOR_BROWN EQU 8 -COLOR_ORANGE EQU 9 -COLOR_GREY2 EQU 10 -COLOR_PINK EQU 11 -COLOR_LIGHTGREEN EQU 12 -COLOR_YELLOW EQU 13 -COLOR_AQUA EQU 14 -COLOR_WHITE EQU 15 +COLOR_BLACK = 0 +COLOR_RED = 1 +COLOR_DARKBLUE = 2 +COLOR_PURPLE = 3 +COLOR_DARKGREEN = 4 +COLOR_GREY = 5 +COLOR_MEDIUMBLUE = 6 +COLOR_LIGHTBLUE = 7 +COLOR_BROWN = 8 +COLOR_ORANGE = 9 +COLOR_GREY2 = 10 +COLOR_PINK = 11 +COLOR_LIGHTGREEN = 12 +COLOR_YELLOW = 13 +COLOR_AQUA = 14 +COLOR_WHITE = 15 -COLOR_BOTH_RED EQU $11 -COLOR_BOTH_DARKBLUE EQU $22 -COLOR_BOTH_DARKGREEN EQU $44 -COLOR_BOTH_GREY EQU $55 -COLOR_BOTH_MEDIUMBLUE EQU $66 -COLOR_BOTH_LIGHTBLUE EQU $77 -COLOR_BOTH_BROWN EQU $88 -COLOR_BOTH_ORANGE EQU $99 -COLOR_BOTH_LIGHTGREEN EQU $CC -COLOR_BOTH_YELLOW EQU $DD -COLOR_BOTH_WHITE EQU $FF +COLOR_BOTH_RED = $11 +COLOR_BOTH_DARKBLUE = $22 +COLOR_BOTH_DARKGREEN = $44 +COLOR_BOTH_GREY = $55 +COLOR_BOTH_MEDIUMBLUE = $66 +COLOR_BOTH_LIGHTBLUE = $77 +COLOR_BOTH_BROWN = $88 +COLOR_BOTH_ORANGE = $99 +COLOR_BOTH_LIGHTGREEN = $CC +COLOR_BOTH_YELLOW = $DD +COLOR_BOTH_WHITE = $FF + +.endif