mist: dentist: cleanup approach, work on time

This commit is contained in:
Vince Weaver 2020-07-03 12:23:18 -04:00
parent 27f713439c
commit 0608053522
12 changed files with 532 additions and 24 deletions

View File

@ -19,20 +19,14 @@ mist.dsk: HELLO LOADER MIST_TITLE MIST OCTAGON VIEWER \
$(DOS33) -y mist.dsk BSAVE -a 0x4000 MIST_TITLE
$(DOS33) -y mist.dsk BSAVE -a 0x2000 MIST
$(DOS33) -y mist.dsk BSAVE -a 0x2000 OCTAGON
# $(DOS33) -y mist.dsk BSAVE -a 0x2000 MECHE
# $(DOS33) -y mist.dsk BSAVE -a 0x2000 SELENA
$(DOS33) -y mist.dsk BSAVE -a 0x2000 CABIN
# $(DOS33) -y mist.dsk BSAVE -a 0x2000 VIEWER
$(DOS33) -y mist.dsk BSAVE -a 0x2000 STONEY
$(DOS33) -y mist.dsk BSAVE -a 0x2000 DENTIST
$(DOS33) -y mist.dsk BSAVE -a 0xe00 SAVE0
$(DOS33) -y mist.dsk BSAVE -a 0x9000 ./audio/link_noise.btc LINK_NOISE.BTC
mist_side2.dsk: HELLO_DISK2 MECHE SELENA CHANNEL VIEWER ARBOR NIBEL
mist_side2.dsk: HELLO_DISK2 CHANNEL VIEWER ARBOR NIBEL
cp empty.dsk mist_side2.dsk
$(DOS33) -y mist_side2.dsk SAVE A HELLO_DISK2 HELLO
# $(DOS33) -y mist_side2.dsk BSAVE -a 0x2000 MECHE
# $(DOS33) -y mist_side2.dsk BSAVE -a 0x2000 SELENA
$(DOS33) -y mist_side2.dsk BSAVE -a 0x2000 CHANNEL
$(DOS33) -y mist_side2.dsk BSAVE -a 0x2000 ARBOR
$(DOS33) -y mist_side2.dsk BSAVE -a 0x2000 NIBEL
@ -40,14 +34,13 @@ mist_side2.dsk: HELLO_DISK2 MECHE SELENA CHANNEL VIEWER ARBOR NIBEL
# $(DOS33) -y mist_side2.dsk BSAVE -a 0x9000 ./audio/link_noise.btc LINK_NOISE.BTC
mist_side3.dsk: HELLO_DISK2 MECHE SELENA
mist_side3.dsk: HELLO_DISK2 MECHE SELENA STONEY
cp empty.dsk mist_side3.dsk
$(DOS33) -y mist_side3.dsk SAVE A HELLO_DISK2 HELLO
$(DOS33) -y mist_side3.dsk BSAVE -a 0x2000 MECHE
$(DOS33) -y mist_side3.dsk BSAVE -a 0x2000 SELENA
# $(DOS33) -y mist_side2.dsk BSAVE -a 0x2000 CHANNEL
# $(DOS33) -y mist_side2.dsk BSAVE -a 0x2000 ARBOR
# $(DOS33) -y mist_side2.dsk BSAVE -a 0x2000 VIEWER
$(DOS33) -y mist_side3.dsk BSAVE -a 0x2000 STONEY
###

View File

@ -33,6 +33,8 @@ page_flip =$1896
; gr_putsprite_crop.s
put_sprite_crop =$18b0
psc_smc1 =$18d3
psc_smc2 =$196b
; keyboard.s
handle_keypress =$19ec
@ -40,6 +42,7 @@ change_location =$1acd
; text_print.s
move_and_print =$1b65
ps_smc1 =$1b92
; page_sprites.inc
blue_page_sprite =$1c7a

View File

