mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-06-02 19:42:23 +00:00
ootw: split make source file up
This commit is contained in:
parent
72fa5367c4
commit
31dbf8cb2f
|
@ -17,6 +17,7 @@ OOTW: ootw.o
|
|||
|
||||
ootw.o: ootw.s \
|
||||
gr_copy.s gr_fast_clear.s gr_pageflip.s gr_unrle.s gr_putsprite.s \
|
||||
ootw_pool.s ootw_cavern.s physicist.s \
|
||||
ootw_pool.inc ootw_cavern.inc ootw_sprites.inc
|
||||
ca65 -o ootw.o ootw.s -l ootw.lst
|
||||
####
|
||||
|
|
454
ootw/ootw.s
454
ootw/ootw.s
|
@ -1,4 +1,6 @@
|
|||
; Ootw
|
||||
; Ootw for Apple II
|
||||
|
||||
; by Vince "Deater" Weaver
|
||||
|
||||
.include "zp.inc"
|
||||
.include "hardware.inc"
|
||||
|
@ -6,453 +8,10 @@
|
|||
|
||||
|
||||
ootw:
|
||||
;===========================
|
||||
; Enable graphics
|
||||
|
||||
bit LORES
|
||||
bit SET_GR
|
||||
bit FULLGR
|
||||
|
||||
|
||||
|
||||
;===========================
|
||||
; Clear both bottoms
|
||||
|
||||
lda #$4
|
||||
sta DRAW_PAGE
|
||||
jsr clear_bottom
|
||||
|
||||
lda #$0
|
||||
sta DRAW_PAGE
|
||||
jsr clear_bottom
|
||||
|
||||
lda #0
|
||||
sta DRAW_PAGE
|
||||
lda #1
|
||||
sta DISP_PAGE
|
||||
|
||||
|
||||
;=============================
|
||||
; Load background to $c00
|
||||
|
||||
lda #$0c
|
||||
sta BASH
|
||||
lda #$00
|
||||
sta BASL ; load image off-screen $c00
|
||||
|
||||
lda #>(pool_rle)
|
||||
sta GBASH
|
||||
lda #<(pool_rle)
|
||||
sta GBASL
|
||||
jsr load_rle_gr
|
||||
|
||||
;=================================
|
||||
; copy to both pages $400/$800
|
||||
|
||||
jsr gr_copy_to_current
|
||||
jsr page_flip
|
||||
jsr gr_copy_to_current
|
||||
|
||||
|
||||
;=================================
|
||||
; setup vars
|
||||
lda #22
|
||||
sta PHYSICIST_Y
|
||||
lda #20
|
||||
sta PHYSICIST_X
|
||||
|
||||
lda #1
|
||||
sta DIRECTION
|
||||
|
||||
lda #0
|
||||
sta GAIT
|
||||
|
||||
lda #30
|
||||
sta TENTACLE_PROGRESS
|
||||
|
||||
;============================
|
||||
; Main Loop
|
||||
;============================
|
||||
game_loop:
|
||||
|
||||
; check keyboard
|
||||
|
||||
jsr handle_keypress
|
||||
|
||||
;================================
|
||||
; copy background to current page
|
||||
|
||||
jsr gr_copy_to_current
|
||||
|
||||
|
||||
;=======================
|
||||
; draw pool ripples
|
||||
|
||||
lda FRAMEL
|
||||
and #$30 ; 0110 1100
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
tax
|
||||
|
||||
lda pool_ripples,X
|
||||
sta INL
|
||||
lda pool_ripples+1,X
|
||||
sta INH
|
||||
|
||||
lda #9
|
||||
sta XPOS
|
||||
lda #30
|
||||
sta YPOS
|
||||
|
||||
jsr put_sprite
|
||||
|
||||
|
||||
lda FRAMEL
|
||||
and #$30 ; 0110 1100
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
clc
|
||||
adc #2
|
||||
and #$6
|
||||
tax
|
||||
|
||||
lda pool_ripples,X
|
||||
sta INL
|
||||
lda pool_ripples+1,X
|
||||
sta INH
|
||||
|
||||
|
||||
lda #27
|
||||
sta XPOS
|
||||
lda #30
|
||||
sta YPOS
|
||||
|
||||
jsr put_sprite
|
||||
|
||||
|
||||
lda FRAMEL
|
||||
and #$30 ; 0110 1100
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
clc
|
||||
adc #4
|
||||
and #$6
|
||||
tax
|
||||
|
||||
lda #18
|
||||
sta XPOS
|
||||
lda #28
|
||||
sta YPOS
|
||||
|
||||
jsr put_sprite
|
||||
|
||||
|
||||
;===============
|
||||
; move/draw tentacle monster
|
||||
|
||||
lda FRAMEH
|
||||
and #3
|
||||
bne tentacle_move
|
||||
lda FRAMEL
|
||||
cmp #$ff
|
||||
bne tentacle_move
|
||||
tentacle_init:
|
||||
sec
|
||||
lda PHYSICIST_X
|
||||
sbc #2
|
||||
sta TENTACLE_X
|
||||
|
||||
lda #0
|
||||
sta TENTACLE_PROGRESS
|
||||
|
||||
tentacle_move:
|
||||
|
||||
lda TENTACLE_PROGRESS
|
||||
cmp #26
|
||||
bpl no_tentacle
|
||||
|
||||
; lda FRAMEL
|
||||
; and #$30 ; 0110 1100
|
||||
; lsr
|
||||
; lsr
|
||||
; lsr
|
||||
|
||||
tax
|
||||
|
||||
lda tentacle_progression,X
|
||||
sta INL
|
||||
lda tentacle_progression+1,X
|
||||
sta INH
|
||||
|
||||
lda TENTACLE_X
|
||||
sta XPOS
|
||||
lda #22
|
||||
sta YPOS
|
||||
|
||||
lda FRAMEL
|
||||
and #$3f
|
||||
bne no_tentacle_progress
|
||||
|
||||
inc TENTACLE_PROGRESS
|
||||
inc TENTACLE_PROGRESS
|
||||
no_tentacle_progress:
|
||||
|
||||
|
||||
jsr put_sprite
|
||||
no_tentacle:
|
||||
|
||||
;===============
|
||||
; draw physicist
|
||||
|
||||
jsr draw_physicist
|
||||
|
||||
;===============
|
||||
; draw slugs
|
||||
|
||||
jsr draw_slugs
|
||||
|
||||
;======================
|
||||
; draw foreground plant
|
||||
|
||||
lda FRAMEL
|
||||
and #$c0 ; 0110 1100
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
tax
|
||||
|
||||
lda plant_wind,X
|
||||
sta INL
|
||||
lda plant_wind+1,X
|
||||
sta INH
|
||||
|
||||
lda #4
|
||||
sta XPOS
|
||||
lda #30
|
||||
sta YPOS
|
||||
|
||||
jsr put_sprite
|
||||
|
||||
; page flip
|
||||
|
||||
jsr page_flip
|
||||
|
||||
|
||||
; inc frame count
|
||||
|
||||
inc FRAMEL
|
||||
bne frame_no_oflo
|
||||
inc FRAMEH
|
||||
|
||||
frame_no_oflo:
|
||||
|
||||
; pause?
|
||||
|
||||
; loop forever
|
||||
|
||||
jmp game_loop
|
||||
|
||||
|
||||
;======================================
|
||||
; handle keypress
|
||||
;======================================
|
||||
|
||||
handle_keypress:
|
||||
|
||||
lda KEYPRESS ; 4
|
||||
bpl no_keypress ; 3
|
||||
|
||||
; -1
|
||||
|
||||
and #$7f ; clear high bit
|
||||
|
||||
check_quit:
|
||||
cmp #'Q'
|
||||
beq quit
|
||||
cmp #27
|
||||
bne check_left
|
||||
quit:
|
||||
jmp quit_level
|
||||
|
||||
check_left:
|
||||
cmp #'A'
|
||||
beq left
|
||||
cmp #$8 ; left arrow
|
||||
bne check_right
|
||||
left:
|
||||
lda DIRECTION
|
||||
bne face_left
|
||||
|
||||
dec PHYSICIST_X
|
||||
bpl just_fine_left
|
||||
too_far_left:
|
||||
inc PHYSICIST_X
|
||||
just_fine_left:
|
||||
|
||||
inc GAIT
|
||||
inc GAIT
|
||||
|
||||
jmp done_keypress
|
||||
|
||||
face_left:
|
||||
lda #0
|
||||
sta DIRECTION
|
||||
sta GAIT
|
||||
jmp done_keypress
|
||||
|
||||
check_right:
|
||||
cmp #'D'
|
||||
beq right
|
||||
cmp #$15
|
||||
bne unknown
|
||||
right:
|
||||
lda DIRECTION
|
||||
beq face_right
|
||||
|
||||
inc PHYSICIST_X
|
||||
lda PHYSICIST_X
|
||||
cmp #37
|
||||
bne just_fine_right
|
||||
too_far_right:
|
||||
dec PHYSICIST_X
|
||||
just_fine_right:
|
||||
|
||||
|
||||
inc GAIT
|
||||
inc GAIT
|
||||
jmp done_keypress
|
||||
|
||||
face_right:
|
||||
lda #0
|
||||
sta GAIT
|
||||
lda #1
|
||||
sta DIRECTION
|
||||
jmp done_keypress
|
||||
|
||||
unknown:
|
||||
done_keypress:
|
||||
bit KEYRESET ; clear the keyboard strobe ; 4
|
||||
|
||||
|
||||
no_keypress:
|
||||
rts ; 6
|
||||
|
||||
|
||||
|
||||
;======================================
|
||||
; draw physicist
|
||||
;======================================
|
||||
|
||||
draw_physicist:
|
||||
|
||||
lda GAIT
|
||||
and #$f
|
||||
sta GAIT
|
||||
tax
|
||||
|
||||
lda phys_walk_progression,X
|
||||
sta INL
|
||||
|
||||
lda phys_walk_progression+1,X
|
||||
sta INH
|
||||
|
||||
lda PHYSICIST_X
|
||||
sta XPOS
|
||||
lda PHYSICIST_Y
|
||||
sta YPOS
|
||||
|
||||
lda DIRECTION
|
||||
bne facing_right
|
||||
|
||||
facing_left:
|
||||
jmp put_sprite
|
||||
|
||||
facing_right:
|
||||
jmp put_sprite_flipped
|
||||
|
||||
|
||||
;==================================
|
||||
; draw slugs
|
||||
;==================================
|
||||
|
||||
slugg0_out: .byte $1
|
||||
slugg0_x: .byte $01
|
||||
slugg0_dir: .byte $1
|
||||
slugg0_gait: .byte $0
|
||||
|
||||
; ___ _-_
|
||||
|
||||
draw_slugs:
|
||||
|
||||
lda slugg0_out
|
||||
beq slug_done ; don't draw if not there
|
||||
|
||||
inc slugg0_gait
|
||||
|
||||
lda slugg0_gait
|
||||
and #$1f
|
||||
cmp #$00
|
||||
bne slug_no_move
|
||||
|
||||
slug_move:
|
||||
lda slugg0_x
|
||||
clc
|
||||
adc slugg0_dir
|
||||
sta slugg0_x
|
||||
|
||||
cmp #37
|
||||
beq remove_slug
|
||||
|
||||
slug_no_move:
|
||||
|
||||
lda slugg0_gait
|
||||
and #$10
|
||||
beq slug_squinched
|
||||
|
||||
slug_flat:
|
||||
lda #<slug1
|
||||
sta INL
|
||||
lda #>slug1
|
||||
sta INH
|
||||
bne slug_selected
|
||||
|
||||
slug_squinched:
|
||||
lda #<slug2
|
||||
sta INL
|
||||
lda #>slug2
|
||||
sta INH
|
||||
|
||||
slug_selected:
|
||||
|
||||
|
||||
lda slugg0_x
|
||||
sta XPOS
|
||||
lda #34
|
||||
sta YPOS
|
||||
|
||||
lda DIRECTION
|
||||
bmi slug_right
|
||||
|
||||
slug_left:
|
||||
jsr put_sprite
|
||||
jmp slug_done
|
||||
|
||||
slug_right:
|
||||
jsr put_sprite_flipped
|
||||
|
||||
slug_done:
|
||||
rts
|
||||
|
||||
remove_slug:
|
||||
lda #0
|
||||
sta slugg0_out
|
||||
rts
|
||||
sta GAME_OVER
|
||||
|
||||
jsr ootw_pool
|
||||
|
||||
;===========================
|
||||
; quit_level
|
||||
|
@ -487,6 +46,9 @@ end_message:
|
|||
.byte 8,10,"PRESS RETURN TO CONTINUE",0
|
||||
.byte 11,20,"ACCESS CODE: IH8S",0
|
||||
|
||||
.include "ootw_pool.s"
|
||||
.include "ootw_cavern.s"
|
||||
.include "physicist.s"
|
||||
.include "text_print.s"
|
||||
.include "gr_pageflip.s"
|
||||
.include "gr_unrle.s"
|
||||
|
|
289
ootw/ootw_cavern.s
Normal file
289
ootw/ootw_cavern.s
Normal file
|
@ -0,0 +1,289 @@
|
|||
; Cavern scene (with the slugs)
|
||||
|
||||
|
||||
|
||||
ootw_cavern:
|
||||
;===========================
|
||||
; Enable graphics
|
||||
|
||||
bit LORES
|
||||
bit SET_GR
|
||||
bit FULLGR
|
||||
|
||||
|
||||
|
||||
;===========================
|
||||
; Clear both bottoms
|
||||
|
||||
lda #$4
|
||||
sta DRAW_PAGE
|
||||
jsr clear_bottom
|
||||
|
||||
lda #$0
|
||||
sta DRAW_PAGE
|
||||
jsr clear_bottom
|
||||
|
||||
lda #0
|
||||
sta DRAW_PAGE
|
||||
lda #1
|
||||
sta DISP_PAGE
|
||||
|
||||
|
||||
;=============================
|
||||
; Load background to $c00
|
||||
|
||||
lda #$0c
|
||||
sta BASH
|
||||
lda #$00
|
||||
sta BASL ; load image off-screen $c00
|
||||
|
||||
lda #>(pool_rle)
|
||||
sta GBASH
|
||||
lda #<(pool_rle)
|
||||
sta GBASL
|
||||
jsr load_rle_gr
|
||||
|
||||
;=================================
|
||||
; copy to both pages $400/$800
|
||||
|
||||
jsr gr_copy_to_current
|
||||
jsr page_flip
|
||||
jsr gr_copy_to_current
|
||||
|
||||
|
||||
;=================================
|
||||
; setup vars
|
||||
lda #22
|
||||
sta PHYSICIST_Y
|
||||
lda #20
|
||||
sta PHYSICIST_X
|
||||
|
||||
lda #1
|
||||
sta DIRECTION
|
||||
|
||||
lda #0
|
||||
sta GAIT
|
||||
|
||||
lda #30
|
||||
sta TENTACLE_PROGRESS
|
||||
|
||||
;============================
|
||||
; Cavern Loop (not a palindrome)
|
||||
;============================
|
||||
cavern_loop:
|
||||
|
||||
; check keyboard
|
||||
|
||||
jsr handle_keypress_cavern
|
||||
|
||||
;================================
|
||||
; copy background to current page
|
||||
|
||||
jsr gr_copy_to_current
|
||||
|
||||
|
||||
;===============
|
||||
; draw physicist
|
||||
|
||||
jsr draw_physicist
|
||||
|
||||
;===============
|
||||
; draw slugs
|
||||
|
||||
jsr draw_slugs
|
||||
|
||||
;======================
|
||||
; draw falling boulders
|
||||
|
||||
|
||||
;=======================
|
||||
; page flip
|
||||
|
||||
jsr page_flip
|
||||
|
||||
;========================
|
||||
; inc frame count
|
||||
|
||||
inc FRAMEL
|
||||
bne frame_no_oflo_c
|
||||
inc FRAMEH
|
||||
|
||||
frame_no_oflo_c:
|
||||
|
||||
; pause?
|
||||
|
||||
; see if game over
|
||||
lda GAME_OVER
|
||||
bne done_cavern
|
||||
|
||||
; loop forever
|
||||
|
||||
jmp cavern_loop
|
||||
|
||||
done_cavern:
|
||||
rts
|
||||
|
||||
|
||||
;======================================
|
||||
; handle keypress
|
||||
;======================================
|
||||
|
||||
handle_keypress_cavern:
|
||||
|
||||
lda KEYPRESS ; 4
|
||||
bpl no_keypress_c ; 3
|
||||
|
||||
; -1
|
||||
|
||||
and #$7f ; clear high bit
|
||||
|
||||
check_quit_c:
|
||||
cmp #'Q'
|
||||
beq quit_c
|
||||
cmp #27
|
||||
bne check_left_c
|
||||
quit_c:
|
||||
lda #1
|
||||
sta GAME_OVER
|
||||
rts
|
||||
|
||||
check_left_c:
|
||||
cmp #'A'
|
||||
beq left_c
|
||||
cmp #$8 ; left arrow
|
||||
bne check_right_c
|
||||
left_c:
|
||||
lda DIRECTION
|
||||
bne face_left_c
|
||||
|
||||
dec PHYSICIST_X
|
||||
bpl just_fine_left_c
|
||||
too_far_left_c:
|
||||
inc PHYSICIST_X
|
||||
just_fine_left_c:
|
||||
|
||||
inc GAIT
|
||||
inc GAIT
|
||||
|
||||
jmp done_keypress_c
|
||||
|
||||
face_left_c:
|
||||
lda #0
|
||||
sta DIRECTION
|
||||
sta GAIT
|
||||
jmp done_keypress_c
|
||||
|
||||
check_right_c:
|
||||
cmp #'D'
|
||||
beq right_c
|
||||
cmp #$15
|
||||
bne unknown_c
|
||||
right_c:
|
||||
lda DIRECTION
|
||||
beq face_right_c
|
||||
|
||||
inc PHYSICIST_X
|
||||
lda PHYSICIST_X
|
||||
cmp #37
|
||||
bne just_fine_right_c
|
||||
too_far_right_c:
|
||||
dec PHYSICIST_X
|
||||
just_fine_right_c:
|
||||
|
||||
|
||||
inc GAIT
|
||||
inc GAIT
|
||||
jmp done_keypress_c
|
||||
|
||||
face_right_c:
|
||||
lda #0
|
||||
sta GAIT
|
||||
lda #1
|
||||
sta DIRECTION
|
||||
jmp done_keypress_c
|
||||
|
||||
unknown_c:
|
||||
done_keypress_c:
|
||||
bit KEYRESET ; clear the keyboard strobe ; 4
|
||||
|
||||
|
||||
no_keypress_c:
|
||||
rts ; 6
|
||||
|
||||
|
||||
;==================================
|
||||
; draw slugs
|
||||
;==================================
|
||||
|
||||
slugg0_out: .byte $1
|
||||
slugg0_x: .byte $01
|
||||
slugg0_dir: .byte $1
|
||||
slugg0_gait: .byte $0
|
||||
|
||||
; ___ _-_
|
||||
|
||||
draw_slugs:
|
||||
|
||||
lda slugg0_out
|
||||
beq slug_done ; don't draw if not there
|
||||
|
||||
inc slugg0_gait
|
||||
|
||||
lda slugg0_gait
|
||||
and #$1f
|
||||
cmp #$00
|
||||
bne slug_no_move
|
||||
|
||||
slug_move:
|
||||
lda slugg0_x
|
||||
clc
|
||||
adc slugg0_dir
|
||||
sta slugg0_x
|
||||
|
||||
cmp #37
|
||||
beq remove_slug
|
||||
|
||||
slug_no_move:
|
||||
|
||||
lda slugg0_gait
|
||||
and #$10
|
||||
beq slug_squinched
|
||||
|
||||
slug_flat:
|
||||
lda #<slug1
|
||||
sta INL
|
||||
lda #>slug1
|
||||
sta INH
|
||||
bne slug_selected
|
||||
|
||||
slug_squinched:
|
||||
lda #<slug2
|
||||
sta INL
|
||||
lda #>slug2
|
||||
sta INH
|
||||
|
||||
slug_selected:
|
||||
|
||||
|
||||
lda slugg0_x
|
||||
sta XPOS
|
||||
lda #34
|
||||
sta YPOS
|
||||
|
||||
lda DIRECTION
|
||||
bmi slug_right
|
||||
|
||||
slug_left:
|
||||
jsr put_sprite
|
||||
jmp slug_done
|
||||
|
||||
slug_right:
|
||||
jsr put_sprite_flipped
|
||||
|
||||
slug_done:
|
||||
rts
|
||||
|
||||
remove_slug:
|
||||
lda #0
|
||||
sta slugg0_out
|
||||
rts
|
344
ootw/ootw_pool.s
Normal file
344
ootw/ootw_pool.s
Normal file
|
@ -0,0 +1,344 @@
|
|||
; Ootw Pool Party
|
||||
|
||||
ootw_pool:
|
||||
;===========================
|
||||
; Enable graphics
|
||||
|
||||
bit LORES
|
||||
bit SET_GR
|
||||
bit FULLGR
|
||||
|
||||
|
||||
;===========================
|
||||
; Clear both bottoms
|
||||
|
||||
lda #$4
|
||||
sta DRAW_PAGE
|
||||
jsr clear_bottom
|
||||
|
||||
lda #$0
|
||||
sta DRAW_PAGE
|
||||
jsr clear_bottom
|
||||
|
||||
lda #0
|
||||
sta DRAW_PAGE
|
||||
lda #1
|
||||
sta DISP_PAGE
|
||||
|
||||
|
||||
;=============================
|
||||
; Load background to $c00
|
||||
|
||||
lda #$0c
|
||||
sta BASH
|
||||
lda #$00
|
||||
sta BASL ; load image off-screen $c00
|
||||
|
||||
lda #>(pool_rle)
|
||||
sta GBASH
|
||||
lda #<(pool_rle)
|
||||
sta GBASL
|
||||
jsr load_rle_gr
|
||||
|
||||
;=================================
|
||||
; copy to both pages $400/$800
|
||||
|
||||
jsr gr_copy_to_current
|
||||
jsr page_flip
|
||||
jsr gr_copy_to_current
|
||||
|
||||
|
||||
;=================================
|
||||
; setup vars
|
||||
lda #22
|
||||
sta PHYSICIST_Y
|
||||
lda #20
|
||||
sta PHYSICIST_X
|
||||
|
||||
lda #1
|
||||
sta DIRECTION
|
||||
|
||||
lda #0
|
||||
sta GAIT
|
||||
|
||||
lda #30
|
||||
sta TENTACLE_PROGRESS
|
||||
|
||||
;============================
|
||||
; Pool Loop (palindrome)
|
||||
;============================
|
||||
pool_loop:
|
||||
|
||||
; check keyboard
|
||||
|
||||
jsr handle_keypress_pool
|
||||
|
||||
;================================
|
||||
; copy background to current page
|
||||
|
||||
jsr gr_copy_to_current
|
||||
|
||||
|
||||
;=======================
|
||||
; draw pool ripples
|
||||
|
||||
lda FRAMEL
|
||||
and #$30 ; 0110 1100
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
tax
|
||||
|
||||
lda pool_ripples,X
|
||||
sta INL
|
||||
lda pool_ripples+1,X
|
||||
sta INH
|
||||
|
||||
lda #9
|
||||
sta XPOS
|
||||
lda #30
|
||||
sta YPOS
|
||||
|
||||
jsr put_sprite
|
||||
|
||||
|
||||
lda FRAMEL
|
||||
and #$30 ; 0110 1100
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
clc
|
||||
adc #2
|
||||
and #$6
|
||||
tax
|
||||
|
||||
lda pool_ripples,X
|
||||
sta INL
|
||||
lda pool_ripples+1,X
|
||||
sta INH
|
||||
|
||||
|
||||
lda #27
|
||||
sta XPOS
|
||||
lda #30
|
||||
sta YPOS
|
||||
|
||||
jsr put_sprite
|
||||
|
||||
|
||||
lda FRAMEL
|
||||
and #$30 ; 0110 1100
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
clc
|
||||
adc #4
|
||||
and #$6
|
||||
tax
|
||||
|
||||
lda #18
|
||||
sta XPOS
|
||||
lda #28
|
||||
sta YPOS
|
||||
|
||||
jsr put_sprite
|
||||
|
||||
|
||||
;===============
|
||||
; move/draw tentacle monster
|
||||
|
||||
lda FRAMEH
|
||||
and #3
|
||||
bne tentacle_move
|
||||
lda FRAMEL
|
||||
cmp #$ff
|
||||
bne tentacle_move
|
||||
tentacle_init:
|
||||
sec
|
||||
lda PHYSICIST_X
|
||||
sbc #2
|
||||
sta TENTACLE_X
|
||||
|
||||
lda #0
|
||||
sta TENTACLE_PROGRESS
|
||||
|
||||
tentacle_move:
|
||||
|
||||
lda TENTACLE_PROGRESS
|
||||
cmp #26
|
||||
bpl no_tentacle
|
||||
|
||||
; lda FRAMEL
|
||||
; and #$30 ; 0110 1100
|
||||
; lsr
|
||||
; lsr
|
||||
; lsr
|
||||
|
||||
tax
|
||||
|
||||
lda tentacle_progression,X
|
||||
sta INL
|
||||
lda tentacle_progression+1,X
|
||||
sta INH
|
||||
|
||||
lda TENTACLE_X
|
||||
sta XPOS
|
||||
lda #22
|
||||
sta YPOS
|
||||
|
||||
lda FRAMEL
|
||||
and #$3f
|
||||
bne no_tentacle_progress
|
||||
|
||||
inc TENTACLE_PROGRESS
|
||||
inc TENTACLE_PROGRESS
|
||||
no_tentacle_progress:
|
||||
|
||||
|
||||
jsr put_sprite
|
||||
no_tentacle:
|
||||
|
||||
;===============
|
||||
; draw physicist
|
||||
|
||||
jsr draw_physicist
|
||||
|
||||
;======================
|
||||
; draw foreground plant
|
||||
|
||||
lda FRAMEL
|
||||
and #$c0 ; 0110 1100
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
tax
|
||||
|
||||
lda plant_wind,X
|
||||
sta INL
|
||||
lda plant_wind+1,X
|
||||
sta INH
|
||||
|
||||
lda #4
|
||||
sta XPOS
|
||||
lda #30
|
||||
sta YPOS
|
||||
|
||||
jsr put_sprite
|
||||
|
||||
;===============
|
||||
; page flip
|
||||
|
||||
jsr page_flip
|
||||
|
||||
;================
|
||||
; inc frame count
|
||||
|
||||
inc FRAMEL
|
||||
bne frame_no_oflo
|
||||
inc FRAMEH
|
||||
|
||||
frame_no_oflo:
|
||||
|
||||
; pause?
|
||||
|
||||
; check if game over
|
||||
|
||||
lda GAME_OVER
|
||||
bne done_pool
|
||||
|
||||
; loop forever
|
||||
|
||||
jmp pool_loop
|
||||
|
||||
done_pool:
|
||||
rts
|
||||
|
||||
;======================================
|
||||
; handle keypress (pool)
|
||||
;======================================
|
||||
|
||||
handle_keypress_pool:
|
||||
|
||||
lda KEYPRESS ; 4
|
||||
bpl no_keypress ; 3
|
||||
|
||||
; -1
|
||||
|
||||
and #$7f ; clear high bit
|
||||
|
||||
check_quit:
|
||||
cmp #'Q'
|
||||
beq quit
|
||||
cmp #27
|
||||
bne check_left
|
||||
quit:
|
||||
lda #1
|
||||
sta GAME_OVER
|
||||
rts
|
||||
|
||||
check_left:
|
||||
cmp #'A'
|
||||
beq left
|
||||
cmp #$8 ; left arrow
|
||||
bne check_right
|
||||
left:
|
||||
lda DIRECTION
|
||||
bne face_left
|
||||
|
||||
dec PHYSICIST_X
|
||||
bpl just_fine_left
|
||||
too_far_left:
|
||||
inc PHYSICIST_X
|
||||
just_fine_left:
|
||||
|
||||
inc GAIT
|
||||
inc GAIT
|
||||
|
||||
jmp done_keypress
|
||||
|
||||
face_left:
|
||||
lda #0
|
||||
sta DIRECTION
|
||||
sta GAIT
|
||||
jmp done_keypress
|
||||
|
||||
check_right:
|
||||
cmp #'D'
|
||||
beq right
|
||||
cmp #$15
|
||||
bne unknown
|
||||
right:
|
||||
lda DIRECTION
|
||||
beq face_right
|
||||
|
||||
inc PHYSICIST_X
|
||||
lda PHYSICIST_X
|
||||
cmp #37
|
||||
bne just_fine_right
|
||||
too_far_right:
|
||||
dec PHYSICIST_X
|
||||
just_fine_right:
|
||||
|
||||
|
||||
inc GAIT
|
||||
inc GAIT
|
||||
jmp done_keypress
|
||||
|
||||
face_right:
|
||||
lda #0
|
||||
sta GAIT
|
||||
lda #1
|
||||
sta DIRECTION
|
||||
jmp done_keypress
|
||||
|
||||
unknown:
|
||||
done_keypress:
|
||||
bit KEYRESET ; clear the keyboard strobe ; 4
|
||||
|
||||
|
||||
no_keypress:
|
||||
rts ; 6
|
||||
|
||||
|
31
ootw/physicist.s
Normal file
31
ootw/physicist.s
Normal file
|
@ -0,0 +1,31 @@
|
|||
;======================================
|
||||
; draw physicist
|
||||
;======================================
|
||||
|
||||
draw_physicist:
|
||||
|
||||
lda GAIT
|
||||
and #$f
|
||||
sta GAIT
|
||||
tax
|
||||
|
||||
lda phys_walk_progression,X
|
||||
sta INL
|
||||
|
||||
lda phys_walk_progression+1,X
|
||||
sta INH
|
||||
|
||||
lda PHYSICIST_X
|
||||
sta XPOS
|
||||
lda PHYSICIST_Y
|
||||
sta YPOS
|
||||
|
||||
lda DIRECTION
|
||||
bne facing_right
|
||||
|
||||
facing_left:
|
||||
jmp put_sprite
|
||||
|
||||
facing_right:
|
||||
jmp put_sprite_flipped
|
||||
|
|
@ -131,6 +131,7 @@ CURSOR = $9D
|
|||
XX = $E3
|
||||
YY = $E4
|
||||
HGR_COLOR = $E4
|
||||
GAME_OVER = $E5
|
||||
;SHIPY = $E4
|
||||
;YADD = $E5
|
||||
;LOOP = $E6
|
||||
|
|
Loading…
Reference in New Issue
Block a user