video: Added basic puts function
authorLukas Krickl <lukas@krickl.dev>
Tue, 1 Oct 2024 10:39:16 +0000 (12:39 +0200)
committerLukas Krickl <lukas@krickl.dev>
Tue, 1 Oct 2024 10:39:16 +0000 (12:39 +0200)
src/main.s
src/strings.s
src/video.s
src/wram.s

index 604bbc4761192e2b088ac2c3683f2f974ca439b8..d48f2ff84e0f530247f69dd932c492a867fcc1ad 100644 (file)
@@ -17,6 +17,8 @@ entry:
   call copy_tiles
   call lcd_on
 
+  call video_init
+
   call enableinterrupts
 
 main:
index eecbd2407191dbcab286aaf0161201cf6184b5e3..5fd229cdf14d5e0d93879647bcee59d887c8a3c8 100644 (file)
@@ -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
index 7aa2bf9ee54b4b92b16e7b732f257644963216ab..d5a2cdba86ef8c342bb4260e0bc73b159b953e99 100644 (file)
@@ -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:
index 589dcfaa8acd00a9046fd0e3497e475c791f6f58..9bf26c9c40c824868661fc54c64be91f46888be3 100644 (file)
@@ -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