mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-09-28 17:55:04 +00:00
wargames: adjust text printing
This commit is contained in:
parent
338152eef6
commit
5c4451b507
5
demos/wargames/gr_offsets.s
Normal file
5
demos/wargames/gr_offsets.s
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
gr_offsets:
|
||||||
|
.word $400,$480,$500,$580,$600,$680,$700,$780
|
||||||
|
.word $428,$4a8,$528,$5a8,$628,$6a8,$728,$7a8
|
||||||
|
.word $450,$4d0,$550,$5d0,$650,$6d0,$750,$7d0
|
||||||
|
|
@ -60,6 +60,11 @@ ssi263_speech_init:
|
|||||||
ldx #SSI263_I
|
ldx #SSI263_I
|
||||||
jsr ssi263_write_chip
|
jsr ssi263_write_chip
|
||||||
|
|
||||||
|
; Set the busy flag
|
||||||
|
lda #$00
|
||||||
|
sta speech_busy
|
||||||
|
|
||||||
|
|
||||||
cli ; enable interrupts
|
cli ; enable interrupts
|
||||||
|
|
||||||
rts
|
rts
|
||||||
@ -85,6 +90,7 @@ ssi263_speak:
|
|||||||
|
|
||||||
sei ; disable interrupts
|
sei ; disable interrupts
|
||||||
|
|
||||||
|
|
||||||
; Set the busy flag
|
; Set the busy flag
|
||||||
lda #$FF
|
lda #$FF
|
||||||
sta speech_busy
|
sta speech_busy
|
||||||
@ -135,7 +141,7 @@ ssi263_speech_irq:
|
|||||||
tya
|
tya
|
||||||
pha ; save Y
|
pha ; save Y
|
||||||
|
|
||||||
inc $0404 ; irq indicator on screen
|
; inc $0404 ; irq indicator on screen
|
||||||
|
|
||||||
; be sure it was a 6522#2 interrupt
|
; be sure it was a 6522#2 interrupt
|
||||||
ldx #VIA6522_IFR2
|
ldx #VIA6522_IFR2
|
||||||
@ -205,7 +211,7 @@ speech_end:
|
|||||||
sta speech_busy
|
sta speech_busy
|
||||||
sta speech_playing
|
sta speech_playing
|
||||||
|
|
||||||
; Re-enable interrupt in 6522
|
; Disable interrupt in 6522
|
||||||
lda #VIA6522_IER2_CA1
|
lda #VIA6522_IER2_CA1
|
||||||
ldx #VIA6522_IER2
|
ldx #VIA6522_IER2
|
||||||
jsr ssi263_write_chip
|
jsr ssi263_write_chip
|
||||||
|
211
demos/wargames/text_print.s
Normal file
211
demos/wargames/text_print.s
Normal file
@ -0,0 +1,211 @@
|
|||||||
|
;=============================
|
||||||
|
; normal_text
|
||||||
|
;=============================
|
||||||
|
; modify so print normal text
|
||||||
|
normal_text:
|
||||||
|
|
||||||
|
; want ora #$80
|
||||||
|
lda #$09
|
||||||
|
sta ps_smc1
|
||||||
|
|
||||||
|
lda #$80
|
||||||
|
sta ps_smc1+1
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
;=============================
|
||||||
|
; inverse_text
|
||||||
|
;=============================
|
||||||
|
; modify so print inverse text
|
||||||
|
inverse_text:
|
||||||
|
|
||||||
|
; want and #$3f
|
||||||
|
lda #$29
|
||||||
|
sta ps_smc1
|
||||||
|
|
||||||
|
lda #$3f
|
||||||
|
sta ps_smc1+1
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
;=============================
|
||||||
|
; flash_text
|
||||||
|
;=============================
|
||||||
|
; modify so print flashing text
|
||||||
|
flash_text:
|
||||||
|
|
||||||
|
; want ora #$30
|
||||||
|
lda #$09
|
||||||
|
sta ps_smc1
|
||||||
|
|
||||||
|
lda #$40
|
||||||
|
sta ps_smc1+1
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
;=============================
|
||||||
|
; raw text
|
||||||
|
;=============================
|
||||||
|
; modify so print raw string
|
||||||
|
raw_text:
|
||||||
|
|
||||||
|
; want nop nop
|
||||||
|
lda #$EA
|
||||||
|
sta ps_smc1
|
||||||
|
|
||||||
|
lda #$EA
|
||||||
|
sta ps_smc1+1
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;================================
|
||||||
|
; 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
|
||||||
|
|
||||||
|
delay_smc:
|
||||||
|
lda #0
|
||||||
|
beq print_string_loop
|
||||||
|
jsr WAIT
|
||||||
|
jmp print_string_loop
|
||||||
|
done_print_string:
|
||||||
|
iny
|
||||||
|
clc
|
||||||
|
tya
|
||||||
|
adc OUTL
|
||||||
|
sta OUTL
|
||||||
|
lda OUTH
|
||||||
|
adc #0
|
||||||
|
sta OUTH
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
;================================
|
||||||
|
; 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
|
||||||
|
|
@ -11,9 +11,16 @@ VGI_CY = P2
|
|||||||
VGI_CR = P3
|
VGI_CR = P3
|
||||||
|
|
||||||
NIBCOUNT = $09
|
NIBCOUNT = $09
|
||||||
|
CH = $24
|
||||||
|
CV = $25
|
||||||
|
BASL = $27
|
||||||
|
BASH = $28
|
||||||
|
|
||||||
HGR_COLOR = $E4
|
HGR_COLOR = $E4
|
||||||
|
|
||||||
|
DRAW_PAGE = $FA
|
||||||
|
OUTL = $FB
|
||||||
|
OUTH = $FC
|
||||||
MISSILE_LOW = $FD
|
MISSILE_LOW = $FD
|
||||||
MISSILE_HIGH = $FE
|
MISSILE_HIGH = $FE
|
||||||
FRAME = $FF
|
FRAME = $FF
|
||||||
@ -42,6 +49,47 @@ MISSILE_RADIUS = 12
|
|||||||
|
|
||||||
|
|
||||||
wargames:
|
wargames:
|
||||||
|
;===========================
|
||||||
|
;===========================
|
||||||
|
; initial message
|
||||||
|
;===========================
|
||||||
|
;===========================
|
||||||
|
|
||||||
|
jsr HOME
|
||||||
|
|
||||||
|
lda #<header
|
||||||
|
sta OUTL
|
||||||
|
lda #>header
|
||||||
|
sta OUTH
|
||||||
|
|
||||||
|
jsr normal_text
|
||||||
|
|
||||||
|
jsr move_and_print
|
||||||
|
jsr move_and_print
|
||||||
|
|
||||||
|
; USSR FIRST STRIKE
|
||||||
|
|
||||||
|
jsr next_step
|
||||||
|
|
||||||
|
; US FIRST STRIKE
|
||||||
|
|
||||||
|
jsr next_step
|
||||||
|
|
||||||
|
; NATO / WARSAW PACT
|
||||||
|
|
||||||
|
jsr next_step
|
||||||
|
|
||||||
|
; FAR EAST STRATEGY
|
||||||
|
|
||||||
|
jsr move_and_print
|
||||||
|
|
||||||
|
jsr wait_1s
|
||||||
|
|
||||||
|
;===========================
|
||||||
|
;===========================
|
||||||
|
; exchange
|
||||||
|
;===========================
|
||||||
|
;===========================
|
||||||
|
|
||||||
jsr HGR
|
jsr HGR
|
||||||
|
|
||||||
@ -171,7 +219,7 @@ missile_explode:
|
|||||||
|
|
||||||
sta VGI_CR
|
sta VGI_CR
|
||||||
|
|
||||||
cmp #15
|
cmp #12
|
||||||
bcc not_done_explosion
|
bcc not_done_explosion
|
||||||
|
|
||||||
lda #STATUS_DONE
|
lda #STATUS_DONE
|
||||||
@ -204,37 +252,115 @@ done_missile_loop:
|
|||||||
|
|
||||||
done_missiles:
|
done_missiles:
|
||||||
|
|
||||||
|
;============================
|
||||||
|
; print WINNER: NONE
|
||||||
|
|
||||||
|
jsr move_and_print
|
||||||
|
|
||||||
|
jsr wait_1s
|
||||||
|
|
||||||
|
|
||||||
;=========================================
|
;=========================================
|
||||||
|
; print flashing code
|
||||||
|
|
||||||
jsr HOME
|
jsr HOME
|
||||||
|
|
||||||
|
bit SET_TEXT
|
||||||
|
|
||||||
|
jsr flash_text
|
||||||
|
|
||||||
|
jsr move_and_print
|
||||||
|
|
||||||
|
jsr wait_1s
|
||||||
|
|
||||||
|
jsr normal_text
|
||||||
|
|
||||||
|
;=========================================
|
||||||
|
; final message
|
||||||
|
|
||||||
|
jsr HOME
|
||||||
|
|
||||||
|
|
||||||
lda #4 ; assume slot #4 for now
|
lda #4 ; assume slot #4 for now
|
||||||
jsr detect_ssi263
|
jsr detect_ssi263
|
||||||
|
|
||||||
lda irq_count
|
|
||||||
clc
|
|
||||||
adc #'A' ; hack to show if detected or not
|
|
||||||
sta $400 ; (B is detected, A is not)
|
|
||||||
|
|
||||||
lda #4 ; assume slot #4 for now
|
lda #4 ; assume slot #4 for now
|
||||||
jsr ssi263_speech_init
|
jsr ssi263_speech_init
|
||||||
|
|
||||||
|
|
||||||
speech_loop:
|
speech_loop:
|
||||||
|
|
||||||
; trogdor
|
; greetings
|
||||||
|
|
||||||
lda #<trogdor
|
; adjust text speed
|
||||||
|
lda #150
|
||||||
|
sta delay_smc+1
|
||||||
|
|
||||||
|
lda #<greetings
|
||||||
sta SPEECH_PTRL
|
sta SPEECH_PTRL
|
||||||
lda #>trogdor
|
lda #>greetings
|
||||||
sta SPEECH_PTRH
|
sta SPEECH_PTRH
|
||||||
|
|
||||||
jsr ssi263_speak
|
jsr ssi263_speak
|
||||||
|
|
||||||
|
jsr move_and_print
|
||||||
|
|
||||||
|
; wait for it to complete
|
||||||
|
|
||||||
|
wait1:
|
||||||
|
lda speech_busy
|
||||||
|
bne wait1
|
||||||
|
|
||||||
|
jsr wait_1s
|
||||||
|
|
||||||
|
; strange
|
||||||
|
|
||||||
|
lda #<strange
|
||||||
|
sta SPEECH_PTRL
|
||||||
|
lda #>strange
|
||||||
|
sta SPEECH_PTRH
|
||||||
|
|
||||||
|
jsr ssi263_speak
|
||||||
|
|
||||||
|
jsr move_and_print
|
||||||
|
|
||||||
|
wait2:
|
||||||
|
lda speech_busy
|
||||||
|
bne wait2
|
||||||
|
|
||||||
|
jsr wait_1s
|
||||||
|
|
||||||
|
; winning
|
||||||
|
|
||||||
|
lda #<winning
|
||||||
|
sta SPEECH_PTRL
|
||||||
|
lda #>winning
|
||||||
|
sta SPEECH_PTRH
|
||||||
|
|
||||||
|
jsr ssi263_speak
|
||||||
|
|
||||||
|
jsr move_and_print
|
||||||
|
jsr move_and_print
|
||||||
|
|
||||||
|
wait3:
|
||||||
|
lda speech_busy
|
||||||
|
bne wait3
|
||||||
|
|
||||||
|
bit KEYRESET
|
||||||
|
|
||||||
jsr wait_until_keypress
|
jsr wait_until_keypress
|
||||||
|
|
||||||
jmp speech_loop
|
; restore text delay to 0
|
||||||
|
|
||||||
|
lda #0
|
||||||
|
sta delay_smc+1
|
||||||
|
|
||||||
|
jmp wargames
|
||||||
|
|
||||||
|
|
||||||
|
;======================
|
||||||
|
; wait until keypress
|
||||||
|
;======================
|
||||||
wait_until_keypress:
|
wait_until_keypress:
|
||||||
|
|
||||||
lda KEYPRESS
|
lda KEYPRESS
|
||||||
@ -253,12 +379,15 @@ wait_until_keypress:
|
|||||||
|
|
||||||
.include "circles.s"
|
.include "circles.s"
|
||||||
|
|
||||||
|
.include "text_print.s"
|
||||||
|
.include "gr_offsets.s"
|
||||||
|
|
||||||
; the document
|
; the document
|
||||||
; "Phonetic Speech Dictionary for the SC-01 Speech Synthesizer"
|
; "Phonetic Speech Dictionary for the SC-01 Speech Synthesizer"
|
||||||
; sc01-dictionary.pdf
|
; sc01-dictionary.pdf
|
||||||
; was very helpful here
|
; was very helpful here
|
||||||
|
|
||||||
trogdor:
|
greetings:
|
||||||
.byte PHONEME_PAUSE ; PA
|
.byte PHONEME_PAUSE ; PA
|
||||||
.byte PHONEME_PAUSE ; PA
|
.byte PHONEME_PAUSE ; PA
|
||||||
|
|
||||||
@ -295,14 +424,9 @@ trogdor:
|
|||||||
.byte PHONEME_UH1 ; UH1
|
.byte PHONEME_UH1 ; UH1
|
||||||
.byte PHONEME_N ; N
|
.byte PHONEME_N ; N
|
||||||
|
|
||||||
.byte PHONEME_PAUSE ; PA
|
.byte $FF
|
||||||
.byte PHONEME_PAUSE ; PA
|
|
||||||
.byte PHONEME_PAUSE ; PA
|
strange:
|
||||||
.byte PHONEME_PAUSE ; PA
|
|
||||||
.byte PHONEME_PAUSE ; PA
|
|
||||||
.byte PHONEME_PAUSE ; PA
|
|
||||||
.byte PHONEME_PAUSE ; PA
|
|
||||||
.byte PHONEME_PAUSE ; PA
|
|
||||||
|
|
||||||
; A strange game.
|
; A strange game.
|
||||||
|
|
||||||
@ -332,9 +456,9 @@ trogdor:
|
|||||||
.byte PHONEME_PAUSE ; PA
|
.byte PHONEME_PAUSE ; PA
|
||||||
.byte PHONEME_PAUSE ; PA
|
.byte PHONEME_PAUSE ; PA
|
||||||
|
|
||||||
.byte PHONEME_PAUSE ; PA
|
.byte $FF
|
||||||
.byte PHONEME_PAUSE ; PA
|
|
||||||
|
|
||||||
|
winning:
|
||||||
; The only winning move is not to play.
|
; The only winning move is not to play.
|
||||||
|
|
||||||
.byte PHONEME_THV ; THV ; The
|
.byte PHONEME_THV ; THV ; The
|
||||||
@ -405,22 +529,29 @@ map_lzsa:
|
|||||||
|
|
||||||
|
|
||||||
header:
|
header:
|
||||||
.byte "STRATEGY: WINNER:",0
|
.byte 0,0,"STRATEGY:",0
|
||||||
.byte "USSR FIRST STRIKE",0
|
.byte 24,0,"WINNER:",0
|
||||||
.byte "U.S. FIRST STRIKE",0
|
.byte 0,1,"USSR FIRST STRIKE",0
|
||||||
.byte "NATO / WARSAW PACT",0
|
.byte 27,1,"NONE",0
|
||||||
.byte "FAR EAST STRATEGY",0
|
.byte 0,2,"U.S. FIRST STRIKE",0
|
||||||
|
.byte 27,2,"NONE",0
|
||||||
|
.byte 0,3,"NATO / WARSAW PACT",0
|
||||||
ending:
|
.byte 27,3,"NONE",0
|
||||||
.byte "GREETINGS PROFESSOR FALKEN",0
|
.byte 0,4,"FAR EAST STRATEGY",0
|
||||||
.byte "A STRANGE GAME",0
|
winner:
|
||||||
.byte "THE ONLY WINNING MOVE IS"
|
.byte 14,21,"WINNER: NONE",0
|
||||||
.byte "NOT TO PLAY.",0
|
|
||||||
|
|
||||||
|
|
||||||
code:
|
code:
|
||||||
.byte "CPE1704TKS",0
|
.byte 15,21,"CPE1704TKS",0
|
||||||
|
|
||||||
|
ending:
|
||||||
|
.byte 0,0,"GREETINGS PROFESSOR FALKEN",0
|
||||||
|
.byte 0,10,"A STRANGE GAME",0
|
||||||
|
.byte 0,11,"THE ONLY WINNING MOVE IS",0
|
||||||
|
.byte 0,12,"NOT TO PLAY.",0
|
||||||
|
|
||||||
|
; .byte "HOW ABOUT A NICE GAME OF CHESS",0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -436,3 +567,31 @@ missiles:
|
|||||||
.byte $00 ; radius
|
.byte $00 ; radius
|
||||||
.byte $00,$00,$00 ; padding
|
.byte $00,$00,$00 ; padding
|
||||||
|
|
||||||
|
;===================
|
||||||
|
; next step
|
||||||
|
;===================
|
||||||
|
next_step:
|
||||||
|
jsr move_and_print
|
||||||
|
|
||||||
|
jsr wait_1s
|
||||||
|
|
||||||
|
jsr move_and_print
|
||||||
|
|
||||||
|
jsr wait_1s
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
;==================
|
||||||
|
; wait 1s
|
||||||
|
;==================
|
||||||
|
wait_1s:
|
||||||
|
ldx #10
|
||||||
|
|
||||||
|
wait_1s_loop:
|
||||||
|
lda #200
|
||||||
|
jsr WAIT
|
||||||
|
|
||||||
|
dex
|
||||||
|
bne wait_1s_loop
|
||||||
|
|
||||||
|
rts
|
||||||
|
@ -205,7 +205,7 @@ speech_end:
|
|||||||
sta speech_busy
|
sta speech_busy
|
||||||
sta speech_playing
|
sta speech_playing
|
||||||
|
|
||||||
; Re-enable interrupt in 6522
|
; Disable interrupt in 6522
|
||||||
lda #VIA6522_IER2_CA1
|
lda #VIA6522_IER2_CA1
|
||||||
ldx #VIA6522_IER2
|
ldx #VIA6522_IER2
|
||||||
jsr ssi263_write_chip
|
jsr ssi263_write_chip
|
||||||
|
Loading…
Reference in New Issue
Block a user