@ -71,8 +71,8 @@ game_loop:
;====================================
lda LOCATION
; cmp #NIBEL_BLUE_ROOM
; beq fg_draw_blue_page
cmp #DENTIST_PANEL
beq fg_draw_panel
; cmp #NIBEL_RED_TABLE_OPEN
; beq fg_draw_red_page
; cmp #NIBEL_BLUE_HOUSE_VIEWER
@ -80,6 +80,9 @@ game_loop:
jmp nothing_special
fg_draw_panel:
jsr draw_date
jmp nothing_special
nothing_special:
@ -155,6 +158,9 @@ pull_down_panel:
lda #DENTIST_PANEL
sta LOCATION
lda #DIRECTION_N|DIRECTION_SPLIT
sta DIRECTION
jmp change_location
@ -165,6 +171,8 @@ pull_down_panel:
; includes
;==========================
.include "gr_putsprite_raw.s"
; level graphics
.include "graphics_dentist/dentist_graphics.inc"

View File

@ -7,6 +7,376 @@
; year 0-9999, leading 0 suppression
; time 1200AM - 1159PM
draw_date:
;=================
; month
lda #10
sta DENTIST_MONTH
lda #4
sta DENTIST_DAY
lda DENTIST_MONTH ; get month
asl
asl
tay
sty saved_month_ptr
; first letter
lda months,Y ; look up in month table
and #$3f ; get char from font
asl
tay
lda big_font,Y
sta INL
lda big_font+1,Y
sta INH
lda #$0
sta XPOS
lda #40
sta YPOS
jsr put_sprite_raw
; second letter
ldy saved_month_ptr
lda months+1,Y ; look up in month table
and #$3f ; get char from font
asl
tay
lda big_font,Y
sta INL
lda big_font+1,Y
sta INH
lda #$4
sta XPOS
lda #40
sta YPOS
jsr put_sprite_raw
; third letter
ldy saved_month_ptr
lda months+2,Y ; look up in month table
and #$3f ; get char from font
asl
tay
lda big_font,Y
sta INL
lda big_font+1,Y
sta INH
lda #$8
sta XPOS
lda #40
sta YPOS
jsr put_sprite_raw
;=================
; day
; tens
lda DENTIST_DAY ; note, starts with 0 so add 1
sed
clc
adc #1
cld
lsr
lsr
lsr
and #$1E
beq skip_tens ; skip tens if zero
tay
lda big_font_num,Y
sta INL
lda big_font_num+1,Y
sta INH
lda #16
sta XPOS
lda #40
sta YPOS
jsr put_sprite_raw
skip_tens:
lda DENTIST_DAY ; note, starts with 0 so add 1
sed
clc
adc #1
cld
and #$f
asl
tay
lda big_font_num,Y
sta INL
lda big_font_num+1,Y
sta INH
lda #20
sta XPOS
lda #40
sta YPOS
jsr put_sprite_raw
;=================
; year
lda #$ff
sta ps_smc1+1
lda #<year_string
sta OUTL
lda #>year_string
sta OUTH
jsr move_and_print
;=================
; time
lda #<time_string
sta OUTL
lda #>time_string
sta OUTH
jsr move_and_print
lda #$3f
sta ps_smc1+1
rts
year_string:
.byte 28,21,'1'+$80,'9'+$80,'5'+$80,'5'+$80,0
time_string:
.byte 28,23,' '+$80,'6'+$80,'0'+$80,'0'+$80,'A'+$80,'M'+$80,0
saved_month_ptr:
.byte $00
months:
.byte "JAN",0
.byte "FEB",0
.byte "MAR",0
.byte "APR",0
.byte "MAY",0
.byte "JUN",0
.byte "JUL",0
.byte "AUG",0
.byte "SEP",0
.byte "OCT",0
.byte "NOV",0
.byte "DEC",0
; A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
; 5 1 2 1 3 1 1 3 1 2 3 2 2 2 1 1 3 1 1
big_font:
.word big_font_space ; @
.word big_font_a ; A
.word big_font_b ; B
.word big_font_space ; C
.word big_font_space ; D
.word big_font_e ; E
.word big_font_f ; F
.word big_font_space ; G
.word big_font_space ; H
.word big_font_space ; I
.word big_font_j ; J
.word big_font_space ; K
.word big_font_space ; L
.word big_font_space ; M
.word big_font_n ; N
.word big_font_o ; O
.word big_font_space ; P
.word big_font_space ; Q
.word big_font_space ; R
.word big_font_space ; S
.word big_font_space ; T
.word big_font_space ; U
.word big_font_v ; V
.word big_font_space ; W
.word big_font_space ; X
.word big_font_space ; Y
.word big_font_space ; Z
big_font_space:
.byte 3,4
.byte $a0,$a0,$a0
.byte $a0,$a0,$a0
.byte $a0,$a0,$a0
.byte $a0,$a0,$a0
big_font_a:
.byte 3,4
.byte $a0,$DF,$a0 ; _
.byte $BA,$a0,$BA ; : :
.byte $BA,$AD,$BA ; :-:
.byte $BA,$a0,$BA ; : :
big_font_b:
.byte 3,4
.byte $a0,$DF,$DF ; __
.byte $BA,$a0,$AF ; : /
.byte $BA,$AD,$a0 ; :-
.byte $BA,$DF,$AF ; :_/
big_font_e:
.byte 3,4
.byte $a0,$DF,$DF ; __
.byte $BA,$a0,$a0 ; :
.byte $BA,$AD,$a0 ; :-
.byte $BA,$DF,$DF ; :__
big_font_f:
.byte 3,4
.byte $a0,$DF,$DF ; __
.byte $BA,$a0,$a0 ; :
.byte $BA,$AD,$a0 ; :-
.byte $BA,$a0,$a0 ; :
big_font_j:
.byte 3,4
.byte $a0,$a0,$a0 ;
.byte $a0,$a0,$BA ; :
.byte $a0,$a0,$BA ; :
.byte $BA,$DF,$BA ; :_:
big_font_n:
.byte 3,4
.byte $a0,$a0,$a0 ;
.byte $BA,$a0,$BA ; : :
.byte $BA,$DC,$BA ; :\:
.byte $BA,$a0,$BA ; : :
big_font_o:
.byte 3,4
.byte $a0,$DF,$a0 ; _
.byte $BA,$a0,$BA ; : :
.byte $BA,$a0,$BA ; : :
.byte $BA,$DF,$BA ; :_:
big_font_v:
.byte 3,4
.byte $a0,$a0,$a0 ;
.byte $BA,$a0,$BA ; : :
.byte $BA,$a0,$AF ; : /
.byte $BA,$AF,$a0 ; :/
big_font_num:
.word big_font_0 ; 0
.word big_font_1 ; 1
.word big_font_2 ; 2
.word big_font_3 ; 3
.word big_font_4 ; 4
.word big_font_5 ; 5
.word big_font_6 ; 6
.word big_font_7 ; 7
.word big_font_8 ; 8
.word big_font_9 ; 9
big_font_0:
.byte 3,4
.byte $a0,$DF,$a0 ; _
.byte $BA,$a0,$BA ; : :
.byte $BA,$a0,$BA ; : :
.byte $BA,$DF,$BA ; :_:
big_font_1:
.byte 3,4
.byte $a0,$a0,$a0 ;
.byte $a0,$a0,$BA ; :
.byte $a0,$a0,$BA ; :
.byte $a0,$a0,$BA ; :
big_font_2:
.byte 3,4
.byte $a0,$DF,$a0 ; _
.byte $a0,$a0,$BA ; :
.byte $a0,$AD,$a0 ; -
.byte $BA,$DF,$DF ; :__
big_font_3:
.byte 3,4
.byte $a0,$DF,$a0 ; _
.byte $a0,$a0,$BA ; :
.byte $a0,$AD,$BA ; -:
.byte $a0,$DF,$BA ; _:
big_font_4:
.byte 3,4
.byte $a0,$a0,$a0 ;
.byte $BA,$a0,$BA ; : :
.byte $BA,$AD,$BA ; :-:
.byte $A0,$A0,$BA ; :
big_font_5:
.byte 3,4
.byte $a0,$DF,$DF ; __
.byte $BA,$a0,$a0 ; :
.byte $a0,$AD,$a0 ; -
.byte $DF,$DF,$BA ; __:
big_font_6:
.byte 3,4
.byte $a0,$DF,$DF ; __
.byte $BA,$a0,$a0 ; :
.byte $BA,$AD,$AE ; :-.
.byte $BA,$DF,$BA ; :_:
big_font_7:
.byte 3,4
.byte $DF,$DF,$a0 ; __
.byte $a0,$a0,$BA ; :
.byte $a0,$a0,$BA ; :
.byte $a0,$a0,$BA ; :
big_font_8:
.byte 3,4
.byte $a0,$DF,$a0 ; _
.byte $BA,$a0,$BA ; : :
.byte $BA,$AD,$BA ; :-:
.byte $BA,$DF,$BA ; :_:
big_font_9:
.byte 3,4
.byte $a0,$DF,$a0 ; _
.byte $BA,$a0,$BA ; : :
.byte $A7,$AD,$BA ; '-:
.byte $a0,$DF,$BA ; _:
; 012345678901234567890
; _
; : : : : :
@ -23,10 +393,10 @@
; 1 2 3
;012345678901234567890123456789013456789
; _ _ ___ __ __
;: : : : : : 1984
;: : : : -- --
;:_: :_ : :__ :__ 10 04 AM
; _ __ ___ __ __
;: : : : : : 1984
;: : : : -- --
;:_: :__ : . :__ :__ 10 04 AM
; _ _ __ _ _
; | | | : : : | | | | | | |
; | | | : : : | -| |-| |_|

