tfv: finally have code working as well as before page-flipping

This commit is contained in:
Vince Weaver 2017-08-13 22:59:37 -04:00
parent 65e3b2e60b
commit c04d93fa5b
4 changed files with 53 additions and 15 deletions

View File

@ -865,8 +865,28 @@ int gr_copy(short source, short dest) {
int i,j,l;
for(i=0;i<8;i++) {
source_addr=gr_addr_lookup[i]+0x400;
dest_addr=gr_addr_lookup[i];
source_addr=gr_addr_lookup[i]+(source-0x400);
dest_addr=gr_addr_lookup[i]+(dest-0x400);
if (i<4) l=120;
else l=80;
for(j=0;j<l;j++) {
ram[dest_addr+j]=ram[source_addr+j];
}
}
return 0;
}
int gr_copy_to_current(short source) {
short dest_addr,source_addr;
int i,j,l;
for(i=0;i<8;i++) {
source_addr=gr_addr_lookup[i]+(source-0x400);
dest_addr=gr_addr_lookup[i]+(0x400*ram[DRAW_PAGE]);
if (i<4) l=120;
else l=80;
@ -1346,7 +1366,7 @@ void move_cursor(void) {
address=gr_addr_lookup[ram[CV]];
address+=ram[CH];
hlin_addr+=(ram[DRAW_PAGE]*4)<<8;
address+=(ram[DRAW_PAGE]*4)<<8;
ram[BASL]=address&0xff;
ram[BASH]=address>>8;
@ -1363,3 +1383,13 @@ void print(char *string) {
}
ram[BASL]+=strlen(string);
}
void print_inverse(char *string) {
for(y=0;y<strlen(string);y++) {
a=string[y];
a=a&0x3f;
ram[y_indirect(BASL,y)]=a;
}
ram[BASL]+=strlen(string);
}

View File

@ -15,6 +15,7 @@ int grsim_unrle(unsigned char *rle_data, int address);
int home(void);
int grsim_put_sprite(int page,unsigned char *sprite_data, int xpos, int ypos);
int gr_copy(short source, short dest);
int gr_copy_to_current(short source);
int text(void);
void basic_htab(int x);
void basic_vtab(int y);
@ -35,6 +36,7 @@ void vtab(int ypos);
void htab(int xpos);
void move_cursor(void);
void print(char *string);
void print_inverse(char *string);
#define APPLE_UP 11

View File

@ -18,12 +18,19 @@ int title(void) {
int result;
home();
clear_bottom(0);
clear_bottom(1);
grsim_unrle(title_rle,0xc00);
gr_copy(0xc00,0x400);
grsim_update();
gr_copy_to_current(0xc00);
page_flip();
gr_copy_to_current(0xc00);
// page_flip();
// page_flip();
// grsim_update();
result=select_menu(12, 22, 3, title_menu);

View File

@ -3,6 +3,7 @@
#include <unistd.h>
#include <string.h>
#include "tfv_utils.h"
#include "gr-sim.h"
#include "tfv_zp.h"
@ -27,22 +28,20 @@ int select_menu(int x, int y, int num, char **items) {
while(1) {
for(i=0;i<num;i++) {
basic_htab(x);
basic_vtab(y+i);
htab(x);
vtab(y+i);
move_cursor();
if (i==result) {
basic_inverse();
basic_print("--> ");
print_inverse("--> ");
}
else {
basic_print(" ");
print(" ");
}
basic_print(items[i]);
basic_normal();
grsim_update();
print(items[i]);
}
page_flip();
ch=repeat_until_keypressed();
if (ch=='\r') break;