tfv: add print_both_pages() routine

This commit is contained in:
Vince Weaver 2017-11-18 14:31:03 -05:00
parent 600ee99c63
commit 294d0da64c
6 changed files with 92 additions and 21 deletions

View File

@ -1434,6 +1434,37 @@ void move_cursor(void) {
}
void print_both_pages(char *string) {
unsigned char temp;
temp=ram[DRAW_PAGE];
ram[DRAW_PAGE]=0;
move_and_print(string);
ram[DRAW_PAGE]=4;
move_and_print(string);
ram[DRAW_PAGE]=temp;
}
void move_and_print(char *string) {
int address;
address=gr_addr_lookup[ram[CV]];
address+=ram[CH];
address+=(ram[DRAW_PAGE]<<8);
ram[BASL]=address&0xff;
ram[BASH]=address>>8;
print(string);
}
void print(char *string) {

View File

@ -36,7 +36,9 @@ void clear_bottom(int page);
void vtab(int ypos);
void htab(int xpos);
void move_cursor(void);
void move_and_print(char *string);
void print(char *string);
void print_both_pages(char *string);
void print_inverse(char *string);
int plot(unsigned char xcoord, unsigned char ycoord);

View File

@ -646,26 +646,13 @@ int flying(void) {
}
return 0;
}
else {
int draw_save;
draw_save=ram[DRAW_PAGE];
ram[DRAW_PAGE]=PAGE0;
htab(11);
vtab(22);
move_cursor();
print("NEED TO LAND ON GRASS!");
ram[DRAW_PAGE]=PAGE1;
htab(11);
vtab(22);
move_cursor();
print("NEED TO LAND ON GRASS!");
ram[DRAW_PAGE]=draw_save;
print_both_pages("NEED TO LAND ON GRASS!");
}
}

View File

@ -232,7 +232,7 @@ check_land:
jsr lookup_map
cmp #COLOR_BOTH_LIGHTGREEN
bne landing_message
bne must_land_on_grass
landing_loop:
@ -271,8 +271,20 @@ landing_loop:
rts ; finish flying
landing_message:
must_land_on_grass:
lda #10
sta CH ; HTAB 11
lda #21
sta CV ; VTAB 22
lda #>(grass_string)
sta OUTH
lda #<(grass_string)
sta OUTL
jsr print_both_pages ; "NEED TO LAND ON GRASS!"
check_help:
cmp #('H')
@ -1036,3 +1048,6 @@ horizontal_lookup:
.byte $73,$60,$52,$48,$40,$39,$34,$30,$2C,$29,$26,$24,$21,$20,$1E,$1C
.byte $8C,$75,$64,$58,$4E,$46,$40,$3A,$36,$32,$2E,$2C,$29,$27,$25,$23
.byte $A6,$8A,$76,$68,$5C,$53,$4B,$45,$40,$3B,$37,$34,$30,$2E,$2B,$29
grass_string:
.asciiz "NEED TO LAND ON GRASS!"

View File

@ -25,15 +25,13 @@ shine_loop:
cmp #30
bne shine_loop
jsr page_flip
; Done, print string
lda #8
sta CH ; HTAB 9
lda #20
jsr TABV ; VTAB 21
sta CV ; VTAB 21
lda #>(vmwsw_string)
@ -41,7 +39,9 @@ shine_loop:
lda #<(vmwsw_string)
sta OUTL
jsr print_string ; print("A VMW SOFTWARE PRODUCTION");
jsr move_and_print ; print("A VMW SOFTWARE PRODUCTION");
jsr page_flip
jsr wait_until_keypressed

View File

@ -435,6 +435,25 @@ put_sprite_done_draw:
rts ; return
;================================
; move_and_print
;================================
; move to CH/CV
move_and_print:
lda CV
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
;================================
; print_string
;================================
@ -445,12 +464,29 @@ print_string_loop:
lda (OUTL),Y
beq done_print_string
ora #$80
jsr COUT1
sta (BASL),Y
iny
bne print_string_loop
done_print_string:
rts
;================================
; print_both_pages
;================================
print_both_pages:
lda DRAW_PAGE
pha
lda #0
sta DRAW_PAGE
jsr move_and_print
lda #4
sta DRAW_PAGE
jsr move_and_print
pla
sta DRAW_PAGE
;=========================================