tfv: add screen clearing routines

This commit is contained in:
Vince Weaver 2017-08-12 20:35:36 -04:00
parent 37c0a98574
commit b39269aaf5
5 changed files with 37 additions and 5 deletions

View File

@ -1309,3 +1309,22 @@ int collision(int xx, int yy, int ground_color) {
return collide;
}
void clear_top(int page) {
int i;
ram[COLOR]=0x0;
for(i=0;i<40;i+=2) {
hlin_double(page,0,40,i);
}
}
void clear_bottom(int page) {
int i;
/* NORMAL space */
ram[COLOR]=0xa0;
for(i=40;i<48;i+=2) {
hlin_double(page,0,40,i);
}
}

View File

@ -29,6 +29,9 @@ void soft_switch(unsigned short address);
int soft_switch_read(unsigned short address);
int vlin(int page, int y1, int y2, int at);
int collision(int xx, int yy, int ground_color);
void clear_top(int page);
void clear_bottom(int page);
#define APPLE_UP 11
#define APPLE_DOWN 10

View File

@ -955,12 +955,22 @@ int main(int argc, char **argv) {
grsim_init();
ram[DISP_PAGE]=0;
ram[DRAW_PAGE]=0;
home();
gr();
/* Clear bottom of zero page */
apple_memset(&ram[0],0,16);
/* clear top page0 */
/* clear top page1 */
clear_top(0);
clear_top(1);
/* clear bottom page0 */
/* clear bottom page1 */
clear_bottom(0);
clear_bottom(1);
/* Do Opening */
opening();

View File

@ -58,7 +58,7 @@ int select_menu(int x, int y, int num, char **items) {
return result;
}
void apple_memset(char *ptr, int value, int length) {
void apple_memset(unsigned char *ptr, int value, int length) {
a=value;
x=length;

View File

@ -1,6 +1,6 @@
int repeat_until_keypressed(void);
int select_menu(int x, int y, int num, char **items);
void apple_memset(char *ptr, int value, int length);
void apple_memset(unsigned char *ptr, int value, int length);
void print_u8(unsigned char value);
void print_byte(unsigned char value);
void page_flip(void);