From 0bc5989ab4f1e3ff5a819707befeb396bfea2b38 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Tue, 1 Oct 2024 12:39:16 +0200 Subject: [PATCH] video: Added basic puts function --- src/main.s | 2 ++ src/strings.s | 15 +++++++++++++++ src/video.s | 10 ++++++++++ src/wram.s | 16 ++++++++++++++++ 4 files changed, 43 insertions(+) diff --git a/src/main.s b/src/main.s index 604bbc4..d48f2ff 100644 --- a/src/main.s +++ b/src/main.s @@ -17,6 +17,8 @@ entry: call copy_tiles call lcd_on + call video_init + call enableinterrupts main: diff --git a/src/strings.s b/src/strings.s index eecbd24..5fd229c 100644 --- a/src/strings.s +++ b/src/strings.s @@ -9,3 +9,18 @@ STR_TITLE: .str "game" .db 0 + + ; print a string 0-terminated to the screen + ; can only be called during blank! + ; inputs: + ; hl: the string + ; de: tile location +puts: +@loop: + ld a, [hl+] + ld [de], a + inc de + cp a, 0 + jp nz, @loop + + ret diff --git a/src/video.s b/src/video.s index 7aa2bf9..d5a2cdb 100644 --- a/src/video.s +++ b/src/video.s @@ -1,6 +1,11 @@ ; vblank handler vblank: call OAMDMAFN + + ; test puts + ld hl, STR_TITLE + ld de, SCRN0 + call puts ret @@ -26,6 +31,11 @@ lcd_on: ret +video_init: + ld a, 0b11100100 + ld [RBGP], a + ret + ; copies tilest0 and tileset1 to ; vram copy_tiles: diff --git a/src/wram.s b/src/wram.s index 589dcfa..9bf26c9 100644 --- a/src/wram.s +++ b/src/wram.s @@ -5,3 +5,19 @@ .def int OAMDMAFN = 0xFF80 shadow_oam: .adv OBJSMAX * oamsize + +#define ACTORS_MAX 16 + +; actor type enum +.se 1 +.de ACTOR_TYPE_PLAYER, 1 + +; struct actor +.se 0 +.de actor_type, 1 +.de actor_y, 1 +.de actor_x, 1 +.de actor_flags, 1 +.de actor_size, 0 + +actor_table: .adv ACTORS_MAX * actor_size -- 2.30.2