From 294d0da64c0fb806ed938f185e321d629a9847a7 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Sat, 18 Nov 2017 14:31:03 -0500 Subject: [PATCH] tfv: add print_both_pages() routine --- gr-sim/gr-sim.c | 31 +++++++++++++++++++++++++++++++ gr-sim/gr-sim.h | 2 ++ gr-sim/tfv_flying.c | 15 +-------------- tfv/tfv_flying.s | 19 +++++++++++++++++-- tfv/tfv_opener.s | 8 ++++---- tfv/tfv_utils.s | 38 +++++++++++++++++++++++++++++++++++++- 6 files changed, 92 insertions(+), 21 deletions(-) diff --git a/gr-sim/gr-sim.c b/gr-sim/gr-sim.c index 4e3dd5e1..8f5b5311 100644 --- a/gr-sim/gr-sim.c +++ b/gr-sim/gr-sim.c @@ -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) { diff --git a/gr-sim/gr-sim.h b/gr-sim/gr-sim.h index 7162440c..b7e0c8e9 100644 --- a/gr-sim/gr-sim.h +++ b/gr-sim/gr-sim.h @@ -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); diff --git a/gr-sim/tfv_flying.c b/gr-sim/tfv_flying.c index 9549a26e..e391c9e6 100644 --- a/gr-sim/tfv_flying.c +++ b/gr-sim/tfv_flying.c @@ -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!"); } } diff --git a/tfv/tfv_flying.s b/tfv/tfv_flying.s index 6258c9fe..f9972e6d 100644 --- a/tfv/tfv_flying.s +++ b/tfv/tfv_flying.s @@ -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!" diff --git a/tfv/tfv_opener.s b/tfv/tfv_opener.s index 9cac8fc7..5133c22d 100644 --- a/tfv/tfv_opener.s +++ b/tfv/tfv_opener.s @@ -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 diff --git a/tfv/tfv_utils.s b/tfv/tfv_utils.s index 2d4dc1a1..c80ce98e 100644 --- a/tfv/tfv_utils.s +++ b/tfv/tfv_utils.s @@ -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 ;=========================================