mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-09-28 02:55:03 +00:00
keen: more work on story
This commit is contained in:
parent
ce36d74251
commit
3c19cd57f5
@ -57,89 +57,172 @@ load_background:
|
|||||||
bit SET_TEXT
|
bit SET_TEXT
|
||||||
bit PAGE1
|
bit PAGE1
|
||||||
|
|
||||||
|
|
||||||
lda #<story_data
|
lda #<story_data
|
||||||
sta START_LINE_L
|
sta START_LINE_L
|
||||||
lda #>story_data
|
lda #>story_data
|
||||||
sta START_LINE_H
|
sta START_LINE_H
|
||||||
|
|
||||||
|
;===========================
|
||||||
|
; main loop
|
||||||
|
;===========================
|
||||||
|
; 16 + 16 * (16 + 40*(39) +7) + 17 + 17*40
|
||||||
|
; 16 + 16*(1583) + 17 + 680
|
||||||
|
; 16 + 25328 + 17 + 680
|
||||||
|
; 26041 = 400 lines :( we're on 16*8=128
|
||||||
|
|
||||||
redraw_text:
|
redraw_text:
|
||||||
|
|
||||||
ldx #0
|
ldx #0 ; 2
|
||||||
|
|
||||||
lda START_LINE_L
|
lda START_LINE_L ; 3
|
||||||
sta INL
|
sta input_smc+1 ; 4
|
||||||
lda START_LINE_H
|
lda START_LINE_H ; 3
|
||||||
sta INH
|
sta input_smc+2 ; 4
|
||||||
|
;===========
|
||||||
|
; 16
|
||||||
|
|
||||||
outer_text_loop:
|
outer_text_loop:
|
||||||
|
|
||||||
lda gr_offsets_low,X
|
lda gr_offsets_low,X ; 4+
|
||||||
sta OUTL
|
sta OUTL ; 3
|
||||||
lda gr_offsets_high,X
|
lda gr_offsets_high,X ; 4+
|
||||||
sta OUTH
|
sta OUTH ; 3
|
||||||
|
|
||||||
|
ldy #0 ; 2
|
||||||
|
;============
|
||||||
|
; 16
|
||||||
|
|
||||||
ldy #39
|
|
||||||
inner_text_loop:
|
inner_text_loop:
|
||||||
lda (INL),Y
|
|
||||||
sta (OUTL),Y
|
|
||||||
dey
|
|
||||||
bpl inner_text_loop
|
|
||||||
|
|
||||||
clc
|
input_smc:
|
||||||
lda INL
|
lda story_bg ; 4
|
||||||
adc #40
|
sta (OUTL),Y ; 6
|
||||||
sta INL
|
|
||||||
lda INH
|
|
||||||
adc #0
|
|
||||||
sta INH
|
|
||||||
|
|
||||||
inx
|
clc ; 2
|
||||||
cpx #17
|
lda input_smc+1 ; 4
|
||||||
bne outer_text_loop
|
adc #1 ; 2
|
||||||
|
sta input_smc+1 ; 4
|
||||||
|
lda input_smc+2 ; 4
|
||||||
|
adc #0 ; 2
|
||||||
|
sta input_smc+2 ; 4
|
||||||
|
|
||||||
|
iny ; 2
|
||||||
|
cpy #40 ; 2
|
||||||
|
bne inner_text_loop ; 2/3
|
||||||
|
;============
|
||||||
|
; 39
|
||||||
|
|
||||||
|
; -1
|
||||||
|
|
||||||
|
|
||||||
|
inx ; 2
|
||||||
|
cpx #16 ; 2
|
||||||
|
bne outer_text_loop ; 2/3
|
||||||
|
;============
|
||||||
|
; 7
|
||||||
|
|
||||||
|
; -1
|
||||||
;==================
|
;==================
|
||||||
; draw message
|
; draw message
|
||||||
;==================
|
;==================
|
||||||
|
|
||||||
ldx #18
|
ldx #17 ; 2
|
||||||
lda gr_offsets_low,X
|
lda gr_offsets_low,X ; 4+
|
||||||
sta OUTL
|
sta OUTL ; 3
|
||||||
lda gr_offsets_high,X
|
lda gr_offsets_high,X ; 4+
|
||||||
sta OUTH
|
sta OUTH ; 3
|
||||||
|
|
||||||
|
ldy #39 ; 2
|
||||||
|
;==================
|
||||||
|
; 17
|
||||||
|
|
||||||
ldy #39
|
|
||||||
message_text_loop:
|
message_text_loop:
|
||||||
lda message,Y
|
lda message,Y ; 4+
|
||||||
and #$3f
|
and #$3f ; 2
|
||||||
sta (OUTL),Y
|
sta (OUTL),Y ; 6
|
||||||
dey
|
dey ; 2
|
||||||
bpl message_text_loop
|
bpl message_text_loop ; 2/3
|
||||||
|
|
||||||
|
;==================
|
||||||
|
; 17*40
|
||||||
|
|
||||||
jsr wait_until_keypress
|
; -1
|
||||||
|
|
||||||
and #$7f ; clear high bit
|
;===================================
|
||||||
and #$df ; change lower to upper
|
; can we do this constant time?
|
||||||
|
;===================================
|
||||||
|
|
||||||
cmp #13
|
check_keypress:
|
||||||
beq done_with_story
|
lda KEYPRESS ; 4
|
||||||
cmp #27
|
bpl done_key7 ; 2/3
|
||||||
beq done_with_story
|
; 6
|
||||||
|
bit KEYRESET ; 4
|
||||||
|
|
||||||
cmp #'W'
|
and #$7f ; clear high bit ; 2
|
||||||
beq do_up
|
and #$df ; change lower to upper ; 2
|
||||||
cmp #$0B
|
; 14
|
||||||
beq do_up
|
cmp #13 ; 2
|
||||||
|
beq done_with_story ; 2/3
|
||||||
|
; 18
|
||||||
|
cmp #27 ; 2
|
||||||
|
beq done_with_story ; 2/3
|
||||||
|
; 22
|
||||||
|
cmp #'W' ; 2
|
||||||
|
beq do_up ; 2/3
|
||||||
|
; 26
|
||||||
|
cmp #$0B ; 2
|
||||||
|
beq do_up ; 2/3
|
||||||
|
; 30
|
||||||
|
cmp #'S' ; 2
|
||||||
|
beq do_down ; 2/3
|
||||||
|
; 34
|
||||||
|
cmp #$0A ; 2
|
||||||
|
beq do_down ; 2/3
|
||||||
|
; 38
|
||||||
|
bne done_key41 ; bra ; 3
|
||||||
|
|
||||||
cmp #'S'
|
done_key7:
|
||||||
beq do_down
|
; need to waste 34 cycles
|
||||||
cmp #$0A
|
|
||||||
beq do_down
|
inc $00 ; 5
|
||||||
|
inc $00 ; 5
|
||||||
|
inc $00 ; 5
|
||||||
|
inc $00 ; 5
|
||||||
|
inc $00 ; 5
|
||||||
|
inc $00 ; 5
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
done_key41:
|
||||||
|
inc $00
|
||||||
|
nop
|
||||||
|
|
||||||
|
; 18*8*65= 9360
|
||||||
|
; want to delay 9360 - 41 - 7 - 4 = 9308 - 20 = 9288/9 = 1032
|
||||||
|
; 1032/256= 4 r 8
|
||||||
|
;
|
||||||
|
|
||||||
|
lda #4 ; 2
|
||||||
|
ldy #8 ; 2
|
||||||
|
jsr delay_loop
|
||||||
|
|
||||||
|
; want to delay 6*8*65 = 3120+4550 = 7670
|
||||||
|
; want to delay 7670 - 15 - 12 = 7643 - 20 = 7623/9 = 847
|
||||||
|
; 905/256=3 r 79
|
||||||
|
|
||||||
|
inc $00 ; nop5
|
||||||
|
inc $00 ; nop5
|
||||||
|
nop ; nop2
|
||||||
|
|
||||||
|
bit SET_GR ; 4
|
||||||
|
|
||||||
|
lda #3 ; 2
|
||||||
|
ldy #79 ; 2
|
||||||
|
jsr delay_loop
|
||||||
|
bit SET_TEXT ; 4
|
||||||
|
|
||||||
done_key:
|
done_key:
|
||||||
jmp redraw_text
|
|
||||||
|
jmp check_keypress ; 3
|
||||||
|
|
||||||
do_up:
|
do_up:
|
||||||
lda START_LINE_H
|
lda START_LINE_H
|
||||||
@ -171,7 +254,6 @@ do_down:
|
|||||||
beq done_key
|
beq done_key
|
||||||
|
|
||||||
down_ok:
|
down_ok:
|
||||||
|
|
||||||
clc
|
clc
|
||||||
lda START_LINE_L
|
lda START_LINE_L
|
||||||
adc #40
|
adc #40
|
||||||
@ -181,7 +263,6 @@ down_ok:
|
|||||||
sta START_LINE_H
|
sta START_LINE_H
|
||||||
jmp redraw_text
|
jmp redraw_text
|
||||||
|
|
||||||
|
|
||||||
done_with_story:
|
done_with_story:
|
||||||
|
|
||||||
|
|
||||||
@ -199,7 +280,7 @@ done_with_story:
|
|||||||
.include "gr_copy.s"
|
.include "gr_copy.s"
|
||||||
; .include "wait_a_bit.s"
|
; .include "wait_a_bit.s"
|
||||||
.include "gr_offsets.s"
|
.include "gr_offsets.s"
|
||||||
.include "gr_offsets_split.s"
|
|
||||||
.include "zx02_optim.s"
|
.include "zx02_optim.s"
|
||||||
|
|
||||||
.include "gr_fast_clear.s"
|
.include "gr_fast_clear.s"
|
||||||
@ -222,6 +303,27 @@ wait_until_keypress:
|
|||||||
bit KEYRESET
|
bit KEYRESET
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
.align $100
|
||||||
|
|
||||||
message:
|
message:
|
||||||
.byte " ESC TO EXIT / ARROWS TO READ ",0
|
.byte " ESC TO EXIT / ARROWS TO READ ",0
|
||||||
|
|
||||||
|
.include "gr_offsets_split.s"
|
||||||
|
|
||||||
|
|
||||||
|
;=====================================
|
||||||
|
; short delay by Bruce Clark
|
||||||
|
; any delay between 8 to 589832 with res of 9
|
||||||
|
;=====================================
|
||||||
|
; 9*(256*A+Y)+8 + 12 for jsr/rts
|
||||||
|
; A and Y both $FF at the end
|
||||||
|
|
||||||
|
size_delay:
|
||||||
|
|
||||||
|
delay_loop:
|
||||||
|
cpy #1
|
||||||
|
dey
|
||||||
|
sbc #0
|
||||||
|
bcs delay_loop
|
||||||
|
delay_12:
|
||||||
|
rts
|
||||||
|
Loading…
Reference in New Issue
Block a user