I'm developing a text-based game with some graphics for the ZX Spectrum (i.e., 48k), using a command-key-press-like input.
The problem is that the game runs and pasts the presentation screen, but then it sometimes immediately gets stuck, or maybe after a key presses.
My guesses so far are:
a) I've a bug I don't know about, specifically a crazy pointer.
b) I've reached some memory limit. My program's size is of around 21kb. Don't know what its the max size.
c) Somehow the input (in_Input) or output (fputc_cons/println) crash [see some warnings below].
Github code:
https://github.com/Baltasarq/reveni
So, I'd like to be able to discard something. Any idea? Follows the makefile and the compilation output.
Note that the game does not use the standard stdio, but it does use the library fputc_cons instead of the ROM one in order to be able to do effects such as relocate the cursor, clear the screen, change text color, etc.
Part of the code is reused from a previous classic text game, Bares.
Thanks in advance for any hint.
Code: Select all
CC=zcc
CFLAGS=+zx
OBJ=obj
all: reveni
reveni: reveni.c ctrl player locs objs cmds
$(CC) $(CFLAGS) -create-app reveni.c $(OBJ)/ctrl.o $(OBJ)/player.o $(OBJ)/locs.o $(OBJ)/objs.o $(OBJ)/cmds.o -oreveni -pragma-define:CLIB_CONIO_NATIVE_COLOUR=1 -pragma-define:CRT_ENABLE_STDIO=0 -pragma-redirect:fputc_cons=fputc_cons_generic
ctrl: ctrl.h ctrl.c
$(CC) $(CFLAGS) -c ctrl.c -o $(OBJ)/ctrl.o
player: player.h player.c
$(CC) $(CFLAGS) -c player.c -o $(OBJ)/player.o
locs: locs.h locs.c
$(CC) $(CFLAGS) -c locs.c -o $(OBJ)/locs.o
objs: objs.h objs.c
$(CC) $(CFLAGS) -c objs.c -o $(OBJ)/objs.o
cmds: cmds.h cmds.c
$(CC) $(CFLAGS) -c cmds.c -o $(OBJ)/cmds.o
clean:
$(RM) $(OBJ)/*.o
$(RM) reveni
$(RM) *.tap
$(RM) *.cpc
$(RM) *.dsk
$(RM) *.bin
$(RM) *.def
$(RM) *.reloc
run:
fuse reveni.tap &
Code: Select all
zcc +zx -c ctrl.c -o obj/ctrl.o
zcc +zx -c player.c -o obj/player.o
zcc +zx -c locs.c -o obj/locs.o
zcc +zx -c objs.c -o obj/objs.o
objs.c:167:24: warning: Implicit definition of function 'fputc_cons' it will return an int. Prototype it explicitly if this is not what you want. [-Wimplicit-function-definition]
zcc +zx -c cmds.c -o obj/cmds.o
cmds.c:185:56: warning: Implicit definition of function 'fputc_cons' it will return an int. Prototype it explicitly if this is not what you want. [-Wimplicit-function-definition]
zcc +zx -create-app reveni.c obj/ctrl.o obj/player.o obj/locs.o obj/objs.o obj/cmds.o -oreveni -pragma-define:CLIB_CONIO_NATIVE_COLOUR=1 -pragma-define:CRT_ENABLE_STDIO=0 -pragma-redirect:fputc_cons=fputc_cons_generic
reveni.c:33:13: warning: Implicit definition of function 'fputc_cons' it will return an int. Prototype it explicitly if this is not what you want. [-Wimplicit-function-definition]