2020-09-13 03:33:28 +00:00
|
|
|
; Monkey Monkey
|
|
|
|
|
|
|
|
; by deater (Vince Weaver) <vince@deater.net>
|
|
|
|
|
|
|
|
; Zero Page
|
|
|
|
.include "zp.inc"
|
|
|
|
.include "hardware.inc"
|
|
|
|
.include "common_defines.inc"
|
|
|
|
|
|
|
|
monkey_start:
|
|
|
|
;===================
|
|
|
|
; init screen
|
|
|
|
jsr TEXT
|
|
|
|
jsr HOME
|
|
|
|
bit KEYRESET
|
|
|
|
|
|
|
|
bit SET_GR
|
|
|
|
bit PAGE0
|
|
|
|
bit LORES
|
|
|
|
bit TEXTGR
|
|
|
|
|
|
|
|
;=================
|
|
|
|
; set up location
|
|
|
|
;=================
|
|
|
|
|
|
|
|
lda #<locations
|
|
|
|
sta LOCATIONS_L
|
|
|
|
lda #>locations
|
|
|
|
sta LOCATIONS_H
|
|
|
|
|
2020-09-13 04:32:52 +00:00
|
|
|
lda #29
|
|
|
|
sta GUYBRUSH_X
|
|
|
|
lda #18
|
|
|
|
sta GUYBRUSH_Y
|
|
|
|
|
|
|
|
|
2020-09-13 03:33:28 +00:00
|
|
|
lda #0
|
|
|
|
sta DRAW_PAGE
|
|
|
|
sta LEVEL_OVER
|
2020-09-18 00:26:18 +00:00
|
|
|
sta GUYBRUSH_DIRECTION
|
2020-10-13 20:41:51 +00:00
|
|
|
sta GUYBRUSH_SIZE
|
2020-09-18 03:39:02 +00:00
|
|
|
sta DISPLAY_MESSAGE
|
|
|
|
sta BAR_DOOR_OPEN
|
2020-09-18 04:42:07 +00:00
|
|
|
sta VALID_NOUN
|
2020-10-19 04:33:39 +00:00
|
|
|
sta ITEMS_PICKED_UP
|
|
|
|
sta INVENTORY_NEXT_SLOT
|
|
|
|
sta INVENTORY
|
|
|
|
sta INVENTORY2
|
|
|
|
sta INVENTORY3
|
|
|
|
sta INVENTORY4
|
|
|
|
sta INVENTORY5
|
|
|
|
|
|
|
|
|
2020-09-13 03:33:28 +00:00
|
|
|
|
|
|
|
; init cursor
|
|
|
|
|
|
|
|
lda #20
|
|
|
|
sta CURSOR_X
|
|
|
|
sta CURSOR_Y
|
|
|
|
|
|
|
|
; set up initial location
|
|
|
|
|
2020-10-19 04:33:39 +00:00
|
|
|
lda #MONKEY_BAR
|
|
|
|
; lda #MONKEY_LOOKOUT
|
2020-10-13 21:17:52 +00:00
|
|
|
; lda #MONKEY_VOODOO1
|
2020-09-13 03:33:28 +00:00
|
|
|
sta LOCATION
|
|
|
|
|
|
|
|
jsr change_location
|
|
|
|
|
|
|
|
lda #1
|
|
|
|
sta CURSOR_VISIBLE ; visible at first
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
sta ANIMATE_FRAME
|
|
|
|
|
2020-09-16 03:45:02 +00:00
|
|
|
lda #VERB_WALK
|
|
|
|
sta CURRENT_VERB
|
|
|
|
|
2020-09-17 02:57:51 +00:00
|
|
|
lda #$ff
|
|
|
|
sta DESTINATION_X
|
|
|
|
sta DESTINATION_Y
|
|
|
|
|
2020-09-13 03:33:28 +00:00
|
|
|
game_loop:
|
|
|
|
;=================
|
|
|
|
; reset things
|
|
|
|
;=================
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
sta IN_SPECIAL
|
|
|
|
sta IN_RIGHT
|
|
|
|
sta IN_LEFT
|
|
|
|
|
|
|
|
;====================================
|
|
|
|
; copy background to current page
|
|
|
|
;====================================
|
|
|
|
|
|
|
|
jsr gr_copy_to_current
|
|
|
|
|
|
|
|
;====================================
|
2020-09-13 04:32:52 +00:00
|
|
|
; draw background sprites
|
2020-09-13 03:33:28 +00:00
|
|
|
;====================================
|
|
|
|
|
|
|
|
lda LOCATION
|
2020-09-17 23:38:34 +00:00
|
|
|
cmp #MONKEY_LOOKOUT
|
|
|
|
beq animate_flame
|
2020-09-18 02:53:00 +00:00
|
|
|
cmp #MONKEY_BAR
|
|
|
|
beq do_draw_bar_door
|
2020-09-28 02:03:50 +00:00
|
|
|
cmp #MONKEY_ZIPLINE
|
|
|
|
beq do_draw_sign
|
2020-10-12 02:32:25 +00:00
|
|
|
cmp #MONKEY_VOODOO2
|
|
|
|
beq do_draw_smoke
|
2020-10-20 00:54:47 +00:00
|
|
|
cmp #MONKEY_BAR_INSIDE2
|
|
|
|
beq do_draw_bar2
|
2020-10-19 04:33:39 +00:00
|
|
|
cmp #MONKEY_BAR_INSIDE3
|
|
|
|
beq do_draw_meat
|
2020-09-13 03:33:28 +00:00
|
|
|
|
|
|
|
jmp nothing_special
|
|
|
|
|
2020-09-17 23:38:34 +00:00
|
|
|
animate_flame:
|
|
|
|
jsr draw_fire
|
2020-09-13 03:33:28 +00:00
|
|
|
jmp nothing_special
|
|
|
|
|
2020-09-18 02:53:00 +00:00
|
|
|
do_draw_bar_door:
|
|
|
|
jsr draw_bar_door
|
|
|
|
jmp nothing_special
|
2020-09-13 03:33:28 +00:00
|
|
|
|
2020-09-28 02:03:50 +00:00
|
|
|
do_draw_sign:
|
|
|
|
jsr draw_sign
|
|
|
|
jmp nothing_special
|
|
|
|
|
2020-10-12 02:32:25 +00:00
|
|
|
do_draw_smoke:
|
|
|
|
jsr draw_smoke
|
|
|
|
jmp nothing_special
|
|
|
|
|
2020-10-20 00:54:47 +00:00
|
|
|
do_draw_bar2:
|
|
|
|
jsr bar_inside2_animate
|
|
|
|
jmp nothing_special
|
|
|
|
|
2020-10-19 04:33:39 +00:00
|
|
|
do_draw_meat:
|
|
|
|
jsr draw_meat
|
|
|
|
jmp nothing_special
|
|
|
|
|
2020-09-13 03:33:28 +00:00
|
|
|
nothing_special:
|
|
|
|
|
2020-09-17 02:57:51 +00:00
|
|
|
|
|
|
|
;====================================
|
|
|
|
; move guybrush
|
|
|
|
;====================================
|
|
|
|
|
|
|
|
; only do it every 4th frame
|
|
|
|
lda FRAMEL
|
|
|
|
and #$3
|
|
|
|
bne done_move_guybrush
|
|
|
|
|
|
|
|
move_guybrush_x:
|
|
|
|
lda DESTINATION_X
|
|
|
|
bmi move_guybrush_y
|
|
|
|
|
|
|
|
cmp GUYBRUSH_X
|
|
|
|
beq guybrush_lr_done
|
|
|
|
bcs move_guybrush_right
|
|
|
|
move_guybrush_left:
|
2020-09-18 00:34:27 +00:00
|
|
|
lda #DIR_LEFT
|
|
|
|
sta GUYBRUSH_DIRECTION
|
2020-09-17 02:57:51 +00:00
|
|
|
dec GUYBRUSH_X
|
|
|
|
jmp move_guybrush_y
|
|
|
|
move_guybrush_right:
|
2020-09-18 00:34:27 +00:00
|
|
|
lda #DIR_RIGHT
|
|
|
|
sta GUYBRUSH_DIRECTION
|
2020-09-17 02:57:51 +00:00
|
|
|
inc GUYBRUSH_X
|
|
|
|
jmp move_guybrush_y
|
|
|
|
|
|
|
|
guybrush_lr_done:
|
|
|
|
|
|
|
|
lda #$ff
|
|
|
|
sta DESTINATION_X
|
|
|
|
|
|
|
|
move_guybrush_y:
|
|
|
|
lda DESTINATION_Y
|
|
|
|
bmi done_move_guybrush
|
|
|
|
|
|
|
|
cmp GUYBRUSH_Y
|
|
|
|
beq guybrush_ud_done
|
2020-09-18 00:34:27 +00:00
|
|
|
bcs move_guybrush_down
|
|
|
|
move_guybrush_up:
|
|
|
|
lda #DIR_UP
|
|
|
|
sta GUYBRUSH_DIRECTION
|
2020-09-17 02:57:51 +00:00
|
|
|
dec GUYBRUSH_Y
|
|
|
|
dec GUYBRUSH_Y
|
|
|
|
jmp done_move_guybrush
|
2020-09-18 00:34:27 +00:00
|
|
|
move_guybrush_down:
|
|
|
|
lda #DIR_DOWN
|
|
|
|
sta GUYBRUSH_DIRECTION
|
2020-09-17 02:57:51 +00:00
|
|
|
inc GUYBRUSH_Y
|
|
|
|
inc GUYBRUSH_Y
|
|
|
|
jmp done_move_guybrush
|
|
|
|
|
|
|
|
guybrush_ud_done:
|
|
|
|
|
|
|
|
lda #$ff
|
|
|
|
sta DESTINATION_Y
|
|
|
|
|
|
|
|
done_move_guybrush:
|
|
|
|
|
2020-09-13 04:32:52 +00:00
|
|
|
;====================================
|
|
|
|
; draw guybrush
|
|
|
|
;====================================
|
|
|
|
|
|
|
|
lda GUYBRUSH_X
|
|
|
|
sta XPOS
|
|
|
|
lda GUYBRUSH_Y
|
|
|
|
sta YPOS
|
|
|
|
|
2020-10-01 22:34:15 +00:00
|
|
|
lda GUYBRUSH_SIZE
|
2020-10-13 20:41:51 +00:00
|
|
|
|
2020-10-01 22:34:15 +00:00
|
|
|
cmp #GUYBRUSH_BIG
|
|
|
|
beq big_guybrush
|
|
|
|
|
2020-10-13 20:41:51 +00:00
|
|
|
cmp #GUYBRUSH_MEDIUM
|
|
|
|
beq medium_guybrush
|
|
|
|
|
2020-10-01 22:34:15 +00:00
|
|
|
lda GUYBRUSH_SIZE
|
|
|
|
cmp #GUYBRUSH_TINY
|
2020-10-13 20:41:51 +00:00
|
|
|
beq tiny_guybrush
|
2020-10-01 22:34:15 +00:00
|
|
|
|
|
|
|
small_guybrush:
|
2020-10-13 20:41:51 +00:00
|
|
|
lda #<guybrush_small_sprite
|
2020-10-01 22:34:15 +00:00
|
|
|
sta INL
|
2020-10-13 20:41:51 +00:00
|
|
|
lda #>guybrush_small_sprite
|
2020-10-01 22:34:15 +00:00
|
|
|
jmp really_draw_guybrush
|
|
|
|
|
2020-10-13 20:41:51 +00:00
|
|
|
tiny_guybrush:
|
|
|
|
lda #<guybrush_tiny_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>guybrush_tiny_sprite
|
|
|
|
jmp really_draw_guybrush
|
|
|
|
|
|
|
|
medium_guybrush:
|
|
|
|
lda GUYBRUSH_DIRECTION ; 00/01 or 02/03 or 04/05 or 06/07
|
|
|
|
and #$fe
|
|
|
|
tay
|
|
|
|
|
|
|
|
lda guybrush_med_sprites,Y
|
2020-09-19 16:07:45 +00:00
|
|
|
sta INL
|
2020-10-13 20:41:51 +00:00
|
|
|
lda guybrush_med_sprites+1,Y
|
2020-09-19 16:07:45 +00:00
|
|
|
jmp really_draw_guybrush
|
|
|
|
|
|
|
|
big_guybrush:
|
2020-09-18 00:26:18 +00:00
|
|
|
lda GUYBRUSH_Y ; always even
|
|
|
|
lsr
|
|
|
|
eor GUYBRUSH_X
|
|
|
|
and #$1 ; 0 or 1
|
|
|
|
ora GUYBRUSH_DIRECTION ; 00/01 or 02/03 or 04/05 or 06/07
|
|
|
|
asl
|
|
|
|
tay
|
|
|
|
|
|
|
|
lda guybrush_sprites,Y
|
2020-09-13 04:32:52 +00:00
|
|
|
sta INL
|
2020-09-18 00:26:18 +00:00
|
|
|
lda guybrush_sprites+1,Y
|
2020-10-01 22:34:15 +00:00
|
|
|
|
2020-09-19 16:07:45 +00:00
|
|
|
really_draw_guybrush:
|
2020-10-01 22:34:15 +00:00
|
|
|
sta INH
|
2020-09-13 04:32:52 +00:00
|
|
|
jsr put_sprite_crop
|
|
|
|
|
|
|
|
|
|
|
|
;====================================
|
|
|
|
; draw foreground sprites
|
|
|
|
;====================================
|
|
|
|
|
2020-09-17 23:38:34 +00:00
|
|
|
lda LOCATION
|
|
|
|
cmp #MONKEY_LOOKOUT
|
|
|
|
beq do_draw_wall
|
2020-09-18 02:53:00 +00:00
|
|
|
cmp #MONKEY_POSTER
|
|
|
|
beq do_draw_house
|
2020-09-29 17:32:23 +00:00
|
|
|
cmp #MONKEY_BAR
|
|
|
|
beq do_draw_building
|
2020-10-20 15:31:58 +00:00
|
|
|
cmp #MONKEY_BAR_INSIDE1
|
|
|
|
beq do_draw_bar1
|
2020-10-13 01:45:17 +00:00
|
|
|
cmp #MONKEY_VOODOO1
|
|
|
|
beq do_draw_voodoo1
|
2020-10-13 03:52:17 +00:00
|
|
|
cmp #MONKEY_CHURCH
|
|
|
|
beq do_draw_church
|
2020-09-17 23:38:34 +00:00
|
|
|
|
|
|
|
jmp nothing_foreground
|
|
|
|
|
|
|
|
do_draw_wall:
|
|
|
|
jsr draw_wall
|
|
|
|
jmp nothing_foreground
|
|
|
|
|
2020-09-18 02:53:00 +00:00
|
|
|
do_draw_house:
|
|
|
|
jsr draw_house
|
|
|
|
jmp nothing_foreground
|
2020-09-17 23:38:34 +00:00
|
|
|
|
2020-09-29 17:32:23 +00:00
|
|
|
do_draw_building:
|
|
|
|
jsr draw_bar_fg_building
|
|
|
|
jmp nothing_foreground
|
|
|
|
|
2020-10-20 15:31:58 +00:00
|
|
|
do_draw_bar1:
|
|
|
|
jsr bar_inside1_foreground
|
|
|
|
jmp nothing_foreground
|
|
|
|
|
2020-10-13 01:45:17 +00:00
|
|
|
do_draw_voodoo1:
|
|
|
|
jsr voodoo1_draw_foreground
|
|
|
|
jmp nothing_foreground
|
|
|
|
|
2020-10-13 03:52:17 +00:00
|
|
|
do_draw_church:
|
|
|
|
jsr draw_church_foreground
|
|
|
|
jmp nothing_foreground
|
|
|
|
|
2020-09-29 17:32:23 +00:00
|
|
|
|
2020-09-17 23:38:34 +00:00
|
|
|
nothing_foreground:
|
|
|
|
|
2020-09-13 04:32:52 +00:00
|
|
|
|
2020-09-16 04:28:08 +00:00
|
|
|
;====================================
|
|
|
|
; what are we pointing too
|
|
|
|
;====================================
|
|
|
|
|
|
|
|
jsr where_do_we_point
|
|
|
|
|
2020-09-13 04:32:52 +00:00
|
|
|
;====================================
|
|
|
|
; update bottom bar
|
|
|
|
;====================================
|
|
|
|
|
|
|
|
jsr update_bottom
|
|
|
|
|
2020-09-13 03:33:28 +00:00
|
|
|
;====================================
|
|
|
|
; draw pointer
|
|
|
|
;====================================
|
|
|
|
|
|
|
|
jsr draw_pointer
|
|
|
|
|
|
|
|
;====================================
|
|
|
|
; page flip
|
|
|
|
;====================================
|
|
|
|
|
|
|
|
jsr page_flip
|
|
|
|
|
|
|
|
;====================================
|
|
|
|
; handle keypress/joystick
|
|
|
|
;====================================
|
|
|
|
|
|
|
|
jsr handle_keypress
|
|
|
|
|
2020-09-29 17:32:23 +00:00
|
|
|
;====================================
|
|
|
|
; keep in bounds
|
|
|
|
;====================================
|
|
|
|
|
|
|
|
keep_in_bounds_smc:
|
|
|
|
jsr $0000
|
|
|
|
|
2020-09-18 01:26:01 +00:00
|
|
|
;====================================
|
|
|
|
; check if exiting room
|
|
|
|
;====================================
|
|
|
|
|
2020-09-25 03:33:59 +00:00
|
|
|
check_exit_smc:
|
|
|
|
jsr $0000
|
|
|
|
|
2020-09-13 03:33:28 +00:00
|
|
|
;====================================
|
|
|
|
; inc frame count
|
|
|
|
;====================================
|
|
|
|
|
|
|
|
inc FRAMEL
|
|
|
|
bne room_frame_no_oflo
|
|
|
|
inc FRAMEH
|
|
|
|
room_frame_no_oflo:
|
|
|
|
|
|
|
|
;====================================
|
|
|
|
; check level over
|
|
|
|
;====================================
|
|
|
|
|
|
|
|
lda LEVEL_OVER
|
|
|
|
bne really_exit
|
|
|
|
jmp game_loop
|
|
|
|
|
|
|
|
really_exit:
|
|
|
|
jmp end_level
|
|
|
|
|
2020-09-13 04:32:52 +00:00
|
|
|
|
|
|
|
|
2020-09-13 03:33:28 +00:00
|
|
|
;==========================
|
|
|
|
; includes
|
|
|
|
;==========================
|
|
|
|
|
|
|
|
; level graphics
|
|
|
|
.include "graphics/graphics.inc"
|
|
|
|
|
|
|
|
; level data
|
|
|
|
.include "leveldata_monkey.inc"
|
|
|
|
|
|
|
|
|
|
|
|
.include "end_level.s"
|
|
|
|
.include "text_print.s"
|
|
|
|
.include "gr_offsets.s"
|
|
|
|
.include "gr_fast_clear.s"
|
|
|
|
.include "keyboard.s"
|
|
|
|
.include "gr_copy.s"
|
|
|
|
.include "gr_putsprite_crop.s"
|
|
|
|
.include "joystick.s"
|
|
|
|
.include "gr_pageflip.s"
|
|
|
|
.include "decompress_fast_v2.s"
|
|
|
|
.include "draw_pointer.s"
|
|
|
|
.include "common_sprites.inc"
|
2020-09-13 04:32:52 +00:00
|
|
|
.include "guy.brush"
|
|
|
|
|
2020-09-25 03:33:59 +00:00
|
|
|
; Locations
|
|
|
|
|
2020-09-17 23:38:34 +00:00
|
|
|
.include "monkey_lookout.s"
|
2020-09-18 01:26:01 +00:00
|
|
|
.include "monkey_poster.s"
|
2020-09-18 01:37:50 +00:00
|
|
|
.include "monkey_dock.s"
|
|
|
|
.include "monkey_bar.s"
|
2020-09-19 05:36:48 +00:00
|
|
|
.include "monkey_town.s"
|
|
|
|
.include "monkey_map.s"
|
2020-09-25 03:33:59 +00:00
|
|
|
.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"
|
2020-10-11 14:35:06 +00:00
|
|
|
.include "monkey_bar_inside3.s"
|
2020-10-01 19:07:02 +00:00
|
|
|
.include "monkey_voodoo1.s"
|
|
|
|
.include "monkey_voodoo2.s"
|
|
|
|
|
|
|
|
|
|
|
|
; cutscenes
|
|
|
|
.include "chapter1.s"
|
|
|
|
.include "cutscene_lechuck.s"
|
2020-09-17 23:38:34 +00:00
|
|
|
|
2020-09-13 04:32:52 +00:00
|
|
|
.include "monkey_actions.s"
|
2020-09-16 03:45:02 +00:00
|
|
|
.include "update_bottom.s"
|
2020-09-17 23:38:34 +00:00
|
|
|
|