View File

@ -83,6 +83,8 @@ int main(int argc, char **argv) {
printf("; gr_putsprite_crop.s\n");
find_address("put_sprite_crop");
find_address("psc_smc1");
find_address("psc_smc2");
printf("\n");
printf("; keyboard.s\n");
@ -92,6 +94,7 @@ int main(int argc, char **argv) {
printf("; text_print.s\n");
find_address("move_and_print");
find_address("ps_smc1");
printf("\n");
printf("; page_sprites.inc\n");

112
mist/gr_putsprite_raw.s Normal file
View File

@ -0,0 +1,112 @@
;=============================================
; put_sprite_raw
;=============================================
; Sprite to display in INH,INL
; Location is XPOS,YPOS
; Note, only works if YPOS is multiple of two
; no transparency, no cropping
; FIXME: force YPOS to be even?
put_sprite_raw:
ldy #0 ; byte 0 is xsize ; 2
lda (INL),Y ; 5
sta CH ; xsize is in CH ; 3
iny ; 2
clc
adc XPOS
sta XMAX
lda (INL),Y ; byte 1 is ysize ; 5
sta CV ; ysize is in CV ; 3
iny ; 2
lda YPOS ; make a copy of ypos ; 3
sta TEMPY ; as we modify it ; 3
;===========
; 28
put_sprite_raw_loop:
sty TEMP ; save sprite pointer ; 3
ldy TEMPY ; 3
bpl put_sprite_raw_pos ; if < 0, skip to next
clc ; skip line in sprite too
lda TEMP
adc CH
tay
bne raw_increment_y
put_sprite_raw_pos:
psr_smc1:
cpy #48 ; bge if >= 48, done sprite
bcs raw_sprite_done
lda gr_offsets,Y ; lookup low-res memory address ; 4
clc ; 2
adc XPOS ; add in xpos ; 3
sta OUTL ; store out low byte of addy ; 3
clc ; never wraps, handle negative
lda gr_offsets+1,Y ; look up high byte ; 4
adc DRAW_PAGE ; ; 3
sta OUTH ; and store it out ; 3
ldy TEMP ; restore sprite pointer ; 3
; OUTH:OUTL now points at right place
ldx XPOS ; load xposition into x ; 3
;===========
; 34
raw_put_sprite_pixel:
lda (INL),Y ; get sprite colors ; 5
iny ; increment sprite pointer ; 2
sty TEMP ; save sprite pointer ; 3
cpx #0 ; if off-screen left, skip draw
bmi skip_drawing
cpx #40
bcs skip_drawing ; if off-screen right, skip draw
ldy #$0 ; 2
sta COLOR ; save color for later ; 3
; check if top pixel transparent
raw_put_sprite_all:
lda COLOR ; load color ; 3
sta (OUTL),Y ; and write it out ; 6
;============
; 9
raw_put_sprite_done_draw:
skip_drawing:
ldy TEMP ; restore sprite pointer ; 3
inc OUTL ; increment output pointer ; 5
inx ; increment x counter ; 2
cpx XMAX
bne raw_put_sprite_pixel ; if not done, keep looping ; 2nt/3
;==============
; 12/13
raw_increment_y:
inc TEMPY ; each line has two y vars ; 5
inc TEMPY ; 5
dec CV ; decemenet total y count ; 5
bne put_sprite_raw_loop ; loop if not done ; 2nt/3
;==============
; 17/18
raw_sprite_done:
rts ; return ; 6

View File

@ -9,11 +9,13 @@ all: dentist_graphics.inc
dentist_graphics.inc: \
dentist_door_n.lzsa dentist_door_s.lzsa \
dentist_door_open_n.lzsa \
chair_view_s.lzsa chair_view_n.lzsa \
chair_close_s.lzsa chair_close_n.lzsa \
panel_up.lzsa \
panel.lzsa
echo "dentist_door_n_lzsa: .incbin \"dentist_door_n.lzsa\"" > dentist_graphics.inc
echo "dentist_door_open_n_lzsa: .incbin \"dentist_door_open_n.lzsa\"" >> dentist_graphics.inc
echo "dentist_door_s_lzsa: .incbin \"dentist_door_s.lzsa\"" >> dentist_graphics.inc
echo "chair_view_s_lzsa: .incbin \"chair_view_s.lzsa\"" >> dentist_graphics.inc
echo "chair_view_n_lzsa: .incbin \"chair_view_n.lzsa\"" >> dentist_graphics.inc

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 554 B

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,10 +1,19 @@
; init state
; in future we might load from disk
; initial state at start of game is for all vars to be 0
init_state:
lda #0
.if 1
lda #$0
ldy #WHICH_LOAD
init_state_loop:
sta 0,Y
iny
cpy #END_OF_SAVE
bne init_state_loop
rts
.else
; book pages
sta RED_PAGES_TAKEN
sta BLUE_PAGES_TAKEN
@ -63,5 +72,6 @@ init_state:
lda #$ff ; for debugging
sta MARKER_SWITCHES
.endif
rts

View File

@ -36,10 +36,10 @@ location1:
.byte $ff ; south exit_dir
.byte $ff ; east exit_dir
.byte $ff ; west exit_dir
.word dentist_door_n_lzsa ; north bg
.word dentist_door_s_lzsa ; south bg
.word $0000 ; east bg
.word $0000 ; west bg
.word dentist_door_open_n_lzsa ; north bg
.word dentist_door_s_lzsa ; south bg
.word $0000 ; east bg
.word $0000 ; west bg
.byte BG_NORTH | BG_SOUTH
.byte DIRECTION_S ; special exit
.byte 10,30 ; special x

View File

@ -151,8 +151,15 @@ CHANNEL_VALVES = $B6
CHANNEL_VALVE4 = $08
CHANNEL_VALVE5 = $10
CHANNEL_VALVE6 = $20
DENTIST_LIGHT = $B7
DENTIST_MONTH = $B8
DENTIST_DAY = $B9
DENTIST_CENTURY = $BA
DENTIST_YEAR = $BB
DENTIST_HOURS = $BC
DENTIST_MINUTES = $BD
END_OF_SAVE = $B7
END_OF_SAVE = $BE
; done game puzzle state