From c7d3cc2e6cbf05e433c5dbd6b30127414c0f9ba4 Mon Sep 17 00:00:00 2001 From: nino-porcino Date: Wed, 15 Dec 2021 10:54:58 +0100 Subject: [PATCH] refactor screen2_init_bitmap --- demo_amiga_hand.h | 3 +-- tetris/intro.h | 3 --- tetris/tetris.c | 4 ++++ tms_screen2.h | 59 ++++++++++++++++++++++++----------------------- 4 files changed, 35 insertions(+), 34 deletions(-) diff --git a/demo_amiga_hand.h b/demo_amiga_hand.h index 67c0fdb..8879575 100644 --- a/demo_amiga_hand.h +++ b/demo_amiga_hand.h @@ -156,8 +156,7 @@ byte amiga_data[612] = { void demo_amiga_hand() { TMS_INIT(SCREEN2_TABLE); - SCREEN2_FILL(); - screen2_square_sprites(); + screen2_init_bitmap(COLOR_BYTE(COLOR_WHITE,COLOR_BLACK)); SCREEN2_PUTS(0, 0, COLOR_BYTE(COLOR_BLACK,COLOR_WHITE), "*** P-LAB VIDEO CARD SYSTEM ***"); SCREEN2_PUTS(0, 2, COLOR_BYTE(COLOR_BLACK,COLOR_WHITE), "16K VRAM BYTES FREE"); diff --git a/tetris/intro.h b/tetris/intro.h index c777639..0b3a3ba 100644 --- a/tetris/intro.h +++ b/tetris/intro.h @@ -40,9 +40,6 @@ void drawLogo() { // introduction screen void introScreen() { - TMS_INIT(SCREEN2_TABLE); - SCREEN2_FILL(); - screen2_square_sprites(); set_color(COLOR_BLACK); // simulate cls (TODO improve speed) diff --git a/tetris/tetris.c b/tetris/tetris.c index b9800c9..7e6d314 100644 --- a/tetris/tetris.c +++ b/tetris/tetris.c @@ -395,6 +395,10 @@ void main() { memcpy(LOWRAM_START, DATAINCODE, LOWRAM_SIZE); #endif + // initialize the screen + TMS_INIT(SCREEN2_TABLE); + screen2_init_bitmap(COLOR_BYTE(COLOR_BLACK,COLOR_BLACK)); + while(1) { introScreen(); initGame(); diff --git a/tms_screen2.h b/tms_screen2.h index eb9feaf..d227791 100644 --- a/tms_screen2.h +++ b/tms_screen2.h @@ -19,23 +19,42 @@ const word SCREEN2_SPRITE_PATTERNS = 0x1800; const word SCREEN2_SPRITE_ATTRS = 0x3b00; const word SCREEN2_SIZE = (32*24); -void SCREEN2_FILL() { - // fills name table x3 with increasing numbers - set_vram_write_addr(SCREEN2_NAME_TABLE); - for(word i=0;i