tfv: some more progress on the name entry screen

This commit is contained in:
Vince Weaver 2017-06-27 00:55:41 -04:00
parent 7f449fcf12
commit 4622f15af9
2 changed files with 165 additions and 42 deletions

View File

@ -32,6 +32,7 @@ static unsigned char title_rle[]=
};
#if 0
static unsigned char test_sprite[]={
0x8,0x4,
0x55,0x50,0x00,0x00,0x00,0x00,0x00,0x00,
@ -39,6 +40,7 @@ static unsigned char test_sprite[]={
0xff,0x1f,0x4f,0x2f,0xff,0x22,0x20,0x00,
0x5f,0x5f,0x5f,0x5f,0xff,0xf2,0xf2,0xf2,
};
#endif
static unsigned char ship_forward[]={
0x5,0x3,
@ -68,6 +70,8 @@ static unsigned char ship_left[]={
#define YY 0x04
#define YADD 0x05
#define LOOP 0x06
#define MEMPTRL 0x07
#define MEMPTRH 0x08
static void draw_segment(void) {
@ -104,13 +108,42 @@ static void draw_logo(void) {
grsim_update();
}
static int repeat_until_keypressed(void) {
int ch;
while(1) {
ch=grsim_input();
if (ch!=0) break;
usleep(10000);
}
return ch;
}
static void apple_memset(char *ptr, int value, int length) {
a=value;
x=length;
y=0;
while(x>0) {
ptr[y]=a;
y++;
x--;
}
}
int main(int argc, char **argv) {
int ch;
int x,y;
char tempst[BUFSIZ];
char nameo[9];
int i;
int xx,yy;
int name_x=0;
int cursor_x=0,cursor_y=0;
@ -125,7 +158,7 @@ int main(int argc, char **argv) {
ram[MATCH]=100;
draw_logo();
usleep(100000);
usleep(200000);
for(ram[MATCH]=0;ram[MATCH]<30;ram[MATCH]++) {
draw_logo();
@ -139,14 +172,7 @@ int main(int argc, char **argv) {
basic_print("A VMW SOFTWARE PRODUCTION");
grsim_update();
while(1) {
ch=grsim_input();
if (ch!=0) break;
usleep(10000);
}
repeat_until_keypressed();
/* Title Screen */
grsim_unrle(title_rle,0x800);
@ -154,12 +180,7 @@ int main(int argc, char **argv) {
grsim_update();
while(1) {
ch=grsim_input();
if (ch!=0) break;
usleep(10000);
}
repeat_until_keypressed();
text();
home();
@ -194,7 +215,7 @@ int main(int argc, char **argv) {
//24
basic_print("PLEASE ENTER A NAME:");
for(x=0;x<9;x++) nameo[x]=0;
apple_memset(nameo,0,9);
grsim_update();
@ -204,30 +225,30 @@ int main(int argc, char **argv) {
basic_htab(12);
basic_vtab(3);
for(x=0;x<8;x++) {
if (x==name_x) {
for(yy=0;yy<8;yy++) {
if (yy==name_x) {
basic_inverse();
basic_print("+");
basic_normal();
basic_print(" ");
}
else if (nameo[x]==0) {
else if (nameo[yy]==0) {
basic_print("_ ");
}
else {
sprintf(tempst,"%c ",nameo[x]);
sprintf(tempst,"%c ",nameo[yy]);
basic_print(tempst);
}
}
for(y=0;y<8;y++) {
for(yy=0;yy<8;yy++) {
basic_htab(12);
basic_vtab(y*2+6);
for(x=0;x<8;x++) {
if (y<4) sprintf(tempst,"%c ",(y*8)+x+64);
else sprintf(tempst,"%c ",(y*8)+x);
basic_vtab(yy*2+6);
for(xx=0;xx<8;xx++) {
if (yy<4) sprintf(tempst,"%c ",(yy*8)+xx+64);
else sprintf(tempst,"%c ",(yy*8)+xx);
if ((x==cursor_x) && (y==cursor_y)) basic_inverse();
if ((xx==cursor_x) && (yy==cursor_y)) basic_inverse();
else basic_normal();
basic_print(tempst);
@ -326,7 +347,7 @@ int main(int argc, char **argv) {
/************************************************/
gr();
x=17; y=30;
xx=17; yy=30;
color_equals(0);
int direction=0;
@ -346,8 +367,8 @@ int main(int argc, char **argv) {
ch=grsim_input();
if ((ch=='q') || (ch==27)) break;
if ((ch=='i') || (ch==APPLE_UP)) if (y>20) y-=2;
if ((ch=='m') || (ch==APPLE_DOWN)) if (y<39) y+=2;
if ((ch=='i') || (ch==APPLE_UP)) if (yy>20) yy-=2;
if ((ch=='m') || (ch==APPLE_DOWN)) if (yy<39) yy+=2;
if ((ch=='j') || (ch==APPLE_LEFT)) {
direction--;
if (direction<-1) direction=-1;
@ -359,9 +380,9 @@ int main(int argc, char **argv) {
gr_copy(0x800,0x400);
if (direction==0) grsim_put_sprite(ship_forward,x,y);
if (direction==-1) grsim_put_sprite(ship_left,x,y);
if (direction==1) grsim_put_sprite(ship_right,x,y);
if (direction==0) grsim_put_sprite(ship_forward,xx,yy);
if (direction==-1) grsim_put_sprite(ship_left,xx,yy);
if (direction==1) grsim_put_sprite(ship_right,xx,yy);
grsim_update();

120
tfv/tfv.s
View File

@ -17,6 +17,9 @@ PADDLE_BUTTON0 EQU $C061
PADDL0 EQU $C064
PTRIG EQU $C070
;; BASIC ROUTINES
NORMAL EQU $F273
;; MONITOR ROUTINES
@ -26,12 +29,14 @@ CLRSCR EQU $F832 ;; Clear low-res screen
CLRTOP EQU $F836 ;; clear only top of low-res screen
SETCOL EQU $F864 ;; COLOR=A
TEXT EQU $FB36
VTAB EQU $FB5B
TABV EQU $FB5B ;; VTAB to A
BASCALC EQU $FBC1 ;;
VTAB EQU $FC22 ;; VTAB to CV
HOME EQU $FC58 ;; Clear the text screen
WAIT EQU $FCA8 ;; delay 1/2(26+27A+5A^2) us
SETINV EQU $FE80 ;; INVERSE
SETNORM EQU $FE84 ;; NORMAL
COUT EQU $FDED ;; output A to screen
COUT1 EQU $FDF0 ;; output A to screen
;; Zero page addresses
@ -49,6 +54,7 @@ H2 EQU $2C
V2 EQU $2D
MASK EQU $2E
COLOR EQU $30
INVFLG EQU $32
; Our zero-page addresses
; we try not to conflict with anything DOS, MONITOR or BASIC related
@ -60,6 +66,12 @@ XX EQU $E3
YY EQU $E4
YADD EQU $E5
LOOP EQU $E6
MEMPTRL EQU $E7
MEMPTRH EQU $E8
NAMEL EQU $E9
NAMEH EQU $EA
NAMEX EQU $EB
CHAR EQU $EC
FIRST EQU $F0
LASTKEY EQU $F1
@ -105,7 +117,7 @@ shine_loop:
sta CH ; HTAB 9
lda #20
jsr VTAB ; VTAB 21
jsr TABV ; VTAB 21
lda #>(vmwsw_string)
@ -118,9 +130,12 @@ shine_loop:
jsr wait_until_keypressed
;=================
; clear the screen
;=================
;======================
; show the title screen
;======================
title_screen:
jsr CLRTOP
lda #$c
@ -141,8 +156,6 @@ shine_loop:
lda #20
sta XPOS
title_screen:
jsr gr_copy
jsr wait_until_keypressed
@ -160,13 +173,87 @@ enter_name:
jsr print_string
; zero out name
lda #<(name)
sta MEMPTRL
sta NAMEL
lda #>(name)
sta MEMPTRH
sta NAMEH
lda #0
ldx #8
jsr memset
name_loop:
; HTAB 12
; VTAB 3
jsr NORMAL
lda #11
sta CH ; HTAB 12
lda #2
jsr TABV ; VTAB 3
ldy #0
sty NAMEX
name_line:
cpy NAMEX
bne name_notx
lda #'+'
jmp name_next
name_notx:
lda NAMEL,Y
beq name_zero
ora #$80
bne name_next
name_zero:
lda #('_'+$80)
name_next:
jsr COUT
lda #(' '+$80)
jsr COUT
iny
cpy #8
bne name_line
lda #7
sta CV
lda #('@'+$80)
sta CHAR
print_letters_loop:
lda #11
sta CH ; HTAB 12
jsr VTAB
ldy #0
print_letters_inner_loop:
lda CHAR
jsr COUT
inc CHAR
lda #(' '+$80)
jsr COUT
iny
cpy #$8
bne print_letters_inner_loop
jsr wait_until_keypressed
;=====================
; Start the game
;=====================
flying_start:
@ -234,6 +321,21 @@ exit:
;= ROUTINES
;=====================================================================
;======================
; memset
;======================
; a=value
; x=length
; MEMPTRL/MEMPTRH is address
memset:
ldy #0
memset_loop:
sta MEMPTRL,Y
iny
dex
bne memset_loop
rts
;=================
; display part of logo
;=================