Begin with basic init

This commit is contained in:
hkz 2025-07-15 21:14:14 +02:00
commit 85ca4f19a2
5 changed files with 36 additions and 7 deletions

View file

@ -9,7 +9,8 @@ LIBS=clib-6502.a
# Common source files
ASM_SRCS = tk2k_startup.s
C_SRCS = main.c monitor_subroutines.c utility.c
C_SRCS = main.c monitor_subroutines.c utility.c \
game_graphics.c
# Object files
OBJS = $(ASM_SRCS:%.s=%.o) $(C_SRCS:%.c=%.o)

7
src/game_graphics.c Normal file
View file

@ -0,0 +1,7 @@
#include "game_graphics.h"
#include "mem_map.h"
void draw_game_background(void) {
}

8
src/game_graphics.h Normal file
View file

@ -0,0 +1,8 @@
#ifndef _GAME_GRAPHICS_HEADER_
#define _GAME_GRAPHICS_HEADER_
#include <stdint.h>
void draw_game_background(void);
#endif /* _GAME_GRAPHICS_HEADER_ */

View file

@ -9,9 +9,22 @@
#include "monitor_subroutines.h"
__task int main () {
// Low level initialization
void __low_level_init(void) {
POKE(P3_PWRDUP, 0); // Dirty the value checked by the reset vector
PEEK(IO_ROMSEL); // Make sure the ROM is selected
PEEK(IO_DISPLAY_BW); // Disable colors
PEEK(IO_DISPLAY_PAGE1); // Select the first display page
// Clear display memory
memset((void*)DISPLAY_PAGE_1, 0, DISPLAY_PAGE_SIZE);
memset((void*)DISPLAY_PAGE_2, 0, DISPLAY_PAGE_SIZE);
}
__task int main(void) {
while(1){

View file

@ -8,7 +8,7 @@
.section data_init_table
.section registers ; pseudo registers in zero page
.extern main, exit
.extern main, exit, __low_level_init
.extern _Zp, _Vsp, _Vfp
.pubweak __program_root_section, __program_start
@ -87,10 +87,10 @@ __call_heap_initialize:
;;;
;;; ***************************************************************************
.section code
.pubweak __low_level_init
__low_level_init:
rts
;;; .section code
;;; .pubweak __low_level_init
;;;__low_level_init:
;;; rts
;;; ***************************************************************************
;;;