diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2416a67 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +obj/ diff --git a/KeyCodes b/KeyCodes deleted file mode 100644 index 69fd9ad..0000000 --- a/KeyCodes +++ /dev/null @@ -1,78 +0,0 @@ -BACKSPACE -TAB -CLEAR -RETURN -PAUSE -ESCAPE -SPACE -EXCLAIM -QUOTEDBL -HASH -DOLLAR -AMPERSAND -QUOTE -LEFTPAREN -RIGHTPAREN -ASTERISK -PLUS -COMMA -MINUS -PERIOD -SLASH -0 ... 9 -COLON -SEMICOLON -LESS -EQUALS -GREATER -QUESTION -AT -LEFTBRACKET -BACKSLASH -RIGHTBRACKET -CARET -UNDERSCORE -BACKQUOTE -a ... z -DELETE -WORLD_0 ... WODLD_95 -KP0 ... KP9 -KP_PERIOD -KP_DIVIDE -KP_MULTIPLY -KP_MINUS -KP_PLUS -KP_ENTER -KP_EQUALS -UP -DOWN -RIGHT -LEFT -INSERT -HOME -END -PAGEUP -PAGEDOWN -F1 ... F15 -NUMLOCK -CAPSLOCK -SCROLLOCK -RSHIFT -LSHIFT -RCTRL -LCTRL -RALT -LALT -RMETA -LMETA -LSUPER -RSUPER -MODE -COMPOSE -HELP -PRINT -SYSREQ -BREAK -MENU -POWER -EURO diff --git a/Makefile b/Makefile index d87bc0e..d0d3377 100644 --- a/Makefile +++ b/Makefile @@ -1,89 +1,101 @@ # -# xrick/Makefile -# -# Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). All rights reserved. -# -# The use and distribution terms for this software are contained in the file -# named README, which can be found in the root of this distribution. By -# using this software in any fashion, you are agreeing to be bound by the -# terms of this license. -# -# You must not remove this notice, or any other, from this software. +# xrick2gs/Makefile # +# This makefile was created by Jason Andersen # -# Vars +# I build on Windows-10 64-bit, this makefile is designed to run under +# a Windows-10 Command Prompt, and makes use of DOS shell commands +# +# In order to build this you need GoldenGate, and ORCA/C +# +# http://golden-gate.ksherlock.com/ +# +# I have the contents of the OPUS-II collection installed +# +# As far a free stuff, I setup a c:\bin directory, in my path +# the following packages and executables are in there +# +# Fine Tools from Brutal Deluxe +# http://www.brutaldeluxe.fr/products/crossdevtools/ +# Cadius.exe +# Merlin32.exe +# OMFAnalyzer.exe +# LZ4.exe +# +# gnumake-4.2.1-x64.exe (with a symbolic link that aliases this to "make") +# +# https://apple2.gs/plus/ +# gsplus32.exe (KEGS based GS Emulator fork by Dagen Brock) +# I configure this to boot the xrick.po image directly +# once that's done "make run" will build, update the disk image +# and boot into xrick2gs. # -SDLVERSION=$(shell sdl-config --version 2>/dev/null) -ROOTDIR=$(shell pwd) -TARGET=$(shell uname -s | tr [a-z] [A-Z]) +# Make and Build Variables -# -# Config -# +VPATH = src:obj +SOURCEFILES = $(wildcard src/*.c) +OBJFILES = $(patsubst src/%.c,obj/%.a,$(SOURCEFILES)) +CC = iix compile +CFLAGS = cc=-DIIGS=1 cc=-Iinclude cc=-Isrc -ifeq ($(strip $(SDLVERSION)),) -$(error SDL is missing) -else -$(warning Detected SDL version $(SDLVERSION)) -endif -ifeq ($(strip $(SDLVERSION)),) -$(error SDL is missing) -endif +help: + @echo. + @echo xrickgs Makefile + @echo ------------------------------------------------- + @echo build commands: + @echo make gs - Apple IIgs + @echo make image - Build Bootable .PO File + @echo make run - Build / Run IIgs on emulator + @echo make clean - Clean intermediate/target files + @echo make depend - Build dependencies + @echo ------------------------------------------------- + @echo. -SDL_MAJ=$(word 1,$(subst ., ,$(SDLVERSION))) -SDL_MIN=$(word 2,$(subst ., ,$(SDLVERSION))) -SDL_MIC=$(word 3,$(subst ., ,$(SDLVERSION))) +xrick.lib: $(OBJFILES) + @echo Y | del xrick.lib + iix makelib -P xrick.lib $(patsubst %,+%,$(OBJFILES)) -SDL_MAJ_REQ=1 -SDL_MIN_REQ=2 -SDL_MIC_REQ=1 +xrick.sys16: xrick.lib +# iix link +L obj\xrick xrick.lib keep=xrick.sys16 + iix link obj\xrick xrick.lib keep=xrick.sys16 -SDL_CHKVER=$(shell if [ $(SDL_MAJ) -lt $(SDL_MAJ_REQ) ]; then echo "BAD"; fi) -ifeq ($(SDL_CHKVER),BAD) -$(error SDL version $(SDL_MAJ_REQ).$(SDL_MIN_REQ).$(SDL_MIC_REQ) is required) -endif +gs: xrick.sys16 -SDL_CHKVER=$(shell if [ $(SDL_MAJ) -eq $(SDL_MAJ_REQ) -a $(SDL_MIN) -lt $(SDL_MIN_REQ) ]; then echo "BAD"; fi) -ifeq ($(SDL_CHKVER),BAD) -$(error SDL version $(SDL_MAJ_REQ).$(SDL_MIN_REQ).$(SDL_MIC_REQ) is required) -endif +image: gs + @echo Updating xrick.po + @echo Remove xrick.sys16 + cadius deletefile xrick.po /xrick/xrick.sys16 + @echo Add xrick.sys16 + cadius addfile xrick.po /xrick ./xrick.sys16 -SDL_CHKVER=$(shell if [ $(SDL_MAJ) -eq $(SDL_MAJ_REQ) -a $(SDL_MIN) -eq $(SDL_MIN_REQ) -a $(SDL_MIC) -lt $(SDL_MIC_REQ) ]; then echo "BAD"; fi) -ifeq ($(SDL_CHKVER),BAD) -$(error SDL version $(SDL_MAJ_REQ).$(SDL_MIN_REQ).$(SDL_MIC_REQ) is required) -endif - -ifneq (,$(findstring CYGWIN,$(TARGET))) -XOBJ=xrick.res -endif - -ifneq (,$(findstring MINGW,$(TARGET))) -XOBJ=xrick.res -endif - -# - # Rules -# - -all: - @echo "ROOTDIR=$(ROOTDIR)" > Makefile.global - @echo "XOBJ=$(XOBJ)" >> Makefile.global - @echo "CFLAGS=-g -ansi -pedantic -Wall -W -O2 -I $(ROOTDIR)/include $(shell sdl-config --cflags)" >> Makefile.global - @echo "LDFLAGS=-lz $(shell sdl-config --libs)" >> Makefile.global - @echo "CC=gcc" >> Makefile.global - @echo "CPP=gcc -E" >> Makefile.global - $(MAKE) -C src all +run: image + gsplus32 clean: - for i in src include; do \ - $(MAKE) -C $$i clean; \ - done - rm -f *~ log.txt Makefile.global + @echo Remove xrick.sys16 +# ifneq ("$(wildcard ./xrick.sys16)","") + @echo Y | del xrick.sys16 +# endif + @echo Clear Object Directory + @echo Y | del obj\* +# @rmdir obj + @echo Y | del xrick.lib depend: - $(MAKE) -C src depend + @echo TODO - make dependencies + +# Generic Rules + +# Goofy Object File Rule for ORCA +obj/%.a : src/%.c obj + @echo Compiling $( .depend - -# eof - - - - diff --git a/src/control.c b/src/control.c index 1b383f4..de5528b 100644 --- a/src/control.c +++ b/src/control.c @@ -15,6 +15,10 @@ #include "system.h" #include "game.h" +#ifdef IIGS +#pragma noroot +#endif + U8 control_status = 0; U8 control_last = 0; U8 control_active = TRUE; diff --git a/src/dat_ents.c b/src/dat_ents.c index 170dc0b..0378159 100644 --- a/src/dat_ents.c +++ b/src/dat_ents.c @@ -14,6 +14,11 @@ #include "system.h" #include "ents.h" +#ifdef IIGS +#pragma noroot +segment "dat"; +#endif + entdata_t ent_entdata[ENT_NBR_ENTDATA] = { {0000, 0000, 000000, 000000, 0000, 0000, 0x00}, {0x18, 0x15, 000000, 000000, 0000, 0000, 0x00}, diff --git a/src/dat_maps.c b/src/dat_maps.c index 116b4b3..b4843a8 100644 --- a/src/dat_maps.c +++ b/src/dat_maps.c @@ -11,6 +11,11 @@ * You must not remove this notice, or any other, from this software. */ +#ifdef IIGS +#pragma noroot +segment "dat"; +#endif + #include "system.h" #include "maps.h" diff --git a/src/dat_picsPC.c b/src/dat_picsPC.c index f709ece..8effa9b 100644 --- a/src/dat_picsPC.c +++ b/src/dat_picsPC.c @@ -13,6 +13,10 @@ #include "config.h" +#ifdef IIGS +#pragma noroot +#endif + #ifdef GFXPC #include "system.h" diff --git a/src/dat_picsST.c b/src/dat_picsST.c index fe6377d..1f319b7 100644 --- a/src/dat_picsST.c +++ b/src/dat_picsST.c @@ -13,6 +13,11 @@ #include "config.h" +#ifdef IIGS +#pragma noroot +//segment "dat"; +#endif + #ifdef GFXST #include "system.h" diff --git a/src/dat_screens.c b/src/dat_screens.c index fe14276..d82f4a5 100644 --- a/src/dat_screens.c +++ b/src/dat_screens.c @@ -14,6 +14,11 @@ #include "system.h" #include "screens.h" +#ifdef IIGS +#pragma noroot +segment "dat"; +#endif + /* * map intro, sprites lists */ diff --git a/src/dat_snd.c b/src/dat_snd.c index d28705d..7220f0a 100644 --- a/src/dat_snd.c +++ b/src/dat_snd.c @@ -13,6 +13,11 @@ #include "config.h" +#ifdef IIGS +#pragma noroot +//segment "dat"; +#endif + #ifdef ENABLE_SOUND #include "system.h" diff --git a/src/dat_spritesPC.c b/src/dat_spritesPC.c index 2343f1e..06c20f6 100644 --- a/src/dat_spritesPC.c +++ b/src/dat_spritesPC.c @@ -13,6 +13,11 @@ #include "config.h" +#ifdef IIGS +#pragma noroot +//segment "sprite_data"; +#endif + #ifdef GFXPC #include "system.h" diff --git a/src/dat_spritesST.c b/src/dat_spritesST.c index 354d6c7..759a45e 100644 --- a/src/dat_spritesST.c +++ b/src/dat_spritesST.c @@ -13,6 +13,11 @@ #include "config.h" +#ifdef IIGS +#pragma noroot +//segment "sprites_dat"; +#endif + #ifdef GFXST #include "system.h" diff --git a/src/dat_tilesPC.c b/src/dat_tilesPC.c index b51556c..c3b987d 100644 --- a/src/dat_tilesPC.c +++ b/src/dat_tilesPC.c @@ -13,6 +13,11 @@ #include "config.h" +#ifdef IIGS +#pragma noroot +//segment "dat"; +#endif + #ifdef GFXPC #include "system.h" diff --git a/src/dat_tilesST.c b/src/dat_tilesST.c index 9eb46e7..b091bf8 100644 --- a/src/dat_tilesST.c +++ b/src/dat_tilesST.c @@ -13,6 +13,11 @@ #include "config.h" +#ifdef IIGS +#pragma noroot +// segment "dat"; +#endif + #ifdef GFXST #include "system.h" diff --git a/src/data.c b/src/data.c index 24d8547..48842c1 100644 --- a/src/data.c +++ b/src/data.c @@ -17,11 +17,19 @@ #include "system.h" #include "data.h" +#ifndef IIGS #include "unzip.h" +#endif + +#ifdef IIGS +#pragma noroot +segment "dat"; +#endif /* * Private typedefs */ +#ifndef IIGS typedef struct { char *name; unzFile zip; @@ -43,6 +51,7 @@ static path_t path; static int str_zipext(char *); static char *str_dup(char *); static char *str_slash(char *); +#endif //IIGS /* * @@ -50,6 +59,8 @@ static char *str_slash(char *); void data_setpath(char *name) { +#ifdef IIGS +#else unzFile zip; char *n; @@ -70,6 +81,7 @@ data_setpath(char *name) path.zip = NULL; path.name = str_dup(name); } +#endif } /* @@ -78,14 +90,18 @@ data_setpath(char *name) void data_closepath() { +#ifdef IIGS +#else if (path.zip) { unzClose(path.zip); path.zip = NULL; } free(path.name); path.name = NULL; +#endif } +#ifndef IIGS /* * Open a data file. */ @@ -235,4 +251,6 @@ str_slash(char *s) return s; } +#endif //IIGS + /* eof */ diff --git a/src/devtools.c b/src/devtools.c index 876d117..8dc6f42 100644 --- a/src/devtools.c +++ b/src/devtools.c @@ -13,6 +13,10 @@ #include "config.h" +#ifdef IIGS +#pragma noroot +#endif + #ifdef ENABLE_DEVTOOLS #include "system.h" diff --git a/src/draw.c b/src/draw.c index d0b5130..94731a7 100644 --- a/src/draw.c +++ b/src/draw.c @@ -54,6 +54,11 @@ #include "rects.h" #include "img.h" +#ifdef IIGS +#pragma noroot +segment "game"; +#endif + /* * counters positions (pixels, screen) @@ -70,7 +75,11 @@ #define DRAW_STATUS_LIVES_X 0xF0 #define DRAW_STATUS_Y 0 #endif - +#ifdef GFXGS +#define DRAW_STATUS_SCORE_X 0x20 +#define DRAW_STATUS_LIVES_X 0xF0 +#define DRAW_STATUS_Y 0 +#endif /* * public vars @@ -299,6 +308,18 @@ draw_sprite(U8 nbr, U16 x, U16 y) } #endif +#ifdef GFXGS +void +draw_sprite(U8 number, U16 x, U16 y) +{ +} + +void +draw_sprite2(U8 number, U16 x, U16 y, U8 front) +{ +} +#endif + /* * Draw a sprite diff --git a/src/e_bomb.c b/src/e_bomb.c index 099ddbd..eb48cb8 100644 --- a/src/e_bomb.c +++ b/src/e_bomb.c @@ -18,6 +18,11 @@ #include "e_rick.h" +#ifdef IIGS +#pragma noroot +segment "e"; +#endif + /* * public vars (for performance reasons) */ diff --git a/src/e_bonus.c b/src/e_bonus.c index b614509..5b9a0df 100644 --- a/src/e_bonus.c +++ b/src/e_bonus.c @@ -19,6 +19,10 @@ #include "e_rick.h" #include "maps.h" +#ifdef IIGS +#pragma noroot +segment "e"; +#endif /* * Entity action diff --git a/src/e_box.c b/src/e_box.c index 8167da1..67f11ec 100644 --- a/src/e_box.c +++ b/src/e_box.c @@ -22,6 +22,11 @@ #include "maps.h" #include "util.h" +#ifdef IIGS +#pragma noroot +segment "e"; +#endif + /* * FIXME this is because the same structure is used * for all entities. Need to replace this w/ an inheritance diff --git a/src/e_bullet.c b/src/e_bullet.c index 124cc94..99a235b 100644 --- a/src/e_bullet.c +++ b/src/e_bullet.c @@ -18,6 +18,11 @@ #include "maps.h" +#ifdef IIGS +#pragma noroot +segment "e"; +#endif + /* * public vars (for performance reasons) */ diff --git a/src/e_rick.c b/src/e_rick.c index 3bd725f..eac3313 100644 --- a/src/e_rick.c +++ b/src/e_rick.c @@ -23,6 +23,11 @@ #include "maps.h" #include "util.h" +#ifdef IIGS +#pragma noroot +segment "e"; +#endif + /* * public vars */ diff --git a/src/e_sbonus.c b/src/e_sbonus.c index cedf9cc..992d018 100644 --- a/src/e_sbonus.c +++ b/src/e_sbonus.c @@ -20,6 +20,10 @@ #include "maps.h" #include "e_rick.h" +#ifdef IIGS +#pragma noroot +segment "e"; +#endif /* * public vars diff --git a/src/e_them.c b/src/e_them.c index 7fecf56..3db73ac 100644 --- a/src/e_them.c +++ b/src/e_them.c @@ -35,6 +35,11 @@ U32 e_them_rndseed = 0; */ static U16 e_them_rndnbr = 0; +#ifdef IIGS +#pragma noroot +segment "e"; +#endif + /* * Check if entity boxtests with a lethal e_them i.e. something lethal * in slot 0 and 4 to 8. @@ -335,13 +340,13 @@ e_them_t2_action2(U8 e) * end of this function. */ static U16 bx; - static U8 *bl = (U8 *)&bx; - static U8 *bh = (U8 *)&bx + 1; + static U8 *bl = (U8*)&bx; + U8 *bh = bl+1; static U16 cx; - static U8 *cl = (U8 *)&cx; - static U8 *ch = (U8 *)&cx + 1; - static U16 *sl = (U16 *)&e_them_rndseed; - static U16 *sh = (U16 *)&e_them_rndseed + 2; + static U8 *cl = (U8*)&cx; + U8 *ch = cl+1; + static U16 *sl = (U16*)&e_them_rndseed; + U16 *sh = sl+1; /*sys_printf("e_them_t2 ------------------------------\n");*/ diff --git a/src/ents.c b/src/ents.c index 5a8c6b7..28e8ae0 100644 --- a/src/ents.c +++ b/src/ents.c @@ -30,6 +30,11 @@ #include "maps.h" #include "draw.h" +#ifdef IIGS +#pragma noroot +segment "game"; +#endif + /* * global vars */ diff --git a/src/game.c b/src/game.c index 205436d..e4a7a10 100644 --- a/src/game.c +++ b/src/game.c @@ -33,6 +33,10 @@ #include "devtools.h" #endif +#ifdef IIGS +#pragma noroot +segment "game"; +#endif /* * local typedefs @@ -74,7 +78,7 @@ U8 game_cheat1 = 0; U8 game_cheat2 = 0; U8 game_cheat3 = 0; -#ifdef GFXST +#if defined(GFXST) || defined(GFXGS) hscore_t game_hscores[8] = { { 8000, "SIMES@@@@@" }, { 7000, "JAYNE@@@@@" }, @@ -209,7 +213,7 @@ game_stopmusic(void) void game_run(void) { - U32 tm, tmx; + U32 tm, tmx; loaddata(); /* load cached data */ @@ -224,6 +228,8 @@ game_run(void) tmx = tm; tm = sys_gettime(); tmx = tm - tmx; if (tmx < game_period) sys_sleep(game_period - tmx); + printf("tmx=%x\n"); + /* video */ /*DEBUG*//*game_rects=&draw_SCREENRECT;*//*DEBUG*/ sysvid_update(game_rects); diff --git a/src/img_splash.e b/src/img_splash.e index 8f5183e..4059a2c 100644 --- a/src/img_splash.e +++ b/src/img_splash.e @@ -1,4 +1,5 @@ -static U8 IMG_SPLASH_PIXELS[] = { +#ifndef GFXGS +U8 IMG_SPLASH_PIXELS[] = { 0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -4012,4 +4013,7 @@ static img_t IMG_SPLASH_OBJECT = { }; img_t *IMG_SPLASH = &IMG_SPLASH_OBJECT; +#else +img_t *IMG_SPLASH = 0; +#endif diff --git a/src/maps.c b/src/maps.c index ef2642e..ea23e67 100644 --- a/src/maps.c +++ b/src/maps.c @@ -38,6 +38,10 @@ #include "screens.h" #include "e_sbonus.h" +#ifdef IIGS +#pragma noroot +#endif + /* * global vars */ diff --git a/src/rects.c b/src/rects.c index cf1c408..6815be5 100644 --- a/src/rects.c +++ b/src/rects.c @@ -16,6 +16,9 @@ #include "system.h" #include "rects.h" +#ifdef IIGS +#pragma noroot +#endif /* * Free a list of rectangles and set the pointer to NULL. diff --git a/src/scr_gameover.c b/src/scr_gameover.c index 977acf8..a62b227 100644 --- a/src/scr_gameover.c +++ b/src/scr_gameover.c @@ -20,6 +20,11 @@ #include "draw.h" #include "control.h" +#ifdef IIGS +#pragma noroot +segment "screen"; +#endif + /* * Display the game over screen * diff --git a/src/scr_getname.c b/src/scr_getname.c index 2b3e7f8..9840b97 100644 --- a/src/scr_getname.c +++ b/src/scr_getname.c @@ -18,6 +18,11 @@ #include "draw.h" #include "control.h" +#ifdef IIGS +#pragma noroot +segment "screen"; +#endif + /* * local vars */ diff --git a/src/scr_imain.c b/src/scr_imain.c index 7fb8b43..46223d7 100644 --- a/src/scr_imain.c +++ b/src/scr_imain.c @@ -21,6 +21,11 @@ #include "pics.h" #include "control.h" +#ifdef IIGS +#pragma noroot +segment "screen"; +#endif + /* * Main introduction * diff --git a/src/scr_imap.c b/src/scr_imap.c index 687fc3a..a0296bc 100644 --- a/src/scr_imap.c +++ b/src/scr_imap.c @@ -22,6 +22,11 @@ #include "control.h" #include "maps.h" +#ifdef IIGS +#pragma noroot +segment "screen"; +#endif + /* * local vars */ diff --git a/src/scr_pause.c b/src/scr_pause.c index 213dcf1..da19357 100644 --- a/src/scr_pause.c +++ b/src/scr_pause.c @@ -21,6 +21,10 @@ #include "control.h" #include "ents.h" +#ifdef IIGS +#pragma noroot +segment "screen"; +#endif /* * Display the pause indicator diff --git a/src/scr_xrick.c b/src/scr_xrick.c index 33f1f8e..67a3e00 100644 --- a/src/scr_xrick.c +++ b/src/scr_xrick.c @@ -19,8 +19,14 @@ #include "control.h" #include "img.h" +#ifdef IIGS +segment "screen"; +#pragma noroot +#endif + #include "img_splash.e" + /* * Display XRICK splash screen * diff --git a/src/scroller.c b/src/scroller.c index 509fb7d..be369a5 100644 --- a/src/scroller.c +++ b/src/scroller.c @@ -24,6 +24,11 @@ static U8 period; +#ifdef IIGS +#pragma noroot +segment "screen"; +#endif + /* * Scroll up * diff --git a/src/sysarg.c b/src/sysarg.c index 807193c..f672119 100644 --- a/src/sysarg.c +++ b/src/sysarg.c @@ -15,10 +15,16 @@ * 20021010 added test to prevent buffer overrun in -keys parsing. */ +#ifdef IIGS +#pragma noroot +#endif + #include /* atoi */ #include /* strcasecmp */ +#ifndef IIGS #include +#endif #include "system.h" #include "config.h" @@ -37,9 +43,11 @@ typedef struct { int code; } sdlcodes_t; +#ifndef IIGS static sdlcodes_t sdlcodes[SDLK_LAST] = { #include "sdlcodes.e" }; +#endif int sysarg_args_period = 0; int sysarg_args_map = 0; @@ -50,6 +58,9 @@ int sysarg_args_nosound = 0; int sysarg_args_vol = 0; char *sysarg_args_data = NULL; +segment "system"; + + /* * Fail */ @@ -64,6 +75,8 @@ sysarg_fail(char *msg) exit(1); } + +#ifndef IIGS /* * Get SDL key code */ @@ -85,6 +98,7 @@ sysarg_sdlcode(char *k) return result; } +#endif /* * Scan key codes sequence @@ -92,6 +106,7 @@ sysarg_sdlcode(char *k) int sysarg_scankeys(char *keys) { +#ifndef IIGS char k[16]; int i, j; @@ -131,7 +146,7 @@ sysarg_scankeys(char *keys) k[j] = '\0'; syskbd_fire = sysarg_sdlcode(k); if (!syskbd_fire) return -1; - +#endif return 0; } diff --git a/src/sysevt.c b/src/sysevt.c index 9e3830f..f42d322 100644 --- a/src/sysevt.c +++ b/src/sysevt.c @@ -16,7 +16,9 @@ * requires that SHIFT be pressed to input numbers. */ +#ifndef IIGS #include +#endif #include "system.h" #include "config.h" @@ -31,7 +33,14 @@ #define SETBIT(x,b) x |= (b) #define CLRBIT(x,b) x &= ~(b) +#ifndef IIGS static SDL_Event event; +#endif + +#ifdef IIGS +segment "system"; +#pragma noroot +#endif /* * Process an event @@ -39,6 +48,7 @@ static SDL_Event event; static void processEvent() { +#ifndef IIGS U16 key; #ifdef ENABLE_FOCUS SDL_ActiveEvent *aevent; @@ -206,6 +216,7 @@ processEvent() default: break; } +#endif //IIGS } /* @@ -214,8 +225,10 @@ processEvent() void sysevt_poll(void) { +#ifndef IIGS while (SDL_PollEvent(&event)) processEvent(); +#endif } /* @@ -224,11 +237,11 @@ sysevt_poll(void) void sysevt_wait(void) { +#ifndef IIGS SDL_WaitEvent(&event); processEvent(); +#endif } /* eof */ - - diff --git a/src/sysjoy.c b/src/sysjoy.c index 92833c8..186c4fb 100644 --- a/src/sysjoy.c +++ b/src/sysjoy.c @@ -11,7 +11,14 @@ * You must not remove this notice, or any other, from this software. */ +//#ifdef IIGS +#pragma noroot +//segment "system"; +//#endif + +#ifndef IIGS #include +#endif #include "config.h" diff --git a/src/syskbd.c b/src/syskbd.c index 2394760..f9f8ca7 100644 --- a/src/syskbd.c +++ b/src/syskbd.c @@ -11,10 +11,27 @@ * You must not remove this notice, or any other, from this software. */ +#ifndef IIGS #include +#endif #include "system.h" +#ifdef IIGS +#pragma noroot +segment "system"; +#endif + +#ifdef IIGS +U8 syskbd_up = 'W'; +U8 syskbd_down = 'S'; +U8 syskbd_left = 'A'; +U8 syskbd_right = 'D'; +U8 syskbd_pause = 'P'; +U8 syskbd_end = '2'; +U8 syskbd_xtra = '1'; +U8 syskbd_fire = ' '; +#else U8 syskbd_up = SDLK_o; U8 syskbd_down = SDLK_k; U8 syskbd_left = SDLK_z; @@ -23,6 +40,7 @@ U8 syskbd_pause = SDLK_p; U8 syskbd_end = SDLK_e; U8 syskbd_xtra = SDLK_ESCAPE; U8 syskbd_fire = SDLK_SPACE; +#endif /* eof */ diff --git a/src/syssnd.c b/src/syssnd.c index 0010090..6d4f675 100644 --- a/src/syssnd.c +++ b/src/syssnd.c @@ -11,7 +11,13 @@ * You must not remove this notice, or any other, from this software. */ +#ifdef IIGS +#pragma noroot +#endif + +#ifndef IIGS #include +#endif #include #include @@ -25,6 +31,8 @@ #include "debug.h" #include "data.h" +segment "system"; + #define ADJVOL(S) (((S)*sndVol)/SDL_MIX_MAXVOLUME) static U8 isAudioActive = FALSE; diff --git a/src/system.c b/src/system.c index 8cb2f8b..3caed3e 100644 --- a/src/system.c +++ b/src/system.c @@ -11,7 +11,13 @@ * You must not remove this notice, or any other, from this software. */ +#ifdef IIGS +#pragma noroot +#endif + +#ifndef IIGS #include +#endif #include /* args for sys_panic */ #include /* fcntl in sys_panic */ @@ -73,6 +79,9 @@ sys_printf(char *msg, ...) U32 sys_gettime(void) { +#ifdef IIGS + return 0; +#else static U32 ticks_base = 0; U32 ticks; @@ -82,6 +91,7 @@ sys_gettime(void) ticks_base = ticks; return ticks - ticks_base; +#endif } /* @@ -90,7 +100,9 @@ sys_gettime(void) void sys_sleep(int s) { +#ifndef IIGS SDL_Delay(s); +#endif } /* diff --git a/src/sysvid.c b/src/sysvid.c index c8f847c..e561bcc 100644 --- a/src/sysvid.c +++ b/src/sysvid.c @@ -11,9 +11,15 @@ * You must not remove this notice, or any other, from this software. */ +#ifdef IIGS +#pragma noroot +#endif + #include /* malloc */ +#ifndef IIGS #include +#endif #include "system.h" #include "game.h" @@ -24,11 +30,15 @@ #include /* memset */ #endif +segment "system"; + U8 *sysvid_fb; /* frame buffer */ rect_t SCREENRECT = {0, 0, SYSVID_WIDTH, SYSVID_HEIGHT, NULL}; /* whole fb */ +#ifndef IIGS static SDL_Color palette[256]; static SDL_Surface *screen; +#endif static U32 videoFlags; static U8 zoom = SYSVID_ZOOM; /* actual zoom level */ @@ -46,7 +56,7 @@ static U8 RED[] = { 0x00, 0x50, 0xf0, 0xf0, 0x00, 0x50, 0xf0, 0xf0 }; static U8 GREEN[] = { 0x00, 0xf8, 0x50, 0xf8, 0x00, 0xf8, 0x50, 0xf8 }; static U8 BLUE[] = { 0x00, 0x50, 0x50, 0x50, 0x00, 0xf8, 0xf8, 0xf8 }; #endif -#ifdef GFXST +#if defined(GFXST) || defined(GFXGS) static U8 RED[] = { 0x00, 0xd8, 0xb0, 0xf8, 0x20, 0x00, 0x00, 0x20, 0x48, 0x48, 0x90, 0xd8, @@ -81,15 +91,18 @@ static U8 BLUE[] = { 0x00, 0x00, 0x68, 0x68, /* * Initialize screen */ +#ifndef IIGS static SDL_Surface *initScreen(U16 w, U16 h, U8 bpp, U32 flags) { return SDL_SetVideoMode(w, h, bpp, flags); } +#endif void sysvid_setPalette(img_color_t *pal, U16 n) { +#ifndef IIGS U16 i; for (i = 0; i < n; i++) { @@ -98,12 +111,15 @@ sysvid_setPalette(img_color_t *pal, U16 n) palette[i].b = pal[i].b; } SDL_SetColors(screen, (SDL_Color *)&palette, 0, n); +#endif } void sysvid_restorePalette() { +#ifndef IIGS SDL_SetColors(screen, (SDL_Color *)&palette, 0, 256); +#endif } void @@ -126,6 +142,7 @@ sysvid_setGamePalette() void sysvid_chkvm(void) { +#ifndef IIGS SDL_Rect **modes; U8 i, mode = 0; @@ -164,6 +181,7 @@ sysvid_chkvm(void) fszoom = 1; } } +#endif } /* @@ -172,6 +190,7 @@ sysvid_chkvm(void) void sysvid_init(void) { +#ifndef IIGS SDL_Surface *s; U8 *mask, tpix; U32 len, i; @@ -242,6 +261,7 @@ sysvid_init(void) sys_panic("xrick/video: sysvid_fb malloc failed\n"); IFDEBUG_VIDEO(printf("xrick/video: ready\n");); +#endif } /* @@ -250,10 +270,12 @@ sysvid_init(void) void sysvid_shutdown(void) { +#ifndef IIGS free(sysvid_fb); sysvid_fb = NULL; SDL_Quit(); +#endif } /* @@ -263,6 +285,7 @@ sysvid_shutdown(void) void sysvid_update(rect_t *rects) { +#ifndef IIGS static SDL_Rect area; U16 x, y, xz, yz; U8 *p, *q, *p0, *q0; @@ -321,6 +344,7 @@ sysvid_update(rect_t *rects) } SDL_UnlockSurface(screen); +#endif } @@ -331,7 +355,9 @@ sysvid_update(rect_t *rects) void sysvid_clear(void) { +#ifndef IIGS memset(sysvid_fb, 0, SYSVID_WIDTH * SYSVID_HEIGHT); +#endif } @@ -341,6 +367,7 @@ sysvid_clear(void) void sysvid_zoom(S8 z) { +#ifndef IIGS if (!(videoFlags & SDL_FULLSCREEN) && ((z < 0 && zoom > 1) || (z > 0 && zoom < SYSVID_MAXZOOM))) { @@ -351,6 +378,7 @@ sysvid_zoom(S8 z) sysvid_restorePalette(); sysvid_update(&SCREENRECT); } +#endif } /* @@ -359,6 +387,7 @@ sysvid_zoom(S8 z) void sysvid_toggleFullscreen(void) { +#ifndef IIGS videoFlags ^= SDL_FULLSCREEN; if (videoFlags & SDL_FULLSCREEN) { /* go fullscreen */ @@ -373,6 +402,7 @@ sysvid_toggleFullscreen(void) screen->format->BitsPerPixel, videoFlags); sysvid_restorePalette(); sysvid_update(&SCREENRECT); +#endif } /* eof */ diff --git a/src/unzip.c b/src/unzip.c index 8cdb9c0..0dbf1ff 100644 --- a/src/unzip.c +++ b/src/unzip.c @@ -3,7 +3,11 @@ Read unzip.h for more info */ +#ifdef IIGS +#pragma noroot +#endif +#ifndef IIGS #include #include @@ -1318,3 +1322,6 @@ extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf) *(szComment+s->gi.size_comment)='\0'; return (int)uReadThis; } + +#endif // !IIGS + diff --git a/src/util.c b/src/util.c index 0b83f8d..24e8cc9 100644 --- a/src/util.c +++ b/src/util.c @@ -11,6 +11,10 @@ * You must not remove this notice, or any other, from this software. */ +#ifdef IIGS +#pragma noroot +#endif + #include /* NULL */ #include "system.h" diff --git a/src/xrick.c b/src/xrick.c index 38d4e26..21ec15b 100644 --- a/src/xrick.c +++ b/src/xrick.c @@ -14,7 +14,12 @@ #include "system.h" #include "game.h" +#ifndef IIGS #include +#endif + +//extern void waitkey(); +//extern void fbuffer(); /* * main @@ -22,6 +27,30 @@ int main(int argc, char *argv[]) { + printf("Hello from xrick IIgs\n"); +// waitkey(); +// fbuffer(); + + #if 0 +handle hndl; /* "generic" handle */ +/* Create new member array of minimum size. */ +hndl = NewHandle(1024L, myID, 0xC010, NULL); +if (toolerror()) { + HandleError(toolerror(), memryErr); + return FALSE; + } + +// PushLong #0 ;/* Ask Shadowing Screen ($8000 bytes from $01/2000)*/ +// PushLong #$8000 +// PushWord myID +// PushWord #%11000000_00000011 +// PushLong #$012000 +// _NewHandle +// PLA +// PLA + #endif + + sys_init(argc, argv); if (sysarg_args_data) data_setpath(sysarg_args_data); diff --git a/waitkey.s b/waitkey.s new file mode 100644 index 0000000..6108818 --- /dev/null +++ b/waitkey.s @@ -0,0 +1,31 @@ + rel + dsk Main.l + +; ext fbuffer + +waitkey ent + clc + xce + sep #$30 + + ; Enable SHR + + ldal $e0c029 + ora #$c0 + stal $e0c029 + + ; Wait Key +:lp + ldal $e0c000 + bpl :lp + stal $e0c010 + + ; Exit the App + + ; TODO call Prodos 16 Exit + ; as rtl probably just crashes + + rtl + +; da fbuffer + diff --git a/xrick.6.gz b/xrick.6.gz deleted file mode 100644 index c501d59..0000000 Binary files a/xrick.6.gz and /dev/null differ diff --git a/xrick.dsp b/xrick.dsp deleted file mode 100644 index bae82aa..0000000 --- a/xrick.dsp +++ /dev/null @@ -1,393 +0,0 @@ -# Microsoft Developer Studio Project File - Name="xrick" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=xrick - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "xrick.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "xrick.mak" CFG="xrick - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "xrick - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "xrick - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "xrick - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x40c /d "NDEBUG" -# ADD RSC /l 0x40c /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 - -!ELSEIF "$(CFG)" == "xrick - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MD /W3 /Gm /GX /ZI /Od /I "include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x40c /d "_DEBUG" -# ADD RSC /l 0x40c /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "xrick - Win32 Release" -# Name "xrick - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\src\control.c -# End Source File -# Begin Source File - -SOURCE=.\src\dat_ents.c -# End Source File -# Begin Source File - -SOURCE=.\src\dat_maps.c -# End Source File -# Begin Source File - -SOURCE=.\src\dat_picsPC.c -# End Source File -# Begin Source File - -SOURCE=.\src\dat_picsST.c -# End Source File -# Begin Source File - -SOURCE=.\src\dat_screens.c -# End Source File -# Begin Source File - -SOURCE=.\src\dat_snd.c -# End Source File -# Begin Source File - -SOURCE=.\src\dat_spritesPC.c -# End Source File -# Begin Source File - -SOURCE=.\src\dat_spritesST.c -# End Source File -# Begin Source File - -SOURCE=.\src\dat_tilesPC.c -# End Source File -# Begin Source File - -SOURCE=.\src\dat_tilesST.c -# End Source File -# Begin Source File - -SOURCE=.\src\data.c -# End Source File -# Begin Source File - -SOURCE=.\src\devtools.c -# End Source File -# Begin Source File - -SOURCE=.\src\draw.c -# End Source File -# Begin Source File - -SOURCE=.\src\e_bomb.c -# End Source File -# Begin Source File - -SOURCE=.\src\e_bonus.c -# End Source File -# Begin Source File - -SOURCE=.\src\e_box.c -# End Source File -# Begin Source File - -SOURCE=.\src\e_bullet.c -# End Source File -# Begin Source File - -SOURCE=.\src\e_rick.c -# End Source File -# Begin Source File - -SOURCE=.\src\e_sbonus.c -# End Source File -# Begin Source File - -SOURCE=.\src\e_them.c -# End Source File -# Begin Source File - -SOURCE=.\src\ents.c -# End Source File -# Begin Source File - -SOURCE=.\src\game.c -# End Source File -# Begin Source File - -SOURCE=.\src\maps.c -# End Source File -# Begin Source File - -SOURCE=.\src\rects.c -# End Source File -# Begin Source File - -SOURCE=.\src\scr_gameover.c -# End Source File -# Begin Source File - -SOURCE=.\src\scr_getname.c -# End Source File -# Begin Source File - -SOURCE=.\src\scr_imain.c -# End Source File -# Begin Source File - -SOURCE=.\src\scr_imap.c -# End Source File -# Begin Source File - -SOURCE=.\src\scr_pause.c -# End Source File -# Begin Source File - -SOURCE=.\src\scr_xrick.c -# End Source File -# Begin Source File - -SOURCE=.\src\scroller.c -# End Source File -# Begin Source File - -SOURCE=.\src\sysarg.c -# End Source File -# Begin Source File - -SOURCE=.\src\sysevt.c -# End Source File -# Begin Source File - -SOURCE=.\src\sysjoy.c -# End Source File -# Begin Source File - -SOURCE=.\src\syskbd.c -# End Source File -# Begin Source File - -SOURCE=.\src\syssnd.c -# End Source File -# Begin Source File - -SOURCE=.\src\system.c -# End Source File -# Begin Source File - -SOURCE=.\src\sysvid.c -# End Source File -# Begin Source File - -SOURCE=.\src\unzip.c -# End Source File -# Begin Source File - -SOURCE=.\src\util.c -# End Source File -# Begin Source File - -SOURCE=.\src\xrick.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\include\config.h -# End Source File -# Begin Source File - -SOURCE=.\include\control.h -# End Source File -# Begin Source File - -SOURCE=.\include\data.h -# End Source File -# Begin Source File - -SOURCE=.\include\debug.h -# End Source File -# Begin Source File - -SOURCE=.\include\devtools.h -# End Source File -# Begin Source File - -SOURCE=.\include\draw.h -# End Source File -# Begin Source File - -SOURCE=.\include\e_bomb.h -# End Source File -# Begin Source File - -SOURCE=.\include\e_bonus.h -# End Source File -# Begin Source File - -SOURCE=.\include\e_box.h -# End Source File -# Begin Source File - -SOURCE=.\include\e_bullet.h -# End Source File -# Begin Source File - -SOURCE=.\include\e_rick.h -# End Source File -# Begin Source File - -SOURCE=.\include\e_sbonus.h -# End Source File -# Begin Source File - -SOURCE=.\include\e_them.h -# End Source File -# Begin Source File - -SOURCE=.\include\ents.h -# End Source File -# Begin Source File - -SOURCE=.\include\game.h -# End Source File -# Begin Source File - -SOURCE=.\include\img.h -# End Source File -# Begin Source File - -SOURCE=.\include\maps.h -# End Source File -# Begin Source File - -SOURCE=.\include\pics.h -# End Source File -# Begin Source File - -SOURCE=.\include\rects.h -# End Source File -# Begin Source File - -SOURCE=.\include\screens.h -# End Source File -# Begin Source File - -SOURCE=.\include\scroller.h -# End Source File -# Begin Source File - -SOURCE=.\include\sprites.h -# End Source File -# Begin Source File - -SOURCE=.\include\syssnd.h -# End Source File -# Begin Source File - -SOURCE=.\include\system.h -# End Source File -# Begin Source File - -SOURCE=.\include\sysvid.h -# End Source File -# Begin Source File - -SOURCE=.\include\tiles.h -# End Source File -# Begin Source File - -SOURCE=.\include\unzip.h -# End Source File -# Begin Source File - -SOURCE=.\include\util.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\src\xrick.rc -# End Source File -# Begin Source File - -SOURCE=.\src\xrickPC.ico -# End Source File -# Begin Source File - -SOURCE=.\src\xrickST.ico -# End Source File -# End Group -# End Target -# End Project diff --git a/xrick.po b/xrick.po new file mode 100644 index 0000000..51ea716 Binary files /dev/null and b/xrick.po differ