diff --git a/gr-sim/gr-sim.c b/gr-sim/gr-sim.c index ceea2572..b6bc5272 100644 --- a/gr-sim/gr-sim.c +++ b/gr-sim/gr-sim.c @@ -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); + } +} diff --git a/gr-sim/gr-sim.h b/gr-sim/gr-sim.h index 923dab5c..10a27c8f 100644 --- a/gr-sim/gr-sim.h +++ b/gr-sim/gr-sim.h @@ -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 diff --git a/gr-sim/tfv.c b/gr-sim/tfv.c index 67abd041..d74a5eb3 100644 --- a/gr-sim/tfv.c +++ b/gr-sim/tfv.c @@ -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(); diff --git a/gr-sim/tfv_utils.c b/gr-sim/tfv_utils.c index a49285d6..d086853f 100644 --- a/gr-sim/tfv_utils.c +++ b/gr-sim/tfv_utils.c @@ -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; diff --git a/gr-sim/tfv_utils.h b/gr-sim/tfv_utils.h index 1a08b4ce..49c6fe91 100644 --- a/gr-sim/tfv_utils.h +++ b/gr-sim/tfv_utils.h @@ -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);