mist: can read letter now

This commit is contained in:
Vince Weaver 2020-03-02 15:46:04 -05:00
parent c12b1ffdaa
commit 6e668a3363
7 changed files with 449 additions and 26 deletions

View File

@ -37,7 +37,7 @@ MIST: mist.o
mist.o: mist.s zp.inc hardware.inc \
mist_graphics.inc \
gr_copy.s gr_unrle.s audio.s
gr_copy.s gr_unrle.s audio.s text_print.s
ca65 -o mist.o mist.s -l mist.lst
####

199
mist/gr_fast_clear.s Normal file
View File

@ -0,0 +1,199 @@
;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_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_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_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

View File

@ -1,5 +1,5 @@
5 HOME
10 PRINT " LOADING MIST"
10 PRINT " LOADING MIST V0.1"
90 PRINT
100 PRINT" ______"
100 PRINT" A \/\/\/ SOFTWARE PRODUCTION"

View File

@ -542,6 +542,94 @@ done_turning:
rts
; Catherine,
; I've left for you a message
; of utmost importance in
; our fore-chamber beside
; the dock. Enter the number
; of Marker Switches on
; this island into the imager
; to retrieve the message.
; Yours,
; Atrus
letter:
; 01234567890123456789
.byte 9,1," CATHERINE, ",0
.byte 9,3," I THINK SOME WEIRD ",0
.byte 9,5," GUY IS OUT ROAMING ",0
.byte 9,7," AROUND OUR ISLAND! ",0
.byte 9,9," MAYBE HE CAN SOLVE ",0
.byte 9,11," ALL OF OUR DEEP ",0
.byte 9,13," FAMILY PROBLEMS ",0
.byte 9,15," WHILE I MESS ",0
.byte 9,17," WITH MY BOOKS. ",0
.byte 9,19," YOURS, ",0
.byte 9,21," ATRUS ",0
clear_line:
.byte 9,0, " ",0
;================
; read the letter
read_letter:
; jsr TEXT
; jsr HOME
bit KEYRESET
bit SET_TEXT
jsr clear_all
; clear
ldx #0
clear_line_loop:
lda #<clear_line
sta OUTL
lda #>clear_line
sta OUTH
stx clear_line+1
jsr move_and_print
inx
cpx #24
bne clear_line_loop
lda #<letter
sta OUTL
lda #>letter
sta OUTH
ldx #0
letter_loop:
jsr move_and_print
inx
cpx #12
bne letter_loop
jsr page_flip
wait_done_letter:
lda KEYPRESS
bpl wait_done_letter
bit KEYRESET
; turn graphics back on
bit SET_GR
; bit PAGE0
; bit FULLGR
rts
;==========================
; includes
;==========================
@ -551,8 +639,10 @@ done_turning:
.include "gr_offsets.s"
.include "gr_pageflip.s"
.include "gr_putsprite_crop.s"
.include "text_print.s"
.include "gr_fast_clear.s"
.include "audio.s"
.include "audio.s"
.include "mist_graphics.inc"
@ -778,14 +868,14 @@ location7:
.byte $ff ; south exit_dir
.byte DIRECTION_E ; east exit_dir
.byte DIRECTION_W ; west exit_dir
.byte $ff ; special exit
.byte $00 ; special exit
.word $0000 ; north bg
.word $0000 ; south bg
.word step_land2_e_rle ; east bg
.word step_land2_w_rle ; west bg
.byte $ff,$ff ; special x
.byte $ff,$ff ; special y
.word $0000 ; special function
.byte 29,32 ; special x
.byte 38,45 ; special y
.word read_letter-1
.byte BG_WEST | BG_EAST
; steps outside dentist chair branch
@ -991,16 +1081,6 @@ location16:
; Catherine,
; I've left for you a message
; of utmost importance in
; our fore-chamber beside
; the dock. Enter the number
; of Marker Switches on
; this island into the imager
; to retrieve the message.
; Yours,
; Atrus

View File

