From: Lukas Krickl Date: Tue, 18 Mar 2025 20:15:42 +0000 (+0100) Subject: ui: Added window X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=944176933508258cf3aa145678f0698b8934f5f1;p=gbrg%2F.git ui: Added window --- diff --git a/src/defs.s b/src/defs.s index c859c88..87c53dd 100644 --- a/src/defs.s +++ b/src/defs.s @@ -19,6 +19,8 @@ #define RAND_MAGIC 0x1B #define SRAND_INITIAL 0x19 +#define WINDOW_Y 120 +#define WINDOW_X 1 ; game modes ; this is a direct index diff --git a/src/hw.inc b/src/hw.inc index 1c9549b..c117709 100644 --- a/src/hw.inc +++ b/src/hw.inc @@ -15,6 +15,7 @@ #define LCDCF_OBJON 0b00000010 #define LCDF_WINDOWON 0b00100000 #define LCDF_OBJ_SIZE 0b00000100 +#define LCDF_WINBANKSELECT 0b01000000 #define RBGP 0xFF47 #define ROBP0 0xFF48 diff --git a/src/macros.inc b/src/macros.inc index 0a367b6..690a0c2 100644 --- a/src/macros.inc +++ b/src/macros.inc @@ -94,7 +94,7 @@ ; inputs: ; $1: cursor_move_y/x -> move ; $2: cursor_move_y/x -> clear - ; $2: -1/1 + ; $2: NEGATE/1 #macro cursor_move_direction xor a, a ld [$2], a diff --git a/src/video.s b/src/video.s index cb8f431..f288585 100644 --- a/src/video.s +++ b/src/video.s @@ -22,7 +22,7 @@ scroll_update: ret nz ld a, [scroll_move_y] - cp a, 0x12 + cp a, 0x0F jr nz, @no_scroll_down REL ; move-1 @@ -36,7 +36,6 @@ scroll_update: jr @done REL @no_scroll_down: - cp a, 0xFF jr nz, @no_scroll_up REL @@ -117,7 +116,7 @@ lcd_off: ; turns on the lcd lcd_on: - ld a, LCDCF_ON | LCDCF_BGON | LCDCF_OBJON + ld a, LCDCF_ON | LCDCF_BGON | LCDCF_OBJON | LCDF_WINDOWON | LCDF_WINBANKSELECT ld [RLCD], a ret @@ -130,6 +129,11 @@ video_init: ld bc, 1024 ld d, EMPTY_TILE call memset + + ld hl, SCRN1 + ld bc, 1024 + ld d, EMPTY_TILE + call memset ; set up bgp ld a, BGP @@ -143,6 +147,11 @@ video_init: call ui_init + ld a, WINDOW_Y + ld [RWY], a + ld a, WINDOW_X + ld [RWX], a + ret ; copies tilest0 and tileset1 to