@ -780,15 +780,15 @@ step_land2_w_rle: .byte $28 ; ysize=48
.byte $CC, $A3,$44, $0C, $09, $99,$99, $A3,$90, $80
.byte $00, $44,$44, $C4, $AC,$CC, $44,$44, $A3,$CC, $44,$44
.byte $CC,$CC, $C4, $A3,$44, $4C, $8C,$8C, $00,$00, $88,$88
.byte $A4,$98, $08, $A6,$44, $A9,$CC, $44,$44, $A4,$CC, $44,$44
.byte $4C, $CC,$CC, $A3,$44, $88, $A4,$99, $90,$90, $00
.byte $09,$09, $A3,$CC, $C4,$C4, $A0,$02,$A4, $C4, $A4,$44, $4C,$4C
.byte $CC,$CC, $44,$44, $4C, $A3,$CC, $C4, $44,$44, $CC,$CC
.byte $C4, $84,$84, $A3,$80, $A4,$90, $A3,$08, $A5,$CC, $A0,$02,$AA
.byte $A7,$CC, $C4, $CC, $44,$44, $4C,$4C, $A4,$CC, $A3,$44
.byte $CC, $A6,$88, $89, $A5,$99, $C4, $44, $A3,$4C
.byte $4A, $CA,$CA, $A8,$CC, $A4,$44, $A5,$CC, $44,$44, $A9,$00
.byte $09, $A3,$99, $A0,$10,$CC
.byte $A4,$98, $08, $A4,$44, $F4,$F4, $FC, $A8,$CC, $44,$44
.byte $A4,$CC, $44,$44, $4C, $CC,$CC, $A3,$44, $88, $A4,$99
.byte $90,$90, $00, $09,$09, $A3,$CC, $C4,$C4, $A3,$FF, $A4,$44
.byte $4C,$4C, $CC,$CC, $44,$44, $4C, $A3,$CC, $C4, $44,$44
.byte $CC,$CC, $C4, $84,$84, $A3,$80, $A4,$90, $A3,$08, $A5,$CC
.byte $A3,$FF, $A6,$CC, $C4, $CC, $44,$44, $4C,$4C, $A4,$CC
.byte $A3,$44, $CC, $A6,$88, $89, $A5,$99, $C4, $44
.byte $A3,$4C, $4F, $CF,$CF, $A8,$CC, $A4,$44, $A5,$CC, $44,$44
.byte $A9,$00, $09, $A3,$99, $A0,$10,$CC
.byte $A1
step_land2_e_rle: .byte $28 ; ysize=48
.byte $A0,$16,$FF, $8F, $A0,$19,$FF, $88, $AD,$FF, $88, $A0,$14,$FF

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 12 KiB

144
mist/text_print.s Normal file
View File

@ -0,0 +1,144 @@
;================================
; move_and_print
;================================
; get X,Y from OUTL/OUTH
; then print following string to that address
; stop at NUL
; convert to APPLE ASCII (or with 0x80)
; leave OUTL/OUTH pointing to next string
move_and_print:
ldy #0
lda (OUTL),Y
sta CH
iny
lda (OUTL),Y
asl
tay
lda gr_offsets,Y ; lookup low-res memory address
clc
adc CH ; add in xpos
sta BASL ; store out low byte of addy
lda gr_offsets+1,Y ; look up high byte
adc DRAW_PAGE ;
sta BASH ; and store it out
; BASH:BASL now points at right place
clc
lda OUTL
adc #2
sta OUTL
lda OUTH
adc #0
sta OUTH
;================================
; print_string
;================================
print_string:
ldy #0
print_string_loop:
lda (OUTL),Y
beq done_print_string
ps_smc1:
and #$3f ; make sure we are inverse
sta (BASL),Y
iny
bne print_string_loop
done_print_string:
iny
clc
tya
adc OUTL
sta OUTL
lda OUTH
adc #0
sta OUTH
rts
.if 0
;================================
; move and print a list of lines
;================================
move_and_print_list:
jsr move_and_print
ldy #0
lda (OUTL),Y
bpl move_and_print_list
rts
;================================
; move and print a list of lines
;================================
move_and_print_list_both_pages:
lda DRAW_PAGE
pha
lda OUTL
pha
lda OUTH
pha
lda #0
sta DRAW_PAGE
jsr move_and_print_list
pla
sta OUTH
pla
sta OUTL
lda #4
sta DRAW_PAGE
jsr move_and_print_list
pla
sta DRAW_PAGE
rts
;=======================
; print to both pages
;=======================
print_both_pages:
lda DRAW_PAGE
pha
lda OUTL
pha
lda OUTH
pha
lda #0
sta DRAW_PAGE
jsr move_and_print
pla
sta OUTH
pla
sta OUTL
lda #4
sta DRAW_PAGE
jsr move_and_print
pla
sta DRAW_PAGE
rts
.endif