diff --git a/README.md b/README.md index b4b765dc..e6f834a7 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,10 @@ Descarga la última release estable de la v5 de la carpeta "releases". El motor/_framework_ reside en [/src](./src). El código, tal y como está, genera un juego mínimo por defecto que debes *reemplazar* con el tuyo. Para compilarlo, sigue los siguientes pasos: -1. Descomprime la versión mínima de z88dk que encontrarás en `env/` en la raíz de `C:` (el archivo `env/z88dk10-stripped.zip`). Se creará un directorio `C:\z88dk10\` con los archivos del compilador. -2. Desde una ventana de línea de comandos, entra en `src/dev` y ejecuta los siguientes comandos: +1. Obtén la última versión de **z88dk** (nightly build) desde https://github.com/z88dk/z88dk e instálala. +2. Descomprime la versión de splib2 que encontrarás en `env/` en una ubicación temporal, y posteriormente mueve `spritepack.h` al subdirectorio `include` de **z88dk** (por ejemplo, `c:/z88dk/include`) y `splib2_mk2.lib` al subdirectorio `lib/clibs` de **z88dk** (por ejemplo, `c:/z88dk/lib/clibs/`). +3. Si has instalado **z88dk** en una ubicación diferente de `c:/z88dk/` tendrás que modificar `src/dev/setenv.bat`. +4. Desde una ventana de línea de comandos, entra en `src/dev` y ejecuta los siguientes comandos: ``` $ setenv.bat diff --git a/docs/tutorial-cap01.md b/docs/tutorial-cap01.md index 20da36ba..5b82250f 100644 --- a/docs/tutorial-cap01.md +++ b/docs/tutorial-cap01.md @@ -118,7 +118,22 @@ Ah, que se me olvidaba. También hicimos un dibujo de la Meemaid. Es ésta: ## Metiendo la cara en el barro -Vamos a empezar a montar cosas. En primer lugar, necesitarás **z88dk**, que es un compilador de C, y **splib2**, que es la biblioteca de gráficos y demás E/S que usamos. Como no tenemos ganas de que te compliques instalando cosas (sobre todo porque la splib2 es muy vieja y es complicado compilarla usando un z88dk moderno, y porque la splib2 que usamos en el motor está modificada por Elías, el mono modificalibrerías), hemos preparado, para los usuarios de Windows, un paquete `z88dk10-stripped.zip` que encontrarás en el directorio `env` de este repositorio y que deberás descomprimir en C:. +Vamos a empezar a montar cosas. En primer lugar, necesitarás **z88dk**, que es un compilador de C, y **splib2**, que es la biblioteca de gráficos y demás E/S que usamos. Hasta ahora habíamos venido usando la versión 1.10 de **z88dk** y una versión modificada de **splib2** con un par de cambios. Sin embargo, a partir de 5.9, **MTE MK1** utiliza la versión más reciente de **z88dk**. + +Lo primero que tienes que hacer es instalar **z88dk**. Por lo general, valdrá con que vayas a https://github.com/z88dk/z88dk, descargues la última *nightly build* (que debería estar siempre disponible en [este enlace](http://nightly.z88dk.org/z88dk-win32-latest.zip)), y la descomprimas en `c:\`. + +Lo siguiente sería instalar **splib2**. Puedes: + +* O bien *construir e instalar splib2* : Para ello entraríamos en `lib/splib2` y ejecutaríamos, en una ventana de linea de comandos, que recompilará toda splib2 con la versión que acabas de instalar de **z88dk** y posteriormente la instalará: + +``` + $ setenv.bat + $ Makefile.bat +``` + +* O bien, simplemente **instalar la versión ya compilada** que hay en `env/splib2_mk2.zip`. En el `zip` encontrarás dos archivos: `spritepack.h` que deberás copiar a `c:/z88dk/include` y `splib2_mk2.lib` que deberás copiar en `c:/z88dk/lib/clibs`. + +Si todo esto te parece un dolor, puedes coger la versión de **z88dk** con **splib2** preinstalado que hay en `env/z88dk_mt.7z`, que corresponde con la versión `v18462-8d70c5a-20210624` del 25 de Junio de 2021. Sin embargo, pienso que es mejor estar "a la última" y realizar este proceso manualmente, y es lo que deberías hacer si tienes un mínimo de experiencia. También vamos a necesitar un editor de textos. Si eres programador ya tendrás uno que te guste de la hostia. Si no lo eres, por favor, no utilices el Bloc de Notas de Windows. diff --git a/docs/tutorial-cap13.md b/docs/tutorial-cap13.md index 59eaab0d..2ba03858 100644 --- a/docs/tutorial-cap13.md +++ b/docs/tutorial-cap13.md @@ -579,7 +579,7 @@ Cuando se descomprime un *level bundle*, los primeros 16 bytes del binario corre Accediendo a los datos en `level_data` podremos leer las dimensiones del nivel actual o donde vamos a empezar, el número máximo de objetos o la vida de los enemigos. Como `level_data` es un puntero a una estructura `extern`, tendremos que usar `->` para acceder a los valores de sus campos, por ejemplo: ```c - rda = level_data->max_objs; + rda = level_data.max_objs; ``` ## Configurando el motor @@ -754,7 +754,7 @@ Antes hemos visto la fullería que hemos hecho con `PLAYER_NUM_OBJETOS` para pod ### Número de objetos -Como ya hemos visto, se trata de configurar `PLAYER_NUM_OBJETOS` al valor de la cabecera `level_data->max_objs`: +Como ya hemos visto, se trata de configurar `PLAYER_NUM_OBJETOS` al valor de la cabecera `level_data.max_objs`: ```c #define PLAYER_NUM_OBJETOS (level_lata->max_objs) @@ -1149,12 +1149,12 @@ El código que saca la pantalla, toca la música de nuevo nivel y saca el numer Una cosa que suele ayudar mucho al _gameplay_, sobre todo cuando el juego es más de avanzar que de explorar, es dar un pequeño boost al jugador al subir a la pantalla de arriba. Vamos a detectar que estemos cambiando de pantalla hacia arriba para dar a la VY el máximo valor negativo, lo que hará más fácil dirigir a Goku Mal a una plataforma en lugar de fallar y volver a la pantalla de abajo. -Si recordamos, `my/ci/before_entering_screen.h` se inyecta justo al ir a cambiar pantalla, cuando `n_pant` y `o_pant` son distintas. Justo ahí podremos detectar que `n_pant == (o_pant - level_data->map_w)` y en ese caso aplicar el boost: +Si recordamos, `my/ci/before_entering_screen.h` se inyecta justo al ir a cambiar pantalla, cuando `n_pant` y `o_pant` son distintas. Justo ahí podremos detectar que `n_pant == (o_pant - level_data.map_w)` y en ese caso aplicar el boost: ```c // before_entering_screen.h - if (n_pant == (o_pant - level_data->map_w)) p_vy = -PLAYER_MAX_VY_SALTANDO; + if (n_pant == (o_pant - level_data.map_w)) p_vy = -PLAYER_MAX_VY_SALTANDO; ``` ## Fin! diff --git a/env/splib2_mk2.zip b/env/splib2_mk2.zip new file mode 100644 index 00000000..8e942bc5 Binary files /dev/null and b/env/splib2_mk2.zip differ diff --git a/env/z88dk10-stripped.zip b/env/z88dk10-stripped.zip deleted file mode 100644 index 9458bdae..00000000 Binary files a/env/z88dk10-stripped.zip and /dev/null differ diff --git a/env/z88dk_mt.7z b/env/z88dk_mt.7z new file mode 100644 index 00000000..405f447a Binary files /dev/null and b/env/z88dk_mt.7z differ diff --git a/examples/dogmole/bin/ending.bin b/examples/dogmole/bin/ending.bin new file mode 100644 index 00000000..e32950a6 Binary files /dev/null and b/examples/dogmole/bin/ending.bin differ diff --git a/examples/dogmole/bin/marco.bin b/examples/dogmole/bin/marco.bin new file mode 100644 index 00000000..62123e85 Binary files /dev/null and b/examples/dogmole/bin/marco.bin differ diff --git a/examples/dogmole/bin/title.bin b/examples/dogmole/bin/title.bin new file mode 100644 index 00000000..fb2abb35 Binary files /dev/null and b/examples/dogmole/bin/title.bin differ diff --git a/examples/dogmole/dev/128k.h b/examples/dogmole/dev/128k.h index 2f4b4b97..317fd7a2 100644 --- a/examples/dogmole/dev/128k.h +++ b/examples/dogmole/dev/128k.h @@ -6,99 +6,19 @@ void SetRAMBank(void) { #asm .SetRAMBank + ld a, b + or a + jp z, restISR + xor a + ld i, a + jp keepGoing + .restISR + ld a, $f0 + ld i, a + .keepGoing ld a, 16 or b ld bc, $7ffd out (C), a #endasm } -/* -// Esto lo empecé pero por ahora lo dejo aparcado :-/ -#ifdef MOVE_STUFF_TO_RAM_6 -typedef struct { - int x, y; - unsigned char x1, y1, x2, y2; - char mx, my; - char t; - unsigned char life; -} MALOTE; - -MALOTE malotes [3]; -MALOTE *malote_copy; - -void ram6_to_ram (void) { - // This function copies current screen data from RAM 6 to low RAM (new screen) - #asm - di - ld b, 6 - call SetRAMBank - #endasm - - // Map screen -#ifdef UNPACKED_MAP - map_pointer = 0xc000 + (n_pant * 150); -#else - map_pointer = 0xc000 + (n_pant * 75); -#endif - for (gpit = 0; gpit < 150; gpit ++) { -#ifdef UNPACKED_MAP - // Mapa tipo UNPACKED - gpd = *map_pointer ++; - map_buff [gpit] = gpd; -#else - // Mapa tipo PACKED - if (!(gpit & 1)) { - gpc = *map_pointer ++; - gpd = gpc >> 4; - } else { - gpd = gpc & 15; - } - map_buff [gpit] = gpd; -#endif - } - - // Enems - enoffs = n_pant * 3; -#ifdef UNPACKED_MAP - map_pointer = 0xc000 + MAP_W * MAP_H * 150 + 12 * enoffs; -#else - map_pointer = 0xc000 + MAP_W * MAP_H * 75 + 12 * enoffs; -#endif - malote_copy = malotes; - for (gpit = 0; gpit < 36; gpit ++) { - *malote_copy ++ = *map_pointer ++; - } - enoffs = 0; - - // Hotspots - // Bolts - - // Get back - #asm - di - ld b, 0 - call SetRAMBank - #endasm -} - -void ram_to_ram6 (void) { - // This function copies current screen data from low RAM to RAM 6 (update) - #asm - di - ld b, 6 - call SetRAMBank - #endasm - - // Enems - // Hotspots - // Bolts - - // Get back - #asm - di - ld b, 0 - call SetRAMBank - #endasm -} -#endif -*/ \ No newline at end of file diff --git a/examples/dogmole/dev/aplib.h b/examples/dogmole/dev/aplib.h index 88a31fda..11441f46 100644 --- a/examples/dogmole/dev/aplib.h +++ b/examples/dogmole/dev/aplib.h @@ -1,13 +1,6 @@ // MTE MK1 (la Churrera) v5.0 // Copyleft 2010-2014, 2020 by the Mojon Twins -unsigned int ram_address; -unsigned int ram_destination; - -#ifdef MODE_128K - unsigned char ram_page; -#endif - #asm ; aPPack decompressor diff --git a/examples/dogmole/dev/assets/ay_fx_numbers.h b/examples/dogmole/dev/assets/ay_fx_numbers.h index 411264ac..531957b2 100644 --- a/examples/dogmole/dev/assets/ay_fx_numbers.h +++ b/examples/dogmole/dev/assets/ay_fx_numbers.h @@ -1,20 +1,42 @@ // MTE MK1 (la Churrera) v5.0 // Copyleft 2010-2014, 2020 by the Mojon Twins -#define SFX_START 0 -#define SFX_BREAKABLE_HIT 1 -#define SFX_BREAKABLE_BREAK 2 -#define SFX_PUSH_BOX 3 -#define SFX_OPEN_LOCK 3 -#define SFX_SHOOT 4 -#define SFX_OBJECT_GET 5 -#define SFX_KILL_ENEMY_STEP 6 -#define SFX_KILL_ENEMY_SHOOT 6 -#define SFX_HIT_ENEMY 7 -#define SFX_ONE_OBJECT_GET 8 -#define SFX_ONE_OBJECT_WRONG 9 -#define SFX_KEY_GET 10 -#define SFX_REFILL_GET 11 -#define SFX_JUMP 12 -#define SFX_SPIKES 13 -#define SFX_ENEMY_HIT 14 +#ifdef USE_ARKOS_PLAYER + #define SFX_START 1 + #define SFX_BREAKABLE_HIT 1 + #define SFX_BREAKABLE_BREAK 2 + #define SFX_PUSH_BOX 3 + #define SFX_OPEN_LOCK 3 + #define SFX_SHOOT 4 + #define SFX_OBJECT_GET 5 + #define SFX_KILL_ENEMY_STEP 6 + #define SFX_KILL_ENEMY_SHOOT 6 + #define SFX_HIT_ENEMY 7 + #define SFX_ONE_OBJECT_GET 8 + #define SFX_ONE_OBJECT_WRONG 9 + #define SFX_KEY_GET 4 + #define SFX_REFILL_GET 11 + #define SFX_JUMP 2 + #define SFX_SPIKES 2 + #define SFX_ENEMY_HIT 8 + +#else + #define SFX_START 0 + #define SFX_BREAKABLE_HIT 1 + #define SFX_BREAKABLE_BREAK 2 + #define SFX_PUSH_BOX 3 + #define SFX_OPEN_LOCK 3 + #define SFX_SHOOT 4 + #define SFX_OBJECT_GET 5 + #define SFX_KILL_ENEMY_STEP 6 + #define SFX_KILL_ENEMY_SHOOT 6 + #define SFX_HIT_ENEMY 7 + #define SFX_ONE_OBJECT_GET 8 + #define SFX_ONE_OBJECT_WRONG 9 + #define SFX_KEY_GET 10 + #define SFX_REFILL_GET 11 + #define SFX_JUMP 12 + #define SFX_SPIKES 13 + #define SFX_ENEMY_HIT 14 + +#endif diff --git a/examples/dogmole/dev/assets/levels.h b/examples/dogmole/dev/assets/levels.h index c601614a..bd29b455 100644 --- a/examples/dogmole/dev/assets/levels.h +++ b/examples/dogmole/dev/assets/levels.h @@ -14,7 +14,7 @@ // Map data, 75 or 150 * (MAP_W*MAP_H) bytes // Bolts, 32 * 4 = 128 bytes // Tileset, 2304 bytes -// Enemies, MAP_W * MAP_H * 3 * 10 bytes +// Enemies, MAP_W * MAP_H * MAX_ENEMS * 10 bytes // Hotspots, MAP_W * MAP_H * 3 bytes // Behs, 48 bytes // Spriteset, 2312 bytes @@ -64,7 +64,7 @@ extern unsigned char font [0]; ._font BINARY "font.bin" #endasm -extern LEVELHEADER level_data [0]; +extern LEVELHEADER level_data; #asm ._level_data defs 16 #endasm @@ -94,7 +94,7 @@ extern unsigned char tileset [0]; extern MALOTE malotes [0]; #asm - ._malotes defs MAP_W * MAP_H * 3 * 10 + ._malotes defs MAP_W * MAP_H * MAX_ENEMS * 10 #endasm extern HOTSPOT hotspots [0]; diff --git a/examples/dogmole/dev/compile.bat b/examples/dogmole/dev/compile.bat index 656beca6..351fe680 100644 --- a/examples/dogmole/dev/compile.bat +++ b/examples/dogmole/dev/compile.bat @@ -37,24 +37,65 @@ echo Importando GFX ..\..\..\src\utils\png2scr.exe ..\gfx\marco.png ..\gfx\marco.scr > nul ..\..\..\src\utils\png2scr.exe ..\gfx\ending.png ..\gfx\ending.scr > nul ..\..\..\src\utils\png2scr.exe ..\gfx\loading.png loading.bin > nul -..\..\..\src\utils\apultra.exe ..\gfx\title.scr title.bin > nul -..\..\..\src\utils\apultra.exe ..\gfx\marco.scr marco.bin > nul -..\..\..\src\utils\apultra.exe ..\gfx\ending.scr ending.bin > nul +..\..\..\src\utils\apultra.exe ..\gfx\title.scr ..\bin\title.bin > nul +..\..\..\src\utils\apultra.exe ..\gfx\marco.scr ..\bin\marco.bin > nul +..\..\..\src\utils\apultra.exe ..\gfx\ending.scr ..\bin\ending.bin > nul if [%1]==[justassets] goto :end +rem echo Running The Librarian +rem ..\utils\librarian2.exe list=..\bin\list.txt index=assets\librarian.h bins_prefix=..\bin\ rams_prefix=..\bin\ > nul + +rem *** Música AY: Descomenta el player que vayas a usar (Wyz o Arkos) *** + +rem echo Compilando musica 128k - Wyz Player +rem cd ..\mus +rem ..\utils\apultra.exe menu.mus menu.bin +rem ..\utils\apultra.exe level1.mus level1.bin +rem ..\utils\pasmo WYZproPlay47aZXc.ASM ..\bin\RAM1.bin +rem cd ..\dev + +rem echo Compilando musica 128k - Arkos Player +rem cd ..\mus_arkos +rem if [%1]==[nomus] goto :nomus +rem ..\utils\build_mus_bin.exe ram1.bin > nul +rem :nomus +rem copy ram1.bin ..\bin +rem copy arkos-addresses.h ..\dev\sound +rem cd ..\dev + :compile echo Compilando guego -zcc +zx -vn mk1.c -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul +zcc +zx -vn mk1.c -O3 -crt0=crt.asm -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul +rem zcc +zx -vn mk1.c -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul ..\..\..\src\utils\printsize.exe %game%.bin ..\..\..\src\utils\printsize.exe scripts.bin +rem *** Tipo de cargador *** + echo Construyendo cinta rem cambia LOADER por el nombre que quieres que salga en Program: ..\..\..\src\utils\bas2tap -a10 -sDOGMOLE loader\loader.bas loader.tap > nul ..\..\..\src\utils\bin2tap -o screen.tap -a 16384 loading.bin > nul ..\..\..\src\utils\bin2tap -o main.tap -a 24000 %game%.bin > nul copy /b loader.tap + screen.tap + main.tap %game%.tap > nul +rem echo Construyendo cinta 128k +rem ..\..\..\src\utils\imanol.exe ^ +rem in=loader\loaderzx.asm-orig ^ +rem out=loader\loader.asm ^ +rem ram1_length=?..\bin\RAM1.bin ^ +rem ram3_length=?..\bin\RAM3.bin ^ +rem mb_length=?%game%.bin > nul + +rem ..\utils\pasmo.exe loader\loader.asm ..\bin\loader.bin loader.txt + +rem cambia LOADER por el nombre que quieres que salga en Program: +rem ..\..\..\src\utils\GenTape.exe %game%.tap ^ +rem basic 'LOADER' 10 ..\bin\loader.bin ^ +rem data loading.bin ^ +rem data ..\bin\RAM1.bin ^ +rem data ..\bin\RAM3.bin ^ +rem data %game%.bin if [%1]==[justcompile] goto :end if [%1]==[noclean] goto :end diff --git a/examples/dogmole/dev/crt.asm b/examples/dogmole/dev/crt.asm new file mode 100644 index 00000000..27e0d47d --- /dev/null +++ b/examples/dogmole/dev/crt.asm @@ -0,0 +1,17 @@ + MODULE zx82_crt0 + INCLUDE "zcc_opt.def" + XREF _main ; main() is always external to crt0 code + + IF !STACKPTR + defc STACKPTR = $FFFF + ENDIF + + IF !CRT_ORG_CODE + defc CRT_ORG_CODE = 32768 + ENDIF + + org CRT_ORG_CODE + +start: + ld sp,STACKPTR + jp _main diff --git a/examples/dogmole/dev/definitions.h b/examples/dogmole/dev/definitions.h index a15cd13b..38f3bd82 100644 --- a/examples/dogmole/dev/definitions.h +++ b/examples/dogmole/dev/definitions.h @@ -6,7 +6,8 @@ .fsClipStruct defb 0, 24, 0, 32 #endasm -void *joyfunc = sp_JoyKeyboard; // Puntero a la función de manejo seleccionada. +//void *joyfunc = sp_JoyKeyboard; // Puntero a la función de manejo seleccionada. +unsigned int (*joyfunc)(struct sp_UDK *) = sp_JoyKeyboard; const void *joyfuncs [] = { sp_JoyKeyboard, sp_JoyKempston, sp_JoySinclair1 @@ -31,8 +32,15 @@ void *u_free = sp_FreeBlock; // Safe stuff in low(est) RAM -unsigned char safe_byte @ 23296; +unsigned char safe_byte @ 23296; +unsigned int ram_address @ 23297; +unsigned int ram_destination @ 23299; + +#ifdef MODE_128K + unsigned char ram_page @ 23301; +#endif + // Globales muy globalizadas struct sp_SS *sp_player; @@ -49,7 +57,7 @@ unsigned char enoffs; // Aux char asm_number; -unsigned int asm_int; +unsigned int asm_int @ 23302; unsigned int asm_int_2; unsigned int seed; unsigned char half_life; @@ -111,7 +119,7 @@ unsigned char p_tx, p_ty; #endif signed int ptgmx, ptgmy; -const unsigned char *spacer = " "; +unsigned char *spacer = " "; unsigned char enit; @@ -173,7 +181,7 @@ unsigned char map_attr [150]; unsigned char map_buff [150] @ FREEPOOL; // Breakable walls/etc #ifdef BREAKABLE_WALLS - unsigned char brk_buff [150] @ 23297; + unsigned char brk_buff [150] @ 23296+16; #endif // posición del objeto (hotspot). Para no objeto, @@ -187,7 +195,7 @@ unsigned char hotspot_destroy; #ifndef MAX_FLAGS #define MAX_FLAGS 16 #endif -unsigned char flags[MAX_FLAGS]; +unsigned char flags[MAX_FLAGS]; // Globalized unsigned char o_pant; @@ -219,7 +227,7 @@ unsigned char maincounter; // Engine globals (for speed) & size! -unsigned char gpx, gpox, gpy, gpd, gpc, gpt; +unsigned char gpx, gpox, gpy, gpd, gpc; unsigned char gpxx, gpyy, gpcx, gpcy; unsigned char possee, hit_v, hit_h, hit, wall_h, wall_v; unsigned char gpen_x, gpen_y, gpen_cx, gpen_cy, gpaux; @@ -230,7 +238,7 @@ unsigned char *map_pointer; #ifdef PLAYER_CAN_FIRE unsigned char blx, bly; #endif -unsigned char rdx, rdy, rda, rdb, rdc, rdd, rdn; +unsigned char rdx, rdy, rda, rdb, rdc, rdd, rdn, rdt; // More stuff @@ -251,6 +259,7 @@ unsigned char objs_old, keys_old, life_old, killed_old; #ifdef COMPRESSED_LEVELS unsigned char *level_str = "LEVEL 0X"; + unsigned char silent_level = 0; #endif #ifdef GET_X_MORE @@ -271,12 +280,24 @@ unsigned char x0, y0, x1, y1; unsigned char ptx1, pty1, ptx2, pty2; unsigned char *_gp_gen; +#ifdef ENABLE_TILANIMS + unsigned char tait; + unsigned char max_tilanims; + unsigned char tacount; + unsigned char tilanims_xy [MAX_TILANIMS]; + unsigned char tilanims_ft [MAX_TILANIMS]; +#endif + +#if defined USE_AUTO_TILE_SHADOWS || defined USE_AUTO_SHADOWS || defined ENABLE_TILANIMS + unsigned char xx, yy; +#endif + #if defined USE_AUTO_TILE_SHADOWS || defined USE_AUTO_SHADOWS unsigned char c1, c2, c3, c4; unsigned char t1, t2, t3, t4; unsigned char nocast, _ta; - unsigned char xx, yy; #endif + #ifdef USE_AUTO_TILE_SHADOWS unsigned a1, a2, a3; unsigned char *gen_pt_alt; @@ -291,4 +312,7 @@ unsigned char *_gp_gen; #ifdef MODE_128K unsigned char song_playing = 0; + unsigned char player_on = 1; #endif + +unsigned char isrc; diff --git a/examples/dogmole/dev/dogmole.tap b/examples/dogmole/dev/dogmole.tap index 715dd57b..6e372be8 100644 Binary files a/examples/dogmole/dev/dogmole.tap and b/examples/dogmole/dev/dogmole.tap differ diff --git a/examples/dogmole/dev/engine.h b/examples/dogmole/dev/engine.h index e89eb1a9..bbbbfb9f 100644 --- a/examples/dogmole/dev/engine.h +++ b/examples/dogmole/dev/engine.h @@ -153,7 +153,7 @@ void espera_activa (int espera) { // Sonido #ifdef MODE_128K - wyz_play_sound (SFX_PUSH_BOX); + PLAY_SOUND (SFX_PUSH_BOX); #else beep_fx (2); #endif @@ -182,7 +182,7 @@ void espera_activa (int espera) { -- p_keys; #ifdef MODE_128K - wyz_play_sound (SFX_OPEN_LOCK); + PLAY_SOUND (SFX_OPEN_LOCK); #else beep_fx (8); #endif @@ -290,6 +290,7 @@ void draw_scr_background (void) { add hl, bc ld (hl), a + #ifdef PACKED_MAP_ALT_TILE ld a, (__t) or a jr nz, _draw_scr_packed_noalt @@ -305,10 +306,12 @@ void draw_scr_background (void) { jr _draw_scr_packed_noalt ._draw_scr_packed_alt_subst - ld a, 19 + ld a, PACKED_MAP_ALT_TILE ld (__t), a ._draw_scr_packed_noalt + #endif + ld hl, _map_buff add hl, bc @@ -326,15 +329,15 @@ void draw_scr_background (void) { #endasm #endif - draw_coloured_tile (); - - #if defined ENABLE_TILANIMS && defined UNPACKED_MAP - // Detect tilanims + #ifdef ENABLE_TILANIMS if (_t >= ENABLE_TILANIMS) { - add_tilanim ((_x - VIEWPORT_X) >> 1, (_y - VIEWPORT_Y) >> 1, _t); + _n = (((_x - VIEWPORT_X) << 3) & 0xf0) | ((_y - VIEWPORT_Y) >> 1); + tilanims_add (); } #endif - + + draw_coloured_tile (); + //_x += 2; if (_x == VIEWPORT_X + 30) { _x = VIEWPORT_X; _y += 2; } #asm ld a, (__x) @@ -355,34 +358,7 @@ void draw_scr_background (void) { #endif } -void draw_scr (void) { - is_rendering = 1; - - #ifdef ENABLE_TILANIMS - max_tilanims = 0; - #endif - - #ifdef ENABLE_FIRE_ZONE - f_zone_ac = 0; - #endif - - draw_scr_background (); - - // Object setup - - enems_load (); - - #ifdef ACTIVATE_SCRIPTING - #if defined LINE_OF_TEXT && !defined LINE_OF_TEXT_NO_AUTOERASE - _x = LINE_OF_TEXT_X; _y = LINE_OF_TEXT; _t = LINE_OF_TEXT_ATTR; _gp_gen = " "; print_str (); - #endif - // Ejecutamos los scripts de entrar en pantalla: - run_script (2 * MAP_W * MAP_H + 1); // ENTERING ANY - run_script (n_pant << 1); // ENTERING SCREEN n - #endif - - #include "my/ci/entering_screen.h" - +void draw_scr_hotspots_locks (void) { /* hotspot_y = 240; rdx = (hotspots [n_pant].xy >> 4); @@ -534,6 +510,14 @@ void draw_scr (void) { cp c jr nz, _open_locks_done + // Remove x=y=np=0 pseudobug in multilevel games + #ifdef COMPRESSED_LEVELS + ld a, b + or d + or e + jr z, _open_locks_done + #endif + ._open_locks_do ld a, d ld (__x), a @@ -573,6 +557,37 @@ void draw_scr (void) { jr nz, _open_locks_loop #endasm #endif +} + +void draw_scr (void) { + is_rendering = 1; + + #ifdef ENABLE_TILANIMS + tilanims_reset (); + #endif + + #ifdef ENABLE_FIRE_ZONE + f_zone_ac = 0; + #endif + + draw_scr_background (); + + // Object setup + + enems_load (); + + #ifdef ACTIVATE_SCRIPTING + #if defined LINE_OF_TEXT && !defined LINE_OF_TEXT_NO_AUTOERASE + _x = LINE_OF_TEXT_X; _y = LINE_OF_TEXT; _t = LINE_OF_TEXT_ATTR; _gp_gen = " "; print_str (); + #endif + // Ejecutamos los scripts de entrar en pantalla: + run_script (2 * MAP_W * MAP_H + 1); // ENTERING ANY + run_script (n_pant << 1); // ENTERING SCREEN n + #endif + + #include "my/ci/entering_screen.h" + + draw_scr_hotspots_locks (); #ifdef PLAYER_CAN_FIRE bullets_init (); @@ -609,7 +624,8 @@ void select_joyfunc (void) { } #ifdef MODE_128K - wyz_play_sound (SFX_START); + STOP_SOUND (); + PLAY_SOUND (SFX_START); sp_WaitForNoKey (); #endif } diff --git a/examples/dogmole/dev/engine/breakable.h b/examples/dogmole/dev/engine/breakable.h index 81e191c1..01e9423f 100644 --- a/examples/dogmole/dev/engine/breakable.h +++ b/examples/dogmole/dev/engine/breakable.h @@ -16,14 +16,14 @@ void break_wall (void) { } else { _n = _t = 0; update_tile (); #ifdef MODE_128K - gpix = SFX_BREAKABLE_BREAK + gpit = SFX_BREAKABLE_BREAK; #else gpit = 0; #endif #include "my/ci/on_wall_broken.h" } #ifdef MODE_128K - wyz_play_sound (gpit); + PLAY_SOUND (gpit); #else // Show what just happened before the sound interrupts the action sp_UpdateNow (); diff --git a/examples/dogmole/dev/engine/bullets.h b/examples/dogmole/dev/engine/bullets.h index 4dda4259..2278b516 100644 --- a/examples/dogmole/dev/engine/bullets.h +++ b/examples/dogmole/dev/engine/bullets.h @@ -54,10 +54,11 @@ void bullets_fire (void) { #ifdef PLAYER_CAN_FIRE_FLAG if (flags [PLAYER_CAN_FIRE_FLAG] == 0) return; #endif + #ifdef MAX_AMMO if (!p_ammo) return; - -- p_ammo; #endif + // Buscamos una bala libre for (b_it = 0; b_it < MAX_BULLETS; ++ b_it) { if (bullets_estado [b_it] == 0) { @@ -165,7 +166,7 @@ void bullets_fire (void) { #endif #ifdef MODE_128K - wyz_play_sound (SFX_SHOOT); + PLAY_SOUND (SFX_SHOOT); #else beep_fx (6); #endif @@ -180,8 +181,12 @@ void bullets_fire (void) { #include "my/ci/on_player_fires.h" - bullets_update (); + bullets_update (); + #ifdef MAX_AMMO + -- p_ammo; + #endif + break; } } diff --git a/examples/dogmole/dev/engine/c_levels.h b/examples/dogmole/dev/engine/c_levels.h index 0a76ee0c..cbbaf91a 100644 --- a/examples/dogmole/dev/engine/c_levels.h +++ b/examples/dogmole/dev/engine/c_levels.h @@ -10,12 +10,12 @@ void prepare_level (void) { #endif { n_pant = level_data.scr_ini; - gpx = level_data->ini_x << 4; p_x = gpx << 6; - gpy = level_data->ini_y << 4; p_y = gpy << 6; + gpx = level_data.ini_x << 4; p_x = gpx << 6; + gpy = level_data.ini_y << 4; p_y = gpy << 6; } #ifdef ACTIVATE_SCRIPTING - main_script_offset = levels [level]->script_offset; + main_script_offset = levels [level].script_offset; #endif #else unpack ((unsigned int) levels [level].c_map_bolts, (unsigned int) (mapa)); @@ -24,11 +24,11 @@ void prepare_level (void) { unpack ((unsigned int) levels [level].c_behs, (unsigned int) (behs)); #ifdef PER_LEVEL_SPRITESET - unpack ((unsigned int) levels [level].c_sprites, (unsigned int) (sprites)); + unpack ((unsigned int) levels [level].c_sprites, (unsigned int) (sprites + 16)); #endif - level_data->map_w = levels.map_w; - level_data->map_h = levels.map_h; + level_data.map_w = levels [level].map_w; + level_data.map_h = levels [level].map_h; #ifdef ACTIVATE_SCRIPTING if (script_result != 3) diff --git a/examples/dogmole/dev/engine/enem_mods/enem_type_pursuers.h b/examples/dogmole/dev/engine/enem_mods/enem_type_pursuers.h index 7cd62b19..601aa01f 100644 --- a/examples/dogmole/dev/engine/enem_mods/enem_type_pursuers.h +++ b/examples/dogmole/dev/engine/enem_mods/enem_type_pursuers.h @@ -9,8 +9,8 @@ _en_x = _en_x1; _en_y = _en_y1; en_an_alive [enit] = 1; - en_an_rawv [enit] = 1 << (rand () % 5); - if (en_an_rawv [enit] > 4) en_an_rawv [enit] = 2; + en_an_rawv [enit] = 1 << (rand () & 3); + if (en_an_rawv [enit] > PURSUERS_MAX_V) en_an_rawv [enit] = 2; en_an_dead_row [enit] = 11 + (rand () & 7); #if defined(PLAYER_STEPS_ON_ENEMIES) || defined(PLAYER_CAN_FIRE) _en_life = ENEMIES_LIFE_GAUGE; diff --git a/examples/dogmole/dev/engine/enem_mods/enem_type_pursuers_asm.h b/examples/dogmole/dev/engine/enem_mods/enem_type_pursuers_asm.h index 6980b4b1..6ce2cc20 100644 --- a/examples/dogmole/dev/engine/enem_mods/enem_type_pursuers_asm.h +++ b/examples/dogmole/dev/engine/enem_mods/enem_type_pursuers_asm.h @@ -34,19 +34,21 @@ ld a, 1 ld (hl), a - // en_an_rawv [enit] = 1 << (rand () % 5); + // en_an_rawv [enit] = 1 << (rand () & 3); push bc call _rand // rand -> L - ld de, 5 - ex de, hl - call l_div // l_div :: DE / HL -> HL = cociente; DE = resto - ex de, hl // HL = resto + + ld a, l + and 3 + ld l, a + ld h, 0 + ld de, 1 call l_asl // l_asl :: DE << HL -> HL ld a, l pop bc - cp 5 + cp PURSUERS_MAX_V+1 jr c, _eij_rawv_set ld a, 2 diff --git a/examples/dogmole/dev/engine/enengine.h b/examples/dogmole/dev/engine/enengine.h index 17dddc2c..4acb013d 100644 --- a/examples/dogmole/dev/engine/enengine.h +++ b/examples/dogmole/dev/engine/enengine.h @@ -14,8 +14,8 @@ #if defined(PLAYER_STEPS_ON_ENEMIES) || defined (PLAYER_CAN_FIRE) void enems_init (void) { enit = 0; - while (enit < MAP_W * MAP_H * 3) { - malotes [enit].t = malotes [enit].t & 15; + while (enit < MAP_W * MAP_H * MAX_ENEMS) { + malotes [enit].t = malotes [enit].t & 0xEF; // Clear bit 4 #ifdef PLAYER_CAN_FIRE malotes [enit].life = ENEMIES_LIFE_GAUGE; #endif @@ -121,7 +121,7 @@ void enems_draw_current (void) { void enems_load (void) { // Movemos y cambiamos a los enemigos según el tipo que tengan - enoffs = n_pant * 3; + enoffs = n_pant * MAX_ENEMS; for (enit = 0; enit < MAX_ENEMS; ++ enit) { en_an_frame [enit] = 0; @@ -141,6 +141,10 @@ void enems_load (void) { #endif #endif + #include "my/ci/enems_custom_respawn.h" + + en_an_next_frame [enit] = sprite_18_a; + switch (malotes [enoffsmasi].t & 0x1f) { case 1: case 2: @@ -184,13 +188,8 @@ void enems_load (void) { #endif #include "my/ci/enems_load.h" - - default: - en_an_next_frame [enit] = sprite_18_a; } - malotes [enoffsmasi].t &= 0x1f; - #include "my/ci/enems_extra_mods.h" } } @@ -227,7 +226,7 @@ void enems_move (void) { ld hl, (_enoffsmasi) ld h, 0 - #ifdef PLAYER_CAN_FIRE + #if defined PLAYER_CAN_FIRE || defined COMPRESSED_LEVELS add hl, hl // x2 ld d, h ld e, l // DE = x2 @@ -284,6 +283,8 @@ void enems_move (void) { ld a, (hl) ld (__en_t), a + and 0x1f + ld (_rdt), a #ifdef PLAYER_CAN_FIRE inc hl @@ -316,7 +317,7 @@ void enems_move (void) { #endif #endif - switch (_en_t) { + switch (rdt) { case 1: case 2: case 3: @@ -326,7 +327,7 @@ void enems_move (void) { #endif #include "engine/enem_mods/enem_type_lineal.h" #ifdef ENABLE_ORTHOSHOOTERS - if (_en_t == 5) { + if (rdt == 5) { #include "engine/enem_mods/enem_type_orthoshooters.h" } #endif @@ -443,13 +444,13 @@ void enems_move (void) { // Step over enemy #ifdef PLAYER_CAN_STEP_ON_FLAG if (flags [PLAYER_CAN_STEP_ON_FLAG] != 0 && - gpy < _en_y - 2 && p_vy >= 0 && _en_t >= PLAYER_MIN_KILLABLE) + gpy < _en_y - 2 && p_vy >= 0 && rdt >= PLAYER_MIN_KILLABLE) #else - if (gpy < _en_y - 2 && p_vy >= 0 && _en_t >= PLAYER_MIN_KILLABLE) + if (gpy < _en_y - 2 && p_vy >= 0 && rdt >= PLAYER_MIN_KILLABLE) #endif { #ifdef MODE_128K - wyz_play_sound (SFX_KILL_ENEMY_STEP); + PLAY_SOUND (SFX_KILL_ENEMY_STEP); en_an_state [enit] = GENERAL_DYING; en_an_count [enit] = 12; en_an_next_frame [enit] = sprite_17_a; @@ -519,7 +520,7 @@ void enems_move (void) { #ifdef PLAYER_CAN_FIRE // Collide with bullets #ifdef FIRE_MIN_KILLABLE - if (_en_t >= FIRE_MIN_KILLABLE) + if (rdt >= FIRE_MIN_KILLABLE) #endif { for (gpjt = 0; gpjt < MAX_BULLETS; gpjt ++) { @@ -548,7 +549,7 @@ void enems_move (void) { #ifdef MODE_128K en_an_state [enit] = GENERAL_DYING; en_an_count [enit] = 12; - wyz_play_sound (SFX_KILL_ENEMY_SHOOT); + PLAY_SOUND (SFX_KILL_ENEMY_SHOOT); #else beep_fx (5); en_an_next_frame [enit] = sprite_18_a; @@ -562,7 +563,7 @@ void enems_move (void) { } #ifdef MODE_128K - wyz_play_sound (SFX_HIT_ENEMY); + PLAY_SOUND (SFX_HIT_ENEMY); #else beep_fx (1); #endif diff --git a/examples/dogmole/dev/engine/hotspots.h b/examples/dogmole/dev/engine/hotspots.h index 10f9978c..3a1b3223 100644 --- a/examples/dogmole/dev/engine/hotspots.h +++ b/examples/dogmole/dev/engine/hotspots.h @@ -25,13 +25,13 @@ void hotspots_do (void) { if (p_objs == 0) { p_objs ++; #ifdef MODE_128K - wyz_play_sound (SFX_ONE_OBJECT_GET); + PLAY_SOUND (SFX_ONE_OBJECT_GET); #else beep_fx (9); #endif } else { #ifdef MODE_128K - wyz_play_sound (SFX_ONE_OBJECT_WRONG); + PLAY_SOUND (SFX_ONE_OBJECT_WRONG); #else beep_fx (4); #endif @@ -45,7 +45,7 @@ void hotspots_do (void) { #endif #ifdef MODE_128K - wyz_play_sound (SFX_OBJECT_GET); + PLAY_SOUND (SFX_OBJECT_GET); #else beep_fx (9); #endif @@ -70,7 +70,7 @@ void hotspots_do (void) { case 2: p_keys ++; #ifdef MODE_128K - wyz_play_sound (SFX_KEY_GET); + PLAY_SOUND (SFX_KEY_GET); #else beep_fx (7); #endif @@ -83,7 +83,7 @@ void hotspots_do (void) { if (p_life > PLAYER_LIFE) p_life = PLAYER_LIFE; #ifdef MODE_128K - wyz_play_sound (SFX_REFILL_GET); + PLAY_SOUND (SFX_REFILL_GET); #else beep_fx (8); #endif @@ -97,7 +97,7 @@ void hotspots_do (void) { else p_ammo = MAX_AMMO; #ifdef MODE_128K - wyz_play_sound (SFX_REFILL_GET); + PLAY_SOUND (SFX_REFILL_GET); #else beep_fx (9); #endif @@ -111,7 +111,7 @@ void hotspots_do (void) { else timer_t = 99; #ifdef MODE_128K - wyz_play_sound (SFX_REFILL_GET); + PLAY_SOUND (SFX_REFILL_GET); #else beep_fx (7); #endif @@ -122,7 +122,7 @@ void hotspots_do (void) { case 6: mem_save (); #ifdef MODE_128K - wyz_play_sound (SFX_START); + PLAY_SOUND (SFX_START); #else beep_fx (7); #endif diff --git a/examples/dogmole/dev/engine/isr.h b/examples/dogmole/dev/engine/isr.h new file mode 100644 index 00000000..76b5bf4a --- /dev/null +++ b/examples/dogmole/dev/engine/isr.h @@ -0,0 +1,15 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// Very simple ISR which counts frames. + +#asm + defw 0 // 2 bytes libres +#endasm + +void ISR (void) { + #asm + ld hl, _isrc + inc (hl) + #endasm +} diff --git a/examples/dogmole/dev/engine/player.h b/examples/dogmole/dev/engine/player.h index 7256df57..59844d68 100644 --- a/examples/dogmole/dev/engine/player.h +++ b/examples/dogmole/dev/engine/player.h @@ -28,17 +28,20 @@ void player_init (void) { #if !defined(COMPRESSED_LEVELS) || defined(REFILL_ME) p_life = PLAYER_LIFE; #endif - p_objs = 0; - p_keys = 0; - p_killed = 0; p_disparando = 0; - #ifdef MAX_AMMO - #ifdef INITIAL_AMMO - p_ammo = INITIAL_AMMO; - #else - p_ammo = MAX_AMMO; + + #ifndef NO_RESET_STATS + p_objs = 0; + p_keys = 0; + p_killed = 0; + #ifdef MAX_AMMO + #ifdef INITIAL_AMMO + p_ammo = INITIAL_AMMO; + #else + p_ammo = MAX_AMMO; + #endif #endif - #endif + #endif #ifdef TIMER_ENABLE timer_count = 0; @@ -283,6 +286,7 @@ unsigned char player_move (void) { // Collision, may set possee, hit_v + // Velocity positive (going downwards) player_calc_bounding_box (); hit_v = 0; @@ -400,7 +404,7 @@ unsigned char player_move (void) { p_saltando = 1; p_cont_salto = 0; #ifdef MODE_128K - wyz_play_sound (SFX_JUMP); + PLAY_SOUND (SFX_JUMP); #else beep_fx (3); #endif @@ -426,7 +430,7 @@ unsigned char player_move (void) { p_saltando = 1; p_cont_salto = 0; #ifdef MODE_128K - wyz_play_sound (SFX_JUMP); + PLAY_SOUND (SFX_JUMP); #else beep_fx (3); #endif @@ -446,43 +450,47 @@ unsigned char player_move (void) { // MOVEMENT IN THE HORIZONTAL AXIS // *************************************************************************** - if ( ! ((pad0 & sp_LEFT) == 0 || (pad0 & sp_RIGHT) == 0)) { - #ifdef PLAYER_GENITAL - p_facing_h = 0xff; - #endif - if (p_vx > 0) { - p_vx -= PLAYER_RX; - if (p_vx < 0) p_vx = 0; - } else if (p_vx < 0) { - p_vx += PLAYER_RX; - if (p_vx > 0) p_vx = 0; + #ifndef PLAYER_DISABLE_DEFAULT_HENG + if ( ! ((pad0 & sp_LEFT) == 0 || (pad0 & sp_RIGHT) == 0)) { + #ifdef PLAYER_GENITAL + p_facing_h = 0xff; + #endif + if (p_vx > 0) { + p_vx -= PLAYER_RX; + if (p_vx < 0) p_vx = 0; + } else if (p_vx < 0) { + p_vx += PLAYER_RX; + if (p_vx > 0) p_vx = 0; + } + wall_h = 0; } - wall_h = 0; - } - if ((pad0 & sp_LEFT) == 0) { - #ifdef PLAYER_GENITAL - p_facing_h = FACING_LEFT; - #endif - if (p_vx > -PLAYER_MAX_VX) { - #ifndef PLAYER_GENITAL - p_facing = 0; + if ((pad0 & sp_LEFT) == 0) { + #ifdef PLAYER_GENITAL + p_facing_h = FACING_LEFT; #endif - p_vx -= PLAYER_AX; + if (p_vx > -PLAYER_MAX_VX) { + #ifndef PLAYER_GENITAL + p_facing = 0; + #endif + p_vx -= PLAYER_AX; + } } - } - if ((pad0 & sp_RIGHT) == 0) { - #ifdef PLAYER_GENITAL - p_facing_h = FACING_RIGHT; - #endif - if (p_vx < PLAYER_MAX_VX) { - p_vx += PLAYER_AX; - #ifndef PLAYER_GENITAL - p_facing = 1; + if ((pad0 & sp_RIGHT) == 0) { + #ifdef PLAYER_GENITAL + p_facing_h = FACING_RIGHT; #endif + if (p_vx < PLAYER_MAX_VX) { + p_vx += PLAYER_AX; + #ifndef PLAYER_GENITAL + p_facing = 1; + #endif + } } - } + #endif + + #include "my/ci/custom_heng.h" p_x = p_x + p_vx; #ifndef PLAYER_GENITAL @@ -606,7 +614,7 @@ unsigned char player_move (void) { #elif defined (BOUNDING_BOX_8_CENTERED) cy1 = (gpy + 3) >> 4; #else - cy1 = gpy >> 3; + cy1 = (gpy - 1) >> 3; #endif if (attr (cx1, cy1) == 10) { @@ -636,7 +644,7 @@ unsigned char player_move (void) { #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) cx1 = (gpx + 3) >> 4; #else - cx1 = gpx >> 4; + cx1 = (gpx - 1) >> 4; #endif if (attr (cx1, cy1) == 10) { @@ -717,19 +725,19 @@ unsigned char player_move (void) { } } - p_next_frame = player_cells [p_facing + p_frame]; + p_next_frame = (unsigned char *) (player_cells [p_facing + p_frame]); #elif defined PLAYER_BOOTEE gpit = p_facing << 2; if (p_vy == 0) { - p_next_frame = player_cells [gpit]; + p_next_frame = (unsigned char *) (player_cells [gpit]); } else if (p_vy < 0) { - p_next_frame = player_cells [gpit + 1]; + p_next_frame = (unsigned char *) (player_cells [gpit + 1]); } else { - p_next_frame = player_cells [gpit + 2]; + p_next_frame = (unsigned char *) (player_cells [gpit + 2]); } #else if (!possee && !p_gotten) { - p_next_frame = player_cells [8 + p_facing]; + p_next_frame = (unsigned char *) (player_cells [8 + p_facing]); } else { gpit = p_facing << 2; if (p_vx == 0) { @@ -737,7 +745,7 @@ unsigned char player_move (void) { } else { rda = ((gpx + 4) >> 3) & 3; } - p_next_frame = player_cells [gpit + rda]; + p_next_frame = (unsigned char *) (player_cells [gpit + rda]); } #endif } @@ -752,7 +760,7 @@ void player_kill (unsigned char sound) { player_deplete (); #ifdef MODE_128K - wyz_play_sound (sound); + PLAY_SOUND (sound); #else beep_fx (sound); #endif diff --git a/examples/dogmole/dev/engine/player_wip.h b/examples/dogmole/dev/engine/player_wip.h new file mode 100644 index 00000000..815761a3 --- /dev/null +++ b/examples/dogmole/dev/engine/player_wip.h @@ -0,0 +1,884 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// player.h + +void player_init (void) { + // Inicializa player con los valores iniciales + // (de ahí lo de inicializar). + + #ifndef COMPRESSED_LEVELS + gpx = PLAYER_INI_X << 4; p_x = gpx << 6; + gpy = PLAYER_INI_Y << 4; p_y = gpy << 6; + #endif + p_vy = 0; + p_vx = 0; + p_cont_salto = 1; + p_saltando = 0; + p_frame = 0; + p_subframe = 0; + #ifdef PLAYER_GENITAL + p_facing = FACING_DOWN; + p_facing_v = p_facing_h = 0xff; + #else + p_facing = 1; + #endif + p_estado = EST_NORMAL; + p_ct_estado = 0; + #if !defined(COMPRESSED_LEVELS) || defined(REFILL_ME) + p_life = PLAYER_LIFE; + #endif + p_objs = 0; + p_keys = 0; + p_killed = 0; + p_disparando = 0; + #ifdef MAX_AMMO + #ifdef INITIAL_AMMO + p_ammo = INITIAL_AMMO; + #else + p_ammo = MAX_AMMO; + #endif + #endif + + #ifdef TIMER_ENABLE + timer_count = 0; + timer_zero = 0; + #ifdef TIMER_LAPSE + timer_frames = TIMER_LAPSE; + #endif + #ifdef TIMER_INITIAL + timer_t = TIMER_INITIAL; + #endif + #ifdef TIMER_START + timer_on = 1; + #else + timer_on = 0; + #endif + #endif +} + +void player_calc_bounding_box (void) { + #if defined (BOUNDING_BOX_8_BOTTOM) + #asm + ld a, (_gpx) + add 4 + srl a + srl a + srl a + srl a + ld (_ptx1), a + ld a, (_gpx) + add 11 + srl a + srl a + srl a + srl a + ld (_ptx2), a + ld a, (_gpy) + add 8 + srl a + srl a + srl a + srl a + ld (_pty1), a + ld a, (_gpy) + add 15 + srl a + srl a + srl a + srl a + ld (_pty2), a + #endasm + #elif defined (BOUNDING_BOX_8_CENTERED) + #asm + ld a, (_gpx) + add 4 + srl a + srl a + srl a + srl a + ld (_ptx1), a + ld a, (_gpx) + add 11 + srl a + srl a + srl a + srl a + ld (_ptx2), a + ld a, (_gpy) + add 4 + srl a + srl a + srl a + srl a + ld (_pty1), a + ld a, (_gpy) + add 11 + srl a + srl a + srl a + srl a + ld (_pty2), a + #endasm + #else + #asm + ld a, (_gpx) + srl a + srl a + srl a + srl a + ld (_ptx1), a + ld a, (_gpx) + add 15 + srl a + srl a + srl a + srl a + ld (_ptx2), a + ld a, (_gpy) + srl a + srl a + srl a + srl a + ld (_pty1), a + ld a, (_gpy) + add 15 + srl a + srl a + srl a + srl a + ld (_pty2), a + #endasm + #endif +} + +unsigned char player_move (void) { + + // *************************************************************************** + // MOVEMENT IN THE VERTICAL AXIS + // *************************************************************************** + + #if !defined PLAYER_GENITAL || defined VENG_SELECTOR + + #if !defined PLAYER_DISABLE_GRAVITY + #if defined VENG_SELECTOR && defined PLAYER_VKEYS + if (veng_selector != VENG_KEYS) + #endif + { + // Do gravity + + #asm + ; Signed comparisons are hard + ; p_vy <= PLAYER_MAX_VY_CAYENDO - PLAYER_G + + ; We are going to take a shortcut. + ; If p_vy < 0, just add PLAYER_G. + ; If p_vy > 0, we can use unsigned comparition anyway. + + ld hl, (_p_vy) + bit 7, h + jr nz, _player_gravity_add ; < 0 + + ld de, PLAYER_MAX_VY_CAYENDO - PLAYER_G + or a + push hl + sbc hl, de + pop hl + jr nc, _player_gravity_maximum + + ._player_gravity_add + ld de, PLAYER_G + add hl, de + jr _player_gravity_vy_set + + ._player_gravity_maximum + ld hl, PLAYER_MAX_VY_CAYENDO + + ._player_gravity_vy_set + ld (_p_vy), hl + + ._player_gravity_done + + #ifdef PLAYER_CUMULATIVE_JUMP + ld a, (_p_jmp_on) + or a + jr nz, _player_gravity_p_gotten_done + #endif + + ld a, (_p_gotten) + or a + jr z, _player_gravity_p_gotten_done + + xor a + ld (_p_vy), a + + ._player_gravity_p_gotten_done + #endasm + } + #endif + #endif + + #if defined PLAYER_GENITAL || (defined VENG_SELECTOR && defined PLAYER_VKEYS) + + #if defined (VENG_SELECTOR) + if (veng_selector == VENG_KEYS ) + #endif + { + // Pad do + + if ( ! ((pad0 & sp_UP) == 0 || (pad0 & sp_DOWN) == 0)) { + p_facing_v = 0xff; + wall_v = 0; + if (p_vy > 0) { + p_vy -= PLAYER_RX; + if (p_vy < 0) p_vy = 0; + } else if (p_vy < 0) { + p_vy += PLAYER_RX; + if (p_vy > 0) p_vy = 0; + } + } + + if ((pad0 & sp_UP) == 0) { + p_facing_v = FACING_UP; + if (p_vy > -PLAYER_MAX_VX) p_vy -= PLAYER_AX; + } + + if ((pad0 & sp_DOWN) == 0) { + p_facing_v = FACING_DOWN; + if (p_vy < PLAYER_MAX_VX) p_vy += PLAYER_AX; + } + } + #endif + + #ifdef PLAYER_HAS_JETPAC + #ifdef VENG_SELECTOR + if (veng_selector == VENG_JETPAC) + #endif + { + if ((pad0 & sp_UP) == 0) { + p_vy -= PLAYER_INCR_JETPAC; + if (p_vy < -PLAYER_MAX_VY_JETPAC) p_vy = -PLAYER_MAX_VY_JETPAC; + + #include "my/ci/on_jetpac_boost.h" + + p_jetpac_on = 1; + } else p_jetpac_on = 0; + } + #endif + + #include "my/ci/custom_veng.h" + + p_y += p_vy; + + #if !defined (PLAYER_GENITAL) + if (p_gotten) p_y += ptgmy; + #endif + + // Safe + + if (p_y < 0) p_y = 0; + if (p_y > 9216) p_y = 9216; + + gpy = p_y >> 6; + + // Collision, may set possee, hit_v + + #asm + call _player_calc_bounding_box + + xor a + ld (_hit_v), a + + ld a, (_ptx1) + ld (_cx1), a + ld a, (_ptx2) + ld (_cx2), a + + // Calculate vertical velocity + + ld a, (_p_vy) + #if !defined (PLAYER_GENITAL) + ld c, a + ld a, (_ptgmy) + add c + #endif + + // Skip if not moving in the vertical axis + + or a + jp z, _va_collision_done + + // Check sign + + bit 7, a + jr z, _va_collision_vy_positive + + ._va_collision_vy_negative + + // Velocity negative (going upwards) + + ld a, (_pty1) + ld (_cy1), a + ld (_cy2), a + + call _cm_two_points + + // if ((at1 & 8) || (at2 & 8)) { + ld a, (_at1) + and 8 + jr nz, _va_col_vy_neg_do + + ld a, (_at2) + and 8 + jr z, _va_collision_checkevil + + ._va_col_vy_neg_do + + #ifdef PLAYER_BOUNCE_WITH_WALLS + ld a, (_p_vy) + sra a + neg a + #else + xor a + #endif + ld (_p_vy), a + + ld a, (_pty1) + inc a + sla a + sla a + sla a + sla a + + #if defined (BOUNDING_BOX_8_BOTTOM) + // gpy = ((pty1 + 1) << 4) - 8; + sub 8 + #elif defined (BOUNDING_BOX_8_CENTERED) + // gpy = ((pty1 + 1) << 4) - 4; + sub 4 + #elif defined (BOUNDING_BOX_TINY_BOTTOM) + // gpy = ((pty1 + 1) << 4) - 14; + sub 14 + #else + // gpy = ((pty1 + 1) << 4); + #endif + + ld (_gpy), a + + // p_y = gpy << FIXBITS; 16 bits shift + ld d, 0 + ld e, a + ld l, FIXBITS + call l_asl + ld (_p_y), hl + + #if defined PLAYER_GENITAL || defined LOCKS_CHECK_VERTICAL + ld a, WTOP + ld (_wall_v), a + #endif + + jr _va_collision_checkevil + + ._va_collision_vy_positive + + // Velocity positive (going downwards) + ld a, (_pty2) + ld (_cy1), a + ld (_cy2), a + + call _cm_two_points + + #ifdef PLAYER_GENITAL + // if ((at1 & 8) || (at2 & 8)) { + ld a, (_at1) + and 8 + jr nz, _va_col_vy_pos_do + + ld a, (_at2) + and 8 + jr z, _va_collision_checkevil + #else + // if ((at1 & 8) || + ld a, (_at1) + and 8 + jr nz, _va_col_vy_pos_do + + // (at2 & 8) || + ld a, (_at2) + and 8 + jr nz, _va_col_vy_pos_do + + // (((gpy - 1) & 15) < 8 && + ld a, (_gpy) + dec a + and 15 + cp 8 + jr nc, _va_collision_checkevil + + // ((at1 & 4) || (at2 & 4)))) + ld a, (_at1) + and 4 + jr nz, _va_col_vy_pos_do + + ld a, (_at2) + and 4 + jr z, _va_collision_checkevil + #endif + ._va_col_vy_pos_do + + #ifdef PLAYER_BOUNCE_WITH_WALLS + ld a, (_p_vy) + sra a + neg a + #else + xor a + #endif + ld (_p_vy), a + + ld a, (_pty2) + dec a + sla a + sla a + sla a + sla a + + #ifdef BOUNDING_BOX_8_CENTERED + add 4 + #endif + + ld (_gpy), a + + // p_y = gpy << FIXBITS; 16 bits shift + ld d, 0 + ld e, a + ld l, FIXBITS + call l_asl + ld (_p_y), hl + + #if defined PLAYER_GENITAL || defined LOCKS_CHECK_VERTICAL + ld a, WBOTTOM + ld (_wall_v), a + #endif + + jr _va_collision_done + + ._va_collision_checkevil + + #ifndef DEACTIVATE_EVIL_TILE + #endasm + hit_v = ((at1 & 1) || (at2 & 1)); + #asm + #endif + + ._va_collision_done + #endasm + + gpxx = gpx >> 4; + gpyy = gpy >> 4; + + #ifndef PLAYER_GENITAL + cy1 = cy2 = (gpy + 16) >> 4; + cx1 = ptx1; cx2 = ptx2; + cm_two_points (); + possee = ((at1 & 12) || (at2 & 12)) && (gpy & 15) < 8; + #endif + + // Jump + + #ifdef PLAYER_HAS_JUMP + #ifdef VENG_SELECTOR + if (veng_selector == VENG_JUMP) + #endif + { + #if defined (PLAYER_CAN_FIRE) && !defined (USE_TWO_BUTTONS) + rda = (pad0 & sp_UP) == 0; + #elif defined (PLAYER_CAN_FIRE) && defined (USE_TWO_BUTTONS) + rda = isJoy ? ((pad0 & sp_UP) == 0) : (sp_KeyPressed (key_jump)); + #else + rda = (pad0 & sp_FIRE) == 0; + #endif + + if (rda) { + if (p_saltando == 0) { + if (possee || p_gotten || hit_v) { + p_saltando = 1; + p_cont_salto = 0; + #ifdef MODE_128K + PLAY_SOUND (SFX_JUMP); + #else + beep_fx (3); + #endif + } + } else { + p_vy -= (PLAYER_VY_INICIAL_SALTO + PLAYER_INCR_SALTO - (p_cont_salto >> 1)); + if (p_vy < -PLAYER_MAX_VY_SALTANDO) p_vy = -PLAYER_MAX_VY_SALTANDO; + ++ p_cont_salto; + if (p_cont_salto == 9) p_saltando = 0; + } + } else p_saltando = 0; + } + #endif + + // Bootee engine + + #ifdef PLAYER_BOOTEE + #ifdef VENG_SELECTOR + if (veng_selector == VENG_BOOTEE) + #endif + { + if ( p_saltando == 0 && (possee || p_gotten || hit_v) ) { + p_saltando = 1; + p_cont_salto = 0; + #ifdef MODE_128K + PLAY_SOUND (SFX_JUMP); + #else + beep_fx (3); + #endif + } + + if (p_saltando ) { + p_vy -= (PLAYER_VY_INICIAL_SALTO + PLAYER_INCR_SALTO - (p_cont_salto>>1)); + if (p_vy < -PLAYER_MAX_VY_SALTANDO) p_vy = -PLAYER_MAX_VY_SALTANDO; + ++ p_cont_salto; + if (p_cont_salto == 8) + p_saltando = 0; + } + } + #endif + + // *************************************************************************** + // MOVEMENT IN THE HORIZONTAL AXIS + // *************************************************************************** + + #ifndef PLAYER_DISABLE_DEFAULT_HENG + if ( ! ((pad0 & sp_LEFT) == 0 || (pad0 & sp_RIGHT) == 0)) { + #ifdef PLAYER_GENITAL + p_facing_h = 0xff; + #endif + if (p_vx > 0) { + p_vx -= PLAYER_RX; + if (p_vx < 0) p_vx = 0; + } else if (p_vx < 0) { + p_vx += PLAYER_RX; + if (p_vx > 0) p_vx = 0; + } + wall_h = 0; + } + + if ((pad0 & sp_LEFT) == 0) { + #ifdef PLAYER_GENITAL + p_facing_h = FACING_LEFT; + #endif + if (p_vx > -PLAYER_MAX_VX) { + #ifndef PLAYER_GENITAL + p_facing = 0; + #endif + p_vx -= PLAYER_AX; + } + } + + if ((pad0 & sp_RIGHT) == 0) { + #ifdef PLAYER_GENITAL + p_facing_h = FACING_RIGHT; + #endif + if (p_vx < PLAYER_MAX_VX) { + p_vx += PLAYER_AX; + #ifndef PLAYER_GENITAL + p_facing = 1; + #endif + } + } + #endif + + #include "my/ci/custom_heng.h" + + p_x = p_x + p_vx; + #ifndef PLAYER_GENITAL + p_x += ptgmx; + #endif + + // Safe + + if (p_x < 0) p_x = 0; + if (p_x > 14336) p_x = 14336; + + gpox = gpx; + gpx = p_x >> 6; + + // Collision. May set hit_h + player_calc_bounding_box (); + + hit_h = 0; + cy1 = pty1; cy2 = pty2; + + #if defined (PLAYER_GENITAL) + if (p_vx < 0) + #else + if (p_vx + ptgmx < 0) + #endif + { + cx1 = cx2 = ptx1; + cm_two_points (); + + if ((at1 & 8) || (at2 & 8)) { + #include "my/ci/bg_collision/obstacle_left.h" + + #ifdef PLAYER_BOUNCE_WITH_WALLS + p_vx = -(p_vx / 2); + #else + p_vx = 0; + #endif + + #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) || defined (BOUNDING_BOX_TINY_BOTTOM) + gpx = ((ptx1 + 1) << 4) - 4; + #else + gpx = ((ptx1 + 1) << 4); + #endif + + p_x = gpx << 6; + wall_h = WLEFT; + } + #ifndef DEACTIVATE_EVIL_TILE + else hit_h = ((at1 & 1) || (at2 & 1)); + #endif + + } + + #if defined (PLAYER_GENITAL) + if (p_vx > 0) + #else + if (p_vx + ptgmx > 0) + #endif + { + cx1 = cx2 = ptx2; + cm_two_points (); + + if ((at1 & 8) || (at2 & 8)) { + #include "my/ci/bg_collision/obstacle_right.h" + + #ifdef PLAYER_BOUNCE_WITH_WALLS + p_vx = -(p_vx / 2); + #else + p_vx = 0; + #endif + + #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) || defined (BOUNDING_BOX_TINY_BOTTOM) + gpx = (ptx1 << 4) + 4; + #else + gpx = (ptx1 << 4); + #endif + + p_x = gpx << 6; + wall_h = WRIGHT; + } + #ifndef DEACTIVATE_EVIL_TILE + else hit_h = ((at1 & 1) || (at2 & 1)); + #endif + + } + + // Priority to decide facing + + #ifdef PLAYER_GENITAL + #ifdef TOP_OVER_SIDE + if (p_facing_v != 0xff) { + p_facing = p_facing_v; + } else if (p_facing_h != 0xff) { + p_facing = p_facing_h; + } + #else + if (p_facing_h != 0xff) { + p_facing = p_facing_h; + } else if (p_facing_v != 0xff) { + p_facing = p_facing_v; + } + #endif + #endif + + cx1 = p_tx = (gpx + 8) >> 4; + cy1 = p_ty = (gpy + 8) >> 4; + + rdb = attr (cx1, cy1); + + // Special tiles + if (rdb & 128) { + #include "my/ci/on_special_tile.h" + } + + #if defined (PLAYER_PUSH_BOXES) || !defined (DEACTIVATE_KEYS) + #if defined PLAYER_GENITAL || defined LOCKS_CHECK_VERTICAL + if (wall_v == WTOP) { + // interact up + #if defined (BOUNDING_BOX_8_BOTTOM) + cy1 = (gpy + 7) >> 4; + #elif defined (BOUNDING_BOX_8_CENTERED) + cy1 = (gpy + 3) >> 4; + #else + cy1 = (gpy - 1) >> 3; + #endif + + if (attr (cx1, cy1) == 10) { + x0 = x1 = cx1; y0 = cy1; y1 = cy1 - 1; + process_tile (); + } + + } else if (wall_v == WBOTTOM) { + // interact down + #if defined (BOUNDING_BOX_8_BOTTOM) + cy1 = (gpy + 16) >> 4; + #elif defined (BOUNDING_BOX_8_CENTERED) + cy1 = (gpy + 12) >> 4; + #else + cy1 = (gpy + 16) >> 3; + #endif + + if (attr (cx1, cy1) == 10) { + x0 = x1 = cx1; y0 = cy1; y1 = cy1 + 1; + process_tile (); + } + } else + #endif + + if (wall_h == WLEFT) { + // interact left + #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) + cx1 = (gpx + 3) >> 4; + #else + cx1 = (gpx - 1) >> 4; + #endif + + if (attr (cx1, cy1) == 10) { + y0 = y1 = cy1; x0 = cx1; x1 = cx1 - 1; + process_tile (); + } + } else if (wall_h == WRIGHT) { + // interact right + #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) + cx1 = (gpx + 12) >> 4; + #else + cx1 = (gpx + 16) >> 4; + #endif + if (attr (cx1, cy1) == 10) { + y0 = y1 = cy1; x0 = cx1; x1 = cx1 + 1; + process_tile (); + } + } + #endif + + #ifdef PLAYER_CAN_FIRE + // Disparos + if ((pad0 & sp_FIRE) == 0 && p_disparando == 0) { + p_disparando = 1; + #ifdef FIRE_TO_PUSH + //if (pushed_any == 0) + #endif + bullets_fire (); + #ifdef FIRE_TO_PUSH + //else pushed_any = 0; + #endif + } + + if ((pad0 & sp_FIRE)) + p_disparando = 0; + + #endif + + #ifndef DEACTIVATE_EVIL_TILE + // Tiles que te matan. + // hit_v tiene preferencia sobre hit_h + hit = 0; + if (hit_v) { + hit = 1; + p_vy = addsign (-p_vy, PLAYER_MAX_VX); + } else if (hit_h) { + hit = 1; + p_vx = addsign (-p_vx, PLAYER_MAX_VX); + } + + if (hit) { + #ifdef PLAYER_FLICKERS + if (p_estado == EST_NORMAL) + #endif + { + #ifdef MODE_128K + p_killme = SFX_SPIKES; + #else + p_killme = 4; + #endif + } + } + #endif + + // Select animation frame + + #ifdef PLAYER_CUSTOM_ANIMATION + #include "my/custom_animation.h" + #elif defined PLAYER_GENITAL + if (p_vx || p_vy) { + ++ p_subframe; + if (p_subframe == 4) { + p_subframe = 0; + p_frame = !p_frame; + #ifdef PLAYER_STEP_SOUND + step (); + #endif + } + } + + p_next_frame = player_cells [p_facing + p_frame]; + #elif defined PLAYER_BOOTEE + gpit = p_facing << 2; + if (p_vy == 0) { + p_next_frame = player_cells [gpit]; + } else if (p_vy < 0) { + p_next_frame = player_cells [gpit + 1]; + } else { + p_next_frame = player_cells [gpit + 2]; + } + #else + if (!possee && !p_gotten) { + p_next_frame = player_cells [8 + p_facing]; + } else { + gpit = p_facing << 2; + if (p_vx == 0) { + rda = 1; + } else { + rda = ((gpx + 4) >> 3) & 3; + } + p_next_frame = player_cells [gpit + rda]; + } + #endif +} + +void player_deplete (void) { + p_life = (p_life > p_kill_amt) ? p_life - p_kill_amt : 0; +} + +void player_kill (unsigned char sound) { + p_killme = 0; + + player_deplete (); + + #ifdef MODE_128K + PLAY_SOUND (sound); + #else + beep_fx (sound); + #endif + + #ifdef CP_RESET_WHEN_DYING + #ifdef CP_RESET_ALSO_FLAGS + mem_load (); + #else + n_pant = sg_pool [MAX_FLAGS]; + p_x = sg_pool [MAX_FLAGS + 1] << 10; + p_y = sg_pool [MAX_FLAGS + 2] << 10; + #endif + o_pant = 0xff; // Reload + #endif + + #ifdef PLAYER_FLICKERS + p_estado = EST_PARP; + p_ct_estado = 50; + #endif +} + diff --git a/examples/dogmole/dev/engine/simple_cocos.h b/examples/dogmole/dev/engine/simple_cocos.h index 1c33a2a5..5a4da667 100644 --- a/examples/dogmole/dev/engine/simple_cocos.h +++ b/examples/dogmole/dev/engine/simple_cocos.h @@ -100,7 +100,71 @@ void simple_coco_update (void) { // Check collision (player) - // Check collision (BG) + #ifdef PLAYER_FLICKERS + ld a, (_p_estado) + or a + jr nz, _simple_coco_update_continue + #endif + + // rdx + 3 >= gpx && rdx + 3 <= gpx + 15 && + // rdx + 3 >= gpx && rdx <= gpx + 12 + + // rdx + 3 >= gpx + ld a, (_gpx) + ld c, a + ld a, (_rdx) + add 3 + cp c + jr c, _simple_coco_update_collpl_done + + // gpx + 12 >= rdx + ld a, (_rdx) + ld c, a + ld a, (_gpx) + add 12 + cp c + jr c, _simple_coco_update_collpl_done + + // rdy + 3 >= gpy && rdy + 3 <= gpy + 15 + // rdy + 3 >= gpy && rdy <= gpy + 12 + + // rdy + 3 >= gpy + ld a, (_gpy) + ld c, a + ld a, (_rdy) + add 3 + cp c + jr c, _simple_coco_update_collpl_done + + // gpy + 12 >= rdy + ld a, (_rdy) + ld c, a + ld a, (_gpy) + add 12 + cp c + jr c, _simple_coco_update_collpl_done + + // Kill player + ld a, 0xff + ld (_rdy), a // This effectively marks the coco for destruction + + #ifdef MODE_128K + ld a, SFX_ENEMY_HIT + #else + ld a, 4 + #endif + ld (_p_killme), a + + jr _simple_coco_update_continue + + ._simple_coco_update_collpl_done + + #endasm + + // Check collision (BG) + if (attr ((rdx + 3) >> 4, (rdy + 3) >> 4) & 12) rdy = 0xff; + + #asm ._simple_coco_update_continue // And update arrays diff --git a/examples/dogmole/dev/mainloop.h b/examples/dogmole/dev/mainloop.h index 96c8fd4b..9875ead0 100644 --- a/examples/dogmole/dev/mainloop.h +++ b/examples/dogmole/dev/mainloop.h @@ -12,7 +12,7 @@ void main (void) { di #endasm - #ifdef MODE_128K + #if defined MODE_128K || defined MIN_FAPS_PER_FRAME sp_InitIM2(0xf1f1); sp_CreateGenericISR(0xf1f1); sp_RegisterHook(255, ISR); @@ -20,8 +20,15 @@ void main (void) { #asm ei #endasm + #endif + + #ifdef MODE_128K + #ifdef USE_ARKOS_PLAYER + arkos_stop(); + #else + wyz_init (); + #endif - wyz_init (); #endif cortina (); @@ -48,13 +55,13 @@ void main (void) { // Sprite creation #ifdef NO_MASKS - sp_player = sp_CreateSpr (sp_OR_SPRITE, 3, sprite_2_a); + sp_player = sp_CreateSpr (NO_MASKS, 3, sprite_2_a); sp_AddColSpr (sp_player, sprite_2_b); sp_AddColSpr (sp_player, sprite_2_c); p_current_frame = p_next_frame = sprite_2_a; - for (gpit = 0; gpit < 3; gpit ++) { - sp_moviles [gpit] = sp_CreateSpr(sp_OR_SPRITE, 3, sprite_9_a); + for (gpit = 0; gpit < MAX_ENEMS; gpit ++) { + sp_moviles [gpit] = sp_CreateSpr(NO_MASKS, 3, sprite_9_a); sp_AddColSpr (sp_moviles [gpit], sprite_9_b); sp_AddColSpr (sp_moviles [gpit], sprite_9_c); en_an_current_frame [gpit] = sprite_9_a; @@ -98,7 +105,7 @@ void main (void) { #include "my/ci/after_load.h" while (1) { - #ifdef ACTIVATE_SCRIPTING + #if defined ACTIVATE_SCRIPTING && !defined MODE_128K main_script_offset = (int) (main_script); #endif @@ -114,7 +121,22 @@ void main (void) { #include "my/ci/before_game.h" + #ifdef NO_RESET_STATS + p_objs = 0; + p_keys = 0; + p_killed = 0; + #ifdef MAX_AMMO + #ifdef INITIAL_AMMO + p_ammo = INITIAL_AMMO; + #else + p_ammo = MAX_AMMO; + #endif + #endif + #endif + #ifdef COMPRESSED_LEVELS + silent_level = 0; + #ifdef ENABLE_CHECKPOINTS if (sg_do_load) level = sg_level; else level = 0; #endif @@ -134,9 +156,12 @@ void main (void) { { #ifdef COMPRESSED_LEVELS - #include "my/level_screen.h" + if (silent_level == 0) { + #include "my/level_screen.h" + } + silent_level = 0; - prepare_level (level); + prepare_level (); #endif #ifndef DIRECT_TO_PLAY @@ -161,17 +186,19 @@ void main (void) { #ifdef COMPRESSED_LEVELS if (success) { #ifdef MODE_128K - //wyz_play_music (6); + //PLAY_MUSIC (6); #endif - zone_clear (); + if (silent_level == 0) zone_clear (); #ifdef ACTIVATE_SCRIPTING if (script_result != 3) #else if (warp_to_level == 0) #endif - ++ level; + { + level ++; + } if (level >= MAX_LEVELS #ifdef ACTIVATE_SCRIPTING @@ -183,7 +210,7 @@ void main (void) { } } else { #ifdef MODE_128K - //wyz_play_music (8); + //PLAY_MUSIC (8); #endif #if defined(TIMER_ENABLE) && defined(TIMER_GAMEOVER_0) && defined(SHOW_TIMER_OVER) @@ -193,7 +220,7 @@ void main (void) { #endif #ifdef MODE_128K - wyz_stop_sound (); + STOP_SOUND (); #endif break; } @@ -201,11 +228,13 @@ void main (void) { if (success) { game_ending (); } else { - //wyz_play_music (8); + //PLAY_MUSIC (8); game_over (); } #endif - cortina (); + #if !defined (DIRECT_TO_PLAY) || !defined (COMPRESSED_LEVELS) + cortina (); + #endif } clear_sprites (); diff --git a/examples/dogmole/dev/mainloop/flick_screen.h b/examples/dogmole/dev/mainloop/flick_screen.h index c1c039b9..97b4515c 100644 --- a/examples/dogmole/dev/mainloop/flick_screen.h +++ b/examples/dogmole/dev/mainloop/flick_screen.h @@ -13,7 +13,7 @@ } #if defined (COMPRESSED_LEVELS) - if (gpx == 224 && p_vx > 0 && x_pant < (level_data->map_w - 1)) + if (gpx == 224 && p_vx > 0 && x_pant < (level_data.map_w - 1)) #else if (gpx == 224 && p_vx > 0 && x_pant < (MAP_W - 1)) #endif @@ -27,7 +27,7 @@ #if MAP_H > 1 if (gpy == 0 && p_vy < 0 && y_pant > 0) { #if defined (COMPRESSED_LEVELS) - n_pant -= level_data->map_w; + n_pant -= level_data.map_w; #else n_pant -= MAP_W; #endif @@ -37,8 +37,8 @@ } #if defined (COMPRESSED_LEVELS) - if (gpy == 144 && p_vy > 0 && y_pant < (level_data->map_h - 1)) { - n_pant += level_data->map_w; + if (gpy == 144 && p_vy > 0 && y_pant < (level_data.map_h - 1)) { + n_pant += level_data.map_w; #else if (gpy == 144 && p_vy > 0 && y_pant < (MAP_H - 1)) { n_pant += MAP_W; @@ -62,8 +62,8 @@ #if MAP_H > 1 #if defined (COMPRESSED_LEVELS) - if (gpy == 0 && p_vy < 0 && n_pant >= level_data->map_w) { - n_pant -= level_data->map_w; + if (gpy == 0 && p_vy < 0 && n_pant >= level_data.map_w) { + n_pant -= level_data.map_w; #else if (gpy == 0 && p_vy < 0 && n_pant >= MAP_W) { n_pant -= MAP_W; @@ -74,8 +74,8 @@ if (gpy == 144 && p_vy > 0) { // 9216 = 144 * 64 #if defined (COMPRESSED_LEVELS) - if (n_pant < level_data->map_w * (level_data->map_h - 1)) { - n_pant += level_data->map_w; + if (n_pant < level_data.map_w * (level_data.map_h - 1)) { + n_pant += level_data.map_w; #else if (n_pant < MAP_W * MAP_H - MAP_W) { n_pant += MAP_W; diff --git a/examples/dogmole/dev/mainloop/game_loop.h b/examples/dogmole/dev/mainloop/game_loop.h index e5442d9e..3f59e563 100644 --- a/examples/dogmole/dev/mainloop/game_loop.h +++ b/examples/dogmole/dev/mainloop/game_loop.h @@ -3,9 +3,18 @@ // game_loop.h - Da game loop. + #asm + ; Makes debugging easier + ._game_loop_init + #endasm + playing = 1; player_init (); + #ifdef OBJECT_COUNT + flags [OBJECT_COUNT] = p_objs; + #endif + #ifndef COMPRESSED_LEVELS hotspots_init (); #endif @@ -35,9 +44,9 @@ #ifdef MODE_128K // Play music #ifdef COMPRESSED_LEVELS - wyz_play_music (levels [level].music_id); + PLAY_MUSIC (levels [level].music_id); #else - wyz_play_music (1); + PLAY_MUSIC (1); #endif #endif @@ -67,8 +76,8 @@ #ifdef PLAYER_CHECK_MAP_BOUNDARIES #ifdef COMPRESSED_LEVELS - x_pant = n_pant % level_data->map_w; - y_pant = n_pant / level_data->map_w; + x_pant = n_pant % level_data.map_w; + y_pant = n_pant / level_data.map_w; #else x_pant = n_pant % MAP_W; y_pant = n_pant / MAP_W; #endif @@ -86,6 +95,11 @@ o_pant = 0xff; while (playing) { + #asm + ; Makes debugging easier + ._game_loop_do + #endasm + #ifdef DEBUG_KEYS if (sp_KeyPressed (KEY_M)) { ++ p_objs; beep_fx (0); } if (sp_KeyPressed (KEY_H)) { ++ n_pant; beep_fx (0); } @@ -176,7 +190,12 @@ simple_coco_update (); #endif - if (p_killme) player_kill (p_killme); + if (p_killme) { + if (p_life) { + player_kill (p_killme); + #include "my/ci/on_player_killed.h" + } else playing = 0; + } #ifdef PLAYER_CAN_FIRE // Move bullets @@ -184,7 +203,7 @@ #endif #ifdef ENABLE_TILANIMS - do_tilanims (); + tilanims_do (); #endif // Detect fire zone @@ -200,6 +219,23 @@ if (o_pant == n_pant) { #include "mainloop/update_sprites.h" + // Limit frame rate + + #ifdef MIN_FAPS_PER_FRAME + #asm + .ml_min_faps_loop + ld a, (_isrc) + cp MIN_FAPS_PER_FRAME + jr nc, ml_min_faps_loop_end + halt + jr ml_min_faps_loop + + .ml_min_faps_loop_end + xor a + ld (_isrc), a + #endasm + #endif + sp_UpdateNow(); } @@ -223,7 +259,7 @@ if (sp_KeyPressed (KEY_Z)) { if (!key_z_pressed) { #ifdef MODE_128K - wyz_play_sound (0); + PLAY_SOUND (0); #else beep_fx (2); #endif @@ -258,8 +294,7 @@ if (sp_KeyPressed (KEY_H)) { sp_WaitForNoKey (); #ifdef MODE_128K - wyz_stop_sound (); - wyz_play_sound (1); + player_on = 0; #endif clear_sprites (); pause_screen (); @@ -267,11 +302,7 @@ sp_WaitForNoKey (); draw_scr (); #ifdef MODE_128K - #ifdef COMPRESSED_LEVELS - //wyz_play_music (levels [level].music_id); - #else - //wyz_play_music (1); - #endif + player_on = 1; #endif } if (sp_KeyPressed (KEY_Y)) { @@ -281,7 +312,12 @@ // Flick the screen ? - #include "mainloop/flick_screen.h" + #if defined ACTIVATE_SCRIPTING && defined COMPRESSED_LEVELS + if (script_result != 3) + #endif + { + #include "mainloop/flick_screen.h" + } // Win game condition @@ -305,7 +341,8 @@ } // Game over condition - if (p_life == 0 + #if defined ACTIVATE_SCRIPTING || (defined(TIMER_ENABLE) && defined(TIMER_GAMEOVER_0)) + if (0 #ifdef ACTIVATE_SCRIPTING || (script_result == 2) #endif @@ -315,14 +352,16 @@ ) { playing = 0; } + #endif #include "my/ci/extra_routines.h" } + sp_UpdateNow (); sp_WaitForNoKey (); #ifdef MODE_128K - wyz_stop_sound (); + STOP_SOUND (); #endif #include "my/ci/after_game_loop.h" diff --git a/examples/dogmole/dev/mk1.c b/examples/dogmole/dev/mk1.c index 04a9fe4f..ba5f994d 100644 --- a/examples/dogmole/dev/mk1.c +++ b/examples/dogmole/dev/mk1.c @@ -21,6 +21,10 @@ #define FIXBITS 6 #define MAX_ENEMS 3 +// Fiddle if you need +#define MAX_TILANIMS 16 +#define TILANIMS_PRIME 7 + /* splib2 memory map 61440 - 61696 IM2 vector table 61697 - 61936 FREEPOOL (240 bytes) @@ -55,7 +59,7 @@ #endif #endif -#define NUMBLOCKS (40 + (MAX_PROJECTILES * 5)) +#define NUMBLOCKS (((1 + MAX_ENEMS) * 10) + (MAX_PROJECTILES * 5)) unsigned char AD_FREE [NUMBLOCKS * 15]; @@ -73,8 +77,6 @@ unsigned char AD_FREE [NUMBLOCKS * 15]; #include "assets/librarian.h" #endif -#include "my/ci/extra_vars.h" - #include "aplib.h" #include "pantallas.h" @@ -90,10 +92,19 @@ unsigned char AD_FREE [NUMBLOCKS * 15]; #include "assets/extrasprites.h" #endif +#include "my/ci/extra_vars.h" + #ifdef MODE_128K - #include "wyzplayer.h" + #ifdef USE_ARKOS_PLAYER + #include "sound/arkosplayer.h" + #else + #include "sound/wyzplayer.h" + #endif #else - #include "beeper.h" + #include "sound/beeper.h" + #ifdef MIN_FAPS_PER_FRAME + #include "engine/isr.h" + #endif #endif #include "printer.h" @@ -132,5 +143,5 @@ unsigned char AD_FREE [NUMBLOCKS * 15]; #ifndef MODE_128K // From beepola. Phaser engine by Shiru. - #include "music.h" + #include "sound/music.h" #endif diff --git a/examples/dogmole/dev/my/ci/custom_heng.h b/examples/dogmole/dev/my/ci/custom_heng.h new file mode 100644 index 00000000..f2a1f4b8 --- /dev/null +++ b/examples/dogmole/dev/my/ci/custom_heng.h @@ -0,0 +1,4 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// Modify p_vx diff --git a/examples/dogmole/dev/my/ci/enems_custom_respawn.h b/examples/dogmole/dev/my/ci/enems_custom_respawn.h new file mode 100644 index 00000000..a06ef557 --- /dev/null +++ b/examples/dogmole/dev/my/ci/enems_custom_respawn.h @@ -0,0 +1,5 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// deactivate RESPAWN_ON_ENTER and write your own routine here! + diff --git a/examples/dogmole/dev/my/ci/on_player_killed.h b/examples/dogmole/dev/my/ci/on_player_killed.h new file mode 100644 index 00000000..d6e076ee --- /dev/null +++ b/examples/dogmole/dev/my/ci/on_player_killed.h @@ -0,0 +1,3 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + diff --git a/examples/dogmole/dev/my/ci/on_wall_hit.h b/examples/dogmole/dev/my/ci/on_wall_hit.h index d6e076ee..6df1f99c 100644 --- a/examples/dogmole/dev/my/ci/on_wall_hit.h +++ b/examples/dogmole/dev/my/ci/on_wall_hit.h @@ -1,3 +1,6 @@ // MTE MK1 (la Churrera) v5.0 // Copyleft 2010-2014, 2020 by the Mojon Twins +// _x, _y contain the tile coordinates. + +_t = 27; draw_invalidate_coloured_tile_gamearea (); diff --git a/examples/dogmole/dev/my/config.h b/examples/dogmole/dev/my/config.h index 268b9c21..960f941f 100644 --- a/examples/dogmole/dev/my/config.h +++ b/examples/dogmole/dev/my/config.h @@ -8,6 +8,9 @@ // ============================================================================ //#define MODE_128K // Read the docs! +//#define MIN_FAPS_PER_FRAME 2 // Limits the max # of fps to 50/N +//#define USE_ARKOS_PLAYER // Use Arkos instead of Wyz player for 128k Music +//#define ARKOS_SFX_CHANNEL 0 // SFX Channel (0-2) //#define VENG_SELECTOR // Very advanced! //#define USE_MAP_CUSTOM_DECODER @@ -25,8 +28,10 @@ #define PLAYER_LIFE 15 // Max and starting life gauge. #define PLAYER_REFILL 1 // Life recharge //#define COMPRESSED_LEVELS // use levels.h instead of mapa.h and enems.h (!) +//#define PER_LEVEL_SPRITESET // use a different spriteset for each level in 48K //#define MAX_LEVELS 2 // # of compressed levels //#define REFILL_ME // If defined, refill player on each level +//#define NO_RESET_STATS // If defined, player stats are not reset per level // ============================================================================ // II. Engine type @@ -72,6 +77,7 @@ //#define ENABLE_PURSUERS // If defined, type 7 enemies are active //#define DEATH_COUNT_AND 7 //#define DEATH_COUNT_ADD 11 // Frames to wait = ADD + (rand & AND) +//#define PURSUERS_MAX_V 2 // 1, 2, 4. //#define PURSUERS_BASE_CELL 3 // If defined, type 7 enemies are always # //#define ENABLE_FANTIES // If defined, Fanties are enabled! @@ -137,6 +143,7 @@ //#define SCRIPTING_KEY_NONE // No action key. #define ENABLE_EXTERN_CODE // Enables custom code to be run from the script using EXTERN n #define ENABLE_FIRE_ZONE // Allows to define a zone which auto-triggers "FIRE" +//#define SCRIPT_PAGE 3 // In MODE_128K & COMPRESSED_LEVELS // Timer // ----- @@ -182,6 +189,8 @@ #define PLAYER_MIN_KILLABLE 3 // Only kill enemies with id >= PLAYER_MIN_KILLABLE //#define PLAYER_STEP_SOUND // Sound while walking. No effect in the BOOTEE engine. +//#define PLAYER_DISABLE_DEFAULT_HENG // To disble default horizontal engine (keyrs) + // Configure keyboard // To define different keys, the first two hex digits are the COLUMN, the next the ROW @@ -261,6 +270,7 @@ //#define USE_AUTO_SHADOWS // Automatic shadows made of darker attributes //#define USE_AUTO_TILE_SHADOWS // Automatic shadows using specially defined tiles 32-47. //#define UNPACKED_MAP // Full, uncompressed maps. Shadows settings are ignored. +#define PACKED_MAP_ALT_TILE 19 // If defined, in 16 tiles mode, alt tile (default 19) //#define NO_MASKS // Sprites are rendered using OR instead of masks. //#define MASKED_BULLETS // If needed //#define PLAYER_CUSTOM_ANIMATION // Code your own animation in my/custom_animation.h diff --git a/examples/dogmole/dev/my/fixed_screens.h b/examples/dogmole/dev/my/fixed_screens.h index 36e03655..e794b96d 100644 --- a/examples/dogmole/dev/my/fixed_screens.h +++ b/examples/dogmole/dev/my/fixed_screens.h @@ -36,7 +36,7 @@ void game_ending (void) { void game_over (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " GAME OVER! "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" GAME OVER! "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNow (); @@ -52,7 +52,7 @@ void game_over (void) { #if defined(TIMER_ENABLE) && defined(SHOW_TIMER_OVER) void time_over (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " TIME'S UP! "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" TIME'S UP! "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); @@ -69,7 +69,7 @@ void game_over (void) { #ifdef PAUSE_ABORT void pause_screen (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " PAUSED "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" PAUSED "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); } @@ -78,7 +78,7 @@ void game_over (void) { #ifdef COMPRESSED_LEVELS void zone_clear (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " ZONE CLEAR "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" ZONE CLEAR "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); espera_activa (250); diff --git a/examples/dogmole/dev/my/level_screen.h b/examples/dogmole/dev/my/level_screen.h index 0de8100f..5e779b2a 100644 --- a/examples/dogmole/dev/my/level_screen.h +++ b/examples/dogmole/dev/my/level_screen.h @@ -10,7 +10,7 @@ _x = 12; _y = 12; _t = 71; _gp_gen = level_str; print_str (); sp_UpdateNow (); #ifdef MODE_128K - wyz_play_sound (SFX_START); + PLAY_SOUND (SFX_START); #else beep_fx (1); #endif diff --git a/examples/dogmole/dev/my/levelset.h b/examples/dogmole/dev/my/levelset.h index 8add6ae3..578decfa 100644 --- a/examples/dogmole/dev/my/levelset.h +++ b/examples/dogmole/dev/my/levelset.h @@ -37,12 +37,14 @@ // In 48K mode, include here your compressed binaries: -extern unsigned char my_binary [0]; +#ifndef MODE_128K + extern unsigned char my_binary [0]; -#asm - ._my_binary - BINARY "../bin/my_binary.bin" -#endasm + #asm + ._my_binary + BINARY "../bin/my_binary.bin" + #endasm +#endif // Define your level sequence array here: // map_w, map_h, scr_ini, ini_x, ini_y, max_objs, c_map_bolts, c_tileset, c_enems_hotspots, c_behs, script diff --git a/examples/dogmole/dev/my/msc.h b/examples/dogmole/dev/my/msc.h index 8d4b7f92..9cbb53b4 100644 --- a/examples/dogmole/dev/my/msc.h +++ b/examples/dogmole/dev/my/msc.h @@ -111,7 +111,7 @@ void run_script (unsigned char whichs) { // readxy (); // sc_terminado = (flags [sc_x] != sc_y); #asm - call _read_two_bytes_d_e + call _read_two_bytes_D_E // Set sc_terminado if flags [C] != E ld b, 0 ld c, d diff --git a/examples/dogmole/dev/my/title_screen.h b/examples/dogmole/dev/my/title_screen.h index 86ae601c..d4342db9 100644 --- a/examples/dogmole/dev/my/title_screen.h +++ b/examples/dogmole/dev/my/title_screen.h @@ -9,7 +9,7 @@ #ifdef MODE_128K get_resource (TITLE_BIN, 16384); - wyz_play_music (0); + PLAY_MUSIC (0); #else #asm ld hl, _s_title diff --git a/examples/dogmole/dev/pantallas.h b/examples/dogmole/dev/pantallas.h index b1fbc674..2734d92b 100644 --- a/examples/dogmole/dev/pantallas.h +++ b/examples/dogmole/dev/pantallas.h @@ -12,17 +12,17 @@ #asm ._s_title - BINARY "title.bin" + BINARY "..\bin\title.bin" ._s_marco #endasm #ifndef DIRECT_TO_PLAY #asm - BINARY "marco.bin" + BINARY "..\bin\marco.bin" #endasm #endif #asm ._s_ending - BINARY "ending.bin" + BINARY "..\bin\ending.bin" #endasm #endif diff --git a/examples/dogmole/dev/printer.h b/examples/dogmole/dev/printer.h index 12b2b499..7e05d920 100644 --- a/examples/dogmole/dev/printer.h +++ b/examples/dogmole/dev/printer.h @@ -4,7 +4,7 @@ // Printing functions unsigned char attr (unsigned char x, unsigned char y) { - if (x >= 14 || y >= 10) return 0; + if (x >= 15 || y >= 10) return 0; return map_attr [x + (y << 4) - y]; } @@ -12,6 +12,48 @@ unsigned char qtile (unsigned char x, unsigned char y) { return map_buff [x + (y << 4) - y]; } +#if defined (USE_AUTO_TILE_SHADOWS) || defined (USE_AUTO_SHADOWS) + unsigned char attr_mk2 (void) { + // x + 15 * y = x + (16 - 1) * y = x + 16 * y - y = x + (y << 4) - y. + // if (cx1 < 0 || cy1 < 0 || cx1 > 14 || cy1 > 9) return 0; + // return map_attr [cx1 + (cy1 << 4) - cy1]; + #asm + ld a, (_cx1) + cp 15 + jr nc, _attr_reset + + ld a, (_cy1) + cp 10 + jr c, _attr_do + + ._attr_reset + ld hl, 0 + ret + + ._attr_do + ld a, (_cy1) + ld b, a + sla a + sla a + sla a + sla a + sub b + ld b, a + ld a, (_cx1) + add b + ld e, a + ld d, 0 + ld hl, _map_attr + add hl, de + ld a, (hl) + + ld h, 0 + ld l, a + ret + #endasm + } +#endif + #ifdef COMPRESSED_LEVELS #define ATTR_OFFSET 1536 #else @@ -53,9 +95,9 @@ void draw_coloured_tile (void) { // Fill up c1, c2, c3, c4 then use them #ifdef USE_AUTO_SHADOWS - cx1 = xx - 1; cy1 = yy - 1; rda = *gen_pt; c1 = (nocast && (attr () & 8)) ? (rda & 7) - 1 : rda; t1 = _ta; ++ gen_pt; ++ _ta; - cx1 = xx ; cy1 = yy - 1; rda = *gen_pt; c2 = (nocast && (attr () & 8)) ? (rda & 7) - 1 : rda; t2 = _ta; ++ gen_pt; ++ _ta; - cx1 = xx - 1; cy1 = yy ; rda = *gen_pt; c3 = (nocast && (attr () & 8)) ? (rda & 7) - 1 : rda; t3 = _ta; ++ gen_pt; ++ _ta; + cx1 = xx - 1; cy1 = yy - 1; rda = *gen_pt; c1 = (nocast && (attr_mk2 () & 8)) ? (rda & 7) - 1 : rda; t1 = _ta; ++ gen_pt; ++ _ta; + cx1 = xx ; cy1 = yy - 1; rda = *gen_pt; c2 = (nocast && (attr_mk2 () & 8)) ? (rda & 7) - 1 : rda; t2 = _ta; ++ gen_pt; ++ _ta; + cx1 = xx - 1; cy1 = yy ; rda = *gen_pt; c3 = (nocast && (attr_mk2 () & 8)) ? (rda & 7) - 1 : rda; t3 = _ta; ++ gen_pt; ++ _ta; #endif #ifdef USE_AUTO_TILE_SHADOWS // Precalc @@ -79,7 +121,7 @@ void draw_coloured_tile (void) { gen_pt_alt = tileset + ATTR_OFFSET + t_alt; - // cx1 = xx - 1; cy1 = yy ? yy - 1 : 0; a1 = (nocast && (attr () & 8)); + // cx1 = xx - 1; cy1 = yy ? yy - 1 : 0; a1 = (nocast && (attr_mk2 () & 8)); #asm // cx1 = xx - 1; ld a, (_xx) @@ -94,12 +136,12 @@ void draw_coloured_tile (void) { ._dct_1_set_yy ld (_cy1), a - // a1 = (nocast && (attr () & 8)); + // a1 = (nocast && (attr_mk2 () & 8)); ld a, (_nocast) or a jr z, _dct_a1_set - call _attr + call _attr_mk2 ld a, l and 8 jr z, _dct_a1_set @@ -110,7 +152,7 @@ void draw_coloured_tile (void) { ld (_a1), a #endasm - // cx1 = xx ; cy1 = yy ? yy - 1 : 0; a2 = (nocast && (attr () & 8)); + // cx1 = xx ; cy1 = yy ? yy - 1 : 0; a2 = (nocast && (attr_mk2 () & 8)); #asm // cx1 = xx; ld a, (_xx) @@ -124,12 +166,12 @@ void draw_coloured_tile (void) { ._dct_2_set_yy ld (_cy1), a - // a2 = (nocast && (attr () & 8)) + // a2 = (nocast && (attr_mk2 () & 8)) ld a, (_nocast) or a jr z, _dct_a2_set - call _attr + call _attr_mk2 ld a, l and 8 jr z, _dct_a2_set @@ -140,7 +182,7 @@ void draw_coloured_tile (void) { ld (_a2), a #endasm - // cx1 = xx - 1; cy1 = yy ; a3 = (nocast && (attr () & 8)); + // cx1 = xx - 1; cy1 = yy ; a3 = (nocast && (attr_mk2 () & 8)); #asm // cx1 = xx - 1; ld a, (_xx) @@ -151,12 +193,12 @@ void draw_coloured_tile (void) { ld a, (_yy) ld (_cy1), a - // a3 = (nocast && (attr () & 8)); + // a3 = (nocast && (attr_mk2 () & 8)); ld a, (_nocast) or a jr z, _dct_a3_set - call _attr + call _attr_mk2 ld a, l and 8 jr z, _dct_a3_set @@ -567,7 +609,8 @@ void update_tile (void) { #ifdef ENABLE_TILANIMS // Detect tilanims if (_t >= ENABLE_TILANIMS) { - add_tilanim (_x, _y, _t); + _n = (_x << 4) | _y; + tilanims_add (); } #endif diff --git a/examples/dogmole/dev/prototypes.h b/examples/dogmole/dev/prototypes.h index aae155dd..843aaf1a 100644 --- a/examples/dogmole/dev/prototypes.h +++ b/examples/dogmole/dev/prototypes.h @@ -7,6 +7,18 @@ #define ENABLE_SIMPLE_COCOS #endif +#ifdef MODE_128K + #ifdef USE_ARKOS_PLAYER + #define PLAY_MUSIC arkos_play_music + #define PLAY_SOUND arkos_play_sound + #define STOP_SOUND arkos_stop_sound + #else + #define PLAY_MUSIC wyz_play_music + #define PLAY_SOUND wyz_play_sound + #define STOP_SOUND wyz_stop_sound + #endif +#endif + // Engine // breakable.h @@ -74,6 +86,7 @@ char player_hidden (void); void run_fire_script (void); void process_tile (void); void draw_scr_background (void); +void draw_scr_hotspots_locks (void); void draw_scr (void); void select_joyfunc (void); unsigned char mons_col_sc_x (void); @@ -108,12 +121,15 @@ void tape_load (void);// TODO! void sg_submenu (void); // tilanim.h -void add_tilanim (unsigned char x, unsigned char y, unsigned char t); -void do_tilanims (void); +void tilanims_add (void); +void tilanims_do (void); +void tilanims_reset (void); -// wyzplayer.h +#ifdef MODE_128K +// wyzplayer.h / arcos_player.h void ISR (void); -void wyz_init (void); -void wyz_play_sound (unsigned char fx_number); -void wyz_play_music (unsigned char song_number); -void wyz_stop_sound (void); +void INIT_PLAYER (void); +void PLAY_SOUND (unsigned char fx_number); +void PLAY_MUSIC (unsigned char song_number); +void STOP_SOUND (void); +#endif diff --git a/examples/dogmole/dev/setenv.bat b/examples/dogmole/dev/setenv.bat index e034d8d5..a543b050 100644 --- a/examples/dogmole/dev/setenv.bat +++ b/examples/dogmole/dev/setenv.bat @@ -1,6 +1,5 @@ @echo off -set Z88DK_PATH=c:\z88dk10 -set PATH=%Z88DK_PATH%\bin;%PATH% +set Z88DK_PATH=c:\z88dk +set PATH=%Z88DK_PATH%\bin.x86;%PATH% set Z80_OZFILES=%Z88DK_PATH%\Lib\ set ZCCCFG=%Z88DK_PATH%\Lib\Config\ -zcc diff --git a/examples/dogmole/dev/sound/arkos-addresses.h b/examples/dogmole/dev/sound/arkos-addresses.h new file mode 100644 index 00000000..fa3225d7 --- /dev/null +++ b/examples/dogmole/dev/sound/arkos-addresses.h @@ -0,0 +1,9 @@ +#define SFXS_SONG 0xd10c +#define ATINIT 0xc68c +#define ATPLAY 0xc000 +#define ATSFXINIT 0xc6f0 +#define ATSFXPLAY 0xc704 +#define ATSFXSTOP 0xc745 +#define ATSFXSTOPALL 0xc6f7 +#define ATSTOP 0xc6e1 +#define SONG_LIST 0xd5b7 diff --git a/src/dev/sound/arkosplayer.h.bak b/examples/dogmole/dev/sound/arkosplayer.h similarity index 98% rename from src/dev/sound/arkosplayer.h.bak rename to examples/dogmole/dev/sound/arkosplayer.h index aaf08306..c149b1b9 100644 --- a/src/dev/sound/arkosplayer.h.bak +++ b/examples/dogmole/dev/sound/arkosplayer.h @@ -25,6 +25,9 @@ void ISR(void) { call ATPLAY ld b, 0 call SetRAMBank + + ld hl, _isrc + inc (hl) #endasm } diff --git a/examples/dogmole/dev/beeper.h b/examples/dogmole/dev/sound/beeper.h similarity index 92% rename from examples/dogmole/dev/beeper.h rename to examples/dogmole/dev/sound/beeper.h index fc57e5ac..379fb386 100644 --- a/examples/dogmole/dev/beeper.h +++ b/examples/dogmole/dev/sound/beeper.h @@ -1,271 +1,271 @@ -// MTE MK1 (la Churrera) v5.0 -// Copyleft 2010-2014, 2020 by the Mojon Twins - -#asm - ;org 60000 - -;BeepFX player by Shiru -;You are free to do whatever you want with this code - - - -.playBasic - ld a,0 -.sound_play - ld hl,sfxData ;address of sound effects data - - ;di - push ix - push iy - - ld b,0 - ld c,a - add hl,bc - add hl,bc - ld e,(hl) - inc hl - ld d,(hl) - push de - pop ix ;put it into ix - - ld a,(23624) ;get border color from BASIC vars to keep it unchanged - rra - rra - rra - and 7 - ld (sfxRoutineToneBorder +1),a - ld (sfxRoutineNoiseBorder +1),a - ld (sfxRoutineSampleBorder+1),a - - -.readData - ld a,(ix+0) ;read block type - ld c,(ix+1) ;read duration 1 - ld b,(ix+2) - ld e,(ix+3) ;read duration 2 - ld d,(ix+4) - push de - pop iy - - dec a - jr z,sfxRoutineTone - dec a - jr z,sfxRoutineNoise - dec a - jr z,sfxRoutineSample - pop iy - pop ix - ;ei - ret - - - -;play sample - -.sfxRoutineSample - ex de,hl -.sfxRS0 - ld e,8 - ld d,(hl) - inc hl -.sfxRS1 - ld a,(ix+5) -.sfxRS2 - dec a - jr nz,sfxRS2 - rl d - sbc a,a - and 16 -.sfxRoutineSampleBorder - or 0 - out (254),a - dec e - jr nz,sfxRS1 - dec bc - ld a,b - or c - jr nz,sfxRS0 - - ld c,6 - -.nextData - add ix,bc ;skip to the next block - jr readData - - - -;generate tone with many parameters - -.sfxRoutineTone - ld e,(ix+5) ;freq - ld d,(ix+6) - ld a,(ix+9) ;duty - ld (sfxRoutineToneDuty+1),a - ld hl,0 - -.sfxRT0 - push bc - push iy - pop bc -.sfxRT1 - add hl,de - ld a,h -.sfxRoutineToneDuty - cp 0 - sbc a,a - and 16 -.sfxRoutineToneBorder - or 0 - out (254),a - - dec bc - ld a,b - or c - jr nz,sfxRT1 - - ld a,(sfxRoutineToneDuty+1) ;duty change - add a,(ix+10) - ld (sfxRoutineToneDuty+1),a - - ld c,(ix+7) ;slide - ld b,(ix+8) - ex de,hl - add hl,bc - ex de,hl - - pop bc - dec bc - ld a,b - or c - jr nz,sfxRT0 - - ld c,11 - jr nextData - - - -;generate noise with two parameters - -.sfxRoutineNoise - ld e,(ix+5) ;pitch - - ld d,1 - ld h,d - ld l,d -.sfxRN0 - push bc - push iy - pop bc -.sfxRN1 - ld a,(hl) - and 16 -.sfxRoutineNoiseBorder - or 0 - out (254),a - dec d - jr nz,sfxRN2 - ld d,e - inc hl - ld a,h - and 31 - ld h,a -.sfxRN2 - dec bc - ld a,b - or c - jr nz,sfxRN1 - - ld a,e - add a,(ix+6) ;slide - ld e,a - - pop bc - dec bc - ld a,b - or c - jr nz,sfxRN0 - - ld c,7 - jr nextData - - -.sfxData - -.SoundEffectsData - defw SoundEffect0Data - defw SoundEffect1Data - defw SoundEffect2Data - defw SoundEffect3Data - defw SoundEffect4Data - defw SoundEffect5Data - defw SoundEffect6Data - defw SoundEffect7Data - defw SoundEffect8Data - defw SoundEffect9Data - -.SoundEffect0Data - defb 2 ;noise - defw 8,200,20 - defb 2 ;noise - defw 4,2000,5220 - defb 0 -.SoundEffect1Data - defb 2 ;noise - defw 1,1000,10 - defb 2 ;noise - defw 1,1000,1 - defb 0 -.SoundEffect2Data - defb 1 ;tone - defw 50,100,200,65531,128 - defb 0 -.SoundEffect3Data - defb 1 ;tone - defw 100,20,500,2,128 - defb 0 -.SoundEffect4Data - defb 2 ;noise - defw 1,1000,20 - defb 1 ;pause - defw 1,1000,0,0,0 - defb 2 ;noise - defw 1,1000,1 - defb 0 -.SoundEffect5Data - defb 1 ;tone - defw 50,200,500,65516,128 - defb 0 -.SoundEffect6Data - defb 2 ;noise - defw 20,50,257 - defb 0 -.SoundEffect7Data - defb 1 ;tone - defw 1,1000,2000,0,64 - defb 1 ;pause - defw 1,1000,0,0,0 - defb 1 ;tone - defw 1,1000,1500,0,64 - defb 0 -.SoundEffect8Data - defb 2 ;noise - defw 2,2000,32776 - defb 0 -.SoundEffect9Data - defb 1 ;tone - defw 4,1000,1000,400,128 - defb 0 -#endasm - -void beep_fx (unsigned char n) { - // Cargar en A el valor de n - asm_int = n; - #asm - push ix - push iy - ld a, (_asm_int) - call sound_play - pop ix - pop iy - #endasm -} +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +#asm + ;org 60000 + +;BeepFX player by Shiru +;You are free to do whatever you want with this code + + + +.playBasic + ld a,0 +.sound_play + ld hl,sfxData ;address of sound effects data + + ;di + push ix + push iy + + ld b,0 + ld c,a + add hl,bc + add hl,bc + ld e,(hl) + inc hl + ld d,(hl) + push de + pop ix ;put it into ix + + ld a,(23624) ;get border color from BASIC vars to keep it unchanged + rra + rra + rra + and 7 + ld (sfxRoutineToneBorder +1),a + ld (sfxRoutineNoiseBorder +1),a + ld (sfxRoutineSampleBorder+1),a + + +.readData + ld a,(ix+0) ;read block type + ld c,(ix+1) ;read duration 1 + ld b,(ix+2) + ld e,(ix+3) ;read duration 2 + ld d,(ix+4) + push de + pop iy + + dec a + jr z,sfxRoutineTone + dec a + jr z,sfxRoutineNoise + dec a + jr z,sfxRoutineSample + pop iy + pop ix + ;ei + ret + + + +;play sample + +.sfxRoutineSample + ex de,hl +.sfxRS0 + ld e,8 + ld d,(hl) + inc hl +.sfxRS1 + ld a,(ix+5) +.sfxRS2 + dec a + jr nz,sfxRS2 + rl d + sbc a,a + and 16 +.sfxRoutineSampleBorder + or 0 + out (254),a + dec e + jr nz,sfxRS1 + dec bc + ld a,b + or c + jr nz,sfxRS0 + + ld c,6 + +.nextData + add ix,bc ;skip to the next block + jr readData + + + +;generate tone with many parameters + +.sfxRoutineTone + ld e,(ix+5) ;freq + ld d,(ix+6) + ld a,(ix+9) ;duty + ld (sfxRoutineToneDuty+1),a + ld hl,0 + +.sfxRT0 + push bc + push iy + pop bc +.sfxRT1 + add hl,de + ld a,h +.sfxRoutineToneDuty + cp 0 + sbc a,a + and 16 +.sfxRoutineToneBorder + or 0 + out (254),a + + dec bc + ld a,b + or c + jr nz,sfxRT1 + + ld a,(sfxRoutineToneDuty+1) ;duty change + add a,(ix+10) + ld (sfxRoutineToneDuty+1),a + + ld c,(ix+7) ;slide + ld b,(ix+8) + ex de,hl + add hl,bc + ex de,hl + + pop bc + dec bc + ld a,b + or c + jr nz,sfxRT0 + + ld c,11 + jr nextData + + + +;generate noise with two parameters + +.sfxRoutineNoise + ld e,(ix+5) ;pitch + + ld d,1 + ld h,d + ld l,d +.sfxRN0 + push bc + push iy + pop bc +.sfxRN1 + ld a,(hl) + and 16 +.sfxRoutineNoiseBorder + or 0 + out (254),a + dec d + jr nz,sfxRN2 + ld d,e + inc hl + ld a,h + and 31 + ld h,a +.sfxRN2 + dec bc + ld a,b + or c + jr nz,sfxRN1 + + ld a,e + add a,(ix+6) ;slide + ld e,a + + pop bc + dec bc + ld a,b + or c + jr nz,sfxRN0 + + ld c,7 + jr nextData + + +.sfxData + +.SoundEffectsData + defw SoundEffect0Data + defw SoundEffect1Data + defw SoundEffect2Data + defw SoundEffect3Data + defw SoundEffect4Data + defw SoundEffect5Data + defw SoundEffect6Data + defw SoundEffect7Data + defw SoundEffect8Data + defw SoundEffect9Data + +.SoundEffect0Data + defb 2 ;noise + defw 8,200,20 + defb 2 ;noise + defw 4,2000,5220 + defb 0 +.SoundEffect1Data + defb 2 ;noise + defw 1,1000,10 + defb 2 ;noise + defw 1,1000,1 + defb 0 +.SoundEffect2Data + defb 1 ;tone + defw 50,100,200,65531,128 + defb 0 +.SoundEffect3Data + defb 1 ;tone + defw 100,20,500,2,128 + defb 0 +.SoundEffect4Data + defb 2 ;noise + defw 1,1000,20 + defb 1 ;pause + defw 1,1000,0,0,0 + defb 2 ;noise + defw 1,1000,1 + defb 0 +.SoundEffect5Data + defb 1 ;tone + defw 50,200,500,65516,128 + defb 0 +.SoundEffect6Data + defb 2 ;noise + defw 20,50,257 + defb 0 +.SoundEffect7Data + defb 1 ;tone + defw 1,1000,2000,0,64 + defb 1 ;pause + defw 1,1000,0,0,0 + defb 1 ;tone + defw 1,1000,1500,0,64 + defb 0 +.SoundEffect8Data + defb 2 ;noise + defw 2,2000,32776 + defb 0 +.SoundEffect9Data + defb 1 ;tone + defw 4,1000,1000,400,128 + defb 0 +#endasm + +void beep_fx (unsigned char n) { + // Cargar en A el valor de n + asm_int = n; + #asm + push ix + push iy + ld a, (_asm_int) + call sound_play + pop ix + pop iy + #endasm +} diff --git a/examples/dogmole/dev/music.h b/examples/dogmole/dev/sound/music.h similarity index 100% rename from examples/dogmole/dev/music.h rename to examples/dogmole/dev/sound/music.h diff --git a/src/dev/sound/wyzplayer.h.bak b/examples/dogmole/dev/sound/wyzplayer.h similarity index 97% rename from src/dev/sound/wyzplayer.h.bak rename to examples/dogmole/dev/sound/wyzplayer.h index aaea6995..b06fedd7 100644 --- a/src/dev/sound/wyzplayer.h.bak +++ b/examples/dogmole/dev/sound/wyzplayer.h @@ -33,6 +33,9 @@ void ISR(void) { call WYZPLAYERISR ld b, 0 call SetRAMBank + + ld hl, _isrc + inc (hl) #endasm } diff --git a/examples/dogmole/dev/tilanim.h b/examples/dogmole/dev/tilanim.h index 3e62c5a7..cfeaafaf 100644 --- a/examples/dogmole/dev/tilanim.h +++ b/examples/dogmole/dev/tilanim.h @@ -2,43 +2,102 @@ // Copyleft 2010-2014, 2020 by the Mojon Twins // tilanim.h -// Rutina para animar tiles. -#define MAX_TILANIMS 64 -#define UPDATE_FREQ 7 -unsigned char max_tilanims; -unsigned char tacount; +void tilanims_reset (void) { + #asm + ld hl, _tilanims_ft + ld de, _tilanims_ft + 1 + ld bc, MAX_TILANIMS - 1 + xor a + ld (hl), a + ldir + ld (_tacount), a + ld (_tait), a + ld (_max_tilanims), a + #endasm +} + +void tilanims_add (void) { + #asm + ld de, (_max_tilanims) + ld d, 0 -typedef struct { - unsigned char xy; - unsigned char ft; -} TILANIM; + ld a, (__n) + ld hl, _tilanims_xy + add hl, de + ld (hl), a -TILANIM tilanims [MAX_TILANIMS]; + ld a, (__t) + ld hl, _tilanims_ft + add hl, de + ld (hl), a -void add_tilanim (unsigned char x, unsigned char y, unsigned char t) { - tilanims [max_tilanims].xy = (x << 4) + y; - tilanims [max_tilanims].ft = t; - - ++ max_tilanims; + ld a, e + inc a + ld (_max_tilanims), a + #endasm } -unsigned char tait; -void do_tilanims (void) { - if (max_tilanims == 0) return; - - tacount = (tacount + 1) & UPDATE_FREQ; - if (!tacount) { - // Select tile - tait = rand () % max_tilanims; - - // Flip bit 7: - tilanims [tait].ft = tilanims [tait].ft ^ 128; +void tilanims_do (void) { + #asm + ld a, (_max_tilanims) + or a + ret z + + ld a, (_tait) + add TILANIMS_PRIME + cp MAX_TILANIMS + jr c, _tilanims_tait_0_skip + sub MAX_TILANIMS + ._tilanims_tait_0_skip + ld (_tait), a + + // Check counter for tilanim #tait + ld d, 0 + ld e, a + + // Check of active + ld hl, _tilanims_ft + add hl, de + ld a, (hl) + or a + ret z + + // Flip bit 7 + ld hl, _tilanims_ft + add hl, de + ld a, (hl) + xor 128 + ld (hl), a + + // Which tile? + bit 7, a + jr z, _tilanims_no_flick + + inc a + ._tilanims_no_flick + and 127 + ld (__t), a // Draw tile - _x = tilanims [tait].xy >> 4; - _y = tilanims [tait].xy & 15; - _t = (tilanims [tait].ft & 127) + (tilanims [tait].ft >> 7); - draw_invalidate_coloured_tile_gamearea (); - } + ld hl, _tilanims_xy + add hl, de + ld a, (hl) + ld c, a + srl a + srl a + srl a + and 0xfe + add VIEWPORT_X + ld (__x), a + + ld a, c + and 15 + sla a + add VIEWPORT_Y + ld (__y), a + + call _draw_coloured_tile + call _invalidate_tile + #endasm } diff --git a/examples/dogmole/dev/zcc_opt.def b/examples/dogmole/dev/zcc_opt.def deleted file mode 100644 index 3cbd4251..00000000 --- a/examples/dogmole/dev/zcc_opt.def +++ /dev/null @@ -1,8 +0,0 @@ - -IF !DEFINED_STACKPTR - defc DEFINED_STACKPTR = 1 - defc STACKPTR = 61936 -ENDIF - - DEFINE DEFINED_myzorg - defc myzorg = 24000 diff --git a/examples/dogmole/script/msc.h b/examples/dogmole/script/msc.h index 8d4b7f92..9cbb53b4 100644 --- a/examples/dogmole/script/msc.h +++ b/examples/dogmole/script/msc.h @@ -111,7 +111,7 @@ void run_script (unsigned char whichs) { // readxy (); // sc_terminado = (flags [sc_x] != sc_y); #asm - call _read_two_bytes_d_e + call _read_two_bytes_D_E // Set sc_terminado if flags [C] != E ld b, 0 ld c, d diff --git a/examples/dogmole_ci/bin/ending.bin b/examples/dogmole_ci/bin/ending.bin new file mode 100644 index 00000000..e32950a6 Binary files /dev/null and b/examples/dogmole_ci/bin/ending.bin differ diff --git a/examples/dogmole_ci/bin/marco.bin b/examples/dogmole_ci/bin/marco.bin new file mode 100644 index 00000000..62123e85 Binary files /dev/null and b/examples/dogmole_ci/bin/marco.bin differ diff --git a/examples/dogmole_ci/bin/title.bin b/examples/dogmole_ci/bin/title.bin new file mode 100644 index 00000000..fb2abb35 Binary files /dev/null and b/examples/dogmole_ci/bin/title.bin differ diff --git a/examples/dogmole_ci/dev/128k.h b/examples/dogmole_ci/dev/128k.h index 2f4b4b97..317fd7a2 100644 --- a/examples/dogmole_ci/dev/128k.h +++ b/examples/dogmole_ci/dev/128k.h @@ -6,99 +6,19 @@ void SetRAMBank(void) { #asm .SetRAMBank + ld a, b + or a + jp z, restISR + xor a + ld i, a + jp keepGoing + .restISR + ld a, $f0 + ld i, a + .keepGoing ld a, 16 or b ld bc, $7ffd out (C), a #endasm } -/* -// Esto lo empecé pero por ahora lo dejo aparcado :-/ -#ifdef MOVE_STUFF_TO_RAM_6 -typedef struct { - int x, y; - unsigned char x1, y1, x2, y2; - char mx, my; - char t; - unsigned char life; -} MALOTE; - -MALOTE malotes [3]; -MALOTE *malote_copy; - -void ram6_to_ram (void) { - // This function copies current screen data from RAM 6 to low RAM (new screen) - #asm - di - ld b, 6 - call SetRAMBank - #endasm - - // Map screen -#ifdef UNPACKED_MAP - map_pointer = 0xc000 + (n_pant * 150); -#else - map_pointer = 0xc000 + (n_pant * 75); -#endif - for (gpit = 0; gpit < 150; gpit ++) { -#ifdef UNPACKED_MAP - // Mapa tipo UNPACKED - gpd = *map_pointer ++; - map_buff [gpit] = gpd; -#else - // Mapa tipo PACKED - if (!(gpit & 1)) { - gpc = *map_pointer ++; - gpd = gpc >> 4; - } else { - gpd = gpc & 15; - } - map_buff [gpit] = gpd; -#endif - } - - // Enems - enoffs = n_pant * 3; -#ifdef UNPACKED_MAP - map_pointer = 0xc000 + MAP_W * MAP_H * 150 + 12 * enoffs; -#else - map_pointer = 0xc000 + MAP_W * MAP_H * 75 + 12 * enoffs; -#endif - malote_copy = malotes; - for (gpit = 0; gpit < 36; gpit ++) { - *malote_copy ++ = *map_pointer ++; - } - enoffs = 0; - - // Hotspots - // Bolts - - // Get back - #asm - di - ld b, 0 - call SetRAMBank - #endasm -} - -void ram_to_ram6 (void) { - // This function copies current screen data from low RAM to RAM 6 (update) - #asm - di - ld b, 6 - call SetRAMBank - #endasm - - // Enems - // Hotspots - // Bolts - - // Get back - #asm - di - ld b, 0 - call SetRAMBank - #endasm -} -#endif -*/ \ No newline at end of file diff --git a/examples/dogmole_ci/dev/aplib.h b/examples/dogmole_ci/dev/aplib.h index 88a31fda..11441f46 100644 --- a/examples/dogmole_ci/dev/aplib.h +++ b/examples/dogmole_ci/dev/aplib.h @@ -1,13 +1,6 @@ // MTE MK1 (la Churrera) v5.0 // Copyleft 2010-2014, 2020 by the Mojon Twins -unsigned int ram_address; -unsigned int ram_destination; - -#ifdef MODE_128K - unsigned char ram_page; -#endif - #asm ; aPPack decompressor diff --git a/examples/dogmole_ci/dev/assets/ay_fx_numbers.h b/examples/dogmole_ci/dev/assets/ay_fx_numbers.h index 411264ac..d1c0346e 100644 --- a/examples/dogmole_ci/dev/assets/ay_fx_numbers.h +++ b/examples/dogmole_ci/dev/assets/ay_fx_numbers.h @@ -1,20 +1,42 @@ // MTE MK1 (la Churrera) v5.0 // Copyleft 2010-2014, 2020 by the Mojon Twins -#define SFX_START 0 -#define SFX_BREAKABLE_HIT 1 -#define SFX_BREAKABLE_BREAK 2 -#define SFX_PUSH_BOX 3 -#define SFX_OPEN_LOCK 3 -#define SFX_SHOOT 4 -#define SFX_OBJECT_GET 5 -#define SFX_KILL_ENEMY_STEP 6 -#define SFX_KILL_ENEMY_SHOOT 6 -#define SFX_HIT_ENEMY 7 -#define SFX_ONE_OBJECT_GET 8 -#define SFX_ONE_OBJECT_WRONG 9 -#define SFX_KEY_GET 10 -#define SFX_REFILL_GET 11 -#define SFX_JUMP 12 -#define SFX_SPIKES 13 -#define SFX_ENEMY_HIT 14 +#ifdef USE_ARKOS_PLAYER + #define SFX_START 1 + #define SFX_BREAKABLE_HIT 1 + #define SFX_BREAKABLE_BREAK 2 + #define SFX_PUSH_BOX 3 + #define SFX_OPEN_LOCK 3 + #define SFX_SHOOT 4 + #define SFX_OBJECT_GET 5 + #define SFX_KILL_ENEMY_STEP 6 + #define SFX_KILL_ENEMY_SHOOT 6 + #define SFX_HIT_ENEMY 7 + #define SFX_ONE_OBJECT_GET 8 + #define SFX_ONE_OBJECT_WRONG 9 + #define SFX_KEY_GET 4 + #define SFX_REFILL_GET 11 + #define SFX_JUMP 2 + #define SFX_SPIKES 2 + #define SFX_ENEMY_HIT 8 + +#else + #define SFX_START 0 + #define SFX_BREAKABLE_HIT 1 + #define SFX_BREAKABLE_BREAK 2 + #define SFX_PUSH_BOX 3 + #define SFX_OPEN_LOCK 3 + #define SFX_SHOOT 4 + #define SFX_OBJECT_GET 5 + #define SFX_KILL_ENEMY_STEP 6 + #define SFX_KILL_ENEMY_SHOOT 6 + #define SFX_HIT_ENEMY 7 + #define SFX_ONE_OBJECT_GET 8 + #define SFX_ONE_OBJECT_WRONG 9 + #define SFX_KEY_GET 10 + #define SFX_REFILL_GET 11 + #define SFX_JUMP 12 + #define SFX_SPIKES 13 + #define SFX_ENEMY_HIT 14 + +#endif \ No newline at end of file diff --git a/examples/dogmole_ci/dev/assets/levels.h b/examples/dogmole_ci/dev/assets/levels.h index c601614a..bd29b455 100644 --- a/examples/dogmole_ci/dev/assets/levels.h +++ b/examples/dogmole_ci/dev/assets/levels.h @@ -14,7 +14,7 @@ // Map data, 75 or 150 * (MAP_W*MAP_H) bytes // Bolts, 32 * 4 = 128 bytes // Tileset, 2304 bytes -// Enemies, MAP_W * MAP_H * 3 * 10 bytes +// Enemies, MAP_W * MAP_H * MAX_ENEMS * 10 bytes // Hotspots, MAP_W * MAP_H * 3 bytes // Behs, 48 bytes // Spriteset, 2312 bytes @@ -64,7 +64,7 @@ extern unsigned char font [0]; ._font BINARY "font.bin" #endasm -extern LEVELHEADER level_data [0]; +extern LEVELHEADER level_data; #asm ._level_data defs 16 #endasm @@ -94,7 +94,7 @@ extern unsigned char tileset [0]; extern MALOTE malotes [0]; #asm - ._malotes defs MAP_W * MAP_H * 3 * 10 + ._malotes defs MAP_W * MAP_H * MAX_ENEMS * 10 #endasm extern HOTSPOT hotspots [0]; diff --git a/examples/dogmole_ci/dev/compile.bat b/examples/dogmole_ci/dev/compile.bat index 2c2f7ef7..0804e715 100644 --- a/examples/dogmole_ci/dev/compile.bat +++ b/examples/dogmole_ci/dev/compile.bat @@ -37,24 +37,65 @@ echo Importando GFX ..\..\..\src\utils\png2scr.exe ..\gfx\marco.png ..\gfx\marco.scr > nul ..\..\..\src\utils\png2scr.exe ..\gfx\ending.png ..\gfx\ending.scr > nul ..\..\..\src\utils\png2scr.exe ..\gfx\loading.png loading.bin > nul -..\..\..\src\utils\apultra.exe ..\gfx\title.scr title.bin > nul -..\..\..\src\utils\apultra.exe ..\gfx\marco.scr marco.bin > nul -..\..\..\src\utils\apultra.exe ..\gfx\ending.scr ending.bin > nul +..\..\..\src\utils\apultra.exe ..\gfx\title.scr ..\bin\title.bin > nul +..\..\..\src\utils\apultra.exe ..\gfx\marco.scr ..\bin\marco.bin > nul +..\..\..\src\utils\apultra.exe ..\gfx\ending.scr ..\bin\ending.bin > nul if [%1]==[justassets] goto :end +rem echo Running The Librarian +rem ..\utils\librarian2.exe list=..\bin\list.txt index=assets\librarian.h bins_prefix=..\bin\ rams_prefix=..\bin\ > nul + +rem *** Música AY: Descomenta el player que vayas a usar (Wyz o Arkos) *** + +rem echo Compilando musica 128k - Wyz Player +rem cd ..\mus +rem ..\utils\apultra.exe menu.mus menu.bin +rem ..\utils\apultra.exe level1.mus level1.bin +rem ..\utils\pasmo WYZproPlay47aZXc.ASM ..\bin\RAM1.bin +rem cd ..\dev + +rem echo Compilando musica 128k - Arkos Player +rem cd ..\mus_arkos +rem if [%1]==[nomus] goto :nomus +rem ..\utils\build_mus_bin.exe ram1.bin > nul +rem :nomus +rem copy ram1.bin ..\bin +rem copy arkos-addresses.h ..\dev\sound +rem cd ..\dev + :compile echo Compilando guego -zcc +zx -vn mk1.c -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul +zcc +zx -vn mk1.c -O3 -crt0=crt.asm -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul +rem zcc +zx -vn mk1.c -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul ..\..\..\src\utils\printsize.exe %game%.bin ..\..\..\src\utils\printsize.exe scripts.bin +rem *** Tipo de cargador *** + echo Construyendo cinta rem cambia LOADER por el nombre que quieres que salga en Program: ..\..\..\src\utils\bas2tap -a10 -sDOGMOLE loader\loader.bas loader.tap > nul ..\..\..\src\utils\bin2tap -o screen.tap -a 16384 loading.bin > nul ..\..\..\src\utils\bin2tap -o main.tap -a 24000 %game%.bin > nul copy /b loader.tap + screen.tap + main.tap %game%.tap > nul +rem echo Construyendo cinta 128k +rem ..\..\..\src\utils\imanol.exe ^ +rem in=loader\loaderzx.asm-orig ^ +rem out=loader\loader.asm ^ +rem ram1_length=?..\bin\RAM1.bin ^ +rem ram3_length=?..\bin\RAM3.bin ^ +rem mb_length=?%game%.bin > nul + +rem ..\utils\pasmo.exe loader\loader.asm ..\bin\loader.bin loader.txt + +rem cambia LOADER por el nombre que quieres que salga en Program: +rem ..\..\..\src\utils\GenTape.exe %game%.tap ^ +rem basic 'LOADER' 10 ..\bin\loader.bin ^ +rem data loading.bin ^ +rem data ..\bin\RAM1.bin ^ +rem data ..\bin\RAM3.bin ^ +rem data %game%.bin if [%1]==[justcompile] goto :end if [%1]==[noclean] goto :end diff --git a/examples/dogmole_ci/dev/crt.asm b/examples/dogmole_ci/dev/crt.asm new file mode 100644 index 00000000..27e0d47d --- /dev/null +++ b/examples/dogmole_ci/dev/crt.asm @@ -0,0 +1,17 @@ + MODULE zx82_crt0 + INCLUDE "zcc_opt.def" + XREF _main ; main() is always external to crt0 code + + IF !STACKPTR + defc STACKPTR = $FFFF + ENDIF + + IF !CRT_ORG_CODE + defc CRT_ORG_CODE = 32768 + ENDIF + + org CRT_ORG_CODE + +start: + ld sp,STACKPTR + jp _main diff --git a/examples/dogmole_ci/dev/definitions.h b/examples/dogmole_ci/dev/definitions.h index a15cd13b..38f3bd82 100644 --- a/examples/dogmole_ci/dev/definitions.h +++ b/examples/dogmole_ci/dev/definitions.h @@ -6,7 +6,8 @@ .fsClipStruct defb 0, 24, 0, 32 #endasm -void *joyfunc = sp_JoyKeyboard; // Puntero a la función de manejo seleccionada. +//void *joyfunc = sp_JoyKeyboard; // Puntero a la función de manejo seleccionada. +unsigned int (*joyfunc)(struct sp_UDK *) = sp_JoyKeyboard; const void *joyfuncs [] = { sp_JoyKeyboard, sp_JoyKempston, sp_JoySinclair1 @@ -31,8 +32,15 @@ void *u_free = sp_FreeBlock; // Safe stuff in low(est) RAM -unsigned char safe_byte @ 23296; +unsigned char safe_byte @ 23296; +unsigned int ram_address @ 23297; +unsigned int ram_destination @ 23299; + +#ifdef MODE_128K + unsigned char ram_page @ 23301; +#endif + // Globales muy globalizadas struct sp_SS *sp_player; @@ -49,7 +57,7 @@ unsigned char enoffs; // Aux char asm_number; -unsigned int asm_int; +unsigned int asm_int @ 23302; unsigned int asm_int_2; unsigned int seed; unsigned char half_life; @@ -111,7 +119,7 @@ unsigned char p_tx, p_ty; #endif signed int ptgmx, ptgmy; -const unsigned char *spacer = " "; +unsigned char *spacer = " "; unsigned char enit; @@ -173,7 +181,7 @@ unsigned char map_attr [150]; unsigned char map_buff [150] @ FREEPOOL; // Breakable walls/etc #ifdef BREAKABLE_WALLS - unsigned char brk_buff [150] @ 23297; + unsigned char brk_buff [150] @ 23296+16; #endif // posición del objeto (hotspot). Para no objeto, @@ -187,7 +195,7 @@ unsigned char hotspot_destroy; #ifndef MAX_FLAGS #define MAX_FLAGS 16 #endif -unsigned char flags[MAX_FLAGS]; +unsigned char flags[MAX_FLAGS]; // Globalized unsigned char o_pant; @@ -219,7 +227,7 @@ unsigned char maincounter; // Engine globals (for speed) & size! -unsigned char gpx, gpox, gpy, gpd, gpc, gpt; +unsigned char gpx, gpox, gpy, gpd, gpc; unsigned char gpxx, gpyy, gpcx, gpcy; unsigned char possee, hit_v, hit_h, hit, wall_h, wall_v; unsigned char gpen_x, gpen_y, gpen_cx, gpen_cy, gpaux; @@ -230,7 +238,7 @@ unsigned char *map_pointer; #ifdef PLAYER_CAN_FIRE unsigned char blx, bly; #endif -unsigned char rdx, rdy, rda, rdb, rdc, rdd, rdn; +unsigned char rdx, rdy, rda, rdb, rdc, rdd, rdn, rdt; // More stuff @@ -251,6 +259,7 @@ unsigned char objs_old, keys_old, life_old, killed_old; #ifdef COMPRESSED_LEVELS unsigned char *level_str = "LEVEL 0X"; + unsigned char silent_level = 0; #endif #ifdef GET_X_MORE @@ -271,12 +280,24 @@ unsigned char x0, y0, x1, y1; unsigned char ptx1, pty1, ptx2, pty2; unsigned char *_gp_gen; +#ifdef ENABLE_TILANIMS + unsigned char tait; + unsigned char max_tilanims; + unsigned char tacount; + unsigned char tilanims_xy [MAX_TILANIMS]; + unsigned char tilanims_ft [MAX_TILANIMS]; +#endif + +#if defined USE_AUTO_TILE_SHADOWS || defined USE_AUTO_SHADOWS || defined ENABLE_TILANIMS + unsigned char xx, yy; +#endif + #if defined USE_AUTO_TILE_SHADOWS || defined USE_AUTO_SHADOWS unsigned char c1, c2, c3, c4; unsigned char t1, t2, t3, t4; unsigned char nocast, _ta; - unsigned char xx, yy; #endif + #ifdef USE_AUTO_TILE_SHADOWS unsigned a1, a2, a3; unsigned char *gen_pt_alt; @@ -291,4 +312,7 @@ unsigned char *_gp_gen; #ifdef MODE_128K unsigned char song_playing = 0; + unsigned char player_on = 1; #endif + +unsigned char isrc; diff --git a/examples/dogmole_ci/dev/dogmole_ci.tap b/examples/dogmole_ci/dev/dogmole_ci.tap index b4a02b2e..04787613 100644 Binary files a/examples/dogmole_ci/dev/dogmole_ci.tap and b/examples/dogmole_ci/dev/dogmole_ci.tap differ diff --git a/examples/dogmole_ci/dev/engine.h b/examples/dogmole_ci/dev/engine.h index e89eb1a9..bbbbfb9f 100644 --- a/examples/dogmole_ci/dev/engine.h +++ b/examples/dogmole_ci/dev/engine.h @@ -153,7 +153,7 @@ void espera_activa (int espera) { // Sonido #ifdef MODE_128K - wyz_play_sound (SFX_PUSH_BOX); + PLAY_SOUND (SFX_PUSH_BOX); #else beep_fx (2); #endif @@ -182,7 +182,7 @@ void espera_activa (int espera) { -- p_keys; #ifdef MODE_128K - wyz_play_sound (SFX_OPEN_LOCK); + PLAY_SOUND (SFX_OPEN_LOCK); #else beep_fx (8); #endif @@ -290,6 +290,7 @@ void draw_scr_background (void) { add hl, bc ld (hl), a + #ifdef PACKED_MAP_ALT_TILE ld a, (__t) or a jr nz, _draw_scr_packed_noalt @@ -305,10 +306,12 @@ void draw_scr_background (void) { jr _draw_scr_packed_noalt ._draw_scr_packed_alt_subst - ld a, 19 + ld a, PACKED_MAP_ALT_TILE ld (__t), a ._draw_scr_packed_noalt + #endif + ld hl, _map_buff add hl, bc @@ -326,15 +329,15 @@ void draw_scr_background (void) { #endasm #endif - draw_coloured_tile (); - - #if defined ENABLE_TILANIMS && defined UNPACKED_MAP - // Detect tilanims + #ifdef ENABLE_TILANIMS if (_t >= ENABLE_TILANIMS) { - add_tilanim ((_x - VIEWPORT_X) >> 1, (_y - VIEWPORT_Y) >> 1, _t); + _n = (((_x - VIEWPORT_X) << 3) & 0xf0) | ((_y - VIEWPORT_Y) >> 1); + tilanims_add (); } #endif - + + draw_coloured_tile (); + //_x += 2; if (_x == VIEWPORT_X + 30) { _x = VIEWPORT_X; _y += 2; } #asm ld a, (__x) @@ -355,34 +358,7 @@ void draw_scr_background (void) { #endif } -void draw_scr (void) { - is_rendering = 1; - - #ifdef ENABLE_TILANIMS - max_tilanims = 0; - #endif - - #ifdef ENABLE_FIRE_ZONE - f_zone_ac = 0; - #endif - - draw_scr_background (); - - // Object setup - - enems_load (); - - #ifdef ACTIVATE_SCRIPTING - #if defined LINE_OF_TEXT && !defined LINE_OF_TEXT_NO_AUTOERASE - _x = LINE_OF_TEXT_X; _y = LINE_OF_TEXT; _t = LINE_OF_TEXT_ATTR; _gp_gen = " "; print_str (); - #endif - // Ejecutamos los scripts de entrar en pantalla: - run_script (2 * MAP_W * MAP_H + 1); // ENTERING ANY - run_script (n_pant << 1); // ENTERING SCREEN n - #endif - - #include "my/ci/entering_screen.h" - +void draw_scr_hotspots_locks (void) { /* hotspot_y = 240; rdx = (hotspots [n_pant].xy >> 4); @@ -534,6 +510,14 @@ void draw_scr (void) { cp c jr nz, _open_locks_done + // Remove x=y=np=0 pseudobug in multilevel games + #ifdef COMPRESSED_LEVELS + ld a, b + or d + or e + jr z, _open_locks_done + #endif + ._open_locks_do ld a, d ld (__x), a @@ -573,6 +557,37 @@ void draw_scr (void) { jr nz, _open_locks_loop #endasm #endif +} + +void draw_scr (void) { + is_rendering = 1; + + #ifdef ENABLE_TILANIMS + tilanims_reset (); + #endif + + #ifdef ENABLE_FIRE_ZONE + f_zone_ac = 0; + #endif + + draw_scr_background (); + + // Object setup + + enems_load (); + + #ifdef ACTIVATE_SCRIPTING + #if defined LINE_OF_TEXT && !defined LINE_OF_TEXT_NO_AUTOERASE + _x = LINE_OF_TEXT_X; _y = LINE_OF_TEXT; _t = LINE_OF_TEXT_ATTR; _gp_gen = " "; print_str (); + #endif + // Ejecutamos los scripts de entrar en pantalla: + run_script (2 * MAP_W * MAP_H + 1); // ENTERING ANY + run_script (n_pant << 1); // ENTERING SCREEN n + #endif + + #include "my/ci/entering_screen.h" + + draw_scr_hotspots_locks (); #ifdef PLAYER_CAN_FIRE bullets_init (); @@ -609,7 +624,8 @@ void select_joyfunc (void) { } #ifdef MODE_128K - wyz_play_sound (SFX_START); + STOP_SOUND (); + PLAY_SOUND (SFX_START); sp_WaitForNoKey (); #endif } diff --git a/examples/dogmole_ci/dev/engine/breakable.h b/examples/dogmole_ci/dev/engine/breakable.h index 81e191c1..01e9423f 100644 --- a/examples/dogmole_ci/dev/engine/breakable.h +++ b/examples/dogmole_ci/dev/engine/breakable.h @@ -16,14 +16,14 @@ void break_wall (void) { } else { _n = _t = 0; update_tile (); #ifdef MODE_128K - gpix = SFX_BREAKABLE_BREAK + gpit = SFX_BREAKABLE_BREAK; #else gpit = 0; #endif #include "my/ci/on_wall_broken.h" } #ifdef MODE_128K - wyz_play_sound (gpit); + PLAY_SOUND (gpit); #else // Show what just happened before the sound interrupts the action sp_UpdateNow (); diff --git a/examples/dogmole_ci/dev/engine/bullets.h b/examples/dogmole_ci/dev/engine/bullets.h index 4dda4259..2278b516 100644 --- a/examples/dogmole_ci/dev/engine/bullets.h +++ b/examples/dogmole_ci/dev/engine/bullets.h @@ -54,10 +54,11 @@ void bullets_fire (void) { #ifdef PLAYER_CAN_FIRE_FLAG if (flags [PLAYER_CAN_FIRE_FLAG] == 0) return; #endif + #ifdef MAX_AMMO if (!p_ammo) return; - -- p_ammo; #endif + // Buscamos una bala libre for (b_it = 0; b_it < MAX_BULLETS; ++ b_it) { if (bullets_estado [b_it] == 0) { @@ -165,7 +166,7 @@ void bullets_fire (void) { #endif #ifdef MODE_128K - wyz_play_sound (SFX_SHOOT); + PLAY_SOUND (SFX_SHOOT); #else beep_fx (6); #endif @@ -180,8 +181,12 @@ void bullets_fire (void) { #include "my/ci/on_player_fires.h" - bullets_update (); + bullets_update (); + #ifdef MAX_AMMO + -- p_ammo; + #endif + break; } } diff --git a/examples/dogmole_ci/dev/engine/c_levels.h b/examples/dogmole_ci/dev/engine/c_levels.h index 0a76ee0c..cbbaf91a 100644 --- a/examples/dogmole_ci/dev/engine/c_levels.h +++ b/examples/dogmole_ci/dev/engine/c_levels.h @@ -10,12 +10,12 @@ void prepare_level (void) { #endif { n_pant = level_data.scr_ini; - gpx = level_data->ini_x << 4; p_x = gpx << 6; - gpy = level_data->ini_y << 4; p_y = gpy << 6; + gpx = level_data.ini_x << 4; p_x = gpx << 6; + gpy = level_data.ini_y << 4; p_y = gpy << 6; } #ifdef ACTIVATE_SCRIPTING - main_script_offset = levels [level]->script_offset; + main_script_offset = levels [level].script_offset; #endif #else unpack ((unsigned int) levels [level].c_map_bolts, (unsigned int) (mapa)); @@ -24,11 +24,11 @@ void prepare_level (void) { unpack ((unsigned int) levels [level].c_behs, (unsigned int) (behs)); #ifdef PER_LEVEL_SPRITESET - unpack ((unsigned int) levels [level].c_sprites, (unsigned int) (sprites)); + unpack ((unsigned int) levels [level].c_sprites, (unsigned int) (sprites + 16)); #endif - level_data->map_w = levels.map_w; - level_data->map_h = levels.map_h; + level_data.map_w = levels [level].map_w; + level_data.map_h = levels [level].map_h; #ifdef ACTIVATE_SCRIPTING if (script_result != 3) diff --git a/examples/dogmole_ci/dev/engine/enem_mods/enem_type_pursuers.h b/examples/dogmole_ci/dev/engine/enem_mods/enem_type_pursuers.h index 7cd62b19..601aa01f 100644 --- a/examples/dogmole_ci/dev/engine/enem_mods/enem_type_pursuers.h +++ b/examples/dogmole_ci/dev/engine/enem_mods/enem_type_pursuers.h @@ -9,8 +9,8 @@ _en_x = _en_x1; _en_y = _en_y1; en_an_alive [enit] = 1; - en_an_rawv [enit] = 1 << (rand () % 5); - if (en_an_rawv [enit] > 4) en_an_rawv [enit] = 2; + en_an_rawv [enit] = 1 << (rand () & 3); + if (en_an_rawv [enit] > PURSUERS_MAX_V) en_an_rawv [enit] = 2; en_an_dead_row [enit] = 11 + (rand () & 7); #if defined(PLAYER_STEPS_ON_ENEMIES) || defined(PLAYER_CAN_FIRE) _en_life = ENEMIES_LIFE_GAUGE; diff --git a/examples/dogmole_ci/dev/engine/enem_mods/enem_type_pursuers_asm.h b/examples/dogmole_ci/dev/engine/enem_mods/enem_type_pursuers_asm.h index 6980b4b1..6ce2cc20 100644 --- a/examples/dogmole_ci/dev/engine/enem_mods/enem_type_pursuers_asm.h +++ b/examples/dogmole_ci/dev/engine/enem_mods/enem_type_pursuers_asm.h @@ -34,19 +34,21 @@ ld a, 1 ld (hl), a - // en_an_rawv [enit] = 1 << (rand () % 5); + // en_an_rawv [enit] = 1 << (rand () & 3); push bc call _rand // rand -> L - ld de, 5 - ex de, hl - call l_div // l_div :: DE / HL -> HL = cociente; DE = resto - ex de, hl // HL = resto + + ld a, l + and 3 + ld l, a + ld h, 0 + ld de, 1 call l_asl // l_asl :: DE << HL -> HL ld a, l pop bc - cp 5 + cp PURSUERS_MAX_V+1 jr c, _eij_rawv_set ld a, 2 diff --git a/examples/dogmole_ci/dev/engine/enengine.h b/examples/dogmole_ci/dev/engine/enengine.h index 17dddc2c..4acb013d 100644 --- a/examples/dogmole_ci/dev/engine/enengine.h +++ b/examples/dogmole_ci/dev/engine/enengine.h @@ -14,8 +14,8 @@ #if defined(PLAYER_STEPS_ON_ENEMIES) || defined (PLAYER_CAN_FIRE) void enems_init (void) { enit = 0; - while (enit < MAP_W * MAP_H * 3) { - malotes [enit].t = malotes [enit].t & 15; + while (enit < MAP_W * MAP_H * MAX_ENEMS) { + malotes [enit].t = malotes [enit].t & 0xEF; // Clear bit 4 #ifdef PLAYER_CAN_FIRE malotes [enit].life = ENEMIES_LIFE_GAUGE; #endif @@ -121,7 +121,7 @@ void enems_draw_current (void) { void enems_load (void) { // Movemos y cambiamos a los enemigos según el tipo que tengan - enoffs = n_pant * 3; + enoffs = n_pant * MAX_ENEMS; for (enit = 0; enit < MAX_ENEMS; ++ enit) { en_an_frame [enit] = 0; @@ -141,6 +141,10 @@ void enems_load (void) { #endif #endif + #include "my/ci/enems_custom_respawn.h" + + en_an_next_frame [enit] = sprite_18_a; + switch (malotes [enoffsmasi].t & 0x1f) { case 1: case 2: @@ -184,13 +188,8 @@ void enems_load (void) { #endif #include "my/ci/enems_load.h" - - default: - en_an_next_frame [enit] = sprite_18_a; } - malotes [enoffsmasi].t &= 0x1f; - #include "my/ci/enems_extra_mods.h" } } @@ -227,7 +226,7 @@ void enems_move (void) { ld hl, (_enoffsmasi) ld h, 0 - #ifdef PLAYER_CAN_FIRE + #if defined PLAYER_CAN_FIRE || defined COMPRESSED_LEVELS add hl, hl // x2 ld d, h ld e, l // DE = x2 @@ -284,6 +283,8 @@ void enems_move (void) { ld a, (hl) ld (__en_t), a + and 0x1f + ld (_rdt), a #ifdef PLAYER_CAN_FIRE inc hl @@ -316,7 +317,7 @@ void enems_move (void) { #endif #endif - switch (_en_t) { + switch (rdt) { case 1: case 2: case 3: @@ -326,7 +327,7 @@ void enems_move (void) { #endif #include "engine/enem_mods/enem_type_lineal.h" #ifdef ENABLE_ORTHOSHOOTERS - if (_en_t == 5) { + if (rdt == 5) { #include "engine/enem_mods/enem_type_orthoshooters.h" } #endif @@ -443,13 +444,13 @@ void enems_move (void) { // Step over enemy #ifdef PLAYER_CAN_STEP_ON_FLAG if (flags [PLAYER_CAN_STEP_ON_FLAG] != 0 && - gpy < _en_y - 2 && p_vy >= 0 && _en_t >= PLAYER_MIN_KILLABLE) + gpy < _en_y - 2 && p_vy >= 0 && rdt >= PLAYER_MIN_KILLABLE) #else - if (gpy < _en_y - 2 && p_vy >= 0 && _en_t >= PLAYER_MIN_KILLABLE) + if (gpy < _en_y - 2 && p_vy >= 0 && rdt >= PLAYER_MIN_KILLABLE) #endif { #ifdef MODE_128K - wyz_play_sound (SFX_KILL_ENEMY_STEP); + PLAY_SOUND (SFX_KILL_ENEMY_STEP); en_an_state [enit] = GENERAL_DYING; en_an_count [enit] = 12; en_an_next_frame [enit] = sprite_17_a; @@ -519,7 +520,7 @@ void enems_move (void) { #ifdef PLAYER_CAN_FIRE // Collide with bullets #ifdef FIRE_MIN_KILLABLE - if (_en_t >= FIRE_MIN_KILLABLE) + if (rdt >= FIRE_MIN_KILLABLE) #endif { for (gpjt = 0; gpjt < MAX_BULLETS; gpjt ++) { @@ -548,7 +549,7 @@ void enems_move (void) { #ifdef MODE_128K en_an_state [enit] = GENERAL_DYING; en_an_count [enit] = 12; - wyz_play_sound (SFX_KILL_ENEMY_SHOOT); + PLAY_SOUND (SFX_KILL_ENEMY_SHOOT); #else beep_fx (5); en_an_next_frame [enit] = sprite_18_a; @@ -562,7 +563,7 @@ void enems_move (void) { } #ifdef MODE_128K - wyz_play_sound (SFX_HIT_ENEMY); + PLAY_SOUND (SFX_HIT_ENEMY); #else beep_fx (1); #endif diff --git a/examples/dogmole_ci/dev/engine/hotspots.h b/examples/dogmole_ci/dev/engine/hotspots.h index 10f9978c..3a1b3223 100644 --- a/examples/dogmole_ci/dev/engine/hotspots.h +++ b/examples/dogmole_ci/dev/engine/hotspots.h @@ -25,13 +25,13 @@ void hotspots_do (void) { if (p_objs == 0) { p_objs ++; #ifdef MODE_128K - wyz_play_sound (SFX_ONE_OBJECT_GET); + PLAY_SOUND (SFX_ONE_OBJECT_GET); #else beep_fx (9); #endif } else { #ifdef MODE_128K - wyz_play_sound (SFX_ONE_OBJECT_WRONG); + PLAY_SOUND (SFX_ONE_OBJECT_WRONG); #else beep_fx (4); #endif @@ -45,7 +45,7 @@ void hotspots_do (void) { #endif #ifdef MODE_128K - wyz_play_sound (SFX_OBJECT_GET); + PLAY_SOUND (SFX_OBJECT_GET); #else beep_fx (9); #endif @@ -70,7 +70,7 @@ void hotspots_do (void) { case 2: p_keys ++; #ifdef MODE_128K - wyz_play_sound (SFX_KEY_GET); + PLAY_SOUND (SFX_KEY_GET); #else beep_fx (7); #endif @@ -83,7 +83,7 @@ void hotspots_do (void) { if (p_life > PLAYER_LIFE) p_life = PLAYER_LIFE; #ifdef MODE_128K - wyz_play_sound (SFX_REFILL_GET); + PLAY_SOUND (SFX_REFILL_GET); #else beep_fx (8); #endif @@ -97,7 +97,7 @@ void hotspots_do (void) { else p_ammo = MAX_AMMO; #ifdef MODE_128K - wyz_play_sound (SFX_REFILL_GET); + PLAY_SOUND (SFX_REFILL_GET); #else beep_fx (9); #endif @@ -111,7 +111,7 @@ void hotspots_do (void) { else timer_t = 99; #ifdef MODE_128K - wyz_play_sound (SFX_REFILL_GET); + PLAY_SOUND (SFX_REFILL_GET); #else beep_fx (7); #endif @@ -122,7 +122,7 @@ void hotspots_do (void) { case 6: mem_save (); #ifdef MODE_128K - wyz_play_sound (SFX_START); + PLAY_SOUND (SFX_START); #else beep_fx (7); #endif diff --git a/examples/dogmole_ci/dev/engine/isr.h b/examples/dogmole_ci/dev/engine/isr.h new file mode 100644 index 00000000..76b5bf4a --- /dev/null +++ b/examples/dogmole_ci/dev/engine/isr.h @@ -0,0 +1,15 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// Very simple ISR which counts frames. + +#asm + defw 0 // 2 bytes libres +#endasm + +void ISR (void) { + #asm + ld hl, _isrc + inc (hl) + #endasm +} diff --git a/examples/dogmole_ci/dev/engine/player.h b/examples/dogmole_ci/dev/engine/player.h index 7256df57..59844d68 100644 --- a/examples/dogmole_ci/dev/engine/player.h +++ b/examples/dogmole_ci/dev/engine/player.h @@ -28,17 +28,20 @@ void player_init (void) { #if !defined(COMPRESSED_LEVELS) || defined(REFILL_ME) p_life = PLAYER_LIFE; #endif - p_objs = 0; - p_keys = 0; - p_killed = 0; p_disparando = 0; - #ifdef MAX_AMMO - #ifdef INITIAL_AMMO - p_ammo = INITIAL_AMMO; - #else - p_ammo = MAX_AMMO; + + #ifndef NO_RESET_STATS + p_objs = 0; + p_keys = 0; + p_killed = 0; + #ifdef MAX_AMMO + #ifdef INITIAL_AMMO + p_ammo = INITIAL_AMMO; + #else + p_ammo = MAX_AMMO; + #endif #endif - #endif + #endif #ifdef TIMER_ENABLE timer_count = 0; @@ -283,6 +286,7 @@ unsigned char player_move (void) { // Collision, may set possee, hit_v + // Velocity positive (going downwards) player_calc_bounding_box (); hit_v = 0; @@ -400,7 +404,7 @@ unsigned char player_move (void) { p_saltando = 1; p_cont_salto = 0; #ifdef MODE_128K - wyz_play_sound (SFX_JUMP); + PLAY_SOUND (SFX_JUMP); #else beep_fx (3); #endif @@ -426,7 +430,7 @@ unsigned char player_move (void) { p_saltando = 1; p_cont_salto = 0; #ifdef MODE_128K - wyz_play_sound (SFX_JUMP); + PLAY_SOUND (SFX_JUMP); #else beep_fx (3); #endif @@ -446,43 +450,47 @@ unsigned char player_move (void) { // MOVEMENT IN THE HORIZONTAL AXIS // *************************************************************************** - if ( ! ((pad0 & sp_LEFT) == 0 || (pad0 & sp_RIGHT) == 0)) { - #ifdef PLAYER_GENITAL - p_facing_h = 0xff; - #endif - if (p_vx > 0) { - p_vx -= PLAYER_RX; - if (p_vx < 0) p_vx = 0; - } else if (p_vx < 0) { - p_vx += PLAYER_RX; - if (p_vx > 0) p_vx = 0; + #ifndef PLAYER_DISABLE_DEFAULT_HENG + if ( ! ((pad0 & sp_LEFT) == 0 || (pad0 & sp_RIGHT) == 0)) { + #ifdef PLAYER_GENITAL + p_facing_h = 0xff; + #endif + if (p_vx > 0) { + p_vx -= PLAYER_RX; + if (p_vx < 0) p_vx = 0; + } else if (p_vx < 0) { + p_vx += PLAYER_RX; + if (p_vx > 0) p_vx = 0; + } + wall_h = 0; } - wall_h = 0; - } - if ((pad0 & sp_LEFT) == 0) { - #ifdef PLAYER_GENITAL - p_facing_h = FACING_LEFT; - #endif - if (p_vx > -PLAYER_MAX_VX) { - #ifndef PLAYER_GENITAL - p_facing = 0; + if ((pad0 & sp_LEFT) == 0) { + #ifdef PLAYER_GENITAL + p_facing_h = FACING_LEFT; #endif - p_vx -= PLAYER_AX; + if (p_vx > -PLAYER_MAX_VX) { + #ifndef PLAYER_GENITAL + p_facing = 0; + #endif + p_vx -= PLAYER_AX; + } } - } - if ((pad0 & sp_RIGHT) == 0) { - #ifdef PLAYER_GENITAL - p_facing_h = FACING_RIGHT; - #endif - if (p_vx < PLAYER_MAX_VX) { - p_vx += PLAYER_AX; - #ifndef PLAYER_GENITAL - p_facing = 1; + if ((pad0 & sp_RIGHT) == 0) { + #ifdef PLAYER_GENITAL + p_facing_h = FACING_RIGHT; #endif + if (p_vx < PLAYER_MAX_VX) { + p_vx += PLAYER_AX; + #ifndef PLAYER_GENITAL + p_facing = 1; + #endif + } } - } + #endif + + #include "my/ci/custom_heng.h" p_x = p_x + p_vx; #ifndef PLAYER_GENITAL @@ -606,7 +614,7 @@ unsigned char player_move (void) { #elif defined (BOUNDING_BOX_8_CENTERED) cy1 = (gpy + 3) >> 4; #else - cy1 = gpy >> 3; + cy1 = (gpy - 1) >> 3; #endif if (attr (cx1, cy1) == 10) { @@ -636,7 +644,7 @@ unsigned char player_move (void) { #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) cx1 = (gpx + 3) >> 4; #else - cx1 = gpx >> 4; + cx1 = (gpx - 1) >> 4; #endif if (attr (cx1, cy1) == 10) { @@ -717,19 +725,19 @@ unsigned char player_move (void) { } } - p_next_frame = player_cells [p_facing + p_frame]; + p_next_frame = (unsigned char *) (player_cells [p_facing + p_frame]); #elif defined PLAYER_BOOTEE gpit = p_facing << 2; if (p_vy == 0) { - p_next_frame = player_cells [gpit]; + p_next_frame = (unsigned char *) (player_cells [gpit]); } else if (p_vy < 0) { - p_next_frame = player_cells [gpit + 1]; + p_next_frame = (unsigned char *) (player_cells [gpit + 1]); } else { - p_next_frame = player_cells [gpit + 2]; + p_next_frame = (unsigned char *) (player_cells [gpit + 2]); } #else if (!possee && !p_gotten) { - p_next_frame = player_cells [8 + p_facing]; + p_next_frame = (unsigned char *) (player_cells [8 + p_facing]); } else { gpit = p_facing << 2; if (p_vx == 0) { @@ -737,7 +745,7 @@ unsigned char player_move (void) { } else { rda = ((gpx + 4) >> 3) & 3; } - p_next_frame = player_cells [gpit + rda]; + p_next_frame = (unsigned char *) (player_cells [gpit + rda]); } #endif } @@ -752,7 +760,7 @@ void player_kill (unsigned char sound) { player_deplete (); #ifdef MODE_128K - wyz_play_sound (sound); + PLAY_SOUND (sound); #else beep_fx (sound); #endif diff --git a/examples/dogmole_ci/dev/engine/player_wip.h b/examples/dogmole_ci/dev/engine/player_wip.h new file mode 100644 index 00000000..815761a3 --- /dev/null +++ b/examples/dogmole_ci/dev/engine/player_wip.h @@ -0,0 +1,884 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// player.h + +void player_init (void) { + // Inicializa player con los valores iniciales + // (de ahí lo de inicializar). + + #ifndef COMPRESSED_LEVELS + gpx = PLAYER_INI_X << 4; p_x = gpx << 6; + gpy = PLAYER_INI_Y << 4; p_y = gpy << 6; + #endif + p_vy = 0; + p_vx = 0; + p_cont_salto = 1; + p_saltando = 0; + p_frame = 0; + p_subframe = 0; + #ifdef PLAYER_GENITAL + p_facing = FACING_DOWN; + p_facing_v = p_facing_h = 0xff; + #else + p_facing = 1; + #endif + p_estado = EST_NORMAL; + p_ct_estado = 0; + #if !defined(COMPRESSED_LEVELS) || defined(REFILL_ME) + p_life = PLAYER_LIFE; + #endif + p_objs = 0; + p_keys = 0; + p_killed = 0; + p_disparando = 0; + #ifdef MAX_AMMO + #ifdef INITIAL_AMMO + p_ammo = INITIAL_AMMO; + #else + p_ammo = MAX_AMMO; + #endif + #endif + + #ifdef TIMER_ENABLE + timer_count = 0; + timer_zero = 0; + #ifdef TIMER_LAPSE + timer_frames = TIMER_LAPSE; + #endif + #ifdef TIMER_INITIAL + timer_t = TIMER_INITIAL; + #endif + #ifdef TIMER_START + timer_on = 1; + #else + timer_on = 0; + #endif + #endif +} + +void player_calc_bounding_box (void) { + #if defined (BOUNDING_BOX_8_BOTTOM) + #asm + ld a, (_gpx) + add 4 + srl a + srl a + srl a + srl a + ld (_ptx1), a + ld a, (_gpx) + add 11 + srl a + srl a + srl a + srl a + ld (_ptx2), a + ld a, (_gpy) + add 8 + srl a + srl a + srl a + srl a + ld (_pty1), a + ld a, (_gpy) + add 15 + srl a + srl a + srl a + srl a + ld (_pty2), a + #endasm + #elif defined (BOUNDING_BOX_8_CENTERED) + #asm + ld a, (_gpx) + add 4 + srl a + srl a + srl a + srl a + ld (_ptx1), a + ld a, (_gpx) + add 11 + srl a + srl a + srl a + srl a + ld (_ptx2), a + ld a, (_gpy) + add 4 + srl a + srl a + srl a + srl a + ld (_pty1), a + ld a, (_gpy) + add 11 + srl a + srl a + srl a + srl a + ld (_pty2), a + #endasm + #else + #asm + ld a, (_gpx) + srl a + srl a + srl a + srl a + ld (_ptx1), a + ld a, (_gpx) + add 15 + srl a + srl a + srl a + srl a + ld (_ptx2), a + ld a, (_gpy) + srl a + srl a + srl a + srl a + ld (_pty1), a + ld a, (_gpy) + add 15 + srl a + srl a + srl a + srl a + ld (_pty2), a + #endasm + #endif +} + +unsigned char player_move (void) { + + // *************************************************************************** + // MOVEMENT IN THE VERTICAL AXIS + // *************************************************************************** + + #if !defined PLAYER_GENITAL || defined VENG_SELECTOR + + #if !defined PLAYER_DISABLE_GRAVITY + #if defined VENG_SELECTOR && defined PLAYER_VKEYS + if (veng_selector != VENG_KEYS) + #endif + { + // Do gravity + + #asm + ; Signed comparisons are hard + ; p_vy <= PLAYER_MAX_VY_CAYENDO - PLAYER_G + + ; We are going to take a shortcut. + ; If p_vy < 0, just add PLAYER_G. + ; If p_vy > 0, we can use unsigned comparition anyway. + + ld hl, (_p_vy) + bit 7, h + jr nz, _player_gravity_add ; < 0 + + ld de, PLAYER_MAX_VY_CAYENDO - PLAYER_G + or a + push hl + sbc hl, de + pop hl + jr nc, _player_gravity_maximum + + ._player_gravity_add + ld de, PLAYER_G + add hl, de + jr _player_gravity_vy_set + + ._player_gravity_maximum + ld hl, PLAYER_MAX_VY_CAYENDO + + ._player_gravity_vy_set + ld (_p_vy), hl + + ._player_gravity_done + + #ifdef PLAYER_CUMULATIVE_JUMP + ld a, (_p_jmp_on) + or a + jr nz, _player_gravity_p_gotten_done + #endif + + ld a, (_p_gotten) + or a + jr z, _player_gravity_p_gotten_done + + xor a + ld (_p_vy), a + + ._player_gravity_p_gotten_done + #endasm + } + #endif + #endif + + #if defined PLAYER_GENITAL || (defined VENG_SELECTOR && defined PLAYER_VKEYS) + + #if defined (VENG_SELECTOR) + if (veng_selector == VENG_KEYS ) + #endif + { + // Pad do + + if ( ! ((pad0 & sp_UP) == 0 || (pad0 & sp_DOWN) == 0)) { + p_facing_v = 0xff; + wall_v = 0; + if (p_vy > 0) { + p_vy -= PLAYER_RX; + if (p_vy < 0) p_vy = 0; + } else if (p_vy < 0) { + p_vy += PLAYER_RX; + if (p_vy > 0) p_vy = 0; + } + } + + if ((pad0 & sp_UP) == 0) { + p_facing_v = FACING_UP; + if (p_vy > -PLAYER_MAX_VX) p_vy -= PLAYER_AX; + } + + if ((pad0 & sp_DOWN) == 0) { + p_facing_v = FACING_DOWN; + if (p_vy < PLAYER_MAX_VX) p_vy += PLAYER_AX; + } + } + #endif + + #ifdef PLAYER_HAS_JETPAC + #ifdef VENG_SELECTOR + if (veng_selector == VENG_JETPAC) + #endif + { + if ((pad0 & sp_UP) == 0) { + p_vy -= PLAYER_INCR_JETPAC; + if (p_vy < -PLAYER_MAX_VY_JETPAC) p_vy = -PLAYER_MAX_VY_JETPAC; + + #include "my/ci/on_jetpac_boost.h" + + p_jetpac_on = 1; + } else p_jetpac_on = 0; + } + #endif + + #include "my/ci/custom_veng.h" + + p_y += p_vy; + + #if !defined (PLAYER_GENITAL) + if (p_gotten) p_y += ptgmy; + #endif + + // Safe + + if (p_y < 0) p_y = 0; + if (p_y > 9216) p_y = 9216; + + gpy = p_y >> 6; + + // Collision, may set possee, hit_v + + #asm + call _player_calc_bounding_box + + xor a + ld (_hit_v), a + + ld a, (_ptx1) + ld (_cx1), a + ld a, (_ptx2) + ld (_cx2), a + + // Calculate vertical velocity + + ld a, (_p_vy) + #if !defined (PLAYER_GENITAL) + ld c, a + ld a, (_ptgmy) + add c + #endif + + // Skip if not moving in the vertical axis + + or a + jp z, _va_collision_done + + // Check sign + + bit 7, a + jr z, _va_collision_vy_positive + + ._va_collision_vy_negative + + // Velocity negative (going upwards) + + ld a, (_pty1) + ld (_cy1), a + ld (_cy2), a + + call _cm_two_points + + // if ((at1 & 8) || (at2 & 8)) { + ld a, (_at1) + and 8 + jr nz, _va_col_vy_neg_do + + ld a, (_at2) + and 8 + jr z, _va_collision_checkevil + + ._va_col_vy_neg_do + + #ifdef PLAYER_BOUNCE_WITH_WALLS + ld a, (_p_vy) + sra a + neg a + #else + xor a + #endif + ld (_p_vy), a + + ld a, (_pty1) + inc a + sla a + sla a + sla a + sla a + + #if defined (BOUNDING_BOX_8_BOTTOM) + // gpy = ((pty1 + 1) << 4) - 8; + sub 8 + #elif defined (BOUNDING_BOX_8_CENTERED) + // gpy = ((pty1 + 1) << 4) - 4; + sub 4 + #elif defined (BOUNDING_BOX_TINY_BOTTOM) + // gpy = ((pty1 + 1) << 4) - 14; + sub 14 + #else + // gpy = ((pty1 + 1) << 4); + #endif + + ld (_gpy), a + + // p_y = gpy << FIXBITS; 16 bits shift + ld d, 0 + ld e, a + ld l, FIXBITS + call l_asl + ld (_p_y), hl + + #if defined PLAYER_GENITAL || defined LOCKS_CHECK_VERTICAL + ld a, WTOP + ld (_wall_v), a + #endif + + jr _va_collision_checkevil + + ._va_collision_vy_positive + + // Velocity positive (going downwards) + ld a, (_pty2) + ld (_cy1), a + ld (_cy2), a + + call _cm_two_points + + #ifdef PLAYER_GENITAL + // if ((at1 & 8) || (at2 & 8)) { + ld a, (_at1) + and 8 + jr nz, _va_col_vy_pos_do + + ld a, (_at2) + and 8 + jr z, _va_collision_checkevil + #else + // if ((at1 & 8) || + ld a, (_at1) + and 8 + jr nz, _va_col_vy_pos_do + + // (at2 & 8) || + ld a, (_at2) + and 8 + jr nz, _va_col_vy_pos_do + + // (((gpy - 1) & 15) < 8 && + ld a, (_gpy) + dec a + and 15 + cp 8 + jr nc, _va_collision_checkevil + + // ((at1 & 4) || (at2 & 4)))) + ld a, (_at1) + and 4 + jr nz, _va_col_vy_pos_do + + ld a, (_at2) + and 4 + jr z, _va_collision_checkevil + #endif + ._va_col_vy_pos_do + + #ifdef PLAYER_BOUNCE_WITH_WALLS + ld a, (_p_vy) + sra a + neg a + #else + xor a + #endif + ld (_p_vy), a + + ld a, (_pty2) + dec a + sla a + sla a + sla a + sla a + + #ifdef BOUNDING_BOX_8_CENTERED + add 4 + #endif + + ld (_gpy), a + + // p_y = gpy << FIXBITS; 16 bits shift + ld d, 0 + ld e, a + ld l, FIXBITS + call l_asl + ld (_p_y), hl + + #if defined PLAYER_GENITAL || defined LOCKS_CHECK_VERTICAL + ld a, WBOTTOM + ld (_wall_v), a + #endif + + jr _va_collision_done + + ._va_collision_checkevil + + #ifndef DEACTIVATE_EVIL_TILE + #endasm + hit_v = ((at1 & 1) || (at2 & 1)); + #asm + #endif + + ._va_collision_done + #endasm + + gpxx = gpx >> 4; + gpyy = gpy >> 4; + + #ifndef PLAYER_GENITAL + cy1 = cy2 = (gpy + 16) >> 4; + cx1 = ptx1; cx2 = ptx2; + cm_two_points (); + possee = ((at1 & 12) || (at2 & 12)) && (gpy & 15) < 8; + #endif + + // Jump + + #ifdef PLAYER_HAS_JUMP + #ifdef VENG_SELECTOR + if (veng_selector == VENG_JUMP) + #endif + { + #if defined (PLAYER_CAN_FIRE) && !defined (USE_TWO_BUTTONS) + rda = (pad0 & sp_UP) == 0; + #elif defined (PLAYER_CAN_FIRE) && defined (USE_TWO_BUTTONS) + rda = isJoy ? ((pad0 & sp_UP) == 0) : (sp_KeyPressed (key_jump)); + #else + rda = (pad0 & sp_FIRE) == 0; + #endif + + if (rda) { + if (p_saltando == 0) { + if (possee || p_gotten || hit_v) { + p_saltando = 1; + p_cont_salto = 0; + #ifdef MODE_128K + PLAY_SOUND (SFX_JUMP); + #else + beep_fx (3); + #endif + } + } else { + p_vy -= (PLAYER_VY_INICIAL_SALTO + PLAYER_INCR_SALTO - (p_cont_salto >> 1)); + if (p_vy < -PLAYER_MAX_VY_SALTANDO) p_vy = -PLAYER_MAX_VY_SALTANDO; + ++ p_cont_salto; + if (p_cont_salto == 9) p_saltando = 0; + } + } else p_saltando = 0; + } + #endif + + // Bootee engine + + #ifdef PLAYER_BOOTEE + #ifdef VENG_SELECTOR + if (veng_selector == VENG_BOOTEE) + #endif + { + if ( p_saltando == 0 && (possee || p_gotten || hit_v) ) { + p_saltando = 1; + p_cont_salto = 0; + #ifdef MODE_128K + PLAY_SOUND (SFX_JUMP); + #else + beep_fx (3); + #endif + } + + if (p_saltando ) { + p_vy -= (PLAYER_VY_INICIAL_SALTO + PLAYER_INCR_SALTO - (p_cont_salto>>1)); + if (p_vy < -PLAYER_MAX_VY_SALTANDO) p_vy = -PLAYER_MAX_VY_SALTANDO; + ++ p_cont_salto; + if (p_cont_salto == 8) + p_saltando = 0; + } + } + #endif + + // *************************************************************************** + // MOVEMENT IN THE HORIZONTAL AXIS + // *************************************************************************** + + #ifndef PLAYER_DISABLE_DEFAULT_HENG + if ( ! ((pad0 & sp_LEFT) == 0 || (pad0 & sp_RIGHT) == 0)) { + #ifdef PLAYER_GENITAL + p_facing_h = 0xff; + #endif + if (p_vx > 0) { + p_vx -= PLAYER_RX; + if (p_vx < 0) p_vx = 0; + } else if (p_vx < 0) { + p_vx += PLAYER_RX; + if (p_vx > 0) p_vx = 0; + } + wall_h = 0; + } + + if ((pad0 & sp_LEFT) == 0) { + #ifdef PLAYER_GENITAL + p_facing_h = FACING_LEFT; + #endif + if (p_vx > -PLAYER_MAX_VX) { + #ifndef PLAYER_GENITAL + p_facing = 0; + #endif + p_vx -= PLAYER_AX; + } + } + + if ((pad0 & sp_RIGHT) == 0) { + #ifdef PLAYER_GENITAL + p_facing_h = FACING_RIGHT; + #endif + if (p_vx < PLAYER_MAX_VX) { + p_vx += PLAYER_AX; + #ifndef PLAYER_GENITAL + p_facing = 1; + #endif + } + } + #endif + + #include "my/ci/custom_heng.h" + + p_x = p_x + p_vx; + #ifndef PLAYER_GENITAL + p_x += ptgmx; + #endif + + // Safe + + if (p_x < 0) p_x = 0; + if (p_x > 14336) p_x = 14336; + + gpox = gpx; + gpx = p_x >> 6; + + // Collision. May set hit_h + player_calc_bounding_box (); + + hit_h = 0; + cy1 = pty1; cy2 = pty2; + + #if defined (PLAYER_GENITAL) + if (p_vx < 0) + #else + if (p_vx + ptgmx < 0) + #endif + { + cx1 = cx2 = ptx1; + cm_two_points (); + + if ((at1 & 8) || (at2 & 8)) { + #include "my/ci/bg_collision/obstacle_left.h" + + #ifdef PLAYER_BOUNCE_WITH_WALLS + p_vx = -(p_vx / 2); + #else + p_vx = 0; + #endif + + #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) || defined (BOUNDING_BOX_TINY_BOTTOM) + gpx = ((ptx1 + 1) << 4) - 4; + #else + gpx = ((ptx1 + 1) << 4); + #endif + + p_x = gpx << 6; + wall_h = WLEFT; + } + #ifndef DEACTIVATE_EVIL_TILE + else hit_h = ((at1 & 1) || (at2 & 1)); + #endif + + } + + #if defined (PLAYER_GENITAL) + if (p_vx > 0) + #else + if (p_vx + ptgmx > 0) + #endif + { + cx1 = cx2 = ptx2; + cm_two_points (); + + if ((at1 & 8) || (at2 & 8)) { + #include "my/ci/bg_collision/obstacle_right.h" + + #ifdef PLAYER_BOUNCE_WITH_WALLS + p_vx = -(p_vx / 2); + #else + p_vx = 0; + #endif + + #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) || defined (BOUNDING_BOX_TINY_BOTTOM) + gpx = (ptx1 << 4) + 4; + #else + gpx = (ptx1 << 4); + #endif + + p_x = gpx << 6; + wall_h = WRIGHT; + } + #ifndef DEACTIVATE_EVIL_TILE + else hit_h = ((at1 & 1) || (at2 & 1)); + #endif + + } + + // Priority to decide facing + + #ifdef PLAYER_GENITAL + #ifdef TOP_OVER_SIDE + if (p_facing_v != 0xff) { + p_facing = p_facing_v; + } else if (p_facing_h != 0xff) { + p_facing = p_facing_h; + } + #else + if (p_facing_h != 0xff) { + p_facing = p_facing_h; + } else if (p_facing_v != 0xff) { + p_facing = p_facing_v; + } + #endif + #endif + + cx1 = p_tx = (gpx + 8) >> 4; + cy1 = p_ty = (gpy + 8) >> 4; + + rdb = attr (cx1, cy1); + + // Special tiles + if (rdb & 128) { + #include "my/ci/on_special_tile.h" + } + + #if defined (PLAYER_PUSH_BOXES) || !defined (DEACTIVATE_KEYS) + #if defined PLAYER_GENITAL || defined LOCKS_CHECK_VERTICAL + if (wall_v == WTOP) { + // interact up + #if defined (BOUNDING_BOX_8_BOTTOM) + cy1 = (gpy + 7) >> 4; + #elif defined (BOUNDING_BOX_8_CENTERED) + cy1 = (gpy + 3) >> 4; + #else + cy1 = (gpy - 1) >> 3; + #endif + + if (attr (cx1, cy1) == 10) { + x0 = x1 = cx1; y0 = cy1; y1 = cy1 - 1; + process_tile (); + } + + } else if (wall_v == WBOTTOM) { + // interact down + #if defined (BOUNDING_BOX_8_BOTTOM) + cy1 = (gpy + 16) >> 4; + #elif defined (BOUNDING_BOX_8_CENTERED) + cy1 = (gpy + 12) >> 4; + #else + cy1 = (gpy + 16) >> 3; + #endif + + if (attr (cx1, cy1) == 10) { + x0 = x1 = cx1; y0 = cy1; y1 = cy1 + 1; + process_tile (); + } + } else + #endif + + if (wall_h == WLEFT) { + // interact left + #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) + cx1 = (gpx + 3) >> 4; + #else + cx1 = (gpx - 1) >> 4; + #endif + + if (attr (cx1, cy1) == 10) { + y0 = y1 = cy1; x0 = cx1; x1 = cx1 - 1; + process_tile (); + } + } else if (wall_h == WRIGHT) { + // interact right + #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) + cx1 = (gpx + 12) >> 4; + #else + cx1 = (gpx + 16) >> 4; + #endif + if (attr (cx1, cy1) == 10) { + y0 = y1 = cy1; x0 = cx1; x1 = cx1 + 1; + process_tile (); + } + } + #endif + + #ifdef PLAYER_CAN_FIRE + // Disparos + if ((pad0 & sp_FIRE) == 0 && p_disparando == 0) { + p_disparando = 1; + #ifdef FIRE_TO_PUSH + //if (pushed_any == 0) + #endif + bullets_fire (); + #ifdef FIRE_TO_PUSH + //else pushed_any = 0; + #endif + } + + if ((pad0 & sp_FIRE)) + p_disparando = 0; + + #endif + + #ifndef DEACTIVATE_EVIL_TILE + // Tiles que te matan. + // hit_v tiene preferencia sobre hit_h + hit = 0; + if (hit_v) { + hit = 1; + p_vy = addsign (-p_vy, PLAYER_MAX_VX); + } else if (hit_h) { + hit = 1; + p_vx = addsign (-p_vx, PLAYER_MAX_VX); + } + + if (hit) { + #ifdef PLAYER_FLICKERS + if (p_estado == EST_NORMAL) + #endif + { + #ifdef MODE_128K + p_killme = SFX_SPIKES; + #else + p_killme = 4; + #endif + } + } + #endif + + // Select animation frame + + #ifdef PLAYER_CUSTOM_ANIMATION + #include "my/custom_animation.h" + #elif defined PLAYER_GENITAL + if (p_vx || p_vy) { + ++ p_subframe; + if (p_subframe == 4) { + p_subframe = 0; + p_frame = !p_frame; + #ifdef PLAYER_STEP_SOUND + step (); + #endif + } + } + + p_next_frame = player_cells [p_facing + p_frame]; + #elif defined PLAYER_BOOTEE + gpit = p_facing << 2; + if (p_vy == 0) { + p_next_frame = player_cells [gpit]; + } else if (p_vy < 0) { + p_next_frame = player_cells [gpit + 1]; + } else { + p_next_frame = player_cells [gpit + 2]; + } + #else + if (!possee && !p_gotten) { + p_next_frame = player_cells [8 + p_facing]; + } else { + gpit = p_facing << 2; + if (p_vx == 0) { + rda = 1; + } else { + rda = ((gpx + 4) >> 3) & 3; + } + p_next_frame = player_cells [gpit + rda]; + } + #endif +} + +void player_deplete (void) { + p_life = (p_life > p_kill_amt) ? p_life - p_kill_amt : 0; +} + +void player_kill (unsigned char sound) { + p_killme = 0; + + player_deplete (); + + #ifdef MODE_128K + PLAY_SOUND (sound); + #else + beep_fx (sound); + #endif + + #ifdef CP_RESET_WHEN_DYING + #ifdef CP_RESET_ALSO_FLAGS + mem_load (); + #else + n_pant = sg_pool [MAX_FLAGS]; + p_x = sg_pool [MAX_FLAGS + 1] << 10; + p_y = sg_pool [MAX_FLAGS + 2] << 10; + #endif + o_pant = 0xff; // Reload + #endif + + #ifdef PLAYER_FLICKERS + p_estado = EST_PARP; + p_ct_estado = 50; + #endif +} + diff --git a/examples/dogmole_ci/dev/engine/simple_cocos.h b/examples/dogmole_ci/dev/engine/simple_cocos.h index 1c33a2a5..5a4da667 100644 --- a/examples/dogmole_ci/dev/engine/simple_cocos.h +++ b/examples/dogmole_ci/dev/engine/simple_cocos.h @@ -100,7 +100,71 @@ void simple_coco_update (void) { // Check collision (player) - // Check collision (BG) + #ifdef PLAYER_FLICKERS + ld a, (_p_estado) + or a + jr nz, _simple_coco_update_continue + #endif + + // rdx + 3 >= gpx && rdx + 3 <= gpx + 15 && + // rdx + 3 >= gpx && rdx <= gpx + 12 + + // rdx + 3 >= gpx + ld a, (_gpx) + ld c, a + ld a, (_rdx) + add 3 + cp c + jr c, _simple_coco_update_collpl_done + + // gpx + 12 >= rdx + ld a, (_rdx) + ld c, a + ld a, (_gpx) + add 12 + cp c + jr c, _simple_coco_update_collpl_done + + // rdy + 3 >= gpy && rdy + 3 <= gpy + 15 + // rdy + 3 >= gpy && rdy <= gpy + 12 + + // rdy + 3 >= gpy + ld a, (_gpy) + ld c, a + ld a, (_rdy) + add 3 + cp c + jr c, _simple_coco_update_collpl_done + + // gpy + 12 >= rdy + ld a, (_rdy) + ld c, a + ld a, (_gpy) + add 12 + cp c + jr c, _simple_coco_update_collpl_done + + // Kill player + ld a, 0xff + ld (_rdy), a // This effectively marks the coco for destruction + + #ifdef MODE_128K + ld a, SFX_ENEMY_HIT + #else + ld a, 4 + #endif + ld (_p_killme), a + + jr _simple_coco_update_continue + + ._simple_coco_update_collpl_done + + #endasm + + // Check collision (BG) + if (attr ((rdx + 3) >> 4, (rdy + 3) >> 4) & 12) rdy = 0xff; + + #asm ._simple_coco_update_continue // And update arrays diff --git a/examples/dogmole_ci/dev/mainloop.h b/examples/dogmole_ci/dev/mainloop.h index 96c8fd4b..9875ead0 100644 --- a/examples/dogmole_ci/dev/mainloop.h +++ b/examples/dogmole_ci/dev/mainloop.h @@ -12,7 +12,7 @@ void main (void) { di #endasm - #ifdef MODE_128K + #if defined MODE_128K || defined MIN_FAPS_PER_FRAME sp_InitIM2(0xf1f1); sp_CreateGenericISR(0xf1f1); sp_RegisterHook(255, ISR); @@ -20,8 +20,15 @@ void main (void) { #asm ei #endasm + #endif + + #ifdef MODE_128K + #ifdef USE_ARKOS_PLAYER + arkos_stop(); + #else + wyz_init (); + #endif - wyz_init (); #endif cortina (); @@ -48,13 +55,13 @@ void main (void) { // Sprite creation #ifdef NO_MASKS - sp_player = sp_CreateSpr (sp_OR_SPRITE, 3, sprite_2_a); + sp_player = sp_CreateSpr (NO_MASKS, 3, sprite_2_a); sp_AddColSpr (sp_player, sprite_2_b); sp_AddColSpr (sp_player, sprite_2_c); p_current_frame = p_next_frame = sprite_2_a; - for (gpit = 0; gpit < 3; gpit ++) { - sp_moviles [gpit] = sp_CreateSpr(sp_OR_SPRITE, 3, sprite_9_a); + for (gpit = 0; gpit < MAX_ENEMS; gpit ++) { + sp_moviles [gpit] = sp_CreateSpr(NO_MASKS, 3, sprite_9_a); sp_AddColSpr (sp_moviles [gpit], sprite_9_b); sp_AddColSpr (sp_moviles [gpit], sprite_9_c); en_an_current_frame [gpit] = sprite_9_a; @@ -98,7 +105,7 @@ void main (void) { #include "my/ci/after_load.h" while (1) { - #ifdef ACTIVATE_SCRIPTING + #if defined ACTIVATE_SCRIPTING && !defined MODE_128K main_script_offset = (int) (main_script); #endif @@ -114,7 +121,22 @@ void main (void) { #include "my/ci/before_game.h" + #ifdef NO_RESET_STATS + p_objs = 0; + p_keys = 0; + p_killed = 0; + #ifdef MAX_AMMO + #ifdef INITIAL_AMMO + p_ammo = INITIAL_AMMO; + #else + p_ammo = MAX_AMMO; + #endif + #endif + #endif + #ifdef COMPRESSED_LEVELS + silent_level = 0; + #ifdef ENABLE_CHECKPOINTS if (sg_do_load) level = sg_level; else level = 0; #endif @@ -134,9 +156,12 @@ void main (void) { { #ifdef COMPRESSED_LEVELS - #include "my/level_screen.h" + if (silent_level == 0) { + #include "my/level_screen.h" + } + silent_level = 0; - prepare_level (level); + prepare_level (); #endif #ifndef DIRECT_TO_PLAY @@ -161,17 +186,19 @@ void main (void) { #ifdef COMPRESSED_LEVELS if (success) { #ifdef MODE_128K - //wyz_play_music (6); + //PLAY_MUSIC (6); #endif - zone_clear (); + if (silent_level == 0) zone_clear (); #ifdef ACTIVATE_SCRIPTING if (script_result != 3) #else if (warp_to_level == 0) #endif - ++ level; + { + level ++; + } if (level >= MAX_LEVELS #ifdef ACTIVATE_SCRIPTING @@ -183,7 +210,7 @@ void main (void) { } } else { #ifdef MODE_128K - //wyz_play_music (8); + //PLAY_MUSIC (8); #endif #if defined(TIMER_ENABLE) && defined(TIMER_GAMEOVER_0) && defined(SHOW_TIMER_OVER) @@ -193,7 +220,7 @@ void main (void) { #endif #ifdef MODE_128K - wyz_stop_sound (); + STOP_SOUND (); #endif break; } @@ -201,11 +228,13 @@ void main (void) { if (success) { game_ending (); } else { - //wyz_play_music (8); + //PLAY_MUSIC (8); game_over (); } #endif - cortina (); + #if !defined (DIRECT_TO_PLAY) || !defined (COMPRESSED_LEVELS) + cortina (); + #endif } clear_sprites (); diff --git a/examples/dogmole_ci/dev/mainloop/flick_screen.h b/examples/dogmole_ci/dev/mainloop/flick_screen.h index c1c039b9..97b4515c 100644 --- a/examples/dogmole_ci/dev/mainloop/flick_screen.h +++ b/examples/dogmole_ci/dev/mainloop/flick_screen.h @@ -13,7 +13,7 @@ } #if defined (COMPRESSED_LEVELS) - if (gpx == 224 && p_vx > 0 && x_pant < (level_data->map_w - 1)) + if (gpx == 224 && p_vx > 0 && x_pant < (level_data.map_w - 1)) #else if (gpx == 224 && p_vx > 0 && x_pant < (MAP_W - 1)) #endif @@ -27,7 +27,7 @@ #if MAP_H > 1 if (gpy == 0 && p_vy < 0 && y_pant > 0) { #if defined (COMPRESSED_LEVELS) - n_pant -= level_data->map_w; + n_pant -= level_data.map_w; #else n_pant -= MAP_W; #endif @@ -37,8 +37,8 @@ } #if defined (COMPRESSED_LEVELS) - if (gpy == 144 && p_vy > 0 && y_pant < (level_data->map_h - 1)) { - n_pant += level_data->map_w; + if (gpy == 144 && p_vy > 0 && y_pant < (level_data.map_h - 1)) { + n_pant += level_data.map_w; #else if (gpy == 144 && p_vy > 0 && y_pant < (MAP_H - 1)) { n_pant += MAP_W; @@ -62,8 +62,8 @@ #if MAP_H > 1 #if defined (COMPRESSED_LEVELS) - if (gpy == 0 && p_vy < 0 && n_pant >= level_data->map_w) { - n_pant -= level_data->map_w; + if (gpy == 0 && p_vy < 0 && n_pant >= level_data.map_w) { + n_pant -= level_data.map_w; #else if (gpy == 0 && p_vy < 0 && n_pant >= MAP_W) { n_pant -= MAP_W; @@ -74,8 +74,8 @@ if (gpy == 144 && p_vy > 0) { // 9216 = 144 * 64 #if defined (COMPRESSED_LEVELS) - if (n_pant < level_data->map_w * (level_data->map_h - 1)) { - n_pant += level_data->map_w; + if (n_pant < level_data.map_w * (level_data.map_h - 1)) { + n_pant += level_data.map_w; #else if (n_pant < MAP_W * MAP_H - MAP_W) { n_pant += MAP_W; diff --git a/examples/dogmole_ci/dev/mainloop/game_loop.h b/examples/dogmole_ci/dev/mainloop/game_loop.h index e5442d9e..3f59e563 100644 --- a/examples/dogmole_ci/dev/mainloop/game_loop.h +++ b/examples/dogmole_ci/dev/mainloop/game_loop.h @@ -3,9 +3,18 @@ // game_loop.h - Da game loop. + #asm + ; Makes debugging easier + ._game_loop_init + #endasm + playing = 1; player_init (); + #ifdef OBJECT_COUNT + flags [OBJECT_COUNT] = p_objs; + #endif + #ifndef COMPRESSED_LEVELS hotspots_init (); #endif @@ -35,9 +44,9 @@ #ifdef MODE_128K // Play music #ifdef COMPRESSED_LEVELS - wyz_play_music (levels [level].music_id); + PLAY_MUSIC (levels [level].music_id); #else - wyz_play_music (1); + PLAY_MUSIC (1); #endif #endif @@ -67,8 +76,8 @@ #ifdef PLAYER_CHECK_MAP_BOUNDARIES #ifdef COMPRESSED_LEVELS - x_pant = n_pant % level_data->map_w; - y_pant = n_pant / level_data->map_w; + x_pant = n_pant % level_data.map_w; + y_pant = n_pant / level_data.map_w; #else x_pant = n_pant % MAP_W; y_pant = n_pant / MAP_W; #endif @@ -86,6 +95,11 @@ o_pant = 0xff; while (playing) { + #asm + ; Makes debugging easier + ._game_loop_do + #endasm + #ifdef DEBUG_KEYS if (sp_KeyPressed (KEY_M)) { ++ p_objs; beep_fx (0); } if (sp_KeyPressed (KEY_H)) { ++ n_pant; beep_fx (0); } @@ -176,7 +190,12 @@ simple_coco_update (); #endif - if (p_killme) player_kill (p_killme); + if (p_killme) { + if (p_life) { + player_kill (p_killme); + #include "my/ci/on_player_killed.h" + } else playing = 0; + } #ifdef PLAYER_CAN_FIRE // Move bullets @@ -184,7 +203,7 @@ #endif #ifdef ENABLE_TILANIMS - do_tilanims (); + tilanims_do (); #endif // Detect fire zone @@ -200,6 +219,23 @@ if (o_pant == n_pant) { #include "mainloop/update_sprites.h" + // Limit frame rate + + #ifdef MIN_FAPS_PER_FRAME + #asm + .ml_min_faps_loop + ld a, (_isrc) + cp MIN_FAPS_PER_FRAME + jr nc, ml_min_faps_loop_end + halt + jr ml_min_faps_loop + + .ml_min_faps_loop_end + xor a + ld (_isrc), a + #endasm + #endif + sp_UpdateNow(); } @@ -223,7 +259,7 @@ if (sp_KeyPressed (KEY_Z)) { if (!key_z_pressed) { #ifdef MODE_128K - wyz_play_sound (0); + PLAY_SOUND (0); #else beep_fx (2); #endif @@ -258,8 +294,7 @@ if (sp_KeyPressed (KEY_H)) { sp_WaitForNoKey (); #ifdef MODE_128K - wyz_stop_sound (); - wyz_play_sound (1); + player_on = 0; #endif clear_sprites (); pause_screen (); @@ -267,11 +302,7 @@ sp_WaitForNoKey (); draw_scr (); #ifdef MODE_128K - #ifdef COMPRESSED_LEVELS - //wyz_play_music (levels [level].music_id); - #else - //wyz_play_music (1); - #endif + player_on = 1; #endif } if (sp_KeyPressed (KEY_Y)) { @@ -281,7 +312,12 @@ // Flick the screen ? - #include "mainloop/flick_screen.h" + #if defined ACTIVATE_SCRIPTING && defined COMPRESSED_LEVELS + if (script_result != 3) + #endif + { + #include "mainloop/flick_screen.h" + } // Win game condition @@ -305,7 +341,8 @@ } // Game over condition - if (p_life == 0 + #if defined ACTIVATE_SCRIPTING || (defined(TIMER_ENABLE) && defined(TIMER_GAMEOVER_0)) + if (0 #ifdef ACTIVATE_SCRIPTING || (script_result == 2) #endif @@ -315,14 +352,16 @@ ) { playing = 0; } + #endif #include "my/ci/extra_routines.h" } + sp_UpdateNow (); sp_WaitForNoKey (); #ifdef MODE_128K - wyz_stop_sound (); + STOP_SOUND (); #endif #include "my/ci/after_game_loop.h" diff --git a/examples/dogmole_ci/dev/mk1.c b/examples/dogmole_ci/dev/mk1.c index 04a9fe4f..ba5f994d 100644 --- a/examples/dogmole_ci/dev/mk1.c +++ b/examples/dogmole_ci/dev/mk1.c @@ -21,6 +21,10 @@ #define FIXBITS 6 #define MAX_ENEMS 3 +// Fiddle if you need +#define MAX_TILANIMS 16 +#define TILANIMS_PRIME 7 + /* splib2 memory map 61440 - 61696 IM2 vector table 61697 - 61936 FREEPOOL (240 bytes) @@ -55,7 +59,7 @@ #endif #endif -#define NUMBLOCKS (40 + (MAX_PROJECTILES * 5)) +#define NUMBLOCKS (((1 + MAX_ENEMS) * 10) + (MAX_PROJECTILES * 5)) unsigned char AD_FREE [NUMBLOCKS * 15]; @@ -73,8 +77,6 @@ unsigned char AD_FREE [NUMBLOCKS * 15]; #include "assets/librarian.h" #endif -#include "my/ci/extra_vars.h" - #include "aplib.h" #include "pantallas.h" @@ -90,10 +92,19 @@ unsigned char AD_FREE [NUMBLOCKS * 15]; #include "assets/extrasprites.h" #endif +#include "my/ci/extra_vars.h" + #ifdef MODE_128K - #include "wyzplayer.h" + #ifdef USE_ARKOS_PLAYER + #include "sound/arkosplayer.h" + #else + #include "sound/wyzplayer.h" + #endif #else - #include "beeper.h" + #include "sound/beeper.h" + #ifdef MIN_FAPS_PER_FRAME + #include "engine/isr.h" + #endif #endif #include "printer.h" @@ -132,5 +143,5 @@ unsigned char AD_FREE [NUMBLOCKS * 15]; #ifndef MODE_128K // From beepola. Phaser engine by Shiru. - #include "music.h" + #include "sound/music.h" #endif diff --git a/examples/dogmole_ci/dev/my/ci/custom_heng.h b/examples/dogmole_ci/dev/my/ci/custom_heng.h new file mode 100644 index 00000000..f2a1f4b8 --- /dev/null +++ b/examples/dogmole_ci/dev/my/ci/custom_heng.h @@ -0,0 +1,4 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// Modify p_vx diff --git a/examples/dogmole_ci/dev/my/ci/enems_custom_respawn.h b/examples/dogmole_ci/dev/my/ci/enems_custom_respawn.h new file mode 100644 index 00000000..a06ef557 --- /dev/null +++ b/examples/dogmole_ci/dev/my/ci/enems_custom_respawn.h @@ -0,0 +1,5 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// deactivate RESPAWN_ON_ENTER and write your own routine here! + diff --git a/examples/dogmole_ci/dev/my/ci/entering_screen.h b/examples/dogmole_ci/dev/my/ci/entering_screen.h index 2bb5fa52..f47f411c 100644 --- a/examples/dogmole_ci/dev/my/ci/entering_screen.h +++ b/examples/dogmole_ci/dev/my/ci/entering_screen.h @@ -7,13 +7,13 @@ _gp_gen = 0; switch (n_pant) { case 0: - _gp_gen = decos_0; break; + _gp_gen = (unsigned char *) (decos_0); break; case 1: - _gp_gen = decos_1; break; + _gp_gen = (unsigned char *) (decos_1); break; case 6: - _gp_gen = decos_6; break; + _gp_gen = (unsigned char *) (decos_6); break; case 18: - _gp_gen = decos_18; break; + _gp_gen = (unsigned char *) (decos_18); break; } if (_gp_gen) draw_decorations (); diff --git a/examples/dogmole_ci/dev/my/ci/on_player_killed.h b/examples/dogmole_ci/dev/my/ci/on_player_killed.h new file mode 100644 index 00000000..d6e076ee --- /dev/null +++ b/examples/dogmole_ci/dev/my/ci/on_player_killed.h @@ -0,0 +1,3 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + diff --git a/examples/dogmole_ci/dev/my/config.h b/examples/dogmole_ci/dev/my/config.h index 4e678266..77d797bf 100644 --- a/examples/dogmole_ci/dev/my/config.h +++ b/examples/dogmole_ci/dev/my/config.h @@ -8,6 +8,9 @@ // ============================================================================ //#define MODE_128K // Read the docs! +//#define MIN_FAPS_PER_FRAME 2 // Limits the max # of fps to 50/N +//#define USE_ARKOS_PLAYER // Use Arkos instead of Wyz player for 128k Music +//#define ARKOS_SFX_CHANNEL 0 // SFX Channel (0-2) //#define VENG_SELECTOR // Very advanced! //#define USE_MAP_CUSTOM_DECODER @@ -25,8 +28,10 @@ #define PLAYER_LIFE 15 // Max and starting life gauge. #define PLAYER_REFILL 1 // Life recharge //#define COMPRESSED_LEVELS // use levels.h instead of mapa.h and enems.h (!) +//#define PER_LEVEL_SPRITESET // use a different spriteset for each level in 48K //#define MAX_LEVELS 2 // # of compressed levels //#define REFILL_ME // If defined, refill player on each level +//#define NO_RESET_STATS // If defined, player stats are not reset per level // ============================================================================ // II. Engine type @@ -72,6 +77,7 @@ //#define ENABLE_PURSUERS // If defined, type 7 enemies are active //#define DEATH_COUNT_AND 7 //#define DEATH_COUNT_ADD 11 // Frames to wait = ADD + (rand & AND) +//#define PURSUERS_MAX_V 2 // 1, 2, 4. //#define PURSUERS_BASE_CELL 3 // If defined, type 7 enemies are always # //#define ENABLE_FANTIES // If defined, Fanties are enabled! @@ -135,8 +141,9 @@ //#define SCRIPTING_KEY_M // Use M as the action key instead. //#define SCRIPTING_KEY_FIRE // User FIRE as the action key instead. //#define SCRIPTING_KEY_NONE // No action key. -#define ENABLE_EXTERN_CODE // Enables custom code to be run from the script using EXTERN n -#define ENABLE_FIRE_ZONE // Allows to define a zone which auto-triggers "FIRE" +//#define ENABLE_EXTERN_CODE // Enables custom code to be run from the script using EXTERN n +//#define ENABLE_FIRE_ZONE // Allows to define a zone which auto-triggers "FIRE" +//#define SCRIPT_PAGE 3 // In MODE_128K & COMPRESSED_LEVELS // Timer // ----- @@ -182,6 +189,8 @@ #define PLAYER_MIN_KILLABLE 3 // Only kill enemies with id >= PLAYER_MIN_KILLABLE //#define PLAYER_STEP_SOUND // Sound while walking. No effect in the BOOTEE engine. +//#define PLAYER_DISABLE_DEFAULT_HENG // To disble default horizontal engine (keyrs) + // Configure keyboard // To define different keys, the first two hex digits are the COLUMN, the next the ROW @@ -261,6 +270,7 @@ //#define USE_AUTO_SHADOWS // Automatic shadows made of darker attributes //#define USE_AUTO_TILE_SHADOWS // Automatic shadows using specially defined tiles 32-47. //#define UNPACKED_MAP // Full, uncompressed maps. Shadows settings are ignored. +#define PACKED_MAP_ALT_TILE 19 // If defined, in 16 tiles mode, alt tile (default 19) //#define NO_MASKS // Sprites are rendered using OR instead of masks. //#define MASKED_BULLETS // If needed //#define PLAYER_CUSTOM_ANIMATION // Code your own animation in my/custom_animation.h diff --git a/examples/dogmole_ci/dev/my/fixed_screens.h b/examples/dogmole_ci/dev/my/fixed_screens.h index 36e03655..e794b96d 100644 --- a/examples/dogmole_ci/dev/my/fixed_screens.h +++ b/examples/dogmole_ci/dev/my/fixed_screens.h @@ -36,7 +36,7 @@ void game_ending (void) { void game_over (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " GAME OVER! "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" GAME OVER! "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNow (); @@ -52,7 +52,7 @@ void game_over (void) { #if defined(TIMER_ENABLE) && defined(SHOW_TIMER_OVER) void time_over (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " TIME'S UP! "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" TIME'S UP! "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); @@ -69,7 +69,7 @@ void game_over (void) { #ifdef PAUSE_ABORT void pause_screen (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " PAUSED "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" PAUSED "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); } @@ -78,7 +78,7 @@ void game_over (void) { #ifdef COMPRESSED_LEVELS void zone_clear (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " ZONE CLEAR "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" ZONE CLEAR "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); espera_activa (250); diff --git a/examples/dogmole_ci/dev/my/level_screen.h b/examples/dogmole_ci/dev/my/level_screen.h index 0de8100f..5e779b2a 100644 --- a/examples/dogmole_ci/dev/my/level_screen.h +++ b/examples/dogmole_ci/dev/my/level_screen.h @@ -10,7 +10,7 @@ _x = 12; _y = 12; _t = 71; _gp_gen = level_str; print_str (); sp_UpdateNow (); #ifdef MODE_128K - wyz_play_sound (SFX_START); + PLAY_SOUND (SFX_START); #else beep_fx (1); #endif diff --git a/examples/dogmole_ci/dev/my/levelset.h b/examples/dogmole_ci/dev/my/levelset.h index 98452985..a0a4f6f8 100644 --- a/examples/dogmole_ci/dev/my/levelset.h +++ b/examples/dogmole_ci/dev/my/levelset.h @@ -12,7 +12,9 @@ typedef struct { unsigned char resource_id; unsigned char music_id; + #ifdef ACTIVATE_SCRIPTING unsigned int script_offset; + #endif } LEVEL; #else // 48K format: @@ -35,12 +37,14 @@ // In 48K mode, include here your compressed binaries: -extern unsigned char my_binary [0]; +#ifndef MODE_128K + extern unsigned char my_binary [0]; -#asm - ._my_binary - BINARY "../bin/my_binary.bin" -#endasm + #asm + ._my_binary + BINARY "../bin/my_binary.bin" + #endasm +#endif // Define your level sequence array here: // map_w, map_h, scr_ini, ini_x, ini_y, max_objs, c_map_bolts, c_tileset, c_enems_hotspots, c_behs, script diff --git a/examples/dogmole_ci/dev/my/title_screen.h b/examples/dogmole_ci/dev/my/title_screen.h index 86ae601c..d4342db9 100644 --- a/examples/dogmole_ci/dev/my/title_screen.h +++ b/examples/dogmole_ci/dev/my/title_screen.h @@ -9,7 +9,7 @@ #ifdef MODE_128K get_resource (TITLE_BIN, 16384); - wyz_play_music (0); + PLAY_MUSIC (0); #else #asm ld hl, _s_title diff --git a/examples/dogmole_ci/dev/pantallas.h b/examples/dogmole_ci/dev/pantallas.h index b1fbc674..2734d92b 100644 --- a/examples/dogmole_ci/dev/pantallas.h +++ b/examples/dogmole_ci/dev/pantallas.h @@ -12,17 +12,17 @@ #asm ._s_title - BINARY "title.bin" + BINARY "..\bin\title.bin" ._s_marco #endasm #ifndef DIRECT_TO_PLAY #asm - BINARY "marco.bin" + BINARY "..\bin\marco.bin" #endasm #endif #asm ._s_ending - BINARY "ending.bin" + BINARY "..\bin\ending.bin" #endasm #endif diff --git a/examples/dogmole_ci/dev/printer.h b/examples/dogmole_ci/dev/printer.h index 12b2b499..7e05d920 100644 --- a/examples/dogmole_ci/dev/printer.h +++ b/examples/dogmole_ci/dev/printer.h @@ -4,7 +4,7 @@ // Printing functions unsigned char attr (unsigned char x, unsigned char y) { - if (x >= 14 || y >= 10) return 0; + if (x >= 15 || y >= 10) return 0; return map_attr [x + (y << 4) - y]; } @@ -12,6 +12,48 @@ unsigned char qtile (unsigned char x, unsigned char y) { return map_buff [x + (y << 4) - y]; } +#if defined (USE_AUTO_TILE_SHADOWS) || defined (USE_AUTO_SHADOWS) + unsigned char attr_mk2 (void) { + // x + 15 * y = x + (16 - 1) * y = x + 16 * y - y = x + (y << 4) - y. + // if (cx1 < 0 || cy1 < 0 || cx1 > 14 || cy1 > 9) return 0; + // return map_attr [cx1 + (cy1 << 4) - cy1]; + #asm + ld a, (_cx1) + cp 15 + jr nc, _attr_reset + + ld a, (_cy1) + cp 10 + jr c, _attr_do + + ._attr_reset + ld hl, 0 + ret + + ._attr_do + ld a, (_cy1) + ld b, a + sla a + sla a + sla a + sla a + sub b + ld b, a + ld a, (_cx1) + add b + ld e, a + ld d, 0 + ld hl, _map_attr + add hl, de + ld a, (hl) + + ld h, 0 + ld l, a + ret + #endasm + } +#endif + #ifdef COMPRESSED_LEVELS #define ATTR_OFFSET 1536 #else @@ -53,9 +95,9 @@ void draw_coloured_tile (void) { // Fill up c1, c2, c3, c4 then use them #ifdef USE_AUTO_SHADOWS - cx1 = xx - 1; cy1 = yy - 1; rda = *gen_pt; c1 = (nocast && (attr () & 8)) ? (rda & 7) - 1 : rda; t1 = _ta; ++ gen_pt; ++ _ta; - cx1 = xx ; cy1 = yy - 1; rda = *gen_pt; c2 = (nocast && (attr () & 8)) ? (rda & 7) - 1 : rda; t2 = _ta; ++ gen_pt; ++ _ta; - cx1 = xx - 1; cy1 = yy ; rda = *gen_pt; c3 = (nocast && (attr () & 8)) ? (rda & 7) - 1 : rda; t3 = _ta; ++ gen_pt; ++ _ta; + cx1 = xx - 1; cy1 = yy - 1; rda = *gen_pt; c1 = (nocast && (attr_mk2 () & 8)) ? (rda & 7) - 1 : rda; t1 = _ta; ++ gen_pt; ++ _ta; + cx1 = xx ; cy1 = yy - 1; rda = *gen_pt; c2 = (nocast && (attr_mk2 () & 8)) ? (rda & 7) - 1 : rda; t2 = _ta; ++ gen_pt; ++ _ta; + cx1 = xx - 1; cy1 = yy ; rda = *gen_pt; c3 = (nocast && (attr_mk2 () & 8)) ? (rda & 7) - 1 : rda; t3 = _ta; ++ gen_pt; ++ _ta; #endif #ifdef USE_AUTO_TILE_SHADOWS // Precalc @@ -79,7 +121,7 @@ void draw_coloured_tile (void) { gen_pt_alt = tileset + ATTR_OFFSET + t_alt; - // cx1 = xx - 1; cy1 = yy ? yy - 1 : 0; a1 = (nocast && (attr () & 8)); + // cx1 = xx - 1; cy1 = yy ? yy - 1 : 0; a1 = (nocast && (attr_mk2 () & 8)); #asm // cx1 = xx - 1; ld a, (_xx) @@ -94,12 +136,12 @@ void draw_coloured_tile (void) { ._dct_1_set_yy ld (_cy1), a - // a1 = (nocast && (attr () & 8)); + // a1 = (nocast && (attr_mk2 () & 8)); ld a, (_nocast) or a jr z, _dct_a1_set - call _attr + call _attr_mk2 ld a, l and 8 jr z, _dct_a1_set @@ -110,7 +152,7 @@ void draw_coloured_tile (void) { ld (_a1), a #endasm - // cx1 = xx ; cy1 = yy ? yy - 1 : 0; a2 = (nocast && (attr () & 8)); + // cx1 = xx ; cy1 = yy ? yy - 1 : 0; a2 = (nocast && (attr_mk2 () & 8)); #asm // cx1 = xx; ld a, (_xx) @@ -124,12 +166,12 @@ void draw_coloured_tile (void) { ._dct_2_set_yy ld (_cy1), a - // a2 = (nocast && (attr () & 8)) + // a2 = (nocast && (attr_mk2 () & 8)) ld a, (_nocast) or a jr z, _dct_a2_set - call _attr + call _attr_mk2 ld a, l and 8 jr z, _dct_a2_set @@ -140,7 +182,7 @@ void draw_coloured_tile (void) { ld (_a2), a #endasm - // cx1 = xx - 1; cy1 = yy ; a3 = (nocast && (attr () & 8)); + // cx1 = xx - 1; cy1 = yy ; a3 = (nocast && (attr_mk2 () & 8)); #asm // cx1 = xx - 1; ld a, (_xx) @@ -151,12 +193,12 @@ void draw_coloured_tile (void) { ld a, (_yy) ld (_cy1), a - // a3 = (nocast && (attr () & 8)); + // a3 = (nocast && (attr_mk2 () & 8)); ld a, (_nocast) or a jr z, _dct_a3_set - call _attr + call _attr_mk2 ld a, l and 8 jr z, _dct_a3_set @@ -567,7 +609,8 @@ void update_tile (void) { #ifdef ENABLE_TILANIMS // Detect tilanims if (_t >= ENABLE_TILANIMS) { - add_tilanim (_x, _y, _t); + _n = (_x << 4) | _y; + tilanims_add (); } #endif diff --git a/examples/dogmole_ci/dev/prototypes.h b/examples/dogmole_ci/dev/prototypes.h index aae155dd..843aaf1a 100644 --- a/examples/dogmole_ci/dev/prototypes.h +++ b/examples/dogmole_ci/dev/prototypes.h @@ -7,6 +7,18 @@ #define ENABLE_SIMPLE_COCOS #endif +#ifdef MODE_128K + #ifdef USE_ARKOS_PLAYER + #define PLAY_MUSIC arkos_play_music + #define PLAY_SOUND arkos_play_sound + #define STOP_SOUND arkos_stop_sound + #else + #define PLAY_MUSIC wyz_play_music + #define PLAY_SOUND wyz_play_sound + #define STOP_SOUND wyz_stop_sound + #endif +#endif + // Engine // breakable.h @@ -74,6 +86,7 @@ char player_hidden (void); void run_fire_script (void); void process_tile (void); void draw_scr_background (void); +void draw_scr_hotspots_locks (void); void draw_scr (void); void select_joyfunc (void); unsigned char mons_col_sc_x (void); @@ -108,12 +121,15 @@ void tape_load (void);// TODO! void sg_submenu (void); // tilanim.h -void add_tilanim (unsigned char x, unsigned char y, unsigned char t); -void do_tilanims (void); +void tilanims_add (void); +void tilanims_do (void); +void tilanims_reset (void); -// wyzplayer.h +#ifdef MODE_128K +// wyzplayer.h / arcos_player.h void ISR (void); -void wyz_init (void); -void wyz_play_sound (unsigned char fx_number); -void wyz_play_music (unsigned char song_number); -void wyz_stop_sound (void); +void INIT_PLAYER (void); +void PLAY_SOUND (unsigned char fx_number); +void PLAY_MUSIC (unsigned char song_number); +void STOP_SOUND (void); +#endif diff --git a/examples/dogmole_ci/dev/setenv.bat b/examples/dogmole_ci/dev/setenv.bat index e034d8d5..a543b050 100644 --- a/examples/dogmole_ci/dev/setenv.bat +++ b/examples/dogmole_ci/dev/setenv.bat @@ -1,6 +1,5 @@ @echo off -set Z88DK_PATH=c:\z88dk10 -set PATH=%Z88DK_PATH%\bin;%PATH% +set Z88DK_PATH=c:\z88dk +set PATH=%Z88DK_PATH%\bin.x86;%PATH% set Z80_OZFILES=%Z88DK_PATH%\Lib\ set ZCCCFG=%Z88DK_PATH%\Lib\Config\ -zcc diff --git a/examples/dogmole_ci/dev/sound/arkos-addresses.h b/examples/dogmole_ci/dev/sound/arkos-addresses.h new file mode 100644 index 00000000..fa3225d7 --- /dev/null +++ b/examples/dogmole_ci/dev/sound/arkos-addresses.h @@ -0,0 +1,9 @@ +#define SFXS_SONG 0xd10c +#define ATINIT 0xc68c +#define ATPLAY 0xc000 +#define ATSFXINIT 0xc6f0 +#define ATSFXPLAY 0xc704 +#define ATSFXSTOP 0xc745 +#define ATSFXSTOPALL 0xc6f7 +#define ATSTOP 0xc6e1 +#define SONG_LIST 0xd5b7 diff --git a/examples/dogmole_ci/dev/sound/arkosplayer.h b/examples/dogmole_ci/dev/sound/arkosplayer.h new file mode 100644 index 00000000..c149b1b9 --- /dev/null +++ b/examples/dogmole_ci/dev/sound/arkosplayer.h @@ -0,0 +1,118 @@ +// MT Engine MK2 +// Copyleft 2014 the Mojon Twins + +// arkosplayer.h +// Arkos Player hook functions + +// This code is based on the original integration by Syx & Nightwolf +// In fact, this code IS the original integration by Syx & Nightwolf. +// I just changed the way params are passed (thanks @reidrac) +// I just automated the process & reindented to meet my own personal taste. + +#include "sound\arkos-addresses.h" + +// Start. + +// isr +#asm + defw 0 +#endasm + +void ISR(void) { + #asm + ld b, 1 + call SetRAMBank + call ATPLAY + ld b, 0 + call SetRAMBank + + ld hl, _isrc + inc (hl) + #endasm +} + +void arkos_stop (void) { + #asm + ld b, 1 + call SetRAMBank + ld a, 201 + ld (ATPLAY),A + ld b, 0 + call SetRAMBank + #endasm +} + +void __FASTCALL__ arkos_play_sound (unsigned char fx_number) { + #asm + di + ld b,1 + call SetRAMBank + + ; __FASTCALL__ -> fx_number is in l! + ld a, ARKOS_SFX_CHANNEL + ld h, 15 + ld e, 50 + ld d, 0 + ld bc, 0 + call ATSFXPLAY + + ld b,0 + call SetRAMBank + ei + #endasm +} + +void __FASTCALL__ arkos_play_music (unsigned char song_number) { + #asm + di + ld b, 1 + call SetRAMBank + + ; Reactivate sound generation + ld a, 175 + ld (ATPLAY),A + + ; Initialize song + ; __FASTCALL__ -> song_number is in l! + ld a, l + add a, a + ld hl, SONG_LIST + add a,l + jr nc, salta_inc_song + inc h + salta_inc_song: + ld l,a + ld e, (hl) + inc hl + ld d, (hl) + + call ATINIT + + ld de, SFXS_SONG + call ATSFXINIT + + ld b, 0 + call SetRAMBank + ei + #endasm +} + +void arkos_stop_sound (void) +{ + #asm + di + ld b,1 + call SetRAMBank + + call ATSFXSTOPALL + call ATSTOP + + ; Turn off sound generation + ld a,201 + ld (ATPLAY),A + + ld b,0 + call SetRAMBank + ei + #endasm +} diff --git a/examples/dogmole_ci/dev/beeper.h b/examples/dogmole_ci/dev/sound/beeper.h similarity index 92% rename from examples/dogmole_ci/dev/beeper.h rename to examples/dogmole_ci/dev/sound/beeper.h index b8a655a3..324f3fae 100644 --- a/examples/dogmole_ci/dev/beeper.h +++ b/examples/dogmole_ci/dev/sound/beeper.h @@ -1,271 +1,271 @@ -// MTE MK1 (la Churrera) v5.0 -// Copyleft 2010-2014, 2020 by the Mojon Twins - -#asm - ;org 60000 - -;BeepFX player by Shiru -;You are free to do whatever you want with this code - - - -.playBasic - ld a,0 -.sound_play - ld hl,sfxData ;address of sound effects data - - ;di - push ix - push iy - - ld b,0 - ld c,a - add hl,bc - add hl,bc - ld e,(hl) - inc hl - ld d,(hl) - push de - pop ix ;put it into ix - - ld a,(23624) ;get border color from BASIC vars to keep it unchanged - rra - rra - rra - and 7 - ld (sfxRoutineToneBorder +1),a - ld (sfxRoutineNoiseBorder +1),a - ld (sfxRoutineSampleBorder+1),a - - -.readData - ld a,(ix+0) ;read block type - ld c,(ix+1) ;read duration 1 - ld b,(ix+2) - ld e,(ix+3) ;read duration 2 - ld d,(ix+4) - push de - pop iy - - dec a - jr z,sfxRoutineTone - dec a - jr z,sfxRoutineNoise - dec a - jr z,sfxRoutineSample - pop iy - pop ix - ;ei - ret - - - -;play sample - -.sfxRoutineSample - ex de,hl -.sfxRS0 - ld e,8 - ld d,(hl) - inc hl -.sfxRS1 - ld a,(ix+5) -.sfxRS2 - dec a - jr nz,sfxRS2 - rl d - sbc a,a - and 16 -.sfxRoutineSampleBorder - or 0 - out (254),a - dec e - jr nz,sfxRS1 - dec bc - ld a,b - or c - jr nz,sfxRS0 - - ld c,6 - -.nextData - add ix,bc ;skip to the next block - jr readData - - - -;generate tone with many parameters - -.sfxRoutineTone - ld e,(ix+5) ;freq - ld d,(ix+6) - ld a,(ix+9) ;duty - ld (sfxRoutineToneDuty+1),a - ld hl,0 - -.sfxRT0 - push bc - push iy - pop bc -.sfxRT1 - add hl,de - ld a,h -.sfxRoutineToneDuty - cp 0 - sbc a,a - and 16 -.sfxRoutineToneBorder - or 0 - out (254),a - - dec bc - ld a,b - or c - jr nz,sfxRT1 - - ld a,(sfxRoutineToneDuty+1) ;duty change - add a,(ix+10) - ld (sfxRoutineToneDuty+1),a - - ld c,(ix+7) ;slide - ld b,(ix+8) - ex de,hl - add hl,bc - ex de,hl - - pop bc - dec bc - ld a,b - or c - jr nz,sfxRT0 - - ld c,11 - jr nextData - - - -;generate noise with two parameters - -.sfxRoutineNoise - ld e,(ix+5) ;pitch - - ld d,1 - ld h,d - ld l,d -.sfxRN0 - push bc - push iy - pop bc -.sfxRN1 - ld a,(hl) - and 16 -.sfxRoutineNoiseBorder - or 0 - out (254),a - dec d - jr nz,sfxRN2 - ld d,e - inc hl - ld a,h - and 31 - ld h,a -.sfxRN2 - dec bc - ld a,b - or c - jr nz,sfxRN1 - - ld a,e - add a,(ix+6) ;slide - ld e,a - - pop bc - dec bc - ld a,b - or c - jr nz,sfxRN0 - - ld c,7 - jr nextData - - -.sfxData - -.SoundEffectsData - defw SoundEffect0Data - defw SoundEffect1Data - defw SoundEffect2Data - defw SoundEffect3Data - defw SoundEffect4Data - defw SoundEffect5Data - defw SoundEffect6Data - defw SoundEffect7Data - defw SoundEffect8Data - defw SoundEffect9Data - -.SoundEffect0Data - defb 2 ;noise - defw 8,200,20 - defb 2 ;noise - defw 4,2000,5220 - defb 0 -.SoundEffect1Data - defb 2 ;noise - defw 1,1000,10 - defb 2 ;noise - defw 1,1000,1 - defb 0 -.SoundEffect2Data - defb 1 ;tone - defw 50,100,200,65531,128 - defb 0 -.SoundEffect3Data - defb 1 ;tone - defw 100,20,500,2,128 - defb 0 -.SoundEffect4Data - defb 2 ;noise - defw 1,1000,20 - defb 1 ;pause - defw 1,1000,0,0,0 - defb 2 ;noise - defw 1,1000,1 - defb 0 -.SoundEffect5Data - defb 1 ;tone - defw 50,200,500,65516,128 - defb 0 -.SoundEffect6Data - defb 2 ;noise - defw 20,50,257 - defb 0 -.SoundEffect7Data - defb 1 ;tone - defw 1,1000,2000,0,64 - defb 1 ;pause - defw 1,1000,0,0,0 - defb 1 ;tone - defw 1,1000,1500,0,64 - defb 0 -.SoundEffect8Data - defb 2 ;noise - defw 2,2000,32776 - defb 0 -.SoundEffect9Data - defb 1 ;tone - defw 4,1000,1000,400,128 - defb 0 -#endasm - -void beep_fx (unsigned char n) { - // Cargar en A el valor de n - asm_int = n; - #asm - push ix - push iy - ld a, (_asm_int) - call sound_play - pop ix - pop iy - #endasm +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +#asm + ;org 60000 + +;BeepFX player by Shiru +;You are free to do whatever you want with this code + + + +.playBasic + ld a,0 +.sound_play + ld hl,sfxData ;address of sound effects data + + ;di + push ix + push iy + + ld b,0 + ld c,a + add hl,bc + add hl,bc + ld e,(hl) + inc hl + ld d,(hl) + push de + pop ix ;put it into ix + + ld a,(23624) ;get border color from BASIC vars to keep it unchanged + rra + rra + rra + and 7 + ld (sfxRoutineToneBorder +1),a + ld (sfxRoutineNoiseBorder +1),a + ld (sfxRoutineSampleBorder+1),a + + +.readData + ld a,(ix+0) ;read block type + ld c,(ix+1) ;read duration 1 + ld b,(ix+2) + ld e,(ix+3) ;read duration 2 + ld d,(ix+4) + push de + pop iy + + dec a + jr z,sfxRoutineTone + dec a + jr z,sfxRoutineNoise + dec a + jr z,sfxRoutineSample + pop iy + pop ix + ;ei + ret + + + +;play sample + +.sfxRoutineSample + ex de,hl +.sfxRS0 + ld e,8 + ld d,(hl) + inc hl +.sfxRS1 + ld a,(ix+5) +.sfxRS2 + dec a + jr nz,sfxRS2 + rl d + sbc a,a + and 16 +.sfxRoutineSampleBorder + or 0 + out (254),a + dec e + jr nz,sfxRS1 + dec bc + ld a,b + or c + jr nz,sfxRS0 + + ld c,6 + +.nextData + add ix,bc ;skip to the next block + jr readData + + + +;generate tone with many parameters + +.sfxRoutineTone + ld e,(ix+5) ;freq + ld d,(ix+6) + ld a,(ix+9) ;duty + ld (sfxRoutineToneDuty+1),a + ld hl,0 + +.sfxRT0 + push bc + push iy + pop bc +.sfxRT1 + add hl,de + ld a,h +.sfxRoutineToneDuty + cp 0 + sbc a,a + and 16 +.sfxRoutineToneBorder + or 0 + out (254),a + + dec bc + ld a,b + or c + jr nz,sfxRT1 + + ld a,(sfxRoutineToneDuty+1) ;duty change + add a,(ix+10) + ld (sfxRoutineToneDuty+1),a + + ld c,(ix+7) ;slide + ld b,(ix+8) + ex de,hl + add hl,bc + ex de,hl + + pop bc + dec bc + ld a,b + or c + jr nz,sfxRT0 + + ld c,11 + jr nextData + + + +;generate noise with two parameters + +.sfxRoutineNoise + ld e,(ix+5) ;pitch + + ld d,1 + ld h,d + ld l,d +.sfxRN0 + push bc + push iy + pop bc +.sfxRN1 + ld a,(hl) + and 16 +.sfxRoutineNoiseBorder + or 0 + out (254),a + dec d + jr nz,sfxRN2 + ld d,e + inc hl + ld a,h + and 31 + ld h,a +.sfxRN2 + dec bc + ld a,b + or c + jr nz,sfxRN1 + + ld a,e + add a,(ix+6) ;slide + ld e,a + + pop bc + dec bc + ld a,b + or c + jr nz,sfxRN0 + + ld c,7 + jr nextData + + +.sfxData + +.SoundEffectsData + defw SoundEffect0Data + defw SoundEffect1Data + defw SoundEffect2Data + defw SoundEffect3Data + defw SoundEffect4Data + defw SoundEffect5Data + defw SoundEffect6Data + defw SoundEffect7Data + defw SoundEffect8Data + defw SoundEffect9Data + +.SoundEffect0Data + defb 2 ;noise + defw 8,200,20 + defb 2 ;noise + defw 4,2000,5220 + defb 0 +.SoundEffect1Data + defb 2 ;noise + defw 1,1000,10 + defb 2 ;noise + defw 1,1000,1 + defb 0 +.SoundEffect2Data + defb 1 ;tone + defw 50,100,200,65531,128 + defb 0 +.SoundEffect3Data + defb 1 ;tone + defw 100,20,500,2,128 + defb 0 +.SoundEffect4Data + defb 2 ;noise + defw 1,1000,20 + defb 1 ;pause + defw 1,1000,0,0,0 + defb 2 ;noise + defw 1,1000,1 + defb 0 +.SoundEffect5Data + defb 1 ;tone + defw 50,200,500,65516,128 + defb 0 +.SoundEffect6Data + defb 2 ;noise + defw 20,50,257 + defb 0 +.SoundEffect7Data + defb 1 ;tone + defw 1,1000,2000,0,64 + defb 1 ;pause + defw 1,1000,0,0,0 + defb 1 ;tone + defw 1,1000,1500,0,64 + defb 0 +.SoundEffect8Data + defb 2 ;noise + defw 2,2000,32776 + defb 0 +.SoundEffect9Data + defb 1 ;tone + defw 4,1000,1000,400,128 + defb 0 +#endasm + +void beep_fx (unsigned char n) { + // Cargar en A el valor de n + asm_int = n; + #asm + push ix + push iy + ld a, (_asm_int) + call sound_play + pop ix + pop iy + #endasm } \ No newline at end of file diff --git a/examples/dogmole_ci/dev/music.h b/examples/dogmole_ci/dev/sound/music.h similarity index 100% rename from examples/dogmole_ci/dev/music.h rename to examples/dogmole_ci/dev/sound/music.h diff --git a/examples/goddess/dev/wyzplayer.h b/examples/dogmole_ci/dev/sound/wyzplayer.h similarity index 60% rename from examples/goddess/dev/wyzplayer.h rename to examples/dogmole_ci/dev/sound/wyzplayer.h index dea53369..b06fedd7 100644 --- a/examples/goddess/dev/wyzplayer.h +++ b/examples/dogmole_ci/dev/sound/wyzplayer.h @@ -25,61 +25,67 @@ void ISR(void) { #asm - ld b, 1 - call SetRAMBank - call WYZPLAYERISR - ld b, 0 - call SetRAMBank + ld a, (_player_on) + or a + ret z + ld b, 1 + call SetRAMBank + call WYZPLAYERISR + ld b, 0 + call SetRAMBank + + ld hl, _isrc + inc (hl) #endasm } void wyz_init (void) { #asm - ld b,1 - call SetRAMBank - call WYZPLAYERINIT - ld b,0 - call SetRAMBank + ld b,1 + call SetRAMBank + call WYZPLAYERINIT + ld b,0 + call SetRAMBank #endasm } void __FASTCALL__ wyz_play_sound (unsigned char fx_number) { #asm - di - ld b, 1 - call SetRAMBank - ; __FASTCALL__ -> fx_number is in l! - ld b, l - call INICIAEFECTO - ld b, 0 - call SetRAMBank - ei + di + ld b, 1 + call SetRAMBank + ; __FASTCALL__ -> fx_number is in l! + ld b, l + call INICIAEFECTO + ld b, 0 + call SetRAMBank + ei #endasm } void __FASTCALL__ wyz_play_music (unsigned char song_number) { #asm - di - ld b, 1 - call SetRAMBank - ; __FASTCALL__ -> song_number is in l! - ld a, l - call CARGA_CANCION - ld b, 0 - call SetRAMBank - ei + di + ld b, 1 + call SetRAMBank + ; __FASTCALL__ -> song_number is in l! + ld a, l + call CARGA_CANCION + ld b, 0 + call SetRAMBank + ei #endasm song_playing = song_number; } void wyz_stop_sound (void) { #asm - di - ld b,1 - call SetRAMBank - call SILENCIA_PLAYER - ld b,0 - call SetRAMBank - ei + di + ld b,1 + call SetRAMBank + call SILENCIA_PLAYER + ld b,0 + call SetRAMBank + ei #endasm } diff --git a/examples/dogmole_ci/dev/tilanim.h b/examples/dogmole_ci/dev/tilanim.h index 3e62c5a7..cfeaafaf 100644 --- a/examples/dogmole_ci/dev/tilanim.h +++ b/examples/dogmole_ci/dev/tilanim.h @@ -2,43 +2,102 @@ // Copyleft 2010-2014, 2020 by the Mojon Twins // tilanim.h -// Rutina para animar tiles. -#define MAX_TILANIMS 64 -#define UPDATE_FREQ 7 -unsigned char max_tilanims; -unsigned char tacount; +void tilanims_reset (void) { + #asm + ld hl, _tilanims_ft + ld de, _tilanims_ft + 1 + ld bc, MAX_TILANIMS - 1 + xor a + ld (hl), a + ldir + ld (_tacount), a + ld (_tait), a + ld (_max_tilanims), a + #endasm +} + +void tilanims_add (void) { + #asm + ld de, (_max_tilanims) + ld d, 0 -typedef struct { - unsigned char xy; - unsigned char ft; -} TILANIM; + ld a, (__n) + ld hl, _tilanims_xy + add hl, de + ld (hl), a -TILANIM tilanims [MAX_TILANIMS]; + ld a, (__t) + ld hl, _tilanims_ft + add hl, de + ld (hl), a -void add_tilanim (unsigned char x, unsigned char y, unsigned char t) { - tilanims [max_tilanims].xy = (x << 4) + y; - tilanims [max_tilanims].ft = t; - - ++ max_tilanims; + ld a, e + inc a + ld (_max_tilanims), a + #endasm } -unsigned char tait; -void do_tilanims (void) { - if (max_tilanims == 0) return; - - tacount = (tacount + 1) & UPDATE_FREQ; - if (!tacount) { - // Select tile - tait = rand () % max_tilanims; - - // Flip bit 7: - tilanims [tait].ft = tilanims [tait].ft ^ 128; +void tilanims_do (void) { + #asm + ld a, (_max_tilanims) + or a + ret z + + ld a, (_tait) + add TILANIMS_PRIME + cp MAX_TILANIMS + jr c, _tilanims_tait_0_skip + sub MAX_TILANIMS + ._tilanims_tait_0_skip + ld (_tait), a + + // Check counter for tilanim #tait + ld d, 0 + ld e, a + + // Check of active + ld hl, _tilanims_ft + add hl, de + ld a, (hl) + or a + ret z + + // Flip bit 7 + ld hl, _tilanims_ft + add hl, de + ld a, (hl) + xor 128 + ld (hl), a + + // Which tile? + bit 7, a + jr z, _tilanims_no_flick + + inc a + ._tilanims_no_flick + and 127 + ld (__t), a // Draw tile - _x = tilanims [tait].xy >> 4; - _y = tilanims [tait].xy & 15; - _t = (tilanims [tait].ft & 127) + (tilanims [tait].ft >> 7); - draw_invalidate_coloured_tile_gamearea (); - } + ld hl, _tilanims_xy + add hl, de + ld a, (hl) + ld c, a + srl a + srl a + srl a + and 0xfe + add VIEWPORT_X + ld (__x), a + + ld a, c + and 15 + sla a + add VIEWPORT_Y + ld (__y), a + + call _draw_coloured_tile + call _invalidate_tile + #endasm } diff --git a/examples/dogmole_ci/dev/wyzplayer.h b/examples/dogmole_ci/dev/wyzplayer.h deleted file mode 100644 index dea53369..00000000 --- a/examples/dogmole_ci/dev/wyzplayer.h +++ /dev/null @@ -1,85 +0,0 @@ -// MTE MK1 (la Churrera) v5.0 -// Copyleft 2010-2014, 2020 by the Mojon Twins - -// WYZ player hook functions - -// WYZ player and songs are loaded into RAM 1 ($C000). -// In each interrupt, we just page in RAM 1, call the player, -// then page back RAM 0 and exit. - -// The player is, thus, compiled to $C000, and its addresses -// are: - -#define WYZPLAYERINIT 0xC018 // INIT_BUFFERS EQU 0C018H -#define WYZPLAYERISR 0xC000 // INICIO EQU 0C000H -#define INICIAEFECTO 0xC47E // INICIA_EFECTO EQU 0C46BH -#define CARGA_CANCION 0xC087 // CARGA_CANCION EQU 0C087H -#define SILENCIA_PLAYER 0xC062 // PLAYER_OFF EQU 0C062H - -// Start. - -// isr -#asm - defw 0 // 2 bytes libres -#endasm - -void ISR(void) { - #asm - ld b, 1 - call SetRAMBank - call WYZPLAYERISR - ld b, 0 - call SetRAMBank - #endasm -} - -void wyz_init (void) { - #asm - ld b,1 - call SetRAMBank - call WYZPLAYERINIT - ld b,0 - call SetRAMBank - #endasm -} - -void __FASTCALL__ wyz_play_sound (unsigned char fx_number) { - #asm - di - ld b, 1 - call SetRAMBank - ; __FASTCALL__ -> fx_number is in l! - ld b, l - call INICIAEFECTO - ld b, 0 - call SetRAMBank - ei - #endasm -} - -void __FASTCALL__ wyz_play_music (unsigned char song_number) { - #asm - di - ld b, 1 - call SetRAMBank - ; __FASTCALL__ -> song_number is in l! - ld a, l - call CARGA_CANCION - ld b, 0 - call SetRAMBank - ei - #endasm - song_playing = song_number; -} - -void wyz_stop_sound (void) { - #asm - di - ld b,1 - call SetRAMBank - call SILENCIA_PLAYER - ld b,0 - call SetRAMBank - ei - #endasm -} diff --git a/examples/dogmole_ci/dev/zcc_opt.def b/examples/dogmole_ci/dev/zcc_opt.def deleted file mode 100644 index 3cbd4251..00000000 --- a/examples/dogmole_ci/dev/zcc_opt.def +++ /dev/null @@ -1,8 +0,0 @@ - -IF !DEFINED_STACKPTR - defc DEFINED_STACKPTR = 1 - defc STACKPTR = 61936 -ENDIF - - DEFINE DEFINED_myzorg - defc myzorg = 24000 diff --git a/examples/goddess/bin/ending.bin b/examples/goddess/bin/ending.bin new file mode 100644 index 00000000..4498b7a9 Binary files /dev/null and b/examples/goddess/bin/ending.bin differ diff --git a/examples/goddess/bin/marco.bin b/examples/goddess/bin/marco.bin new file mode 100644 index 00000000..62123e85 Binary files /dev/null and b/examples/goddess/bin/marco.bin differ diff --git a/examples/goddess/bin/title.bin b/examples/goddess/bin/title.bin new file mode 100644 index 00000000..89c800f2 Binary files /dev/null and b/examples/goddess/bin/title.bin differ diff --git a/examples/goddess/dev/128k.h b/examples/goddess/dev/128k.h index 2f4b4b97..317fd7a2 100644 --- a/examples/goddess/dev/128k.h +++ b/examples/goddess/dev/128k.h @@ -6,99 +6,19 @@ void SetRAMBank(void) { #asm .SetRAMBank + ld a, b + or a + jp z, restISR + xor a + ld i, a + jp keepGoing + .restISR + ld a, $f0 + ld i, a + .keepGoing ld a, 16 or b ld bc, $7ffd out (C), a #endasm } -/* -// Esto lo empecé pero por ahora lo dejo aparcado :-/ -#ifdef MOVE_STUFF_TO_RAM_6 -typedef struct { - int x, y; - unsigned char x1, y1, x2, y2; - char mx, my; - char t; - unsigned char life; -} MALOTE; - -MALOTE malotes [3]; -MALOTE *malote_copy; - -void ram6_to_ram (void) { - // This function copies current screen data from RAM 6 to low RAM (new screen) - #asm - di - ld b, 6 - call SetRAMBank - #endasm - - // Map screen -#ifdef UNPACKED_MAP - map_pointer = 0xc000 + (n_pant * 150); -#else - map_pointer = 0xc000 + (n_pant * 75); -#endif - for (gpit = 0; gpit < 150; gpit ++) { -#ifdef UNPACKED_MAP - // Mapa tipo UNPACKED - gpd = *map_pointer ++; - map_buff [gpit] = gpd; -#else - // Mapa tipo PACKED - if (!(gpit & 1)) { - gpc = *map_pointer ++; - gpd = gpc >> 4; - } else { - gpd = gpc & 15; - } - map_buff [gpit] = gpd; -#endif - } - - // Enems - enoffs = n_pant * 3; -#ifdef UNPACKED_MAP - map_pointer = 0xc000 + MAP_W * MAP_H * 150 + 12 * enoffs; -#else - map_pointer = 0xc000 + MAP_W * MAP_H * 75 + 12 * enoffs; -#endif - malote_copy = malotes; - for (gpit = 0; gpit < 36; gpit ++) { - *malote_copy ++ = *map_pointer ++; - } - enoffs = 0; - - // Hotspots - // Bolts - - // Get back - #asm - di - ld b, 0 - call SetRAMBank - #endasm -} - -void ram_to_ram6 (void) { - // This function copies current screen data from low RAM to RAM 6 (update) - #asm - di - ld b, 6 - call SetRAMBank - #endasm - - // Enems - // Hotspots - // Bolts - - // Get back - #asm - di - ld b, 0 - call SetRAMBank - #endasm -} -#endif -*/ \ No newline at end of file diff --git a/examples/goddess/dev/aplib.h b/examples/goddess/dev/aplib.h index 88a31fda..11441f46 100644 --- a/examples/goddess/dev/aplib.h +++ b/examples/goddess/dev/aplib.h @@ -1,13 +1,6 @@ // MTE MK1 (la Churrera) v5.0 // Copyleft 2010-2014, 2020 by the Mojon Twins -unsigned int ram_address; -unsigned int ram_destination; - -#ifdef MODE_128K - unsigned char ram_page; -#endif - #asm ; aPPack decompressor diff --git a/examples/goddess/dev/assets/ay_fx_numbers.h b/examples/goddess/dev/assets/ay_fx_numbers.h index 411264ac..d1c0346e 100644 --- a/examples/goddess/dev/assets/ay_fx_numbers.h +++ b/examples/goddess/dev/assets/ay_fx_numbers.h @@ -1,20 +1,42 @@ // MTE MK1 (la Churrera) v5.0 // Copyleft 2010-2014, 2020 by the Mojon Twins -#define SFX_START 0 -#define SFX_BREAKABLE_HIT 1 -#define SFX_BREAKABLE_BREAK 2 -#define SFX_PUSH_BOX 3 -#define SFX_OPEN_LOCK 3 -#define SFX_SHOOT 4 -#define SFX_OBJECT_GET 5 -#define SFX_KILL_ENEMY_STEP 6 -#define SFX_KILL_ENEMY_SHOOT 6 -#define SFX_HIT_ENEMY 7 -#define SFX_ONE_OBJECT_GET 8 -#define SFX_ONE_OBJECT_WRONG 9 -#define SFX_KEY_GET 10 -#define SFX_REFILL_GET 11 -#define SFX_JUMP 12 -#define SFX_SPIKES 13 -#define SFX_ENEMY_HIT 14 +#ifdef USE_ARKOS_PLAYER + #define SFX_START 1 + #define SFX_BREAKABLE_HIT 1 + #define SFX_BREAKABLE_BREAK 2 + #define SFX_PUSH_BOX 3 + #define SFX_OPEN_LOCK 3 + #define SFX_SHOOT 4 + #define SFX_OBJECT_GET 5 + #define SFX_KILL_ENEMY_STEP 6 + #define SFX_KILL_ENEMY_SHOOT 6 + #define SFX_HIT_ENEMY 7 + #define SFX_ONE_OBJECT_GET 8 + #define SFX_ONE_OBJECT_WRONG 9 + #define SFX_KEY_GET 4 + #define SFX_REFILL_GET 11 + #define SFX_JUMP 2 + #define SFX_SPIKES 2 + #define SFX_ENEMY_HIT 8 + +#else + #define SFX_START 0 + #define SFX_BREAKABLE_HIT 1 + #define SFX_BREAKABLE_BREAK 2 + #define SFX_PUSH_BOX 3 + #define SFX_OPEN_LOCK 3 + #define SFX_SHOOT 4 + #define SFX_OBJECT_GET 5 + #define SFX_KILL_ENEMY_STEP 6 + #define SFX_KILL_ENEMY_SHOOT 6 + #define SFX_HIT_ENEMY 7 + #define SFX_ONE_OBJECT_GET 8 + #define SFX_ONE_OBJECT_WRONG 9 + #define SFX_KEY_GET 10 + #define SFX_REFILL_GET 11 + #define SFX_JUMP 12 + #define SFX_SPIKES 13 + #define SFX_ENEMY_HIT 14 + +#endif \ No newline at end of file diff --git a/examples/goddess/dev/assets/levels.h b/examples/goddess/dev/assets/levels.h index c601614a..bd29b455 100644 --- a/examples/goddess/dev/assets/levels.h +++ b/examples/goddess/dev/assets/levels.h @@ -14,7 +14,7 @@ // Map data, 75 or 150 * (MAP_W*MAP_H) bytes // Bolts, 32 * 4 = 128 bytes // Tileset, 2304 bytes -// Enemies, MAP_W * MAP_H * 3 * 10 bytes +// Enemies, MAP_W * MAP_H * MAX_ENEMS * 10 bytes // Hotspots, MAP_W * MAP_H * 3 bytes // Behs, 48 bytes // Spriteset, 2312 bytes @@ -64,7 +64,7 @@ extern unsigned char font [0]; ._font BINARY "font.bin" #endasm -extern LEVELHEADER level_data [0]; +extern LEVELHEADER level_data; #asm ._level_data defs 16 #endasm @@ -94,7 +94,7 @@ extern unsigned char tileset [0]; extern MALOTE malotes [0]; #asm - ._malotes defs MAP_W * MAP_H * 3 * 10 + ._malotes defs MAP_W * MAP_H * MAX_ENEMS * 10 #endasm extern HOTSPOT hotspots [0]; diff --git a/examples/goddess/dev/compile.bat b/examples/goddess/dev/compile.bat index dbec9703..bad70341 100644 --- a/examples/goddess/dev/compile.bat +++ b/examples/goddess/dev/compile.bat @@ -37,24 +37,65 @@ echo Importando GFX ..\..\..\src\utils\png2scr.exe ..\gfx\marco.png ..\gfx\marco.scr > nul ..\..\..\src\utils\png2scr.exe ..\gfx\ending.png ..\gfx\ending.scr > nul ..\..\..\src\utils\png2scr.exe ..\gfx\loading.png loading.bin > nul -..\..\..\src\utils\apultra.exe ..\gfx\title.scr title.bin > nul -..\..\..\src\utils\apultra.exe ..\gfx\marco.scr marco.bin > nul -..\..\..\src\utils\apultra.exe ..\gfx\ending.scr ending.bin > nul +..\..\..\src\utils\apultra.exe ..\gfx\title.scr ..\bin\title.bin > nul +..\..\..\src\utils\apultra.exe ..\gfx\marco.scr ..\bin\marco.bin > nul +..\..\..\src\utils\apultra.exe ..\gfx\ending.scr ..\bin\ending.bin > nul if [%1]==[justassets] goto :end +rem echo Running The Librarian +rem ..\utils\librarian2.exe list=..\bin\list.txt index=assets\librarian.h bins_prefix=..\bin\ rams_prefix=..\bin\ > nul + +rem *** Música AY: Descomenta el player que vayas a usar (Wyz o Arkos) *** + +rem echo Compilando musica 128k - Wyz Player +rem cd ..\mus +rem ..\utils\apultra.exe menu.mus menu.bin +rem ..\utils\apultra.exe level1.mus level1.bin +rem ..\utils\pasmo WYZproPlay47aZXc.ASM ..\bin\RAM1.bin +rem cd ..\dev + +rem echo Compilando musica 128k - Arkos Player +rem cd ..\mus_arkos +rem if [%1]==[nomus] goto :nomus +rem ..\utils\build_mus_bin.exe ram1.bin > nul +rem :nomus +rem copy ram1.bin ..\bin +rem copy arkos-addresses.h ..\dev\sound +rem cd ..\dev + :compile echo Compilando guego -zcc +zx -vn mk1.c -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul +zcc +zx -vn mk1.c -O3 -crt0=crt.asm -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul +rem zcc +zx -vn mk1.c -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul ..\..\..\src\utils\printsize.exe %game%.bin ..\..\..\src\utils\printsize.exe scripts.bin +rem *** Tipo de cargador *** + echo Construyendo cinta rem cambia LOADER por el nombre que quieres que salga en Program: -..\..\..\src\utils\bas2tap -a10 -sCHERIL3v3 loader\loader.bas loader.tap > nul +..\..\..\src\utils\bas2tap -a10 -sDOGMOLE loader\loader.bas loader.tap > nul ..\..\..\src\utils\bin2tap -o screen.tap -a 16384 loading.bin > nul ..\..\..\src\utils\bin2tap -o main.tap -a 24000 %game%.bin > nul copy /b loader.tap + screen.tap + main.tap %game%.tap > nul +rem echo Construyendo cinta 128k +rem ..\..\..\src\utils\imanol.exe ^ +rem in=loader\loaderzx.asm-orig ^ +rem out=loader\loader.asm ^ +rem ram1_length=?..\bin\RAM1.bin ^ +rem ram3_length=?..\bin\RAM3.bin ^ +rem mb_length=?%game%.bin > nul + +rem ..\utils\pasmo.exe loader\loader.asm ..\bin\loader.bin loader.txt + +rem cambia LOADER por el nombre que quieres que salga en Program: +rem ..\..\..\src\utils\GenTape.exe %game%.tap ^ +rem basic 'LOADER' 10 ..\bin\loader.bin ^ +rem data loading.bin ^ +rem data ..\bin\RAM1.bin ^ +rem data ..\bin\RAM3.bin ^ +rem data %game%.bin if [%1]==[justcompile] goto :end if [%1]==[noclean] goto :end diff --git a/examples/goddess/dev/crt.asm b/examples/goddess/dev/crt.asm new file mode 100644 index 00000000..27e0d47d --- /dev/null +++ b/examples/goddess/dev/crt.asm @@ -0,0 +1,17 @@ + MODULE zx82_crt0 + INCLUDE "zcc_opt.def" + XREF _main ; main() is always external to crt0 code + + IF !STACKPTR + defc STACKPTR = $FFFF + ENDIF + + IF !CRT_ORG_CODE + defc CRT_ORG_CODE = 32768 + ENDIF + + org CRT_ORG_CODE + +start: + ld sp,STACKPTR + jp _main diff --git a/examples/goddess/dev/definitions.h b/examples/goddess/dev/definitions.h index a15cd13b..38f3bd82 100644 --- a/examples/goddess/dev/definitions.h +++ b/examples/goddess/dev/definitions.h @@ -6,7 +6,8 @@ .fsClipStruct defb 0, 24, 0, 32 #endasm -void *joyfunc = sp_JoyKeyboard; // Puntero a la función de manejo seleccionada. +//void *joyfunc = sp_JoyKeyboard; // Puntero a la función de manejo seleccionada. +unsigned int (*joyfunc)(struct sp_UDK *) = sp_JoyKeyboard; const void *joyfuncs [] = { sp_JoyKeyboard, sp_JoyKempston, sp_JoySinclair1 @@ -31,8 +32,15 @@ void *u_free = sp_FreeBlock; // Safe stuff in low(est) RAM -unsigned char safe_byte @ 23296; +unsigned char safe_byte @ 23296; +unsigned int ram_address @ 23297; +unsigned int ram_destination @ 23299; + +#ifdef MODE_128K + unsigned char ram_page @ 23301; +#endif + // Globales muy globalizadas struct sp_SS *sp_player; @@ -49,7 +57,7 @@ unsigned char enoffs; // Aux char asm_number; -unsigned int asm_int; +unsigned int asm_int @ 23302; unsigned int asm_int_2; unsigned int seed; unsigned char half_life; @@ -111,7 +119,7 @@ unsigned char p_tx, p_ty; #endif signed int ptgmx, ptgmy; -const unsigned char *spacer = " "; +unsigned char *spacer = " "; unsigned char enit; @@ -173,7 +181,7 @@ unsigned char map_attr [150]; unsigned char map_buff [150] @ FREEPOOL; // Breakable walls/etc #ifdef BREAKABLE_WALLS - unsigned char brk_buff [150] @ 23297; + unsigned char brk_buff [150] @ 23296+16; #endif // posición del objeto (hotspot). Para no objeto, @@ -187,7 +195,7 @@ unsigned char hotspot_destroy; #ifndef MAX_FLAGS #define MAX_FLAGS 16 #endif -unsigned char flags[MAX_FLAGS]; +unsigned char flags[MAX_FLAGS]; // Globalized unsigned char o_pant; @@ -219,7 +227,7 @@ unsigned char maincounter; // Engine globals (for speed) & size! -unsigned char gpx, gpox, gpy, gpd, gpc, gpt; +unsigned char gpx, gpox, gpy, gpd, gpc; unsigned char gpxx, gpyy, gpcx, gpcy; unsigned char possee, hit_v, hit_h, hit, wall_h, wall_v; unsigned char gpen_x, gpen_y, gpen_cx, gpen_cy, gpaux; @@ -230,7 +238,7 @@ unsigned char *map_pointer; #ifdef PLAYER_CAN_FIRE unsigned char blx, bly; #endif -unsigned char rdx, rdy, rda, rdb, rdc, rdd, rdn; +unsigned char rdx, rdy, rda, rdb, rdc, rdd, rdn, rdt; // More stuff @@ -251,6 +259,7 @@ unsigned char objs_old, keys_old, life_old, killed_old; #ifdef COMPRESSED_LEVELS unsigned char *level_str = "LEVEL 0X"; + unsigned char silent_level = 0; #endif #ifdef GET_X_MORE @@ -271,12 +280,24 @@ unsigned char x0, y0, x1, y1; unsigned char ptx1, pty1, ptx2, pty2; unsigned char *_gp_gen; +#ifdef ENABLE_TILANIMS + unsigned char tait; + unsigned char max_tilanims; + unsigned char tacount; + unsigned char tilanims_xy [MAX_TILANIMS]; + unsigned char tilanims_ft [MAX_TILANIMS]; +#endif + +#if defined USE_AUTO_TILE_SHADOWS || defined USE_AUTO_SHADOWS || defined ENABLE_TILANIMS + unsigned char xx, yy; +#endif + #if defined USE_AUTO_TILE_SHADOWS || defined USE_AUTO_SHADOWS unsigned char c1, c2, c3, c4; unsigned char t1, t2, t3, t4; unsigned char nocast, _ta; - unsigned char xx, yy; #endif + #ifdef USE_AUTO_TILE_SHADOWS unsigned a1, a2, a3; unsigned char *gen_pt_alt; @@ -291,4 +312,7 @@ unsigned char *_gp_gen; #ifdef MODE_128K unsigned char song_playing = 0; + unsigned char player_on = 1; #endif + +unsigned char isrc; diff --git a/examples/goddess/dev/engine.h b/examples/goddess/dev/engine.h index e89eb1a9..bbbbfb9f 100644 --- a/examples/goddess/dev/engine.h +++ b/examples/goddess/dev/engine.h @@ -153,7 +153,7 @@ void espera_activa (int espera) { // Sonido #ifdef MODE_128K - wyz_play_sound (SFX_PUSH_BOX); + PLAY_SOUND (SFX_PUSH_BOX); #else beep_fx (2); #endif @@ -182,7 +182,7 @@ void espera_activa (int espera) { -- p_keys; #ifdef MODE_128K - wyz_play_sound (SFX_OPEN_LOCK); + PLAY_SOUND (SFX_OPEN_LOCK); #else beep_fx (8); #endif @@ -290,6 +290,7 @@ void draw_scr_background (void) { add hl, bc ld (hl), a + #ifdef PACKED_MAP_ALT_TILE ld a, (__t) or a jr nz, _draw_scr_packed_noalt @@ -305,10 +306,12 @@ void draw_scr_background (void) { jr _draw_scr_packed_noalt ._draw_scr_packed_alt_subst - ld a, 19 + ld a, PACKED_MAP_ALT_TILE ld (__t), a ._draw_scr_packed_noalt + #endif + ld hl, _map_buff add hl, bc @@ -326,15 +329,15 @@ void draw_scr_background (void) { #endasm #endif - draw_coloured_tile (); - - #if defined ENABLE_TILANIMS && defined UNPACKED_MAP - // Detect tilanims + #ifdef ENABLE_TILANIMS if (_t >= ENABLE_TILANIMS) { - add_tilanim ((_x - VIEWPORT_X) >> 1, (_y - VIEWPORT_Y) >> 1, _t); + _n = (((_x - VIEWPORT_X) << 3) & 0xf0) | ((_y - VIEWPORT_Y) >> 1); + tilanims_add (); } #endif - + + draw_coloured_tile (); + //_x += 2; if (_x == VIEWPORT_X + 30) { _x = VIEWPORT_X; _y += 2; } #asm ld a, (__x) @@ -355,34 +358,7 @@ void draw_scr_background (void) { #endif } -void draw_scr (void) { - is_rendering = 1; - - #ifdef ENABLE_TILANIMS - max_tilanims = 0; - #endif - - #ifdef ENABLE_FIRE_ZONE - f_zone_ac = 0; - #endif - - draw_scr_background (); - - // Object setup - - enems_load (); - - #ifdef ACTIVATE_SCRIPTING - #if defined LINE_OF_TEXT && !defined LINE_OF_TEXT_NO_AUTOERASE - _x = LINE_OF_TEXT_X; _y = LINE_OF_TEXT; _t = LINE_OF_TEXT_ATTR; _gp_gen = " "; print_str (); - #endif - // Ejecutamos los scripts de entrar en pantalla: - run_script (2 * MAP_W * MAP_H + 1); // ENTERING ANY - run_script (n_pant << 1); // ENTERING SCREEN n - #endif - - #include "my/ci/entering_screen.h" - +void draw_scr_hotspots_locks (void) { /* hotspot_y = 240; rdx = (hotspots [n_pant].xy >> 4); @@ -534,6 +510,14 @@ void draw_scr (void) { cp c jr nz, _open_locks_done + // Remove x=y=np=0 pseudobug in multilevel games + #ifdef COMPRESSED_LEVELS + ld a, b + or d + or e + jr z, _open_locks_done + #endif + ._open_locks_do ld a, d ld (__x), a @@ -573,6 +557,37 @@ void draw_scr (void) { jr nz, _open_locks_loop #endasm #endif +} + +void draw_scr (void) { + is_rendering = 1; + + #ifdef ENABLE_TILANIMS + tilanims_reset (); + #endif + + #ifdef ENABLE_FIRE_ZONE + f_zone_ac = 0; + #endif + + draw_scr_background (); + + // Object setup + + enems_load (); + + #ifdef ACTIVATE_SCRIPTING + #if defined LINE_OF_TEXT && !defined LINE_OF_TEXT_NO_AUTOERASE + _x = LINE_OF_TEXT_X; _y = LINE_OF_TEXT; _t = LINE_OF_TEXT_ATTR; _gp_gen = " "; print_str (); + #endif + // Ejecutamos los scripts de entrar en pantalla: + run_script (2 * MAP_W * MAP_H + 1); // ENTERING ANY + run_script (n_pant << 1); // ENTERING SCREEN n + #endif + + #include "my/ci/entering_screen.h" + + draw_scr_hotspots_locks (); #ifdef PLAYER_CAN_FIRE bullets_init (); @@ -609,7 +624,8 @@ void select_joyfunc (void) { } #ifdef MODE_128K - wyz_play_sound (SFX_START); + STOP_SOUND (); + PLAY_SOUND (SFX_START); sp_WaitForNoKey (); #endif } diff --git a/examples/goddess/dev/engine/breakable.h b/examples/goddess/dev/engine/breakable.h index 81e191c1..01e9423f 100644 --- a/examples/goddess/dev/engine/breakable.h +++ b/examples/goddess/dev/engine/breakable.h @@ -16,14 +16,14 @@ void break_wall (void) { } else { _n = _t = 0; update_tile (); #ifdef MODE_128K - gpix = SFX_BREAKABLE_BREAK + gpit = SFX_BREAKABLE_BREAK; #else gpit = 0; #endif #include "my/ci/on_wall_broken.h" } #ifdef MODE_128K - wyz_play_sound (gpit); + PLAY_SOUND (gpit); #else // Show what just happened before the sound interrupts the action sp_UpdateNow (); diff --git a/examples/goddess/dev/engine/bullets.h b/examples/goddess/dev/engine/bullets.h index 4dda4259..2278b516 100644 --- a/examples/goddess/dev/engine/bullets.h +++ b/examples/goddess/dev/engine/bullets.h @@ -54,10 +54,11 @@ void bullets_fire (void) { #ifdef PLAYER_CAN_FIRE_FLAG if (flags [PLAYER_CAN_FIRE_FLAG] == 0) return; #endif + #ifdef MAX_AMMO if (!p_ammo) return; - -- p_ammo; #endif + // Buscamos una bala libre for (b_it = 0; b_it < MAX_BULLETS; ++ b_it) { if (bullets_estado [b_it] == 0) { @@ -165,7 +166,7 @@ void bullets_fire (void) { #endif #ifdef MODE_128K - wyz_play_sound (SFX_SHOOT); + PLAY_SOUND (SFX_SHOOT); #else beep_fx (6); #endif @@ -180,8 +181,12 @@ void bullets_fire (void) { #include "my/ci/on_player_fires.h" - bullets_update (); + bullets_update (); + #ifdef MAX_AMMO + -- p_ammo; + #endif + break; } } diff --git a/examples/goddess/dev/engine/c_levels.h b/examples/goddess/dev/engine/c_levels.h index 0a76ee0c..cbbaf91a 100644 --- a/examples/goddess/dev/engine/c_levels.h +++ b/examples/goddess/dev/engine/c_levels.h @@ -10,12 +10,12 @@ void prepare_level (void) { #endif { n_pant = level_data.scr_ini; - gpx = level_data->ini_x << 4; p_x = gpx << 6; - gpy = level_data->ini_y << 4; p_y = gpy << 6; + gpx = level_data.ini_x << 4; p_x = gpx << 6; + gpy = level_data.ini_y << 4; p_y = gpy << 6; } #ifdef ACTIVATE_SCRIPTING - main_script_offset = levels [level]->script_offset; + main_script_offset = levels [level].script_offset; #endif #else unpack ((unsigned int) levels [level].c_map_bolts, (unsigned int) (mapa)); @@ -24,11 +24,11 @@ void prepare_level (void) { unpack ((unsigned int) levels [level].c_behs, (unsigned int) (behs)); #ifdef PER_LEVEL_SPRITESET - unpack ((unsigned int) levels [level].c_sprites, (unsigned int) (sprites)); + unpack ((unsigned int) levels [level].c_sprites, (unsigned int) (sprites + 16)); #endif - level_data->map_w = levels.map_w; - level_data->map_h = levels.map_h; + level_data.map_w = levels [level].map_w; + level_data.map_h = levels [level].map_h; #ifdef ACTIVATE_SCRIPTING if (script_result != 3) diff --git a/examples/goddess/dev/engine/enem_mods/enem_type_pursuers.h b/examples/goddess/dev/engine/enem_mods/enem_type_pursuers.h index 7cd62b19..601aa01f 100644 --- a/examples/goddess/dev/engine/enem_mods/enem_type_pursuers.h +++ b/examples/goddess/dev/engine/enem_mods/enem_type_pursuers.h @@ -9,8 +9,8 @@ _en_x = _en_x1; _en_y = _en_y1; en_an_alive [enit] = 1; - en_an_rawv [enit] = 1 << (rand () % 5); - if (en_an_rawv [enit] > 4) en_an_rawv [enit] = 2; + en_an_rawv [enit] = 1 << (rand () & 3); + if (en_an_rawv [enit] > PURSUERS_MAX_V) en_an_rawv [enit] = 2; en_an_dead_row [enit] = 11 + (rand () & 7); #if defined(PLAYER_STEPS_ON_ENEMIES) || defined(PLAYER_CAN_FIRE) _en_life = ENEMIES_LIFE_GAUGE; diff --git a/examples/goddess/dev/engine/enem_mods/enem_type_pursuers_asm.h b/examples/goddess/dev/engine/enem_mods/enem_type_pursuers_asm.h index 6980b4b1..6ce2cc20 100644 --- a/examples/goddess/dev/engine/enem_mods/enem_type_pursuers_asm.h +++ b/examples/goddess/dev/engine/enem_mods/enem_type_pursuers_asm.h @@ -34,19 +34,21 @@ ld a, 1 ld (hl), a - // en_an_rawv [enit] = 1 << (rand () % 5); + // en_an_rawv [enit] = 1 << (rand () & 3); push bc call _rand // rand -> L - ld de, 5 - ex de, hl - call l_div // l_div :: DE / HL -> HL = cociente; DE = resto - ex de, hl // HL = resto + + ld a, l + and 3 + ld l, a + ld h, 0 + ld de, 1 call l_asl // l_asl :: DE << HL -> HL ld a, l pop bc - cp 5 + cp PURSUERS_MAX_V+1 jr c, _eij_rawv_set ld a, 2 diff --git a/examples/goddess/dev/engine/enengine.h b/examples/goddess/dev/engine/enengine.h index 17dddc2c..4acb013d 100644 --- a/examples/goddess/dev/engine/enengine.h +++ b/examples/goddess/dev/engine/enengine.h @@ -14,8 +14,8 @@ #if defined(PLAYER_STEPS_ON_ENEMIES) || defined (PLAYER_CAN_FIRE) void enems_init (void) { enit = 0; - while (enit < MAP_W * MAP_H * 3) { - malotes [enit].t = malotes [enit].t & 15; + while (enit < MAP_W * MAP_H * MAX_ENEMS) { + malotes [enit].t = malotes [enit].t & 0xEF; // Clear bit 4 #ifdef PLAYER_CAN_FIRE malotes [enit].life = ENEMIES_LIFE_GAUGE; #endif @@ -121,7 +121,7 @@ void enems_draw_current (void) { void enems_load (void) { // Movemos y cambiamos a los enemigos según el tipo que tengan - enoffs = n_pant * 3; + enoffs = n_pant * MAX_ENEMS; for (enit = 0; enit < MAX_ENEMS; ++ enit) { en_an_frame [enit] = 0; @@ -141,6 +141,10 @@ void enems_load (void) { #endif #endif + #include "my/ci/enems_custom_respawn.h" + + en_an_next_frame [enit] = sprite_18_a; + switch (malotes [enoffsmasi].t & 0x1f) { case 1: case 2: @@ -184,13 +188,8 @@ void enems_load (void) { #endif #include "my/ci/enems_load.h" - - default: - en_an_next_frame [enit] = sprite_18_a; } - malotes [enoffsmasi].t &= 0x1f; - #include "my/ci/enems_extra_mods.h" } } @@ -227,7 +226,7 @@ void enems_move (void) { ld hl, (_enoffsmasi) ld h, 0 - #ifdef PLAYER_CAN_FIRE + #if defined PLAYER_CAN_FIRE || defined COMPRESSED_LEVELS add hl, hl // x2 ld d, h ld e, l // DE = x2 @@ -284,6 +283,8 @@ void enems_move (void) { ld a, (hl) ld (__en_t), a + and 0x1f + ld (_rdt), a #ifdef PLAYER_CAN_FIRE inc hl @@ -316,7 +317,7 @@ void enems_move (void) { #endif #endif - switch (_en_t) { + switch (rdt) { case 1: case 2: case 3: @@ -326,7 +327,7 @@ void enems_move (void) { #endif #include "engine/enem_mods/enem_type_lineal.h" #ifdef ENABLE_ORTHOSHOOTERS - if (_en_t == 5) { + if (rdt == 5) { #include "engine/enem_mods/enem_type_orthoshooters.h" } #endif @@ -443,13 +444,13 @@ void enems_move (void) { // Step over enemy #ifdef PLAYER_CAN_STEP_ON_FLAG if (flags [PLAYER_CAN_STEP_ON_FLAG] != 0 && - gpy < _en_y - 2 && p_vy >= 0 && _en_t >= PLAYER_MIN_KILLABLE) + gpy < _en_y - 2 && p_vy >= 0 && rdt >= PLAYER_MIN_KILLABLE) #else - if (gpy < _en_y - 2 && p_vy >= 0 && _en_t >= PLAYER_MIN_KILLABLE) + if (gpy < _en_y - 2 && p_vy >= 0 && rdt >= PLAYER_MIN_KILLABLE) #endif { #ifdef MODE_128K - wyz_play_sound (SFX_KILL_ENEMY_STEP); + PLAY_SOUND (SFX_KILL_ENEMY_STEP); en_an_state [enit] = GENERAL_DYING; en_an_count [enit] = 12; en_an_next_frame [enit] = sprite_17_a; @@ -519,7 +520,7 @@ void enems_move (void) { #ifdef PLAYER_CAN_FIRE // Collide with bullets #ifdef FIRE_MIN_KILLABLE - if (_en_t >= FIRE_MIN_KILLABLE) + if (rdt >= FIRE_MIN_KILLABLE) #endif { for (gpjt = 0; gpjt < MAX_BULLETS; gpjt ++) { @@ -548,7 +549,7 @@ void enems_move (void) { #ifdef MODE_128K en_an_state [enit] = GENERAL_DYING; en_an_count [enit] = 12; - wyz_play_sound (SFX_KILL_ENEMY_SHOOT); + PLAY_SOUND (SFX_KILL_ENEMY_SHOOT); #else beep_fx (5); en_an_next_frame [enit] = sprite_18_a; @@ -562,7 +563,7 @@ void enems_move (void) { } #ifdef MODE_128K - wyz_play_sound (SFX_HIT_ENEMY); + PLAY_SOUND (SFX_HIT_ENEMY); #else beep_fx (1); #endif diff --git a/examples/goddess/dev/engine/hotspots.h b/examples/goddess/dev/engine/hotspots.h index 10f9978c..3a1b3223 100644 --- a/examples/goddess/dev/engine/hotspots.h +++ b/examples/goddess/dev/engine/hotspots.h @@ -25,13 +25,13 @@ void hotspots_do (void) { if (p_objs == 0) { p_objs ++; #ifdef MODE_128K - wyz_play_sound (SFX_ONE_OBJECT_GET); + PLAY_SOUND (SFX_ONE_OBJECT_GET); #else beep_fx (9); #endif } else { #ifdef MODE_128K - wyz_play_sound (SFX_ONE_OBJECT_WRONG); + PLAY_SOUND (SFX_ONE_OBJECT_WRONG); #else beep_fx (4); #endif @@ -45,7 +45,7 @@ void hotspots_do (void) { #endif #ifdef MODE_128K - wyz_play_sound (SFX_OBJECT_GET); + PLAY_SOUND (SFX_OBJECT_GET); #else beep_fx (9); #endif @@ -70,7 +70,7 @@ void hotspots_do (void) { case 2: p_keys ++; #ifdef MODE_128K - wyz_play_sound (SFX_KEY_GET); + PLAY_SOUND (SFX_KEY_GET); #else beep_fx (7); #endif @@ -83,7 +83,7 @@ void hotspots_do (void) { if (p_life > PLAYER_LIFE) p_life = PLAYER_LIFE; #ifdef MODE_128K - wyz_play_sound (SFX_REFILL_GET); + PLAY_SOUND (SFX_REFILL_GET); #else beep_fx (8); #endif @@ -97,7 +97,7 @@ void hotspots_do (void) { else p_ammo = MAX_AMMO; #ifdef MODE_128K - wyz_play_sound (SFX_REFILL_GET); + PLAY_SOUND (SFX_REFILL_GET); #else beep_fx (9); #endif @@ -111,7 +111,7 @@ void hotspots_do (void) { else timer_t = 99; #ifdef MODE_128K - wyz_play_sound (SFX_REFILL_GET); + PLAY_SOUND (SFX_REFILL_GET); #else beep_fx (7); #endif @@ -122,7 +122,7 @@ void hotspots_do (void) { case 6: mem_save (); #ifdef MODE_128K - wyz_play_sound (SFX_START); + PLAY_SOUND (SFX_START); #else beep_fx (7); #endif diff --git a/examples/goddess/dev/engine/isr.h b/examples/goddess/dev/engine/isr.h new file mode 100644 index 00000000..76b5bf4a --- /dev/null +++ b/examples/goddess/dev/engine/isr.h @@ -0,0 +1,15 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// Very simple ISR which counts frames. + +#asm + defw 0 // 2 bytes libres +#endasm + +void ISR (void) { + #asm + ld hl, _isrc + inc (hl) + #endasm +} diff --git a/examples/goddess/dev/engine/player.h b/examples/goddess/dev/engine/player.h index 7256df57..59844d68 100644 --- a/examples/goddess/dev/engine/player.h +++ b/examples/goddess/dev/engine/player.h @@ -28,17 +28,20 @@ void player_init (void) { #if !defined(COMPRESSED_LEVELS) || defined(REFILL_ME) p_life = PLAYER_LIFE; #endif - p_objs = 0; - p_keys = 0; - p_killed = 0; p_disparando = 0; - #ifdef MAX_AMMO - #ifdef INITIAL_AMMO - p_ammo = INITIAL_AMMO; - #else - p_ammo = MAX_AMMO; + + #ifndef NO_RESET_STATS + p_objs = 0; + p_keys = 0; + p_killed = 0; + #ifdef MAX_AMMO + #ifdef INITIAL_AMMO + p_ammo = INITIAL_AMMO; + #else + p_ammo = MAX_AMMO; + #endif #endif - #endif + #endif #ifdef TIMER_ENABLE timer_count = 0; @@ -283,6 +286,7 @@ unsigned char player_move (void) { // Collision, may set possee, hit_v + // Velocity positive (going downwards) player_calc_bounding_box (); hit_v = 0; @@ -400,7 +404,7 @@ unsigned char player_move (void) { p_saltando = 1; p_cont_salto = 0; #ifdef MODE_128K - wyz_play_sound (SFX_JUMP); + PLAY_SOUND (SFX_JUMP); #else beep_fx (3); #endif @@ -426,7 +430,7 @@ unsigned char player_move (void) { p_saltando = 1; p_cont_salto = 0; #ifdef MODE_128K - wyz_play_sound (SFX_JUMP); + PLAY_SOUND (SFX_JUMP); #else beep_fx (3); #endif @@ -446,43 +450,47 @@ unsigned char player_move (void) { // MOVEMENT IN THE HORIZONTAL AXIS // *************************************************************************** - if ( ! ((pad0 & sp_LEFT) == 0 || (pad0 & sp_RIGHT) == 0)) { - #ifdef PLAYER_GENITAL - p_facing_h = 0xff; - #endif - if (p_vx > 0) { - p_vx -= PLAYER_RX; - if (p_vx < 0) p_vx = 0; - } else if (p_vx < 0) { - p_vx += PLAYER_RX; - if (p_vx > 0) p_vx = 0; + #ifndef PLAYER_DISABLE_DEFAULT_HENG + if ( ! ((pad0 & sp_LEFT) == 0 || (pad0 & sp_RIGHT) == 0)) { + #ifdef PLAYER_GENITAL + p_facing_h = 0xff; + #endif + if (p_vx > 0) { + p_vx -= PLAYER_RX; + if (p_vx < 0) p_vx = 0; + } else if (p_vx < 0) { + p_vx += PLAYER_RX; + if (p_vx > 0) p_vx = 0; + } + wall_h = 0; } - wall_h = 0; - } - if ((pad0 & sp_LEFT) == 0) { - #ifdef PLAYER_GENITAL - p_facing_h = FACING_LEFT; - #endif - if (p_vx > -PLAYER_MAX_VX) { - #ifndef PLAYER_GENITAL - p_facing = 0; + if ((pad0 & sp_LEFT) == 0) { + #ifdef PLAYER_GENITAL + p_facing_h = FACING_LEFT; #endif - p_vx -= PLAYER_AX; + if (p_vx > -PLAYER_MAX_VX) { + #ifndef PLAYER_GENITAL + p_facing = 0; + #endif + p_vx -= PLAYER_AX; + } } - } - if ((pad0 & sp_RIGHT) == 0) { - #ifdef PLAYER_GENITAL - p_facing_h = FACING_RIGHT; - #endif - if (p_vx < PLAYER_MAX_VX) { - p_vx += PLAYER_AX; - #ifndef PLAYER_GENITAL - p_facing = 1; + if ((pad0 & sp_RIGHT) == 0) { + #ifdef PLAYER_GENITAL + p_facing_h = FACING_RIGHT; #endif + if (p_vx < PLAYER_MAX_VX) { + p_vx += PLAYER_AX; + #ifndef PLAYER_GENITAL + p_facing = 1; + #endif + } } - } + #endif + + #include "my/ci/custom_heng.h" p_x = p_x + p_vx; #ifndef PLAYER_GENITAL @@ -606,7 +614,7 @@ unsigned char player_move (void) { #elif defined (BOUNDING_BOX_8_CENTERED) cy1 = (gpy + 3) >> 4; #else - cy1 = gpy >> 3; + cy1 = (gpy - 1) >> 3; #endif if (attr (cx1, cy1) == 10) { @@ -636,7 +644,7 @@ unsigned char player_move (void) { #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) cx1 = (gpx + 3) >> 4; #else - cx1 = gpx >> 4; + cx1 = (gpx - 1) >> 4; #endif if (attr (cx1, cy1) == 10) { @@ -717,19 +725,19 @@ unsigned char player_move (void) { } } - p_next_frame = player_cells [p_facing + p_frame]; + p_next_frame = (unsigned char *) (player_cells [p_facing + p_frame]); #elif defined PLAYER_BOOTEE gpit = p_facing << 2; if (p_vy == 0) { - p_next_frame = player_cells [gpit]; + p_next_frame = (unsigned char *) (player_cells [gpit]); } else if (p_vy < 0) { - p_next_frame = player_cells [gpit + 1]; + p_next_frame = (unsigned char *) (player_cells [gpit + 1]); } else { - p_next_frame = player_cells [gpit + 2]; + p_next_frame = (unsigned char *) (player_cells [gpit + 2]); } #else if (!possee && !p_gotten) { - p_next_frame = player_cells [8 + p_facing]; + p_next_frame = (unsigned char *) (player_cells [8 + p_facing]); } else { gpit = p_facing << 2; if (p_vx == 0) { @@ -737,7 +745,7 @@ unsigned char player_move (void) { } else { rda = ((gpx + 4) >> 3) & 3; } - p_next_frame = player_cells [gpit + rda]; + p_next_frame = (unsigned char *) (player_cells [gpit + rda]); } #endif } @@ -752,7 +760,7 @@ void player_kill (unsigned char sound) { player_deplete (); #ifdef MODE_128K - wyz_play_sound (sound); + PLAY_SOUND (sound); #else beep_fx (sound); #endif diff --git a/examples/goddess/dev/engine/player_wip.h b/examples/goddess/dev/engine/player_wip.h new file mode 100644 index 00000000..815761a3 --- /dev/null +++ b/examples/goddess/dev/engine/player_wip.h @@ -0,0 +1,884 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// player.h + +void player_init (void) { + // Inicializa player con los valores iniciales + // (de ahí lo de inicializar). + + #ifndef COMPRESSED_LEVELS + gpx = PLAYER_INI_X << 4; p_x = gpx << 6; + gpy = PLAYER_INI_Y << 4; p_y = gpy << 6; + #endif + p_vy = 0; + p_vx = 0; + p_cont_salto = 1; + p_saltando = 0; + p_frame = 0; + p_subframe = 0; + #ifdef PLAYER_GENITAL + p_facing = FACING_DOWN; + p_facing_v = p_facing_h = 0xff; + #else + p_facing = 1; + #endif + p_estado = EST_NORMAL; + p_ct_estado = 0; + #if !defined(COMPRESSED_LEVELS) || defined(REFILL_ME) + p_life = PLAYER_LIFE; + #endif + p_objs = 0; + p_keys = 0; + p_killed = 0; + p_disparando = 0; + #ifdef MAX_AMMO + #ifdef INITIAL_AMMO + p_ammo = INITIAL_AMMO; + #else + p_ammo = MAX_AMMO; + #endif + #endif + + #ifdef TIMER_ENABLE + timer_count = 0; + timer_zero = 0; + #ifdef TIMER_LAPSE + timer_frames = TIMER_LAPSE; + #endif + #ifdef TIMER_INITIAL + timer_t = TIMER_INITIAL; + #endif + #ifdef TIMER_START + timer_on = 1; + #else + timer_on = 0; + #endif + #endif +} + +void player_calc_bounding_box (void) { + #if defined (BOUNDING_BOX_8_BOTTOM) + #asm + ld a, (_gpx) + add 4 + srl a + srl a + srl a + srl a + ld (_ptx1), a + ld a, (_gpx) + add 11 + srl a + srl a + srl a + srl a + ld (_ptx2), a + ld a, (_gpy) + add 8 + srl a + srl a + srl a + srl a + ld (_pty1), a + ld a, (_gpy) + add 15 + srl a + srl a + srl a + srl a + ld (_pty2), a + #endasm + #elif defined (BOUNDING_BOX_8_CENTERED) + #asm + ld a, (_gpx) + add 4 + srl a + srl a + srl a + srl a + ld (_ptx1), a + ld a, (_gpx) + add 11 + srl a + srl a + srl a + srl a + ld (_ptx2), a + ld a, (_gpy) + add 4 + srl a + srl a + srl a + srl a + ld (_pty1), a + ld a, (_gpy) + add 11 + srl a + srl a + srl a + srl a + ld (_pty2), a + #endasm + #else + #asm + ld a, (_gpx) + srl a + srl a + srl a + srl a + ld (_ptx1), a + ld a, (_gpx) + add 15 + srl a + srl a + srl a + srl a + ld (_ptx2), a + ld a, (_gpy) + srl a + srl a + srl a + srl a + ld (_pty1), a + ld a, (_gpy) + add 15 + srl a + srl a + srl a + srl a + ld (_pty2), a + #endasm + #endif +} + +unsigned char player_move (void) { + + // *************************************************************************** + // MOVEMENT IN THE VERTICAL AXIS + // *************************************************************************** + + #if !defined PLAYER_GENITAL || defined VENG_SELECTOR + + #if !defined PLAYER_DISABLE_GRAVITY + #if defined VENG_SELECTOR && defined PLAYER_VKEYS + if (veng_selector != VENG_KEYS) + #endif + { + // Do gravity + + #asm + ; Signed comparisons are hard + ; p_vy <= PLAYER_MAX_VY_CAYENDO - PLAYER_G + + ; We are going to take a shortcut. + ; If p_vy < 0, just add PLAYER_G. + ; If p_vy > 0, we can use unsigned comparition anyway. + + ld hl, (_p_vy) + bit 7, h + jr nz, _player_gravity_add ; < 0 + + ld de, PLAYER_MAX_VY_CAYENDO - PLAYER_G + or a + push hl + sbc hl, de + pop hl + jr nc, _player_gravity_maximum + + ._player_gravity_add + ld de, PLAYER_G + add hl, de + jr _player_gravity_vy_set + + ._player_gravity_maximum + ld hl, PLAYER_MAX_VY_CAYENDO + + ._player_gravity_vy_set + ld (_p_vy), hl + + ._player_gravity_done + + #ifdef PLAYER_CUMULATIVE_JUMP + ld a, (_p_jmp_on) + or a + jr nz, _player_gravity_p_gotten_done + #endif + + ld a, (_p_gotten) + or a + jr z, _player_gravity_p_gotten_done + + xor a + ld (_p_vy), a + + ._player_gravity_p_gotten_done + #endasm + } + #endif + #endif + + #if defined PLAYER_GENITAL || (defined VENG_SELECTOR && defined PLAYER_VKEYS) + + #if defined (VENG_SELECTOR) + if (veng_selector == VENG_KEYS ) + #endif + { + // Pad do + + if ( ! ((pad0 & sp_UP) == 0 || (pad0 & sp_DOWN) == 0)) { + p_facing_v = 0xff; + wall_v = 0; + if (p_vy > 0) { + p_vy -= PLAYER_RX; + if (p_vy < 0) p_vy = 0; + } else if (p_vy < 0) { + p_vy += PLAYER_RX; + if (p_vy > 0) p_vy = 0; + } + } + + if ((pad0 & sp_UP) == 0) { + p_facing_v = FACING_UP; + if (p_vy > -PLAYER_MAX_VX) p_vy -= PLAYER_AX; + } + + if ((pad0 & sp_DOWN) == 0) { + p_facing_v = FACING_DOWN; + if (p_vy < PLAYER_MAX_VX) p_vy += PLAYER_AX; + } + } + #endif + + #ifdef PLAYER_HAS_JETPAC + #ifdef VENG_SELECTOR + if (veng_selector == VENG_JETPAC) + #endif + { + if ((pad0 & sp_UP) == 0) { + p_vy -= PLAYER_INCR_JETPAC; + if (p_vy < -PLAYER_MAX_VY_JETPAC) p_vy = -PLAYER_MAX_VY_JETPAC; + + #include "my/ci/on_jetpac_boost.h" + + p_jetpac_on = 1; + } else p_jetpac_on = 0; + } + #endif + + #include "my/ci/custom_veng.h" + + p_y += p_vy; + + #if !defined (PLAYER_GENITAL) + if (p_gotten) p_y += ptgmy; + #endif + + // Safe + + if (p_y < 0) p_y = 0; + if (p_y > 9216) p_y = 9216; + + gpy = p_y >> 6; + + // Collision, may set possee, hit_v + + #asm + call _player_calc_bounding_box + + xor a + ld (_hit_v), a + + ld a, (_ptx1) + ld (_cx1), a + ld a, (_ptx2) + ld (_cx2), a + + // Calculate vertical velocity + + ld a, (_p_vy) + #if !defined (PLAYER_GENITAL) + ld c, a + ld a, (_ptgmy) + add c + #endif + + // Skip if not moving in the vertical axis + + or a + jp z, _va_collision_done + + // Check sign + + bit 7, a + jr z, _va_collision_vy_positive + + ._va_collision_vy_negative + + // Velocity negative (going upwards) + + ld a, (_pty1) + ld (_cy1), a + ld (_cy2), a + + call _cm_two_points + + // if ((at1 & 8) || (at2 & 8)) { + ld a, (_at1) + and 8 + jr nz, _va_col_vy_neg_do + + ld a, (_at2) + and 8 + jr z, _va_collision_checkevil + + ._va_col_vy_neg_do + + #ifdef PLAYER_BOUNCE_WITH_WALLS + ld a, (_p_vy) + sra a + neg a + #else + xor a + #endif + ld (_p_vy), a + + ld a, (_pty1) + inc a + sla a + sla a + sla a + sla a + + #if defined (BOUNDING_BOX_8_BOTTOM) + // gpy = ((pty1 + 1) << 4) - 8; + sub 8 + #elif defined (BOUNDING_BOX_8_CENTERED) + // gpy = ((pty1 + 1) << 4) - 4; + sub 4 + #elif defined (BOUNDING_BOX_TINY_BOTTOM) + // gpy = ((pty1 + 1) << 4) - 14; + sub 14 + #else + // gpy = ((pty1 + 1) << 4); + #endif + + ld (_gpy), a + + // p_y = gpy << FIXBITS; 16 bits shift + ld d, 0 + ld e, a + ld l, FIXBITS + call l_asl + ld (_p_y), hl + + #if defined PLAYER_GENITAL || defined LOCKS_CHECK_VERTICAL + ld a, WTOP + ld (_wall_v), a + #endif + + jr _va_collision_checkevil + + ._va_collision_vy_positive + + // Velocity positive (going downwards) + ld a, (_pty2) + ld (_cy1), a + ld (_cy2), a + + call _cm_two_points + + #ifdef PLAYER_GENITAL + // if ((at1 & 8) || (at2 & 8)) { + ld a, (_at1) + and 8 + jr nz, _va_col_vy_pos_do + + ld a, (_at2) + and 8 + jr z, _va_collision_checkevil + #else + // if ((at1 & 8) || + ld a, (_at1) + and 8 + jr nz, _va_col_vy_pos_do + + // (at2 & 8) || + ld a, (_at2) + and 8 + jr nz, _va_col_vy_pos_do + + // (((gpy - 1) & 15) < 8 && + ld a, (_gpy) + dec a + and 15 + cp 8 + jr nc, _va_collision_checkevil + + // ((at1 & 4) || (at2 & 4)))) + ld a, (_at1) + and 4 + jr nz, _va_col_vy_pos_do + + ld a, (_at2) + and 4 + jr z, _va_collision_checkevil + #endif + ._va_col_vy_pos_do + + #ifdef PLAYER_BOUNCE_WITH_WALLS + ld a, (_p_vy) + sra a + neg a + #else + xor a + #endif + ld (_p_vy), a + + ld a, (_pty2) + dec a + sla a + sla a + sla a + sla a + + #ifdef BOUNDING_BOX_8_CENTERED + add 4 + #endif + + ld (_gpy), a + + // p_y = gpy << FIXBITS; 16 bits shift + ld d, 0 + ld e, a + ld l, FIXBITS + call l_asl + ld (_p_y), hl + + #if defined PLAYER_GENITAL || defined LOCKS_CHECK_VERTICAL + ld a, WBOTTOM + ld (_wall_v), a + #endif + + jr _va_collision_done + + ._va_collision_checkevil + + #ifndef DEACTIVATE_EVIL_TILE + #endasm + hit_v = ((at1 & 1) || (at2 & 1)); + #asm + #endif + + ._va_collision_done + #endasm + + gpxx = gpx >> 4; + gpyy = gpy >> 4; + + #ifndef PLAYER_GENITAL + cy1 = cy2 = (gpy + 16) >> 4; + cx1 = ptx1; cx2 = ptx2; + cm_two_points (); + possee = ((at1 & 12) || (at2 & 12)) && (gpy & 15) < 8; + #endif + + // Jump + + #ifdef PLAYER_HAS_JUMP + #ifdef VENG_SELECTOR + if (veng_selector == VENG_JUMP) + #endif + { + #if defined (PLAYER_CAN_FIRE) && !defined (USE_TWO_BUTTONS) + rda = (pad0 & sp_UP) == 0; + #elif defined (PLAYER_CAN_FIRE) && defined (USE_TWO_BUTTONS) + rda = isJoy ? ((pad0 & sp_UP) == 0) : (sp_KeyPressed (key_jump)); + #else + rda = (pad0 & sp_FIRE) == 0; + #endif + + if (rda) { + if (p_saltando == 0) { + if (possee || p_gotten || hit_v) { + p_saltando = 1; + p_cont_salto = 0; + #ifdef MODE_128K + PLAY_SOUND (SFX_JUMP); + #else + beep_fx (3); + #endif + } + } else { + p_vy -= (PLAYER_VY_INICIAL_SALTO + PLAYER_INCR_SALTO - (p_cont_salto >> 1)); + if (p_vy < -PLAYER_MAX_VY_SALTANDO) p_vy = -PLAYER_MAX_VY_SALTANDO; + ++ p_cont_salto; + if (p_cont_salto == 9) p_saltando = 0; + } + } else p_saltando = 0; + } + #endif + + // Bootee engine + + #ifdef PLAYER_BOOTEE + #ifdef VENG_SELECTOR + if (veng_selector == VENG_BOOTEE) + #endif + { + if ( p_saltando == 0 && (possee || p_gotten || hit_v) ) { + p_saltando = 1; + p_cont_salto = 0; + #ifdef MODE_128K + PLAY_SOUND (SFX_JUMP); + #else + beep_fx (3); + #endif + } + + if (p_saltando ) { + p_vy -= (PLAYER_VY_INICIAL_SALTO + PLAYER_INCR_SALTO - (p_cont_salto>>1)); + if (p_vy < -PLAYER_MAX_VY_SALTANDO) p_vy = -PLAYER_MAX_VY_SALTANDO; + ++ p_cont_salto; + if (p_cont_salto == 8) + p_saltando = 0; + } + } + #endif + + // *************************************************************************** + // MOVEMENT IN THE HORIZONTAL AXIS + // *************************************************************************** + + #ifndef PLAYER_DISABLE_DEFAULT_HENG + if ( ! ((pad0 & sp_LEFT) == 0 || (pad0 & sp_RIGHT) == 0)) { + #ifdef PLAYER_GENITAL + p_facing_h = 0xff; + #endif + if (p_vx > 0) { + p_vx -= PLAYER_RX; + if (p_vx < 0) p_vx = 0; + } else if (p_vx < 0) { + p_vx += PLAYER_RX; + if (p_vx > 0) p_vx = 0; + } + wall_h = 0; + } + + if ((pad0 & sp_LEFT) == 0) { + #ifdef PLAYER_GENITAL + p_facing_h = FACING_LEFT; + #endif + if (p_vx > -PLAYER_MAX_VX) { + #ifndef PLAYER_GENITAL + p_facing = 0; + #endif + p_vx -= PLAYER_AX; + } + } + + if ((pad0 & sp_RIGHT) == 0) { + #ifdef PLAYER_GENITAL + p_facing_h = FACING_RIGHT; + #endif + if (p_vx < PLAYER_MAX_VX) { + p_vx += PLAYER_AX; + #ifndef PLAYER_GENITAL + p_facing = 1; + #endif + } + } + #endif + + #include "my/ci/custom_heng.h" + + p_x = p_x + p_vx; + #ifndef PLAYER_GENITAL + p_x += ptgmx; + #endif + + // Safe + + if (p_x < 0) p_x = 0; + if (p_x > 14336) p_x = 14336; + + gpox = gpx; + gpx = p_x >> 6; + + // Collision. May set hit_h + player_calc_bounding_box (); + + hit_h = 0; + cy1 = pty1; cy2 = pty2; + + #if defined (PLAYER_GENITAL) + if (p_vx < 0) + #else + if (p_vx + ptgmx < 0) + #endif + { + cx1 = cx2 = ptx1; + cm_two_points (); + + if ((at1 & 8) || (at2 & 8)) { + #include "my/ci/bg_collision/obstacle_left.h" + + #ifdef PLAYER_BOUNCE_WITH_WALLS + p_vx = -(p_vx / 2); + #else + p_vx = 0; + #endif + + #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) || defined (BOUNDING_BOX_TINY_BOTTOM) + gpx = ((ptx1 + 1) << 4) - 4; + #else + gpx = ((ptx1 + 1) << 4); + #endif + + p_x = gpx << 6; + wall_h = WLEFT; + } + #ifndef DEACTIVATE_EVIL_TILE + else hit_h = ((at1 & 1) || (at2 & 1)); + #endif + + } + + #if defined (PLAYER_GENITAL) + if (p_vx > 0) + #else + if (p_vx + ptgmx > 0) + #endif + { + cx1 = cx2 = ptx2; + cm_two_points (); + + if ((at1 & 8) || (at2 & 8)) { + #include "my/ci/bg_collision/obstacle_right.h" + + #ifdef PLAYER_BOUNCE_WITH_WALLS + p_vx = -(p_vx / 2); + #else + p_vx = 0; + #endif + + #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) || defined (BOUNDING_BOX_TINY_BOTTOM) + gpx = (ptx1 << 4) + 4; + #else + gpx = (ptx1 << 4); + #endif + + p_x = gpx << 6; + wall_h = WRIGHT; + } + #ifndef DEACTIVATE_EVIL_TILE + else hit_h = ((at1 & 1) || (at2 & 1)); + #endif + + } + + // Priority to decide facing + + #ifdef PLAYER_GENITAL + #ifdef TOP_OVER_SIDE + if (p_facing_v != 0xff) { + p_facing = p_facing_v; + } else if (p_facing_h != 0xff) { + p_facing = p_facing_h; + } + #else + if (p_facing_h != 0xff) { + p_facing = p_facing_h; + } else if (p_facing_v != 0xff) { + p_facing = p_facing_v; + } + #endif + #endif + + cx1 = p_tx = (gpx + 8) >> 4; + cy1 = p_ty = (gpy + 8) >> 4; + + rdb = attr (cx1, cy1); + + // Special tiles + if (rdb & 128) { + #include "my/ci/on_special_tile.h" + } + + #if defined (PLAYER_PUSH_BOXES) || !defined (DEACTIVATE_KEYS) + #if defined PLAYER_GENITAL || defined LOCKS_CHECK_VERTICAL + if (wall_v == WTOP) { + // interact up + #if defined (BOUNDING_BOX_8_BOTTOM) + cy1 = (gpy + 7) >> 4; + #elif defined (BOUNDING_BOX_8_CENTERED) + cy1 = (gpy + 3) >> 4; + #else + cy1 = (gpy - 1) >> 3; + #endif + + if (attr (cx1, cy1) == 10) { + x0 = x1 = cx1; y0 = cy1; y1 = cy1 - 1; + process_tile (); + } + + } else if (wall_v == WBOTTOM) { + // interact down + #if defined (BOUNDING_BOX_8_BOTTOM) + cy1 = (gpy + 16) >> 4; + #elif defined (BOUNDING_BOX_8_CENTERED) + cy1 = (gpy + 12) >> 4; + #else + cy1 = (gpy + 16) >> 3; + #endif + + if (attr (cx1, cy1) == 10) { + x0 = x1 = cx1; y0 = cy1; y1 = cy1 + 1; + process_tile (); + } + } else + #endif + + if (wall_h == WLEFT) { + // interact left + #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) + cx1 = (gpx + 3) >> 4; + #else + cx1 = (gpx - 1) >> 4; + #endif + + if (attr (cx1, cy1) == 10) { + y0 = y1 = cy1; x0 = cx1; x1 = cx1 - 1; + process_tile (); + } + } else if (wall_h == WRIGHT) { + // interact right + #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) + cx1 = (gpx + 12) >> 4; + #else + cx1 = (gpx + 16) >> 4; + #endif + if (attr (cx1, cy1) == 10) { + y0 = y1 = cy1; x0 = cx1; x1 = cx1 + 1; + process_tile (); + } + } + #endif + + #ifdef PLAYER_CAN_FIRE + // Disparos + if ((pad0 & sp_FIRE) == 0 && p_disparando == 0) { + p_disparando = 1; + #ifdef FIRE_TO_PUSH + //if (pushed_any == 0) + #endif + bullets_fire (); + #ifdef FIRE_TO_PUSH + //else pushed_any = 0; + #endif + } + + if ((pad0 & sp_FIRE)) + p_disparando = 0; + + #endif + + #ifndef DEACTIVATE_EVIL_TILE + // Tiles que te matan. + // hit_v tiene preferencia sobre hit_h + hit = 0; + if (hit_v) { + hit = 1; + p_vy = addsign (-p_vy, PLAYER_MAX_VX); + } else if (hit_h) { + hit = 1; + p_vx = addsign (-p_vx, PLAYER_MAX_VX); + } + + if (hit) { + #ifdef PLAYER_FLICKERS + if (p_estado == EST_NORMAL) + #endif + { + #ifdef MODE_128K + p_killme = SFX_SPIKES; + #else + p_killme = 4; + #endif + } + } + #endif + + // Select animation frame + + #ifdef PLAYER_CUSTOM_ANIMATION + #include "my/custom_animation.h" + #elif defined PLAYER_GENITAL + if (p_vx || p_vy) { + ++ p_subframe; + if (p_subframe == 4) { + p_subframe = 0; + p_frame = !p_frame; + #ifdef PLAYER_STEP_SOUND + step (); + #endif + } + } + + p_next_frame = player_cells [p_facing + p_frame]; + #elif defined PLAYER_BOOTEE + gpit = p_facing << 2; + if (p_vy == 0) { + p_next_frame = player_cells [gpit]; + } else if (p_vy < 0) { + p_next_frame = player_cells [gpit + 1]; + } else { + p_next_frame = player_cells [gpit + 2]; + } + #else + if (!possee && !p_gotten) { + p_next_frame = player_cells [8 + p_facing]; + } else { + gpit = p_facing << 2; + if (p_vx == 0) { + rda = 1; + } else { + rda = ((gpx + 4) >> 3) & 3; + } + p_next_frame = player_cells [gpit + rda]; + } + #endif +} + +void player_deplete (void) { + p_life = (p_life > p_kill_amt) ? p_life - p_kill_amt : 0; +} + +void player_kill (unsigned char sound) { + p_killme = 0; + + player_deplete (); + + #ifdef MODE_128K + PLAY_SOUND (sound); + #else + beep_fx (sound); + #endif + + #ifdef CP_RESET_WHEN_DYING + #ifdef CP_RESET_ALSO_FLAGS + mem_load (); + #else + n_pant = sg_pool [MAX_FLAGS]; + p_x = sg_pool [MAX_FLAGS + 1] << 10; + p_y = sg_pool [MAX_FLAGS + 2] << 10; + #endif + o_pant = 0xff; // Reload + #endif + + #ifdef PLAYER_FLICKERS + p_estado = EST_PARP; + p_ct_estado = 50; + #endif +} + diff --git a/examples/goddess/dev/engine/simple_cocos.h b/examples/goddess/dev/engine/simple_cocos.h index 1c33a2a5..5a4da667 100644 --- a/examples/goddess/dev/engine/simple_cocos.h +++ b/examples/goddess/dev/engine/simple_cocos.h @@ -100,7 +100,71 @@ void simple_coco_update (void) { // Check collision (player) - // Check collision (BG) + #ifdef PLAYER_FLICKERS + ld a, (_p_estado) + or a + jr nz, _simple_coco_update_continue + #endif + + // rdx + 3 >= gpx && rdx + 3 <= gpx + 15 && + // rdx + 3 >= gpx && rdx <= gpx + 12 + + // rdx + 3 >= gpx + ld a, (_gpx) + ld c, a + ld a, (_rdx) + add 3 + cp c + jr c, _simple_coco_update_collpl_done + + // gpx + 12 >= rdx + ld a, (_rdx) + ld c, a + ld a, (_gpx) + add 12 + cp c + jr c, _simple_coco_update_collpl_done + + // rdy + 3 >= gpy && rdy + 3 <= gpy + 15 + // rdy + 3 >= gpy && rdy <= gpy + 12 + + // rdy + 3 >= gpy + ld a, (_gpy) + ld c, a + ld a, (_rdy) + add 3 + cp c + jr c, _simple_coco_update_collpl_done + + // gpy + 12 >= rdy + ld a, (_rdy) + ld c, a + ld a, (_gpy) + add 12 + cp c + jr c, _simple_coco_update_collpl_done + + // Kill player + ld a, 0xff + ld (_rdy), a // This effectively marks the coco for destruction + + #ifdef MODE_128K + ld a, SFX_ENEMY_HIT + #else + ld a, 4 + #endif + ld (_p_killme), a + + jr _simple_coco_update_continue + + ._simple_coco_update_collpl_done + + #endasm + + // Check collision (BG) + if (attr ((rdx + 3) >> 4, (rdy + 3) >> 4) & 12) rdy = 0xff; + + #asm ._simple_coco_update_continue // And update arrays diff --git a/examples/goddess/dev/goddess_v3.tap b/examples/goddess/dev/goddess_v3.tap index 12f9d179..7a5774ad 100644 Binary files a/examples/goddess/dev/goddess_v3.tap and b/examples/goddess/dev/goddess_v3.tap differ diff --git a/examples/goddess/dev/mainloop.h b/examples/goddess/dev/mainloop.h index 96c8fd4b..9875ead0 100644 --- a/examples/goddess/dev/mainloop.h +++ b/examples/goddess/dev/mainloop.h @@ -12,7 +12,7 @@ void main (void) { di #endasm - #ifdef MODE_128K + #if defined MODE_128K || defined MIN_FAPS_PER_FRAME sp_InitIM2(0xf1f1); sp_CreateGenericISR(0xf1f1); sp_RegisterHook(255, ISR); @@ -20,8 +20,15 @@ void main (void) { #asm ei #endasm + #endif + + #ifdef MODE_128K + #ifdef USE_ARKOS_PLAYER + arkos_stop(); + #else + wyz_init (); + #endif - wyz_init (); #endif cortina (); @@ -48,13 +55,13 @@ void main (void) { // Sprite creation #ifdef NO_MASKS - sp_player = sp_CreateSpr (sp_OR_SPRITE, 3, sprite_2_a); + sp_player = sp_CreateSpr (NO_MASKS, 3, sprite_2_a); sp_AddColSpr (sp_player, sprite_2_b); sp_AddColSpr (sp_player, sprite_2_c); p_current_frame = p_next_frame = sprite_2_a; - for (gpit = 0; gpit < 3; gpit ++) { - sp_moviles [gpit] = sp_CreateSpr(sp_OR_SPRITE, 3, sprite_9_a); + for (gpit = 0; gpit < MAX_ENEMS; gpit ++) { + sp_moviles [gpit] = sp_CreateSpr(NO_MASKS, 3, sprite_9_a); sp_AddColSpr (sp_moviles [gpit], sprite_9_b); sp_AddColSpr (sp_moviles [gpit], sprite_9_c); en_an_current_frame [gpit] = sprite_9_a; @@ -98,7 +105,7 @@ void main (void) { #include "my/ci/after_load.h" while (1) { - #ifdef ACTIVATE_SCRIPTING + #if defined ACTIVATE_SCRIPTING && !defined MODE_128K main_script_offset = (int) (main_script); #endif @@ -114,7 +121,22 @@ void main (void) { #include "my/ci/before_game.h" + #ifdef NO_RESET_STATS + p_objs = 0; + p_keys = 0; + p_killed = 0; + #ifdef MAX_AMMO + #ifdef INITIAL_AMMO + p_ammo = INITIAL_AMMO; + #else + p_ammo = MAX_AMMO; + #endif + #endif + #endif + #ifdef COMPRESSED_LEVELS + silent_level = 0; + #ifdef ENABLE_CHECKPOINTS if (sg_do_load) level = sg_level; else level = 0; #endif @@ -134,9 +156,12 @@ void main (void) { { #ifdef COMPRESSED_LEVELS - #include "my/level_screen.h" + if (silent_level == 0) { + #include "my/level_screen.h" + } + silent_level = 0; - prepare_level (level); + prepare_level (); #endif #ifndef DIRECT_TO_PLAY @@ -161,17 +186,19 @@ void main (void) { #ifdef COMPRESSED_LEVELS if (success) { #ifdef MODE_128K - //wyz_play_music (6); + //PLAY_MUSIC (6); #endif - zone_clear (); + if (silent_level == 0) zone_clear (); #ifdef ACTIVATE_SCRIPTING if (script_result != 3) #else if (warp_to_level == 0) #endif - ++ level; + { + level ++; + } if (level >= MAX_LEVELS #ifdef ACTIVATE_SCRIPTING @@ -183,7 +210,7 @@ void main (void) { } } else { #ifdef MODE_128K - //wyz_play_music (8); + //PLAY_MUSIC (8); #endif #if defined(TIMER_ENABLE) && defined(TIMER_GAMEOVER_0) && defined(SHOW_TIMER_OVER) @@ -193,7 +220,7 @@ void main (void) { #endif #ifdef MODE_128K - wyz_stop_sound (); + STOP_SOUND (); #endif break; } @@ -201,11 +228,13 @@ void main (void) { if (success) { game_ending (); } else { - //wyz_play_music (8); + //PLAY_MUSIC (8); game_over (); } #endif - cortina (); + #if !defined (DIRECT_TO_PLAY) || !defined (COMPRESSED_LEVELS) + cortina (); + #endif } clear_sprites (); diff --git a/examples/goddess/dev/mainloop/flick_screen.h b/examples/goddess/dev/mainloop/flick_screen.h index c1c039b9..97b4515c 100644 --- a/examples/goddess/dev/mainloop/flick_screen.h +++ b/examples/goddess/dev/mainloop/flick_screen.h @@ -13,7 +13,7 @@ } #if defined (COMPRESSED_LEVELS) - if (gpx == 224 && p_vx > 0 && x_pant < (level_data->map_w - 1)) + if (gpx == 224 && p_vx > 0 && x_pant < (level_data.map_w - 1)) #else if (gpx == 224 && p_vx > 0 && x_pant < (MAP_W - 1)) #endif @@ -27,7 +27,7 @@ #if MAP_H > 1 if (gpy == 0 && p_vy < 0 && y_pant > 0) { #if defined (COMPRESSED_LEVELS) - n_pant -= level_data->map_w; + n_pant -= level_data.map_w; #else n_pant -= MAP_W; #endif @@ -37,8 +37,8 @@ } #if defined (COMPRESSED_LEVELS) - if (gpy == 144 && p_vy > 0 && y_pant < (level_data->map_h - 1)) { - n_pant += level_data->map_w; + if (gpy == 144 && p_vy > 0 && y_pant < (level_data.map_h - 1)) { + n_pant += level_data.map_w; #else if (gpy == 144 && p_vy > 0 && y_pant < (MAP_H - 1)) { n_pant += MAP_W; @@ -62,8 +62,8 @@ #if MAP_H > 1 #if defined (COMPRESSED_LEVELS) - if (gpy == 0 && p_vy < 0 && n_pant >= level_data->map_w) { - n_pant -= level_data->map_w; + if (gpy == 0 && p_vy < 0 && n_pant >= level_data.map_w) { + n_pant -= level_data.map_w; #else if (gpy == 0 && p_vy < 0 && n_pant >= MAP_W) { n_pant -= MAP_W; @@ -74,8 +74,8 @@ if (gpy == 144 && p_vy > 0) { // 9216 = 144 * 64 #if defined (COMPRESSED_LEVELS) - if (n_pant < level_data->map_w * (level_data->map_h - 1)) { - n_pant += level_data->map_w; + if (n_pant < level_data.map_w * (level_data.map_h - 1)) { + n_pant += level_data.map_w; #else if (n_pant < MAP_W * MAP_H - MAP_W) { n_pant += MAP_W; diff --git a/examples/goddess/dev/mainloop/game_loop.h b/examples/goddess/dev/mainloop/game_loop.h index e5442d9e..3f59e563 100644 --- a/examples/goddess/dev/mainloop/game_loop.h +++ b/examples/goddess/dev/mainloop/game_loop.h @@ -3,9 +3,18 @@ // game_loop.h - Da game loop. + #asm + ; Makes debugging easier + ._game_loop_init + #endasm + playing = 1; player_init (); + #ifdef OBJECT_COUNT + flags [OBJECT_COUNT] = p_objs; + #endif + #ifndef COMPRESSED_LEVELS hotspots_init (); #endif @@ -35,9 +44,9 @@ #ifdef MODE_128K // Play music #ifdef COMPRESSED_LEVELS - wyz_play_music (levels [level].music_id); + PLAY_MUSIC (levels [level].music_id); #else - wyz_play_music (1); + PLAY_MUSIC (1); #endif #endif @@ -67,8 +76,8 @@ #ifdef PLAYER_CHECK_MAP_BOUNDARIES #ifdef COMPRESSED_LEVELS - x_pant = n_pant % level_data->map_w; - y_pant = n_pant / level_data->map_w; + x_pant = n_pant % level_data.map_w; + y_pant = n_pant / level_data.map_w; #else x_pant = n_pant % MAP_W; y_pant = n_pant / MAP_W; #endif @@ -86,6 +95,11 @@ o_pant = 0xff; while (playing) { + #asm + ; Makes debugging easier + ._game_loop_do + #endasm + #ifdef DEBUG_KEYS if (sp_KeyPressed (KEY_M)) { ++ p_objs; beep_fx (0); } if (sp_KeyPressed (KEY_H)) { ++ n_pant; beep_fx (0); } @@ -176,7 +190,12 @@ simple_coco_update (); #endif - if (p_killme) player_kill (p_killme); + if (p_killme) { + if (p_life) { + player_kill (p_killme); + #include "my/ci/on_player_killed.h" + } else playing = 0; + } #ifdef PLAYER_CAN_FIRE // Move bullets @@ -184,7 +203,7 @@ #endif #ifdef ENABLE_TILANIMS - do_tilanims (); + tilanims_do (); #endif // Detect fire zone @@ -200,6 +219,23 @@ if (o_pant == n_pant) { #include "mainloop/update_sprites.h" + // Limit frame rate + + #ifdef MIN_FAPS_PER_FRAME + #asm + .ml_min_faps_loop + ld a, (_isrc) + cp MIN_FAPS_PER_FRAME + jr nc, ml_min_faps_loop_end + halt + jr ml_min_faps_loop + + .ml_min_faps_loop_end + xor a + ld (_isrc), a + #endasm + #endif + sp_UpdateNow(); } @@ -223,7 +259,7 @@ if (sp_KeyPressed (KEY_Z)) { if (!key_z_pressed) { #ifdef MODE_128K - wyz_play_sound (0); + PLAY_SOUND (0); #else beep_fx (2); #endif @@ -258,8 +294,7 @@ if (sp_KeyPressed (KEY_H)) { sp_WaitForNoKey (); #ifdef MODE_128K - wyz_stop_sound (); - wyz_play_sound (1); + player_on = 0; #endif clear_sprites (); pause_screen (); @@ -267,11 +302,7 @@ sp_WaitForNoKey (); draw_scr (); #ifdef MODE_128K - #ifdef COMPRESSED_LEVELS - //wyz_play_music (levels [level].music_id); - #else - //wyz_play_music (1); - #endif + player_on = 1; #endif } if (sp_KeyPressed (KEY_Y)) { @@ -281,7 +312,12 @@ // Flick the screen ? - #include "mainloop/flick_screen.h" + #if defined ACTIVATE_SCRIPTING && defined COMPRESSED_LEVELS + if (script_result != 3) + #endif + { + #include "mainloop/flick_screen.h" + } // Win game condition @@ -305,7 +341,8 @@ } // Game over condition - if (p_life == 0 + #if defined ACTIVATE_SCRIPTING || (defined(TIMER_ENABLE) && defined(TIMER_GAMEOVER_0)) + if (0 #ifdef ACTIVATE_SCRIPTING || (script_result == 2) #endif @@ -315,14 +352,16 @@ ) { playing = 0; } + #endif #include "my/ci/extra_routines.h" } + sp_UpdateNow (); sp_WaitForNoKey (); #ifdef MODE_128K - wyz_stop_sound (); + STOP_SOUND (); #endif #include "my/ci/after_game_loop.h" diff --git a/examples/goddess/dev/mk1.c b/examples/goddess/dev/mk1.c index 04a9fe4f..ba5f994d 100644 --- a/examples/goddess/dev/mk1.c +++ b/examples/goddess/dev/mk1.c @@ -21,6 +21,10 @@ #define FIXBITS 6 #define MAX_ENEMS 3 +// Fiddle if you need +#define MAX_TILANIMS 16 +#define TILANIMS_PRIME 7 + /* splib2 memory map 61440 - 61696 IM2 vector table 61697 - 61936 FREEPOOL (240 bytes) @@ -55,7 +59,7 @@ #endif #endif -#define NUMBLOCKS (40 + (MAX_PROJECTILES * 5)) +#define NUMBLOCKS (((1 + MAX_ENEMS) * 10) + (MAX_PROJECTILES * 5)) unsigned char AD_FREE [NUMBLOCKS * 15]; @@ -73,8 +77,6 @@ unsigned char AD_FREE [NUMBLOCKS * 15]; #include "assets/librarian.h" #endif -#include "my/ci/extra_vars.h" - #include "aplib.h" #include "pantallas.h" @@ -90,10 +92,19 @@ unsigned char AD_FREE [NUMBLOCKS * 15]; #include "assets/extrasprites.h" #endif +#include "my/ci/extra_vars.h" + #ifdef MODE_128K - #include "wyzplayer.h" + #ifdef USE_ARKOS_PLAYER + #include "sound/arkosplayer.h" + #else + #include "sound/wyzplayer.h" + #endif #else - #include "beeper.h" + #include "sound/beeper.h" + #ifdef MIN_FAPS_PER_FRAME + #include "engine/isr.h" + #endif #endif #include "printer.h" @@ -132,5 +143,5 @@ unsigned char AD_FREE [NUMBLOCKS * 15]; #ifndef MODE_128K // From beepola. Phaser engine by Shiru. - #include "music.h" + #include "sound/music.h" #endif diff --git a/examples/goddess/dev/my/ci/before_game.h b/examples/goddess/dev/my/ci/before_game.h index 913ff23e..6f377ab8 100644 --- a/examples/goddess/dev/my/ci/before_game.h +++ b/examples/goddess/dev/my/ci/before_game.h @@ -2,7 +2,7 @@ // Copyleft 2010-2014, 2020 by the Mojon Twins _x = 4; _y = 20; _t = 71; -_gp_gen = "A EASY B MEDIUM C HARD"; +_gp_gen = (unsigned char *) ("A EASY B MEDIUM C HARD"); print_str (); sp_UpdateNow (); diff --git a/examples/goddess/dev/my/ci/custom_heng.h b/examples/goddess/dev/my/ci/custom_heng.h new file mode 100644 index 00000000..f2a1f4b8 --- /dev/null +++ b/examples/goddess/dev/my/ci/custom_heng.h @@ -0,0 +1,4 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// Modify p_vx diff --git a/examples/goddess/dev/my/ci/enems_custom_respawn.h b/examples/goddess/dev/my/ci/enems_custom_respawn.h new file mode 100644 index 00000000..a06ef557 --- /dev/null +++ b/examples/goddess/dev/my/ci/enems_custom_respawn.h @@ -0,0 +1,5 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// deactivate RESPAWN_ON_ENTER and write your own routine here! + diff --git a/examples/goddess/dev/my/ci/entering_game.h b/examples/goddess/dev/my/ci/entering_game.h index 494c048c..a121996c 100644 --- a/examples/goddess/dev/my/ci/entering_game.h +++ b/examples/goddess/dev/my/ci/entering_game.h @@ -10,5 +10,5 @@ op_inv = 0; // Forces update templos_mataos = puerta_abierta = 0; _x = 1; _y = 23; _t = 71; -_gp_gen = "ONCE UPON A TIME IN BADAJOZ..."; +_gp_gen = (unsigned char *) ("ONCE UPON A TIME IN BADAJOZ..."); print_str (); diff --git a/examples/goddess/dev/my/ci/entering_screen.h b/examples/goddess/dev/my/ci/entering_screen.h index 74ac5994..4c2863fb 100644 --- a/examples/goddess/dev/my/ci/entering_screen.h +++ b/examples/goddess/dev/my/ci/entering_screen.h @@ -2,7 +2,7 @@ // Copyleft 2010-2014, 2020 by the Mojon Twins rda = templos_mataos ^ 1; -_gp_gen = simple_decorations + (rda ? 4 : 0); +_gp_gen = (unsigned char *) (simple_decorations + (rda ? 4 : 0)); for (gpit = rda; gpit < 6; gpit ++) { if (*_gp_gen == n_pant) { ++ _gp_gen; diff --git a/examples/goddess/dev/my/ci/hotspots_custom.h b/examples/goddess/dev/my/ci/hotspots_custom.h index 664e7735..cb1a135c 100644 --- a/examples/goddess/dev/my/ci/hotspots_custom.h +++ b/examples/goddess/dev/my/ci/hotspots_custom.h @@ -35,7 +35,7 @@ case 8: ) { templos_mataos = 1; _x = 1; _y = 23; _t = 71; - _gp_gen = "A BOLT APPEARED ELSEWHERE... "; + _gp_gen = (unsigned char *) ("A BOLT APPEARED ELSEWHERE... "); print_str (); beep_fx (0); } diff --git a/examples/goddess/dev/my/ci/on_player_killed.h b/examples/goddess/dev/my/ci/on_player_killed.h new file mode 100644 index 00000000..d6e076ee --- /dev/null +++ b/examples/goddess/dev/my/ci/on_player_killed.h @@ -0,0 +1,3 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + diff --git a/examples/goddess/dev/my/config.h b/examples/goddess/dev/my/config.h index d825fd92..f0061dcf 100644 --- a/examples/goddess/dev/my/config.h +++ b/examples/goddess/dev/my/config.h @@ -8,6 +8,9 @@ // ============================================================================ //#define MODE_128K // Read the docs! +//#define MIN_FAPS_PER_FRAME 2 // Limits the max # of fps to 50/N +//#define USE_ARKOS_PLAYER // Use Arkos instead of Wyz player for 128k Music +//#define ARKOS_SFX_CHANNEL 0 // SFX Channel (0-2) //#define VENG_SELECTOR // Very advanced! //#define USE_MAP_CUSTOM_DECODER @@ -25,8 +28,10 @@ #define PLAYER_LIFE 99 // Max and starting life gauge. #define PLAYER_REFILL 25 // Life recharge //#define COMPRESSED_LEVELS // use levels.h instead of mapa.h and enems.h (!) +//#define PER_LEVEL_SPRITESET // use a different spriteset for each level in 48K //#define MAX_LEVELS 2 // # of compressed levels //#define REFILL_ME // If defined, refill player on each level +//#define NO_RESET_STATS // If defined, player stats are not reset per level // ============================================================================ // II. Engine type @@ -72,6 +77,7 @@ //#define ENABLE_PURSUERS // If defined, type 7 enemies are active //#define DEATH_COUNT_AND 7 //#define DEATH_COUNT_ADD 11 // Frames to wait = ADD + (rand & AND) +//#define PURSUERS_MAX_V 2 // 1, 2, 4. //#define PURSUERS_BASE_CELL 3 // If defined, type 7 enemies are always # #define ENABLE_FANTIES // If defined, Fanties are enabled! @@ -137,6 +143,7 @@ //#define SCRIPTING_KEY_NONE // No action key. //#define ENABLE_EXTERN_CODE // Enables custom code to be run from the script using EXTERN n //#define ENABLE_FIRE_ZONE // Allows to define a zone which auto-triggers "FIRE" +//#define SCRIPT_PAGE 3 // In MODE_128K & COMPRESSED_LEVELS // Timer // ----- @@ -182,6 +189,8 @@ //#define PLAYER_MIN_KILLABLE 3 // Only kill enemies with id >= PLAYER_MIN_KILLABLE //#define PLAYER_STEP_SOUND // Sound while walking. No effect in the BOOTEE engine. +//#define PLAYER_DISABLE_DEFAULT_HENG // To disble default horizontal engine (keyrs) + // Configure keyboard // To define different keys, the first two hex digits are the COLUMN, the next the ROW @@ -261,6 +270,7 @@ //#define USE_AUTO_SHADOWS // Automatic shadows made of darker attributes //#define USE_AUTO_TILE_SHADOWS // Automatic shadows using specially defined tiles 32-47. //#define UNPACKED_MAP // Full, uncompressed maps. Shadows settings are ignored. +#define PACKED_MAP_ALT_TILE 19 // If defined, in 16 tiles mode, alt tile (default 19) //#define NO_MASKS // Sprites are rendered using OR instead of masks. //#define MASKED_BULLETS // If needed //#define PLAYER_CUSTOM_ANIMATION // Code your own animation in my/custom_animation.h diff --git a/examples/goddess/dev/my/fixed_screens.h b/examples/goddess/dev/my/fixed_screens.h index 36e03655..e794b96d 100644 --- a/examples/goddess/dev/my/fixed_screens.h +++ b/examples/goddess/dev/my/fixed_screens.h @@ -36,7 +36,7 @@ void game_ending (void) { void game_over (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " GAME OVER! "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" GAME OVER! "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNow (); @@ -52,7 +52,7 @@ void game_over (void) { #if defined(TIMER_ENABLE) && defined(SHOW_TIMER_OVER) void time_over (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " TIME'S UP! "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" TIME'S UP! "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); @@ -69,7 +69,7 @@ void game_over (void) { #ifdef PAUSE_ABORT void pause_screen (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " PAUSED "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" PAUSED "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); } @@ -78,7 +78,7 @@ void game_over (void) { #ifdef COMPRESSED_LEVELS void zone_clear (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " ZONE CLEAR "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" ZONE CLEAR "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); espera_activa (250); diff --git a/examples/goddess/dev/my/level_screen.h b/examples/goddess/dev/my/level_screen.h index 0de8100f..5e779b2a 100644 --- a/examples/goddess/dev/my/level_screen.h +++ b/examples/goddess/dev/my/level_screen.h @@ -10,7 +10,7 @@ _x = 12; _y = 12; _t = 71; _gp_gen = level_str; print_str (); sp_UpdateNow (); #ifdef MODE_128K - wyz_play_sound (SFX_START); + PLAY_SOUND (SFX_START); #else beep_fx (1); #endif diff --git a/examples/goddess/dev/my/levelset.h b/examples/goddess/dev/my/levelset.h index 8add6ae3..578decfa 100644 --- a/examples/goddess/dev/my/levelset.h +++ b/examples/goddess/dev/my/levelset.h @@ -37,12 +37,14 @@ // In 48K mode, include here your compressed binaries: -extern unsigned char my_binary [0]; +#ifndef MODE_128K + extern unsigned char my_binary [0]; -#asm - ._my_binary - BINARY "../bin/my_binary.bin" -#endasm + #asm + ._my_binary + BINARY "../bin/my_binary.bin" + #endasm +#endif // Define your level sequence array here: // map_w, map_h, scr_ini, ini_x, ini_y, max_objs, c_map_bolts, c_tileset, c_enems_hotspots, c_behs, script diff --git a/examples/goddess/dev/my/msc-config.h b/examples/goddess/dev/my/msc-config.h index bea7ebab..510250b8 100644 --- a/examples/goddess/dev/my/msc-config.h +++ b/examples/goddess/dev/my/msc-config.h @@ -7,15 +7,16 @@ unsigned char script_result = 0; unsigned char sc_terminado = 0; unsigned char sc_continuar = 0; unsigned int main_script_offset; +#ifndef MODE_128K extern unsigned char main_script [0]; #asm ._main_script BINARY "scripts.bin" #endasm +#endif unsigned char warp_to_level; extern unsigned char *script; #asm ._script defw 0 #endasm -#define SCRIPT_0 0x0000 diff --git a/examples/goddess/dev/pantallas.h b/examples/goddess/dev/pantallas.h index b1fbc674..2734d92b 100644 --- a/examples/goddess/dev/pantallas.h +++ b/examples/goddess/dev/pantallas.h @@ -12,17 +12,17 @@ #asm ._s_title - BINARY "title.bin" + BINARY "..\bin\title.bin" ._s_marco #endasm #ifndef DIRECT_TO_PLAY #asm - BINARY "marco.bin" + BINARY "..\bin\marco.bin" #endasm #endif #asm ._s_ending - BINARY "ending.bin" + BINARY "..\bin\ending.bin" #endasm #endif diff --git a/examples/goddess/dev/printer.h b/examples/goddess/dev/printer.h index 12b2b499..7e05d920 100644 --- a/examples/goddess/dev/printer.h +++ b/examples/goddess/dev/printer.h @@ -4,7 +4,7 @@ // Printing functions unsigned char attr (unsigned char x, unsigned char y) { - if (x >= 14 || y >= 10) return 0; + if (x >= 15 || y >= 10) return 0; return map_attr [x + (y << 4) - y]; } @@ -12,6 +12,48 @@ unsigned char qtile (unsigned char x, unsigned char y) { return map_buff [x + (y << 4) - y]; } +#if defined (USE_AUTO_TILE_SHADOWS) || defined (USE_AUTO_SHADOWS) + unsigned char attr_mk2 (void) { + // x + 15 * y = x + (16 - 1) * y = x + 16 * y - y = x + (y << 4) - y. + // if (cx1 < 0 || cy1 < 0 || cx1 > 14 || cy1 > 9) return 0; + // return map_attr [cx1 + (cy1 << 4) - cy1]; + #asm + ld a, (_cx1) + cp 15 + jr nc, _attr_reset + + ld a, (_cy1) + cp 10 + jr c, _attr_do + + ._attr_reset + ld hl, 0 + ret + + ._attr_do + ld a, (_cy1) + ld b, a + sla a + sla a + sla a + sla a + sub b + ld b, a + ld a, (_cx1) + add b + ld e, a + ld d, 0 + ld hl, _map_attr + add hl, de + ld a, (hl) + + ld h, 0 + ld l, a + ret + #endasm + } +#endif + #ifdef COMPRESSED_LEVELS #define ATTR_OFFSET 1536 #else @@ -53,9 +95,9 @@ void draw_coloured_tile (void) { // Fill up c1, c2, c3, c4 then use them #ifdef USE_AUTO_SHADOWS - cx1 = xx - 1; cy1 = yy - 1; rda = *gen_pt; c1 = (nocast && (attr () & 8)) ? (rda & 7) - 1 : rda; t1 = _ta; ++ gen_pt; ++ _ta; - cx1 = xx ; cy1 = yy - 1; rda = *gen_pt; c2 = (nocast && (attr () & 8)) ? (rda & 7) - 1 : rda; t2 = _ta; ++ gen_pt; ++ _ta; - cx1 = xx - 1; cy1 = yy ; rda = *gen_pt; c3 = (nocast && (attr () & 8)) ? (rda & 7) - 1 : rda; t3 = _ta; ++ gen_pt; ++ _ta; + cx1 = xx - 1; cy1 = yy - 1; rda = *gen_pt; c1 = (nocast && (attr_mk2 () & 8)) ? (rda & 7) - 1 : rda; t1 = _ta; ++ gen_pt; ++ _ta; + cx1 = xx ; cy1 = yy - 1; rda = *gen_pt; c2 = (nocast && (attr_mk2 () & 8)) ? (rda & 7) - 1 : rda; t2 = _ta; ++ gen_pt; ++ _ta; + cx1 = xx - 1; cy1 = yy ; rda = *gen_pt; c3 = (nocast && (attr_mk2 () & 8)) ? (rda & 7) - 1 : rda; t3 = _ta; ++ gen_pt; ++ _ta; #endif #ifdef USE_AUTO_TILE_SHADOWS // Precalc @@ -79,7 +121,7 @@ void draw_coloured_tile (void) { gen_pt_alt = tileset + ATTR_OFFSET + t_alt; - // cx1 = xx - 1; cy1 = yy ? yy - 1 : 0; a1 = (nocast && (attr () & 8)); + // cx1 = xx - 1; cy1 = yy ? yy - 1 : 0; a1 = (nocast && (attr_mk2 () & 8)); #asm // cx1 = xx - 1; ld a, (_xx) @@ -94,12 +136,12 @@ void draw_coloured_tile (void) { ._dct_1_set_yy ld (_cy1), a - // a1 = (nocast && (attr () & 8)); + // a1 = (nocast && (attr_mk2 () & 8)); ld a, (_nocast) or a jr z, _dct_a1_set - call _attr + call _attr_mk2 ld a, l and 8 jr z, _dct_a1_set @@ -110,7 +152,7 @@ void draw_coloured_tile (void) { ld (_a1), a #endasm - // cx1 = xx ; cy1 = yy ? yy - 1 : 0; a2 = (nocast && (attr () & 8)); + // cx1 = xx ; cy1 = yy ? yy - 1 : 0; a2 = (nocast && (attr_mk2 () & 8)); #asm // cx1 = xx; ld a, (_xx) @@ -124,12 +166,12 @@ void draw_coloured_tile (void) { ._dct_2_set_yy ld (_cy1), a - // a2 = (nocast && (attr () & 8)) + // a2 = (nocast && (attr_mk2 () & 8)) ld a, (_nocast) or a jr z, _dct_a2_set - call _attr + call _attr_mk2 ld a, l and 8 jr z, _dct_a2_set @@ -140,7 +182,7 @@ void draw_coloured_tile (void) { ld (_a2), a #endasm - // cx1 = xx - 1; cy1 = yy ; a3 = (nocast && (attr () & 8)); + // cx1 = xx - 1; cy1 = yy ; a3 = (nocast && (attr_mk2 () & 8)); #asm // cx1 = xx - 1; ld a, (_xx) @@ -151,12 +193,12 @@ void draw_coloured_tile (void) { ld a, (_yy) ld (_cy1), a - // a3 = (nocast && (attr () & 8)); + // a3 = (nocast && (attr_mk2 () & 8)); ld a, (_nocast) or a jr z, _dct_a3_set - call _attr + call _attr_mk2 ld a, l and 8 jr z, _dct_a3_set @@ -567,7 +609,8 @@ void update_tile (void) { #ifdef ENABLE_TILANIMS // Detect tilanims if (_t >= ENABLE_TILANIMS) { - add_tilanim (_x, _y, _t); + _n = (_x << 4) | _y; + tilanims_add (); } #endif diff --git a/examples/goddess/dev/prototypes.h b/examples/goddess/dev/prototypes.h index aae155dd..843aaf1a 100644 --- a/examples/goddess/dev/prototypes.h +++ b/examples/goddess/dev/prototypes.h @@ -7,6 +7,18 @@ #define ENABLE_SIMPLE_COCOS #endif +#ifdef MODE_128K + #ifdef USE_ARKOS_PLAYER + #define PLAY_MUSIC arkos_play_music + #define PLAY_SOUND arkos_play_sound + #define STOP_SOUND arkos_stop_sound + #else + #define PLAY_MUSIC wyz_play_music + #define PLAY_SOUND wyz_play_sound + #define STOP_SOUND wyz_stop_sound + #endif +#endif + // Engine // breakable.h @@ -74,6 +86,7 @@ char player_hidden (void); void run_fire_script (void); void process_tile (void); void draw_scr_background (void); +void draw_scr_hotspots_locks (void); void draw_scr (void); void select_joyfunc (void); unsigned char mons_col_sc_x (void); @@ -108,12 +121,15 @@ void tape_load (void);// TODO! void sg_submenu (void); // tilanim.h -void add_tilanim (unsigned char x, unsigned char y, unsigned char t); -void do_tilanims (void); +void tilanims_add (void); +void tilanims_do (void); +void tilanims_reset (void); -// wyzplayer.h +#ifdef MODE_128K +// wyzplayer.h / arcos_player.h void ISR (void); -void wyz_init (void); -void wyz_play_sound (unsigned char fx_number); -void wyz_play_music (unsigned char song_number); -void wyz_stop_sound (void); +void INIT_PLAYER (void); +void PLAY_SOUND (unsigned char fx_number); +void PLAY_MUSIC (unsigned char song_number); +void STOP_SOUND (void); +#endif diff --git a/examples/goddess/dev/setenv.bat b/examples/goddess/dev/setenv.bat index e034d8d5..a543b050 100644 --- a/examples/goddess/dev/setenv.bat +++ b/examples/goddess/dev/setenv.bat @@ -1,6 +1,5 @@ @echo off -set Z88DK_PATH=c:\z88dk10 -set PATH=%Z88DK_PATH%\bin;%PATH% +set Z88DK_PATH=c:\z88dk +set PATH=%Z88DK_PATH%\bin.x86;%PATH% set Z80_OZFILES=%Z88DK_PATH%\Lib\ set ZCCCFG=%Z88DK_PATH%\Lib\Config\ -zcc diff --git a/examples/goddess/dev/sound/arkos-addresses.h b/examples/goddess/dev/sound/arkos-addresses.h new file mode 100644 index 00000000..fa3225d7 --- /dev/null +++ b/examples/goddess/dev/sound/arkos-addresses.h @@ -0,0 +1,9 @@ +#define SFXS_SONG 0xd10c +#define ATINIT 0xc68c +#define ATPLAY 0xc000 +#define ATSFXINIT 0xc6f0 +#define ATSFXPLAY 0xc704 +#define ATSFXSTOP 0xc745 +#define ATSFXSTOPALL 0xc6f7 +#define ATSTOP 0xc6e1 +#define SONG_LIST 0xd5b7 diff --git a/examples/goddess/dev/sound/arkosplayer.h b/examples/goddess/dev/sound/arkosplayer.h new file mode 100644 index 00000000..c149b1b9 --- /dev/null +++ b/examples/goddess/dev/sound/arkosplayer.h @@ -0,0 +1,118 @@ +// MT Engine MK2 +// Copyleft 2014 the Mojon Twins + +// arkosplayer.h +// Arkos Player hook functions + +// This code is based on the original integration by Syx & Nightwolf +// In fact, this code IS the original integration by Syx & Nightwolf. +// I just changed the way params are passed (thanks @reidrac) +// I just automated the process & reindented to meet my own personal taste. + +#include "sound\arkos-addresses.h" + +// Start. + +// isr +#asm + defw 0 +#endasm + +void ISR(void) { + #asm + ld b, 1 + call SetRAMBank + call ATPLAY + ld b, 0 + call SetRAMBank + + ld hl, _isrc + inc (hl) + #endasm +} + +void arkos_stop (void) { + #asm + ld b, 1 + call SetRAMBank + ld a, 201 + ld (ATPLAY),A + ld b, 0 + call SetRAMBank + #endasm +} + +void __FASTCALL__ arkos_play_sound (unsigned char fx_number) { + #asm + di + ld b,1 + call SetRAMBank + + ; __FASTCALL__ -> fx_number is in l! + ld a, ARKOS_SFX_CHANNEL + ld h, 15 + ld e, 50 + ld d, 0 + ld bc, 0 + call ATSFXPLAY + + ld b,0 + call SetRAMBank + ei + #endasm +} + +void __FASTCALL__ arkos_play_music (unsigned char song_number) { + #asm + di + ld b, 1 + call SetRAMBank + + ; Reactivate sound generation + ld a, 175 + ld (ATPLAY),A + + ; Initialize song + ; __FASTCALL__ -> song_number is in l! + ld a, l + add a, a + ld hl, SONG_LIST + add a,l + jr nc, salta_inc_song + inc h + salta_inc_song: + ld l,a + ld e, (hl) + inc hl + ld d, (hl) + + call ATINIT + + ld de, SFXS_SONG + call ATSFXINIT + + ld b, 0 + call SetRAMBank + ei + #endasm +} + +void arkos_stop_sound (void) +{ + #asm + di + ld b,1 + call SetRAMBank + + call ATSFXSTOPALL + call ATSTOP + + ; Turn off sound generation + ld a,201 + ld (ATPLAY),A + + ld b,0 + call SetRAMBank + ei + #endasm +} diff --git a/examples/goddess/dev/sound/beeper.h b/examples/goddess/dev/sound/beeper.h new file mode 100644 index 00000000..a28f337d --- /dev/null +++ b/examples/goddess/dev/sound/beeper.h @@ -0,0 +1,292 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// Beeper.h +// Rutinas de sonido para beeper por Shiru +// I removed di's and ei's, not needed here. +// Copyleft 2010 The Mojon Twins + +#asm + .playsfx + ;di + ld l,a + ld h,0 + add hl,hl + ld de,proclist + add hl,de + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + ld de,0 + jp (hl) + + .sound1 ;enemy destroyed + ex de,hl + ld bc,500 + .sound1l0 + ld a,(hl) + and 16 + out ($FE),a + ld e,a + inc a + sla a + sla a + .sound1l1 + dec a + jr nz,sound1l1 + out ($FE),a + ld a,e + inc a + add a,a + add a,a + add a,a + .sound1l2 + dec a + jr nz,sound1l2 + ld a,b + inc hl + dec bc + ld a,b + or c + jr nz,sound1l0 + ;ei + ret + + .sound2 ;enemy hit + ex de,hl + ld bc,40*256+100 + .sound2l0 + ld a,(hl) + and 16 + out ($FE),a + inc hl + ld a,c + .sound2l1 + dec a + jr nz,sound2l1 + out ($FE),a + ld a,c + .sound2l2 + dec a + jr nz,sound2l2 + djnz sound2l0 + ;ei + ret + + .sound3 ;something + ex de,hl + ld b,100 + ld de,$1020 + .sound3l0 + ld a,(hl) + and d + out ($FE),a + inc hl + ld a,e + .sound3l0a + dec a + jr nz,sound3l0a + djnz sound3l0 + ld b,250 + .sound3l1 + ld a,(hl) + and d + out ($FE),a + inc hl + ld a,2 + .sound3l2 + dec a + jr nz,sound3l2 + xor a + out ($FE),a + ld a,e + .sound3l3 + dec a + jr nz,sound3l3 + djnz sound3l1 + ;ei + ret + + .sound4 ;jump + ld bc,20*256+250 + .sound4l0 + ld a,16 + out ($FE),a + ld a,4 + .sound4l1 + dec a + jr nz,sound4l1 + out ($FE),a + ld a,c + .sound4l2 + dec a + jr nz,sound4l2 + dec c + dec c + djnz sound4l0 + ;ei + ret + + .sound5 ;player hit + ex de,hl + ld bc,100*256+16 + .sound5l0 + ld a,(hl) + and c + out ($FE),a + inc hl + ld a,110 + sub b + ld e,a + and c + out ($FE),a + .sound5l1 + dec e + jr nz,sound5l1 + djnz sound5l0 + ;ei + ret + + .sound6 ;enemy destroyed 2 + ex de,hl + ld bc,20*256+16 + .sound6l0 + ld a,(hl) + inc hl + and c + out ($FE),a + xor a + .sound6l0a + dec a + jr nz,sound6l0a + djnz sound6l0 + .sound6l1 + ld a,(hl) + inc hl + and c + out ($FE),a + .sound6l2 + dec a + jr nz,sound6l2 + djnz sound6l1 + ;ei + ret + + .sound7 ;shot + ex de,hl + ld bc,100*256 + .sound7l0 + ld a,(hl) + inc hl + or c + and 16 + out ($FE),a + ld a,(hl) + srl a + srl a + .sound7l1 + dec a + jr nz,sound7l1 + ld a,c + add a,4 + ld c,a + djnz sound7l0 + ;ei + ret + + .sound8 ;take item + ld a,200 + jr soundItem + .sound9 + ld a,175 + jr soundItem + .sound10 + ld a,100 + .soundItem + ld (frq),a + ld b,4 + ld d,128 + .sound8l2 + push bc + ;.frq=$+1 + ; ld bc,2*256+200 + defb 1 ;ld bc + .frq + defb 200 ;+200 + defb 2 ;2*256 + .sound8l0 + push bc + ld b,50 + .sound8l1 + xor 16 + and 16 + out ($FE),a + ld e,a + ld a,d + .sound8l2b + dec a + jr nz,sound8l2b + out ($FE),a + ld a,129 + sub d + .sound8l3 + dec a + jr nz,sound8l3 + ld a,e + ld e,c + .sound8l4 + dec e + jr nz,sound8l4 + djnz sound8l1 + pop bc + ld a,c + sub 16 + ld c,a + djnz sound8l0 + pop bc + srl d + srl d + djnz sound8l2 + ;ei + ret + + .proclist + defw sound1 + defw sound2 + defw sound3 + defw sound4 + defw sound5 + defw sound6 + defw sound7 + defw sound8 + defw sound9 + defw sound10 +#endasm + +/* + TABLA DE SONIDOS + + n Sonido + ---------- + 0 Enemy destroyed + 1 Enemy hit + 2 Something + 3 Jump + 4 Player hit + 5 Enemy destroyed 2 + 6 Shot + 7 Item #1 (item) + 8 Item #2 (key) + 9 Item #3 (life) + +*/ + +void beep_fx (unsigned char n) { + // Cargar en A el valor de n + asm_int = n; + #asm + ld a, (_asm_int) + call playsfx + #endasm +} diff --git a/examples/goddess/dev/music.h b/examples/goddess/dev/sound/music.h similarity index 100% rename from examples/goddess/dev/music.h rename to examples/goddess/dev/sound/music.h diff --git a/examples/dogmole/dev/wyzplayer.h b/examples/goddess/dev/sound/wyzplayer.h similarity index 60% rename from examples/dogmole/dev/wyzplayer.h rename to examples/goddess/dev/sound/wyzplayer.h index dea53369..b06fedd7 100644 --- a/examples/dogmole/dev/wyzplayer.h +++ b/examples/goddess/dev/sound/wyzplayer.h @@ -25,61 +25,67 @@ void ISR(void) { #asm - ld b, 1 - call SetRAMBank - call WYZPLAYERISR - ld b, 0 - call SetRAMBank + ld a, (_player_on) + or a + ret z + ld b, 1 + call SetRAMBank + call WYZPLAYERISR + ld b, 0 + call SetRAMBank + + ld hl, _isrc + inc (hl) #endasm } void wyz_init (void) { #asm - ld b,1 - call SetRAMBank - call WYZPLAYERINIT - ld b,0 - call SetRAMBank + ld b,1 + call SetRAMBank + call WYZPLAYERINIT + ld b,0 + call SetRAMBank #endasm } void __FASTCALL__ wyz_play_sound (unsigned char fx_number) { #asm - di - ld b, 1 - call SetRAMBank - ; __FASTCALL__ -> fx_number is in l! - ld b, l - call INICIAEFECTO - ld b, 0 - call SetRAMBank - ei + di + ld b, 1 + call SetRAMBank + ; __FASTCALL__ -> fx_number is in l! + ld b, l + call INICIAEFECTO + ld b, 0 + call SetRAMBank + ei #endasm } void __FASTCALL__ wyz_play_music (unsigned char song_number) { #asm - di - ld b, 1 - call SetRAMBank - ; __FASTCALL__ -> song_number is in l! - ld a, l - call CARGA_CANCION - ld b, 0 - call SetRAMBank - ei + di + ld b, 1 + call SetRAMBank + ; __FASTCALL__ -> song_number is in l! + ld a, l + call CARGA_CANCION + ld b, 0 + call SetRAMBank + ei #endasm song_playing = song_number; } void wyz_stop_sound (void) { #asm - di - ld b,1 - call SetRAMBank - call SILENCIA_PLAYER - ld b,0 - call SetRAMBank - ei + di + ld b,1 + call SetRAMBank + call SILENCIA_PLAYER + ld b,0 + call SetRAMBank + ei #endasm } diff --git a/examples/goddess/dev/tilanim.h b/examples/goddess/dev/tilanim.h index 3e62c5a7..cfeaafaf 100644 --- a/examples/goddess/dev/tilanim.h +++ b/examples/goddess/dev/tilanim.h @@ -2,43 +2,102 @@ // Copyleft 2010-2014, 2020 by the Mojon Twins // tilanim.h -// Rutina para animar tiles. -#define MAX_TILANIMS 64 -#define UPDATE_FREQ 7 -unsigned char max_tilanims; -unsigned char tacount; +void tilanims_reset (void) { + #asm + ld hl, _tilanims_ft + ld de, _tilanims_ft + 1 + ld bc, MAX_TILANIMS - 1 + xor a + ld (hl), a + ldir + ld (_tacount), a + ld (_tait), a + ld (_max_tilanims), a + #endasm +} + +void tilanims_add (void) { + #asm + ld de, (_max_tilanims) + ld d, 0 -typedef struct { - unsigned char xy; - unsigned char ft; -} TILANIM; + ld a, (__n) + ld hl, _tilanims_xy + add hl, de + ld (hl), a -TILANIM tilanims [MAX_TILANIMS]; + ld a, (__t) + ld hl, _tilanims_ft + add hl, de + ld (hl), a -void add_tilanim (unsigned char x, unsigned char y, unsigned char t) { - tilanims [max_tilanims].xy = (x << 4) + y; - tilanims [max_tilanims].ft = t; - - ++ max_tilanims; + ld a, e + inc a + ld (_max_tilanims), a + #endasm } -unsigned char tait; -void do_tilanims (void) { - if (max_tilanims == 0) return; - - tacount = (tacount + 1) & UPDATE_FREQ; - if (!tacount) { - // Select tile - tait = rand () % max_tilanims; - - // Flip bit 7: - tilanims [tait].ft = tilanims [tait].ft ^ 128; +void tilanims_do (void) { + #asm + ld a, (_max_tilanims) + or a + ret z + + ld a, (_tait) + add TILANIMS_PRIME + cp MAX_TILANIMS + jr c, _tilanims_tait_0_skip + sub MAX_TILANIMS + ._tilanims_tait_0_skip + ld (_tait), a + + // Check counter for tilanim #tait + ld d, 0 + ld e, a + + // Check of active + ld hl, _tilanims_ft + add hl, de + ld a, (hl) + or a + ret z + + // Flip bit 7 + ld hl, _tilanims_ft + add hl, de + ld a, (hl) + xor 128 + ld (hl), a + + // Which tile? + bit 7, a + jr z, _tilanims_no_flick + + inc a + ._tilanims_no_flick + and 127 + ld (__t), a // Draw tile - _x = tilanims [tait].xy >> 4; - _y = tilanims [tait].xy & 15; - _t = (tilanims [tait].ft & 127) + (tilanims [tait].ft >> 7); - draw_invalidate_coloured_tile_gamearea (); - } + ld hl, _tilanims_xy + add hl, de + ld a, (hl) + ld c, a + srl a + srl a + srl a + and 0xfe + add VIEWPORT_X + ld (__x), a + + ld a, c + and 15 + sla a + add VIEWPORT_Y + ld (__y), a + + call _draw_coloured_tile + call _invalidate_tile + #endasm } diff --git a/examples/goddess/dev/zcc_opt.def b/examples/goddess/dev/zcc_opt.def deleted file mode 100644 index 4548b859..00000000 --- a/examples/goddess/dev/zcc_opt.def +++ /dev/null @@ -1,8 +0,0 @@ - -IF !DEFINED_STACKPTR - defc DEFINED_STACKPTR = 1 - defc STACKPTR = 61936 -ENDIF - - DEFINE DEFINED_myzorg - defc myzorg = 24000 diff --git a/examples/goku_mal/bin/loader.bin b/examples/goku_mal/bin/loader.bin index 77c1ec50..b403511d 100644 Binary files a/examples/goku_mal/bin/loader.bin and b/examples/goku_mal/bin/loader.bin differ diff --git a/examples/goku_mal/dev/aplib.h b/examples/goku_mal/dev/aplib.h index 88a31fda..11441f46 100644 --- a/examples/goku_mal/dev/aplib.h +++ b/examples/goku_mal/dev/aplib.h @@ -1,13 +1,6 @@ // MTE MK1 (la Churrera) v5.0 // Copyleft 2010-2014, 2020 by the Mojon Twins -unsigned int ram_address; -unsigned int ram_destination; - -#ifdef MODE_128K - unsigned char ram_page; -#endif - #asm ; aPPack decompressor diff --git a/examples/goku_mal/dev/assets/ay_fx_numbers.h b/examples/goku_mal/dev/assets/ay_fx_numbers.h index 411264ac..d1c0346e 100644 --- a/examples/goku_mal/dev/assets/ay_fx_numbers.h +++ b/examples/goku_mal/dev/assets/ay_fx_numbers.h @@ -1,20 +1,42 @@ // MTE MK1 (la Churrera) v5.0 // Copyleft 2010-2014, 2020 by the Mojon Twins -#define SFX_START 0 -#define SFX_BREAKABLE_HIT 1 -#define SFX_BREAKABLE_BREAK 2 -#define SFX_PUSH_BOX 3 -#define SFX_OPEN_LOCK 3 -#define SFX_SHOOT 4 -#define SFX_OBJECT_GET 5 -#define SFX_KILL_ENEMY_STEP 6 -#define SFX_KILL_ENEMY_SHOOT 6 -#define SFX_HIT_ENEMY 7 -#define SFX_ONE_OBJECT_GET 8 -#define SFX_ONE_OBJECT_WRONG 9 -#define SFX_KEY_GET 10 -#define SFX_REFILL_GET 11 -#define SFX_JUMP 12 -#define SFX_SPIKES 13 -#define SFX_ENEMY_HIT 14 +#ifdef USE_ARKOS_PLAYER + #define SFX_START 1 + #define SFX_BREAKABLE_HIT 1 + #define SFX_BREAKABLE_BREAK 2 + #define SFX_PUSH_BOX 3 + #define SFX_OPEN_LOCK 3 + #define SFX_SHOOT 4 + #define SFX_OBJECT_GET 5 + #define SFX_KILL_ENEMY_STEP 6 + #define SFX_KILL_ENEMY_SHOOT 6 + #define SFX_HIT_ENEMY 7 + #define SFX_ONE_OBJECT_GET 8 + #define SFX_ONE_OBJECT_WRONG 9 + #define SFX_KEY_GET 4 + #define SFX_REFILL_GET 11 + #define SFX_JUMP 2 + #define SFX_SPIKES 2 + #define SFX_ENEMY_HIT 8 + +#else + #define SFX_START 0 + #define SFX_BREAKABLE_HIT 1 + #define SFX_BREAKABLE_BREAK 2 + #define SFX_PUSH_BOX 3 + #define SFX_OPEN_LOCK 3 + #define SFX_SHOOT 4 + #define SFX_OBJECT_GET 5 + #define SFX_KILL_ENEMY_STEP 6 + #define SFX_KILL_ENEMY_SHOOT 6 + #define SFX_HIT_ENEMY 7 + #define SFX_ONE_OBJECT_GET 8 + #define SFX_ONE_OBJECT_WRONG 9 + #define SFX_KEY_GET 10 + #define SFX_REFILL_GET 11 + #define SFX_JUMP 12 + #define SFX_SPIKES 13 + #define SFX_ENEMY_HIT 14 + +#endif \ No newline at end of file diff --git a/examples/goku_mal/dev/assets/levels.h b/examples/goku_mal/dev/assets/levels.h index c601614a..bd29b455 100644 --- a/examples/goku_mal/dev/assets/levels.h +++ b/examples/goku_mal/dev/assets/levels.h @@ -14,7 +14,7 @@ // Map data, 75 or 150 * (MAP_W*MAP_H) bytes // Bolts, 32 * 4 = 128 bytes // Tileset, 2304 bytes -// Enemies, MAP_W * MAP_H * 3 * 10 bytes +// Enemies, MAP_W * MAP_H * MAX_ENEMS * 10 bytes // Hotspots, MAP_W * MAP_H * 3 bytes // Behs, 48 bytes // Spriteset, 2312 bytes @@ -64,7 +64,7 @@ extern unsigned char font [0]; ._font BINARY "font.bin" #endasm -extern LEVELHEADER level_data [0]; +extern LEVELHEADER level_data; #asm ._level_data defs 16 #endasm @@ -94,7 +94,7 @@ extern unsigned char tileset [0]; extern MALOTE malotes [0]; #asm - ._malotes defs MAP_W * MAP_H * 3 * 10 + ._malotes defs MAP_W * MAP_H * MAX_ENEMS * 10 #endasm extern HOTSPOT hotspots [0]; diff --git a/examples/goku_mal/dev/compile.bat b/examples/goku_mal/dev/compile.bat index 40066d37..7a202fb5 100644 --- a/examples/goku_mal/dev/compile.bat +++ b/examples/goku_mal/dev/compile.bat @@ -31,7 +31,7 @@ if [%1]==[justassets] goto :end :compile echo Compilando guego -zcc +zx -vn -m mk1.c -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul +zcc +zx -vn -m mk1.c -O3 -crt0=crt.asm -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul ..\..\..\src\utils\printsize.exe %game%.bin ..\..\..\src\utils\printsize.exe scripts.bin diff --git a/examples/goku_mal/dev/crt.asm b/examples/goku_mal/dev/crt.asm new file mode 100644 index 00000000..27e0d47d --- /dev/null +++ b/examples/goku_mal/dev/crt.asm @@ -0,0 +1,17 @@ + MODULE zx82_crt0 + INCLUDE "zcc_opt.def" + XREF _main ; main() is always external to crt0 code + + IF !STACKPTR + defc STACKPTR = $FFFF + ENDIF + + IF !CRT_ORG_CODE + defc CRT_ORG_CODE = 32768 + ENDIF + + org CRT_ORG_CODE + +start: + ld sp,STACKPTR + jp _main diff --git a/examples/goku_mal/dev/definitions.h b/examples/goku_mal/dev/definitions.h index a15cd13b..38f3bd82 100644 --- a/examples/goku_mal/dev/definitions.h +++ b/examples/goku_mal/dev/definitions.h @@ -6,7 +6,8 @@ .fsClipStruct defb 0, 24, 0, 32 #endasm -void *joyfunc = sp_JoyKeyboard; // Puntero a la función de manejo seleccionada. +//void *joyfunc = sp_JoyKeyboard; // Puntero a la función de manejo seleccionada. +unsigned int (*joyfunc)(struct sp_UDK *) = sp_JoyKeyboard; const void *joyfuncs [] = { sp_JoyKeyboard, sp_JoyKempston, sp_JoySinclair1 @@ -31,8 +32,15 @@ void *u_free = sp_FreeBlock; // Safe stuff in low(est) RAM -unsigned char safe_byte @ 23296; +unsigned char safe_byte @ 23296; +unsigned int ram_address @ 23297; +unsigned int ram_destination @ 23299; + +#ifdef MODE_128K + unsigned char ram_page @ 23301; +#endif + // Globales muy globalizadas struct sp_SS *sp_player; @@ -49,7 +57,7 @@ unsigned char enoffs; // Aux char asm_number; -unsigned int asm_int; +unsigned int asm_int @ 23302; unsigned int asm_int_2; unsigned int seed; unsigned char half_life; @@ -111,7 +119,7 @@ unsigned char p_tx, p_ty; #endif signed int ptgmx, ptgmy; -const unsigned char *spacer = " "; +unsigned char *spacer = " "; unsigned char enit; @@ -173,7 +181,7 @@ unsigned char map_attr [150]; unsigned char map_buff [150] @ FREEPOOL; // Breakable walls/etc #ifdef BREAKABLE_WALLS - unsigned char brk_buff [150] @ 23297; + unsigned char brk_buff [150] @ 23296+16; #endif // posición del objeto (hotspot). Para no objeto, @@ -187,7 +195,7 @@ unsigned char hotspot_destroy; #ifndef MAX_FLAGS #define MAX_FLAGS 16 #endif -unsigned char flags[MAX_FLAGS]; +unsigned char flags[MAX_FLAGS]; // Globalized unsigned char o_pant; @@ -219,7 +227,7 @@ unsigned char maincounter; // Engine globals (for speed) & size! -unsigned char gpx, gpox, gpy, gpd, gpc, gpt; +unsigned char gpx, gpox, gpy, gpd, gpc; unsigned char gpxx, gpyy, gpcx, gpcy; unsigned char possee, hit_v, hit_h, hit, wall_h, wall_v; unsigned char gpen_x, gpen_y, gpen_cx, gpen_cy, gpaux; @@ -230,7 +238,7 @@ unsigned char *map_pointer; #ifdef PLAYER_CAN_FIRE unsigned char blx, bly; #endif -unsigned char rdx, rdy, rda, rdb, rdc, rdd, rdn; +unsigned char rdx, rdy, rda, rdb, rdc, rdd, rdn, rdt; // More stuff @@ -251,6 +259,7 @@ unsigned char objs_old, keys_old, life_old, killed_old; #ifdef COMPRESSED_LEVELS unsigned char *level_str = "LEVEL 0X"; + unsigned char silent_level = 0; #endif #ifdef GET_X_MORE @@ -271,12 +280,24 @@ unsigned char x0, y0, x1, y1; unsigned char ptx1, pty1, ptx2, pty2; unsigned char *_gp_gen; +#ifdef ENABLE_TILANIMS + unsigned char tait; + unsigned char max_tilanims; + unsigned char tacount; + unsigned char tilanims_xy [MAX_TILANIMS]; + unsigned char tilanims_ft [MAX_TILANIMS]; +#endif + +#if defined USE_AUTO_TILE_SHADOWS || defined USE_AUTO_SHADOWS || defined ENABLE_TILANIMS + unsigned char xx, yy; +#endif + #if defined USE_AUTO_TILE_SHADOWS || defined USE_AUTO_SHADOWS unsigned char c1, c2, c3, c4; unsigned char t1, t2, t3, t4; unsigned char nocast, _ta; - unsigned char xx, yy; #endif + #ifdef USE_AUTO_TILE_SHADOWS unsigned a1, a2, a3; unsigned char *gen_pt_alt; @@ -291,4 +312,7 @@ unsigned char *_gp_gen; #ifdef MODE_128K unsigned char song_playing = 0; + unsigned char player_on = 1; #endif + +unsigned char isrc; diff --git a/examples/goku_mal/dev/engine.h b/examples/goku_mal/dev/engine.h index e89eb1a9..bbbbfb9f 100644 --- a/examples/goku_mal/dev/engine.h +++ b/examples/goku_mal/dev/engine.h @@ -153,7 +153,7 @@ void espera_activa (int espera) { // Sonido #ifdef MODE_128K - wyz_play_sound (SFX_PUSH_BOX); + PLAY_SOUND (SFX_PUSH_BOX); #else beep_fx (2); #endif @@ -182,7 +182,7 @@ void espera_activa (int espera) { -- p_keys; #ifdef MODE_128K - wyz_play_sound (SFX_OPEN_LOCK); + PLAY_SOUND (SFX_OPEN_LOCK); #else beep_fx (8); #endif @@ -290,6 +290,7 @@ void draw_scr_background (void) { add hl, bc ld (hl), a + #ifdef PACKED_MAP_ALT_TILE ld a, (__t) or a jr nz, _draw_scr_packed_noalt @@ -305,10 +306,12 @@ void draw_scr_background (void) { jr _draw_scr_packed_noalt ._draw_scr_packed_alt_subst - ld a, 19 + ld a, PACKED_MAP_ALT_TILE ld (__t), a ._draw_scr_packed_noalt + #endif + ld hl, _map_buff add hl, bc @@ -326,15 +329,15 @@ void draw_scr_background (void) { #endasm #endif - draw_coloured_tile (); - - #if defined ENABLE_TILANIMS && defined UNPACKED_MAP - // Detect tilanims + #ifdef ENABLE_TILANIMS if (_t >= ENABLE_TILANIMS) { - add_tilanim ((_x - VIEWPORT_X) >> 1, (_y - VIEWPORT_Y) >> 1, _t); + _n = (((_x - VIEWPORT_X) << 3) & 0xf0) | ((_y - VIEWPORT_Y) >> 1); + tilanims_add (); } #endif - + + draw_coloured_tile (); + //_x += 2; if (_x == VIEWPORT_X + 30) { _x = VIEWPORT_X; _y += 2; } #asm ld a, (__x) @@ -355,34 +358,7 @@ void draw_scr_background (void) { #endif } -void draw_scr (void) { - is_rendering = 1; - - #ifdef ENABLE_TILANIMS - max_tilanims = 0; - #endif - - #ifdef ENABLE_FIRE_ZONE - f_zone_ac = 0; - #endif - - draw_scr_background (); - - // Object setup - - enems_load (); - - #ifdef ACTIVATE_SCRIPTING - #if defined LINE_OF_TEXT && !defined LINE_OF_TEXT_NO_AUTOERASE - _x = LINE_OF_TEXT_X; _y = LINE_OF_TEXT; _t = LINE_OF_TEXT_ATTR; _gp_gen = " "; print_str (); - #endif - // Ejecutamos los scripts de entrar en pantalla: - run_script (2 * MAP_W * MAP_H + 1); // ENTERING ANY - run_script (n_pant << 1); // ENTERING SCREEN n - #endif - - #include "my/ci/entering_screen.h" - +void draw_scr_hotspots_locks (void) { /* hotspot_y = 240; rdx = (hotspots [n_pant].xy >> 4); @@ -534,6 +510,14 @@ void draw_scr (void) { cp c jr nz, _open_locks_done + // Remove x=y=np=0 pseudobug in multilevel games + #ifdef COMPRESSED_LEVELS + ld a, b + or d + or e + jr z, _open_locks_done + #endif + ._open_locks_do ld a, d ld (__x), a @@ -573,6 +557,37 @@ void draw_scr (void) { jr nz, _open_locks_loop #endasm #endif +} + +void draw_scr (void) { + is_rendering = 1; + + #ifdef ENABLE_TILANIMS + tilanims_reset (); + #endif + + #ifdef ENABLE_FIRE_ZONE + f_zone_ac = 0; + #endif + + draw_scr_background (); + + // Object setup + + enems_load (); + + #ifdef ACTIVATE_SCRIPTING + #if defined LINE_OF_TEXT && !defined LINE_OF_TEXT_NO_AUTOERASE + _x = LINE_OF_TEXT_X; _y = LINE_OF_TEXT; _t = LINE_OF_TEXT_ATTR; _gp_gen = " "; print_str (); + #endif + // Ejecutamos los scripts de entrar en pantalla: + run_script (2 * MAP_W * MAP_H + 1); // ENTERING ANY + run_script (n_pant << 1); // ENTERING SCREEN n + #endif + + #include "my/ci/entering_screen.h" + + draw_scr_hotspots_locks (); #ifdef PLAYER_CAN_FIRE bullets_init (); @@ -609,7 +624,8 @@ void select_joyfunc (void) { } #ifdef MODE_128K - wyz_play_sound (SFX_START); + STOP_SOUND (); + PLAY_SOUND (SFX_START); sp_WaitForNoKey (); #endif } diff --git a/examples/goku_mal/dev/engine/breakable.h b/examples/goku_mal/dev/engine/breakable.h index 81e191c1..01e9423f 100644 --- a/examples/goku_mal/dev/engine/breakable.h +++ b/examples/goku_mal/dev/engine/breakable.h @@ -16,14 +16,14 @@ void break_wall (void) { } else { _n = _t = 0; update_tile (); #ifdef MODE_128K - gpix = SFX_BREAKABLE_BREAK + gpit = SFX_BREAKABLE_BREAK; #else gpit = 0; #endif #include "my/ci/on_wall_broken.h" } #ifdef MODE_128K - wyz_play_sound (gpit); + PLAY_SOUND (gpit); #else // Show what just happened before the sound interrupts the action sp_UpdateNow (); diff --git a/examples/goku_mal/dev/engine/bullets.h b/examples/goku_mal/dev/engine/bullets.h index 4dda4259..2278b516 100644 --- a/examples/goku_mal/dev/engine/bullets.h +++ b/examples/goku_mal/dev/engine/bullets.h @@ -54,10 +54,11 @@ void bullets_fire (void) { #ifdef PLAYER_CAN_FIRE_FLAG if (flags [PLAYER_CAN_FIRE_FLAG] == 0) return; #endif + #ifdef MAX_AMMO if (!p_ammo) return; - -- p_ammo; #endif + // Buscamos una bala libre for (b_it = 0; b_it < MAX_BULLETS; ++ b_it) { if (bullets_estado [b_it] == 0) { @@ -165,7 +166,7 @@ void bullets_fire (void) { #endif #ifdef MODE_128K - wyz_play_sound (SFX_SHOOT); + PLAY_SOUND (SFX_SHOOT); #else beep_fx (6); #endif @@ -180,8 +181,12 @@ void bullets_fire (void) { #include "my/ci/on_player_fires.h" - bullets_update (); + bullets_update (); + #ifdef MAX_AMMO + -- p_ammo; + #endif + break; } } diff --git a/examples/goku_mal/dev/engine/c_levels.h b/examples/goku_mal/dev/engine/c_levels.h index 0a76ee0c..cbbaf91a 100644 --- a/examples/goku_mal/dev/engine/c_levels.h +++ b/examples/goku_mal/dev/engine/c_levels.h @@ -10,12 +10,12 @@ void prepare_level (void) { #endif { n_pant = level_data.scr_ini; - gpx = level_data->ini_x << 4; p_x = gpx << 6; - gpy = level_data->ini_y << 4; p_y = gpy << 6; + gpx = level_data.ini_x << 4; p_x = gpx << 6; + gpy = level_data.ini_y << 4; p_y = gpy << 6; } #ifdef ACTIVATE_SCRIPTING - main_script_offset = levels [level]->script_offset; + main_script_offset = levels [level].script_offset; #endif #else unpack ((unsigned int) levels [level].c_map_bolts, (unsigned int) (mapa)); @@ -24,11 +24,11 @@ void prepare_level (void) { unpack ((unsigned int) levels [level].c_behs, (unsigned int) (behs)); #ifdef PER_LEVEL_SPRITESET - unpack ((unsigned int) levels [level].c_sprites, (unsigned int) (sprites)); + unpack ((unsigned int) levels [level].c_sprites, (unsigned int) (sprites + 16)); #endif - level_data->map_w = levels.map_w; - level_data->map_h = levels.map_h; + level_data.map_w = levels [level].map_w; + level_data.map_h = levels [level].map_h; #ifdef ACTIVATE_SCRIPTING if (script_result != 3) diff --git a/examples/goku_mal/dev/engine/enem_mods/enem_type_pursuers.h b/examples/goku_mal/dev/engine/enem_mods/enem_type_pursuers.h index 7cd62b19..601aa01f 100644 --- a/examples/goku_mal/dev/engine/enem_mods/enem_type_pursuers.h +++ b/examples/goku_mal/dev/engine/enem_mods/enem_type_pursuers.h @@ -9,8 +9,8 @@ _en_x = _en_x1; _en_y = _en_y1; en_an_alive [enit] = 1; - en_an_rawv [enit] = 1 << (rand () % 5); - if (en_an_rawv [enit] > 4) en_an_rawv [enit] = 2; + en_an_rawv [enit] = 1 << (rand () & 3); + if (en_an_rawv [enit] > PURSUERS_MAX_V) en_an_rawv [enit] = 2; en_an_dead_row [enit] = 11 + (rand () & 7); #if defined(PLAYER_STEPS_ON_ENEMIES) || defined(PLAYER_CAN_FIRE) _en_life = ENEMIES_LIFE_GAUGE; diff --git a/examples/goku_mal/dev/engine/enem_mods/enem_type_pursuers_asm.h b/examples/goku_mal/dev/engine/enem_mods/enem_type_pursuers_asm.h index 6980b4b1..6ce2cc20 100644 --- a/examples/goku_mal/dev/engine/enem_mods/enem_type_pursuers_asm.h +++ b/examples/goku_mal/dev/engine/enem_mods/enem_type_pursuers_asm.h @@ -34,19 +34,21 @@ ld a, 1 ld (hl), a - // en_an_rawv [enit] = 1 << (rand () % 5); + // en_an_rawv [enit] = 1 << (rand () & 3); push bc call _rand // rand -> L - ld de, 5 - ex de, hl - call l_div // l_div :: DE / HL -> HL = cociente; DE = resto - ex de, hl // HL = resto + + ld a, l + and 3 + ld l, a + ld h, 0 + ld de, 1 call l_asl // l_asl :: DE << HL -> HL ld a, l pop bc - cp 5 + cp PURSUERS_MAX_V+1 jr c, _eij_rawv_set ld a, 2 diff --git a/examples/goku_mal/dev/engine/enengine.h b/examples/goku_mal/dev/engine/enengine.h index 17dddc2c..4acb013d 100644 --- a/examples/goku_mal/dev/engine/enengine.h +++ b/examples/goku_mal/dev/engine/enengine.h @@ -14,8 +14,8 @@ #if defined(PLAYER_STEPS_ON_ENEMIES) || defined (PLAYER_CAN_FIRE) void enems_init (void) { enit = 0; - while (enit < MAP_W * MAP_H * 3) { - malotes [enit].t = malotes [enit].t & 15; + while (enit < MAP_W * MAP_H * MAX_ENEMS) { + malotes [enit].t = malotes [enit].t & 0xEF; // Clear bit 4 #ifdef PLAYER_CAN_FIRE malotes [enit].life = ENEMIES_LIFE_GAUGE; #endif @@ -121,7 +121,7 @@ void enems_draw_current (void) { void enems_load (void) { // Movemos y cambiamos a los enemigos según el tipo que tengan - enoffs = n_pant * 3; + enoffs = n_pant * MAX_ENEMS; for (enit = 0; enit < MAX_ENEMS; ++ enit) { en_an_frame [enit] = 0; @@ -141,6 +141,10 @@ void enems_load (void) { #endif #endif + #include "my/ci/enems_custom_respawn.h" + + en_an_next_frame [enit] = sprite_18_a; + switch (malotes [enoffsmasi].t & 0x1f) { case 1: case 2: @@ -184,13 +188,8 @@ void enems_load (void) { #endif #include "my/ci/enems_load.h" - - default: - en_an_next_frame [enit] = sprite_18_a; } - malotes [enoffsmasi].t &= 0x1f; - #include "my/ci/enems_extra_mods.h" } } @@ -227,7 +226,7 @@ void enems_move (void) { ld hl, (_enoffsmasi) ld h, 0 - #ifdef PLAYER_CAN_FIRE + #if defined PLAYER_CAN_FIRE || defined COMPRESSED_LEVELS add hl, hl // x2 ld d, h ld e, l // DE = x2 @@ -284,6 +283,8 @@ void enems_move (void) { ld a, (hl) ld (__en_t), a + and 0x1f + ld (_rdt), a #ifdef PLAYER_CAN_FIRE inc hl @@ -316,7 +317,7 @@ void enems_move (void) { #endif #endif - switch (_en_t) { + switch (rdt) { case 1: case 2: case 3: @@ -326,7 +327,7 @@ void enems_move (void) { #endif #include "engine/enem_mods/enem_type_lineal.h" #ifdef ENABLE_ORTHOSHOOTERS - if (_en_t == 5) { + if (rdt == 5) { #include "engine/enem_mods/enem_type_orthoshooters.h" } #endif @@ -443,13 +444,13 @@ void enems_move (void) { // Step over enemy #ifdef PLAYER_CAN_STEP_ON_FLAG if (flags [PLAYER_CAN_STEP_ON_FLAG] != 0 && - gpy < _en_y - 2 && p_vy >= 0 && _en_t >= PLAYER_MIN_KILLABLE) + gpy < _en_y - 2 && p_vy >= 0 && rdt >= PLAYER_MIN_KILLABLE) #else - if (gpy < _en_y - 2 && p_vy >= 0 && _en_t >= PLAYER_MIN_KILLABLE) + if (gpy < _en_y - 2 && p_vy >= 0 && rdt >= PLAYER_MIN_KILLABLE) #endif { #ifdef MODE_128K - wyz_play_sound (SFX_KILL_ENEMY_STEP); + PLAY_SOUND (SFX_KILL_ENEMY_STEP); en_an_state [enit] = GENERAL_DYING; en_an_count [enit] = 12; en_an_next_frame [enit] = sprite_17_a; @@ -519,7 +520,7 @@ void enems_move (void) { #ifdef PLAYER_CAN_FIRE // Collide with bullets #ifdef FIRE_MIN_KILLABLE - if (_en_t >= FIRE_MIN_KILLABLE) + if (rdt >= FIRE_MIN_KILLABLE) #endif { for (gpjt = 0; gpjt < MAX_BULLETS; gpjt ++) { @@ -548,7 +549,7 @@ void enems_move (void) { #ifdef MODE_128K en_an_state [enit] = GENERAL_DYING; en_an_count [enit] = 12; - wyz_play_sound (SFX_KILL_ENEMY_SHOOT); + PLAY_SOUND (SFX_KILL_ENEMY_SHOOT); #else beep_fx (5); en_an_next_frame [enit] = sprite_18_a; @@ -562,7 +563,7 @@ void enems_move (void) { } #ifdef MODE_128K - wyz_play_sound (SFX_HIT_ENEMY); + PLAY_SOUND (SFX_HIT_ENEMY); #else beep_fx (1); #endif diff --git a/examples/goku_mal/dev/engine/hotspots.h b/examples/goku_mal/dev/engine/hotspots.h index 10f9978c..3a1b3223 100644 --- a/examples/goku_mal/dev/engine/hotspots.h +++ b/examples/goku_mal/dev/engine/hotspots.h @@ -25,13 +25,13 @@ void hotspots_do (void) { if (p_objs == 0) { p_objs ++; #ifdef MODE_128K - wyz_play_sound (SFX_ONE_OBJECT_GET); + PLAY_SOUND (SFX_ONE_OBJECT_GET); #else beep_fx (9); #endif } else { #ifdef MODE_128K - wyz_play_sound (SFX_ONE_OBJECT_WRONG); + PLAY_SOUND (SFX_ONE_OBJECT_WRONG); #else beep_fx (4); #endif @@ -45,7 +45,7 @@ void hotspots_do (void) { #endif #ifdef MODE_128K - wyz_play_sound (SFX_OBJECT_GET); + PLAY_SOUND (SFX_OBJECT_GET); #else beep_fx (9); #endif @@ -70,7 +70,7 @@ void hotspots_do (void) { case 2: p_keys ++; #ifdef MODE_128K - wyz_play_sound (SFX_KEY_GET); + PLAY_SOUND (SFX_KEY_GET); #else beep_fx (7); #endif @@ -83,7 +83,7 @@ void hotspots_do (void) { if (p_life > PLAYER_LIFE) p_life = PLAYER_LIFE; #ifdef MODE_128K - wyz_play_sound (SFX_REFILL_GET); + PLAY_SOUND (SFX_REFILL_GET); #else beep_fx (8); #endif @@ -97,7 +97,7 @@ void hotspots_do (void) { else p_ammo = MAX_AMMO; #ifdef MODE_128K - wyz_play_sound (SFX_REFILL_GET); + PLAY_SOUND (SFX_REFILL_GET); #else beep_fx (9); #endif @@ -111,7 +111,7 @@ void hotspots_do (void) { else timer_t = 99; #ifdef MODE_128K - wyz_play_sound (SFX_REFILL_GET); + PLAY_SOUND (SFX_REFILL_GET); #else beep_fx (7); #endif @@ -122,7 +122,7 @@ void hotspots_do (void) { case 6: mem_save (); #ifdef MODE_128K - wyz_play_sound (SFX_START); + PLAY_SOUND (SFX_START); #else beep_fx (7); #endif diff --git a/examples/goku_mal/dev/engine/isr.h b/examples/goku_mal/dev/engine/isr.h new file mode 100644 index 00000000..76b5bf4a --- /dev/null +++ b/examples/goku_mal/dev/engine/isr.h @@ -0,0 +1,15 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// Very simple ISR which counts frames. + +#asm + defw 0 // 2 bytes libres +#endasm + +void ISR (void) { + #asm + ld hl, _isrc + inc (hl) + #endasm +} diff --git a/examples/goku_mal/dev/engine/player.h b/examples/goku_mal/dev/engine/player.h index 7256df57..59844d68 100644 --- a/examples/goku_mal/dev/engine/player.h +++ b/examples/goku_mal/dev/engine/player.h @@ -28,17 +28,20 @@ void player_init (void) { #if !defined(COMPRESSED_LEVELS) || defined(REFILL_ME) p_life = PLAYER_LIFE; #endif - p_objs = 0; - p_keys = 0; - p_killed = 0; p_disparando = 0; - #ifdef MAX_AMMO - #ifdef INITIAL_AMMO - p_ammo = INITIAL_AMMO; - #else - p_ammo = MAX_AMMO; + + #ifndef NO_RESET_STATS + p_objs = 0; + p_keys = 0; + p_killed = 0; + #ifdef MAX_AMMO + #ifdef INITIAL_AMMO + p_ammo = INITIAL_AMMO; + #else + p_ammo = MAX_AMMO; + #endif #endif - #endif + #endif #ifdef TIMER_ENABLE timer_count = 0; @@ -283,6 +286,7 @@ unsigned char player_move (void) { // Collision, may set possee, hit_v + // Velocity positive (going downwards) player_calc_bounding_box (); hit_v = 0; @@ -400,7 +404,7 @@ unsigned char player_move (void) { p_saltando = 1; p_cont_salto = 0; #ifdef MODE_128K - wyz_play_sound (SFX_JUMP); + PLAY_SOUND (SFX_JUMP); #else beep_fx (3); #endif @@ -426,7 +430,7 @@ unsigned char player_move (void) { p_saltando = 1; p_cont_salto = 0; #ifdef MODE_128K - wyz_play_sound (SFX_JUMP); + PLAY_SOUND (SFX_JUMP); #else beep_fx (3); #endif @@ -446,43 +450,47 @@ unsigned char player_move (void) { // MOVEMENT IN THE HORIZONTAL AXIS // *************************************************************************** - if ( ! ((pad0 & sp_LEFT) == 0 || (pad0 & sp_RIGHT) == 0)) { - #ifdef PLAYER_GENITAL - p_facing_h = 0xff; - #endif - if (p_vx > 0) { - p_vx -= PLAYER_RX; - if (p_vx < 0) p_vx = 0; - } else if (p_vx < 0) { - p_vx += PLAYER_RX; - if (p_vx > 0) p_vx = 0; + #ifndef PLAYER_DISABLE_DEFAULT_HENG + if ( ! ((pad0 & sp_LEFT) == 0 || (pad0 & sp_RIGHT) == 0)) { + #ifdef PLAYER_GENITAL + p_facing_h = 0xff; + #endif + if (p_vx > 0) { + p_vx -= PLAYER_RX; + if (p_vx < 0) p_vx = 0; + } else if (p_vx < 0) { + p_vx += PLAYER_RX; + if (p_vx > 0) p_vx = 0; + } + wall_h = 0; } - wall_h = 0; - } - if ((pad0 & sp_LEFT) == 0) { - #ifdef PLAYER_GENITAL - p_facing_h = FACING_LEFT; - #endif - if (p_vx > -PLAYER_MAX_VX) { - #ifndef PLAYER_GENITAL - p_facing = 0; + if ((pad0 & sp_LEFT) == 0) { + #ifdef PLAYER_GENITAL + p_facing_h = FACING_LEFT; #endif - p_vx -= PLAYER_AX; + if (p_vx > -PLAYER_MAX_VX) { + #ifndef PLAYER_GENITAL + p_facing = 0; + #endif + p_vx -= PLAYER_AX; + } } - } - if ((pad0 & sp_RIGHT) == 0) { - #ifdef PLAYER_GENITAL - p_facing_h = FACING_RIGHT; - #endif - if (p_vx < PLAYER_MAX_VX) { - p_vx += PLAYER_AX; - #ifndef PLAYER_GENITAL - p_facing = 1; + if ((pad0 & sp_RIGHT) == 0) { + #ifdef PLAYER_GENITAL + p_facing_h = FACING_RIGHT; #endif + if (p_vx < PLAYER_MAX_VX) { + p_vx += PLAYER_AX; + #ifndef PLAYER_GENITAL + p_facing = 1; + #endif + } } - } + #endif + + #include "my/ci/custom_heng.h" p_x = p_x + p_vx; #ifndef PLAYER_GENITAL @@ -606,7 +614,7 @@ unsigned char player_move (void) { #elif defined (BOUNDING_BOX_8_CENTERED) cy1 = (gpy + 3) >> 4; #else - cy1 = gpy >> 3; + cy1 = (gpy - 1) >> 3; #endif if (attr (cx1, cy1) == 10) { @@ -636,7 +644,7 @@ unsigned char player_move (void) { #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) cx1 = (gpx + 3) >> 4; #else - cx1 = gpx >> 4; + cx1 = (gpx - 1) >> 4; #endif if (attr (cx1, cy1) == 10) { @@ -717,19 +725,19 @@ unsigned char player_move (void) { } } - p_next_frame = player_cells [p_facing + p_frame]; + p_next_frame = (unsigned char *) (player_cells [p_facing + p_frame]); #elif defined PLAYER_BOOTEE gpit = p_facing << 2; if (p_vy == 0) { - p_next_frame = player_cells [gpit]; + p_next_frame = (unsigned char *) (player_cells [gpit]); } else if (p_vy < 0) { - p_next_frame = player_cells [gpit + 1]; + p_next_frame = (unsigned char *) (player_cells [gpit + 1]); } else { - p_next_frame = player_cells [gpit + 2]; + p_next_frame = (unsigned char *) (player_cells [gpit + 2]); } #else if (!possee && !p_gotten) { - p_next_frame = player_cells [8 + p_facing]; + p_next_frame = (unsigned char *) (player_cells [8 + p_facing]); } else { gpit = p_facing << 2; if (p_vx == 0) { @@ -737,7 +745,7 @@ unsigned char player_move (void) { } else { rda = ((gpx + 4) >> 3) & 3; } - p_next_frame = player_cells [gpit + rda]; + p_next_frame = (unsigned char *) (player_cells [gpit + rda]); } #endif } @@ -752,7 +760,7 @@ void player_kill (unsigned char sound) { player_deplete (); #ifdef MODE_128K - wyz_play_sound (sound); + PLAY_SOUND (sound); #else beep_fx (sound); #endif diff --git a/examples/goku_mal/dev/engine/player_wip.h b/examples/goku_mal/dev/engine/player_wip.h new file mode 100644 index 00000000..815761a3 --- /dev/null +++ b/examples/goku_mal/dev/engine/player_wip.h @@ -0,0 +1,884 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// player.h + +void player_init (void) { + // Inicializa player con los valores iniciales + // (de ahí lo de inicializar). + + #ifndef COMPRESSED_LEVELS + gpx = PLAYER_INI_X << 4; p_x = gpx << 6; + gpy = PLAYER_INI_Y << 4; p_y = gpy << 6; + #endif + p_vy = 0; + p_vx = 0; + p_cont_salto = 1; + p_saltando = 0; + p_frame = 0; + p_subframe = 0; + #ifdef PLAYER_GENITAL + p_facing = FACING_DOWN; + p_facing_v = p_facing_h = 0xff; + #else + p_facing = 1; + #endif + p_estado = EST_NORMAL; + p_ct_estado = 0; + #if !defined(COMPRESSED_LEVELS) || defined(REFILL_ME) + p_life = PLAYER_LIFE; + #endif + p_objs = 0; + p_keys = 0; + p_killed = 0; + p_disparando = 0; + #ifdef MAX_AMMO + #ifdef INITIAL_AMMO + p_ammo = INITIAL_AMMO; + #else + p_ammo = MAX_AMMO; + #endif + #endif + + #ifdef TIMER_ENABLE + timer_count = 0; + timer_zero = 0; + #ifdef TIMER_LAPSE + timer_frames = TIMER_LAPSE; + #endif + #ifdef TIMER_INITIAL + timer_t = TIMER_INITIAL; + #endif + #ifdef TIMER_START + timer_on = 1; + #else + timer_on = 0; + #endif + #endif +} + +void player_calc_bounding_box (void) { + #if defined (BOUNDING_BOX_8_BOTTOM) + #asm + ld a, (_gpx) + add 4 + srl a + srl a + srl a + srl a + ld (_ptx1), a + ld a, (_gpx) + add 11 + srl a + srl a + srl a + srl a + ld (_ptx2), a + ld a, (_gpy) + add 8 + srl a + srl a + srl a + srl a + ld (_pty1), a + ld a, (_gpy) + add 15 + srl a + srl a + srl a + srl a + ld (_pty2), a + #endasm + #elif defined (BOUNDING_BOX_8_CENTERED) + #asm + ld a, (_gpx) + add 4 + srl a + srl a + srl a + srl a + ld (_ptx1), a + ld a, (_gpx) + add 11 + srl a + srl a + srl a + srl a + ld (_ptx2), a + ld a, (_gpy) + add 4 + srl a + srl a + srl a + srl a + ld (_pty1), a + ld a, (_gpy) + add 11 + srl a + srl a + srl a + srl a + ld (_pty2), a + #endasm + #else + #asm + ld a, (_gpx) + srl a + srl a + srl a + srl a + ld (_ptx1), a + ld a, (_gpx) + add 15 + srl a + srl a + srl a + srl a + ld (_ptx2), a + ld a, (_gpy) + srl a + srl a + srl a + srl a + ld (_pty1), a + ld a, (_gpy) + add 15 + srl a + srl a + srl a + srl a + ld (_pty2), a + #endasm + #endif +} + +unsigned char player_move (void) { + + // *************************************************************************** + // MOVEMENT IN THE VERTICAL AXIS + // *************************************************************************** + + #if !defined PLAYER_GENITAL || defined VENG_SELECTOR + + #if !defined PLAYER_DISABLE_GRAVITY + #if defined VENG_SELECTOR && defined PLAYER_VKEYS + if (veng_selector != VENG_KEYS) + #endif + { + // Do gravity + + #asm + ; Signed comparisons are hard + ; p_vy <= PLAYER_MAX_VY_CAYENDO - PLAYER_G + + ; We are going to take a shortcut. + ; If p_vy < 0, just add PLAYER_G. + ; If p_vy > 0, we can use unsigned comparition anyway. + + ld hl, (_p_vy) + bit 7, h + jr nz, _player_gravity_add ; < 0 + + ld de, PLAYER_MAX_VY_CAYENDO - PLAYER_G + or a + push hl + sbc hl, de + pop hl + jr nc, _player_gravity_maximum + + ._player_gravity_add + ld de, PLAYER_G + add hl, de + jr _player_gravity_vy_set + + ._player_gravity_maximum + ld hl, PLAYER_MAX_VY_CAYENDO + + ._player_gravity_vy_set + ld (_p_vy), hl + + ._player_gravity_done + + #ifdef PLAYER_CUMULATIVE_JUMP + ld a, (_p_jmp_on) + or a + jr nz, _player_gravity_p_gotten_done + #endif + + ld a, (_p_gotten) + or a + jr z, _player_gravity_p_gotten_done + + xor a + ld (_p_vy), a + + ._player_gravity_p_gotten_done + #endasm + } + #endif + #endif + + #if defined PLAYER_GENITAL || (defined VENG_SELECTOR && defined PLAYER_VKEYS) + + #if defined (VENG_SELECTOR) + if (veng_selector == VENG_KEYS ) + #endif + { + // Pad do + + if ( ! ((pad0 & sp_UP) == 0 || (pad0 & sp_DOWN) == 0)) { + p_facing_v = 0xff; + wall_v = 0; + if (p_vy > 0) { + p_vy -= PLAYER_RX; + if (p_vy < 0) p_vy = 0; + } else if (p_vy < 0) { + p_vy += PLAYER_RX; + if (p_vy > 0) p_vy = 0; + } + } + + if ((pad0 & sp_UP) == 0) { + p_facing_v = FACING_UP; + if (p_vy > -PLAYER_MAX_VX) p_vy -= PLAYER_AX; + } + + if ((pad0 & sp_DOWN) == 0) { + p_facing_v = FACING_DOWN; + if (p_vy < PLAYER_MAX_VX) p_vy += PLAYER_AX; + } + } + #endif + + #ifdef PLAYER_HAS_JETPAC + #ifdef VENG_SELECTOR + if (veng_selector == VENG_JETPAC) + #endif + { + if ((pad0 & sp_UP) == 0) { + p_vy -= PLAYER_INCR_JETPAC; + if (p_vy < -PLAYER_MAX_VY_JETPAC) p_vy = -PLAYER_MAX_VY_JETPAC; + + #include "my/ci/on_jetpac_boost.h" + + p_jetpac_on = 1; + } else p_jetpac_on = 0; + } + #endif + + #include "my/ci/custom_veng.h" + + p_y += p_vy; + + #if !defined (PLAYER_GENITAL) + if (p_gotten) p_y += ptgmy; + #endif + + // Safe + + if (p_y < 0) p_y = 0; + if (p_y > 9216) p_y = 9216; + + gpy = p_y >> 6; + + // Collision, may set possee, hit_v + + #asm + call _player_calc_bounding_box + + xor a + ld (_hit_v), a + + ld a, (_ptx1) + ld (_cx1), a + ld a, (_ptx2) + ld (_cx2), a + + // Calculate vertical velocity + + ld a, (_p_vy) + #if !defined (PLAYER_GENITAL) + ld c, a + ld a, (_ptgmy) + add c + #endif + + // Skip if not moving in the vertical axis + + or a + jp z, _va_collision_done + + // Check sign + + bit 7, a + jr z, _va_collision_vy_positive + + ._va_collision_vy_negative + + // Velocity negative (going upwards) + + ld a, (_pty1) + ld (_cy1), a + ld (_cy2), a + + call _cm_two_points + + // if ((at1 & 8) || (at2 & 8)) { + ld a, (_at1) + and 8 + jr nz, _va_col_vy_neg_do + + ld a, (_at2) + and 8 + jr z, _va_collision_checkevil + + ._va_col_vy_neg_do + + #ifdef PLAYER_BOUNCE_WITH_WALLS + ld a, (_p_vy) + sra a + neg a + #else + xor a + #endif + ld (_p_vy), a + + ld a, (_pty1) + inc a + sla a + sla a + sla a + sla a + + #if defined (BOUNDING_BOX_8_BOTTOM) + // gpy = ((pty1 + 1) << 4) - 8; + sub 8 + #elif defined (BOUNDING_BOX_8_CENTERED) + // gpy = ((pty1 + 1) << 4) - 4; + sub 4 + #elif defined (BOUNDING_BOX_TINY_BOTTOM) + // gpy = ((pty1 + 1) << 4) - 14; + sub 14 + #else + // gpy = ((pty1 + 1) << 4); + #endif + + ld (_gpy), a + + // p_y = gpy << FIXBITS; 16 bits shift + ld d, 0 + ld e, a + ld l, FIXBITS + call l_asl + ld (_p_y), hl + + #if defined PLAYER_GENITAL || defined LOCKS_CHECK_VERTICAL + ld a, WTOP + ld (_wall_v), a + #endif + + jr _va_collision_checkevil + + ._va_collision_vy_positive + + // Velocity positive (going downwards) + ld a, (_pty2) + ld (_cy1), a + ld (_cy2), a + + call _cm_two_points + + #ifdef PLAYER_GENITAL + // if ((at1 & 8) || (at2 & 8)) { + ld a, (_at1) + and 8 + jr nz, _va_col_vy_pos_do + + ld a, (_at2) + and 8 + jr z, _va_collision_checkevil + #else + // if ((at1 & 8) || + ld a, (_at1) + and 8 + jr nz, _va_col_vy_pos_do + + // (at2 & 8) || + ld a, (_at2) + and 8 + jr nz, _va_col_vy_pos_do + + // (((gpy - 1) & 15) < 8 && + ld a, (_gpy) + dec a + and 15 + cp 8 + jr nc, _va_collision_checkevil + + // ((at1 & 4) || (at2 & 4)))) + ld a, (_at1) + and 4 + jr nz, _va_col_vy_pos_do + + ld a, (_at2) + and 4 + jr z, _va_collision_checkevil + #endif + ._va_col_vy_pos_do + + #ifdef PLAYER_BOUNCE_WITH_WALLS + ld a, (_p_vy) + sra a + neg a + #else + xor a + #endif + ld (_p_vy), a + + ld a, (_pty2) + dec a + sla a + sla a + sla a + sla a + + #ifdef BOUNDING_BOX_8_CENTERED + add 4 + #endif + + ld (_gpy), a + + // p_y = gpy << FIXBITS; 16 bits shift + ld d, 0 + ld e, a + ld l, FIXBITS + call l_asl + ld (_p_y), hl + + #if defined PLAYER_GENITAL || defined LOCKS_CHECK_VERTICAL + ld a, WBOTTOM + ld (_wall_v), a + #endif + + jr _va_collision_done + + ._va_collision_checkevil + + #ifndef DEACTIVATE_EVIL_TILE + #endasm + hit_v = ((at1 & 1) || (at2 & 1)); + #asm + #endif + + ._va_collision_done + #endasm + + gpxx = gpx >> 4; + gpyy = gpy >> 4; + + #ifndef PLAYER_GENITAL + cy1 = cy2 = (gpy + 16) >> 4; + cx1 = ptx1; cx2 = ptx2; + cm_two_points (); + possee = ((at1 & 12) || (at2 & 12)) && (gpy & 15) < 8; + #endif + + // Jump + + #ifdef PLAYER_HAS_JUMP + #ifdef VENG_SELECTOR + if (veng_selector == VENG_JUMP) + #endif + { + #if defined (PLAYER_CAN_FIRE) && !defined (USE_TWO_BUTTONS) + rda = (pad0 & sp_UP) == 0; + #elif defined (PLAYER_CAN_FIRE) && defined (USE_TWO_BUTTONS) + rda = isJoy ? ((pad0 & sp_UP) == 0) : (sp_KeyPressed (key_jump)); + #else + rda = (pad0 & sp_FIRE) == 0; + #endif + + if (rda) { + if (p_saltando == 0) { + if (possee || p_gotten || hit_v) { + p_saltando = 1; + p_cont_salto = 0; + #ifdef MODE_128K + PLAY_SOUND (SFX_JUMP); + #else + beep_fx (3); + #endif + } + } else { + p_vy -= (PLAYER_VY_INICIAL_SALTO + PLAYER_INCR_SALTO - (p_cont_salto >> 1)); + if (p_vy < -PLAYER_MAX_VY_SALTANDO) p_vy = -PLAYER_MAX_VY_SALTANDO; + ++ p_cont_salto; + if (p_cont_salto == 9) p_saltando = 0; + } + } else p_saltando = 0; + } + #endif + + // Bootee engine + + #ifdef PLAYER_BOOTEE + #ifdef VENG_SELECTOR + if (veng_selector == VENG_BOOTEE) + #endif + { + if ( p_saltando == 0 && (possee || p_gotten || hit_v) ) { + p_saltando = 1; + p_cont_salto = 0; + #ifdef MODE_128K + PLAY_SOUND (SFX_JUMP); + #else + beep_fx (3); + #endif + } + + if (p_saltando ) { + p_vy -= (PLAYER_VY_INICIAL_SALTO + PLAYER_INCR_SALTO - (p_cont_salto>>1)); + if (p_vy < -PLAYER_MAX_VY_SALTANDO) p_vy = -PLAYER_MAX_VY_SALTANDO; + ++ p_cont_salto; + if (p_cont_salto == 8) + p_saltando = 0; + } + } + #endif + + // *************************************************************************** + // MOVEMENT IN THE HORIZONTAL AXIS + // *************************************************************************** + + #ifndef PLAYER_DISABLE_DEFAULT_HENG + if ( ! ((pad0 & sp_LEFT) == 0 || (pad0 & sp_RIGHT) == 0)) { + #ifdef PLAYER_GENITAL + p_facing_h = 0xff; + #endif + if (p_vx > 0) { + p_vx -= PLAYER_RX; + if (p_vx < 0) p_vx = 0; + } else if (p_vx < 0) { + p_vx += PLAYER_RX; + if (p_vx > 0) p_vx = 0; + } + wall_h = 0; + } + + if ((pad0 & sp_LEFT) == 0) { + #ifdef PLAYER_GENITAL + p_facing_h = FACING_LEFT; + #endif + if (p_vx > -PLAYER_MAX_VX) { + #ifndef PLAYER_GENITAL + p_facing = 0; + #endif + p_vx -= PLAYER_AX; + } + } + + if ((pad0 & sp_RIGHT) == 0) { + #ifdef PLAYER_GENITAL + p_facing_h = FACING_RIGHT; + #endif + if (p_vx < PLAYER_MAX_VX) { + p_vx += PLAYER_AX; + #ifndef PLAYER_GENITAL + p_facing = 1; + #endif + } + } + #endif + + #include "my/ci/custom_heng.h" + + p_x = p_x + p_vx; + #ifndef PLAYER_GENITAL + p_x += ptgmx; + #endif + + // Safe + + if (p_x < 0) p_x = 0; + if (p_x > 14336) p_x = 14336; + + gpox = gpx; + gpx = p_x >> 6; + + // Collision. May set hit_h + player_calc_bounding_box (); + + hit_h = 0; + cy1 = pty1; cy2 = pty2; + + #if defined (PLAYER_GENITAL) + if (p_vx < 0) + #else + if (p_vx + ptgmx < 0) + #endif + { + cx1 = cx2 = ptx1; + cm_two_points (); + + if ((at1 & 8) || (at2 & 8)) { + #include "my/ci/bg_collision/obstacle_left.h" + + #ifdef PLAYER_BOUNCE_WITH_WALLS + p_vx = -(p_vx / 2); + #else + p_vx = 0; + #endif + + #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) || defined (BOUNDING_BOX_TINY_BOTTOM) + gpx = ((ptx1 + 1) << 4) - 4; + #else + gpx = ((ptx1 + 1) << 4); + #endif + + p_x = gpx << 6; + wall_h = WLEFT; + } + #ifndef DEACTIVATE_EVIL_TILE + else hit_h = ((at1 & 1) || (at2 & 1)); + #endif + + } + + #if defined (PLAYER_GENITAL) + if (p_vx > 0) + #else + if (p_vx + ptgmx > 0) + #endif + { + cx1 = cx2 = ptx2; + cm_two_points (); + + if ((at1 & 8) || (at2 & 8)) { + #include "my/ci/bg_collision/obstacle_right.h" + + #ifdef PLAYER_BOUNCE_WITH_WALLS + p_vx = -(p_vx / 2); + #else + p_vx = 0; + #endif + + #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) || defined (BOUNDING_BOX_TINY_BOTTOM) + gpx = (ptx1 << 4) + 4; + #else + gpx = (ptx1 << 4); + #endif + + p_x = gpx << 6; + wall_h = WRIGHT; + } + #ifndef DEACTIVATE_EVIL_TILE + else hit_h = ((at1 & 1) || (at2 & 1)); + #endif + + } + + // Priority to decide facing + + #ifdef PLAYER_GENITAL + #ifdef TOP_OVER_SIDE + if (p_facing_v != 0xff) { + p_facing = p_facing_v; + } else if (p_facing_h != 0xff) { + p_facing = p_facing_h; + } + #else + if (p_facing_h != 0xff) { + p_facing = p_facing_h; + } else if (p_facing_v != 0xff) { + p_facing = p_facing_v; + } + #endif + #endif + + cx1 = p_tx = (gpx + 8) >> 4; + cy1 = p_ty = (gpy + 8) >> 4; + + rdb = attr (cx1, cy1); + + // Special tiles + if (rdb & 128) { + #include "my/ci/on_special_tile.h" + } + + #if defined (PLAYER_PUSH_BOXES) || !defined (DEACTIVATE_KEYS) + #if defined PLAYER_GENITAL || defined LOCKS_CHECK_VERTICAL + if (wall_v == WTOP) { + // interact up + #if defined (BOUNDING_BOX_8_BOTTOM) + cy1 = (gpy + 7) >> 4; + #elif defined (BOUNDING_BOX_8_CENTERED) + cy1 = (gpy + 3) >> 4; + #else + cy1 = (gpy - 1) >> 3; + #endif + + if (attr (cx1, cy1) == 10) { + x0 = x1 = cx1; y0 = cy1; y1 = cy1 - 1; + process_tile (); + } + + } else if (wall_v == WBOTTOM) { + // interact down + #if defined (BOUNDING_BOX_8_BOTTOM) + cy1 = (gpy + 16) >> 4; + #elif defined (BOUNDING_BOX_8_CENTERED) + cy1 = (gpy + 12) >> 4; + #else + cy1 = (gpy + 16) >> 3; + #endif + + if (attr (cx1, cy1) == 10) { + x0 = x1 = cx1; y0 = cy1; y1 = cy1 + 1; + process_tile (); + } + } else + #endif + + if (wall_h == WLEFT) { + // interact left + #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) + cx1 = (gpx + 3) >> 4; + #else + cx1 = (gpx - 1) >> 4; + #endif + + if (attr (cx1, cy1) == 10) { + y0 = y1 = cy1; x0 = cx1; x1 = cx1 - 1; + process_tile (); + } + } else if (wall_h == WRIGHT) { + // interact right + #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) + cx1 = (gpx + 12) >> 4; + #else + cx1 = (gpx + 16) >> 4; + #endif + if (attr (cx1, cy1) == 10) { + y0 = y1 = cy1; x0 = cx1; x1 = cx1 + 1; + process_tile (); + } + } + #endif + + #ifdef PLAYER_CAN_FIRE + // Disparos + if ((pad0 & sp_FIRE) == 0 && p_disparando == 0) { + p_disparando = 1; + #ifdef FIRE_TO_PUSH + //if (pushed_any == 0) + #endif + bullets_fire (); + #ifdef FIRE_TO_PUSH + //else pushed_any = 0; + #endif + } + + if ((pad0 & sp_FIRE)) + p_disparando = 0; + + #endif + + #ifndef DEACTIVATE_EVIL_TILE + // Tiles que te matan. + // hit_v tiene preferencia sobre hit_h + hit = 0; + if (hit_v) { + hit = 1; + p_vy = addsign (-p_vy, PLAYER_MAX_VX); + } else if (hit_h) { + hit = 1; + p_vx = addsign (-p_vx, PLAYER_MAX_VX); + } + + if (hit) { + #ifdef PLAYER_FLICKERS + if (p_estado == EST_NORMAL) + #endif + { + #ifdef MODE_128K + p_killme = SFX_SPIKES; + #else + p_killme = 4; + #endif + } + } + #endif + + // Select animation frame + + #ifdef PLAYER_CUSTOM_ANIMATION + #include "my/custom_animation.h" + #elif defined PLAYER_GENITAL + if (p_vx || p_vy) { + ++ p_subframe; + if (p_subframe == 4) { + p_subframe = 0; + p_frame = !p_frame; + #ifdef PLAYER_STEP_SOUND + step (); + #endif + } + } + + p_next_frame = player_cells [p_facing + p_frame]; + #elif defined PLAYER_BOOTEE + gpit = p_facing << 2; + if (p_vy == 0) { + p_next_frame = player_cells [gpit]; + } else if (p_vy < 0) { + p_next_frame = player_cells [gpit + 1]; + } else { + p_next_frame = player_cells [gpit + 2]; + } + #else + if (!possee && !p_gotten) { + p_next_frame = player_cells [8 + p_facing]; + } else { + gpit = p_facing << 2; + if (p_vx == 0) { + rda = 1; + } else { + rda = ((gpx + 4) >> 3) & 3; + } + p_next_frame = player_cells [gpit + rda]; + } + #endif +} + +void player_deplete (void) { + p_life = (p_life > p_kill_amt) ? p_life - p_kill_amt : 0; +} + +void player_kill (unsigned char sound) { + p_killme = 0; + + player_deplete (); + + #ifdef MODE_128K + PLAY_SOUND (sound); + #else + beep_fx (sound); + #endif + + #ifdef CP_RESET_WHEN_DYING + #ifdef CP_RESET_ALSO_FLAGS + mem_load (); + #else + n_pant = sg_pool [MAX_FLAGS]; + p_x = sg_pool [MAX_FLAGS + 1] << 10; + p_y = sg_pool [MAX_FLAGS + 2] << 10; + #endif + o_pant = 0xff; // Reload + #endif + + #ifdef PLAYER_FLICKERS + p_estado = EST_PARP; + p_ct_estado = 50; + #endif +} + diff --git a/examples/goku_mal/dev/engine/simple_cocos.h b/examples/goku_mal/dev/engine/simple_cocos.h index 1c33a2a5..5a4da667 100644 --- a/examples/goku_mal/dev/engine/simple_cocos.h +++ b/examples/goku_mal/dev/engine/simple_cocos.h @@ -100,7 +100,71 @@ void simple_coco_update (void) { // Check collision (player) - // Check collision (BG) + #ifdef PLAYER_FLICKERS + ld a, (_p_estado) + or a + jr nz, _simple_coco_update_continue + #endif + + // rdx + 3 >= gpx && rdx + 3 <= gpx + 15 && + // rdx + 3 >= gpx && rdx <= gpx + 12 + + // rdx + 3 >= gpx + ld a, (_gpx) + ld c, a + ld a, (_rdx) + add 3 + cp c + jr c, _simple_coco_update_collpl_done + + // gpx + 12 >= rdx + ld a, (_rdx) + ld c, a + ld a, (_gpx) + add 12 + cp c + jr c, _simple_coco_update_collpl_done + + // rdy + 3 >= gpy && rdy + 3 <= gpy + 15 + // rdy + 3 >= gpy && rdy <= gpy + 12 + + // rdy + 3 >= gpy + ld a, (_gpy) + ld c, a + ld a, (_rdy) + add 3 + cp c + jr c, _simple_coco_update_collpl_done + + // gpy + 12 >= rdy + ld a, (_rdy) + ld c, a + ld a, (_gpy) + add 12 + cp c + jr c, _simple_coco_update_collpl_done + + // Kill player + ld a, 0xff + ld (_rdy), a // This effectively marks the coco for destruction + + #ifdef MODE_128K + ld a, SFX_ENEMY_HIT + #else + ld a, 4 + #endif + ld (_p_killme), a + + jr _simple_coco_update_continue + + ._simple_coco_update_collpl_done + + #endasm + + // Check collision (BG) + if (attr ((rdx + 3) >> 4, (rdy + 3) >> 4) & 12) rdy = 0xff; + + #asm ._simple_coco_update_continue // And update arrays diff --git a/examples/goku_mal/dev/goku_mal.map b/examples/goku_mal/dev/goku_mal.map index 79328bff..7821568b 100644 --- a/examples/goku_mal/dev/goku_mal.map +++ b/examples/goku_mal/dev/goku_mal.map @@ -1,2034 +1,1172 @@ -ACFAIL = C94B, L: SPADDCOLSPR -ACLOOP = C8D1, L: SPADDCOLSPR -ACNOCRY = C8C0, L: SPADDCOLSPR -ACNOCRY3 = C921, L: SPADDCOLSPR -ADJLOOP = C6F0, L: SPMOVESPRABS -ADJUSTGRAPHICS = C833, L: SPMOVESPRABS -APBRANCH1 = 6538, L: MK1 -APBRANCH2 = 657B, L: MK1 -APBRANCH3 = 6567, L: MK1 -APBRANCH4 = 655E, L: MK1 -APGET4BITS = 6550, L: MK1 -APLOOP = 653D, L: MK1 -APLOOP0 = 653A, L: MK1 -APSKIP2 = 659A, L: MK1 -APSKIP3 = 65A3, L: MK1 -APWRITEBYTE = 655A, L: MK1 -AP_FINISHUP = 65A6, L: MK1 -AP_FINISHUP2 = 65A9, L: MK1 -AP_GETBIT = 65BC, L: MK1 -AP_GETGAMMA = 65C8, L: MK1 -AP_GETGAMMALOOP = 65CB, L: MK1 -AP_R0_GAMMA = 65B0, L: MK1 -ATMAXCOUNT = CB6A, L: SPGETKEY -BAL1 = 88DD, L: MK1 -BROKEN = C6CE, L: SPINTRECT -BUCLE = 8DBF, L: MK1 -BUCLE1 = 8DC2, L: MK1 -BUCLE2 = 8DCA, L: MK1 -CLEAR = D21C, L: SPUPDATENOW -CLEARB1 = 8DAA, L: MK1 -CLEARB2 = 8DAD, L: MK1 -COLOURSPRITE = D21A, L: SPUPDATENOW -COMPUTEDISP = C810, L: SPMOVESPRABS -CONT = CAE3, L: SPCREATESPR -CONT1 = CCAA, L: SPINITIALIZE -COPYBUFFER = D227, L: SPUPDATENOW -COUNT = CB24, L: SPGETKEY -CSENTER = CACC, L: SPCREATESPR -CSFAIL1 = CB01, L: SPCREATESPR -CSFAIL2 = CB03, L: SPCREATESPR -CSLOOP = CAB8, L: SPCREATESPR -CSNOCRY = CAF7, L: SPCREATESPR -DEPACK = 6535, L: MK1 -DIRTYAREA = D047, L: SPUPDATENOW -DIRTYLOOP = D021, L: SPUPDATENOW -DONE = CFDC, L: SPREGISTERHOOKLAST -DOSPRITE = D109, L: SPUPDATENOW -DOSPRITES = D014, L: SPUPDATENOW -DRAWCHAR = D0B7, L: SPUPDATENOW -ENTRY = B8E2, L: L_DIV_U -ENTRYLP = CC86, L: SPINITIALIZE -FSCLIPSTRUCT = 5DD8, L: MK1 -GENERICISR = CA16, L: SPCREATEGENERICISR -HIDE_SPRITES_BULLETS_LOOP = 892E, L: MK1 -HIDE_SPRITES_ENEMS_LOOP = 8903, L: MK1 -IB1 = C998, L: SPADDMEMORY -IB2 = C99F, L: SPADDMEMORY -INVALIDATE = C801, L: SPMOVESPRABS -INVCOLLP = C5B9, L: SPINVALIDATE -INVFULLCHAR = C5CC, L: SPINVALIDATE -INVROWLP = C5CE, L: SPINVALIDATE -I_1 = B2C5, L: MK1 -I_100 = 9010, L: MK1 -I_101 = 903E, L: MK1 -I_102 = 903E, L: MK1 -I_103 = 908C, L: MK1 -I_104 = 90F4, L: MK1 -I_107 = 92AF, L: MK1 -I_108 = 92B7, L: MK1 -I_109 = 92B8, L: MK1 -I_110 = 92C0, L: MK1 -I_111 = 92C9, L: MK1 -I_112 = 92D3, L: MK1 -I_113 = 92C0, L: MK1 -I_114 = 92C9, L: MK1 -I_115 = 9304, L: MK1 -I_116 = 938F, L: MK1 -I_117 = 930E, L: MK1 -I_118 = 9417, L: MK1 -I_119 = 9466, L: MK1 -I_120 = 9463, L: MK1 -I_121 = 9430, L: MK1 -I_121_UGE = 9427, L: MK1 -I_122_I_121 = 9433, L: MK1 -I_123 = 94BD, L: MK1 -I_124 = 94C2, L: MK1 -I_125 = 9523, L: MK1 -I_126 = 953C, L: MK1 -I_127 = 962A, L: MK1 -I_128 = 9638, L: MK1 -I_129 = 964B, L: MK1 -I_130 = 96CC, L: MK1 -I_131 = 96CC, L: MK1 -I_132 = 96A5, L: MK1 -I_134 = 9764, L: MK1 -I_135 = 9764, L: MK1 -I_136 = 9739, L: MK1 -I_137 = 972F, L: MK1 -I_138 = 972A, L: MK1 -I_140 = 9732, L: MK1 -I_141 = 973C, L: MK1 -I_142 = 978A, L: MK1 -I_143 = 9781, L: MK1 -I_144 = 9784, L: MK1 -I_145 = 97EE, L: MK1 -I_147 = 9809, L: MK1 -I_148 = 980C, L: MK1 -I_149 = 982F, L: MK1 -I_150 = 9837, L: MK1 -I_151 = 98B7, L: MK1 -I_152 = 9870, L: MK1 -I_153 = 986D, L: MK1 -I_154 = 985D, L: MK1 -I_156 = 98B4, L: MK1 -I_157 = 989E, L: MK1 -I_158 = 98B4, L: MK1 -I_159 = 98BE, L: MK1 -I_160 = 9944, L: MK1 -I_161 = 98EF, L: MK1 -I_162 = 98F2, L: MK1 -I_163 = 991C, L: MK1 -I_164 = 9919, L: MK1 -I_165 = 993D, L: MK1 -I_166 = 993D, L: MK1 -I_167 = 993D, L: MK1 -I_168 = 9969, L: MK1 -I_169 = 9969, L: MK1 -I_170 = 9990, L: MK1 -I_171 = 9990, L: MK1 -I_172 = 99AE, L: MK1 -I_173 = 99C1, L: MK1 -I_174 = 9A73, L: MK1 -I_175 = 9A55, L: MK1 -I_176 = 9A24, L: MK1 -I_178 = 9A73, L: MK1 -I_179 = 9A6A, L: MK1 -I_180 = 9A6D, L: MK1 -I_181 = 9AF6, L: MK1 -I_182 = 9AD8, L: MK1 -I_183 = 9AA8, L: MK1 -I_185 = 9AF6, L: MK1 -I_186 = 9AED, L: MK1 -I_187 = 9AF0, L: MK1 -I_188 = 9B4B, L: MK1 -I_189 = 9B6E, L: MK1 -I_190 = 9B61, L: MK1 -I_191_I_190 = 9B64, L: MK1 -I_192 = 9B7D, L: MK1 -I_193 = 9BA4, L: MK1 -I_194 = 9BC3, L: MK1 -I_195 = 9BC3, L: MK1 -I_196 = 9BD8, L: MK1 -I_197 = 9BD8, L: MK1 -I_198 = 9C09, L: MK1 -I_199 = 9BED, L: MK1 -I_200_I_199 = 9BF0, L: MK1 -I_201 = 9C61, L: MK1 -I_202 = 9C2C, L: MK1 -I_203 = 9C48, L: MK1 -I_204 = 9C85, L: MK1 -I_205 = 9C88, L: MK1 -I_206 = 9D5B, L: MK1 -I_207 = 9F21, L: MK1 -I_208 = 9D65, L: MK1 -I_210 = 9F00, L: MK1 -I_211 = 9DF5, L: MK1 -I_212 = 9E12, L: MK1 -I_213 = 9E12, L: MK1 -I_214 = 9E12, L: MK1 -I_215 = 9E12, L: MK1 -I_216 = 9E3C, L: MK1 -I_217 = 9EEC, L: MK1 -I_218 = 9F47, L: MK1 -I_219 = 9F71, L: MK1 -I_22 = 84FB, L: MK1 -I_220 = A697, L: MK1 -I_221 = 9F76, L: MK1 -I_222 = A036, L: MK1 -I_223 = A036, L: MK1 -I_224 = A066, L: MK1 -I_225 = A069, L: MK1 -I_227 = A327, L: MK1 -I_228 = A075, L: MK1 -I_229 = A092, L: MK1 -I_23 = 84F7, L: MK1 -I_230 = A092, L: MK1 -I_231 = A092, L: MK1 -I_232 = A092, L: MK1 -I_233 = A0DA, L: MK1 -I_235 = A294, L: MK1 -I_236 = A154, L: MK1 -I_237 = A167, L: MK1 -I_238 = A17F, L: MK1 -I_238_ULE = A171, L: MK1 -I_239 = A182, L: MK1 -I_240 = A1A7, L: MK1 -I_241 = A235, L: MK1 -I_242 = A238, L: MK1 -I_243 = A294, L: MK1 -I_243_ULE = A286, L: MK1 -I_244 = A2F3, L: MK1 -I_245 = A2E2, L: MK1 -I_246_I_245 = A2E5, L: MK1 -I_247 = A660, L: MK1 -I_248 = A378, L: MK1 -I_249 = A4C0, L: MK1 -I_25 = 85D6, L: MK1 -I_250 = A4BD, L: MK1 -I_251 = A3F4, L: MK1 -I_252 = A3F4, L: MK1 -I_253 = A3C3, L: MK1 -I_254_I_253 = A3C6, L: MK1 -I_255 = A4BD, L: MK1 -I_256 = A42E, L: MK1 -I_256_I_257 = A435, L: MK1 -I_257 = A430, L: MK1 -I_258 = A487, L: MK1 -I_259 = A47D, L: MK1 -I_26 = 85CC, L: MK1 -I_260 = A480, L: MK1 -I_261 = A48A, L: MK1 -I_262 = A4FB, L: MK1 -I_263 = A4FB, L: MK1 -I_264 = A4EC, L: MK1 -I_265_I_264 = A4EF, L: MK1 -I_266 = A4FB, L: MK1 -I_267 = A505, L: MK1 -I_268 = A660, L: MK1 -I_269 = A50A, L: MK1 -I_26_UGE = 85BF, L: MK1 -I_27 = 85CF, L: MK1 -I_270 = A65D, L: MK1 -I_271 = A65D, L: MK1 -I_272 = A59B, L: MK1 -I_273_I_272 = A59E, L: MK1 -I_274 = A5DB, L: MK1 -I_275 = A627, L: MK1 -I_276 = A657, L: MK1 -I_277 = A6B2, L: MK1 -I_278 = A83A, L: MK1 -I_28 = 85D9, L: MK1 -I_280 = A7EB, L: MK1 -I_281 = A6E4, L: MK1 -I_282 = A6F7, L: MK1 -I_283 = A78F, L: MK1 -I_284 = A792, L: MK1 -I_285 = A7AD, L: MK1 -I_286 = A7B6, L: MK1 -I_287 = A7DE, L: MK1 -I_288 = A7E5, L: MK1 -I_289 = A83A, L: MK1 -I_29 = 861C, L: MK1 -I_290 = A8C2, L: MK1 -I_291 = A8CC, L: MK1 -I_292 = A896, L: MK1 -I_293 = A8C2, L: MK1 -I_294 = A90B, L: MK1 -I_295 = A998, L: MK1 -I_296 = A910, L: MK1 -I_297 = A9A2, L: MK1 -I_298 = A9F1, L: MK1 -I_299 = A9A7, L: MK1 -I_30 = 8638, L: MK1 -I_300 = A9FE, L: MK1 -I_301 = AA40, L: MK1 -I_302 = AA08, L: MK1 -I_303 = AA73, L: MK1 -I_304 = AAAA, L: MK1 -I_305 = AAA7, L: MK1 -I_306 = AA98, L: MK1 -I_308 = AAAD, L: MK1 -I_309 = B2C4, L: MK1 -I_310 = AAEC, L: MK1 -I_311 = AAEF, L: MK1 -I_312 = AB0C, L: MK1 -I_313 = AB0F, L: MK1 -I_314 = AB32, L: MK1 -I_315 = AB73, L: MK1 -I_317 = AB70, L: MK1 -I_318 = AB4F, L: MK1 -I_319 = AB5D, L: MK1 -I_32 = 8967, L: MK1 -I_320 = AB67, L: MK1 -I_321 = AB8B, L: MK1 -I_322 = B2BE, L: MK1 -I_323 = ABA7, L: MK1 -I_324 = ABBE, L: MK1 -I_325 = ABBE, L: MK1 -I_326 = ABDE, L: MK1 -I_327 = ABE1, L: MK1 -I_328 = AC65, L: MK1 -I_329 = AC2F, L: MK1 -I_33 = 8977, L: MK1 -I_330 = AC65, L: MK1 -I_331 = AC39, L: MK1 -I_332 = AC83, L: MK1 -I_333 = ACD6, L: MK1 -I_334 = AC8D, L: MK1 -I_335 = ACA2, L: MK1 -I_336 = ACD3, L: MK1 -I_337 = ACAC, L: MK1 -I_338 = AD3A, L: MK1 -I_339 = AD7F, L: MK1 -I_34 = 89C2, L: MK1 -I_340 = AD4C, L: MK1 -I_341 = AD7F, L: MK1 -I_342 = AD5E, L: MK1 -I_343 = AD7F, L: MK1 -I_344 = AD70, L: MK1 -I_345 = AD7F, L: MK1 -I_346 = AD7F, L: MK1 -I_347 = ADDB, L: MK1 -I_348 = B260, L: MK1 -I_349 = ADF8, L: MK1 -I_35 = 89E9, L: MK1 -I_350 = AE3E, L: MK1 -I_351 = AE32, L: MK1 -I_352 = AE73, L: MK1 -I_353 = AE73, L: MK1 -I_354 = AE73, L: MK1 -I_355 = AEA3, L: MK1 -I_356 = AED3, L: MK1 -I_357 = AF02, L: MK1 -I_358 = B07B, L: MK1 -I_359 = AF20, L: MK1 -I_36 = 89CC, L: MK1 -I_360 = AF48, L: MK1 -I_361 = AF25, L: MK1 -I_362 = AFA4, L: MK1 -I_363 = AF66, L: MK1 -I_365 = AFC1, L: MK1 -I_366 = AFD1, L: MK1 -I_367 = B078, L: MK1 -I_368 = AFD6, L: MK1 -I_369 = B053, L: MK1 -I_37 = 8A0C, L: MK1 -I_370 = B075, L: MK1 -I_371 = B096, L: MK1 -I_372 = B096, L: MK1 -I_373 = B0CC, L: MK1 -I_374 = B0B8, L: MK1 -I_375 = B0C6, L: MK1 -I_376 = B0E0, L: MK1 -I_377 = B124, L: MK1 -I_378 = B102, L: MK1 -I_379_I_378 = B105, L: MK1 -I_38 = 8AED, L: MK1 -I_380 = B16E, L: MK1 -I_381 = B14B, L: MK1 -I_382_I_381 = B14E, L: MK1 -I_383 = B1BD, L: MK1 -I_384 = B190, L: MK1 -I_385_I_384 = B193, L: MK1 -I_386 = B222, L: MK1 -I_387 = B1E4, L: MK1 -I_388_I_387 = B1E7, L: MK1 -I_389 = B222, L: MK1 -I_39 = 8A2E, L: MK1 -I_390 = B247, L: MK1 -I_391 = B23B, L: MK1 -I_393 = B25D, L: MK1 -I_394 = B256, L: MK1 -I_396 = B29F, L: MK1 -I_397 = B287, L: MK1 -I_398 = B29C, L: MK1 -I_399 = B2B8, L: MK1 -I_40 = 8A38, L: MK1 -I_400 = B2AF, L: MK1 -I_401 = B2B2, L: MK1 -I_41 = 8A25, L: MK1 -I_42 = 8A7C, L: MK1 -I_43 = 8A4D, L: MK1 -I_44_I_43 = 8A50, L: MK1 -I_45 = 8A69, L: MK1 -I_46 = 8A6C, L: MK1 -I_47 = 8AA5, L: MK1 -I_48 = 8A8B, L: MK1 -I_49 = 8AA5, L: MK1 -I_50 = 8AA5, L: MK1 -I_51 = 8AE1, L: MK1 -I_52 = 8AC3, L: MK1 -I_52_UGE = 8AAF, L: MK1 -I_52_ULE = 8AB9, L: MK1 -I_53_I_52 = 8AC6, L: MK1 -I_54 = 8B00, L: MK1 -I_55 = 8B79, L: MK1 -I_56 = 8B0A, L: MK1 -I_57 = 8B24, L: MK1 -I_58 = 8B63, L: MK1 -I_59 = 8B2E, L: MK1 -I_60 = 8B60, L: MK1 -I_61 = 8B76, L: MK1 -I_62 = 8B8E, L: MK1 -I_63 = 8C08, L: MK1 -I_64 = 8BC9, L: MK1 -I_65 = 8BE9, L: MK1 -I_66 = 8C05, L: MK1 -I_67 = 8C13, L: MK1 -I_68 = 8C24, L: MK1 -I_69 = 8C27, L: MK1 -I_70 = 8C45, L: MK1 -I_71 = 8CA3, L: MK1 -I_72 = 8C4A, L: MK1 -I_73 = 8D02, L: MK1 -I_74 = 8D05, L: MK1 -I_75 = 8D9F, L: MK1 -I_76 = 8DA4, L: MK1 -I_77 = 8DE0, L: MK1 -I_78 = 8E03, L: MK1 -I_79 = 8E3D, L: MK1 -I_80 = 8F8B, L: MK1 -I_81 = 8E47, L: MK1 -I_82 = 8F88, L: MK1 -I_83 = 8E84, L: MK1 -I_84 = 8ECD, L: MK1 -I_85 = 8EB3, L: MK1 -I_86 = 8ECD, L: MK1 -I_87 = 8F62, L: MK1 -I_88 = 8F19, L: MK1 -I_89 = 8F0F, L: MK1 -I_90 = 8F12, L: MK1 -I_91 = 8F1C, L: MK1 -I_92 = 8F45, L: MK1 -I_93 = 8F5F, L: MK1 -I_94 = 8F7C, L: MK1 -I_95 = 8F96, L: MK1 -I_96 = 9092, L: MK1 -I_97 = 8F9B, L: MK1 -I_98 = 908F, L: MK1 -I_99 = 9010, L: MK1 -JKLOOP = CF2A, L: SPJOYKEYBOARD -JPHL = CB0C, L: SPCREATESPR -JPHL = CA31, L: SPCREATEGENERICISR -JPHL = C976, L: SPDELETESPR -JPHL = C95C, L: SPADDCOLSPR -KEMPTBL = CEEF, L: SPJOYKEMPSTON -KEYOK = CB1E, L: SP_GETKEY -KEYROWLOOP = CB44, L: SPGETKEY -LOADNOROTATE = D310, L: SPUPDATENOW -LOADTYPE = D2A2, L: SPUPDATENOW -LOOP = CFD1, L: SPREGISTERHOOKLAST -LOOP = CCA2, L: SPINITIALIZE -LOOP = C961, L: SPDELETESPR -L_AND = B8BC, G: L_AND -L_ASL = B8C3, G: L_ASL -L_ASL1 = B8C4, L: L_ASL -L_ASR = B8CA, G: L_ASR -L_ASR1 = B8CB, L: L_ASR -L_ASR_U = B8D4, G: L_ASR_U -L_ASR_U_1 = B8D5, L: L_ASR_U -L_DIV1 = B8E9, L: L_DIV_U -L_DIV2 = B8F3, L: L_DIV_U -L_DIV_U = B8DE, G: L_DIV_U -L_EQ = B8FD, G: L_EQ -L_GCHAR = B904, G: L_GCHAR -L_GINT = B90A, G: L_GINT -L_GINTSPSP = B90F, G: L_GINTSPSP -L_GT = B918, G: L_GT -L_LNEG = B924, G: L_LNEG -L_LT = B929, G: L_LT -L_MULT = B935, G: L_MULT -L_MULT1 = B93C, L: L_MULT -L_MULT2 = B943, L: L_MULT -L_NE = B946, G: L_NE -L_NEG = B94D, G: L_NEG -L_OR = B955, G: L_OR -L_PINT = B95C, G: L_PINT -L_SXT = B962, G: L_SXT -L_SXT = B905, L: L_GCHAR -L_UGE = B967, G: L_UGE -L_UGT = B96F, G: L_UGT -L_ULE = B975, G: L_ULE -L_ULT = B97D, G: L_ULT -MASKNOROTATE = D257, L: SPUPDATENOW -MVCOLLOOP = C73D, L: SPMOVESPRABS -MVROWLOOP = C743, L: SPMOVESPRABS -NEXTRAND = 8D81, L: MK1 -NEXTSCANROW = CB59, L: SPGETKEY -NOADD = CCB4, L: SPINITIALIZE -NOCAPS = CF8B, L: SPKEYPRESSED -NOCAPS = CB97, L: SPGETKEY -NODEC1 = C7CD, L: SPMOVESPRABS -NOFIRE = CF2A, L: SPJOYKEYBOARD -NOINC = CFFC, L: SPTILEENTRY -NOINC = C898, L: SPTBLLOOKUP -NOINC1 = D039, L: SPUPDATENOW -NOINC1 = C90D, L: SPADDCOLSPR -NOINC1 = C765, L: SPMOVESPRABS -NOINC1 = C5B5, L: SPINVALIDATE -NOINC10 = D0F0, L: SPUPDATENOW -NOINC11 = D093, L: SPUPDATENOW -NOINC2 = C79E, L: SPMOVESPRABS -NOINC2 = C5C8, L: SPINVALIDATE -NOINC3 = C7BF, L: SPMOVESPRABS -NOINC3 = C5D9, L: SPINVALIDATE -NOINC4 = C7D9, L: SPMOVESPRABS -NOINC5 = C83F, L: SPMOVESPRABS -NOKEYS = CBA5, L: SPGETKEY -NOMORESPRITES = D249, L: SPUPDATENOW -NONEXT1 = C779, L: SPMOVESPRABS -NONEXT2 = C7E6, L: SPMOVESPRABS -NOPRESS = CF35, L: SPJOYKEYBOARD -NOPRESS = CB54, L: SPGETKEY -NOSYM = CF97, L: SPKEYPRESSED -NOSYM = CBA2, L: SPGETKEY -NOTACROSSBLK1 = D031, L: SPUPDATENOW -NOTACROSSBLK2 = D081, L: SPUPDATENOW -NOTCOMPRESS = CADE, L: SPCREATESPR -NOTDISPLAYED = C7E6, L: SPMOVESPRABS -NOTDONE = C74D, L: SPMOVESPRABS -NOTINDLIST = C779, L: SPMOVESPRABS -NOTLOAD = D0E5, L: SPUPDATENOW -NOTNEGATIVE = C82E, L: SPMOVESPRABS -ORNOROTATE = D46D, L: SPUPDATENOW -ORTYPE = D3E7, L: SPUPDATENOW -PDLOOP = C796, L: SPMOVESPRABS -POPREG = CA44, L: SPCREATEGENERICISR -POSITION = CA19, L: SPCREATEGENERICISR -PRINT_STR_LOOP = 88B6, L: MK1 -PRINT_STR_NO_INC_A = 88CA, L: MK1 -PUSHREG = CA22, L: SPCREATEGENERICISR -PUTHERE = C7B0, L: SPMOVESPRABS -RAND16 = 8D65, L: MK1 -REENTER = D039, L: SPUPDATENOW -REPITATODO = 8DB9, L: MK1 -ROTLP = CC89, L: SPINITIALIZE -ROTTBLLP = CC7F, L: SPINITIALIZE -RUNHOOKS = CA32, L: SPCREATEGENERICISR -SCANLOOP = CB40, L: SPGETKEY -SETRAMBANK = 5DF9, L: MK1 -SINC1TBL = CF4F, L: SPJOYSINCLAIR1 -SKIP = CB81, L: SPGETKEY -SKIP1 = C84F, L: SPMOVESPRABS -SKIP2 = C85F, L: SPMOVESPRABS -SKIPUPDATECOL = D254, L: SPUPDATENOW -SKIP_SPRITE_UPDATE = D21B, L: SPUPDATENOW -SPADDCOLSPR = C8B5, G: SPADDCOLSPR -SPADDMEMORY = C990, G: SPADDMEMORY -SPALLOC = C9E1, G: SPBLOCKALLOC -SPBIT2MASK = C88A, G: SPBIT2MASK -SPBITLEFT2MASK = C5E7, G: SPBITLEFT2MASK -SPBITRIGHT2MASK = C5EF, G: SPBITRIGHT2MASK -SPBLOCKALLOC = C9D7, G: SPBLOCKALLOC -SPBORDER = C9FC, G: SPBORDER -SPBORDERCLR = C9FB, G: SPBORDER -SPCOMPDIRTYADDR = C5F7, G: SPCOMPDIRTYADDR -SPCOMPDLISTADDR = B983, G: SPCOMPDLISTADDR -SPCREATEGENERICISR = CA0D, G: SPCREATEGENERICISR -SPCREATESPR = CA6D, G: SPCREATESPR -SPDELETESPR = C95D, G: SPDELETESPR -SPDIRTYCHARS = C60C, G: SPDIRTYCHARS -SPDISPLAYLIST = B994, G: SPDISPLAYLIST -SPDSLOOP = C96E, G: SPDELETESPR -SPFB1 = C9B1, G: SPFREEBLOCK -SPFB2 = C9BC, G: SPFREEBLOCK -SPFREEBLOCK = C9AC, G: SPFREEBLOCK -SPGETKEY = CB39, G: SPGETKEY -SPINITIALIZE = CC59, G: SPINITIALIZE -SPINITIM2 = CEC7, G: SPINITIM2 -SPINKEY = CB28, G: SPGETKEY -SPINTRECT = C66C, G: SPINTRECT -SPINTSMALLIVAL = C69D, G: SPINTRECT -SPINVALIDATE = C594, G: SPINVALIDATE -SPINVALIDATEP = C59C, G: SPINVALIDATE -SPJOYKEMPSTON = CEE4, G: SPJOYKEMPSTON -SPJOYKEYBOARD = CF1D, G: SPJOYKEYBOARD -SPJOYSINCLAIR1 = CF43, G: SPJOYSINCLAIR1 -SPKEYDEBOUNCE = CB25, G: SPGETKEY -SPKEYPRESSED = CF7F, G: SPKEYPRESSED -SPKEYREPEATPERIOD = CB27, G: SPGETKEY -SPKEYSTARTREPEAT = CB26, G: SPGETKEY -SPKEYTRANSTBL = CBAD, G: SPKEYTRANSTBL -SPMOVESPRABS = C6D7, G: SPMOVESPRABS -SPMOVESPRABSC = C6FE, G: SPMOVESPRABS -SPMOVESPRABSNC = C6E5, G: SPMOVESPRABS -SPNULLSPRPTR = C862, G: SPNULLSPRPTR -SPPRINTATINV = C872, G: SPPRINTATINV -SPPTINSMALLIVAL = C6C2, G: SPINTRECT -SPQUEUETABLE = C9C7, G: SPQUEUETABLE -SPREGISTERHOOK = CFC8, G: SPREGISTERHOOKLAST -SPREGISTERHOOKLAST = CFC8, G: SPREGISTERHOOKLAST -SPRITELOOP = D105, L: SPUPDATENOW -SPTBLLOOKUP = C892, G: SPTBLLOOKUP -SPTILEARRAY = CCBC, G: SPTILEARRAY -SPTILEENTRY = CFF3, G: SPTILEENTRY -SPUPDATENOW = D015, G: SPUPDATENOW -SPWAITFORNOKEY = D4AC, G: SPWAITFORNOKEY -SP_ADDCOLSPR = C89A, G: SP_ADDCOLSPR -SP_ADDMEMORY = C977, G: SP_ADDMEMORY -SP_BLOCKALLOC = C9C9, G: SP_BLOCKALLOC -SP_BORDER = C9F2, G: SP_BORDER -SP_CREATEGENERICISR = CA04, G: SP_CREATEGENERICISR -SP_CREATESPR = CA55, G: SP_CREATESPR -SP_FREEBLOCK = CB0D, G: SP_FREEBLOCK -SP_GETKEY = CB18, G: SP_GETKEY -SP_INITIALIZE = CC4D, G: SP_INITIALIZE -SP_INITIM2 = CEBC, G: SP_INITIM2 -SP_JOYKEMPSTON = CEDD, G: SP_JOYKEMPSTON -SP_JOYKEYBOARD = CF0F, G: SP_JOYKEYBOARD -SP_JOYSINCLAIR1 = CF3C, G: SP_JOYSINCLAIR1 -SP_KEYPRESSED = CF6F, G: SP_KEYPRESSED -SP_REGISTERHOOK = CFA3, G: SP_REGISTERHOOK -SP_REGISTERHOOKLAST = CFB9, G: SP_REGISTERHOOKLAST -SP_TILEARRAY = CFE5, G: SP_TILEARRAY -SP_UPDATENOW = D004, G: SP_UPDATENOW -SP_UPDATENOWEX = D49F, G: SP_UPDATENOWEX -SP_WAITFORNOKEY = D4A8, G: SP_WAITFORNOKEY -START = 5DC0, L: ZX82_CRT0 -STATE = CB23, L: SPGETKEY -TEMPCOLOUR = D012, L: SPUPDATENOW -TEMPGRAPHIC = D00A, L: SPUPDATENOW -TILEONLY = D088, L: SPUPDATENOW -TOOMANYKEYS = CBA5, L: SPGETKEY -TRYOTHERWAY = C6B1, L: SPINTRECT -UPDATE_ATTRS = D013, G: SPUPDATENOW -USERTILE = CCB7, L: SPINITIALIZE -VPCLIPSTRUCT = 5DD4, L: MK1 -XINSCREEN = C726, L: SPMOVESPRABS -XORNOROTATE = D3B5, L: SPUPDATENOW -XORTYPE = D32F, L: SPUPDATENOW -YINSCREEN = C716, L: SPMOVESPRABS -_A1 = B456, G: MK1 -_A2 = B458, G: MK1 -_A3 = B45F, G: MK1 -_ABS = 8D8E, G: MK1 -_ACTIVE = B454, G: MK1 -_ADDSIGN = 929E, G: MK1 -_ADVANCE_WORM_NO_INC_Y = 9389, L: MK1 -_AD_FREE = B509, G: MK1 -_ASM_INT = B8A3, G: MK1 -_ASM_INT_2 = B4C9, G: MK1 -_ASM_NUMBER = B4DB, G: MK1 -_AT1 = B4E5, G: MK1 -_AT2 = B4E6, G: MK1 -_ATTR = 84D7, G: MK1 -_ATTR_DO = 8565, L: MK1 -_ATTR_MK2 = 8553, G: MK1 -_ATTR_RESET = 8561, L: MK1 -_BEHS = 79D2, G: MK1 -_BLACKOUT = 6628, G: MK1 -_BLACKOUT_AREA = 88D8, G: MK1 -_BLX = B4F2, G: MK1 -_BLY = B4F3, G: MK1 -_BULLETS_ESTADO = B475, G: MK1 -_BULLETS_FIRE = 8E33, G: MK1 -_BULLETS_INIT = 8DD9, G: MK1 -_BULLETS_MOVE = 8F8C, G: MK1 -_BULLETS_MX = B38B, G: MK1 -_BULLETS_MY = B38F, G: MK1 -_BULLETS_UPDATE = 8E04, G: MK1 -_BULLETS_X = B49D, G: MK1 -_BULLETS_Y = B4A1, G: MK1 -_B_IT = B499, G: MK1 -_C1 = B45B, G: MK1 -_C2 = B45C, G: MK1 -_C3 = B45D, G: MK1 -_C4 = B45E, G: MK1 -_CHECK_PASSWORD = 8978, G: MK1 -_CLEAR_SPRITES = 88EE, G: MK1 -_CM_TWO_POINTS = 8D08, G: MK1 -_CM_TWO_POINTS_AT1_DO = 8D19, L: MK1 -_CM_TWO_POINTS_AT1_DONE = 8D33, L: MK1 -_CM_TWO_POINTS_AT1_RESET = 8D16, L: MK1 -_CM_TWO_POINTS_AT2_DO = 8D47, L: MK1 -_CM_TWO_POINTS_AT2_DONE = 8D61, L: MK1 -_CM_TWO_POINTS_AT2_RESET = 8D44, L: MK1 -_COLLIDE = 8CA7, G: MK1 -_CORTINA = 8DA5, G: MK1 -_CORTINA2 = 8959, G: MK1 -_CX1 = B4EA, G: MK1 -_CX2 = B4EB, G: MK1 -_CY1 = B4EC, G: MK1 -_CY2 = B4ED, G: MK1 -_DAFUQ = 8BE9, L: MK1 -_DCT_1_INCREMENT = 86D9, L: MK1 -_DCT_1_NO_SHADOW = 86CC, L: MK1 -_DCT_1_SET_YY = 8652, L: MK1 -_DCT_1_SHADOW = 86BD, L: MK1 -_DCT_2_INCREMENT = 8711, L: MK1 -_DCT_2_NO_SHADOW = 8704, L: MK1 -_DCT_2_SET_YY = 8675, L: MK1 -_DCT_2_SHADOW = 86F5, L: MK1 -_DCT_3_INCREMENT = 8749, L: MK1 -_DCT_3_NO_SHADOW = 873C, L: MK1 -_DCT_3_SHADOW = 872D, L: MK1 -_DCT_A1_SET = 8665, L: MK1 -_DCT_A2_SET = 8688, L: MK1 -_DCT_A3_SET = 86A8, L: MK1 -_DISTANCE = 9470, G: MK1 -_DO_CUTSCENE = 8C14, G: MK1 -_DRAW_COLOURED_TILE = 8584, G: MK1 -_DRAW_COLOURED_TILE_GAMEAREA = 87D0, G: MK1 -_DRAW_DECORATIONS = 87FE, G: MK1 -_DRAW_DECORATIONS_LOOP = 8801, L: MK1 -_DRAW_INVALIDATE_COLOURED_TILE_G= 87C9, G: MK1 -_DRAW_OBJS = 88B2, G: MK1 -_DRAW_SCR = 9390, G: MK1 -_DRAW_SCR_BACKGROUND = 92D4, G: MK1 -_DRAW_SCR_PACKED_ALT = 935A, L: MK1 -_DRAW_SCR_PACKED_ALT_SUBST = 9369, L: MK1 -_DRAW_SCR_PACKED_DONE = 933E, L: MK1 -_DRAW_SCR_PACKED_EXISTING = 9339, L: MK1 -_DRAW_SCR_PACKED_NEW = 9324, L: MK1 -_DRAW_SCR_PACKED_NOALT = 936E, L: MK1 -_ENEMS_DRAW_CURRENT = 9CB0, G: MK1 -_ENEMS_KILL = 9F22, G: MK1 -_ENEMS_LM_CHANGE_AXIS_X = A0AF, L: MK1 -_ENEMS_LM_CHANGE_AXIS_X_DONE = A0B7, L: MK1 -_ENEMS_LM_CHANGE_AXIS_Y = A0CF, L: MK1 -_ENEMS_LM_CHANGE_AXIS_Y_DONE = A0D7, L: MK1 -_ENEMS_LOAD = 9D42, G: MK1 -_ENEMS_MOVE = 9F52, G: MK1 -_ENEMS_MOVE_UPDATE_FRAME_DONE = A378, L: MK1 -_ENEM_CELLS = 9109, G: MK1 -_ENIT = B4AE, G: MK1 -_ENOFFS = B498, G: MK1 -_ENOFFSMASI = B89C, G: MK1 -_EN_AN_BASE_FRAME = B393, G: MK1 -_EN_AN_COUNT = B8B4, G: MK1 -_EN_AN_CURRENT_FRAME = B485, G: MK1 -_EN_AN_FRAME = B8AD, G: MK1 -_EN_AN_NEXT_FRAME = B4DF, G: MK1 -_EN_AN_STATE = B3A0, G: MK1 -_EN_AN_VX = B4B4, G: MK1 -_EN_AN_VY = B4BB, G: MK1 -_EN_AN_X = B4F6, G: MK1 -_EN_AN_Y = B4FC, G: MK1 -_ESPERA_ACTIVA = 92B8, G: MK1 -_FLAGS = B3A3, G: MK1 -_FONT = 6636, G: MK1 -_GAME_ENDING = 9119, G: MK1 -_GAME_OVER = 9147, G: MK1 -_GEN_PT = B47D, G: MK1 -_GEN_PT_ALT = B3B8, G: MK1 -_GETXMORE = 5DF6, G: MK1 -_GET_RESOURCE = 65D8, G: MK1 -_GPAUX = B3BD, G: MK1 -_GPC = B4F4, G: MK1 -_GPCX = B4B2, G: MK1 -_GPCY = B4B3, G: MK1 -_GPD = B4F5, G: MK1 -_GPEN_CX = B385, G: MK1 -_GPEN_CY = B386, G: MK1 -_GPEN_X = B4A6, G: MK1 -_GPEN_Y = B4A7, G: MK1 -_GPIT = B4C1, G: MK1 -_GPJT = B4C2, G: MK1 -_GPOX = B4C4, G: MK1 -_GPT = B503, G: MK1 -_GPX = B88F, G: MK1 -_GPXX = B4CF, G: MK1 -_GPY = B890, G: MK1 -_GPYY = B4D0, G: MK1 -_HALF_LIFE = B39A, G: MK1 -_HALTS_DELAY = 8967, G: MK1 -_HIT = B502, G: MK1 -_HIT_H = B3B7, G: MK1 -_HIT_V = B3BB, G: MK1 -_HOTSPOTS = 7987, G: MK1 -_HOTSPOTS_DO = A698, G: MK1 -_HOTSPOTS_SETUP_DO = 93CF, L: MK1 -_HOTSPOTS_SETUP_DONE = 9409, L: MK1 -_HOTSPOTS_SETUP_SET = 9401, L: MK1 -_HOTSPOTS_SETUP_SET_REFILL = 9400, L: MK1 -_HOTSPOT_DESTROY = B462, G: MK1 -_HOTSPOT_X = B398, G: MK1 -_HOTSPOT_Y = B399, G: MK1 -_INTROX = B4EF, G: MK1 -_INTROY = B4F0, G: MK1 -_INTRO_ITERATOR = B39F, G: MK1 -_INTRO_TEXTS = 6404, G: MK1 -_INTRO_TEXT_0 = 5E5F, L: MK1 -_INTRO_TEXT_1 = 5EC7, L: MK1 -_INTRO_TEXT_2 = 5F2D, L: MK1 -_INTRO_TEXT_3 = 5F8C, L: MK1 -_INTRO_TEXT_4 = 5FE0, L: MK1 -_INTRO_TEXT_5 = 6045, L: MK1 -_INTRO_TEXT_6 = 60B1, L: MK1 -_INTRO_TEXT_7 = 6120, L: MK1 -_INTRO_TEXT_8 = 618A, L: MK1 -_INTRO_TEXT_9 = 61FC, L: MK1 -_INTRO_TEXT_A = 6264, L: MK1 -_INTRO_TEXT_B = 62BC, L: MK1 -_INTRO_TEXT_C = 6328, L: MK1 -_INTRO_TEXT_D = 6398, L: MK1 -_INVALIDATE_TILE = 87A5, G: MK1 -_INVALIDATE_VIEWPORT = 87B9, G: MK1 -_ISJOY = B3B5, G: MK1 -_ISR = 847E, G: MK1 -_IS_RENDERING = B8A1, G: MK1 -_ITJ = B893, G: MK1 -_JOYFUNC = 5DDC, G: MK1 -_JOYFUNCS = 5DDE, G: MK1 -_KEYS = 5DC6, G: MK1 -_KEYS_OLD = B895, G: MK1 -_KEY_FIRE = 5DD2, G: MK1 -_KEY_JUMP = 5DD0, G: MK1 -_KILLED_OLD = B3BC, G: MK1 -_LANG = 5E44, G: MK1 -_LEVEL = B45A, G: MK1 -_LEVELNUMBERS = 6427, G: MK1 -_LEVELS = 8472, G: MK1 -_LEVEL_DATA = 6836, G: MK1 -_LEVEL_STR = 5DF4, G: MK1 -_LIFE_OLD = B473, G: MK1 -_LIMIT = 9507, G: MK1 -_MAIN = A83B, G: MK1 -_MAINCOUNTER = B4D6, G: MK1 -_MALOTES = 7699, G: MK1 -_MAPA = 6846, G: MK1 -_MAP_ATTR = B3BE, G: MK1 -_MAP_POINTER = B39D, G: MK1 -_MY_MALLOC = 5DE4, G: MK1 -_NOCAST = B4E8, G: MK1 -_N_PANT = B4AA, G: MK1 -_OBJS_OLD = B4D5, G: MK1 -_ORIG_TILE = B8AC, G: MK1 -_O_PANT = B4AC, G: MK1 -_PAD0 = B4A8, G: MK1 -_PASSWORD = 5E5D, G: MK1 -_PASSWORDS = 5E45, G: MK1 -_PAUSE_SCREEN = 91F4, G: MK1 -_PIC_RESOURCE = 6420, G: MK1 -_PLAYER_CALC_BOUNDING_BOX = 95A5, G: MK1 -_PLAYER_CELLS = 90F5, G: MK1 -_PLAYER_DEPLETE = 9C62, G: MK1 -_PLAYER_GRAVITY_ADD = 95F7, L: MK1 -_PLAYER_GRAVITY_DONE = 9603, L: MK1 -_PLAYER_GRAVITY_MAXIMUM = 95FD, L: MK1 -_PLAYER_GRAVITY_P_GOTTEN_DONE = 960D, L: MK1 -_PLAYER_GRAVITY_VY_SET = 9600, L: MK1 -_PLAYER_INIT = 9544, G: MK1 -_PLAYER_KILL = 9C8F, G: MK1 -_PLAYER_MOVE = 95E6, G: MK1 -_PLAYING = B4C3, G: MK1 -_POSSEE = B8AB, G: MK1 -_PREGOTTEN = B3B6, G: MK1 -_PREPARE_LEVEL = 9093, G: MK1 -_PRINT_NUMBER2 = 8863, G: MK1 -_PRINT_STR = 88B3, G: MK1 -_PTGMX = B481, G: MK1 -_PTGMY = B483, G: MK1 -_PTX1 = B4D7, G: MK1 -_PTX2 = B4D8, G: MK1 -_PTY1 = B4D9, G: MK1 -_PTY2 = B4DA, G: MK1 -_P_AMMO = B4A5, G: MK1 -_P_CONT_SALTO = B4AB, G: MK1 -_P_CT_ESTADO = B455, G: MK1 -_P_CURRENT_FRAME = B47F, G: MK1 -_P_DISPARANDO = B8B7, G: MK1 -_P_ESTADO = B49A, G: MK1 -_P_FACING = B3B3, G: MK1 -_P_FACING_H = B8A5, G: MK1 -_P_FACING_V = B8A9, G: MK1 -_P_FRAME = B3B4, G: MK1 -_P_FUEL = B4AF, G: MK1 -_P_GOTTEN = B4B1, G: MK1 -_P_KEYS = B4BA, G: MK1 -_P_KILLED = B49C, G: MK1 -_P_KILLME = B4A9, G: MK1 -_P_KILL_AMT = B3BA, G: MK1 -_P_LIFE = B4AD, G: MK1 -_P_NEXT_FRAME = B4DD, G: MK1 -_P_OBJS = B4B0, G: MK1 -_P_SALTANDO = B8AA, G: MK1 -_P_SUBFRAME = B4EE, G: MK1 -_P_TX = B4C7, G: MK1 -_P_TY = B4C8, G: MK1 -_P_VX = B4CB, G: MK1 -_P_VY = B4CD, G: MK1 -_P_X = B507, G: MK1 -_P_Y = B88D, G: MK1 -_QTILE = 8527, G: MK1 -_RAM_ADDRESS = B8BA, G: MK1 -_RAM_DESTINATION = B8B1, G: MK1 -_RAM_PAGE = B897, G: MK1 -_RAND = 8D65, G: MK1 -_RDA = B504, G: MK1 -_RDB = B505, G: MK1 -_RDC = B506, G: MK1 -_RDD = B891, G: MK1 -_RDN = B892, G: MK1 -_RDX = B898, G: MK1 -_RDY = B899, G: MK1 -_RESOURCES = 5E02, G: MK1 -_SEED = B4C5, G: MK1 -_SELECT_JOYFUNC = 9417, G: MK1 -_SETRAMBANK = 5DF9, G: MK1 -_SHOW_INTRO_TEXT = 8B7D, G: MK1 -_SLEVEL = B8A2, G: MK1 -_SONG_PLAYING = 5DF8, G: MK1 -_SPACER = 5DF1, G: MK1 -_SPLASH_SCREENS = 5E41, G: MK1 -_SPRITES = 7A02, G: MK1 -_SPRITE_10_A = 7F22, G: MK1 -_SPRITE_10_B = 7F52, G: MK1 -_SPRITE_10_C = 7F82, G: MK1 -_SPRITE_11_A = 7FB2, G: MK1 -_SPRITE_11_B = 7FE2, G: MK1 -_SPRITE_11_C = 8012, G: MK1 -_SPRITE_12_A = 8042, G: MK1 -_SPRITE_12_B = 8072, G: MK1 -_SPRITE_12_C = 80A2, G: MK1 -_SPRITE_13_A = 80D2, G: MK1 -_SPRITE_13_B = 8102, G: MK1 -_SPRITE_13_C = 8132, G: MK1 -_SPRITE_14_A = 8162, G: MK1 -_SPRITE_14_B = 8192, G: MK1 -_SPRITE_14_C = 81C2, G: MK1 -_SPRITE_15_A = 81F2, G: MK1 -_SPRITE_15_B = 8222, G: MK1 -_SPRITE_15_C = 8252, G: MK1 -_SPRITE_16_A = 8282, G: MK1 -_SPRITE_16_B = 82B2, G: MK1 -_SPRITE_16_C = 82E2, G: MK1 -_SPRITE_17_A = 8312, G: MK1 -_SPRITE_18_A = 83A2, G: MK1 -_SPRITE_18_B = 83D2, L: MK1 -_SPRITE_18_C = 8402, L: MK1 -_SPRITE_19_A = 8432, G: MK1 -_SPRITE_1_A = 7A12, G: MK1 -_SPRITE_1_B = 7A42, G: MK1 -_SPRITE_1_C = 7A72, G: MK1 -_SPRITE_2_A = 7AA2, G: MK1 -_SPRITE_2_B = 7AD2, G: MK1 -_SPRITE_2_C = 7B02, G: MK1 -_SPRITE_3_A = 7B32, G: MK1 -_SPRITE_3_B = 7B62, G: MK1 -_SPRITE_3_C = 7B92, G: MK1 -_SPRITE_4_A = 7BC2, G: MK1 -_SPRITE_4_B = 7BF2, G: MK1 -_SPRITE_4_C = 7C22, G: MK1 -_SPRITE_5_A = 7C52, G: MK1 -_SPRITE_5_B = 7C82, G: MK1 -_SPRITE_5_C = 7CB2, G: MK1 -_SPRITE_6_A = 7CE2, G: MK1 -_SPRITE_6_B = 7D12, G: MK1 -_SPRITE_6_C = 7D42, G: MK1 -_SPRITE_7_A = 7D72, G: MK1 -_SPRITE_7_B = 7DA2, G: MK1 -_SPRITE_7_C = 7DD2, G: MK1 -_SPRITE_8_A = 7E02, G: MK1 -_SPRITE_8_B = 7E32, G: MK1 -_SPRITE_8_C = 7E62, G: MK1 -_SPRITE_9_A = 7E92, G: MK1 -_SPRITE_9_B = 7EC2, G: MK1 -_SPRITE_9_C = 7EF2, G: MK1 -_SP_BULLETS = B48E, G: MK1 -_SP_MOVILES = B37F, G: MK1 -_SP_PLAYER = B48C, G: MK1 -_STEPBYSTEP = B896, G: MK1 -_SUCCESS = B8B0, G: MK1 -_T1 = B463, G: MK1 -_T2 = B464, G: MK1 -_T3 = B465, G: MK1 -_T4 = B466, G: MK1 -_TEXT_OFFS = B89E, G: MK1 -_TILESET = 6F99, G: MK1 -_TIMER_COUNT = B4E9, G: MK1 -_TIMER_FRAMES = B48B, G: MK1 -_TIMER_OLD = B47C, G: MK1 -_TIMER_ON = B4DC, G: MK1 -_TIMER_T = B89A, G: MK1 -_TIMER_ZERO = B8B3, G: MK1 -_TIME_OVER = 919B, G: MK1 -_TOCADO = B89F, G: MK1 -_T_ALT = B461, G: MK1 -_UPDATE_TILE = 8832, G: MK1 -_UTAUX = 8831, G: MK1 -_U_FREE = 5DEF, G: MK1 -_U_MALLOC = 5DED, G: MK1 -_WALL_H = B89B, G: MK1 -_WALL_V = B89D, G: MK1 -_WARP_TO_LEVEL = 5DF3, G: MK1 -_WYZ_INIT = 848C, G: MK1 -_WYZ_PLAY_MUSIC = 84AB, G: MK1 -_WYZ_PLAY_SOUND = 849A, G: MK1 -_WYZ_STOP_SOUND = 84C7, G: MK1 -_X0 = B467, G: MK1 -_X1 = B469, G: MK1 -_XX = B474, G: MK1 -_X_PANT = B8A0, G: MK1 -_Y0 = B468, G: MK1 -_Y1 = B46A, G: MK1 -_YY = B47B, G: MK1 -_Y_PANT = B8A6, G: MK1 -_ZONE_CLEAR = 9245, G: MK1 -__BADDIES_POINTER = B8A7, G: MK1 -__B_ESTADO = B49B, G: MK1 -__B_MX = B8B8, G: MK1 -__B_MY = B8B9, G: MK1 -__B_X = B496, G: MK1 -__B_Y = B497, G: MK1 -__EN_AN_VX = B46F, G: MK1 -__EN_AN_VY = B471, G: MK1 -__EN_AN_X = B4D1, G: MK1 -__EN_AN_Y = B4D3, G: MK1 -__EN_CX = B396, G: MK1 -__EN_CY = B397, G: MK1 -__EN_LIFE = B4E7, G: MK1 -__EN_MX = B39B, G: MK1 -__EN_MY = B39C, G: MK1 -__EN_T = B37C, G: MK1 -__EN_X = B37D, G: MK1 -__EN_X1 = B387, G: MK1 -__EN_X2 = B389, G: MK1 -__EN_Y = B37E, G: MK1 -__EN_Y1 = B388, G: MK1 -__EN_Y2 = B38A, G: MK1 -__GP_GEN = B479, G: MK1 -__N = B46B, G: MK1 -__T = B46C, G: MK1 -__TA = B4F1, G: MK1 -__X = B46D, G: MK1 -__Y = B46E, G: MK1 - - -START = 5DC0, L: ZX82_CRT0 -_KEYS = 5DC6, G: MK1 -_KEY_JUMP = 5DD0, G: MK1 -_KEY_FIRE = 5DD2, G: MK1 -VPCLIPSTRUCT = 5DD4, L: MK1 -FSCLIPSTRUCT = 5DD8, L: MK1 -_JOYFUNC = 5DDC, G: MK1 -_JOYFUNCS = 5DDE, G: MK1 -_MY_MALLOC = 5DE4, G: MK1 -_U_MALLOC = 5DED, G: MK1 -_U_FREE = 5DEF, G: MK1 -_SPACER = 5DF1, G: MK1 -_WARP_TO_LEVEL = 5DF3, G: MK1 -_LEVEL_STR = 5DF4, G: MK1 -_GETXMORE = 5DF6, G: MK1 -_SONG_PLAYING = 5DF8, G: MK1 -_SETRAMBANK = 5DF9, G: MK1 -SETRAMBANK = 5DF9, L: MK1 -_RESOURCES = 5E02, G: MK1 -_SPLASH_SCREENS = 5E41, G: MK1 -_LANG = 5E44, G: MK1 -_PASSWORDS = 5E45, G: MK1 -_PASSWORD = 5E5D, G: MK1 -_INTRO_TEXT_0 = 5E5F, L: MK1 -_INTRO_TEXT_1 = 5EC7, L: MK1 -_INTRO_TEXT_2 = 5F2D, L: MK1 -_INTRO_TEXT_3 = 5F8C, L: MK1 -_INTRO_TEXT_4 = 5FE0, L: MK1 -_INTRO_TEXT_5 = 6045, L: MK1 -_INTRO_TEXT_6 = 60B1, L: MK1 -_INTRO_TEXT_7 = 6120, L: MK1 -_INTRO_TEXT_8 = 618A, L: MK1 -_INTRO_TEXT_9 = 61FC, L: MK1 -_INTRO_TEXT_A = 6264, L: MK1 -_INTRO_TEXT_B = 62BC, L: MK1 -_INTRO_TEXT_C = 6328, L: MK1 -_INTRO_TEXT_D = 6398, L: MK1 -_INTRO_TEXTS = 6404, G: MK1 -_PIC_RESOURCE = 6420, G: MK1 -_LEVELNUMBERS = 6427, G: MK1 -DEPACK = 6535, L: MK1 -APBRANCH1 = 6538, L: MK1 -APLOOP0 = 653A, L: MK1 -APLOOP = 653D, L: MK1 -APGET4BITS = 6550, L: MK1 -APWRITEBYTE = 655A, L: MK1 -APBRANCH4 = 655E, L: MK1 -APBRANCH3 = 6567, L: MK1 -APBRANCH2 = 657B, L: MK1 -APSKIP2 = 659A, L: MK1 -APSKIP3 = 65A3, L: MK1 -AP_FINISHUP = 65A6, L: MK1 -AP_FINISHUP2 = 65A9, L: MK1 -AP_R0_GAMMA = 65B0, L: MK1 -AP_GETBIT = 65BC, L: MK1 -AP_GETGAMMA = 65C8, L: MK1 -AP_GETGAMMALOOP = 65CB, L: MK1 -_GET_RESOURCE = 65D8, G: MK1 -_BLACKOUT = 6628, G: MK1 -_FONT = 6636, G: MK1 -_LEVEL_DATA = 6836, G: MK1 -_MAPA = 6846, G: MK1 -_TILESET = 6F99, G: MK1 -_MALOTES = 7699, G: MK1 -_HOTSPOTS = 7987, G: MK1 -_BEHS = 79D2, G: MK1 -_SPRITES = 7A02, G: MK1 -_SPRITE_1_A = 7A12, G: MK1 -_SPRITE_1_B = 7A42, G: MK1 -_SPRITE_1_C = 7A72, G: MK1 -_SPRITE_2_A = 7AA2, G: MK1 -_SPRITE_2_B = 7AD2, G: MK1 -_SPRITE_2_C = 7B02, G: MK1 -_SPRITE_3_A = 7B32, G: MK1 -_SPRITE_3_B = 7B62, G: MK1 -_SPRITE_3_C = 7B92, G: MK1 -_SPRITE_4_A = 7BC2, G: MK1 -_SPRITE_4_B = 7BF2, G: MK1 -_SPRITE_4_C = 7C22, G: MK1 -_SPRITE_5_A = 7C52, G: MK1 -_SPRITE_5_B = 7C82, G: MK1 -_SPRITE_5_C = 7CB2, G: MK1 -_SPRITE_6_A = 7CE2, G: MK1 -_SPRITE_6_B = 7D12, G: MK1 -_SPRITE_6_C = 7D42, G: MK1 -_SPRITE_7_A = 7D72, G: MK1 -_SPRITE_7_B = 7DA2, G: MK1 -_SPRITE_7_C = 7DD2, G: MK1 -_SPRITE_8_A = 7E02, G: MK1 -_SPRITE_8_B = 7E32, G: MK1 -_SPRITE_8_C = 7E62, G: MK1 -_SPRITE_9_A = 7E92, G: MK1 -_SPRITE_9_B = 7EC2, G: MK1 -_SPRITE_9_C = 7EF2, G: MK1 -_SPRITE_10_A = 7F22, G: MK1 -_SPRITE_10_B = 7F52, G: MK1 -_SPRITE_10_C = 7F82, G: MK1 -_SPRITE_11_A = 7FB2, G: MK1 -_SPRITE_11_B = 7FE2, G: MK1 -_SPRITE_11_C = 8012, G: MK1 -_SPRITE_12_A = 8042, G: MK1 -_SPRITE_12_B = 8072, G: MK1 -_SPRITE_12_C = 80A2, G: MK1 -_SPRITE_13_A = 80D2, G: MK1 -_SPRITE_13_B = 8102, G: MK1 -_SPRITE_13_C = 8132, G: MK1 -_SPRITE_14_A = 8162, G: MK1 -_SPRITE_14_B = 8192, G: MK1 -_SPRITE_14_C = 81C2, G: MK1 -_SPRITE_15_A = 81F2, G: MK1 -_SPRITE_15_B = 8222, G: MK1 -_SPRITE_15_C = 8252, G: MK1 -_SPRITE_16_A = 8282, G: MK1 -_SPRITE_16_B = 82B2, G: MK1 -_SPRITE_16_C = 82E2, G: MK1 -_SPRITE_17_A = 8312, G: MK1 -_SPRITE_18_A = 83A2, G: MK1 -_SPRITE_18_B = 83D2, L: MK1 -_SPRITE_18_C = 8402, L: MK1 -_SPRITE_19_A = 8432, G: MK1 -_LEVELS = 8472, G: MK1 -_ISR = 847E, G: MK1 -_WYZ_INIT = 848C, G: MK1 -_WYZ_PLAY_SOUND = 849A, G: MK1 -_WYZ_PLAY_MUSIC = 84AB, G: MK1 -_WYZ_STOP_SOUND = 84C7, G: MK1 -_ATTR = 84D7, G: MK1 -I_23 = 84F7, L: MK1 -I_22 = 84FB, L: MK1 -_QTILE = 8527, G: MK1 -_ATTR_MK2 = 8553, G: MK1 -_ATTR_RESET = 8561, L: MK1 -_ATTR_DO = 8565, L: MK1 -_DRAW_COLOURED_TILE = 8584, G: MK1 -I_26_UGE = 85BF, L: MK1 -I_26 = 85CC, L: MK1 -I_27 = 85CF, L: MK1 -I_25 = 85D6, L: MK1 -I_28 = 85D9, L: MK1 -I_29 = 861C, L: MK1 -I_30 = 8638, L: MK1 -_DCT_1_SET_YY = 8652, L: MK1 -_DCT_A1_SET = 8665, L: MK1 -_DCT_2_SET_YY = 8675, L: MK1 -_DCT_A2_SET = 8688, L: MK1 -_DCT_A3_SET = 86A8, L: MK1 -_DCT_1_SHADOW = 86BD, L: MK1 -_DCT_1_NO_SHADOW = 86CC, L: MK1 -_DCT_1_INCREMENT = 86D9, L: MK1 -_DCT_2_SHADOW = 86F5, L: MK1 -_DCT_2_NO_SHADOW = 8704, L: MK1 -_DCT_2_INCREMENT = 8711, L: MK1 -_DCT_3_SHADOW = 872D, L: MK1 -_DCT_3_NO_SHADOW = 873C, L: MK1 -_DCT_3_INCREMENT = 8749, L: MK1 -_INVALIDATE_TILE = 87A5, G: MK1 -_INVALIDATE_VIEWPORT = 87B9, G: MK1 -_DRAW_INVALIDATE_COLOURED_TILE_G= 87C9, G: MK1 -_DRAW_COLOURED_TILE_GAMEAREA = 87D0, G: MK1 -_DRAW_DECORATIONS = 87FE, G: MK1 -_DRAW_DECORATIONS_LOOP = 8801, L: MK1 -_UTAUX = 8831, G: MK1 -_UPDATE_TILE = 8832, G: MK1 -_PRINT_NUMBER2 = 8863, G: MK1 -_DRAW_OBJS = 88B2, G: MK1 -_PRINT_STR = 88B3, G: MK1 -PRINT_STR_LOOP = 88B6, L: MK1 -PRINT_STR_NO_INC_A = 88CA, L: MK1 -_BLACKOUT_AREA = 88D8, G: MK1 -BAL1 = 88DD, L: MK1 -_CLEAR_SPRITES = 88EE, G: MK1 -HIDE_SPRITES_ENEMS_LOOP = 8903, L: MK1 -HIDE_SPRITES_BULLETS_LOOP = 892E, L: MK1 -_CORTINA2 = 8959, G: MK1 -_HALTS_DELAY = 8967, G: MK1 -I_32 = 8967, L: MK1 -I_33 = 8977, L: MK1 -_CHECK_PASSWORD = 8978, G: MK1 -I_34 = 89C2, L: MK1 -I_36 = 89CC, L: MK1 -I_35 = 89E9, L: MK1 -I_37 = 8A0C, L: MK1 -I_41 = 8A25, L: MK1 -I_39 = 8A2E, L: MK1 -I_40 = 8A38, L: MK1 -I_43 = 8A4D, L: MK1 -I_44_I_43 = 8A50, L: MK1 -I_45 = 8A69, L: MK1 -I_46 = 8A6C, L: MK1 -I_42 = 8A7C, L: MK1 -I_48 = 8A8B, L: MK1 -I_49 = 8AA5, L: MK1 -I_50 = 8AA5, L: MK1 -I_47 = 8AA5, L: MK1 -I_52_UGE = 8AAF, L: MK1 -I_52_ULE = 8AB9, L: MK1 -I_52 = 8AC3, L: MK1 -I_53_I_52 = 8AC6, L: MK1 -I_51 = 8AE1, L: MK1 -I_38 = 8AED, L: MK1 -I_54 = 8B00, L: MK1 -I_56 = 8B0A, L: MK1 -I_57 = 8B24, L: MK1 -I_59 = 8B2E, L: MK1 -I_60 = 8B60, L: MK1 -I_58 = 8B63, L: MK1 -I_61 = 8B76, L: MK1 -I_55 = 8B79, L: MK1 -_SHOW_INTRO_TEXT = 8B7D, G: MK1 -I_62 = 8B8E, L: MK1 -I_64 = 8BC9, L: MK1 -_DAFUQ = 8BE9, L: MK1 -I_65 = 8BE9, L: MK1 -I_66 = 8C05, L: MK1 -I_63 = 8C08, L: MK1 -I_67 = 8C13, L: MK1 -_DO_CUTSCENE = 8C14, G: MK1 -I_68 = 8C24, L: MK1 -I_69 = 8C27, L: MK1 -I_70 = 8C45, L: MK1 -I_72 = 8C4A, L: MK1 -I_71 = 8CA3, L: MK1 -_COLLIDE = 8CA7, G: MK1 -I_73 = 8D02, L: MK1 -I_74 = 8D05, L: MK1 -_CM_TWO_POINTS = 8D08, G: MK1 -_CM_TWO_POINTS_AT1_RESET = 8D16, L: MK1 -_CM_TWO_POINTS_AT1_DO = 8D19, L: MK1 -_CM_TWO_POINTS_AT1_DONE = 8D33, L: MK1 -_CM_TWO_POINTS_AT2_RESET = 8D44, L: MK1 -_CM_TWO_POINTS_AT2_DO = 8D47, L: MK1 -_CM_TWO_POINTS_AT2_DONE = 8D61, L: MK1 -_RAND = 8D65, G: MK1 -RAND16 = 8D65, L: MK1 -NEXTRAND = 8D81, L: MK1 -_ABS = 8D8E, G: MK1 -I_75 = 8D9F, L: MK1 -I_76 = 8DA4, L: MK1 -_CORTINA = 8DA5, G: MK1 -CLEARB1 = 8DAA, L: MK1 -CLEARB2 = 8DAD, L: MK1 -REPITATODO = 8DB9, L: MK1 -BUCLE = 8DBF, L: MK1 -BUCLE1 = 8DC2, L: MK1 -BUCLE2 = 8DCA, L: MK1 -_BULLETS_INIT = 8DD9, G: MK1 -I_77 = 8DE0, L: MK1 -I_78 = 8E03, L: MK1 -_BULLETS_UPDATE = 8E04, G: MK1 -_BULLETS_FIRE = 8E33, G: MK1 -I_79 = 8E3D, L: MK1 -I_81 = 8E47, L: MK1 -I_83 = 8E84, L: MK1 -I_85 = 8EB3, L: MK1 -I_86 = 8ECD, L: MK1 -I_84 = 8ECD, L: MK1 -I_89 = 8F0F, L: MK1 -I_90 = 8F12, L: MK1 -I_88 = 8F19, L: MK1 -I_91 = 8F1C, L: MK1 -I_92 = 8F45, L: MK1 -I_93 = 8F5F, L: MK1 -I_87 = 8F62, L: MK1 -I_94 = 8F7C, L: MK1 -I_82 = 8F88, L: MK1 -I_80 = 8F8B, L: MK1 -_BULLETS_MOVE = 8F8C, G: MK1 -I_95 = 8F96, L: MK1 -I_97 = 8F9B, L: MK1 -I_99 = 9010, L: MK1 -I_100 = 9010, L: MK1 -I_101 = 903E, L: MK1 -I_102 = 903E, L: MK1 -I_103 = 908C, L: MK1 -I_98 = 908F, L: MK1 -I_96 = 9092, L: MK1 -_PREPARE_LEVEL = 9093, G: MK1 -I_104 = 90F4, L: MK1 -_PLAYER_CELLS = 90F5, G: MK1 -_ENEM_CELLS = 9109, G: MK1 -_GAME_ENDING = 9119, G: MK1 -_GAME_OVER = 9147, G: MK1 -_TIME_OVER = 919B, G: MK1 -_PAUSE_SCREEN = 91F4, G: MK1 -_ZONE_CLEAR = 9245, G: MK1 -_ADDSIGN = 929E, G: MK1 -I_107 = 92AF, L: MK1 -I_108 = 92B7, L: MK1 -_ESPERA_ACTIVA = 92B8, G: MK1 -I_109 = 92B8, L: MK1 -I_113 = 92C0, L: MK1 -I_110 = 92C0, L: MK1 -I_114 = 92C9, L: MK1 -I_111 = 92C9, L: MK1 -I_112 = 92D3, L: MK1 -_DRAW_SCR_BACKGROUND = 92D4, G: MK1 -I_115 = 9304, L: MK1 -I_117 = 930E, L: MK1 -_DRAW_SCR_PACKED_NEW = 9324, L: MK1 -_DRAW_SCR_PACKED_EXISTING = 9339, L: MK1 -_DRAW_SCR_PACKED_DONE = 933E, L: MK1 -_DRAW_SCR_PACKED_ALT = 935A, L: MK1 -_DRAW_SCR_PACKED_ALT_SUBST = 9369, L: MK1 -_DRAW_SCR_PACKED_NOALT = 936E, L: MK1 -_ADVANCE_WORM_NO_INC_Y = 9389, L: MK1 -I_116 = 938F, L: MK1 -_DRAW_SCR = 9390, G: MK1 -_HOTSPOTS_SETUP_DO = 93CF, L: MK1 -_HOTSPOTS_SETUP_SET_REFILL = 9400, L: MK1 -_HOTSPOTS_SETUP_SET = 9401, L: MK1 -_HOTSPOTS_SETUP_DONE = 9409, L: MK1 -_SELECT_JOYFUNC = 9417, G: MK1 -I_118 = 9417, L: MK1 -I_121_UGE = 9427, L: MK1 -I_121 = 9430, L: MK1 -I_122_I_121 = 9433, L: MK1 -I_120 = 9463, L: MK1 -I_119 = 9466, L: MK1 -_DISTANCE = 9470, G: MK1 -I_123 = 94BD, L: MK1 -I_124 = 94C2, L: MK1 -_LIMIT = 9507, G: MK1 -I_125 = 9523, L: MK1 -I_126 = 953C, L: MK1 -_PLAYER_INIT = 9544, G: MK1 -_PLAYER_CALC_BOUNDING_BOX = 95A5, G: MK1 -_PLAYER_MOVE = 95E6, G: MK1 -_PLAYER_GRAVITY_ADD = 95F7, L: MK1 -_PLAYER_GRAVITY_MAXIMUM = 95FD, L: MK1 -_PLAYER_GRAVITY_VY_SET = 9600, L: MK1 -_PLAYER_GRAVITY_DONE = 9603, L: MK1 -_PLAYER_GRAVITY_P_GOTTEN_DONE = 960D, L: MK1 -I_127 = 962A, L: MK1 -I_128 = 9638, L: MK1 -I_129 = 964B, L: MK1 -I_132 = 96A5, L: MK1 -I_130 = 96CC, L: MK1 -I_131 = 96CC, L: MK1 -I_138 = 972A, L: MK1 -I_137 = 972F, L: MK1 -I_140 = 9732, L: MK1 -I_136 = 9739, L: MK1 -I_141 = 973C, L: MK1 -I_135 = 9764, L: MK1 -I_134 = 9764, L: MK1 -I_143 = 9781, L: MK1 -I_144 = 9784, L: MK1 -I_142 = 978A, L: MK1 -I_145 = 97EE, L: MK1 -I_147 = 9809, L: MK1 -I_148 = 980C, L: MK1 -I_149 = 982F, L: MK1 -I_150 = 9837, L: MK1 -I_154 = 985D, L: MK1 -I_153 = 986D, L: MK1 -I_152 = 9870, L: MK1 -I_157 = 989E, L: MK1 -I_156 = 98B4, L: MK1 -I_158 = 98B4, L: MK1 -I_151 = 98B7, L: MK1 -I_159 = 98BE, L: MK1 -I_161 = 98EF, L: MK1 -I_162 = 98F2, L: MK1 -I_164 = 9919, L: MK1 -I_163 = 991C, L: MK1 -I_166 = 993D, L: MK1 -I_167 = 993D, L: MK1 -I_165 = 993D, L: MK1 -I_160 = 9944, L: MK1 -I_168 = 9969, L: MK1 -I_169 = 9969, L: MK1 -I_170 = 9990, L: MK1 -I_171 = 9990, L: MK1 -I_172 = 99AE, L: MK1 -I_173 = 99C1, L: MK1 -I_176 = 9A24, L: MK1 -I_175 = 9A55, L: MK1 -I_179 = 9A6A, L: MK1 -I_180 = 9A6D, L: MK1 -I_178 = 9A73, L: MK1 -I_174 = 9A73, L: MK1 -I_183 = 9AA8, L: MK1 -I_182 = 9AD8, L: MK1 -I_186 = 9AED, L: MK1 -I_187 = 9AF0, L: MK1 -I_181 = 9AF6, L: MK1 -I_185 = 9AF6, L: MK1 -I_188 = 9B4B, L: MK1 -I_190 = 9B61, L: MK1 -I_191_I_190 = 9B64, L: MK1 -I_189 = 9B6E, L: MK1 -I_192 = 9B7D, L: MK1 -I_193 = 9BA4, L: MK1 -I_194 = 9BC3, L: MK1 -I_195 = 9BC3, L: MK1 -I_196 = 9BD8, L: MK1 -I_197 = 9BD8, L: MK1 -I_199 = 9BED, L: MK1 -I_200_I_199 = 9BF0, L: MK1 -I_198 = 9C09, L: MK1 -I_202 = 9C2C, L: MK1 -I_203 = 9C48, L: MK1 -I_201 = 9C61, L: MK1 -_PLAYER_DEPLETE = 9C62, G: MK1 -I_204 = 9C85, L: MK1 -I_205 = 9C88, L: MK1 -_PLAYER_KILL = 9C8F, G: MK1 -_ENEMS_DRAW_CURRENT = 9CB0, G: MK1 -_ENEMS_LOAD = 9D42, G: MK1 -I_206 = 9D5B, L: MK1 -I_208 = 9D65, L: MK1 -I_211 = 9DF5, L: MK1 -I_215 = 9E12, L: MK1 -I_213 = 9E12, L: MK1 -I_214 = 9E12, L: MK1 -I_212 = 9E12, L: MK1 -I_216 = 9E3C, L: MK1 -I_217 = 9EEC, L: MK1 -I_210 = 9F00, L: MK1 -I_207 = 9F21, L: MK1 -_ENEMS_KILL = 9F22, G: MK1 -I_218 = 9F47, L: MK1 -_ENEMS_MOVE = 9F52, G: MK1 -I_219 = 9F71, L: MK1 -I_221 = 9F76, L: MK1 -I_222 = A036, L: MK1 -I_223 = A036, L: MK1 -I_224 = A066, L: MK1 -I_225 = A069, L: MK1 -I_228 = A075, L: MK1 -I_230 = A092, L: MK1 -I_232 = A092, L: MK1 -I_231 = A092, L: MK1 -I_229 = A092, L: MK1 -_ENEMS_LM_CHANGE_AXIS_X = A0AF, L: MK1 -_ENEMS_LM_CHANGE_AXIS_X_DONE = A0B7, L: MK1 -_ENEMS_LM_CHANGE_AXIS_Y = A0CF, L: MK1 -_ENEMS_LM_CHANGE_AXIS_Y_DONE = A0D7, L: MK1 -I_233 = A0DA, L: MK1 -I_236 = A154, L: MK1 -I_237 = A167, L: MK1 -I_238_ULE = A171, L: MK1 -I_238 = A17F, L: MK1 -I_239 = A182, L: MK1 -I_240 = A1A7, L: MK1 -I_241 = A235, L: MK1 -I_242 = A238, L: MK1 -I_243_ULE = A286, L: MK1 -I_243 = A294, L: MK1 -I_235 = A294, L: MK1 -I_245 = A2E2, L: MK1 -I_246_I_245 = A2E5, L: MK1 -I_244 = A2F3, L: MK1 -I_227 = A327, L: MK1 -_ENEMS_MOVE_UPDATE_FRAME_DONE = A378, L: MK1 -I_248 = A378, L: MK1 -I_253 = A3C3, L: MK1 -I_254_I_253 = A3C6, L: MK1 -I_252 = A3F4, L: MK1 -I_251 = A3F4, L: MK1 -I_256 = A42E, L: MK1 -I_257 = A430, L: MK1 -I_256_I_257 = A435, L: MK1 -I_259 = A47D, L: MK1 -I_260 = A480, L: MK1 -I_258 = A487, L: MK1 -I_261 = A48A, L: MK1 -I_255 = A4BD, L: MK1 -I_250 = A4BD, L: MK1 -I_249 = A4C0, L: MK1 -I_264 = A4EC, L: MK1 -I_265_I_264 = A4EF, L: MK1 -I_266 = A4FB, L: MK1 -I_262 = A4FB, L: MK1 -I_263 = A4FB, L: MK1 -I_267 = A505, L: MK1 -I_269 = A50A, L: MK1 -I_272 = A59B, L: MK1 -I_273_I_272 = A59E, L: MK1 -I_274 = A5DB, L: MK1 -I_275 = A627, L: MK1 -I_276 = A657, L: MK1 -I_270 = A65D, L: MK1 -I_271 = A65D, L: MK1 -I_268 = A660, L: MK1 -I_247 = A660, L: MK1 -I_220 = A697, L: MK1 -_HOTSPOTS_DO = A698, G: MK1 -I_277 = A6B2, L: MK1 -I_281 = A6E4, L: MK1 -I_282 = A6F7, L: MK1 -I_283 = A78F, L: MK1 -I_284 = A792, L: MK1 -I_285 = A7AD, L: MK1 -I_286 = A7B6, L: MK1 -I_287 = A7DE, L: MK1 -I_288 = A7E5, L: MK1 -I_280 = A7EB, L: MK1 -I_289 = A83A, L: MK1 -I_278 = A83A, L: MK1 -_MAIN = A83B, G: MK1 -I_292 = A896, L: MK1 -I_293 = A8C2, L: MK1 -I_290 = A8C2, L: MK1 -I_291 = A8CC, L: MK1 -I_294 = A90B, L: MK1 -I_296 = A910, L: MK1 -I_295 = A998, L: MK1 -I_297 = A9A2, L: MK1 -I_299 = A9A7, L: MK1 -I_298 = A9F1, L: MK1 -I_300 = A9FE, L: MK1 -I_302 = AA08, L: MK1 -I_301 = AA40, L: MK1 -I_303 = AA73, L: MK1 -I_306 = AA98, L: MK1 -I_305 = AAA7, L: MK1 -I_304 = AAAA, L: MK1 -I_308 = AAAD, L: MK1 -I_310 = AAEC, L: MK1 -I_311 = AAEF, L: MK1 -I_312 = AB0C, L: MK1 -I_313 = AB0F, L: MK1 -I_314 = AB32, L: MK1 -I_318 = AB4F, L: MK1 -I_319 = AB5D, L: MK1 -I_320 = AB67, L: MK1 -I_317 = AB70, L: MK1 -I_315 = AB73, L: MK1 -I_321 = AB8B, L: MK1 -I_323 = ABA7, L: MK1 -I_325 = ABBE, L: MK1 -I_324 = ABBE, L: MK1 -I_326 = ABDE, L: MK1 -I_327 = ABE1, L: MK1 -I_329 = AC2F, L: MK1 -I_331 = AC39, L: MK1 -I_330 = AC65, L: MK1 -I_328 = AC65, L: MK1 -I_332 = AC83, L: MK1 -I_334 = AC8D, L: MK1 -I_335 = ACA2, L: MK1 -I_337 = ACAC, L: MK1 -I_336 = ACD3, L: MK1 -I_333 = ACD6, L: MK1 -I_338 = AD3A, L: MK1 -I_340 = AD4C, L: MK1 -I_342 = AD5E, L: MK1 -I_344 = AD70, L: MK1 -I_341 = AD7F, L: MK1 -I_345 = AD7F, L: MK1 -I_346 = AD7F, L: MK1 -I_343 = AD7F, L: MK1 -I_339 = AD7F, L: MK1 -I_347 = ADDB, L: MK1 -I_349 = ADF8, L: MK1 -I_351 = AE32, L: MK1 -I_350 = AE3E, L: MK1 -I_352 = AE73, L: MK1 -I_354 = AE73, L: MK1 -I_353 = AE73, L: MK1 -I_355 = AEA3, L: MK1 -I_356 = AED3, L: MK1 -I_357 = AF02, L: MK1 -I_359 = AF20, L: MK1 -I_361 = AF25, L: MK1 -I_360 = AF48, L: MK1 -I_363 = AF66, L: MK1 -I_362 = AFA4, L: MK1 -I_365 = AFC1, L: MK1 -I_366 = AFD1, L: MK1 -I_368 = AFD6, L: MK1 -I_369 = B053, L: MK1 -I_370 = B075, L: MK1 -I_367 = B078, L: MK1 -I_358 = B07B, L: MK1 -I_371 = B096, L: MK1 -I_372 = B096, L: MK1 -I_374 = B0B8, L: MK1 -I_375 = B0C6, L: MK1 -I_373 = B0CC, L: MK1 -I_376 = B0E0, L: MK1 -I_378 = B102, L: MK1 -I_379_I_378 = B105, L: MK1 -I_377 = B124, L: MK1 -I_381 = B14B, L: MK1 -I_382_I_381 = B14E, L: MK1 -I_380 = B16E, L: MK1 -I_384 = B190, L: MK1 -I_385_I_384 = B193, L: MK1 -I_383 = B1BD, L: MK1 -I_387 = B1E4, L: MK1 -I_388_I_387 = B1E7, L: MK1 -I_386 = B222, L: MK1 -I_389 = B222, L: MK1 -I_391 = B23B, L: MK1 -I_390 = B247, L: MK1 -I_394 = B256, L: MK1 -I_393 = B25D, L: MK1 -I_348 = B260, L: MK1 -I_397 = B287, L: MK1 -I_398 = B29C, L: MK1 -I_396 = B29F, L: MK1 -I_400 = B2AF, L: MK1 -I_401 = B2B2, L: MK1 -I_399 = B2B8, L: MK1 -I_322 = B2BE, L: MK1 -I_309 = B2C4, L: MK1 -I_1 = B2C5, L: MK1 -__EN_T = B37C, G: MK1 -__EN_X = B37D, G: MK1 -__EN_Y = B37E, G: MK1 -_SP_MOVILES = B37F, G: MK1 -_GPEN_CX = B385, G: MK1 -_GPEN_CY = B386, G: MK1 -__EN_X1 = B387, G: MK1 -__EN_Y1 = B388, G: MK1 -__EN_X2 = B389, G: MK1 -__EN_Y2 = B38A, G: MK1 -_BULLETS_MX = B38B, G: MK1 -_BULLETS_MY = B38F, G: MK1 -_EN_AN_BASE_FRAME = B393, G: MK1 -__EN_CX = B396, G: MK1 -__EN_CY = B397, G: MK1 -_HOTSPOT_X = B398, G: MK1 -_HOTSPOT_Y = B399, G: MK1 -_HALF_LIFE = B39A, G: MK1 -__EN_MX = B39B, G: MK1 -__EN_MY = B39C, G: MK1 -_MAP_POINTER = B39D, G: MK1 -_INTRO_ITERATOR = B39F, G: MK1 -_EN_AN_STATE = B3A0, G: MK1 -_FLAGS = B3A3, G: MK1 -_P_FACING = B3B3, G: MK1 -_P_FRAME = B3B4, G: MK1 -_ISJOY = B3B5, G: MK1 -_PREGOTTEN = B3B6, G: MK1 -_HIT_H = B3B7, G: MK1 -_GEN_PT_ALT = B3B8, G: MK1 -_P_KILL_AMT = B3BA, G: MK1 -_HIT_V = B3BB, G: MK1 -_KILLED_OLD = B3BC, G: MK1 -_GPAUX = B3BD, G: MK1 -_MAP_ATTR = B3BE, G: MK1 -_ACTIVE = B454, G: MK1 -_P_CT_ESTADO = B455, G: MK1 -_A1 = B456, G: MK1 -_A2 = B458, G: MK1 -_LEVEL = B45A, G: MK1 -_C1 = B45B, G: MK1 -_C2 = B45C, G: MK1 -_C3 = B45D, G: MK1 -_C4 = B45E, G: MK1 -_A3 = B45F, G: MK1 -_T_ALT = B461, G: MK1 -_HOTSPOT_DESTROY = B462, G: MK1 -_T1 = B463, G: MK1 -_T2 = B464, G: MK1 -_T3 = B465, G: MK1 -_T4 = B466, G: MK1 -_X0 = B467, G: MK1 -_Y0 = B468, G: MK1 -_X1 = B469, G: MK1 -_Y1 = B46A, G: MK1 -__N = B46B, G: MK1 -__T = B46C, G: MK1 -__X = B46D, G: MK1 -__Y = B46E, G: MK1 -__EN_AN_VX = B46F, G: MK1 -__EN_AN_VY = B471, G: MK1 -_LIFE_OLD = B473, G: MK1 -_XX = B474, G: MK1 -_BULLETS_ESTADO = B475, G: MK1 -__GP_GEN = B479, G: MK1 -_YY = B47B, G: MK1 -_TIMER_OLD = B47C, G: MK1 -_GEN_PT = B47D, G: MK1 -_P_CURRENT_FRAME = B47F, G: MK1 -_PTGMX = B481, G: MK1 -_PTGMY = B483, G: MK1 -_EN_AN_CURRENT_FRAME = B485, G: MK1 -_TIMER_FRAMES = B48B, G: MK1 -_SP_PLAYER = B48C, G: MK1 -_SP_BULLETS = B48E, G: MK1 -__B_X = B496, G: MK1 -__B_Y = B497, G: MK1 -_ENOFFS = B498, G: MK1 -_B_IT = B499, G: MK1 -_P_ESTADO = B49A, G: MK1 -__B_ESTADO = B49B, G: MK1 -_P_KILLED = B49C, G: MK1 -_BULLETS_X = B49D, G: MK1 -_BULLETS_Y = B4A1, G: MK1 -_P_AMMO = B4A5, G: MK1 -_GPEN_X = B4A6, G: MK1 -_GPEN_Y = B4A7, G: MK1 -_PAD0 = B4A8, G: MK1 -_P_KILLME = B4A9, G: MK1 -_N_PANT = B4AA, G: MK1 -_P_CONT_SALTO = B4AB, G: MK1 -_O_PANT = B4AC, G: MK1 -_P_LIFE = B4AD, G: MK1 -_ENIT = B4AE, G: MK1 -_P_FUEL = B4AF, G: MK1 -_P_OBJS = B4B0, G: MK1 -_P_GOTTEN = B4B1, G: MK1 -_GPCX = B4B2, G: MK1 -_GPCY = B4B3, G: MK1 -_EN_AN_VX = B4B4, G: MK1 -_P_KEYS = B4BA, G: MK1 -_EN_AN_VY = B4BB, G: MK1 -_GPIT = B4C1, G: MK1 -_GPJT = B4C2, G: MK1 -_PLAYING = B4C3, G: MK1 -_GPOX = B4C4, G: MK1 -_SEED = B4C5, G: MK1 -_P_TX = B4C7, G: MK1 -_P_TY = B4C8, G: MK1 -_ASM_INT_2 = B4C9, G: MK1 -_P_VX = B4CB, G: MK1 -_P_VY = B4CD, G: MK1 -_GPXX = B4CF, G: MK1 -_GPYY = B4D0, G: MK1 -__EN_AN_X = B4D1, G: MK1 -__EN_AN_Y = B4D3, G: MK1 -_OBJS_OLD = B4D5, G: MK1 -_MAINCOUNTER = B4D6, G: MK1 -_PTX1 = B4D7, G: MK1 -_PTX2 = B4D8, G: MK1 -_PTY1 = B4D9, G: MK1 -_PTY2 = B4DA, G: MK1 -_ASM_NUMBER = B4DB, G: MK1 -_TIMER_ON = B4DC, G: MK1 -_P_NEXT_FRAME = B4DD, G: MK1 -_EN_AN_NEXT_FRAME = B4DF, G: MK1 -_AT1 = B4E5, G: MK1 -_AT2 = B4E6, G: MK1 -__EN_LIFE = B4E7, G: MK1 -_NOCAST = B4E8, G: MK1 -_TIMER_COUNT = B4E9, G: MK1 -_CX1 = B4EA, G: MK1 -_CX2 = B4EB, G: MK1 -_CY1 = B4EC, G: MK1 -_CY2 = B4ED, G: MK1 -_P_SUBFRAME = B4EE, G: MK1 -_INTROX = B4EF, G: MK1 -_INTROY = B4F0, G: MK1 -__TA = B4F1, G: MK1 -_BLX = B4F2, G: MK1 -_BLY = B4F3, G: MK1 -_GPC = B4F4, G: MK1 -_GPD = B4F5, G: MK1 -_EN_AN_X = B4F6, G: MK1 -_EN_AN_Y = B4FC, G: MK1 -_HIT = B502, G: MK1 -_GPT = B503, G: MK1 -_RDA = B504, G: MK1 -_RDB = B505, G: MK1 -_RDC = B506, G: MK1 -_P_X = B507, G: MK1 -_AD_FREE = B509, G: MK1 -_P_Y = B88D, G: MK1 -_GPX = B88F, G: MK1 -_GPY = B890, G: MK1 -_RDD = B891, G: MK1 -_RDN = B892, G: MK1 -_ITJ = B893, G: MK1 -_KEYS_OLD = B895, G: MK1 -_STEPBYSTEP = B896, G: MK1 -_RAM_PAGE = B897, G: MK1 -_RDX = B898, G: MK1 -_RDY = B899, G: MK1 -_TIMER_T = B89A, G: MK1 -_WALL_H = B89B, G: MK1 -_ENOFFSMASI = B89C, G: MK1 -_WALL_V = B89D, G: MK1 -_TEXT_OFFS = B89E, G: MK1 -_TOCADO = B89F, G: MK1 -_X_PANT = B8A0, G: MK1 -_IS_RENDERING = B8A1, G: MK1 -_SLEVEL = B8A2, G: MK1 -_ASM_INT = B8A3, G: MK1 -_P_FACING_H = B8A5, G: MK1 -_Y_PANT = B8A6, G: MK1 -__BADDIES_POINTER = B8A7, G: MK1 -_P_FACING_V = B8A9, G: MK1 -_P_SALTANDO = B8AA, G: MK1 -_POSSEE = B8AB, G: MK1 -_ORIG_TILE = B8AC, G: MK1 -_EN_AN_FRAME = B8AD, G: MK1 -_SUCCESS = B8B0, G: MK1 -_RAM_DESTINATION = B8B1, G: MK1 -_TIMER_ZERO = B8B3, G: MK1 -_EN_AN_COUNT = B8B4, G: MK1 -_P_DISPARANDO = B8B7, G: MK1 -__B_MX = B8B8, G: MK1 -__B_MY = B8B9, G: MK1 -_RAM_ADDRESS = B8BA, G: MK1 -L_AND = B8BC, G: L_AND -L_ASL = B8C3, G: L_ASL -L_ASL1 = B8C4, L: L_ASL -L_ASR = B8CA, G: L_ASR -L_ASR1 = B8CB, L: L_ASR -L_ASR_U = B8D4, G: L_ASR_U -L_ASR_U_1 = B8D5, L: L_ASR_U -L_DIV_U = B8DE, G: L_DIV_U -ENTRY = B8E2, L: L_DIV_U -L_DIV1 = B8E9, L: L_DIV_U -L_DIV2 = B8F3, L: L_DIV_U -L_EQ = B8FD, G: L_EQ -L_GCHAR = B904, G: L_GCHAR -L_SXT = B905, L: L_GCHAR -L_GINT = B90A, G: L_GINT -L_GINTSPSP = B90F, G: L_GINTSPSP -L_GT = B918, G: L_GT -L_LNEG = B924, G: L_LNEG -L_LT = B929, G: L_LT -L_MULT = B935, G: L_MULT -L_MULT1 = B93C, L: L_MULT -L_MULT2 = B943, L: L_MULT -L_NE = B946, G: L_NE -L_NEG = B94D, G: L_NEG -L_OR = B955, G: L_OR -L_PINT = B95C, G: L_PINT -L_SXT = B962, G: L_SXT -L_UGE = B967, G: L_UGE -L_UGT = B96F, G: L_UGT -L_ULE = B975, G: L_ULE -L_ULT = B97D, G: L_ULT -SPCOMPDLISTADDR = B983, G: SPCOMPDLISTADDR -SPDISPLAYLIST = B994, G: SPDISPLAYLIST -SPINVALIDATE = C594, G: SPINVALIDATE -SPINVALIDATEP = C59C, G: SPINVALIDATE -NOINC1 = C5B5, L: SPINVALIDATE -INVCOLLP = C5B9, L: SPINVALIDATE -NOINC2 = C5C8, L: SPINVALIDATE -INVFULLCHAR = C5CC, L: SPINVALIDATE -INVROWLP = C5CE, L: SPINVALIDATE -NOINC3 = C5D9, L: SPINVALIDATE -SPBITLEFT2MASK = C5E7, G: SPBITLEFT2MASK -SPBITRIGHT2MASK = C5EF, G: SPBITRIGHT2MASK -SPCOMPDIRTYADDR = C5F7, G: SPCOMPDIRTYADDR -SPDIRTYCHARS = C60C, G: SPDIRTYCHARS -SPINTRECT = C66C, G: SPINTRECT -SPINTSMALLIVAL = C69D, G: SPINTRECT -TRYOTHERWAY = C6B1, L: SPINTRECT -SPPTINSMALLIVAL = C6C2, G: SPINTRECT -BROKEN = C6CE, L: SPINTRECT -SPMOVESPRABS = C6D7, G: SPMOVESPRABS -SPMOVESPRABSNC = C6E5, G: SPMOVESPRABS -ADJLOOP = C6F0, L: SPMOVESPRABS -SPMOVESPRABSC = C6FE, G: SPMOVESPRABS -YINSCREEN = C716, L: SPMOVESPRABS -XINSCREEN = C726, L: SPMOVESPRABS -MVCOLLOOP = C73D, L: SPMOVESPRABS -MVROWLOOP = C743, L: SPMOVESPRABS -NOTDONE = C74D, L: SPMOVESPRABS -NOINC1 = C765, L: SPMOVESPRABS -NOTINDLIST = C779, L: SPMOVESPRABS -NONEXT1 = C779, L: SPMOVESPRABS -PDLOOP = C796, L: SPMOVESPRABS -NOINC2 = C79E, L: SPMOVESPRABS -PUTHERE = C7B0, L: SPMOVESPRABS -NOINC3 = C7BF, L: SPMOVESPRABS -NODEC1 = C7CD, L: SPMOVESPRABS -NOINC4 = C7D9, L: SPMOVESPRABS -NOTDISPLAYED = C7E6, L: SPMOVESPRABS -NONEXT2 = C7E6, L: SPMOVESPRABS -INVALIDATE = C801, L: SPMOVESPRABS -COMPUTEDISP = C810, L: SPMOVESPRABS -NOTNEGATIVE = C82E, L: SPMOVESPRABS -ADJUSTGRAPHICS = C833, L: SPMOVESPRABS -NOINC5 = C83F, L: SPMOVESPRABS -SKIP1 = C84F, L: SPMOVESPRABS -SKIP2 = C85F, L: SPMOVESPRABS -SPNULLSPRPTR = C862, G: SPNULLSPRPTR -SPPRINTATINV = C872, G: SPPRINTATINV -SPBIT2MASK = C88A, G: SPBIT2MASK -SPTBLLOOKUP = C892, G: SPTBLLOOKUP -NOINC = C898, L: SPTBLLOOKUP -SP_ADDCOLSPR = C89A, G: SP_ADDCOLSPR -SPADDCOLSPR = C8B5, G: SPADDCOLSPR -ACNOCRY = C8C0, L: SPADDCOLSPR -ACLOOP = C8D1, L: SPADDCOLSPR -NOINC1 = C90D, L: SPADDCOLSPR -ACNOCRY3 = C921, L: SPADDCOLSPR -ACFAIL = C94B, L: SPADDCOLSPR -JPHL = C95C, L: SPADDCOLSPR -SPDELETESPR = C95D, G: SPDELETESPR -LOOP = C961, L: SPDELETESPR -SPDSLOOP = C96E, G: SPDELETESPR -JPHL = C976, L: SPDELETESPR -SP_ADDMEMORY = C977, G: SP_ADDMEMORY -SPADDMEMORY = C990, G: SPADDMEMORY -IB1 = C998, L: SPADDMEMORY -IB2 = C99F, L: SPADDMEMORY -SPFREEBLOCK = C9AC, G: SPFREEBLOCK -SPFB1 = C9B1, G: SPFREEBLOCK -SPFB2 = C9BC, G: SPFREEBLOCK -SPQUEUETABLE = C9C7, G: SPQUEUETABLE -SP_BLOCKALLOC = C9C9, G: SP_BLOCKALLOC -SPBLOCKALLOC = C9D7, G: SPBLOCKALLOC -SPALLOC = C9E1, G: SPBLOCKALLOC -SP_BORDER = C9F2, G: SP_BORDER -SPBORDERCLR = C9FB, G: SPBORDER -SPBORDER = C9FC, G: SPBORDER -SP_CREATEGENERICISR = CA04, G: SP_CREATEGENERICISR -SPCREATEGENERICISR = CA0D, G: SPCREATEGENERICISR -GENERICISR = CA16, L: SPCREATEGENERICISR -POSITION = CA19, L: SPCREATEGENERICISR -PUSHREG = CA22, L: SPCREATEGENERICISR -JPHL = CA31, L: SPCREATEGENERICISR -RUNHOOKS = CA32, L: SPCREATEGENERICISR -POPREG = CA44, L: SPCREATEGENERICISR -SP_CREATESPR = CA55, G: SP_CREATESPR -SPCREATESPR = CA6D, G: SPCREATESPR -CSLOOP = CAB8, L: SPCREATESPR -CSENTER = CACC, L: SPCREATESPR -NOTCOMPRESS = CADE, L: SPCREATESPR -CONT = CAE3, L: SPCREATESPR -CSNOCRY = CAF7, L: SPCREATESPR -CSFAIL1 = CB01, L: SPCREATESPR -CSFAIL2 = CB03, L: SPCREATESPR -JPHL = CB0C, L: SPCREATESPR -SP_FREEBLOCK = CB0D, G: SP_FREEBLOCK -SP_GETKEY = CB18, G: SP_GETKEY -KEYOK = CB1E, L: SP_GETKEY -STATE = CB23, L: SPGETKEY -COUNT = CB24, L: SPGETKEY -SPKEYDEBOUNCE = CB25, G: SPGETKEY -SPKEYSTARTREPEAT = CB26, G: SPGETKEY -SPKEYREPEATPERIOD = CB27, G: SPGETKEY -SPINKEY = CB28, G: SPGETKEY -SPGETKEY = CB39, G: SPGETKEY -SCANLOOP = CB40, L: SPGETKEY -KEYROWLOOP = CB44, L: SPGETKEY -NOPRESS = CB54, L: SPGETKEY -NEXTSCANROW = CB59, L: SPGETKEY -ATMAXCOUNT = CB6A, L: SPGETKEY -SKIP = CB81, L: SPGETKEY -NOCAPS = CB97, L: SPGETKEY -NOSYM = CBA2, L: SPGETKEY -TOOMANYKEYS = CBA5, L: SPGETKEY -NOKEYS = CBA5, L: SPGETKEY -SPKEYTRANSTBL = CBAD, G: SPKEYTRANSTBL -SP_INITIALIZE = CC4D, G: SP_INITIALIZE -SPINITIALIZE = CC59, G: SPINITIALIZE -ROTTBLLP = CC7F, L: SPINITIALIZE -ENTRYLP = CC86, L: SPINITIALIZE -ROTLP = CC89, L: SPINITIALIZE -LOOP = CCA2, L: SPINITIALIZE -CONT1 = CCAA, L: SPINITIALIZE -NOADD = CCB4, L: SPINITIALIZE -USERTILE = CCB7, L: SPINITIALIZE -SPTILEARRAY = CCBC, G: SPTILEARRAY -SP_INITIM2 = CEBC, G: SP_INITIM2 -SPINITIM2 = CEC7, G: SPINITIM2 -SP_JOYKEMPSTON = CEDD, G: SP_JOYKEMPSTON -SPJOYKEMPSTON = CEE4, G: SPJOYKEMPSTON -KEMPTBL = CEEF, L: SPJOYKEMPSTON -SP_JOYKEYBOARD = CF0F, G: SP_JOYKEYBOARD -SPJOYKEYBOARD = CF1D, G: SPJOYKEYBOARD -NOFIRE = CF2A, L: SPJOYKEYBOARD -JKLOOP = CF2A, L: SPJOYKEYBOARD -NOPRESS = CF35, L: SPJOYKEYBOARD -SP_JOYSINCLAIR1 = CF3C, G: SP_JOYSINCLAIR1 -SPJOYSINCLAIR1 = CF43, G: SPJOYSINCLAIR1 -SINC1TBL = CF4F, L: SPJOYSINCLAIR1 -SP_KEYPRESSED = CF6F, G: SP_KEYPRESSED -SPKEYPRESSED = CF7F, G: SPKEYPRESSED -NOCAPS = CF8B, L: SPKEYPRESSED -NOSYM = CF97, L: SPKEYPRESSED -SP_REGISTERHOOK = CFA3, G: SP_REGISTERHOOK -SP_REGISTERHOOKLAST = CFB9, G: SP_REGISTERHOOKLAST -SPREGISTERHOOK = CFC8, G: SPREGISTERHOOKLAST -SPREGISTERHOOKLAST = CFC8, G: SPREGISTERHOOKLAST -LOOP = CFD1, L: SPREGISTERHOOKLAST -DONE = CFDC, L: SPREGISTERHOOKLAST -SP_TILEARRAY = CFE5, G: SP_TILEARRAY -SPTILEENTRY = CFF3, G: SPTILEENTRY -NOINC = CFFC, L: SPTILEENTRY -SP_UPDATENOW = D004, G: SP_UPDATENOW -TEMPGRAPHIC = D00A, L: SPUPDATENOW -TEMPCOLOUR = D012, L: SPUPDATENOW -UPDATE_ATTRS = D013, G: SPUPDATENOW -DOSPRITES = D014, L: SPUPDATENOW -SPUPDATENOW = D015, G: SPUPDATENOW -DIRTYLOOP = D021, L: SPUPDATENOW -NOTACROSSBLK1 = D031, L: SPUPDATENOW -REENTER = D039, L: SPUPDATENOW -NOINC1 = D039, L: SPUPDATENOW -DIRTYAREA = D047, L: SPUPDATENOW -NOTACROSSBLK2 = D081, L: SPUPDATENOW -TILEONLY = D088, L: SPUPDATENOW -NOINC11 = D093, L: SPUPDATENOW -DRAWCHAR = D0B7, L: SPUPDATENOW -NOTLOAD = D0E5, L: SPUPDATENOW -NOINC10 = D0F0, L: SPUPDATENOW -SPRITELOOP = D105, L: SPUPDATENOW -DOSPRITE = D109, L: SPUPDATENOW -COLOURSPRITE = D21A, L: SPUPDATENOW -SKIP_SPRITE_UPDATE = D21B, L: SPUPDATENOW -CLEAR = D21C, L: SPUPDATENOW -COPYBUFFER = D227, L: SPUPDATENOW -NOMORESPRITES = D249, L: SPUPDATENOW -SKIPUPDATECOL = D254, L: SPUPDATENOW -MASKNOROTATE = D257, L: SPUPDATENOW -LOADTYPE = D2A2, L: SPUPDATENOW -LOADNOROTATE = D310, L: SPUPDATENOW -XORTYPE = D32F, L: SPUPDATENOW -XORNOROTATE = D3B5, L: SPUPDATENOW -ORTYPE = D3E7, L: SPUPDATENOW -ORNOROTATE = D46D, L: SPUPDATENOW -SP_UPDATENOWEX = D49F, G: SP_UPDATENOWEX -SP_WAITFORNOKEY = D4A8, G: SP_WAITFORNOKEY -SPWAITFORNOKEY = D4AC, G: SPWAITFORNOKEY +DEFINED_CRT_ORG_CODE = $0001 ; const, local, , zx82_crt0, , C:/DOCUME~1/ADMINI~1/CONFIG~1/Temp/zcc000001C8B77A3/zcc_opt.def:3 +CRT_ORG_CODE = $5DC0 ; const, local, , zx82_crt0, , C:/DOCUME~1/ADMINI~1/CONFIG~1/Temp/zcc000001C8B77A3/zcc_opt.def:4 +DEFINED_STACKPTR = $0001 ; const, local, , zx82_crt0, , C:/DOCUME~1/ADMINI~1/CONFIG~1/Temp/zcc000001C8B77A3/zcc_opt.def:11 +STACKPTR = $5DBF ; const, local, , zx82_crt0, , C:/DOCUME~1/ADMINI~1/CONFIG~1/Temp/zcc000001C8B77A3/zcc_opt.def:12 +DEFINED_REGISTER_SP = $0001 ; const, local, , zx82_crt0, , C:/DOCUME~1/ADMINI~1/CONFIG~1/Temp/zcc000001C8B77A3/zcc_opt.def:19 +REGISTER_SP = $5DBF ; const, local, , zx82_crt0, , C:/DOCUME~1/ADMINI~1/CONFIG~1/Temp/zcc000001C8B77A3/zcc_opt.def:20 +start = $5DC0 ; addr, local, , zx82_crt0, , crt.asm:15 +vpClipStruct = $7964 ; addr, local, , mk1_c, code_compiler, definitions.h:4 +fsClipStruct = $7968 ; addr, local, , mk1_c, code_compiler, definitions.h:4 +i_1 = $CA97 ; addr, local, , mk1_c, rodata_compiler, mk1.c::main::0::206:142 +SetRAMBank = $7975 ; addr, local, , mk1_c, code_compiler, 128k.h::SetRAMBank::0::1:6 +restISR = $7980 ; addr, local, , mk1_c, code_compiler, 128k.h::SetRAMBank::0::1:6 +keepGoing = $7984 ; addr, local, , mk1_c, code_compiler, 128k.h::SetRAMBank::0::1:6 +depack = $798D ; addr, local, , mk1_c, code_compiler, aplib.h::SetRAMBank::0::2:4 +apbranch1 = $7990 ; addr, local, , mk1_c, code_compiler, aplib.h::SetRAMBank::0::2:4 +aploop0 = $7992 ; addr, local, , mk1_c, code_compiler, aplib.h::SetRAMBank::0::2:4 +ap_getbit = $7A14 ; addr, local, , mk1_c, code_compiler, aplib.h::SetRAMBank::0::2:4 +aploop = $7995 ; addr, local, , mk1_c, code_compiler, aplib.h::SetRAMBank::0::2:4 +apbranch2 = $79D3 ; addr, local, , mk1_c, code_compiler, aplib.h::SetRAMBank::0::2:4 +apbranch3 = $79BF ; addr, local, , mk1_c, code_compiler, aplib.h::SetRAMBank::0::2:4 +apget4bits = $79A8 ; addr, local, , mk1_c, code_compiler, aplib.h::SetRAMBank::0::2:4 +apbranch4 = $79B6 ; addr, local, , mk1_c, code_compiler, aplib.h::SetRAMBank::0::2:4 +apwritebyte = $79B2 ; addr, local, , mk1_c, code_compiler, aplib.h::SetRAMBank::0::2:4 +ap_finishup2 = $7A01 ; addr, local, , mk1_c, code_compiler, aplib.h::SetRAMBank::0::2:4 +ap_getgamma = $7A20 ; addr, local, , mk1_c, code_compiler, aplib.h::SetRAMBank::0::2:4 +ap_r0_gamma = $7A08 ; addr, local, , mk1_c, code_compiler, aplib.h::SetRAMBank::0::2:4 +apskip2 = $79F2 ; addr, local, , mk1_c, code_compiler, aplib.h::SetRAMBank::0::2:4 +apskip3 = $79FB ; addr, local, , mk1_c, code_compiler, aplib.h::SetRAMBank::0::2:4 +ap_finishup = $79FE ; addr, local, , mk1_c, code_compiler, aplib.h::SetRAMBank::0::2:4 +ap_getgammaloop = $7A23 ; addr, local, , mk1_c, code_compiler, aplib.h::SetRAMBank::0::2:4 +_ram_page = $5B05 ; const, local, , mk1_c, code_compiler, mk1.c::main::0::206:142 +_ram_address = $5B01 ; const, local, , mk1_c, code_compiler, mk1.c::main::0::206:142 +_ram_destination = $5B03 ; const, local, , mk1_c, code_compiler, mk1.c::main::0::206:142 +_sprite_18_b = $9827 ; addr, local, , mk1_c, code_compiler, assets/extrasprites.h::blackout::0::4:30 +_sprite_18_c = $9857 ; addr, local, , mk1_c, code_compiler, assets/extrasprites.h::blackout::0::4:30 +_intro_text_0 = $98DF ; addr, local, , mk1_c, code_compiler, my/ci/extra_vars.h::blackout::0::4:31 +_intro_text_1 = $9947 ; addr, local, , mk1_c, code_compiler, my/ci/extra_vars.h::blackout::0::4:31 +_intro_text_2 = $99AD ; addr, local, , mk1_c, code_compiler, my/ci/extra_vars.h::blackout::0::4:31 +_intro_text_3 = $9A0C ; addr, local, , mk1_c, code_compiler, my/ci/extra_vars.h::blackout::0::4:31 +_intro_text_4 = $9A60 ; addr, local, , mk1_c, code_compiler, my/ci/extra_vars.h::blackout::0::4:31 +_intro_text_5 = $9AC5 ; addr, local, , mk1_c, code_compiler, my/ci/extra_vars.h::blackout::0::4:31 +_intro_text_6 = $9B31 ; addr, local, , mk1_c, code_compiler, my/ci/extra_vars.h::blackout::0::4:31 +_intro_text_7 = $9BA0 ; addr, local, , mk1_c, code_compiler, my/ci/extra_vars.h::blackout::0::4:31 +_intro_text_8 = $9C0A ; addr, local, , mk1_c, code_compiler, my/ci/extra_vars.h::blackout::0::4:31 +_intro_text_9 = $9C7C ; addr, local, , mk1_c, code_compiler, my/ci/extra_vars.h::blackout::0::4:31 +_intro_text_A = $9CE4 ; addr, local, , mk1_c, code_compiler, my/ci/extra_vars.h::blackout::0::4:31 +_intro_text_B = $9D3C ; addr, local, , mk1_c, code_compiler, my/ci/extra_vars.h::blackout::0::4:31 +_intro_text_C = $9DA8 ; addr, local, , mk1_c, code_compiler, my/ci/extra_vars.h::blackout::0::4:31 +_intro_text_D = $9E18 ; addr, local, , mk1_c, code_compiler, my/ci/extra_vars.h::blackout::0::4:31 +i_24 = $9F21 ; addr, local, , mk1_c, code_compiler, printer.h::attr::0::9:6 +i_23 = $9F25 ; addr, local, , mk1_c, code_compiler, printer.h::attr::0::9:6 +_map_buff = $F101 ; const, local, , mk1_c, code_compiler, mk1.c::main::0::206:142 +_attr_reset = $9F89 ; addr, local, , mk1_c, code_compiler, printer.h::attr_mk2::0::11:16 +_attr_do = $9F8D ; addr, local, , mk1_c, code_compiler, printer.h::attr_mk2::0::11:16 +i_26 = $9FFA ; addr, local, , mk1_c, code_compiler, printer.h::draw_coloured_tile::0::12:63 +i_27 = $9FF0 ; addr, local, , mk1_c, code_compiler, printer.h::draw_coloured_tile::0::12:63 +i_28 = $9FF3 ; addr, local, , mk1_c, code_compiler, printer.h::draw_coloured_tile::0::12:63 +i_29 = $9FFD ; addr, local, , mk1_c, code_compiler, printer.h::draw_coloured_tile::0::12:63 +i_30 = $A035 ; addr, local, , mk1_c, code_compiler, printer.h::draw_coloured_tile::0::12:63 +i_31 = $A051 ; addr, local, , mk1_c, code_compiler, printer.h::draw_coloured_tile::0::12:63 +_dct_1_set_yy = $A070 ; addr, local, , mk1_c, code_compiler, printer.h::draw_coloured_tile::0::12:63 +_dct_a1_set = $A083 ; addr, local, , mk1_c, code_compiler, printer.h::draw_coloured_tile::0::12:63 +_dct_2_set_yy = $A093 ; addr, local, , mk1_c, code_compiler, printer.h::draw_coloured_tile::0::12:63 +_dct_a2_set = $A0A6 ; addr, local, , mk1_c, code_compiler, printer.h::draw_coloured_tile::0::12:63 +_dct_a3_set = $A0C6 ; addr, local, , mk1_c, code_compiler, printer.h::draw_coloured_tile::0::12:63 +_dct_1_shadow = $A0DB ; addr, local, , mk1_c, code_compiler, printer.h::draw_coloured_tile::0::12:63 +_dct_1_no_shadow = $A0EA ; addr, local, , mk1_c, code_compiler, printer.h::draw_coloured_tile::0::12:63 +_dct_1_increment = $A0F7 ; addr, local, , mk1_c, code_compiler, printer.h::draw_coloured_tile::0::12:63 +_dct_2_no_shadow = $A122 ; addr, local, , mk1_c, code_compiler, printer.h::draw_coloured_tile::0::12:63 +_dct_2_shadow = $A113 ; addr, local, , mk1_c, code_compiler, printer.h::draw_coloured_tile::0::12:63 +_dct_2_increment = $A12F ; addr, local, , mk1_c, code_compiler, printer.h::draw_coloured_tile::0::12:63 +_dct_3_no_shadow = $A15A ; addr, local, , mk1_c, code_compiler, printer.h::draw_coloured_tile::0::12:63 +_dct_3_shadow = $A14B ; addr, local, , mk1_c, code_compiler, printer.h::draw_coloured_tile::0::12:63 +_dct_3_increment = $A167 ; addr, local, , mk1_c, code_compiler, printer.h::draw_coloured_tile::0::12:63 +_draw_decorations_loop = $A20E ; addr, local, , mk1_c, code_compiler, printer.h::draw_decorations::0::19:569 +print_str_loop = $A2C0 ; addr, local, , mk1_c, code_compiler, printer.h::print_str::0::23:774 +print_str_no_inc_a = $A2D4 ; addr, local, , mk1_c, code_compiler, printer.h::print_str::0::23:774 +bal1 = $A2E7 ; addr, local, , mk1_c, code_compiler, printer.h::blackout_area::0::24:810 +hide_sprites_enems_loop = $A30D ; addr, local, , mk1_c, code_compiler, printer.h::clear_sprites::0::25:831 +hide_sprites_bullets_loop = $A338 ; addr, local, , mk1_c, code_compiler, printer.h::clear_sprites::0::25:831 +i_33 = $A371 ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::halts_delay::0::27:21 +i_34 = $A381 ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::halts_delay::0::27:21 +i_37 = $A3D2 ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +i_35 = $A3CB ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +i_36 = $A3E9 ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +i_38 = $A40C ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +i_42 = $A425 ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +i_40 = $A42E ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +i_41 = $A438 ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +i_44 = $A473 ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +i_43 = $A473 ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +i_45_i_44 = $A44A ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +i_46 = $A463 ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +i_47 = $A466 ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +i_48 = $A49C ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +i_39 = $A4E0 ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +i_49 = $A47E ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +i_51 = $A49C ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +i_50 = $A49C ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +i_53 = $A4D2 ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +i_52 = $A4D2 ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +i_54_i_53 = $A4BB ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +i_57 = $A4F7 ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +i_55 = $A4F0 ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +i_56 = $A54F ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +i_60 = $A512 ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +i_58 = $A50B ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +i_59 = $A541 ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +i_61 = $A50B ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +i_62 = $A4F0 ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +i_63 = $A562 ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::show_intro_text::0::36:96 +i_64 = $A5DF ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::show_intro_text::0::36:96 +i_65 = $A5A0 ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::show_intro_text::0::36:96 +i_66 = $A5BE ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::show_intro_text::0::36:96 +_dafuq = $A5BE ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::show_intro_text::0::36:96 +i_67 = $A562 ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::show_intro_text::0::36:96 +i_68 = $A5E6 ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::show_intro_text::0::36:96 +i_69 = $A5F7 ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::do_cutscene::0::41:154 +i_70 = $A5FA ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::do_cutscene::0::41:154 +i_73 = $A61A ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::do_cutscene::0::41:154 +i_71 = $A615 ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::do_cutscene::0::41:154 +i_72 = $A673 ; addr, local, , mk1_c, code_compiler, my/ci/extra_functions.h::do_cutscene::0::41:154 +i_74 = $A6D3 ; addr, local, , mk1_c, code_compiler, engine/general.h::collide::0::43:6 +_cm_two_points_at1_reset = $A6E5 ; addr, local, , mk1_c, code_compiler, engine/general.h::cm_two_points::0::44:14 +_cm_two_points_at1_do = $A6E8 ; addr, local, , mk1_c, code_compiler, engine/general.h::cm_two_points::0::44:14 +_cm_two_points_at1_done = $A702 ; addr, local, , mk1_c, code_compiler, engine/general.h::cm_two_points::0::44:14 +_cm_two_points_at2_reset = $A713 ; addr, local, , mk1_c, code_compiler, engine/general.h::cm_two_points::0::44:14 +_cm_two_points_at2_do = $A716 ; addr, local, , mk1_c, code_compiler, engine/general.h::cm_two_points::0::44:14 +_cm_two_points_at2_done = $A730 ; addr, local, , mk1_c, code_compiler, engine/general.h::cm_two_points::0::44:14 +rand16 = $A734 ; addr, local, , mk1_c, code_compiler, engine/general.h::rand::0::45:91 +nextrand = $A750 ; addr, local, , mk1_c, code_compiler, engine/general.h::rand::0::45:91 +i_76 = $A76E ; addr, local, , mk1_c, code_compiler, engine/general.h::abs::0::46:135 +i_77 = $A773 ; addr, local, , mk1_c, code_compiler, engine/general.h::abs::0::46:135 +clearb1 = $A779 ; addr, local, , mk1_c, code_compiler, engine/general.h::cortina::0::47:158 +clearb2 = $A77C ; addr, local, , mk1_c, code_compiler, engine/general.h::cortina::0::47:158 +repitatodo = $A788 ; addr, local, , mk1_c, code_compiler, engine/general.h::cortina::0::47:158 +bucle = $A78E ; addr, local, , mk1_c, code_compiler, engine/general.h::cortina::0::47:158 +bucle1 = $A791 ; addr, local, , mk1_c, code_compiler, engine/general.h::cortina::0::47:158 +bucle2 = $A799 ; addr, local, , mk1_c, code_compiler, engine/general.h::cortina::0::47:158 +i_78 = $A7AC ; addr, local, , mk1_c, code_compiler, engine/bullets.h::bullets_init::0::48:6 +i_79 = $A7C6 ; addr, local, , mk1_c, code_compiler, engine/bullets.h::bullets_init::0::48:6 +i_82 = $A804 ; addr, local, , mk1_c, code_compiler, engine/bullets.h::bullets_fire::0::51:53 +i_80 = $A7FD ; addr, local, , mk1_c, code_compiler, engine/bullets.h::bullets_fire::0::51:53 +i_81 = $A8F4 ; addr, local, , mk1_c, code_compiler, engine/bullets.h::bullets_fire::4::61:182 +i_83 = $A7FD ; addr, local, , mk1_c, code_compiler, engine/bullets.h::bullets_fire::4::61:182 +i_84 = $A840 ; addr, local, , mk1_c, code_compiler, engine/bullets.h::bullets_fire::0::51:53 +i_85 = $A878 ; addr, local, , mk1_c, code_compiler, engine/bullets.h::bullets_fire::0::51:53 +i_86 = $A864 ; addr, local, , mk1_c, code_compiler, engine/bullets.h::bullets_fire::0::51:53 +i_87 = $A878 ; addr, local, , mk1_c, code_compiler, engine/bullets.h::bullets_fire::0::51:53 +i_89 = $A8A0 ; addr, local, , mk1_c, code_compiler, engine/bullets.h::bullets_fire::0::51:53 +i_90 = $A8D5 ; addr, local, , mk1_c, code_compiler, engine/bullets.h::bullets_fire::0::51:53 +i_88 = $A8D5 ; addr, local, , mk1_c, code_compiler, engine/bullets.h::bullets_fire::0::51:53 +i_92_i_90 = $A8A0 ; addr, local, , mk1_c, code_compiler, engine/bullets.h::bullets_fire::0::51:53 +i_93 = $A8C0 ; addr, local, , mk1_c, code_compiler, engine/bullets.h::bullets_fire::0::51:53 +i_94 = $A8E6 ; addr, local, , mk1_c, code_compiler, engine/bullets.h::bullets_fire::0::51:53 +i_95 = $A8E6 ; addr, local, , mk1_c, code_compiler, engine/bullets.h::bullets_fire::0::51:53 +i_98 = $A901 ; addr, local, , mk1_c, code_compiler, engine/bullets.h::bullets_move::0::61:195 +i_96 = $A8FC ; addr, local, , mk1_c, code_compiler, engine/bullets.h::bullets_move::0::61:195 +i_97 = $A9E4 ; addr, local, , mk1_c, code_compiler, engine/bullets.h::bullets_move::0::61:195 +i_99 = $A8FC ; addr, local, , mk1_c, code_compiler, engine/bullets.h::bullets_move::0::61:195 +i_100 = $A96A ; addr, local, , mk1_c, code_compiler, engine/bullets.h::bullets_move::0::61:195 +i_101 = $A96A ; addr, local, , mk1_c, code_compiler, engine/bullets.h::bullets_move::0::61:195 +i_102 = $A991 ; addr, local, , mk1_c, code_compiler, engine/bullets.h::bullets_move::0::61:195 +i_103 = $A991 ; addr, local, , mk1_c, code_compiler, engine/bullets.h::bullets_move::0::61:195 +i_104 = $A9DE ; addr, local, , mk1_c, code_compiler, engine/bullets.h::bullets_move::0::61:195 +i_105 = $AA3F ; addr, local, , mk1_c, code_compiler, engine/c_levels.h::prepare_level::0::68:2 +i_108 = $ABD6 ; addr, local, , mk1_c, code_compiler, engine.h::addsign::0::75:78 +i_109 = $ABDE ; addr, local, , mk1_c, code_compiler, engine.h::addsign::0::75:78 +i_110 = $ABDF ; addr, local, , mk1_c, code_compiler, engine.h::espera_activa::0::76:86 +i_111 = $ABE7 ; addr, local, , mk1_c, code_compiler, engine.h::espera_activa::0::76:86 +i_114 = $ABE7 ; addr, local, , mk1_c, code_compiler, engine.h::espera_activa::0::76:86 +i_113 = $ABFA ; addr, local, , mk1_c, code_compiler, engine.h::espera_activa::0::76:86 +i_115 = $ABF0 ; addr, local, , mk1_c, code_compiler, engine.h::espera_activa::0::76:86 +i_112 = $ABF0 ; addr, local, , mk1_c, code_compiler, engine.h::espera_activa::0::76:86 +i_118 = $AC2F ; addr, local, , mk1_c, code_compiler, engine.h::draw_scr_background::0::78:196 +i_116 = $AC28 ; addr, local, , mk1_c, code_compiler, engine.h::draw_scr_background::0::78:196 +i_117 = $ACAC ; addr, local, , mk1_c, code_compiler, engine.h::draw_scr_background::0::78:196 +_draw_scr_packed_existing = $AC56 ; addr, local, , mk1_c, code_compiler, engine.h::draw_scr_background::0::78:196 +_draw_scr_packed_new = $AC41 ; addr, local, , mk1_c, code_compiler, engine.h::draw_scr_background::0::78:196 +_draw_scr_packed_done = $AC5B ; addr, local, , mk1_c, code_compiler, engine.h::draw_scr_background::0::78:196 +_draw_scr_packed_noalt = $AC8B ; addr, local, , mk1_c, code_compiler, engine.h::draw_scr_background::0::78:196 +_draw_scr_packed_alt = $AC77 ; addr, local, , mk1_c, code_compiler, engine.h::draw_scr_background::0::78:196 +_draw_scr_packed_alt_subst = $AC86 ; addr, local, , mk1_c, code_compiler, engine.h::draw_scr_background::0::78:196 +_advance_worm_no_inc_y = $ACA6 ; addr, local, , mk1_c, code_compiler, engine.h::draw_scr_background::0::78:196 +_hotspots_setup_done = $AD19 ; addr, local, , mk1_c, code_compiler, engine.h::draw_scr_hotspots_locks::0::80:362 +_hotspots_setup_do = $ACDF ; addr, local, , mk1_c, code_compiler, engine.h::draw_scr_hotspots_locks::0::80:362 +_hotspots_setup_set = $AD11 ; addr, local, , mk1_c, code_compiler, engine.h::draw_scr_hotspots_locks::0::80:362 +_hotspots_setup_set_refill = $AD10 ; addr, local, , mk1_c, code_compiler, engine.h::draw_scr_hotspots_locks::0::80:362 +i_119 = $AD38 ; addr, local, , mk1_c, code_compiler, engine.h::select_joyfunc::0::82:604 +i_122 = $AD38 ; addr, local, , mk1_c, code_compiler, engine.h::select_joyfunc::0::82:604 +i_121 = $AD38 ; addr, local, , mk1_c, code_compiler, engine.h::select_joyfunc::0::82:604 +i_123_i_122 = $AD4E ; addr, local, , mk1_c, code_compiler, engine.h::select_joyfunc::0::82:604 +i_120 = $AD7C ; addr, local, , mk1_c, code_compiler, engine.h::select_joyfunc::0::82:604 +i_124 = $ADD2 ; addr, local, , mk1_c, code_compiler, engine.h::distance::0::85:663 +i_125 = $ADD7 ; addr, local, , mk1_c, code_compiler, engine.h::distance::0::85:663 +i_126 = $AE34 ; addr, local, , mk1_c, code_compiler, engine.h::limit::0::86:672 +i_127 = $AE4A ; addr, local, , mk1_c, code_compiler, engine.h::limit::0::86:672 +_player_gravity_add = $AEF4 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::0::89:158 +_player_gravity_maximum = $AEFA ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::0::89:158 +_player_gravity_vy_set = $AEFD ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::0::89:158 +_player_gravity_done = $AF00 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::0::89:158 +_player_gravity_p_gotten_done = $AF0A ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::0::89:158 +i_128 = $AF27 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::1::91:272 +i_129 = $AF35 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::1::91:272 +i_130 = $AF48 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::1::91:272 +i_131 = $AFB9 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::93:304 +i_133 = $AF94 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::1::91:272 +i_132 = $AFB9 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::93:304 +i_135 = $B02A ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_137 = $B009 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::93:304 +i_138 = $B02A ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::93:304 +i_139 = $B009 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::93:304 +i_136 = $B02A ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_142_i_138 = $B009 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::93:304 +i_143 = $B050 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_144 = $B047 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_145 = $B04A ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_146 = $B0B0 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_148 = $B0C3 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_149 = $B0C6 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_150 = $B0E0 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_151 = $B0E8 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_152 = $B167 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_153 = $B121 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_155 = $B10D ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_154 = $B16B ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_157 = $B16B ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_158 = $B150 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_159 = $B16B ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_160 = $B16B ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_162 = $B188 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_163 = $B18B ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_161 = $B1DC ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_164 = $B1B6 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_165 = $B1D8 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_166 = $B1D8 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_167 = $B1D8 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_168 = $B1D8 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_169 = $B206 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_170 = $B206 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_171 = $B235 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::1::107:493 +i_172 = $B235 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::95:348 +i_173 = $B253 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::1::107:493 +i_174 = $B266 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::1::107:493 +i_175 = $B303 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::109:524 +i_177 = $B2B8 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::1::107:493 +i_176 = $B2E5 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::109:524 +i_179 = $B303 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::109:524 +i_180 = $B2FA ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::109:524 +i_181 = $B2FD ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::109:524 +i_182 = $B37C ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::111:557 +i_184 = $B332 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::109:524 +i_183 = $B35E ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::111:557 +i_186 = $B37C ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::111:557 +i_187 = $B373 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::111:557 +i_188 = $B376 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::3::111:557 +i_189 = $B3CF ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::2::112:605 +i_191 = $B3EF ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::2::112:605 +i_190 = $B3EF ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::2::112:605 +i_192_i_191 = $B3E5 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::2::112:605 +i_193 = $B3FA ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::2::112:605 +i_194 = $B420 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::2::112:605 +i_195 = $B43F ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::2::112:605 +i_196 = $B43F ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::2::112:605 +i_197 = $B454 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::2::112:605 +i_198 = $B454 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::2::112:605 +i_200 = $B47B ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::2::112:605 +i_199 = $B47B ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::2::112:605 +i_201_i_200 = $B462 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::2::112:605 +i_202 = $B4C3 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::2::112:605 +i_203 = $B499 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::2::112:605 +i_204 = $B4AB ; addr, local, , mk1_c, code_compiler, engine/player.h::player_move::2::112:605 +i_205 = $B4E5 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_deplete::0::121:753 +i_206 = $B4E8 ; addr, local, , mk1_c, code_compiler, engine/player.h::player_deplete::0::121:753 +i_209 = $B5BC ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_load::0::124:124 +i_207 = $B5B5 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_load::0::124:124 +i_208 = $B74D ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_load::3::127:193 +i_212 = $B657 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_load::3::126:144 +i_213 = $B674 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_load::3::126:144 +i_214 = $B674 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_load::3::126:144 +i_215 = $B674 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_load::3::126:144 +i_216 = $B674 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_load::3::126:144 +i_217 = $B69E ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_load::3::126:144 +i_211 = $B74A ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_load::4::127:190 +i_218 = $B766 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_kill::0::127:197 +i_221 = $B78A ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::0::128:212 +i_219 = $B785 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::0::128:212 +i_220 = $BE32 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::4::152:577 +i_222 = $B843 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::0::128:212 +i_223 = $B843 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::0::128:212 +i_224 = $B874 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::0::128:212 +i_225 = $B877 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::0::128:212 +i_228 = $B880 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::0::128:212 +i_229 = $B89D ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::0::128:212 +i_230 = $B89D ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::0::128:212 +i_231 = $B89D ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::0::128:212 +i_232 = $B89D ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::0::128:212 +i_233 = $B8E5 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::4::133:328 +i_227 = $BB1C ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::4::136:346 +_enems_lm_change_axis_x = $B8BA ; addr, local, , mk1_c, code_compiler, ./engine/enem_mods/enem_type_lineal.h::enems_move::4::133:0 +_enems_lm_change_axis_x_done = $B8C2 ; addr, local, , mk1_c, code_compiler, ./engine/enem_mods/enem_type_lineal.h::enems_move::4::133:0 +_enems_lm_change_axis_y = $B8DA ; addr, local, , mk1_c, code_compiler, ./engine/enem_mods/enem_type_lineal.h::enems_move::4::133:0 +_enems_lm_change_axis_y_done = $B8E2 ; addr, local, , mk1_c, code_compiler, ./engine/enem_mods/enem_type_lineal.h::enems_move::4::133:0 +i_236 = $B953 ; addr, local, , mk1_c, code_compiler, ./engine/enem_mods/enem_type_fanties.h::enems_move::4::133:0 +i_237 = $B965 ; addr, local, , mk1_c, code_compiler, ./engine/enem_mods/enem_type_fanties.h::enems_move::4::133:0 +i_239 = $B97F ; addr, local, , mk1_c, code_compiler, ./engine/enem_mods/enem_type_fanties.h::enems_move::4::133:0 +i_242 = $BA32 ; addr, local, , mk1_c, code_compiler, ./engine/enem_mods/enem_type_fanties.h::enems_move::4::133:0 +i_235 = $BA8E ; addr, local, , mk1_c, code_compiler, ./engine/enem_mods/enem_type_fanties.h::enems_move::4::133:0 +i_238 = $BA8E ; addr, local, , mk1_c, code_compiler, ./engine/enem_mods/enem_type_fanties.h::enems_move::4::133:0 +i_240 = $B9A1 ; addr, local, , mk1_c, code_compiler, ./engine/enem_mods/enem_type_fanties.h::enems_move::4::133:0 +i_241 = $BA8E ; addr, local, , mk1_c, code_compiler, ./engine/enem_mods/enem_type_fanties.h::enems_move::4::133:0 +i_243 = $BA8E ; addr, local, , mk1_c, code_compiler, ./engine/enem_mods/enem_type_fanties.h::enems_move::4::133:0 +i_245 = $BAE5 ; addr, local, , mk1_c, code_compiler, ./engine/enem_mods/enem_type_fanties.h::enems_move::4::133:0 +i_244 = $BAE5 ; addr, local, , mk1_c, code_compiler, ./engine/enem_mods/enem_type_fanties.h::enems_move::4::133:0 +i_246_i_245 = $BAD7 ; addr, local, , mk1_c, code_compiler, ./engine/enem_mods/enem_type_fanties.h::enems_move::4::133:0 +i_247 = $BDFB ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::4::152:577 +i_248 = $BB6A ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::4::136:346 +_enems_move_update_frame_done = $BB6A ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::4::136:346 +i_249 = $BC88 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::4::136:346 +i_250 = $BCB6 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::4::136:346 +i_251 = $BBD9 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::4::136:346 +i_253 = $BBD9 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::4::136:346 +i_252 = $BBD9 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::4::136:346 +i_254_i_253 = $BBAB ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::4::136:346 +i_256 = $BC0C ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::4::136:346 +i_258 = $BC57 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::4::136:346 +i_256_i_257 = $BC13 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::4::136:346 +i_257 = $BC0E ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::4::136:346 +i_259 = $BCB6 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::4::136:346 +i_255 = $BCB6 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::4::136:346 +i_261_i_259 = $BC57 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::4::136:346 +i_262 = $BCB6 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::7::146:514 +i_264 = $BCB6 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::5::144:439 +i_263 = $BCB6 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::7::146:514 +i_265_i_264 = $BCAA ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::5::144:439 +i_266 = $BCB6 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::7::146:514 +i_269 = $BCC2 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::7::146:514 +i_267 = $BCBD ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::7::146:514 +i_268 = $BDFB ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::7::146:514 +i_270 = $BCBD ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::7::146:514 +i_272 = $BCBD ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::7::146:514 +i_271 = $BCBD ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::7::146:514 +i_273_i_272 = $BD4D ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::7::146:514 +i_274 = $BD81 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::7::146:514 +i_275 = $BDBE ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::7::146:514 +i_276 = $BDF0 ; addr, local, , mk1_c, code_compiler, engine/enengine.h::enems_move::7::146:514 +i_277 = $BE4A ; addr, local, , mk1_c, code_compiler, engine/hotspots.h::hotspots_do::0::152:14 +i_278 = $BFC7 ; addr, local, , mk1_c, code_compiler, engine/hotspots.h::hotspots_do::3::156:132 +i_281 = $BE79 ; addr, local, , mk1_c, code_compiler, engine/hotspots.h::hotspots_do::0::152:14 +i_282 = $BE8C ; addr, local, , mk1_c, code_compiler, engine/hotspots.h::hotspots_do::0::152:14 +i_284 = $BF25 ; addr, local, , mk1_c, code_compiler, engine/hotspots.h::hotspots_do::0::152:14 +i_286 = $BF44 ; addr, local, , mk1_c, code_compiler, engine/hotspots.h::hotspots_do::0::152:14 +i_280 = $BF76 ; addr, local, , mk1_c, code_compiler, engine/hotspots.h::hotspots_do::3::156:132 +i_283 = $BF76 ; addr, local, , mk1_c, code_compiler, engine/hotspots.h::hotspots_do::0::152:14 +i_285 = $BF39 ; addr, local, , mk1_c, code_compiler, engine/hotspots.h::hotspots_do::0::152:14 +i_287 = $BF66 ; addr, local, , mk1_c, code_compiler, engine/hotspots.h::hotspots_do::0::152:14 +i_288 = $BF6B ; addr, local, , mk1_c, code_compiler, engine/hotspots.h::hotspots_do::0::152:14 +i_289 = $BFC7 ; addr, local, , mk1_c, code_compiler, engine/hotspots.h::hotspots_do::3::156:132 +i_292 = $C020 ; addr, local, , mk1_c, code_compiler, mainloop.h::main::0::158:7 +i_293 = $C04C ; addr, local, , mk1_c, code_compiler, mainloop.h::main::0::158:7 +i_290 = $C04C ; addr, local, , mk1_c, code_compiler, mainloop.h::main::0::158:7 +i_291 = $C053 ; addr, local, , mk1_c, code_compiler, mainloop.h::main::0::158:7 +i_296 = $C094 ; addr, local, , mk1_c, code_compiler, mainloop.h::main::0::158:7 +i_294 = $C08F ; addr, local, , mk1_c, code_compiler, mainloop.h::main::0::158:7 +i_295 = $C116 ; addr, local, , mk1_c, code_compiler, mainloop.h::main::0::158:7 +i_299 = $C122 ; addr, local, , mk1_c, code_compiler, mainloop.h::main::0::158:7 +i_297 = $C11D ; addr, local, , mk1_c, code_compiler, mainloop.h::main::0::158:7 +i_298 = $C168 ; addr, local, , mk1_c, code_compiler, mainloop.h::main::0::158:7 +i_302 = $C179 ; addr, local, , mk1_c, code_compiler, my/ci/after_load.h::main::1::162:0 +i_300 = $C172 ; addr, local, , mk1_c, code_compiler, my/ci/after_load.h::main::1::162:0 +i_301 = $C1B0 ; addr, local, , mk1_c, code_compiler, my/ci/after_load.h::main::1::162:0 +i_303 = $C1E3 ; addr, local, , mk1_c, code_compiler, my/ci/after_load.h::main::1::162:0 +i_304 = $C220 ; addr, local, , mk1_c, code_compiler, my/ci/after_load.h::main::1::162:0 +i_306 = $C210 ; addr, local, , mk1_c, code_compiler, my/ci/after_load.h::main::1::162:0 +i_305 = $C1E3 ; addr, local, , mk1_c, code_compiler, my/ci/after_load.h::main::1::162:0 +i_308 = $C223 ; addr, local, , mk1_c, code_compiler, mainloop.h::main::1::164:105 +i_310 = $C264 ; addr, local, , mk1_c, code_compiler, my/title_screen.h::main::2::165:0 +i_311 = $C267 ; addr, local, , mk1_c, code_compiler, my/title_screen.h::main::2::165:0 +i_312 = $C284 ; addr, local, , mk1_c, code_compiler, my/title_screen.h::main::2::165:0 +i_313 = $C287 ; addr, local, , mk1_c, code_compiler, my/title_screen.h::main::2::165:0 +i_314 = $C2A8 ; addr, local, , mk1_c, code_compiler, my/title_screen.h::main::2::165:0 +i_315 = $C2DD ; addr, local, , mk1_c, code_compiler, my/title_screen.h::main::2::165:0 +i_318 = $C2BE ; addr, local, , mk1_c, code_compiler, my/title_screen.h::main::2::165:0 +i_319 = $C2CC ; addr, local, , mk1_c, code_compiler, my/title_screen.h::main::2::165:0 +i_320 = $C2D3 ; addr, local, , mk1_c, code_compiler, my/title_screen.h::main::2::165:0 +i_317 = $C2A8 ; addr, local, , mk1_c, code_compiler, my/title_screen.h::main::2::165:0 +i_321 = $C2F7 ; addr, local, , mk1_c, code_compiler, mainloop.h::main::2::168:122 +i_323 = $C443 ; addr, local, , mk1_c, code_compiler, mainloop.h::main::4::177:160 +i_324 = $C31D ; addr, local, , mk1_c, code_compiler, my/level_screen.h::main::4::170:0 +i_325 = $C334 ; addr, local, , mk1_c, code_compiler, my/level_screen.h::main::4::170:0 +i_326 = $C334 ; addr, local, , mk1_c, code_compiler, my/level_screen.h::main::4::170:0 +i_329 = $C354 ; addr, local, , mk1_c, code_compiler, my/level_screen.h::main::4::170:0 +i_330 = $C357 ; addr, local, , mk1_c, code_compiler, my/level_screen.h::main::4::170:0 +i_331 = $C3D1 ; addr, local, , mk1_c, code_compiler, my/level_screen.h::main::4::170:0 +i_334 = $C3A9 ; addr, local, , mk1_c, code_compiler, my/level_screen.h::main::4::170:0 +i_332 = $C3A2 ; addr, local, , mk1_c, code_compiler, my/level_screen.h::main::4::170:0 +i_333 = $C3D1 ; addr, local, , mk1_c, code_compiler, my/level_screen.h::main::4::170:0 +i_337 = $C3F3 ; addr, local, , mk1_c, code_compiler, my/level_screen.h::main::4::170:0 +i_335 = $C3EC ; addr, local, , mk1_c, code_compiler, my/level_screen.h::main::4::170:0 +i_336 = $C42D ; addr, local, , mk1_c, code_compiler, my/level_screen.h::main::4::170:0 +i_340 = $C40A ; addr, local, , mk1_c, code_compiler, my/level_screen.h::main::4::170:0 +i_338 = $C403 ; addr, local, , mk1_c, code_compiler, my/level_screen.h::main::4::170:0 +i_339 = $C3EC ; addr, local, , mk1_c, code_compiler, my/level_screen.h::main::4::170:0 +_game_loop_init = $C460 ; addr, local, , mk1_c, code_compiler, mainloop/game_loop.h::main::3::177:0 +i_341 = $C4CB ; addr, local, , mk1_c, code_compiler, mainloop/game_loop.h::main::3::177:58 +i_342 = $C902 ; addr, local, , mk1_c, code_compiler, mainloop/game_loop.h::main::4::202:357 +_game_loop_do = $C4D3 ; addr, local, , mk1_c, code_compiler, mainloop/game_loop.h::main::3::177:58 +i_343 = $C525 ; addr, local, , mk1_c, code_compiler, mainloop/game_loop.h::main::5::179:113 +i_344 = $C519 ; addr, local, , mk1_c, code_compiler, mainloop/game_loop.h::main::5::179:113 +i_345 = $C558 ; addr, local, , mk1_c, code_compiler, ./mainloop/hud.h::main::4::181:0 +i_346 = $C558 ; addr, local, , mk1_c, code_compiler, mainloop/game_loop.h::main::5::179:113 +i_347 = $C558 ; addr, local, , mk1_c, code_compiler, mainloop/game_loop.h::main::5::179:113 +i_348 = $C583 ; addr, local, , mk1_c, code_compiler, ./mainloop/hud.h::main::4::181:0 +i_349 = $C5B1 ; addr, local, , mk1_c, code_compiler, mainloop/game_loop.h::main::4::183:177 +i_350 = $C5EC ; addr, local, , mk1_c, code_compiler, mainloop/game_loop.h::main::6::185:196 +i_351 = $C5E5 ; addr, local, , mk1_c, code_compiler, mainloop/game_loop.h::main::6::185:196 +i_352 = $C5EC ; addr, local, , mk1_c, code_compiler, mainloop/game_loop.h::main::6::185:196 +i_353 = $C757 ; addr, local, , mk1_c, code_compiler, mainloop/game_loop.h::main::5::192:220 +i_356 = $C60B ; addr, local, , mk1_c, code_compiler, ./mainloop/update_sprites.h::main::5::186:0 +i_354 = $C606 ; addr, local, , mk1_c, code_compiler, ./mainloop/update_sprites.h::main::5::186:0 +i_355 = $C62A ; addr, local, , mk1_c, code_compiler, ./mainloop/update_sprites.h::main::5::186:0 +i_358 = $C63D ; addr, local, , mk1_c, code_compiler, ./mainloop/update_sprites.h::main::5::186:0 +i_357 = $C67B ; addr, local, , mk1_c, code_compiler, ./mainloop/update_sprites.h::main::5::186:0 +i_360 = $C698 ; addr, local, , mk1_c, code_compiler, ./mainloop/update_sprites.h::main::5::186:0 +i_363 = $C6AA ; addr, local, , mk1_c, code_compiler, ./mainloop/update_sprites.h::main::5::186:0 +i_361 = $C6A5 ; addr, local, , mk1_c, code_compiler, ./mainloop/update_sprites.h::main::5::186:0 +i_362 = $C746 ; addr, local, , mk1_c, code_compiler, ./mainloop/update_sprites.h::main::5::186:0 +i_364 = $C721 ; addr, local, , mk1_c, code_compiler, ./mainloop/update_sprites.h::main::5::186:0 +i_365 = $C6A5 ; addr, local, , mk1_c, code_compiler, ./mainloop/update_sprites.h::main::5::186:0 +ml_min_faps_loop = $C746 ; addr, local, , mk1_c, code_compiler, mainloop/game_loop.h::main::5::192:220 +ml_min_faps_loop_end = $C750 ; addr, local, , mk1_c, code_compiler, mainloop/game_loop.h::main::5::192:220 +i_366 = $C772 ; addr, local, , mk1_c, code_compiler, mainloop/game_loop.h::main::5::192:220 +i_367 = $C772 ; addr, local, , mk1_c, code_compiler, mainloop/game_loop.h::main::5::192:220 +i_368 = $C7AB ; addr, local, , mk1_c, code_compiler, mainloop/game_loop.h::main::5::192:220 +i_369 = $C792 ; addr, local, , mk1_c, code_compiler, mainloop/game_loop.h::main::5::192:220 +i_370 = $C7A0 ; addr, local, , mk1_c, code_compiler, mainloop/game_loop.h::main::5::192:220 +i_371 = $C7BF ; addr, local, , mk1_c, code_compiler, mainloop/game_loop.h::main::5::192:220 +i_373 = $C7F1 ; addr, local, , mk1_c, code_compiler, ./mainloop/flick_screen.h::main::5::196:0 +i_372 = $C7F1 ; addr, local, , mk1_c, code_compiler, ./mainloop/flick_screen.h::main::5::196:0 +i_374_i_373 = $C7D8 ; addr, local, , mk1_c, code_compiler, ./mainloop/flick_screen.h::main::5::196:0 +i_376 = $C834 ; addr, local, , mk1_c, code_compiler, ./mainloop/flick_screen.h::main::5::196:0 +i_375 = $C834 ; addr, local, , mk1_c, code_compiler, ./mainloop/flick_screen.h::main::5::196:0 +i_377_i_376 = $C81A ; addr, local, , mk1_c, code_compiler, ./mainloop/flick_screen.h::main::5::196:0 +i_379 = $C871 ; addr, local, , mk1_c, code_compiler, ./mainloop/flick_screen.h::main::5::196:0 +i_378 = $C871 ; addr, local, , mk1_c, code_compiler, ./mainloop/flick_screen.h::main::5::196:0 +i_380_i_379 = $C84D ; addr, local, , mk1_c, code_compiler, ./mainloop/flick_screen.h::main::5::196:0 +i_382 = $C8C8 ; addr, local, , mk1_c, code_compiler, ./mainloop/flick_screen.h::main::5::196:0 +i_381 = $C8C8 ; addr, local, , mk1_c, code_compiler, mainloop/game_loop.h::main::5::200:319 +i_383_i_382 = $C89A ; addr, local, , mk1_c, code_compiler, ./mainloop/flick_screen.h::main::5::196:0 +i_384 = $C8C8 ; addr, local, , mk1_c, code_compiler, ./mainloop/flick_screen.h::main::5::196:0 +i_386 = $C8E0 ; addr, local, , mk1_c, code_compiler, mainloop/game_loop.h::main::5::200:319 +i_385 = $C8E9 ; addr, local, , mk1_c, code_compiler, mainloop/game_loop.h::main::5::200:319 +i_389 = $C8F8 ; addr, local, , mk1_c, code_compiler, mainloop/game_loop.h::main::5::200:319 +i_388 = $C4CB ; addr, local, , mk1_c, code_compiler, mainloop/game_loop.h::main::4::202:357 +i_391 = $C93A ; addr, local, , mk1_c, code_compiler, mainloop.h::main::3::202:184 +i_392 = $C91C ; addr, local, , mk1_c, code_compiler, mainloop.h::main::3::202:184 +i_393 = $C928 ; addr, local, , mk1_c, code_compiler, mainloop.h::main::3::202:184 +i_394 = $C951 ; addr, local, , mk1_c, code_compiler, mainloop.h::main::3::202:184 +i_322 = $C957 ; addr, local, , mk1_c, code_compiler, mainloop.h::main::3::202:184 +i_395 = $C951 ; addr, local, , mk1_c, code_compiler, mainloop.h::main::3::202:184 +i_396 = $C948 ; addr, local, , mk1_c, code_compiler, mainloop.h::main::3::202:184 +i_397 = $C94B ; addr, local, , mk1_c, code_compiler, mainloop.h::main::3::202:184 +i_309 = $C95D ; addr, local, , mk1_c, code_compiler, mainloop.h::main::3::202:184 +ib1 = $5DE8 ; addr, local, , SPAddMemory, , blockmemoryalloc/SPAddMemory.asm:36 +ib2 = $5DEF ; addr, local, , SPAddMemory, , blockmemoryalloc/SPAddMemory.asm:44 +keyok = $C9D7 ; addr, local, , sp_GetKey_c, code_compiler, sp_GetKey.c::sp_GetKey::0::0:15 +AYREG_128 = $FFFD ; const, local, , SPTileEntry, , SPconfig.def:82 +AYDAT_128 = $BFFD ; const, local, , SPTileEntry, , SPconfig.def:83 +noinc = $5E3B ; addr, local, , SPTileEntry, , backgroundtiles/SPTileEntry.asm:24 +DISP_HIRES = $0000 ; const, local, , SPCompDListAddr, , SPconfig.def:18 +SProtatetbl = $F000 ; const, local, , SPCompDListAddr, , SPconfig.def:51 +AYREG_128 = $FFFD ; const, local, , SPCompDListAddr, , SPconfig.def:82 +AYDAT_128 = $BFFD ; const, local, , SPCompDListAddr, , SPconfig.def:83 +DISP_HIRES = $0000 ; const, local, , SPCompDirtyAddr, , SPconfig.def:18 +AYREG_128 = $FFFD ; const, local, , SPCompDirtyAddr, , SPconfig.def:82 +AYDAT_128 = $BFFD ; const, local, , SPCompDirtyAddr, , SPconfig.def:83 +DISP_HIRES = $0000 ; const, local, , SPDirtyChars, , SPconfig.def:18 +DISP_TMXDUAL = $0000 ; const, local, , SPDirtyChars, , SPconfig.def:21 +SP_ROWSTART = $0000 ; const, local, , SPDirtyChars, , SPconfig.def:30 +SP_ROWEND = $0018 ; const, local, , SPDirtyChars, , SPconfig.def:31 +AYREG_128 = $FFFD ; const, local, , SPDirtyChars, , SPconfig.def:82 +AYDAT_128 = $BFFD ; const, local, , SPDirtyChars, , SPconfig.def:83 +DISP_HIRES = $0000 ; const, local, , SPDisplayList, , SPconfig.def:18 +SP_ROWSTART = $0000 ; const, local, , SPDisplayList, , SPconfig.def:30 +SP_ROWEND = $0018 ; const, local, , SPDisplayList, , SPconfig.def:31 +AYREG_128 = $FFFD ; const, local, , SPDisplayList, , SPconfig.def:82 +AYDAT_128 = $BFFD ; const, local, , SPDisplayList, , SPconfig.def:83 +NUMQUEUES = $0001 ; const, local, , SPqueuetable, , SPconfig.def:73 +AYREG_128 = $FFFD ; const, local, , SPqueuetable, , SPconfig.def:82 +AYDAT_128 = $BFFD ; const, local, , SPqueuetable, , SPconfig.def:83 +DISP_HICOLOUR = $0000 ; const, local, , SPTileArray, , SPconfig.def:15 +AYREG_128 = $FFFD ; const, local, , SPTileArray, , SPconfig.def:82 +AYDAT_128 = $BFFD ; const, local, , SPTileArray, , SPconfig.def:83 +state = $6CD3 ; addr, local, , SPGetKey, , input/SPGetKey.asm:30 +count = $6CD4 ; addr, local, , SPGetKey, , input/SPGetKey.asm:32 +scanloop = $6CF0 ; addr, local, , SPGetKey, , input/SPGetKey.asm:80 +keyrowloop = $6CF4 ; addr, local, , SPGetKey, , input/SPGetKey.asm:84 +nopress = $6D04 ; addr, local, , SPGetKey, , input/SPGetKey.asm:95 +toomanykeys = $6D55 ; addr, local, , SPGetKey, , input/SPGetKey.asm:154 +nextscanrow = $6D09 ; addr, local, , SPGetKey, , input/SPGetKey.asm:100 +nokeys = $6D55 ; addr, local, , SPGetKey, , input/SPGetKey.asm:155 +atmaxcount = $6D1A ; addr, local, , SPGetKey, , input/SPGetKey.asm:112 +skip = $6D31 ; addr, local, , SPGetKey, , input/SPGetKey.asm:126 +nocaps = $6D47 ; addr, local, , SPGetKey, , input/SPGetKey.asm:141 +nosym = $6D52 ; addr, local, , SPGetKey, , input/SPGetKey.asm:149 +kemptbl = $6E08 ; addr, local, , SPJoyKempston, , input/SPJoyKempston.asm:27 +nofire = $6E35 ; addr, local, , SPJoyKeyboard, , input/SPJoyKeyboard.asm:36 +jkloop = $6E35 ; addr, local, , SPJoyKeyboard, , input/SPJoyKeyboard.asm:37 +nopress = $6E40 ; addr, local, , SPJoyKeyboard, , input/SPJoyKeyboard.asm:48 +sinc1tbl = $6E53 ; addr, local, , SPJoySinclair1, , input/SPJoySinclair1.asm:25 +nocaps = $6E7F ; addr, local, , SPKeyPressed, , input/SPKeyPressed.asm:25 +nosym = $6E8B ; addr, local, , SPKeyPressed, , input/SPKeyPressed.asm:34 +noinc = $6E9D ; addr, local, , SPtbllookup, , input/SPtbllookup.asm:17 +GenericISR = $6EB2 ; addr, local, , SPCreateGenericISR, , interrupts/SPCreateGenericISR.asm:37 +pushreg = $6EBE ; addr, local, , SPCreateGenericISR, , interrupts/SPCreateGenericISR.asm:44 +position = $6EB5 ; addr, local, , SPCreateGenericISR, , interrupts/SPCreateGenericISR.asm:39 +runhooks = $6ECE ; addr, local, , SPCreateGenericISR, , interrupts/SPCreateGenericISR.asm:61 +popreg = $6EE0 ; addr, local, , SPCreateGenericISR, , interrupts/SPCreateGenericISR.asm:77 +JPHL = $6ECD ; addr, local, , SPCreateGenericISR, , interrupts/SPCreateGenericISR.asm:58 +IM2TABLE = $F000 ; const, local, , SPInitIM2, , SPconfig.def:62 +EVENVECTORS = $0000 ; const, local, , SPInitIM2, , SPconfig.def:66 +AYREG_128 = $FFFD ; const, local, , SPInitIM2, , SPconfig.def:82 +AYDAT_128 = $BFFD ; const, local, , SPInitIM2, , SPconfig.def:83 +IM2TABLE = $F000 ; const, local, , SPRegisterHookLast, , SPconfig.def:62 +AYREG_128 = $FFFD ; const, local, , SPRegisterHookLast, , SPconfig.def:82 +AYDAT_128 = $BFFD ; const, local, , SPRegisterHookLast, , SPconfig.def:83 +loop = $6F12 ; addr, local, , SPRegisterHookLast, , interrupts/SPRegisterHookLast.asm:35 +done = $6F1D ; addr, local, , SPRegisterHookLast, , interrupts/SPRegisterHookLast.asm:45 +DISP_HIRES = $0000 ; const, local, , SPBorder, , SPconfig.def:18 +AYREG_128 = $FFFD ; const, local, , SPBorder, , SPconfig.def:82 +AYDAT_128 = $BFFD ; const, local, , SPBorder, , SPconfig.def:83 +DISP_HICOLOUR = $0000 ; const, local, , SPInitialize, , SPconfig.def:15 +DISP_HIRES = $0000 ; const, local, , SPInitialize, , SPconfig.def:18 +SP_ROWSTART = $0000 ; const, local, , SPInitialize, , SPconfig.def:30 +SP_ROWEND = $0018 ; const, local, , SPInitialize, , SPconfig.def:31 +SProtatetbl = $F000 ; const, local, , SPInitialize, , SPconfig.def:51 +AYREG_128 = $FFFD ; const, local, , SPInitialize, , SPconfig.def:82 +AYDAT_128 = $BFFD ; const, local, , SPInitialize, , SPconfig.def:83 +rottbllp = $6F55 ; addr, local, , SPInitialize, , miscellaneous/SPInitialize.asm:62 +entrylp = $6F5C ; addr, local, , SPInitialize, , miscellaneous/SPInitialize.asm:68 +rotlp = $6F5F ; addr, local, , SPInitialize, , miscellaneous/SPInitialize.asm:72 +loop = $6F78 ; addr, local, , SPInitialize, , miscellaneous/SPInitialize.asm:101 +usertile = $6F8D ; addr, local, , SPInitialize, , miscellaneous/SPInitialize.asm:134 +cont1 = $6F80 ; addr, local, , SPInitialize, , miscellaneous/SPInitialize.asm:109 +noadd = $6F8A ; addr, local, , SPInitialize, , miscellaneous/SPInitialize.asm:130 +DISP_HICOLOUR = $0000 ; const, local, , SPAddColSpr, , SPconfig.def:15 +COMPRESS = $0000 ; const, local, , SPAddColSpr, , SPconfig.def:44 +AYREG_128 = $FFFD ; const, local, , SPAddColSpr, , SPconfig.def:82 +AYDAT_128 = $BFFD ; const, local, , SPAddColSpr, , SPconfig.def:83 +acnocry = $6F9F ; addr, local, , SPAddColSpr, , sprites/SPAddColSpr.asm:39 +acloop = $6FB0 ; addr, local, , SPAddColSpr, , sprites/SPAddColSpr.asm:48 +JPHL = $703B ; addr, local, , SPAddColSpr, , sprites/SPAddColSpr.asm:176 +acfail = $702A ; addr, local, , SPAddColSpr, , sprites/SPAddColSpr.asm:164 +noinc1 = $6FEC ; addr, local, , SPAddColSpr, , sprites/SPAddColSpr.asm:95 +acnocry3 = $7000 ; addr, local, , SPAddColSpr, , sprites/SPAddColSpr.asm:131 +DISP_HICOLOUR = $0000 ; const, local, , SPCreateSpr, , SPconfig.def:15 +DISP_HIRES = $0000 ; const, local, , SPCreateSpr, , SPconfig.def:18 +COMPRESS = $0000 ; const, local, , SPCreateSpr, , SPconfig.def:44 +SProtatetbl = $F000 ; const, local, , SPCreateSpr, , SPconfig.def:51 +AYREG_128 = $FFFD ; const, local, , SPCreateSpr, , SPconfig.def:82 +AYDAT_128 = $BFFD ; const, local, , SPCreateSpr, , SPconfig.def:83 +JPHL = $70DB ; addr, local, , SPCreateSpr, , sprites/SPCreateSpr.asm:205 +csfail1 = $70D0 ; addr, local, , SPCreateSpr, , sprites/SPCreateSpr.asm:192 +csfail2 = $70D2 ; addr, local, , SPCreateSpr, , sprites/SPCreateSpr.asm:196 +csenter = $709B ; addr, local, , SPCreateSpr, , sprites/SPCreateSpr.asm:115 +csloop = $7087 ; addr, local, , SPCreateSpr, , sprites/SPCreateSpr.asm:100 +notcompress = $70AD ; addr, local, , SPCreateSpr, , sprites/SPCreateSpr.asm:153 +cont = $70B2 ; addr, local, , SPCreateSpr, , sprites/SPCreateSpr.asm:157 +csnocry = $70C6 ; addr, local, , SPCreateSpr, , sprites/SPCreateSpr.asm:185 +DISP_HICOLOUR = $0000 ; const, local, , SPNullSprPtr, , SPconfig.def:15 +AYREG_128 = $FFFD ; const, local, , SPNullSprPtr, , SPconfig.def:82 +AYDAT_128 = $BFFD ; const, local, , SPNullSprPtr, , SPconfig.def:83 +AYREG_128 = $FFFD ; const, local, , SPDeleteSpr, , SPconfig.def:82 +AYDAT_128 = $BFFD ; const, local, , SPDeleteSpr, , SPconfig.def:83 +loop = $70F0 ; addr, local, , SPDeleteSpr, , sprites/SPDeleteSpr.asm:27 +JPHL = $7105 ; addr, local, , SPDeleteSpr, , sprites/SPDeleteSpr.asm:46 +DISP_HICOLOUR = $0000 ; const, local, , SPMoveSprAbs, , SPconfig.def:15 +DISP_HIRES = $0000 ; const, local, , SPMoveSprAbs, , SPconfig.def:18 +SP_ROWSTART = $0000 ; const, local, , SPMoveSprAbs, , SPconfig.def:30 +SP_ROWEND = $0018 ; const, local, , SPMoveSprAbs, , SPconfig.def:31 +COMPRESS = $0000 ; const, local, , SPMoveSprAbs, , SPconfig.def:44 +SProtatetbl = $F000 ; const, local, , SPMoveSprAbs, , SPconfig.def:51 +USEPLANES = $0000 ; const, local, , SPMoveSprAbs, , SPconfig.def:56 +AYREG_128 = $FFFD ; const, local, , SPMoveSprAbs, , SPconfig.def:82 +AYDAT_128 = $BFFD ; const, local, , SPMoveSprAbs, , SPconfig.def:83 +computedisp = $7238 ; addr, local, , SPMoveSprAbs, , sprites/SPMoveSprAbs.asm:307 +adjloop = $7121 ; addr, local, , SPMoveSprAbs, , sprites/SPMoveSprAbs.asm:47 +invalidate = $7229 ; addr, local, , SPMoveSprAbs, , sprites/SPMoveSprAbs.asm:299 +adjustgraphics = $725B ; addr, local, , SPMoveSprAbs, , sprites/SPMoveSprAbs.asm:358 +yinscreen = $7147 ; addr, local, , SPMoveSprAbs, , sprites/SPMoveSprAbs.asm:75 +xinscreen = $7157 ; addr, local, , SPMoveSprAbs, , sprites/SPMoveSprAbs.asm:95 +mvcolloop = $716E ; addr, local, , SPMoveSprAbs, , sprites/SPMoveSprAbs.asm:116 +mvrowloop = $7174 ; addr, local, , SPMoveSprAbs, , sprites/SPMoveSprAbs.asm:120 +notdone = $717E ; addr, local, , SPMoveSprAbs, , sprites/SPMoveSprAbs.asm:128 +notinDList = $71AA ; addr, local, , SPMoveSprAbs, , sprites/SPMoveSprAbs.asm:175 +noinc1 = $7196 ; addr, local, , SPMoveSprAbs, , sprites/SPMoveSprAbs.asm:152 +nonext1 = $71AA ; addr, local, , SPMoveSprAbs, , sprites/SPMoveSprAbs.asm:174 +notdisplayed = $720E ; addr, local, , SPMoveSprAbs, , sprites/SPMoveSprAbs.asm:269 +noinc2 = $71CF ; addr, local, , SPMoveSprAbs, , sprites/SPMoveSprAbs.asm:200 +pdloop = $71C7 ; addr, local, , SPMoveSprAbs, , sprites/SPMoveSprAbs.asm:193 +puthere = $71D8 ; addr, local, , SPMoveSprAbs, , sprites/SPMoveSprAbs.asm:216 +noinc3 = $71E7 ; addr, local, , SPMoveSprAbs, , sprites/SPMoveSprAbs.asm:230 +nodec1 = $71F5 ; addr, local, , SPMoveSprAbs, , sprites/SPMoveSprAbs.asm:243 +noinc4 = $7201 ; addr, local, , SPMoveSprAbs, , sprites/SPMoveSprAbs.asm:254 +nonext2 = $720E ; addr, local, , SPMoveSprAbs, , sprites/SPMoveSprAbs.asm:268 +notnegative = $7256 ; addr, local, , SPMoveSprAbs, , sprites/SPMoveSprAbs.asm:350 +noinc5 = $7267 ; addr, local, , SPMoveSprAbs, , sprites/SPMoveSprAbs.asm:369 +skip1 = $7277 ; addr, local, , SPMoveSprAbs, , sprites/SPMoveSprAbs.asm:388 +skip2 = $7287 ; addr, local, , SPMoveSprAbs, , sprites/SPMoveSprAbs.asm:407 +DISP_HIRES = $0000 ; const, local, , SPInvalidate, , SPconfig.def:18 +AYREG_128 = $FFFD ; const, local, , SPInvalidate, , SPconfig.def:82 +AYDAT_128 = $BFFD ; const, local, , SPInvalidate, , SPconfig.def:83 +noinc1 = $72AB ; addr, local, , SPInvalidate, , updater/SPInvalidate.asm:54 +invcollp = $72AF ; addr, local, , SPInvalidate, , updater/SPInvalidate.asm:60 +invfullchar = $72C2 ; addr, local, , SPInvalidate, , updater/SPInvalidate.asm:78 +noinc2 = $72BE ; addr, local, , SPInvalidate, , updater/SPInvalidate.asm:72 +invrowlp = $72C4 ; addr, local, , SPInvalidate, , updater/SPInvalidate.asm:82 +noinc3 = $72CF ; addr, local, , SPInvalidate, , updater/SPInvalidate.asm:96 +tryotherway = $7332 ; addr, local, , SPIntRect, , miscellaneous/SPIntRect.asm:97 +broken = $734F ; addr, local, , SPIntRect, , miscellaneous/SPIntRect.asm:131 +DISP_SPECTRUM = $0001 ; const, local, , SPUpdateNow, , SPconfig.def:12 +DISP_HICOLOUR = $0000 ; const, local, , SPUpdateNow, , SPconfig.def:15 +DISP_HIRES = $0000 ; const, local, , SPUpdateNow, , SPconfig.def:18 +DISP_TMXDUAL = $0000 ; const, local, , SPUpdateNow, , SPconfig.def:21 +SP_ROWSTART = $0000 ; const, local, , SPUpdateNow, , SPconfig.def:30 +SP_ROWEND = $0018 ; const, local, , SPUpdateNow, , SPconfig.def:31 +NOFLICKER = $0001 ; const, local, , SPUpdateNow, , SPconfig.def:36 +SCROLLER = $0000 ; const, local, , SPUpdateNow, , SPconfig.def:40 +COMPRESS = $0000 ; const, local, , SPUpdateNow, , SPconfig.def:44 +AYREG_128 = $FFFD ; const, local, , SPUpdateNow, , SPconfig.def:82 +AYDAT_128 = $BFFD ; const, local, , SPUpdateNow, , SPconfig.def:83 +tempgraphic = $7356 ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:76 +tempcolour = $735E ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:85 +dosprites = $7360 ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:92 +dirtyloop = $736D ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:113 +dirtyarea = $7393 ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:184 +notacrossblk1 = $737D ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:136 +noinc1 = $7385 ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:150 +reenter = $7385 ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:151 +drawchar = $7403 ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:364 +notacrossblk2 = $73CD ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:257 +tileonly = $73D4 ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:276 +noinc11 = $73DF ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:326 +nomoresprites = $7595 ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:1266 +notload = $7431 ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:495 +loadtype = $75EE ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:1436 +noinc10 = $743C ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:503 +spriteloop = $7451 ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:554 +dosprite = $7455 ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:569 +skip_sprite_update = $7567 ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:1169 +xortype = $767B ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:1845 +ortype = $7733 ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:2194 +masknorotate = $75A3 ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:1294 +coloursprite = $7566 ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:1167 +clear = $7568 ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:1178 +copybuffer = $7573 ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:1196 +skipupdatecol = $75A0 ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:1286 +loadnorotate = $765C ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:1688 +xornorotate = $7701 ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:2065 +ornorotate = $77B9 ; addr, local, , SPUpdateNow, , updater/SPUpdateNow.asm:2414 +l_asr1 = $D08A ; addr, local, , l_asr, code_crt0_sccz80, sccz80/crt0_z80/l_asr.asm:17 +__CLIB_OPT_IMATH = $0000 ; const, local, , l_divu_16_16x16, , ../config_private.inc:27 +divide_zero = $D146 ; addr, local, , l_small_divu_16_16x16, code_math, ../_DEVELOPMENT/math/integer/small/l_small_divu_16_16x16.asm:141 +divisor_sixteen_bit = $D118 ; addr, local, , l_small_divu_16_16x16, code_math, ../_DEVELOPMENT/math/integer/small/l_small_divu_16_16x16.asm:50 +loop_16_0 = $D11E ; addr, local, , l_small_divu_16_16x16, code_math, ../_DEVELOPMENT/math/integer/small/l_small_divu_16_16x16.asm:60 +loop_16_1 = $D126 ; addr, local, , l_small_divu_16_16x16, code_math, ../_DEVELOPMENT/math/integer/small/l_small_divu_16_16x16.asm:69 +loop_8_0 = $D138 ; addr, local, , l_small_divu_16_16x16, code_math, ../_DEVELOPMENT/math/integer/small/l_small_divu_16_16x16.asm:118 +loop_8_2 = $D13F ; addr, local, , l_small_divu_16_16x16, code_math, ../_DEVELOPMENT/math/integer/small/l_small_divu_16_16x16.asm:127 +loop_8_1 = $D141 ; addr, local, , l_small_divu_16_16x16, code_math, ../_DEVELOPMENT/math/integer/small/l_small_divu_16_16x16.asm:132 +l_sxt = $D09E ; addr, local, , l_gchar, code_crt0_sccz80, sccz80/crt0_z80/l_gchar.asm:12 +__CLIB_OPT_IMATH = $0000 ; const, local, , l_mulu_16_16x16, , ../config_private.inc:27 +eight_bit_1 = $D159 ; addr, local, , l_small_mul_16_16x16, code_math, ../_DEVELOPMENT/math/integer/small/l_small_mul_16_16x16.asm:40 +eight_bit_0 = $D158 ; addr, local, , l_small_mul_16_16x16, code_math, ../_DEVELOPMENT/math/integer/small/l_small_mul_16_16x16.asm:36 +rejoin = $D15C ; addr, local, , l_small_mul_16_16x16, code_math, ../_DEVELOPMENT/math/integer/small/l_small_mul_16_16x16.asm:57 +loop_0 = $D15F ; addr, local, , l_small_mul_16_16x16, code_math, ../_DEVELOPMENT/math/integer/small/l_small_mul_16_16x16.asm:61 +loop_1 = $D166 ; addr, local, , l_small_mul_16_16x16, code_math, ../_DEVELOPMENT/math/integer/small/l_small_mul_16_16x16.asm:75 +_u_malloc = $77FB ; addr, public, , mk1_c, data_compiler, definitions.h::my_malloc::0::1:30 +_u_free = $77FD ; addr, public, , mk1_c, data_compiler, definitions.h::my_malloc::0::1:31 +_keys = $77EB ; addr, public, , mk1_c, data_compiler, my/config.h:215 +_key_jump = $77F5 ; addr, public, , mk1_c, data_compiler, my/config.h:223 +_key_fire = $77F7 ; addr, public, , mk1_c, data_compiler, my/config.h:224 +_bullets_init = $A7A8 ; addr, public, , mk1_c, code_compiler, engine/bullets.h::bullets_init::0::48:6 +_bullets_update = $A7C7 ; addr, public, , mk1_c, code_compiler, engine/bullets.h::bullets_update::0::50:12 +_bullets_fire = $A7F6 ; addr, public, , mk1_c, code_compiler, engine/bullets.h::bullets_fire::0::51:53 +_bullets_move = $A8F5 ; addr, public, , mk1_c, code_compiler, engine/bullets.h::bullets_move::0::61:195 +_enems_draw_current = $B512 ; addr, public, , mk1_c, code_compiler, engine/enengine.h::enems_draw_current::0::123:28 +_enems_load = $B5A1 ; addr, public, , mk1_c, code_compiler, engine/enengine.h::enems_load::0::124:124 +_enems_kill = $B74E ; addr, public, , mk1_c, code_compiler, engine/enengine.h::enems_kill::0::127:197 +_enems_move = $B76E ; addr, public, , mk1_c, code_compiler, engine/enengine.h::enems_move::0::128:212 +_collide = $A677 ; addr, public, , mk1_c, code_compiler, engine/general.h::collide::0::43:6 +_cm_two_points = $A6D7 ; addr, public, , mk1_c, code_compiler, engine/general.h::cm_two_points::0::44:14 +_rand = $A734 ; addr, public, , mk1_c, code_compiler, engine/general.h::rand::0::45:91 +_abs = $A75D ; addr, public, , mk1_c, code_compiler, engine/general.h::abs::0::46:135 +_cortina = $A774 ; addr, public, , mk1_c, code_compiler, engine/general.h::cortina::0::47:158 +_hotspots_do = $BE33 ; addr, public, , mk1_c, code_compiler, engine/hotspots.h::hotspots_do::0::152:14 +_player_init = $AE51 ; addr, public, , mk1_c, code_compiler, engine/player.h::player_init::0::87:6 +_player_calc_bounding_box = $AEA2 ; addr, public, , mk1_c, code_compiler, engine/player.h::player_calc_bounding_box::0::88:63 +_player_move = $AEE3 ; addr, public, , mk1_c, code_compiler, engine/player.h::player_move::0::89:158 +_player_deplete = $B4C4 ; addr, public, , mk1_c, code_compiler, engine/player.h::player_deplete::0::121:753 +_player_kill = $B4EF ; addr, public, , mk1_c, code_compiler, engine/player.h::player_kill::0::122:757 +_SetRAMBank = $7975 ; addr, public, , mk1_c, code_compiler, 128k.h::SetRAMBank::0::1:6 +_get_resource = $7A30 ; addr, public, , mk1_c, code_compiler, aplib.h::get_resource::0::2:128 +_prepare_level = $A9E5 ; addr, public, , mk1_c, code_compiler, engine/c_levels.h::prepare_level::0::68:2 +_game_ending = $AA40 ; addr, public, , mk1_c, code_compiler, my/fixed_screens.h::game_ending::0::70:14 +_game_over = $AA6E ; addr, public, , mk1_c, code_compiler, my/fixed_screens.h::game_over::0::71:41 +_time_over = $AAC2 ; addr, public, , mk1_c, code_compiler, my/fixed_screens.h::time_over::0::72:57 +_pause_screen = $AB1B ; addr, public, , mk1_c, code_compiler, my/fixed_screens.h::pause_screen::0::73:74 +_addsign = $ABC5 ; addr, public, , mk1_c, code_compiler, engine.h::addsign::0::75:78 +_espera_activa = $ABDF ; addr, public, , mk1_c, code_compiler, engine.h::espera_activa::0::76:86 +_draw_scr_background = $ABFB ; addr, public, , mk1_c, code_compiler, engine.h::draw_scr_background::0::78:196 +_draw_scr_hotspots_locks = $ACAD ; addr, public, , mk1_c, code_compiler, engine.h::draw_scr_hotspots_locks::0::80:362 +_draw_scr = $AD1A ; addr, public, , mk1_c, code_compiler, engine.h::draw_scr::0::81:562 +_select_joyfunc = $AD38 ; addr, public, , mk1_c, code_compiler, engine.h::select_joyfunc::0::82:604 +_distance = $AD8B ; addr, public, , mk1_c, code_compiler, engine.h::distance::0::85:663 +_limit = $AE1A ; addr, public, , mk1_c, code_compiler, engine.h::limit::0::86:672 +_blackout = $7A7D ; addr, public, , mk1_c, code_compiler, pantallas.h::blackout::0::3:29 +_attr = $9F05 ; addr, public, , mk1_c, code_compiler, printer.h::attr::0::9:6 +_qtile = $9F50 ; addr, public, , mk1_c, code_compiler, printer.h::qtile::0::10:11 +_draw_coloured_tile = $9FAC ; addr, public, , mk1_c, code_compiler, printer.h::draw_coloured_tile::0::12:63 +_invalidate_tile = $A1C3 ; addr, public, , mk1_c, code_compiler, printer.h::invalidate_tile::0::15:514 +_invalidate_viewport = $A1D7 ; addr, public, , mk1_c, code_compiler, printer.h::invalidate_viewport::0::16:539 +_draw_invalidate_coloured_tile_gamearea = $A1E7 ; addr, public, , mk1_c, code_compiler, printer.h::draw_invalidate_coloured_tile_gamearea::0::17:560 +_draw_coloured_tile_gamearea = $A1EE ; addr, public, , mk1_c, code_compiler, printer.h::draw_coloured_tile_gamearea::0::18:565 +_draw_decorations = $A20B ; addr, public, , mk1_c, code_compiler, printer.h::draw_decorations::0::19:569 +_update_tile = $A23E ; addr, public, , mk1_c, code_compiler, printer.h::update_tile::0::20:614 +_print_number2 = $A26F ; addr, public, , mk1_c, code_compiler, printer.h::print_number2::0::21:657 +_draw_objs = $A2BC ; addr, public, , mk1_c, code_compiler, printer.h::draw_objs::0::22:694 +_print_str = $A2BD ; addr, public, , mk1_c, code_compiler, printer.h::print_str::0::23:774 +_blackout_area = $A2E2 ; addr, public, , mk1_c, code_compiler, printer.h::blackout_area::0::24:810 +_clear_sprites = $A2F8 ; addr, public, , mk1_c, code_compiler, printer.h::clear_sprites::0::25:831 +_ISR = $9EA2 ; addr, public, , mk1_c, code_compiler, sound/wyzplayer.h::ISR::0::4:28 +_wyz_play_sound = $9EC7 ; addr, public, , mk1_c, code_compiler, sound/wyzplayer.h::wyz_play_sound::0::6:58 +_wyz_play_music = $9EDA ; addr, public, , mk1_c, code_compiler, sound/wyzplayer.h::wyz_play_music::0::7:74 +_wyz_stop_sound = $9EF5 ; addr, public, , mk1_c, code_compiler, sound/wyzplayer.h::wyz_stop_sound::0::8:91 +_AD_FREE = $CB4E ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_joyfunc = $77F9 ; addr, public, , mk1_c, data_compiler, definitions.h:12 +_joyfuncs = $CA63 ; addr, public, , mk1_c, rodata_compiler, definitions.h:14 +_pad0 = $CED2 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_isJoy = $CED3 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_my_malloc = $796C ; addr, public, , mk1_c, code_compiler, definitions.h::my_malloc::0::0:26 +_sp_player = $CED4 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_sp_moviles = $CED6 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_sp_bullets = $CEDC ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_enoffs = $CEE4 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_asm_number = $CEE5 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_asm_int_2 = $CEE6 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_seed = $CEE8 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_half_life = $CEEA ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_p_x = $CEEB ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_p_y = $CEED ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_p_vx = $CEEF ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_p_vy = $CEF1 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_p_current_frame = $CEF3 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_p_next_frame = $CEF5 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_p_saltando = $CEF7 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_p_cont_salto = $CEF8 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_p_frame = $CEF9 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_p_subframe = $CEFA ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_p_facing = $CEFB ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_p_estado = $CEFC ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_p_ct_estado = $CEFD ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_p_gotten = $CEFE ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_pregotten = $CEFF ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_p_life = $CF00 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_p_objs = $CF01 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_p_keys = $CF02 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_p_fuel = $CF03 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_p_killed = $CF04 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_p_disparando = $CF05 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_p_facing_v = $CF06 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_p_facing_h = $CF07 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_p_ammo = $CF08 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_p_killme = $CF09 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_p_kill_amt = $CF0A ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_p_tx = $CF0B ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_p_ty = $CF0C ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_ptgmx = $CF0D ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_ptgmy = $CF0F ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_spacer = $77FF ; addr, public, , mk1_c, data_compiler, definitions.h::my_malloc::0::1:122 +_enit = $CF11 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_en_an_base_frame = $CF12 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_en_an_frame = $CF15 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_en_an_count = $CF18 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_en_an_current_frame = $CF1B ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_en_an_next_frame = $CF21 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_en_an_state = $CF27 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_en_an_x = $CF2A ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_en_an_y = $CF30 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_en_an_vx = $CF36 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_en_an_vy = $CF3C ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +__en_an_x = $CF42 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +__en_an_y = $CF44 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +__en_an_vx = $CF46 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +__en_an_vy = $CF48 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +__en_x = $CF4A ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +__en_y = $CF4B ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +__en_x1 = $CF4C ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +__en_y1 = $CF4D ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +__en_x2 = $CF4E ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +__en_y2 = $CF4F ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +__en_mx = $CF50 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +__en_my = $CF51 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +__en_t = $CF52 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +__en_life = $CF53 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +__baddies_pointer = $CF54 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +__en_cx = $CF56 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +__en_cy = $CF57 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_bullets_x = $CF58 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_bullets_y = $CF5C ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_bullets_mx = $CF60 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_bullets_my = $CF64 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_bullets_estado = $CF68 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +__b_estado = $CF6C ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_b_it = $CF6D ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +__b_x = $CF6E ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +__b_y = $CF6F ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +__b_mx = $CF70 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +__b_my = $CF71 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_map_attr = $CF72 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_hotspot_x = $D008 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_hotspot_y = $D009 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_hotspot_destroy = $D00A ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_orig_tile = $D00B ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_flags = $D00C ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_o_pant = $D01C ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_n_pant = $D01D ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_is_rendering = $D01E ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_level = $D01F ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_slevel = $D020 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_warp_to_level = $7801 ; addr, public, , mk1_c, data_compiler, definitions.h::my_malloc::0::1:206 +_maincounter = $D021 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_timer_on = $D022 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_timer_t = $D023 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_timer_frames = $D024 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_timer_count = $D025 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_timer_zero = $D026 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_gpx = $D027 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_gpox = $D028 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_gpy = $D029 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_gpd = $D02A ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_gpc = $D02B ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_gpxx = $D02C ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_gpyy = $D02D ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_gpcx = $D02E ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_gpcy = $D02F ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_possee = $D030 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_hit_v = $D031 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_hit_h = $D032 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_hit = $D033 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_wall_h = $D034 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_wall_v = $D035 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_gpen_x = $D036 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_gpen_y = $D037 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_gpen_cx = $D038 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_gpen_cy = $D039 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_gpaux = $D03A ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_tocado = $D03B ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_active = $D03C ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_gpit = $D03D ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_gpjt = $D03E ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_enoffsmasi = $D03F ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_map_pointer = $D040 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_blx = $D042 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_bly = $D043 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_rdx = $D044 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_rdy = $D045 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_rda = $D046 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_rdb = $D047 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_rdc = $D048 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_rdd = $D049 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_rdn = $D04A ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_rdt = $D04B ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_itj = $D04C ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_objs_old = $D04E ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_keys_old = $D04F ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_life_old = $D050 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_killed_old = $D051 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_timer_old = $D052 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_level_str = $7802 ; addr, public, , mk1_c, data_compiler, definitions.h::my_malloc::0::1:261 +_silent_level = $7804 ; addr, public, , mk1_c, data_compiler, definitions.h::my_malloc::0::1:262 +_getxmore = $7805 ; addr, public, , mk1_c, data_compiler, definitions.h::my_malloc::0::1:266 +_gen_pt = $D053 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_playing = $D055 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_success = $D056 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_x_pant = $D057 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_y_pant = $D058 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +__x = $D059 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +__y = $D05A ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +__n = $D05B ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +__t = $D05C ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_cx1 = $D05D ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_cy1 = $D05E ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_cx2 = $D05F ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_cy2 = $D060 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_at1 = $D061 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_at2 = $D062 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_x0 = $D063 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_y0 = $D064 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_x1 = $D065 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_y1 = $D066 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_ptx1 = $D067 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_pty1 = $D068 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_ptx2 = $D069 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_pty2 = $D06A ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +__gp_gen = $D06B ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_xx = $D06D ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_yy = $D06E ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_c1 = $D06F ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_c2 = $D070 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_c3 = $D071 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_c4 = $D072 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_t1 = $D073 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_t2 = $D074 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_t3 = $D075 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_t4 = $D076 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_nocast = $D077 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +__ta = $D078 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_a1 = $D079 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_a2 = $D07B ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_a3 = $D07D ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_gen_pt_alt = $D07F ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_t_alt = $D081 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_song_playing = $7807 ; addr, public, , mk1_c, data_compiler, definitions.h::my_malloc::0::1:314 +_player_on = $7808 ; addr, public, , mk1_c, data_compiler, definitions.h::my_malloc::0::1:315 +_isrc = $D082 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_resources = $7809 ; addr, public, , mk1_c, data_compiler, assets/librarian.h::SetRAMBank::0::2:12 +_font = $7A8B ; addr, public, , mk1_c, code_compiler, assets/levels.h::blackout::0::4:63 +_level_data = $7C8B ; addr, public, , mk1_c, code_compiler, assets/levels.h::blackout::0::4:70 +_mapa = $7C9B ; addr, public, , mk1_c, code_compiler, assets/levels.h::blackout::0::4:78 +_tileset = $83EE ; addr, public, , mk1_c, code_compiler, assets/levels.h::blackout::0::4:91 +_malotes = $8AEE ; addr, public, , mk1_c, code_compiler, assets/levels.h::blackout::0::4:98 +_hotspots = $8DDC ; addr, public, , mk1_c, code_compiler, assets/levels.h::blackout::0::4:105 +_behs = $8E27 ; addr, public, , mk1_c, code_compiler, assets/levels.h::blackout::0::4:112 +_sprites = $8E57 ; addr, public, , mk1_c, code_compiler, assets/levels.h::blackout::0::4:119 +_sprite_1_a = $8E67 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_1_b = $8E97 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_1_c = $8EC7 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_2_a = $8EF7 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_2_b = $8F27 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_2_c = $8F57 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_3_a = $8F87 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_3_b = $8FB7 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_3_c = $8FE7 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_4_a = $9017 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_4_b = $9047 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_4_c = $9077 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_5_a = $90A7 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_5_b = $90D7 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_5_c = $9107 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_6_a = $9137 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_6_b = $9167 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_6_c = $9197 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_7_a = $91C7 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_7_b = $91F7 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_7_c = $9227 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_8_a = $9257 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_8_b = $9287 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_8_c = $92B7 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_9_a = $92E7 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_9_b = $9317 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_9_c = $9347 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_10_a = $9377 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_10_b = $93A7 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_10_c = $93D7 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_11_a = $9407 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_11_b = $9437 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_11_c = $9467 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_12_a = $9497 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_12_b = $94C7 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_12_c = $94F7 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_13_a = $9527 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_13_b = $9557 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_13_c = $9587 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_14_a = $95B7 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_14_b = $95E7 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_14_c = $9617 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_15_a = $9647 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_15_b = $9677 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_15_c = $96A7 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_16_a = $96D7 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_16_b = $9707 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_16_c = $9737 ; addr, public, , mk1_c, code_compiler, ./assets/sprites-empty.h::blackout::0::4:57 +_sprite_17_a = $9767 ; addr, public, , mk1_c, code_compiler, assets/extrasprites.h::blackout::0::4:23 +_sprite_18_a = $97F7 ; addr, public, , mk1_c, code_compiler, assets/extrasprites.h::blackout::0::4:30 +_sprite_19_a = $9887 ; addr, public, , mk1_c, code_compiler, assets/extrasprites.h::blackout::0::4:58 +_levels = $7848 ; addr, public, , mk1_c, data_compiler, my/levelset.h::blackout::0::4:40 +_splash_screens = $CA69 ; addr, public, , mk1_c, rodata_compiler, my/ci/extra_vars.h::blackout::0::4:6 +_lang = $7852 ; addr, public, , mk1_c, data_compiler, my/ci/extra_vars.h::blackout::0::4:7 +_passwords = $98C7 ; addr, public, , mk1_c, code_compiler, my/ci/extra_vars.h::blackout::0::4:15 +_password = $7853 ; addr, public, , mk1_c, data_compiler, my/ci/extra_vars.h::blackout::0::4:25 +_intro_texts = $9E84 ; addr, public, , mk1_c, code_compiler, my/ci/extra_vars.h::blackout::0::4:31 +_pic_resource = $CA6C ; addr, public, , mk1_c, rodata_compiler, my/ci/extra_vars.h::blackout::0::4:57 +_introx = $D083 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_introy = $D084 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_stepbystep = $D085 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_intro_iterator = $D086 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_text_offs = $D087 ; addr, public, , mk1_c, bss_compiler, mk1.c::main::0::206:142 +_levelnumbers = $7855 ; addr, public, , mk1_c, data_compiler, my/ci/extra_vars.h::blackout::0::4:72 +_wyz_init = $9EB9 ; addr, public, , mk1_c, code_compiler, sound/wyzplayer.h::wyz_init::0::5:46 +_attr_mk2 = $9F7B ; addr, public, , mk1_c, code_compiler, printer.h::attr_mk2::0::11:16 +_utaux = $7963 ; addr, public, , mk1_c, data_compiler, printer.h::draw_decorations::0::20:613 +_cortina2 = $A363 ; addr, public, , mk1_c, code_compiler, my/ci/extra_functions.h::cortina2::0::26:6 +_halts_delay = $A371 ; addr, public, , mk1_c, code_compiler, my/ci/extra_functions.h::halts_delay::0::27:21 +_check_password = $A382 ; addr, public, , mk1_c, code_compiler, my/ci/extra_functions.h::check_password::0::29:35 +_show_intro_text = $A553 ; addr, public, , mk1_c, code_compiler, my/ci/extra_functions.h::show_intro_text::0::36:96 +_do_cutscene = $A5E7 ; addr, public, , mk1_c, code_compiler, my/ci/extra_functions.h::do_cutscene::0::41:154 +_player_cells = $CA73 ; addr, public, , mk1_c, rodata_compiler, engine.h::prepare_level::0::70:64 +_enem_cells = $CA87 ; addr, public, , mk1_c, rodata_compiler, engine.h::prepare_level::0::70:71 +_zone_clear = $AB6C ; addr, public, , mk1_c, code_compiler, my/fixed_screens.h::zone_clear::0::74:83 +_main = $BFC8 ; addr, public, , mk1_c, code_compiler, mainloop.h::main::0::158:7 +SPPrintAtInv = $5DC6 ; addr, public, , SPPrintAtInv, , backgroundtiles/SPPrintAtInv.asm:20 +_sp_AddColSpr = $C95E ; addr, public, , sp_AddColSpr_c, code_compiler, sp_AddColSpr.c::sp_AddColSpr::0::0:15 +sp_AddColSpr = $C95E ; addr, public, , sp_AddColSpr_c, code_compiler, sp_AddColSpr.c::sp_AddColSpr::0::0:15 +_sp_AddMemory = $C977 ; addr, public, , sp_AddMemory_c, code_compiler, sp_AddMemory.c::sp_AddMemory::0::0:15 +sp_AddMemory = $C977 ; addr, public, , sp_AddMemory_c, code_compiler, sp_AddMemory.c::sp_AddMemory::0::0:15 +SPAddMemory = $5DE0 ; addr, public, , SPAddMemory, , blockmemoryalloc/SPAddMemory.asm:28 +SPFreeBlock = $5DFC ; addr, public, , SPFreeBlock, , blockmemoryalloc/SPFreeBlock.asm:26 +SPfb1 = $5E01 ; addr, public, , SPFreeBlock, , blockmemoryalloc/SPFreeBlock.asm:33 +SPfb2 = $5E0C ; addr, public, , SPFreeBlock, , blockmemoryalloc/SPFreeBlock.asm:42 +_sp_BlockAlloc = $C98E ; addr, public, , sp_BlockAlloc_c, code_compiler, sp_BlockAlloc.c::sp_BlockAlloc::0::0:15 +sp_BlockAlloc = $C98E ; addr, public, , sp_BlockAlloc_c, code_compiler, sp_BlockAlloc.c::sp_BlockAlloc::0::0:15 +SPBlockAlloc = $5E17 ; addr, public, , SPBlockAlloc, , blockmemoryalloc/SPBlockAlloc.asm:26 +SPalloc = $5E21 ; addr, public, , SPBlockAlloc, , blockmemoryalloc/SPBlockAlloc.asm:34 +_sp_Border = $C99C ; addr, public, , sp_Border_c, code_compiler, sp_Border.c::sp_Border::0::0:15 +sp_Border = $C99C ; addr, public, , sp_Border_c, code_compiler, sp_Border.c::sp_Border::0::0:15 +_sp_CreateSpr = $C9A5 ; addr, public, , sp_CreateSpr_c, code_compiler, sp_CreateSpr.c::sp_CreateSpr::0::0:16 +sp_CreateSpr = $C9A5 ; addr, public, , sp_CreateSpr_c, code_compiler, sp_CreateSpr.c::sp_CreateSpr::0::0:16 +_sp_CreateGenericISR = $C9BD ; addr, public, , sp_CreateGenericISR_c, code_compiler, sp_CreateGenericISR.c::sp_CreateGenericISR::0::0:14 +sp_CreateGenericISR = $C9BD ; addr, public, , sp_CreateGenericISR_c, code_compiler, sp_CreateGenericISR.c::sp_CreateGenericISR::0::0:14 +_sp_FreeBlock = $C9C6 ; addr, public, , sp_FreeBlock_c, code_compiler, sp_FreeBlock.c::sp_FreeBlock::0::0:15 +sp_FreeBlock = $C9C6 ; addr, public, , sp_FreeBlock_c, code_compiler, sp_FreeBlock.c::sp_FreeBlock::0::0:15 +_sp_GetKey = $C9D1 ; addr, public, , sp_GetKey_c, code_compiler, sp_GetKey.c::sp_GetKey::0::0:15 +sp_GetKey = $C9D1 ; addr, public, , sp_GetKey_c, code_compiler, sp_GetKey.c::sp_GetKey::0::0:15 +_sp_InitIM2 = $C9DC ; addr, public, , sp_InitIM2_c, code_compiler, sp_InitIM2.c::sp_InitIM2::0::0:15 +sp_InitIM2 = $C9DC ; addr, public, , sp_InitIM2_c, code_compiler, sp_InitIM2.c::sp_InitIM2::0::0:15 +_sp_Initialize = $C9E7 ; addr, public, , sp_Initialize_c, code_compiler, sp_Initialize.c::sp_Initialize::0::0:15 +sp_Initialize = $C9E7 ; addr, public, , sp_Initialize_c, code_compiler, sp_Initialize.c::sp_Initialize::0::0:15 +_sp_JoyKempston = $C9F3 ; addr, public, , sp_JoyKempston_c, code_compiler, sp_JoyKempston.c::sp_JoyKempston::0::0:15 +sp_JoyKempston = $C9F3 ; addr, public, , sp_JoyKempston_c, code_compiler, sp_JoyKempston.c::sp_JoyKempston::0::0:15 +_sp_JoyKeyboard = $C9FA ; addr, public, , sp_JoyKeyboard_c, code_compiler, sp_JoyKeyboard.c::sp_JoyKeyboard::0::0:15 +sp_JoyKeyboard = $C9FA ; addr, public, , sp_JoyKeyboard_c, code_compiler, sp_JoyKeyboard.c::sp_JoyKeyboard::0::0:15 +_sp_JoySinclair1 = $CA08 ; addr, public, , sp_JoySinclair1_c, code_compiler, sp_JoySinclair1.c::sp_JoySinclair1::0::0:15 +sp_JoySinclair1 = $CA08 ; addr, public, , sp_JoySinclair1_c, code_compiler, sp_JoySinclair1.c::sp_JoySinclair1::0::0:15 +_sp_KeyPressed = $CA0F ; addr, public, , sp_KeyPressed_c, code_compiler, sp_KeyPressed.c::sp_KeyPressed::0::0:15 +sp_KeyPressed = $CA0F ; addr, public, , sp_KeyPressed_c, code_compiler, sp_KeyPressed.c::sp_KeyPressed::0::0:15 +_sp_RegisterHook = $CA1F ; addr, public, , sp_RegisterHook_c, code_compiler, sp_RegisterHook.c::sp_RegisterHook::0::0:15 +sp_RegisterHook = $CA1F ; addr, public, , sp_RegisterHook_c, code_compiler, sp_RegisterHook.c::sp_RegisterHook::0::0:15 +_sp_RegisterHookLast = $CA35 ; addr, public, , sp_RegisterHookLast_c, code_compiler, sp_RegisterHookLast.c::sp_RegisterHookLast::0::0:15 +sp_RegisterHookLast = $CA35 ; addr, public, , sp_RegisterHookLast_c, code_compiler, sp_RegisterHookLast.c::sp_RegisterHookLast::0::0:15 +_sp_TileArray = $CA42 ; addr, public, , sp_TileArray_c, code_compiler, sp_TileArray.c::sp_TileArray::0::0:14 +sp_TileArray = $CA42 ; addr, public, , sp_TileArray_c, code_compiler, sp_TileArray.c::sp_TileArray::0::0:14 +SPTileEntry = $5E32 ; addr, public, , SPTileEntry, , backgroundtiles/SPTileEntry.asm:18 +_sp_UpdateNow = $CA50 ; addr, public, , sp_UpdateNow_c, code_compiler, sp_UpdateNow.c::sp_UpdateNow::0::0:15 +sp_UpdateNow = $CA50 ; addr, public, , sp_UpdateNow_c, code_compiler, sp_UpdateNow.c::sp_UpdateNow::0::0:15 +_sp_UpdateNowEx = $CA56 ; addr, public, , sp_UpdateNowEx_c, code_compiler, sp_UpdateNowEx.c::sp_UpdateNowEx::0::0:15 +sp_UpdateNowEx = $CA56 ; addr, public, , sp_UpdateNowEx_c, code_compiler, sp_UpdateNowEx.c::sp_UpdateNowEx::0::0:15 +_sp_WaitForNoKey = $CA5F ; addr, public, , sp_WaitForNoKey_c, code_compiler, sp_WaitForNoKey.c::sp_WaitForNoKey::0::0:15 +sp_WaitForNoKey = $CA5F ; addr, public, , sp_WaitForNoKey_c, code_compiler, sp_WaitForNoKey.c::sp_WaitForNoKey::0::0:15 +SPCompDListAddr = $5E43 ; addr, public, , SPCompDListAddr, , displaylist/SPCompDListAddr.asm:19 +SPCompDirtyAddr = $5E54 ; addr, public, , SPCompDirtyAddr, , displaylist/SPCompDirtyAddr.asm:20 +SPbit2mask = $5E69 ; addr, public, , SPbit2mask, , globalvariables/SPbit2mask.asm:4 +SPDirtyChars = $5E71 ; addr, public, , SPDirtyChars, , globalvariables/SPDirtyChars.asm:6 +SPDisplayList = $5ED1 ; addr, public, , SPDisplayList, , globalvariables/SPDisplayList.asm:6 +SPqueuetable = $6AD1 ; addr, public, , SPqueuetable, , globalvariables/SPqueuetable.asm:19 +SPTileArray = $6AD3 ; addr, public, , SPTileArray, , globalvariables/SPTileArray.asm:6 +SPGetKey = $6CE9 ; addr, public, , SPGetKey, , input/SPGetKey.asm:74 +SPInkey = $6CD8 ; addr, public, , SPGetKey, , input/SPGetKey.asm:56 +SPkeydebounce = $6CD5 ; addr, public, , SPGetKey, , input/SPGetKey.asm:39 +SPkeystartrepeat = $6CD6 ; addr, public, , SPGetKey, , input/SPGetKey.asm:41 +SPkeyrepeatperiod = $6CD7 ; addr, public, , SPGetKey, , input/SPGetKey.asm:43 +SPkeytranstbl = $6D5D ; addr, public, , SPkeytranstbl, , globalvariables/SPkeytranstbl.asm:13 +SPJoyKempston = $6DFD ; addr, public, , SPJoyKempston, , input/SPJoyKempston.asm:20 +SPJoyKeyboard = $6E28 ; addr, public, , SPJoyKeyboard, , input/SPJoyKeyboard.asm:26 +SPJoySinclair1 = $6E47 ; addr, public, , SPJoySinclair1, , input/SPJoySinclair1.asm:18 +SPKeyPressed = $6E73 ; addr, public, , SPKeyPressed, , input/SPKeyPressed.asm:16 +SPtbllookup = $6E97 ; addr, public, , SPtbllookup, , input/SPtbllookup.asm:11 +SPWaitForNoKey = $6E9F ; addr, public, , SPWaitForNoKey, , input/SPWaitForNoKey.asm:11 +SPCreateGenericISR = $6EA9 ; addr, public, , SPCreateGenericISR, , interrupts/SPCreateGenericISR.asm:31 +GENERICISRSIZE = $000C ; addr, public, , SPCreateGenericISR, , interrupts/SPCreateGenericISR.asm:93 +GENERICLISTDISP = $0004 ; addr, public, , SPCreateGenericISR, , interrupts/SPCreateGenericISR.asm:94 +SPInitIM2 = $6EF1 ; addr, public, , SPInitIM2, , interrupts/SPInitIM2.asm:22 +SPRegisterHookLast = $6F09 ; addr, public, , SPRegisterHookLast, , interrupts/SPRegisterHookLast.asm:27 +SPRegisterHook = $6F09 ; addr, public, , SPRegisterHookLast, , interrupts/SPRegisterHookLast.asm:26 +SPBorder = $6F27 ; addr, public, , SPBorder, , miscellaneous/SPBorder.asm:30 +SPBorderClr = $6F26 ; addr, public, , SPBorder, , miscellaneous/SPBorder.asm:11 +SPInitialize = $6F2F ; addr, public, , SPInitialize, , miscellaneous/SPInitialize.asm:26 +SPAddColSpr = $6F94 ; addr, public, , SPAddColSpr, , sprites/SPAddColSpr.asm:27 +SPCreateSpr = $703C ; addr, public, , SPCreateSpr, , sprites/SPCreateSpr.asm:36 +SPNullSprPtr = $70DC ; addr, public, , SPNullSprPtr, , globalvariables/SPNullSprPtr.asm:10 +SPDeleteSpr = $70EC ; addr, public, , SPDeleteSpr, , sprites/SPDeleteSpr.asm:23 +SPdsloop = $70FD ; addr, public, , SPDeleteSpr, , sprites/SPDeleteSpr.asm:38 +SPMoveSprAbs = $7108 ; addr, public, , SPMoveSprAbs, , sprites/SPMoveSprAbs.asm:30 +SPMoveSprAbsC = $712F ; addr, public, , SPMoveSprAbs, , sprites/SPMoveSprAbs.asm:58 +SPMoveSprAbsNC = $7116 ; addr, public, , SPMoveSprAbs, , sprites/SPMoveSprAbs.asm:38 +SPInvalidate = $728A ; addr, public, , SPInvalidate, , updater/SPInvalidate.asm:21 +SPInvalidateP = $7292 ; addr, public, , SPInvalidate, , updater/SPInvalidate.asm:31 +SPbitleft2mask = $72DD ; addr, public, , SPbitleft2mask, , globalvariables/SPbitleft2mask.asm:4 +SPbitright2mask = $72E5 ; addr, public, , SPbitright2mask, , globalvariables/SPbitright2mask.asm:4 +SPIntRect = $72ED ; addr, public, , SPIntRect, , miscellaneous/SPIntRect.asm:33 +SPIntSmallIval = $731E ; addr, public, , SPIntRect, , miscellaneous/SPIntRect.asm:77 +SPPtInSmallIval = $7343 ; addr, public, , SPIntRect, , miscellaneous/SPIntRect.asm:117 +SPUpdateNow = $7361 ; addr, public, , SPUpdateNow, , updater/SPUpdateNow.asm:99 +update_attrs = $735F ; addr, public, , SPUpdateNow, , updater/SPUpdateNow.asm:88 +l_jphl = $D088 ; addr, public, , l_jphl, code_l, ../_DEVELOPMENT/l/z80/l_jphl.asm:7 +l_asr = $D089 ; addr, public, , l_asr, code_crt0_sccz80, sccz80/crt0_z80/l_asr.asm:14 +l_asr_hl_by_e = $D08A ; addr, public, , l_asr, code_crt0_sccz80, sccz80/crt0_z80/l_asr.asm:16 +l_div_u = $D10F ; addr, public, , l_div_u, code_crt0_sccz80, sccz80/crt0_z80/l_div_u.asm:17 +l_divu_16_16x16 = $D110 ; addr, public, , l_divu_16_16x16, code_math, ../_DEVELOPMENT/math/integer/l_divu_16_16x16.asm:22 +l0_divu_16_16x16 = $D114 ; addr, public, , l_divu_16_16x16, code_math, ../_DEVELOPMENT/math/integer/l_divu_16_16x16.asm:23 +l_small_divu_16_16x16 = $D110 ; addr, public, , l_small_divu_16_16x16, code_math, ../_DEVELOPMENT/math/integer/small/l_small_divu_16_16x16.asm:17 +l0_small_divu_16_16x16 = $D114 ; addr, public, , l_small_divu_16_16x16, code_math, ../_DEVELOPMENT/math/integer/small/l_small_divu_16_16x16.asm:42 +l_small_divu_16_16x8 = $D130 ; addr, public, , l_small_divu_16_16x16, code_math, ../_DEVELOPMENT/math/integer/small/l_small_divu_16_16x16.asm:87 +l0_small_divu_16_16x8 = $D134 ; addr, public, , l_small_divu_16_16x16, code_math, ../_DEVELOPMENT/math/integer/small/l_small_divu_16_16x16.asm:112 +error_divide_by_zero_mc = $D16D ; addr, public, , error_divide_by_zero_mc, code_error, ../_DEVELOPMENT/error/z80/error_divide_by_zero_mc.asm:12 +error_edom_mc = $D16D ; addr, public, , error_edom_mc, code_error, ../_DEVELOPMENT/error/z80/error_edom_mc.asm:57 +errno_mc = $D16F ; addr, public, , errno_mc, code_error, ../_DEVELOPMENT/error/z80/errno_mc.asm:21 +_errno = $D17F ; addr, public, , _errno, bss_error, ../_DEVELOPMENT/error/z80/_errno.asm:7 +error_mc = $D17A ; addr, public, , error_mc, code_error, ../_DEVELOPMENT/error/z80/error_mc.asm:11 +l_eq = $D093 ; addr, public, , l_eq, code_crt0_sccz80, sccz80/crt0_z80/l_eq.asm:17 +l_gchar = $D09D ; addr, public, , l_gchar, code_crt0_sccz80, sccz80/crt0_z80/l_gchar.asm:11 +l_gint = $D0A3 ; addr, public, , l_gint, code_crt0_sccz80, sccz80/crt0_z80/l_gint.asm:11 +l_gintsp = $D0A8 ; addr, public, , l_gintsp, code_crt0_sccz80, sccz80/crt0_z80/l_gintsp.asm:7 +l_gt = $D0B0 ; addr, public, , l_gt, code_crt0_sccz80, sccz80/crt0_z80/l_gt.asm:15 +l_compare_result = $D0C0 ; addr, public, , l_compare_result, code_crt0_sccz80, sccz80/crt0_z80/l_compare_result.asm:4 +l_lneg = $D0C6 ; addr, public, , l_lneg, code_crt0_sccz80, sccz80/crt0_z80/l_lneg.asm:14 +l_lt = $D0CF ; addr, public, , l_lt, code_crt0_sccz80, sccz80/crt0_z80/l_lt.asm:15 +l_mult = $D14A ; addr, public, , l_mul, code_crt0_sccz80, sccz80/crt0_z80/l_mul.asm:12 +l_mulu_16_16x16 = $D14A ; addr, public, , l_mulu_16_16x16, code_math, ../_DEVELOPMENT/math/integer/l_mulu_16_16x16.asm:36 +l_small_mul_16_16x16 = $D14A ; addr, public, , l_small_mul_16_16x16, code_math, ../_DEVELOPMENT/math/integer/small/l_small_mul_16_16x16.asm:10 +l_small_mul_16_16x8 = $D159 ; addr, public, , l_small_mul_16_16x16, code_math, ../_DEVELOPMENT/math/integer/small/l_small_mul_16_16x16.asm:42 +l_ne = $D0DF ; addr, public, , l_ne, code_crt0_sccz80, sccz80/crt0_z80/l_ne.asm:16 +l_neg = $D0EA ; addr, public, , l_neg, code_crt0_sccz80, sccz80/crt0_z80/l_neg.asm:13 +l_pint = $D0F2 ; addr, public, , l_pint, code_crt0_sccz80, sccz80/crt0_z80/l_pint.asm:11 +l_pint_pop = $D0F8 ; addr, public, , l_pint_pop, code_crt0_sccz80, sccz80/crt0_z80/l_pint_pop.asm:12 +l_sxt = $D0FE ; addr, public, , l_sxt, code_crt0_sccz80, sccz80/crt0_z80/l_sxt.asm:10 +l_uge = $D103 ; addr, public, , l_uge, code_crt0_sccz80, sccz80/crt0_z80/l_uge.asm:18 +__head = $5DC0 ; const, public, def, , , +__tail = $D181 ; const, public, def, , , +__size = $73C1 ; const, public, def, , , +__data_compiler_head = $77EB ; const, public, def, , , +__data_compiler_tail = $7964 ; const, public, def, , , +__data_compiler_size = $0179 ; const, public, def, , , +__code_compiler_head = $7964 ; const, public, def, , , +__code_compiler_tail = $CA63 ; const, public, def, , , +__code_compiler_size = $50FF ; const, public, def, , , +__rodata_compiler_head = $CA63 ; const, public, def, , , +__rodata_compiler_tail = $CB4E ; const, public, def, , , +__rodata_compiler_size = $00EB ; const, public, def, , , +__bss_compiler_head = $CB4E ; const, public, def, , , +__bss_compiler_tail = $D088 ; const, public, def, , , +__bss_compiler_size = $053A ; const, public, def, , , +__code_clib_head = $D088 ; const, public, def, , , +__code_clib_tail = $D088 ; const, public, def, , , +__code_clib_size = $0000 ; const, public, def, , , +__code_l_head = $D088 ; const, public, def, , , +__code_l_tail = $D089 ; const, public, def, , , +__code_l_size = $0001 ; const, public, def, , , +__code_crt0_sccz80_head = $D089 ; const, public, def, , , +__code_crt0_sccz80_tail = $D10F ; const, public, def, , , +__code_crt0_sccz80_size = $0086 ; const, public, def, , , +__code_math_head = $D10F ; const, public, def, , , +__code_math_tail = $D16A ; const, public, def, , , +__code_math_size = $005B ; const, public, def, , , +__code_error_head = $D16A ; const, public, def, , , +__code_error_tail = $D17F ; const, public, def, , , +__code_error_size = $0015 ; const, public, def, , , +__bss_clib_head = $D17F ; const, public, def, , , +__bss_clib_tail = $D17F ; const, public, def, , , +__bss_clib_size = $0000 ; const, public, def, , , +__bss_error_head = $D17F ; const, public, def, , , +__bss_error_tail = $D181 ; const, public, def, , , +__bss_error_size = $0002 ; const, public, def, , , diff --git a/examples/goku_mal/dev/goku_mal.tap b/examples/goku_mal/dev/goku_mal.tap index f67c29f3..63f72496 100644 Binary files a/examples/goku_mal/dev/goku_mal.tap and b/examples/goku_mal/dev/goku_mal.tap differ diff --git a/examples/goku_mal/dev/loader/loader.asm b/examples/goku_mal/dev/loader/loader.asm index c67cf62d..b5e8c025 100644 --- a/examples/goku_mal/dev/loader/loader.asm +++ b/examples/goku_mal/dev/loader/loader.asm @@ -64,7 +64,7 @@ ld de, 2217 call $0556 di - + ; Main binary ld a, $10 ; ROM 1, RAM 0 ld bc, $7ffd @@ -73,7 +73,7 @@ scf ld a, $ff ld ix, 24000 - ld de, 30454 + ld de, 29633 call $0556 di diff --git a/examples/goku_mal/dev/mainloop.h b/examples/goku_mal/dev/mainloop.h index c66d93e4..9875ead0 100644 --- a/examples/goku_mal/dev/mainloop.h +++ b/examples/goku_mal/dev/mainloop.h @@ -12,7 +12,7 @@ void main (void) { di #endasm - #ifdef MODE_128K + #if defined MODE_128K || defined MIN_FAPS_PER_FRAME sp_InitIM2(0xf1f1); sp_CreateGenericISR(0xf1f1); sp_RegisterHook(255, ISR); @@ -20,8 +20,15 @@ void main (void) { #asm ei #endasm + #endif + + #ifdef MODE_128K + #ifdef USE_ARKOS_PLAYER + arkos_stop(); + #else + wyz_init (); + #endif - wyz_init (); #endif cortina (); @@ -48,13 +55,13 @@ void main (void) { // Sprite creation #ifdef NO_MASKS - sp_player = sp_CreateSpr (sp_OR_SPRITE, 3, sprite_2_a); + sp_player = sp_CreateSpr (NO_MASKS, 3, sprite_2_a); sp_AddColSpr (sp_player, sprite_2_b); sp_AddColSpr (sp_player, sprite_2_c); p_current_frame = p_next_frame = sprite_2_a; - for (gpit = 0; gpit < 3; gpit ++) { - sp_moviles [gpit] = sp_CreateSpr(sp_OR_SPRITE, 3, sprite_9_a); + for (gpit = 0; gpit < MAX_ENEMS; gpit ++) { + sp_moviles [gpit] = sp_CreateSpr(NO_MASKS, 3, sprite_9_a); sp_AddColSpr (sp_moviles [gpit], sprite_9_b); sp_AddColSpr (sp_moviles [gpit], sprite_9_c); en_an_current_frame [gpit] = sprite_9_a; @@ -98,7 +105,7 @@ void main (void) { #include "my/ci/after_load.h" while (1) { - #ifdef ACTIVATE_SCRIPTING + #if defined ACTIVATE_SCRIPTING && !defined MODE_128K main_script_offset = (int) (main_script); #endif @@ -114,7 +121,22 @@ void main (void) { #include "my/ci/before_game.h" + #ifdef NO_RESET_STATS + p_objs = 0; + p_keys = 0; + p_killed = 0; + #ifdef MAX_AMMO + #ifdef INITIAL_AMMO + p_ammo = INITIAL_AMMO; + #else + p_ammo = MAX_AMMO; + #endif + #endif + #endif + #ifdef COMPRESSED_LEVELS + silent_level = 0; + #ifdef ENABLE_CHECKPOINTS if (sg_do_load) level = sg_level; else level = 0; #endif @@ -134,9 +156,12 @@ void main (void) { { #ifdef COMPRESSED_LEVELS - #include "my/level_screen.h" + if (silent_level == 0) { + #include "my/level_screen.h" + } + silent_level = 0; - prepare_level (level); + prepare_level (); #endif #ifndef DIRECT_TO_PLAY @@ -161,17 +186,19 @@ void main (void) { #ifdef COMPRESSED_LEVELS if (success) { #ifdef MODE_128K - //wyz_play_music (6); + //PLAY_MUSIC (6); #endif - zone_clear (); + if (silent_level == 0) zone_clear (); #ifdef ACTIVATE_SCRIPTING if (script_result != 3) #else if (warp_to_level == 0) #endif - ++ level; + { + level ++; + } if (level >= MAX_LEVELS #ifdef ACTIVATE_SCRIPTING @@ -183,7 +210,7 @@ void main (void) { } } else { #ifdef MODE_128K - //wyz_play_music (8); + //PLAY_MUSIC (8); #endif #if defined(TIMER_ENABLE) && defined(TIMER_GAMEOVER_0) && defined(SHOW_TIMER_OVER) @@ -193,7 +220,7 @@ void main (void) { #endif #ifdef MODE_128K - wyz_stop_sound (); + STOP_SOUND (); #endif break; } @@ -201,12 +228,12 @@ void main (void) { if (success) { game_ending (); } else { - //wyz_play_music (8); + //PLAY_MUSIC (8); game_over (); } #endif #if !defined (DIRECT_TO_PLAY) || !defined (COMPRESSED_LEVELS) - cortina (); + cortina (); #endif } diff --git a/examples/goku_mal/dev/mainloop/flick_screen.h b/examples/goku_mal/dev/mainloop/flick_screen.h index c1c039b9..97b4515c 100644 --- a/examples/goku_mal/dev/mainloop/flick_screen.h +++ b/examples/goku_mal/dev/mainloop/flick_screen.h @@ -13,7 +13,7 @@ } #if defined (COMPRESSED_LEVELS) - if (gpx == 224 && p_vx > 0 && x_pant < (level_data->map_w - 1)) + if (gpx == 224 && p_vx > 0 && x_pant < (level_data.map_w - 1)) #else if (gpx == 224 && p_vx > 0 && x_pant < (MAP_W - 1)) #endif @@ -27,7 +27,7 @@ #if MAP_H > 1 if (gpy == 0 && p_vy < 0 && y_pant > 0) { #if defined (COMPRESSED_LEVELS) - n_pant -= level_data->map_w; + n_pant -= level_data.map_w; #else n_pant -= MAP_W; #endif @@ -37,8 +37,8 @@ } #if defined (COMPRESSED_LEVELS) - if (gpy == 144 && p_vy > 0 && y_pant < (level_data->map_h - 1)) { - n_pant += level_data->map_w; + if (gpy == 144 && p_vy > 0 && y_pant < (level_data.map_h - 1)) { + n_pant += level_data.map_w; #else if (gpy == 144 && p_vy > 0 && y_pant < (MAP_H - 1)) { n_pant += MAP_W; @@ -62,8 +62,8 @@ #if MAP_H > 1 #if defined (COMPRESSED_LEVELS) - if (gpy == 0 && p_vy < 0 && n_pant >= level_data->map_w) { - n_pant -= level_data->map_w; + if (gpy == 0 && p_vy < 0 && n_pant >= level_data.map_w) { + n_pant -= level_data.map_w; #else if (gpy == 0 && p_vy < 0 && n_pant >= MAP_W) { n_pant -= MAP_W; @@ -74,8 +74,8 @@ if (gpy == 144 && p_vy > 0) { // 9216 = 144 * 64 #if defined (COMPRESSED_LEVELS) - if (n_pant < level_data->map_w * (level_data->map_h - 1)) { - n_pant += level_data->map_w; + if (n_pant < level_data.map_w * (level_data.map_h - 1)) { + n_pant += level_data.map_w; #else if (n_pant < MAP_W * MAP_H - MAP_W) { n_pant += MAP_W; diff --git a/examples/goku_mal/dev/mainloop/game_loop.h b/examples/goku_mal/dev/mainloop/game_loop.h index be29c503..3f59e563 100644 --- a/examples/goku_mal/dev/mainloop/game_loop.h +++ b/examples/goku_mal/dev/mainloop/game_loop.h @@ -3,9 +3,18 @@ // game_loop.h - Da game loop. + #asm + ; Makes debugging easier + ._game_loop_init + #endasm + playing = 1; player_init (); + #ifdef OBJECT_COUNT + flags [OBJECT_COUNT] = p_objs; + #endif + #ifndef COMPRESSED_LEVELS hotspots_init (); #endif @@ -35,9 +44,9 @@ #ifdef MODE_128K // Play music #ifdef COMPRESSED_LEVELS - wyz_play_music (levels [level].music_id); + PLAY_MUSIC (levels [level].music_id); #else - wyz_play_music (1); + PLAY_MUSIC (1); #endif #endif @@ -67,8 +76,8 @@ #ifdef PLAYER_CHECK_MAP_BOUNDARIES #ifdef COMPRESSED_LEVELS - x_pant = n_pant % level_data->map_w; - y_pant = n_pant / level_data->map_w; + x_pant = n_pant % level_data.map_w; + y_pant = n_pant / level_data.map_w; #else x_pant = n_pant % MAP_W; y_pant = n_pant / MAP_W; #endif @@ -86,6 +95,11 @@ o_pant = 0xff; while (playing) { + #asm + ; Makes debugging easier + ._game_loop_do + #endasm + #ifdef DEBUG_KEYS if (sp_KeyPressed (KEY_M)) { ++ p_objs; beep_fx (0); } if (sp_KeyPressed (KEY_H)) { ++ n_pant; beep_fx (0); } @@ -177,8 +191,10 @@ #endif if (p_killme) { + if (p_life) { player_kill (p_killme); #include "my/ci/on_player_killed.h" + } else playing = 0; } #ifdef PLAYER_CAN_FIRE @@ -187,7 +203,7 @@ #endif #ifdef ENABLE_TILANIMS - do_tilanims (); + tilanims_do (); #endif // Detect fire zone @@ -203,6 +219,23 @@ if (o_pant == n_pant) { #include "mainloop/update_sprites.h" + // Limit frame rate + + #ifdef MIN_FAPS_PER_FRAME + #asm + .ml_min_faps_loop + ld a, (_isrc) + cp MIN_FAPS_PER_FRAME + jr nc, ml_min_faps_loop_end + halt + jr ml_min_faps_loop + + .ml_min_faps_loop_end + xor a + ld (_isrc), a + #endasm + #endif + sp_UpdateNow(); } @@ -226,7 +259,7 @@ if (sp_KeyPressed (KEY_Z)) { if (!key_z_pressed) { #ifdef MODE_128K - wyz_play_sound (0); + PLAY_SOUND (0); #else beep_fx (2); #endif @@ -261,8 +294,7 @@ if (sp_KeyPressed (KEY_H)) { sp_WaitForNoKey (); #ifdef MODE_128K - wyz_stop_sound (); - wyz_play_sound (1); + player_on = 0; #endif clear_sprites (); pause_screen (); @@ -270,11 +302,7 @@ sp_WaitForNoKey (); draw_scr (); #ifdef MODE_128K - #ifdef COMPRESSED_LEVELS - //wyz_play_music (levels [level].music_id); - #else - //wyz_play_music (1); - #endif + player_on = 1; #endif } if (sp_KeyPressed (KEY_Y)) { @@ -284,7 +312,12 @@ // Flick the screen ? - #include "mainloop/flick_screen.h" + #if defined ACTIVATE_SCRIPTING && defined COMPRESSED_LEVELS + if (script_result != 3) + #endif + { + #include "mainloop/flick_screen.h" + } // Win game condition @@ -308,7 +341,8 @@ } // Game over condition - if (p_life == 0 + #if defined ACTIVATE_SCRIPTING || (defined(TIMER_ENABLE) && defined(TIMER_GAMEOVER_0)) + if (0 #ifdef ACTIVATE_SCRIPTING || (script_result == 2) #endif @@ -318,14 +352,16 @@ ) { playing = 0; } + #endif #include "my/ci/extra_routines.h" } + sp_UpdateNow (); sp_WaitForNoKey (); #ifdef MODE_128K - wyz_stop_sound (); + STOP_SOUND (); #endif #include "my/ci/after_game_loop.h" diff --git a/examples/goku_mal/dev/mk1.c b/examples/goku_mal/dev/mk1.c index 04a9fe4f..ba5f994d 100644 --- a/examples/goku_mal/dev/mk1.c +++ b/examples/goku_mal/dev/mk1.c @@ -21,6 +21,10 @@ #define FIXBITS 6 #define MAX_ENEMS 3 +// Fiddle if you need +#define MAX_TILANIMS 16 +#define TILANIMS_PRIME 7 + /* splib2 memory map 61440 - 61696 IM2 vector table 61697 - 61936 FREEPOOL (240 bytes) @@ -55,7 +59,7 @@ #endif #endif -#define NUMBLOCKS (40 + (MAX_PROJECTILES * 5)) +#define NUMBLOCKS (((1 + MAX_ENEMS) * 10) + (MAX_PROJECTILES * 5)) unsigned char AD_FREE [NUMBLOCKS * 15]; @@ -73,8 +77,6 @@ unsigned char AD_FREE [NUMBLOCKS * 15]; #include "assets/librarian.h" #endif -#include "my/ci/extra_vars.h" - #include "aplib.h" #include "pantallas.h" @@ -90,10 +92,19 @@ unsigned char AD_FREE [NUMBLOCKS * 15]; #include "assets/extrasprites.h" #endif +#include "my/ci/extra_vars.h" + #ifdef MODE_128K - #include "wyzplayer.h" + #ifdef USE_ARKOS_PLAYER + #include "sound/arkosplayer.h" + #else + #include "sound/wyzplayer.h" + #endif #else - #include "beeper.h" + #include "sound/beeper.h" + #ifdef MIN_FAPS_PER_FRAME + #include "engine/isr.h" + #endif #endif #include "printer.h" @@ -132,5 +143,5 @@ unsigned char AD_FREE [NUMBLOCKS * 15]; #ifndef MODE_128K // From beepola. Phaser engine by Shiru. - #include "music.h" + #include "sound/music.h" #endif diff --git a/examples/goku_mal/dev/my/ci/after_load.h b/examples/goku_mal/dev/my/ci/after_load.h index 01a70e65..fcbf795f 100644 --- a/examples/goku_mal/dev/my/ci/after_load.h +++ b/examples/goku_mal/dev/my/ci/after_load.h @@ -15,8 +15,8 @@ // Select lang - _x = 11; _y = 11; _t = 71; _gp_gen = "1. ENGLISH"; print_str (); - _x = 11; _y = 12; _t = 71; _gp_gen = "2. SPANISH"; print_str (); + _x = 11; _y = 11; _t = 71; _gp_gen = (unsigned char *) ("1. ENGLISH"); print_str (); + _x = 11; _y = 12; _t = 71; _gp_gen = (unsigned char *) ("2. SPANISH"); print_str (); sp_UpdateNow (); while (lang == 99) { diff --git a/examples/goku_mal/dev/my/ci/before_entering_screen.h b/examples/goku_mal/dev/my/ci/before_entering_screen.h index 398e7171..789ba3e3 100644 --- a/examples/goku_mal/dev/my/ci/before_entering_screen.h +++ b/examples/goku_mal/dev/my/ci/before_entering_screen.h @@ -1,4 +1,4 @@ // MTE MK1 (la Churrera) v5.0 // Copyleft 2010-2014, 2020 by the Mojon Twins -if (n_pant == (o_pant - level_data->map_w)) p_vy = -PLAYER_MAX_VY_SALTANDO; +if (n_pant == (o_pant - level_data.map_w)) p_vy = -PLAYER_MAX_VY_SALTANDO; diff --git a/examples/goku_mal/dev/my/ci/custom_heng.h b/examples/goku_mal/dev/my/ci/custom_heng.h new file mode 100644 index 00000000..f2a1f4b8 --- /dev/null +++ b/examples/goku_mal/dev/my/ci/custom_heng.h @@ -0,0 +1,4 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// Modify p_vx diff --git a/examples/goku_mal/dev/my/ci/enems_custom_respawn.h b/examples/goku_mal/dev/my/ci/enems_custom_respawn.h new file mode 100644 index 00000000..a06ef557 --- /dev/null +++ b/examples/goku_mal/dev/my/ci/enems_custom_respawn.h @@ -0,0 +1,5 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// deactivate RESPAWN_ON_ENTER and write your own routine here! + diff --git a/examples/goku_mal/dev/my/ci/entering_game.h b/examples/goku_mal/dev/my/ci/entering_game.h index 5cd94d3f..310b6776 100644 --- a/examples/goku_mal/dev/my/ci/entering_game.h +++ b/examples/goku_mal/dev/my/ci/entering_game.h @@ -1,9 +1,10 @@ // MTE MK1 (la Churrera) v5.0 // Copyleft 2010-2014, 2020 by the Mojon Twins - +/* if (level==0)n_pant=1; else if (level ==1) n_pant = 23; else if (level ==2) n_pant = 0; else if (level==4) n_pant = 23; else if (level == 3) p_objs=5; +*/ diff --git a/examples/goku_mal/dev/my/ci/extra_functions.h b/examples/goku_mal/dev/my/ci/extra_functions.h index fe17dd01..4de5634e 100644 --- a/examples/goku_mal/dev/my/ci/extra_functions.h +++ b/examples/goku_mal/dev/my/ci/extra_functions.h @@ -31,8 +31,8 @@ void halts_delay (unsigned char n) { unsigned char check_password (void) { wyz_play_sound (SFX_START); - _x = MENU_X; _y = MENU_Y ; _t = 7; _gp_gen = " PASSWORD "; print_str (); - _x = MENU_X; _y = MENU_Y + 1; ; _gp_gen = " "; print_str (); + _x = MENU_X; _y = MENU_Y ; _t = 7; _gp_gen = (unsigned char *) (" PASSWORD "); print_str (); + _x = MENU_X; _y = MENU_Y + 1; ; _gp_gen = (unsigned char *) (" "); print_str (); _x = MENU_X; _y = MENU_Y + 2; ; print_str (); for (gpit = 0; gpit < PASSWORD_LENGTH; ++ gpit) password [gpit] = '.'; diff --git a/examples/goku_mal/dev/my/config.h b/examples/goku_mal/dev/my/config.h index 620d176a..58e9f873 100644 --- a/examples/goku_mal/dev/my/config.h +++ b/examples/goku_mal/dev/my/config.h @@ -8,6 +8,9 @@ // ============================================================================ #define MODE_128K // Read the docs! +#define MIN_FAPS_PER_FRAME 2 // Limits the max # of fps to 50/N +//#define USE_ARKOS_PLAYER // Use Arkos instead of Wyz player for 128k Music +//#define ARKOS_SFX_CHANNEL 0 // SFX Channel (0-2) //#define VENG_SELECTOR // Very advanced! //#define USE_MAP_CUSTOM_DECODER @@ -21,12 +24,14 @@ //#define SCR_FIN 99 // Last screen. 99 = deactivated. //#define PLAYER_FIN_X 99 // //#define PLAYER_FIN_Y 99 // Player tile coordinates to finish game -#define PLAYER_NUM_OBJETOS (level_data->max_objs) // Objects to get to finish game +#define PLAYER_NUM_OBJETOS (level_data.max_objs) // Objects to get to finish game #define PLAYER_LIFE 6 // Max and starting life gauge. #define PLAYER_REFILL 1 // Life recharge #define COMPRESSED_LEVELS // use levels.h instead of mapa.h and enems.h (!) +//#define PER_LEVEL_SPRITESET // use a different spriteset for each level in 48K #define MAX_LEVELS 5 // # of compressed levels #define REFILL_ME // If defined, refill player on each level +//#define NO_RESET_STATS // If defined, player stats are not reset per level // ============================================================================ // II. Engine type @@ -72,6 +77,7 @@ //#define ENABLE_PURSUERS // If defined, type 7 enemies are active //#define DEATH_COUNT_AND 7 //#define DEATH_COUNT_ADD 11 // Frames to wait = ADD + (rand & AND) +//#define PURSUERS_MAX_V 2 // 1, 2, 4. //#define PURSUERS_BASE_CELL 3 // If defined, type 7 enemies are always # #define ENABLE_FANTIES // If defined, Fanties are enabled! @@ -137,6 +143,7 @@ //#define SCRIPTING_KEY_NONE // No action key. //#define ENABLE_EXTERN_CODE // Enables custom code to be run from the script using EXTERN n //#define ENABLE_FIRE_ZONE // Allows to define a zone which auto-triggers "FIRE" +//#define SCRIPT_PAGE 3 // In MODE_128K & COMPRESSED_LEVELS // Timer // ----- @@ -182,6 +189,8 @@ //#define PLAYER_MIN_KILLABLE 3 // Only kill enemies with id >= PLAYER_MIN_KILLABLE //#define PLAYER_STEP_SOUND // Sound while walking. No effect in the BOOTEE engine. +//#define PLAYER_DISABLE_DEFAULT_HENG // To disble default horizontal engine (keyrs) + // Configure keyboard // To define different keys, the first two hex digits are the COLUMN, the next the ROW @@ -261,6 +270,7 @@ //#define USE_AUTO_SHADOWS // Automatic shadows made of darker attributes #define USE_AUTO_TILE_SHADOWS // Automatic shadows using specially defined tiles 32-47. //#define UNPACKED_MAP // Full, uncompressed maps. Shadows settings are ignored. +#define PACKED_MAP_ALT_TILE 19 // If defined, in 16 tiles mode, alt tile (default 19) //#define NO_MASKS // Sprites are rendered using OR instead of masks. #define MASKED_BULLETS // If needed //#define PLAYER_CUSTOM_ANIMATION // Code your own animation in my/custom_animation.h diff --git a/examples/goku_mal/dev/my/fixed_screens.h b/examples/goku_mal/dev/my/fixed_screens.h index a8759ada..f8fb83d6 100644 --- a/examples/goku_mal/dev/my/fixed_screens.h +++ b/examples/goku_mal/dev/my/fixed_screens.h @@ -40,7 +40,7 @@ void game_ending (void) { void game_over (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " GAME OVER! "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *) (" GAME OVER! "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNow (); @@ -56,7 +56,7 @@ void game_over (void) { #if defined(TIMER_ENABLE) && defined(SHOW_TIMER_OVER) void time_over (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " TIME'S UP! "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *) (" TIME'S UP! "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); @@ -73,7 +73,7 @@ void game_over (void) { #ifdef PAUSE_ABORT void pause_screen (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " PAUSED "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *) (" PAUSED "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); } @@ -82,7 +82,7 @@ void game_over (void) { #ifdef COMPRESSED_LEVELS void zone_clear (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " ZONE CLEAR "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *) (" ZONE CLEAR "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); espera_activa (250); diff --git a/examples/goku_mal/dev/my/level_screen.h b/examples/goku_mal/dev/my/level_screen.h index 2e2c4c79..037f23af 100644 --- a/examples/goku_mal/dev/my/level_screen.h +++ b/examples/goku_mal/dev/my/level_screen.h @@ -24,7 +24,7 @@ // Show password if (level) { - _x = 7; _y = 18; _t = 70; _gp_gen = " PASSWORD "; print_str (); + _x = 7; _y = 18; _t = 70; _gp_gen = (unsigned char *) (" PASSWORD "); print_str (); _gp_gen = passwords + ((level - 1) * PASSWORD_LENGTH); gpx = 9; for (gpit = 0; gpit < PASSWORD_LENGTH; ++ gpit) { #asm diff --git a/examples/goku_mal/dev/my/title_screen.h b/examples/goku_mal/dev/my/title_screen.h index f56a2f65..1d452117 100644 --- a/examples/goku_mal/dev/my/title_screen.h +++ b/examples/goku_mal/dev/my/title_screen.h @@ -20,13 +20,13 @@ select_joyfunc (); - _x = 11; _y = 16; _t = 7; _gp_gen = lang ? "-= MENU =-" : "-=SELECT=-"; + _x = 11; _y = 16; _t = 7; _gp_gen = (unsigned char *) (lang ? "-= MENU =-" : "-=SELECT=-"); print_str (); - _x = 11; _y = 17; _gp_gen = lang ? "1 JUGAR " : "1 PLAY "; + _x = 11; _y = 17; _gp_gen = (unsigned char *) (lang ? "1 JUGAR " : "1 PLAY "); print_str (); - _x = 11; _y = 18; _gp_gen = "2 PASSWORD"; + _x = 11; _y = 18; _gp_gen = (unsigned char *) ("2 PASSWORD"); print_str (); sp_UpdateNow (); diff --git a/examples/goku_mal/dev/pantallas.h b/examples/goku_mal/dev/pantallas.h index b1fbc674..2734d92b 100644 --- a/examples/goku_mal/dev/pantallas.h +++ b/examples/goku_mal/dev/pantallas.h @@ -12,17 +12,17 @@ #asm ._s_title - BINARY "title.bin" + BINARY "..\bin\title.bin" ._s_marco #endasm #ifndef DIRECT_TO_PLAY #asm - BINARY "marco.bin" + BINARY "..\bin\marco.bin" #endasm #endif #asm ._s_ending - BINARY "ending.bin" + BINARY "..\bin\ending.bin" #endasm #endif diff --git a/examples/goku_mal/dev/printer.h b/examples/goku_mal/dev/printer.h index b610ad67..7e05d920 100644 --- a/examples/goku_mal/dev/printer.h +++ b/examples/goku_mal/dev/printer.h @@ -4,7 +4,7 @@ // Printing functions unsigned char attr (unsigned char x, unsigned char y) { - if (x >= 14 || y >= 10) return 0; + if (x >= 15 || y >= 10) return 0; return map_attr [x + (y << 4) - y]; } @@ -12,46 +12,48 @@ unsigned char qtile (unsigned char x, unsigned char y) { return map_buff [x + (y << 4) - y]; } -unsigned char attr_mk2 (void) { - // x + 15 * y = x + (16 - 1) * y = x + 16 * y - y = x + (y << 4) - y. - // if (cx1 < 0 || cy1 < 0 || cx1 > 14 || cy1 > 9) return 0; - // return map_attr [cx1 + (cy1 << 4) - cy1]; - #asm - ld a, (_cx1) - cp 15 - jr nc, _attr_reset - - ld a, (_cy1) - cp 10 - jr c, _attr_do - - ._attr_reset - ld hl, 0 - ret - - ._attr_do - ld a, (_cy1) - ld b, a - sla a - sla a - sla a - sla a - sub b - ld b, a - ld a, (_cx1) - add b - ld e, a - ld d, 0 - ld hl, _map_attr - add hl, de - ld a, (hl) - - ld h, 0 - ld l, a - ret - #endasm -} - +#if defined (USE_AUTO_TILE_SHADOWS) || defined (USE_AUTO_SHADOWS) + unsigned char attr_mk2 (void) { + // x + 15 * y = x + (16 - 1) * y = x + 16 * y - y = x + (y << 4) - y. + // if (cx1 < 0 || cy1 < 0 || cx1 > 14 || cy1 > 9) return 0; + // return map_attr [cx1 + (cy1 << 4) - cy1]; + #asm + ld a, (_cx1) + cp 15 + jr nc, _attr_reset + + ld a, (_cy1) + cp 10 + jr c, _attr_do + + ._attr_reset + ld hl, 0 + ret + + ._attr_do + ld a, (_cy1) + ld b, a + sla a + sla a + sla a + sla a + sub b + ld b, a + ld a, (_cx1) + add b + ld e, a + ld d, 0 + ld hl, _map_attr + add hl, de + ld a, (hl) + + ld h, 0 + ld l, a + ret + #endasm + } +#endif + #ifdef COMPRESSED_LEVELS #define ATTR_OFFSET 1536 #else @@ -93,9 +95,9 @@ void draw_coloured_tile (void) { // Fill up c1, c2, c3, c4 then use them #ifdef USE_AUTO_SHADOWS - cx1 = xx - 1; cy1 = yy - 1; rda = *gen_pt; c1 = (nocast && (attr () & 8)) ? (rda & 7) - 1 : rda; t1 = _ta; ++ gen_pt; ++ _ta; - cx1 = xx ; cy1 = yy - 1; rda = *gen_pt; c2 = (nocast && (attr () & 8)) ? (rda & 7) - 1 : rda; t2 = _ta; ++ gen_pt; ++ _ta; - cx1 = xx - 1; cy1 = yy ; rda = *gen_pt; c3 = (nocast && (attr () & 8)) ? (rda & 7) - 1 : rda; t3 = _ta; ++ gen_pt; ++ _ta; + cx1 = xx - 1; cy1 = yy - 1; rda = *gen_pt; c1 = (nocast && (attr_mk2 () & 8)) ? (rda & 7) - 1 : rda; t1 = _ta; ++ gen_pt; ++ _ta; + cx1 = xx ; cy1 = yy - 1; rda = *gen_pt; c2 = (nocast && (attr_mk2 () & 8)) ? (rda & 7) - 1 : rda; t2 = _ta; ++ gen_pt; ++ _ta; + cx1 = xx - 1; cy1 = yy ; rda = *gen_pt; c3 = (nocast && (attr_mk2 () & 8)) ? (rda & 7) - 1 : rda; t3 = _ta; ++ gen_pt; ++ _ta; #endif #ifdef USE_AUTO_TILE_SHADOWS // Precalc @@ -607,7 +609,8 @@ void update_tile (void) { #ifdef ENABLE_TILANIMS // Detect tilanims if (_t >= ENABLE_TILANIMS) { - add_tilanim (_x, _y, _t); + _n = (_x << 4) | _y; + tilanims_add (); } #endif diff --git a/examples/goku_mal/dev/prototypes.h b/examples/goku_mal/dev/prototypes.h index aae155dd..843aaf1a 100644 --- a/examples/goku_mal/dev/prototypes.h +++ b/examples/goku_mal/dev/prototypes.h @@ -7,6 +7,18 @@ #define ENABLE_SIMPLE_COCOS #endif +#ifdef MODE_128K + #ifdef USE_ARKOS_PLAYER + #define PLAY_MUSIC arkos_play_music + #define PLAY_SOUND arkos_play_sound + #define STOP_SOUND arkos_stop_sound + #else + #define PLAY_MUSIC wyz_play_music + #define PLAY_SOUND wyz_play_sound + #define STOP_SOUND wyz_stop_sound + #endif +#endif + // Engine // breakable.h @@ -74,6 +86,7 @@ char player_hidden (void); void run_fire_script (void); void process_tile (void); void draw_scr_background (void); +void draw_scr_hotspots_locks (void); void draw_scr (void); void select_joyfunc (void); unsigned char mons_col_sc_x (void); @@ -108,12 +121,15 @@ void tape_load (void);// TODO! void sg_submenu (void); // tilanim.h -void add_tilanim (unsigned char x, unsigned char y, unsigned char t); -void do_tilanims (void); +void tilanims_add (void); +void tilanims_do (void); +void tilanims_reset (void); -// wyzplayer.h +#ifdef MODE_128K +// wyzplayer.h / arcos_player.h void ISR (void); -void wyz_init (void); -void wyz_play_sound (unsigned char fx_number); -void wyz_play_music (unsigned char song_number); -void wyz_stop_sound (void); +void INIT_PLAYER (void); +void PLAY_SOUND (unsigned char fx_number); +void PLAY_MUSIC (unsigned char song_number); +void STOP_SOUND (void); +#endif diff --git a/examples/goku_mal/dev/setenv.bat b/examples/goku_mal/dev/setenv.bat index e034d8d5..a543b050 100644 --- a/examples/goku_mal/dev/setenv.bat +++ b/examples/goku_mal/dev/setenv.bat @@ -1,6 +1,5 @@ @echo off -set Z88DK_PATH=c:\z88dk10 -set PATH=%Z88DK_PATH%\bin;%PATH% +set Z88DK_PATH=c:\z88dk +set PATH=%Z88DK_PATH%\bin.x86;%PATH% set Z80_OZFILES=%Z88DK_PATH%\Lib\ set ZCCCFG=%Z88DK_PATH%\Lib\Config\ -zcc diff --git a/examples/goku_mal/dev/sound/arkos-addresses.h b/examples/goku_mal/dev/sound/arkos-addresses.h new file mode 100644 index 00000000..fa3225d7 --- /dev/null +++ b/examples/goku_mal/dev/sound/arkos-addresses.h @@ -0,0 +1,9 @@ +#define SFXS_SONG 0xd10c +#define ATINIT 0xc68c +#define ATPLAY 0xc000 +#define ATSFXINIT 0xc6f0 +#define ATSFXPLAY 0xc704 +#define ATSFXSTOP 0xc745 +#define ATSFXSTOPALL 0xc6f7 +#define ATSTOP 0xc6e1 +#define SONG_LIST 0xd5b7 diff --git a/examples/goku_mal/dev/sound/arkosplayer.h b/examples/goku_mal/dev/sound/arkosplayer.h new file mode 100644 index 00000000..c149b1b9 --- /dev/null +++ b/examples/goku_mal/dev/sound/arkosplayer.h @@ -0,0 +1,118 @@ +// MT Engine MK2 +// Copyleft 2014 the Mojon Twins + +// arkosplayer.h +// Arkos Player hook functions + +// This code is based on the original integration by Syx & Nightwolf +// In fact, this code IS the original integration by Syx & Nightwolf. +// I just changed the way params are passed (thanks @reidrac) +// I just automated the process & reindented to meet my own personal taste. + +#include "sound\arkos-addresses.h" + +// Start. + +// isr +#asm + defw 0 +#endasm + +void ISR(void) { + #asm + ld b, 1 + call SetRAMBank + call ATPLAY + ld b, 0 + call SetRAMBank + + ld hl, _isrc + inc (hl) + #endasm +} + +void arkos_stop (void) { + #asm + ld b, 1 + call SetRAMBank + ld a, 201 + ld (ATPLAY),A + ld b, 0 + call SetRAMBank + #endasm +} + +void __FASTCALL__ arkos_play_sound (unsigned char fx_number) { + #asm + di + ld b,1 + call SetRAMBank + + ; __FASTCALL__ -> fx_number is in l! + ld a, ARKOS_SFX_CHANNEL + ld h, 15 + ld e, 50 + ld d, 0 + ld bc, 0 + call ATSFXPLAY + + ld b,0 + call SetRAMBank + ei + #endasm +} + +void __FASTCALL__ arkos_play_music (unsigned char song_number) { + #asm + di + ld b, 1 + call SetRAMBank + + ; Reactivate sound generation + ld a, 175 + ld (ATPLAY),A + + ; Initialize song + ; __FASTCALL__ -> song_number is in l! + ld a, l + add a, a + ld hl, SONG_LIST + add a,l + jr nc, salta_inc_song + inc h + salta_inc_song: + ld l,a + ld e, (hl) + inc hl + ld d, (hl) + + call ATINIT + + ld de, SFXS_SONG + call ATSFXINIT + + ld b, 0 + call SetRAMBank + ei + #endasm +} + +void arkos_stop_sound (void) +{ + #asm + di + ld b,1 + call SetRAMBank + + call ATSFXSTOPALL + call ATSTOP + + ; Turn off sound generation + ld a,201 + ld (ATPLAY),A + + ld b,0 + call SetRAMBank + ei + #endasm +} diff --git a/examples/goku_mal/dev/sound/beeper.h b/examples/goku_mal/dev/sound/beeper.h new file mode 100644 index 00000000..a28f337d --- /dev/null +++ b/examples/goku_mal/dev/sound/beeper.h @@ -0,0 +1,292 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// Beeper.h +// Rutinas de sonido para beeper por Shiru +// I removed di's and ei's, not needed here. +// Copyleft 2010 The Mojon Twins + +#asm + .playsfx + ;di + ld l,a + ld h,0 + add hl,hl + ld de,proclist + add hl,de + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + ld de,0 + jp (hl) + + .sound1 ;enemy destroyed + ex de,hl + ld bc,500 + .sound1l0 + ld a,(hl) + and 16 + out ($FE),a + ld e,a + inc a + sla a + sla a + .sound1l1 + dec a + jr nz,sound1l1 + out ($FE),a + ld a,e + inc a + add a,a + add a,a + add a,a + .sound1l2 + dec a + jr nz,sound1l2 + ld a,b + inc hl + dec bc + ld a,b + or c + jr nz,sound1l0 + ;ei + ret + + .sound2 ;enemy hit + ex de,hl + ld bc,40*256+100 + .sound2l0 + ld a,(hl) + and 16 + out ($FE),a + inc hl + ld a,c + .sound2l1 + dec a + jr nz,sound2l1 + out ($FE),a + ld a,c + .sound2l2 + dec a + jr nz,sound2l2 + djnz sound2l0 + ;ei + ret + + .sound3 ;something + ex de,hl + ld b,100 + ld de,$1020 + .sound3l0 + ld a,(hl) + and d + out ($FE),a + inc hl + ld a,e + .sound3l0a + dec a + jr nz,sound3l0a + djnz sound3l0 + ld b,250 + .sound3l1 + ld a,(hl) + and d + out ($FE),a + inc hl + ld a,2 + .sound3l2 + dec a + jr nz,sound3l2 + xor a + out ($FE),a + ld a,e + .sound3l3 + dec a + jr nz,sound3l3 + djnz sound3l1 + ;ei + ret + + .sound4 ;jump + ld bc,20*256+250 + .sound4l0 + ld a,16 + out ($FE),a + ld a,4 + .sound4l1 + dec a + jr nz,sound4l1 + out ($FE),a + ld a,c + .sound4l2 + dec a + jr nz,sound4l2 + dec c + dec c + djnz sound4l0 + ;ei + ret + + .sound5 ;player hit + ex de,hl + ld bc,100*256+16 + .sound5l0 + ld a,(hl) + and c + out ($FE),a + inc hl + ld a,110 + sub b + ld e,a + and c + out ($FE),a + .sound5l1 + dec e + jr nz,sound5l1 + djnz sound5l0 + ;ei + ret + + .sound6 ;enemy destroyed 2 + ex de,hl + ld bc,20*256+16 + .sound6l0 + ld a,(hl) + inc hl + and c + out ($FE),a + xor a + .sound6l0a + dec a + jr nz,sound6l0a + djnz sound6l0 + .sound6l1 + ld a,(hl) + inc hl + and c + out ($FE),a + .sound6l2 + dec a + jr nz,sound6l2 + djnz sound6l1 + ;ei + ret + + .sound7 ;shot + ex de,hl + ld bc,100*256 + .sound7l0 + ld a,(hl) + inc hl + or c + and 16 + out ($FE),a + ld a,(hl) + srl a + srl a + .sound7l1 + dec a + jr nz,sound7l1 + ld a,c + add a,4 + ld c,a + djnz sound7l0 + ;ei + ret + + .sound8 ;take item + ld a,200 + jr soundItem + .sound9 + ld a,175 + jr soundItem + .sound10 + ld a,100 + .soundItem + ld (frq),a + ld b,4 + ld d,128 + .sound8l2 + push bc + ;.frq=$+1 + ; ld bc,2*256+200 + defb 1 ;ld bc + .frq + defb 200 ;+200 + defb 2 ;2*256 + .sound8l0 + push bc + ld b,50 + .sound8l1 + xor 16 + and 16 + out ($FE),a + ld e,a + ld a,d + .sound8l2b + dec a + jr nz,sound8l2b + out ($FE),a + ld a,129 + sub d + .sound8l3 + dec a + jr nz,sound8l3 + ld a,e + ld e,c + .sound8l4 + dec e + jr nz,sound8l4 + djnz sound8l1 + pop bc + ld a,c + sub 16 + ld c,a + djnz sound8l0 + pop bc + srl d + srl d + djnz sound8l2 + ;ei + ret + + .proclist + defw sound1 + defw sound2 + defw sound3 + defw sound4 + defw sound5 + defw sound6 + defw sound7 + defw sound8 + defw sound9 + defw sound10 +#endasm + +/* + TABLA DE SONIDOS + + n Sonido + ---------- + 0 Enemy destroyed + 1 Enemy hit + 2 Something + 3 Jump + 4 Player hit + 5 Enemy destroyed 2 + 6 Shot + 7 Item #1 (item) + 8 Item #2 (key) + 9 Item #3 (life) + +*/ + +void beep_fx (unsigned char n) { + // Cargar en A el valor de n + asm_int = n; + #asm + ld a, (_asm_int) + call playsfx + #endasm +} diff --git a/examples/goku_mal/dev/sound/music.h b/examples/goku_mal/dev/sound/music.h new file mode 100644 index 00000000..ac0d8625 --- /dev/null +++ b/examples/goku_mal/dev/sound/music.h @@ -0,0 +1,599 @@ +// mte mk1 (la churrera) v5.0 +// copyleft 2010-2014, 2020 by the mojon twins + +#asm +; ***************************************************************************** +; * phaser1 engine, with synthesised drums +; * +; * original code by shiru - .http//shiru.untergrund.net/ +; * modified by chris cowley +; * +; * produced by beepola v1.05.01 +; ****************************************************************************** + +.musicstart + ld hl,musicdata ; <- pointer to music data. change + ; this to play a different song + ld a,(hl) ; get the loop start pointer + ld (pattern_loop_begin),a + inc hl + ld a,(hl) ; get the song end pointer + ld (pattern_loop_end),a + inc hl + ld e,(hl) + inc hl + ld d,(hl) + inc hl + ld (instrum_tbl),hl + ld (current_inst),hl + add hl,de + ld (pattern_addr),hl + xor a + ld (pattern_ptr),a ; set the pattern pointer to zero + ld h,a + ld l,a + ld (note_ptr),hl ; set the note offset (within this pattern) to 0 + +.player + ;di + push iy + ;ld a,border_col + xor a + ld h,$00 + ld l,a + ld (cnt_1a),hl + ld (cnt_1b),hl + ld (div_1a),hl + ld (div_1b),hl + ld (cnt_2),hl + ld (div_2),hl + ld (out_1),a + ld (out_2),a + jr main_loop + +; ******************************************************************************************************** +; * next_pattern +; * +; * select the next pattern in sequence (and handle looping if weve reached pattern_loop_end +; * execution falls through to playnote to play the first note from our next pattern +; ******************************************************************************************************** +.next_pattern + ld a,(pattern_ptr) + inc a + inc a + defb $fe ; cp n +.pattern_loop_end defb 0 + jr nz,no_pattern_loop + ; handle pattern looping at and of song + defb $3e ; ld a,n +.pattern_loop_begin defb 0 +.no_pattern_loop ld (pattern_ptr),a + ld hl,$0000 + ld (note_ptr),hl ; start of pattern (note_ptr = 0) + +.main_loop + ld iyl,0 ; set channel = 0 + +.read_loop + ld hl,(pattern_addr) + ld a,(pattern_ptr) + ld e,a + ld d,0 + add hl,de + ld e,(hl) + inc hl + ld d,(hl) ; now de = start of pattern data + ld hl,(note_ptr) + inc hl ; increment the note pointer and... + ld (note_ptr),hl ; ..store it + dec hl + add hl,de ; now hl = address of note data + ld a,(hl) + or a + jr z,next_pattern ; select next pattern + + bit 7,a + jp z,render ; play the currently defined note(s) and drum + ld iyh,a + and $3f + cp $3c + jp nc,other ; other parameters + add a,a + ld b,0 + ld c,a + ld hl,freq_table + add hl,bc + ld e,(hl) + inc hl + ld d,(hl) + ld a,iyl ; iyl = 0 for channel 1, or = 1 for channel 2 + or a + jr nz,set_note2 + ld (div_1a),de + ex de,hl + + defb $dd,$21 ; ld ix,nn +.current_inst + defw $0000 + + ld a,(ix+$00) + or a + jr z,l809b ; original code jumps into byte 2 of the djnz (invalid opcode fd) + ld b,a +.l8098 add hl,hl + djnz l8098 +.l809b ld e,(ix+$01) + ld d,(ix+$02) + add hl,de + ld (div_1b),hl + ld iyl,1 ; set channel = 1 + ld a,iyh + and $40 + jr z,read_loop ; no phase reset + + ld hl,out_1 ; reset phaser + res 4,(hl) + ld hl,$0000 + ld (cnt_1a),hl + ld h,(ix+$03) + ld (cnt_1b),hl + jr read_loop + +.set_note2 + ld (div_2),de + ld a,iyh + ld hl,out_2 + res 4,(hl) + ld hl,$0000 + ld (cnt_2),hl + jp read_loop + +.set_stop + ld hl,$0000 + ld a,iyl + or a + jr nz,set_stop2 + ; stop channel 1 note + ld (div_1a),hl + ld (div_1b),hl + ld hl,out_1 + res 4,(hl) + ld iyl,1 + jp read_loop +.set_stop2 + ; stop channel 2 note + ld (div_2),hl + ld hl,out_2 + res 4,(hl) + jp read_loop + +.other cp $3c + jr z,set_stop ; stop note + cp $3e + jr z,skip_ch1 ; no changes to channel 1 + inc hl ; instrument change + ld l,(hl) + ld h,$00 + add hl,hl + ld de,(note_ptr) + inc de + ld (note_ptr),de ; increment the note pointer + + defb $01 ; ld bc,nn +.instrum_tbl + defw $0000 + + add hl,bc + ld (current_inst),hl + jp read_loop + +.skip_ch1 + ld iyl,$01 + jp read_loop + +.exit_player + ld hl,$2758 + exx + pop iy + ;ei + ret + +.render + and $7f ; l813a + cp $76 + jp nc,drums + ld d,a + exx + defb $21 ; ld hl,nn +.cnt_1a defw $0000 + defb $dd,$21 ; ld ix,nn +.cnt_1b defw $0000 + defb $01 ; ld bc,nn +.div_1a defw $0000 + defb $11 ; ld de,nn +.div_1b defw $0000 + defb $3e ; ld a,n +.out_1 defb $0 + exx + ex af,af ; beware! + defb $21 ; ld hl,nn +.cnt_2 defw $0000 + defb $01 ; ld bc,nn +.div_2 defw $0000 + defb $3e ; ld a,n +.out_2 defb $00 + +.play_note + ; read keyboard + ld e,a + xor a + in a,($fe) + or $e0 + inc a + +.player_wait_key + jr nz,exit_player + ld a,e + ld e,0 + +.l8168 exx + ex af,af ; beware! + add hl,bc + out ($fe),a + jr c,l8171 + jr l8173 +.l8171 xor $10 +.l8173 add ix,de + jr c,l8179 + jr l817b +.l8179 xor $10 +.l817b ex af,af ; beware! + out ($fe),a + exx + add hl,bc + jr c,l8184 + jr l8186 +.l8184 xor $10 +.l8186 nop + jp l818a + +.l818a exx + ex af,af ; beware! + add hl,bc + out ($fe),a + jr c,l8193 + jr l8195 +.l8193 xor $10 +.l8195 add ix,de + jr c,l819b + jr l819d +.l819b xor $10 +.l819d ex af,af ; beware! + out ($fe),a + exx + add hl,bc + jr c,l81a6 + jr l81a8 +.l81a6 xor $10 +.l81a8 nop + jp l81ac + +.l81ac exx + ex af,af ; beware! + add hl,bc + out ($fe),a + jr c,l81b5 + jr l81b7 +.l81b5 xor $10 +.l81b7 add ix,de + jr c,l81bd + jr l81bf +.l81bd xor $10 +.l81bf ex af,af ; beware! + out ($fe),a + exx + add hl,bc + jr c,l81c8 + jr l81ca +.l81c8 xor $10 +.l81ca nop + jp l81ce + +.l81ce exx + ex af,af ; beware! + add hl,bc + out ($fe),a + jr c,l81d7 + jr l81d9 +.l81d7 xor $10 +.l81d9 add ix,de + jr c,l81df + jr l81e1 +.l81df xor $10 +.l81e1 ex af,af ; beware! + out ($fe),a + exx + add hl,bc + jr c,l81ea + jr l81ec +.l81ea xor $10 + +.l81ec dec e + jp nz,l8168 + + exx + ex af,af ; beware! + add hl,bc + out ($fe),a + jr c,l81f9 + jr l81fb +.l81f9 xor $10 +.l81fb add ix,de + jr c,l8201 + jr l8203 +.l8201 xor $10 +.l8203 ex af,af ; beware! + out ($fe),a + exx + add hl,bc + jr c,l820c + jr l820e +.l820c xor $10 + +.l820e dec d + jp nz,play_note + + ld (cnt_2),hl + ld (out_2),a + exx + ex af,af ; beware! + ld (cnt_1a),hl + ld (cnt_1b),ix + ld (out_1),a + jp main_loop + +; ************************************************************ +; * drums - synthesised +; ************************************************************ +.drums + add a,a ; on entry a=$75+drum number (i.e. $76 to $7e) + ld b,0 + ld c,a + ld hl,drum_table - 236 + add hl,bc + ld e,(hl) + inc hl + ld d,(hl) + ex de,hl + jp (hl) + +.drum_tone1 ld l,16 + jr drum_tone +.drum_tone2 ld l,12 + jr drum_tone +.drum_tone3 ld l,8 + jr drum_tone +.drum_tone4 ld l,6 + jr drum_tone +.drum_tone5 ld l,4 + jr drum_tone +.drum_tone6 ld l,2 +.drum_tone + ld de,3700 + ld bc,$0101 + //ld a,border_col + xor a +.dt_loop0 out ($fe),a + dec b + jr nz,dt_loop1 + xor 16 + ld b,c + ex af,af ; beware! + ld a,c + add a,l + ld c,a + ex af,af ; beware! +.dt_loop1 dec e + jr nz,dt_loop0 + dec d + jr nz,dt_loop0 + jp main_loop + +.drum_noise1 ld de,2480 + ld ixl,1 + jr drum_noise +.drum_noise2 ld de,1070 + ld ixl,10 + jr drum_noise +.drum_noise3 ld de,365 + ld ixl,101 +.drum_noise + ld h,d + ld l,e + //ld a,border_col + xor a + ld c,a +.dn_loop0 ld a,(hl) + and 16 + or c + out ($fe),a + ld b,ixl +.dn_loop1 djnz dn_loop1 + inc hl + dec e + jr nz,dn_loop0 + dec d + jr nz,dn_loop0 + jp main_loop + +.pattern_addr defw $0000 +.pattern_ptr defb 0 +.note_ptr defw $0000 + +; ************************************************************** +; * frequency table +; ************************************************************** +.freq_table + defw 178,189,200,212,225,238,252,267,283,300,318,337 + defw 357,378,401,425,450,477,505,535,567,601,637,675 + defw 715,757,802,850,901,954,1011,1071,1135,1202,1274,1350 + defw 1430,1515,1605,1701,1802,1909,2023,2143,2270,2405,2548,2700 + defw 2860,3030,3211,3402,3604,3818,4046,4286,4541,4811,5097,5400 + +; ***************************************************************** +; * synth drum lookup table +; ***************************************************************** +.drum_table + defw drum_tone1,drum_tone2,drum_tone3,drum_tone4,drum_tone5,drum_tone6 + defw drum_noise1,drum_noise2,drum_noise3 + + +.musicdata + defb 0 ; pattern loop begin * 2 + defb 16 ; song length * 2 + defw 8 ; offset to start of song (length of instrument table) + defb 1 ; multiple + defw 10 ; detune + defb 0 ; phase + defb 1 ; multiple + defw 5 ; detune + defb 1 ; phase + +.patterndata + defw pat0 + defw pat1 + defw pat0 + defw pat1 + defw pat2 + defw pat3 + defw pat2 + defw pat3 + +; *** pattern data - $00 marks the end of a pattern *** +.pat0 + defb $bd,0 + defb 152 + defb 140 + defb 6 + defb 157 + defb 140 + defb 6 + defb 159 + defb 188 + defb 6 + defb 152 + defb 140 + defb 6 + defb 157 + defb 6 + defb 159 + defb 6 + defb 152 + defb 6 + defb 159 + defb 6 + defb 151 + defb 139 + defb 6 + defb 157 + defb 139 + defb 6 + defb 159 + defb 188 + defb 6 + defb 151 + defb 139 + defb 6 + defb 157 + defb 6 + defb 159 + defb 6 + defb 151 + defb 6 + defb 159 + defb 6 + defb $00 +.pat1 + defb $bd,0 + defb 150 + defb 138 + defb 6 + defb 157 + defb 138 + defb 6 + defb 159 + defb 188 + defb 6 + defb 150 + defb 138 + defb 6 + defb 157 + defb 6 + defb 159 + defb 6 + defb 150 + defb 6 + defb 159 + defb 6 + defb 149 + defb 137 + defb 6 + defb 159 + defb 137 + defb 6 + defb 157 + defb 188 + defb 6 + defb 149 + defb 137 + defb 6 + defb 159 + defb 6 + defb 157 + defb 145 + defb 6 + defb 149 + defb 6 + defb 159 + defb 6 + defb $00 +.pat2 + defb $bd,2 + defb 140 + defb 152 + defb 24 + defb 140 + defb 6 + defb 141 + defb 6 + defb 140 + defb 12 + defb 139 + defb 163 + defb 24 + defb 139 + defb 6 + defb 140 + defb 6 + defb 139 + defb 12 + defb $00 +.pat3 + defb 138 + defb 150 + defb 24 + defb 138 + defb 6 + defb 139 + defb 6 + defb 138 + defb 12 + defb 137 + defb 161 + defb 30 + defb 133 + defb 145 + defb 18 + defb $00 + +#endasm \ No newline at end of file diff --git a/examples/goku_mal/dev/wyzplayer.h b/examples/goku_mal/dev/sound/wyzplayer.h similarity index 60% rename from examples/goku_mal/dev/wyzplayer.h rename to examples/goku_mal/dev/sound/wyzplayer.h index dea53369..b06fedd7 100644 --- a/examples/goku_mal/dev/wyzplayer.h +++ b/examples/goku_mal/dev/sound/wyzplayer.h @@ -25,61 +25,67 @@ void ISR(void) { #asm - ld b, 1 - call SetRAMBank - call WYZPLAYERISR - ld b, 0 - call SetRAMBank + ld a, (_player_on) + or a + ret z + ld b, 1 + call SetRAMBank + call WYZPLAYERISR + ld b, 0 + call SetRAMBank + + ld hl, _isrc + inc (hl) #endasm } void wyz_init (void) { #asm - ld b,1 - call SetRAMBank - call WYZPLAYERINIT - ld b,0 - call SetRAMBank + ld b,1 + call SetRAMBank + call WYZPLAYERINIT + ld b,0 + call SetRAMBank #endasm } void __FASTCALL__ wyz_play_sound (unsigned char fx_number) { #asm - di - ld b, 1 - call SetRAMBank - ; __FASTCALL__ -> fx_number is in l! - ld b, l - call INICIAEFECTO - ld b, 0 - call SetRAMBank - ei + di + ld b, 1 + call SetRAMBank + ; __FASTCALL__ -> fx_number is in l! + ld b, l + call INICIAEFECTO + ld b, 0 + call SetRAMBank + ei #endasm } void __FASTCALL__ wyz_play_music (unsigned char song_number) { #asm - di - ld b, 1 - call SetRAMBank - ; __FASTCALL__ -> song_number is in l! - ld a, l - call CARGA_CANCION - ld b, 0 - call SetRAMBank - ei + di + ld b, 1 + call SetRAMBank + ; __FASTCALL__ -> song_number is in l! + ld a, l + call CARGA_CANCION + ld b, 0 + call SetRAMBank + ei #endasm song_playing = song_number; } void wyz_stop_sound (void) { #asm - di - ld b,1 - call SetRAMBank - call SILENCIA_PLAYER - ld b,0 - call SetRAMBank - ei + di + ld b,1 + call SetRAMBank + call SILENCIA_PLAYER + ld b,0 + call SetRAMBank + ei #endasm } diff --git a/examples/goku_mal/dev/tilanim.h b/examples/goku_mal/dev/tilanim.h index 3e62c5a7..cfeaafaf 100644 --- a/examples/goku_mal/dev/tilanim.h +++ b/examples/goku_mal/dev/tilanim.h @@ -2,43 +2,102 @@ // Copyleft 2010-2014, 2020 by the Mojon Twins // tilanim.h -// Rutina para animar tiles. -#define MAX_TILANIMS 64 -#define UPDATE_FREQ 7 -unsigned char max_tilanims; -unsigned char tacount; +void tilanims_reset (void) { + #asm + ld hl, _tilanims_ft + ld de, _tilanims_ft + 1 + ld bc, MAX_TILANIMS - 1 + xor a + ld (hl), a + ldir + ld (_tacount), a + ld (_tait), a + ld (_max_tilanims), a + #endasm +} + +void tilanims_add (void) { + #asm + ld de, (_max_tilanims) + ld d, 0 -typedef struct { - unsigned char xy; - unsigned char ft; -} TILANIM; + ld a, (__n) + ld hl, _tilanims_xy + add hl, de + ld (hl), a -TILANIM tilanims [MAX_TILANIMS]; + ld a, (__t) + ld hl, _tilanims_ft + add hl, de + ld (hl), a -void add_tilanim (unsigned char x, unsigned char y, unsigned char t) { - tilanims [max_tilanims].xy = (x << 4) + y; - tilanims [max_tilanims].ft = t; - - ++ max_tilanims; + ld a, e + inc a + ld (_max_tilanims), a + #endasm } -unsigned char tait; -void do_tilanims (void) { - if (max_tilanims == 0) return; - - tacount = (tacount + 1) & UPDATE_FREQ; - if (!tacount) { - // Select tile - tait = rand () % max_tilanims; - - // Flip bit 7: - tilanims [tait].ft = tilanims [tait].ft ^ 128; +void tilanims_do (void) { + #asm + ld a, (_max_tilanims) + or a + ret z + + ld a, (_tait) + add TILANIMS_PRIME + cp MAX_TILANIMS + jr c, _tilanims_tait_0_skip + sub MAX_TILANIMS + ._tilanims_tait_0_skip + ld (_tait), a + + // Check counter for tilanim #tait + ld d, 0 + ld e, a + + // Check of active + ld hl, _tilanims_ft + add hl, de + ld a, (hl) + or a + ret z + + // Flip bit 7 + ld hl, _tilanims_ft + add hl, de + ld a, (hl) + xor 128 + ld (hl), a + + // Which tile? + bit 7, a + jr z, _tilanims_no_flick + + inc a + ._tilanims_no_flick + and 127 + ld (__t), a // Draw tile - _x = tilanims [tait].xy >> 4; - _y = tilanims [tait].xy & 15; - _t = (tilanims [tait].ft & 127) + (tilanims [tait].ft >> 7); - draw_invalidate_coloured_tile_gamearea (); - } + ld hl, _tilanims_xy + add hl, de + ld a, (hl) + ld c, a + srl a + srl a + srl a + and 0xfe + add VIEWPORT_X + ld (__x), a + + ld a, c + and 15 + sla a + add VIEWPORT_Y + ld (__y), a + + call _draw_coloured_tile + call _invalidate_tile + #endasm } diff --git a/examples/goku_mal/dev/zcc_opt.def b/examples/goku_mal/dev/zcc_opt.def deleted file mode 100644 index 2e9e29a1..00000000 --- a/examples/goku_mal/dev/zcc_opt.def +++ /dev/null @@ -1,8 +0,0 @@ - -IF !DEFINED_STACKPTR - defc DEFINED_STACKPTR = 1 - defc STACKPTR = 23999 -ENDIF - - DEFINE DEFINED_myzorg - defc myzorg = 24000 diff --git a/examples/helmet/bin/ending.bin b/examples/helmet/bin/ending.bin new file mode 100644 index 00000000..bfe1d906 Binary files /dev/null and b/examples/helmet/bin/ending.bin differ diff --git a/examples/helmet/bin/marco.bin b/examples/helmet/bin/marco.bin new file mode 100644 index 00000000..62123e85 Binary files /dev/null and b/examples/helmet/bin/marco.bin differ diff --git a/examples/helmet/bin/title.bin b/examples/helmet/bin/title.bin new file mode 100644 index 00000000..87edc168 Binary files /dev/null and b/examples/helmet/bin/title.bin differ diff --git a/examples/helmet/dev/128k.h b/examples/helmet/dev/128k.h index 2f4b4b97..317fd7a2 100644 --- a/examples/helmet/dev/128k.h +++ b/examples/helmet/dev/128k.h @@ -6,99 +6,19 @@ void SetRAMBank(void) { #asm .SetRAMBank + ld a, b + or a + jp z, restISR + xor a + ld i, a + jp keepGoing + .restISR + ld a, $f0 + ld i, a + .keepGoing ld a, 16 or b ld bc, $7ffd out (C), a #endasm } -/* -// Esto lo empecé pero por ahora lo dejo aparcado :-/ -#ifdef MOVE_STUFF_TO_RAM_6 -typedef struct { - int x, y; - unsigned char x1, y1, x2, y2; - char mx, my; - char t; - unsigned char life; -} MALOTE; - -MALOTE malotes [3]; -MALOTE *malote_copy; - -void ram6_to_ram (void) { - // This function copies current screen data from RAM 6 to low RAM (new screen) - #asm - di - ld b, 6 - call SetRAMBank - #endasm - - // Map screen -#ifdef UNPACKED_MAP - map_pointer = 0xc000 + (n_pant * 150); -#else - map_pointer = 0xc000 + (n_pant * 75); -#endif - for (gpit = 0; gpit < 150; gpit ++) { -#ifdef UNPACKED_MAP - // Mapa tipo UNPACKED - gpd = *map_pointer ++; - map_buff [gpit] = gpd; -#else - // Mapa tipo PACKED - if (!(gpit & 1)) { - gpc = *map_pointer ++; - gpd = gpc >> 4; - } else { - gpd = gpc & 15; - } - map_buff [gpit] = gpd; -#endif - } - - // Enems - enoffs = n_pant * 3; -#ifdef UNPACKED_MAP - map_pointer = 0xc000 + MAP_W * MAP_H * 150 + 12 * enoffs; -#else - map_pointer = 0xc000 + MAP_W * MAP_H * 75 + 12 * enoffs; -#endif - malote_copy = malotes; - for (gpit = 0; gpit < 36; gpit ++) { - *malote_copy ++ = *map_pointer ++; - } - enoffs = 0; - - // Hotspots - // Bolts - - // Get back - #asm - di - ld b, 0 - call SetRAMBank - #endasm -} - -void ram_to_ram6 (void) { - // This function copies current screen data from low RAM to RAM 6 (update) - #asm - di - ld b, 6 - call SetRAMBank - #endasm - - // Enems - // Hotspots - // Bolts - - // Get back - #asm - di - ld b, 0 - call SetRAMBank - #endasm -} -#endif -*/ \ No newline at end of file diff --git a/examples/helmet/dev/aplib.h b/examples/helmet/dev/aplib.h index 88a31fda..11441f46 100644 --- a/examples/helmet/dev/aplib.h +++ b/examples/helmet/dev/aplib.h @@ -1,13 +1,6 @@ // MTE MK1 (la Churrera) v5.0 // Copyleft 2010-2014, 2020 by the Mojon Twins -unsigned int ram_address; -unsigned int ram_destination; - -#ifdef MODE_128K - unsigned char ram_page; -#endif - #asm ; aPPack decompressor diff --git a/examples/helmet/dev/assets/ay_fx_numbers.h b/examples/helmet/dev/assets/ay_fx_numbers.h index 411264ac..d1c0346e 100644 --- a/examples/helmet/dev/assets/ay_fx_numbers.h +++ b/examples/helmet/dev/assets/ay_fx_numbers.h @@ -1,20 +1,42 @@ // MTE MK1 (la Churrera) v5.0 // Copyleft 2010-2014, 2020 by the Mojon Twins -#define SFX_START 0 -#define SFX_BREAKABLE_HIT 1 -#define SFX_BREAKABLE_BREAK 2 -#define SFX_PUSH_BOX 3 -#define SFX_OPEN_LOCK 3 -#define SFX_SHOOT 4 -#define SFX_OBJECT_GET 5 -#define SFX_KILL_ENEMY_STEP 6 -#define SFX_KILL_ENEMY_SHOOT 6 -#define SFX_HIT_ENEMY 7 -#define SFX_ONE_OBJECT_GET 8 -#define SFX_ONE_OBJECT_WRONG 9 -#define SFX_KEY_GET 10 -#define SFX_REFILL_GET 11 -#define SFX_JUMP 12 -#define SFX_SPIKES 13 -#define SFX_ENEMY_HIT 14 +#ifdef USE_ARKOS_PLAYER + #define SFX_START 1 + #define SFX_BREAKABLE_HIT 1 + #define SFX_BREAKABLE_BREAK 2 + #define SFX_PUSH_BOX 3 + #define SFX_OPEN_LOCK 3 + #define SFX_SHOOT 4 + #define SFX_OBJECT_GET 5 + #define SFX_KILL_ENEMY_STEP 6 + #define SFX_KILL_ENEMY_SHOOT 6 + #define SFX_HIT_ENEMY 7 + #define SFX_ONE_OBJECT_GET 8 + #define SFX_ONE_OBJECT_WRONG 9 + #define SFX_KEY_GET 4 + #define SFX_REFILL_GET 11 + #define SFX_JUMP 2 + #define SFX_SPIKES 2 + #define SFX_ENEMY_HIT 8 + +#else + #define SFX_START 0 + #define SFX_BREAKABLE_HIT 1 + #define SFX_BREAKABLE_BREAK 2 + #define SFX_PUSH_BOX 3 + #define SFX_OPEN_LOCK 3 + #define SFX_SHOOT 4 + #define SFX_OBJECT_GET 5 + #define SFX_KILL_ENEMY_STEP 6 + #define SFX_KILL_ENEMY_SHOOT 6 + #define SFX_HIT_ENEMY 7 + #define SFX_ONE_OBJECT_GET 8 + #define SFX_ONE_OBJECT_WRONG 9 + #define SFX_KEY_GET 10 + #define SFX_REFILL_GET 11 + #define SFX_JUMP 12 + #define SFX_SPIKES 13 + #define SFX_ENEMY_HIT 14 + +#endif \ No newline at end of file diff --git a/examples/helmet/dev/assets/levels.h b/examples/helmet/dev/assets/levels.h index c601614a..bd29b455 100644 --- a/examples/helmet/dev/assets/levels.h +++ b/examples/helmet/dev/assets/levels.h @@ -14,7 +14,7 @@ // Map data, 75 or 150 * (MAP_W*MAP_H) bytes // Bolts, 32 * 4 = 128 bytes // Tileset, 2304 bytes -// Enemies, MAP_W * MAP_H * 3 * 10 bytes +// Enemies, MAP_W * MAP_H * MAX_ENEMS * 10 bytes // Hotspots, MAP_W * MAP_H * 3 bytes // Behs, 48 bytes // Spriteset, 2312 bytes @@ -64,7 +64,7 @@ extern unsigned char font [0]; ._font BINARY "font.bin" #endasm -extern LEVELHEADER level_data [0]; +extern LEVELHEADER level_data; #asm ._level_data defs 16 #endasm @@ -94,7 +94,7 @@ extern unsigned char tileset [0]; extern MALOTE malotes [0]; #asm - ._malotes defs MAP_W * MAP_H * 3 * 10 + ._malotes defs MAP_W * MAP_H * MAX_ENEMS * 10 #endasm extern HOTSPOT hotspots [0]; diff --git a/examples/helmet/dev/compile.bat b/examples/helmet/dev/compile.bat index 0f33f14f..12bc342d 100644 --- a/examples/helmet/dev/compile.bat +++ b/examples/helmet/dev/compile.bat @@ -31,24 +31,65 @@ echo Importando GFX ..\..\..\src\utils\png2scr.exe ..\gfx\marco.png ..\gfx\marco.scr > nul ..\..\..\src\utils\png2scr.exe ..\gfx\ending.png ..\gfx\ending.scr > nul ..\..\..\src\utils\png2scr.exe ..\gfx\loading.png loading.bin > nul -..\..\..\src\utils\apultra.exe ..\gfx\title.scr title.bin > nul -..\..\..\src\utils\apultra.exe ..\gfx\marco.scr marco.bin > nul -..\..\..\src\utils\apultra.exe ..\gfx\ending.scr ending.bin > nul +..\..\..\src\utils\apultra.exe ..\gfx\title.scr ..\bin\title.bin > nul +..\..\..\src\utils\apultra.exe ..\gfx\marco.scr ..\bin\marco.bin > nul +..\..\..\src\utils\apultra.exe ..\gfx\ending.scr ..\bin\ending.bin > nul if [%1]==[justassets] goto :end +rem echo Running The Librarian +rem ..\utils\librarian2.exe list=..\bin\list.txt index=assets\librarian.h bins_prefix=..\bin\ rams_prefix=..\bin\ > nul + +rem *** Música AY: Descomenta el player que vayas a usar (Wyz o Arkos) *** + +rem echo Compilando musica 128k - Wyz Player +rem cd ..\mus +rem ..\utils\apultra.exe menu.mus menu.bin +rem ..\utils\apultra.exe level1.mus level1.bin +rem ..\utils\pasmo WYZproPlay47aZXc.ASM ..\bin\RAM1.bin +rem cd ..\dev + +rem echo Compilando musica 128k - Arkos Player +rem cd ..\mus_arkos +rem if [%1]==[nomus] goto :nomus +rem ..\utils\build_mus_bin.exe ram1.bin > nul +rem :nomus +rem copy ram1.bin ..\bin +rem copy arkos-addresses.h ..\dev\sound +rem cd ..\dev + :compile echo Compilando guego -zcc +zx -vn -m mk1.c -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul +zcc +zx -vn mk1.c -O3 -crt0=crt.asm -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul +rem zcc +zx -vn mk1.c -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul ..\..\..\src\utils\printsize.exe %game%.bin ..\..\..\src\utils\printsize.exe scripts.bin +rem *** Tipo de cargador *** + echo Construyendo cinta rem cambia LOADER por el nombre que quieres que salga en Program: -..\..\..\src\utils\bas2tap -a10 -sHELMET_R loader\loader.bas loader.tap > nul +..\..\..\src\utils\bas2tap -a10 -sDOGMOLE loader\loader.bas loader.tap > nul ..\..\..\src\utils\bin2tap -o screen.tap -a 16384 loading.bin > nul ..\..\..\src\utils\bin2tap -o main.tap -a 24000 %game%.bin > nul copy /b loader.tap + screen.tap + main.tap %game%.tap > nul +rem echo Construyendo cinta 128k +rem ..\..\..\src\utils\imanol.exe ^ +rem in=loader\loaderzx.asm-orig ^ +rem out=loader\loader.asm ^ +rem ram1_length=?..\bin\RAM1.bin ^ +rem ram3_length=?..\bin\RAM3.bin ^ +rem mb_length=?%game%.bin > nul + +rem ..\utils\pasmo.exe loader\loader.asm ..\bin\loader.bin loader.txt + +rem cambia LOADER por el nombre que quieres que salga en Program: +rem ..\..\..\src\utils\GenTape.exe %game%.tap ^ +rem basic 'LOADER' 10 ..\bin\loader.bin ^ +rem data loading.bin ^ +rem data ..\bin\RAM1.bin ^ +rem data ..\bin\RAM3.bin ^ +rem data %game%.bin if [%1]==[justcompile] goto :end if [%1]==[noclean] goto :end diff --git a/examples/helmet/dev/crt.asm b/examples/helmet/dev/crt.asm new file mode 100644 index 00000000..27e0d47d --- /dev/null +++ b/examples/helmet/dev/crt.asm @@ -0,0 +1,17 @@ + MODULE zx82_crt0 + INCLUDE "zcc_opt.def" + XREF _main ; main() is always external to crt0 code + + IF !STACKPTR + defc STACKPTR = $FFFF + ENDIF + + IF !CRT_ORG_CODE + defc CRT_ORG_CODE = 32768 + ENDIF + + org CRT_ORG_CODE + +start: + ld sp,STACKPTR + jp _main diff --git a/examples/helmet/dev/definitions.h b/examples/helmet/dev/definitions.h index 69b1d6ac..38f3bd82 100644 --- a/examples/helmet/dev/definitions.h +++ b/examples/helmet/dev/definitions.h @@ -6,7 +6,8 @@ .fsClipStruct defb 0, 24, 0, 32 #endasm -void *joyfunc = sp_JoyKeyboard; // Puntero a la función de manejo seleccionada. +//void *joyfunc = sp_JoyKeyboard; // Puntero a la función de manejo seleccionada. +unsigned int (*joyfunc)(struct sp_UDK *) = sp_JoyKeyboard; const void *joyfuncs [] = { sp_JoyKeyboard, sp_JoyKempston, sp_JoySinclair1 @@ -31,8 +32,15 @@ void *u_free = sp_FreeBlock; // Safe stuff in low(est) RAM -unsigned char safe_byte @ 23296; +unsigned char safe_byte @ 23296; +unsigned int ram_address @ 23297; +unsigned int ram_destination @ 23299; + +#ifdef MODE_128K + unsigned char ram_page @ 23301; +#endif + // Globales muy globalizadas struct sp_SS *sp_player; @@ -49,7 +57,7 @@ unsigned char enoffs; // Aux char asm_number; -unsigned int asm_int; +unsigned int asm_int @ 23302; unsigned int asm_int_2; unsigned int seed; unsigned char half_life; @@ -111,7 +119,7 @@ unsigned char p_tx, p_ty; #endif signed int ptgmx, ptgmy; -const unsigned char *spacer = " "; +unsigned char *spacer = " "; unsigned char enit; @@ -173,7 +181,7 @@ unsigned char map_attr [150]; unsigned char map_buff [150] @ FREEPOOL; // Breakable walls/etc #ifdef BREAKABLE_WALLS - unsigned char brk_buff [150] @ 23297; + unsigned char brk_buff [150] @ 23296+16; #endif // posición del objeto (hotspot). Para no objeto, @@ -187,7 +195,7 @@ unsigned char hotspot_destroy; #ifndef MAX_FLAGS #define MAX_FLAGS 16 #endif -unsigned char flags[MAX_FLAGS]; +unsigned char flags[MAX_FLAGS]; // Globalized unsigned char o_pant; @@ -251,6 +259,7 @@ unsigned char objs_old, keys_old, life_old, killed_old; #ifdef COMPRESSED_LEVELS unsigned char *level_str = "LEVEL 0X"; + unsigned char silent_level = 0; #endif #ifdef GET_X_MORE @@ -271,12 +280,24 @@ unsigned char x0, y0, x1, y1; unsigned char ptx1, pty1, ptx2, pty2; unsigned char *_gp_gen; +#ifdef ENABLE_TILANIMS + unsigned char tait; + unsigned char max_tilanims; + unsigned char tacount; + unsigned char tilanims_xy [MAX_TILANIMS]; + unsigned char tilanims_ft [MAX_TILANIMS]; +#endif + +#if defined USE_AUTO_TILE_SHADOWS || defined USE_AUTO_SHADOWS || defined ENABLE_TILANIMS + unsigned char xx, yy; +#endif + #if defined USE_AUTO_TILE_SHADOWS || defined USE_AUTO_SHADOWS unsigned char c1, c2, c3, c4; unsigned char t1, t2, t3, t4; unsigned char nocast, _ta; - unsigned char xx, yy; #endif + #ifdef USE_AUTO_TILE_SHADOWS unsigned a1, a2, a3; unsigned char *gen_pt_alt; @@ -291,4 +312,7 @@ unsigned char *_gp_gen; #ifdef MODE_128K unsigned char song_playing = 0; + unsigned char player_on = 1; #endif + +unsigned char isrc; diff --git a/examples/helmet/dev/engine.h b/examples/helmet/dev/engine.h index 067691a1..bbbbfb9f 100644 --- a/examples/helmet/dev/engine.h +++ b/examples/helmet/dev/engine.h @@ -153,7 +153,7 @@ void espera_activa (int espera) { // Sonido #ifdef MODE_128K - wyz_play_sound (SFX_PUSH_BOX); + PLAY_SOUND (SFX_PUSH_BOX); #else beep_fx (2); #endif @@ -182,7 +182,7 @@ void espera_activa (int espera) { -- p_keys; #ifdef MODE_128K - wyz_play_sound (SFX_OPEN_LOCK); + PLAY_SOUND (SFX_OPEN_LOCK); #else beep_fx (8); #endif @@ -329,15 +329,15 @@ void draw_scr_background (void) { #endasm #endif - draw_coloured_tile (); - - #if defined ENABLE_TILANIMS && defined UNPACKED_MAP - // Detect tilanims + #ifdef ENABLE_TILANIMS if (_t >= ENABLE_TILANIMS) { - add_tilanim ((_x - VIEWPORT_X) >> 1, (_y - VIEWPORT_Y) >> 1, _t); + _n = (((_x - VIEWPORT_X) << 3) & 0xf0) | ((_y - VIEWPORT_Y) >> 1); + tilanims_add (); } #endif - + + draw_coloured_tile (); + //_x += 2; if (_x == VIEWPORT_X + 30) { _x = VIEWPORT_X; _y += 2; } #asm ld a, (__x) @@ -358,34 +358,7 @@ void draw_scr_background (void) { #endif } -void draw_scr (void) { - is_rendering = 1; - - #ifdef ENABLE_TILANIMS - max_tilanims = 0; - #endif - - #ifdef ENABLE_FIRE_ZONE - f_zone_ac = 0; - #endif - - draw_scr_background (); - - // Object setup - - enems_load (); - - #ifdef ACTIVATE_SCRIPTING - #if defined LINE_OF_TEXT && !defined LINE_OF_TEXT_NO_AUTOERASE - _x = LINE_OF_TEXT_X; _y = LINE_OF_TEXT; _t = LINE_OF_TEXT_ATTR; _gp_gen = " "; print_str (); - #endif - // Ejecutamos los scripts de entrar en pantalla: - run_script (2 * MAP_W * MAP_H + 1); // ENTERING ANY - run_script (n_pant << 1); // ENTERING SCREEN n - #endif - - #include "my/ci/entering_screen.h" - +void draw_scr_hotspots_locks (void) { /* hotspot_y = 240; rdx = (hotspots [n_pant].xy >> 4); @@ -537,6 +510,14 @@ void draw_scr (void) { cp c jr nz, _open_locks_done + // Remove x=y=np=0 pseudobug in multilevel games + #ifdef COMPRESSED_LEVELS + ld a, b + or d + or e + jr z, _open_locks_done + #endif + ._open_locks_do ld a, d ld (__x), a @@ -576,6 +557,37 @@ void draw_scr (void) { jr nz, _open_locks_loop #endasm #endif +} + +void draw_scr (void) { + is_rendering = 1; + + #ifdef ENABLE_TILANIMS + tilanims_reset (); + #endif + + #ifdef ENABLE_FIRE_ZONE + f_zone_ac = 0; + #endif + + draw_scr_background (); + + // Object setup + + enems_load (); + + #ifdef ACTIVATE_SCRIPTING + #if defined LINE_OF_TEXT && !defined LINE_OF_TEXT_NO_AUTOERASE + _x = LINE_OF_TEXT_X; _y = LINE_OF_TEXT; _t = LINE_OF_TEXT_ATTR; _gp_gen = " "; print_str (); + #endif + // Ejecutamos los scripts de entrar en pantalla: + run_script (2 * MAP_W * MAP_H + 1); // ENTERING ANY + run_script (n_pant << 1); // ENTERING SCREEN n + #endif + + #include "my/ci/entering_screen.h" + + draw_scr_hotspots_locks (); #ifdef PLAYER_CAN_FIRE bullets_init (); @@ -612,7 +624,8 @@ void select_joyfunc (void) { } #ifdef MODE_128K - wyz_play_sound (SFX_START); + STOP_SOUND (); + PLAY_SOUND (SFX_START); sp_WaitForNoKey (); #endif } diff --git a/examples/helmet/dev/engine/breakable.h b/examples/helmet/dev/engine/breakable.h index 81e191c1..01e9423f 100644 --- a/examples/helmet/dev/engine/breakable.h +++ b/examples/helmet/dev/engine/breakable.h @@ -16,14 +16,14 @@ void break_wall (void) { } else { _n = _t = 0; update_tile (); #ifdef MODE_128K - gpix = SFX_BREAKABLE_BREAK + gpit = SFX_BREAKABLE_BREAK; #else gpit = 0; #endif #include "my/ci/on_wall_broken.h" } #ifdef MODE_128K - wyz_play_sound (gpit); + PLAY_SOUND (gpit); #else // Show what just happened before the sound interrupts the action sp_UpdateNow (); diff --git a/examples/helmet/dev/engine/bullets.h b/examples/helmet/dev/engine/bullets.h index 4dda4259..2278b516 100644 --- a/examples/helmet/dev/engine/bullets.h +++ b/examples/helmet/dev/engine/bullets.h @@ -54,10 +54,11 @@ void bullets_fire (void) { #ifdef PLAYER_CAN_FIRE_FLAG if (flags [PLAYER_CAN_FIRE_FLAG] == 0) return; #endif + #ifdef MAX_AMMO if (!p_ammo) return; - -- p_ammo; #endif + // Buscamos una bala libre for (b_it = 0; b_it < MAX_BULLETS; ++ b_it) { if (bullets_estado [b_it] == 0) { @@ -165,7 +166,7 @@ void bullets_fire (void) { #endif #ifdef MODE_128K - wyz_play_sound (SFX_SHOOT); + PLAY_SOUND (SFX_SHOOT); #else beep_fx (6); #endif @@ -180,8 +181,12 @@ void bullets_fire (void) { #include "my/ci/on_player_fires.h" - bullets_update (); + bullets_update (); + #ifdef MAX_AMMO + -- p_ammo; + #endif + break; } } diff --git a/examples/helmet/dev/engine/c_levels.h b/examples/helmet/dev/engine/c_levels.h index 15113eb1..1385cf0e 100644 --- a/examples/helmet/dev/engine/c_levels.h +++ b/examples/helmet/dev/engine/c_levels.h @@ -10,12 +10,12 @@ void prepare_level (void) { #endif { n_pant = level_data.scr_ini; - gpx = level_data->ini_x << 4; p_x = gpx << 6; - gpy = level_data->ini_y << 4; p_y = gpy << 6; + gpx = level_data.ini_x << 4; p_x = gpx << 6; + gpy = level_data.ini_y << 4; p_y = gpy << 6; } #ifdef ACTIVATE_SCRIPTING - main_script_offset = levels [level]->script_offset; + main_script_offset = levels [level].script_offset; #endif #else unpack ((unsigned int) levels [level].c_map_bolts, (unsigned int) (mapa)); @@ -27,8 +27,8 @@ void prepare_level (void) { unpack ((unsigned int) levels [level].c_sprites, (unsigned int) (sprites + 16)); #endif - level_data->map_w = levels.map_w; - level_data->map_h = levels.map_h; + level_data.map_w = levels [level].map_w; + level_data.map_h = levels [level].map_h; #ifdef ACTIVATE_SCRIPTING if (script_result != 3) diff --git a/examples/helmet/dev/engine/enem_mods/enem_type_pursuers.h b/examples/helmet/dev/engine/enem_mods/enem_type_pursuers.h index 7cd62b19..601aa01f 100644 --- a/examples/helmet/dev/engine/enem_mods/enem_type_pursuers.h +++ b/examples/helmet/dev/engine/enem_mods/enem_type_pursuers.h @@ -9,8 +9,8 @@ _en_x = _en_x1; _en_y = _en_y1; en_an_alive [enit] = 1; - en_an_rawv [enit] = 1 << (rand () % 5); - if (en_an_rawv [enit] > 4) en_an_rawv [enit] = 2; + en_an_rawv [enit] = 1 << (rand () & 3); + if (en_an_rawv [enit] > PURSUERS_MAX_V) en_an_rawv [enit] = 2; en_an_dead_row [enit] = 11 + (rand () & 7); #if defined(PLAYER_STEPS_ON_ENEMIES) || defined(PLAYER_CAN_FIRE) _en_life = ENEMIES_LIFE_GAUGE; diff --git a/examples/helmet/dev/engine/enem_mods/enem_type_pursuers_asm.h b/examples/helmet/dev/engine/enem_mods/enem_type_pursuers_asm.h index 6980b4b1..6ce2cc20 100644 --- a/examples/helmet/dev/engine/enem_mods/enem_type_pursuers_asm.h +++ b/examples/helmet/dev/engine/enem_mods/enem_type_pursuers_asm.h @@ -34,19 +34,21 @@ ld a, 1 ld (hl), a - // en_an_rawv [enit] = 1 << (rand () % 5); + // en_an_rawv [enit] = 1 << (rand () & 3); push bc call _rand // rand -> L - ld de, 5 - ex de, hl - call l_div // l_div :: DE / HL -> HL = cociente; DE = resto - ex de, hl // HL = resto + + ld a, l + and 3 + ld l, a + ld h, 0 + ld de, 1 call l_asl // l_asl :: DE << HL -> HL ld a, l pop bc - cp 5 + cp PURSUERS_MAX_V+1 jr c, _eij_rawv_set ld a, 2 diff --git a/examples/helmet/dev/engine/enengine.h b/examples/helmet/dev/engine/enengine.h index ed162380..4acb013d 100644 --- a/examples/helmet/dev/engine/enengine.h +++ b/examples/helmet/dev/engine/enengine.h @@ -14,8 +14,8 @@ #if defined(PLAYER_STEPS_ON_ENEMIES) || defined (PLAYER_CAN_FIRE) void enems_init (void) { enit = 0; - while (enit < MAP_W * MAP_H * 3) { - malotes [enit].t = malotes [enit].t & 15; + while (enit < MAP_W * MAP_H * MAX_ENEMS) { + malotes [enit].t = malotes [enit].t & 0xEF; // Clear bit 4 #ifdef PLAYER_CAN_FIRE malotes [enit].life = ENEMIES_LIFE_GAUGE; #endif @@ -121,7 +121,7 @@ void enems_draw_current (void) { void enems_load (void) { // Movemos y cambiamos a los enemigos según el tipo que tengan - enoffs = n_pant * 3; + enoffs = n_pant * MAX_ENEMS; for (enit = 0; enit < MAX_ENEMS; ++ enit) { en_an_frame [enit] = 0; @@ -141,6 +141,8 @@ void enems_load (void) { #endif #endif + #include "my/ci/enems_custom_respawn.h" + en_an_next_frame [enit] = sprite_18_a; switch (malotes [enoffsmasi].t & 0x1f) { @@ -224,7 +226,7 @@ void enems_move (void) { ld hl, (_enoffsmasi) ld h, 0 - #ifdef PLAYER_CAN_FIRE + #if defined PLAYER_CAN_FIRE || defined COMPRESSED_LEVELS add hl, hl // x2 ld d, h ld e, l // DE = x2 @@ -448,7 +450,7 @@ void enems_move (void) { #endif { #ifdef MODE_128K - wyz_play_sound (SFX_KILL_ENEMY_STEP); + PLAY_SOUND (SFX_KILL_ENEMY_STEP); en_an_state [enit] = GENERAL_DYING; en_an_count [enit] = 12; en_an_next_frame [enit] = sprite_17_a; @@ -547,7 +549,7 @@ void enems_move (void) { #ifdef MODE_128K en_an_state [enit] = GENERAL_DYING; en_an_count [enit] = 12; - wyz_play_sound (SFX_KILL_ENEMY_SHOOT); + PLAY_SOUND (SFX_KILL_ENEMY_SHOOT); #else beep_fx (5); en_an_next_frame [enit] = sprite_18_a; @@ -561,7 +563,7 @@ void enems_move (void) { } #ifdef MODE_128K - wyz_play_sound (SFX_HIT_ENEMY); + PLAY_SOUND (SFX_HIT_ENEMY); #else beep_fx (1); #endif diff --git a/examples/helmet/dev/engine/hotspots.h b/examples/helmet/dev/engine/hotspots.h index 10f9978c..3a1b3223 100644 --- a/examples/helmet/dev/engine/hotspots.h +++ b/examples/helmet/dev/engine/hotspots.h @@ -25,13 +25,13 @@ void hotspots_do (void) { if (p_objs == 0) { p_objs ++; #ifdef MODE_128K - wyz_play_sound (SFX_ONE_OBJECT_GET); + PLAY_SOUND (SFX_ONE_OBJECT_GET); #else beep_fx (9); #endif } else { #ifdef MODE_128K - wyz_play_sound (SFX_ONE_OBJECT_WRONG); + PLAY_SOUND (SFX_ONE_OBJECT_WRONG); #else beep_fx (4); #endif @@ -45,7 +45,7 @@ void hotspots_do (void) { #endif #ifdef MODE_128K - wyz_play_sound (SFX_OBJECT_GET); + PLAY_SOUND (SFX_OBJECT_GET); #else beep_fx (9); #endif @@ -70,7 +70,7 @@ void hotspots_do (void) { case 2: p_keys ++; #ifdef MODE_128K - wyz_play_sound (SFX_KEY_GET); + PLAY_SOUND (SFX_KEY_GET); #else beep_fx (7); #endif @@ -83,7 +83,7 @@ void hotspots_do (void) { if (p_life > PLAYER_LIFE) p_life = PLAYER_LIFE; #ifdef MODE_128K - wyz_play_sound (SFX_REFILL_GET); + PLAY_SOUND (SFX_REFILL_GET); #else beep_fx (8); #endif @@ -97,7 +97,7 @@ void hotspots_do (void) { else p_ammo = MAX_AMMO; #ifdef MODE_128K - wyz_play_sound (SFX_REFILL_GET); + PLAY_SOUND (SFX_REFILL_GET); #else beep_fx (9); #endif @@ -111,7 +111,7 @@ void hotspots_do (void) { else timer_t = 99; #ifdef MODE_128K - wyz_play_sound (SFX_REFILL_GET); + PLAY_SOUND (SFX_REFILL_GET); #else beep_fx (7); #endif @@ -122,7 +122,7 @@ void hotspots_do (void) { case 6: mem_save (); #ifdef MODE_128K - wyz_play_sound (SFX_START); + PLAY_SOUND (SFX_START); #else beep_fx (7); #endif diff --git a/examples/helmet/dev/engine/isr.h b/examples/helmet/dev/engine/isr.h new file mode 100644 index 00000000..76b5bf4a --- /dev/null +++ b/examples/helmet/dev/engine/isr.h @@ -0,0 +1,15 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// Very simple ISR which counts frames. + +#asm + defw 0 // 2 bytes libres +#endasm + +void ISR (void) { + #asm + ld hl, _isrc + inc (hl) + #endasm +} diff --git a/examples/helmet/dev/engine/player.h b/examples/helmet/dev/engine/player.h index d7c0b0c2..59844d68 100644 --- a/examples/helmet/dev/engine/player.h +++ b/examples/helmet/dev/engine/player.h @@ -28,17 +28,20 @@ void player_init (void) { #if !defined(COMPRESSED_LEVELS) || defined(REFILL_ME) p_life = PLAYER_LIFE; #endif - p_objs = 0; - p_keys = 0; - p_killed = 0; p_disparando = 0; - #ifdef MAX_AMMO - #ifdef INITIAL_AMMO - p_ammo = INITIAL_AMMO; - #else - p_ammo = MAX_AMMO; + + #ifndef NO_RESET_STATS + p_objs = 0; + p_keys = 0; + p_killed = 0; + #ifdef MAX_AMMO + #ifdef INITIAL_AMMO + p_ammo = INITIAL_AMMO; + #else + p_ammo = MAX_AMMO; + #endif #endif - #endif + #endif #ifdef TIMER_ENABLE timer_count = 0; @@ -283,6 +286,7 @@ unsigned char player_move (void) { // Collision, may set possee, hit_v + // Velocity positive (going downwards) player_calc_bounding_box (); hit_v = 0; @@ -400,7 +404,7 @@ unsigned char player_move (void) { p_saltando = 1; p_cont_salto = 0; #ifdef MODE_128K - wyz_play_sound (SFX_JUMP); + PLAY_SOUND (SFX_JUMP); #else beep_fx (3); #endif @@ -426,7 +430,7 @@ unsigned char player_move (void) { p_saltando = 1; p_cont_salto = 0; #ifdef MODE_128K - wyz_play_sound (SFX_JUMP); + PLAY_SOUND (SFX_JUMP); #else beep_fx (3); #endif @@ -721,19 +725,19 @@ unsigned char player_move (void) { } } - p_next_frame = player_cells [p_facing + p_frame]; + p_next_frame = (unsigned char *) (player_cells [p_facing + p_frame]); #elif defined PLAYER_BOOTEE gpit = p_facing << 2; if (p_vy == 0) { - p_next_frame = player_cells [gpit]; + p_next_frame = (unsigned char *) (player_cells [gpit]); } else if (p_vy < 0) { - p_next_frame = player_cells [gpit + 1]; + p_next_frame = (unsigned char *) (player_cells [gpit + 1]); } else { - p_next_frame = player_cells [gpit + 2]; + p_next_frame = (unsigned char *) (player_cells [gpit + 2]); } #else if (!possee && !p_gotten) { - p_next_frame = player_cells [8 + p_facing]; + p_next_frame = (unsigned char *) (player_cells [8 + p_facing]); } else { gpit = p_facing << 2; if (p_vx == 0) { @@ -741,7 +745,7 @@ unsigned char player_move (void) { } else { rda = ((gpx + 4) >> 3) & 3; } - p_next_frame = player_cells [gpit + rda]; + p_next_frame = (unsigned char *) (player_cells [gpit + rda]); } #endif } @@ -756,7 +760,7 @@ void player_kill (unsigned char sound) { player_deplete (); #ifdef MODE_128K - wyz_play_sound (sound); + PLAY_SOUND (sound); #else beep_fx (sound); #endif diff --git a/examples/helmet/dev/engine/player_wip.h b/examples/helmet/dev/engine/player_wip.h new file mode 100644 index 00000000..815761a3 --- /dev/null +++ b/examples/helmet/dev/engine/player_wip.h @@ -0,0 +1,884 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// player.h + +void player_init (void) { + // Inicializa player con los valores iniciales + // (de ahí lo de inicializar). + + #ifndef COMPRESSED_LEVELS + gpx = PLAYER_INI_X << 4; p_x = gpx << 6; + gpy = PLAYER_INI_Y << 4; p_y = gpy << 6; + #endif + p_vy = 0; + p_vx = 0; + p_cont_salto = 1; + p_saltando = 0; + p_frame = 0; + p_subframe = 0; + #ifdef PLAYER_GENITAL + p_facing = FACING_DOWN; + p_facing_v = p_facing_h = 0xff; + #else + p_facing = 1; + #endif + p_estado = EST_NORMAL; + p_ct_estado = 0; + #if !defined(COMPRESSED_LEVELS) || defined(REFILL_ME) + p_life = PLAYER_LIFE; + #endif + p_objs = 0; + p_keys = 0; + p_killed = 0; + p_disparando = 0; + #ifdef MAX_AMMO + #ifdef INITIAL_AMMO + p_ammo = INITIAL_AMMO; + #else + p_ammo = MAX_AMMO; + #endif + #endif + + #ifdef TIMER_ENABLE + timer_count = 0; + timer_zero = 0; + #ifdef TIMER_LAPSE + timer_frames = TIMER_LAPSE; + #endif + #ifdef TIMER_INITIAL + timer_t = TIMER_INITIAL; + #endif + #ifdef TIMER_START + timer_on = 1; + #else + timer_on = 0; + #endif + #endif +} + +void player_calc_bounding_box (void) { + #if defined (BOUNDING_BOX_8_BOTTOM) + #asm + ld a, (_gpx) + add 4 + srl a + srl a + srl a + srl a + ld (_ptx1), a + ld a, (_gpx) + add 11 + srl a + srl a + srl a + srl a + ld (_ptx2), a + ld a, (_gpy) + add 8 + srl a + srl a + srl a + srl a + ld (_pty1), a + ld a, (_gpy) + add 15 + srl a + srl a + srl a + srl a + ld (_pty2), a + #endasm + #elif defined (BOUNDING_BOX_8_CENTERED) + #asm + ld a, (_gpx) + add 4 + srl a + srl a + srl a + srl a + ld (_ptx1), a + ld a, (_gpx) + add 11 + srl a + srl a + srl a + srl a + ld (_ptx2), a + ld a, (_gpy) + add 4 + srl a + srl a + srl a + srl a + ld (_pty1), a + ld a, (_gpy) + add 11 + srl a + srl a + srl a + srl a + ld (_pty2), a + #endasm + #else + #asm + ld a, (_gpx) + srl a + srl a + srl a + srl a + ld (_ptx1), a + ld a, (_gpx) + add 15 + srl a + srl a + srl a + srl a + ld (_ptx2), a + ld a, (_gpy) + srl a + srl a + srl a + srl a + ld (_pty1), a + ld a, (_gpy) + add 15 + srl a + srl a + srl a + srl a + ld (_pty2), a + #endasm + #endif +} + +unsigned char player_move (void) { + + // *************************************************************************** + // MOVEMENT IN THE VERTICAL AXIS + // *************************************************************************** + + #if !defined PLAYER_GENITAL || defined VENG_SELECTOR + + #if !defined PLAYER_DISABLE_GRAVITY + #if defined VENG_SELECTOR && defined PLAYER_VKEYS + if (veng_selector != VENG_KEYS) + #endif + { + // Do gravity + + #asm + ; Signed comparisons are hard + ; p_vy <= PLAYER_MAX_VY_CAYENDO - PLAYER_G + + ; We are going to take a shortcut. + ; If p_vy < 0, just add PLAYER_G. + ; If p_vy > 0, we can use unsigned comparition anyway. + + ld hl, (_p_vy) + bit 7, h + jr nz, _player_gravity_add ; < 0 + + ld de, PLAYER_MAX_VY_CAYENDO - PLAYER_G + or a + push hl + sbc hl, de + pop hl + jr nc, _player_gravity_maximum + + ._player_gravity_add + ld de, PLAYER_G + add hl, de + jr _player_gravity_vy_set + + ._player_gravity_maximum + ld hl, PLAYER_MAX_VY_CAYENDO + + ._player_gravity_vy_set + ld (_p_vy), hl + + ._player_gravity_done + + #ifdef PLAYER_CUMULATIVE_JUMP + ld a, (_p_jmp_on) + or a + jr nz, _player_gravity_p_gotten_done + #endif + + ld a, (_p_gotten) + or a + jr z, _player_gravity_p_gotten_done + + xor a + ld (_p_vy), a + + ._player_gravity_p_gotten_done + #endasm + } + #endif + #endif + + #if defined PLAYER_GENITAL || (defined VENG_SELECTOR && defined PLAYER_VKEYS) + + #if defined (VENG_SELECTOR) + if (veng_selector == VENG_KEYS ) + #endif + { + // Pad do + + if ( ! ((pad0 & sp_UP) == 0 || (pad0 & sp_DOWN) == 0)) { + p_facing_v = 0xff; + wall_v = 0; + if (p_vy > 0) { + p_vy -= PLAYER_RX; + if (p_vy < 0) p_vy = 0; + } else if (p_vy < 0) { + p_vy += PLAYER_RX; + if (p_vy > 0) p_vy = 0; + } + } + + if ((pad0 & sp_UP) == 0) { + p_facing_v = FACING_UP; + if (p_vy > -PLAYER_MAX_VX) p_vy -= PLAYER_AX; + } + + if ((pad0 & sp_DOWN) == 0) { + p_facing_v = FACING_DOWN; + if (p_vy < PLAYER_MAX_VX) p_vy += PLAYER_AX; + } + } + #endif + + #ifdef PLAYER_HAS_JETPAC + #ifdef VENG_SELECTOR + if (veng_selector == VENG_JETPAC) + #endif + { + if ((pad0 & sp_UP) == 0) { + p_vy -= PLAYER_INCR_JETPAC; + if (p_vy < -PLAYER_MAX_VY_JETPAC) p_vy = -PLAYER_MAX_VY_JETPAC; + + #include "my/ci/on_jetpac_boost.h" + + p_jetpac_on = 1; + } else p_jetpac_on = 0; + } + #endif + + #include "my/ci/custom_veng.h" + + p_y += p_vy; + + #if !defined (PLAYER_GENITAL) + if (p_gotten) p_y += ptgmy; + #endif + + // Safe + + if (p_y < 0) p_y = 0; + if (p_y > 9216) p_y = 9216; + + gpy = p_y >> 6; + + // Collision, may set possee, hit_v + + #asm + call _player_calc_bounding_box + + xor a + ld (_hit_v), a + + ld a, (_ptx1) + ld (_cx1), a + ld a, (_ptx2) + ld (_cx2), a + + // Calculate vertical velocity + + ld a, (_p_vy) + #if !defined (PLAYER_GENITAL) + ld c, a + ld a, (_ptgmy) + add c + #endif + + // Skip if not moving in the vertical axis + + or a + jp z, _va_collision_done + + // Check sign + + bit 7, a + jr z, _va_collision_vy_positive + + ._va_collision_vy_negative + + // Velocity negative (going upwards) + + ld a, (_pty1) + ld (_cy1), a + ld (_cy2), a + + call _cm_two_points + + // if ((at1 & 8) || (at2 & 8)) { + ld a, (_at1) + and 8 + jr nz, _va_col_vy_neg_do + + ld a, (_at2) + and 8 + jr z, _va_collision_checkevil + + ._va_col_vy_neg_do + + #ifdef PLAYER_BOUNCE_WITH_WALLS + ld a, (_p_vy) + sra a + neg a + #else + xor a + #endif + ld (_p_vy), a + + ld a, (_pty1) + inc a + sla a + sla a + sla a + sla a + + #if defined (BOUNDING_BOX_8_BOTTOM) + // gpy = ((pty1 + 1) << 4) - 8; + sub 8 + #elif defined (BOUNDING_BOX_8_CENTERED) + // gpy = ((pty1 + 1) << 4) - 4; + sub 4 + #elif defined (BOUNDING_BOX_TINY_BOTTOM) + // gpy = ((pty1 + 1) << 4) - 14; + sub 14 + #else + // gpy = ((pty1 + 1) << 4); + #endif + + ld (_gpy), a + + // p_y = gpy << FIXBITS; 16 bits shift + ld d, 0 + ld e, a + ld l, FIXBITS + call l_asl + ld (_p_y), hl + + #if defined PLAYER_GENITAL || defined LOCKS_CHECK_VERTICAL + ld a, WTOP + ld (_wall_v), a + #endif + + jr _va_collision_checkevil + + ._va_collision_vy_positive + + // Velocity positive (going downwards) + ld a, (_pty2) + ld (_cy1), a + ld (_cy2), a + + call _cm_two_points + + #ifdef PLAYER_GENITAL + // if ((at1 & 8) || (at2 & 8)) { + ld a, (_at1) + and 8 + jr nz, _va_col_vy_pos_do + + ld a, (_at2) + and 8 + jr z, _va_collision_checkevil + #else + // if ((at1 & 8) || + ld a, (_at1) + and 8 + jr nz, _va_col_vy_pos_do + + // (at2 & 8) || + ld a, (_at2) + and 8 + jr nz, _va_col_vy_pos_do + + // (((gpy - 1) & 15) < 8 && + ld a, (_gpy) + dec a + and 15 + cp 8 + jr nc, _va_collision_checkevil + + // ((at1 & 4) || (at2 & 4)))) + ld a, (_at1) + and 4 + jr nz, _va_col_vy_pos_do + + ld a, (_at2) + and 4 + jr z, _va_collision_checkevil + #endif + ._va_col_vy_pos_do + + #ifdef PLAYER_BOUNCE_WITH_WALLS + ld a, (_p_vy) + sra a + neg a + #else + xor a + #endif + ld (_p_vy), a + + ld a, (_pty2) + dec a + sla a + sla a + sla a + sla a + + #ifdef BOUNDING_BOX_8_CENTERED + add 4 + #endif + + ld (_gpy), a + + // p_y = gpy << FIXBITS; 16 bits shift + ld d, 0 + ld e, a + ld l, FIXBITS + call l_asl + ld (_p_y), hl + + #if defined PLAYER_GENITAL || defined LOCKS_CHECK_VERTICAL + ld a, WBOTTOM + ld (_wall_v), a + #endif + + jr _va_collision_done + + ._va_collision_checkevil + + #ifndef DEACTIVATE_EVIL_TILE + #endasm + hit_v = ((at1 & 1) || (at2 & 1)); + #asm + #endif + + ._va_collision_done + #endasm + + gpxx = gpx >> 4; + gpyy = gpy >> 4; + + #ifndef PLAYER_GENITAL + cy1 = cy2 = (gpy + 16) >> 4; + cx1 = ptx1; cx2 = ptx2; + cm_two_points (); + possee = ((at1 & 12) || (at2 & 12)) && (gpy & 15) < 8; + #endif + + // Jump + + #ifdef PLAYER_HAS_JUMP + #ifdef VENG_SELECTOR + if (veng_selector == VENG_JUMP) + #endif + { + #if defined (PLAYER_CAN_FIRE) && !defined (USE_TWO_BUTTONS) + rda = (pad0 & sp_UP) == 0; + #elif defined (PLAYER_CAN_FIRE) && defined (USE_TWO_BUTTONS) + rda = isJoy ? ((pad0 & sp_UP) == 0) : (sp_KeyPressed (key_jump)); + #else + rda = (pad0 & sp_FIRE) == 0; + #endif + + if (rda) { + if (p_saltando == 0) { + if (possee || p_gotten || hit_v) { + p_saltando = 1; + p_cont_salto = 0; + #ifdef MODE_128K + PLAY_SOUND (SFX_JUMP); + #else + beep_fx (3); + #endif + } + } else { + p_vy -= (PLAYER_VY_INICIAL_SALTO + PLAYER_INCR_SALTO - (p_cont_salto >> 1)); + if (p_vy < -PLAYER_MAX_VY_SALTANDO) p_vy = -PLAYER_MAX_VY_SALTANDO; + ++ p_cont_salto; + if (p_cont_salto == 9) p_saltando = 0; + } + } else p_saltando = 0; + } + #endif + + // Bootee engine + + #ifdef PLAYER_BOOTEE + #ifdef VENG_SELECTOR + if (veng_selector == VENG_BOOTEE) + #endif + { + if ( p_saltando == 0 && (possee || p_gotten || hit_v) ) { + p_saltando = 1; + p_cont_salto = 0; + #ifdef MODE_128K + PLAY_SOUND (SFX_JUMP); + #else + beep_fx (3); + #endif + } + + if (p_saltando ) { + p_vy -= (PLAYER_VY_INICIAL_SALTO + PLAYER_INCR_SALTO - (p_cont_salto>>1)); + if (p_vy < -PLAYER_MAX_VY_SALTANDO) p_vy = -PLAYER_MAX_VY_SALTANDO; + ++ p_cont_salto; + if (p_cont_salto == 8) + p_saltando = 0; + } + } + #endif + + // *************************************************************************** + // MOVEMENT IN THE HORIZONTAL AXIS + // *************************************************************************** + + #ifndef PLAYER_DISABLE_DEFAULT_HENG + if ( ! ((pad0 & sp_LEFT) == 0 || (pad0 & sp_RIGHT) == 0)) { + #ifdef PLAYER_GENITAL + p_facing_h = 0xff; + #endif + if (p_vx > 0) { + p_vx -= PLAYER_RX; + if (p_vx < 0) p_vx = 0; + } else if (p_vx < 0) { + p_vx += PLAYER_RX; + if (p_vx > 0) p_vx = 0; + } + wall_h = 0; + } + + if ((pad0 & sp_LEFT) == 0) { + #ifdef PLAYER_GENITAL + p_facing_h = FACING_LEFT; + #endif + if (p_vx > -PLAYER_MAX_VX) { + #ifndef PLAYER_GENITAL + p_facing = 0; + #endif + p_vx -= PLAYER_AX; + } + } + + if ((pad0 & sp_RIGHT) == 0) { + #ifdef PLAYER_GENITAL + p_facing_h = FACING_RIGHT; + #endif + if (p_vx < PLAYER_MAX_VX) { + p_vx += PLAYER_AX; + #ifndef PLAYER_GENITAL + p_facing = 1; + #endif + } + } + #endif + + #include "my/ci/custom_heng.h" + + p_x = p_x + p_vx; + #ifndef PLAYER_GENITAL + p_x += ptgmx; + #endif + + // Safe + + if (p_x < 0) p_x = 0; + if (p_x > 14336) p_x = 14336; + + gpox = gpx; + gpx = p_x >> 6; + + // Collision. May set hit_h + player_calc_bounding_box (); + + hit_h = 0; + cy1 = pty1; cy2 = pty2; + + #if defined (PLAYER_GENITAL) + if (p_vx < 0) + #else + if (p_vx + ptgmx < 0) + #endif + { + cx1 = cx2 = ptx1; + cm_two_points (); + + if ((at1 & 8) || (at2 & 8)) { + #include "my/ci/bg_collision/obstacle_left.h" + + #ifdef PLAYER_BOUNCE_WITH_WALLS + p_vx = -(p_vx / 2); + #else + p_vx = 0; + #endif + + #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) || defined (BOUNDING_BOX_TINY_BOTTOM) + gpx = ((ptx1 + 1) << 4) - 4; + #else + gpx = ((ptx1 + 1) << 4); + #endif + + p_x = gpx << 6; + wall_h = WLEFT; + } + #ifndef DEACTIVATE_EVIL_TILE + else hit_h = ((at1 & 1) || (at2 & 1)); + #endif + + } + + #if defined (PLAYER_GENITAL) + if (p_vx > 0) + #else + if (p_vx + ptgmx > 0) + #endif + { + cx1 = cx2 = ptx2; + cm_two_points (); + + if ((at1 & 8) || (at2 & 8)) { + #include "my/ci/bg_collision/obstacle_right.h" + + #ifdef PLAYER_BOUNCE_WITH_WALLS + p_vx = -(p_vx / 2); + #else + p_vx = 0; + #endif + + #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) || defined (BOUNDING_BOX_TINY_BOTTOM) + gpx = (ptx1 << 4) + 4; + #else + gpx = (ptx1 << 4); + #endif + + p_x = gpx << 6; + wall_h = WRIGHT; + } + #ifndef DEACTIVATE_EVIL_TILE + else hit_h = ((at1 & 1) || (at2 & 1)); + #endif + + } + + // Priority to decide facing + + #ifdef PLAYER_GENITAL + #ifdef TOP_OVER_SIDE + if (p_facing_v != 0xff) { + p_facing = p_facing_v; + } else if (p_facing_h != 0xff) { + p_facing = p_facing_h; + } + #else + if (p_facing_h != 0xff) { + p_facing = p_facing_h; + } else if (p_facing_v != 0xff) { + p_facing = p_facing_v; + } + #endif + #endif + + cx1 = p_tx = (gpx + 8) >> 4; + cy1 = p_ty = (gpy + 8) >> 4; + + rdb = attr (cx1, cy1); + + // Special tiles + if (rdb & 128) { + #include "my/ci/on_special_tile.h" + } + + #if defined (PLAYER_PUSH_BOXES) || !defined (DEACTIVATE_KEYS) + #if defined PLAYER_GENITAL || defined LOCKS_CHECK_VERTICAL + if (wall_v == WTOP) { + // interact up + #if defined (BOUNDING_BOX_8_BOTTOM) + cy1 = (gpy + 7) >> 4; + #elif defined (BOUNDING_BOX_8_CENTERED) + cy1 = (gpy + 3) >> 4; + #else + cy1 = (gpy - 1) >> 3; + #endif + + if (attr (cx1, cy1) == 10) { + x0 = x1 = cx1; y0 = cy1; y1 = cy1 - 1; + process_tile (); + } + + } else if (wall_v == WBOTTOM) { + // interact down + #if defined (BOUNDING_BOX_8_BOTTOM) + cy1 = (gpy + 16) >> 4; + #elif defined (BOUNDING_BOX_8_CENTERED) + cy1 = (gpy + 12) >> 4; + #else + cy1 = (gpy + 16) >> 3; + #endif + + if (attr (cx1, cy1) == 10) { + x0 = x1 = cx1; y0 = cy1; y1 = cy1 + 1; + process_tile (); + } + } else + #endif + + if (wall_h == WLEFT) { + // interact left + #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) + cx1 = (gpx + 3) >> 4; + #else + cx1 = (gpx - 1) >> 4; + #endif + + if (attr (cx1, cy1) == 10) { + y0 = y1 = cy1; x0 = cx1; x1 = cx1 - 1; + process_tile (); + } + } else if (wall_h == WRIGHT) { + // interact right + #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) + cx1 = (gpx + 12) >> 4; + #else + cx1 = (gpx + 16) >> 4; + #endif + if (attr (cx1, cy1) == 10) { + y0 = y1 = cy1; x0 = cx1; x1 = cx1 + 1; + process_tile (); + } + } + #endif + + #ifdef PLAYER_CAN_FIRE + // Disparos + if ((pad0 & sp_FIRE) == 0 && p_disparando == 0) { + p_disparando = 1; + #ifdef FIRE_TO_PUSH + //if (pushed_any == 0) + #endif + bullets_fire (); + #ifdef FIRE_TO_PUSH + //else pushed_any = 0; + #endif + } + + if ((pad0 & sp_FIRE)) + p_disparando = 0; + + #endif + + #ifndef DEACTIVATE_EVIL_TILE + // Tiles que te matan. + // hit_v tiene preferencia sobre hit_h + hit = 0; + if (hit_v) { + hit = 1; + p_vy = addsign (-p_vy, PLAYER_MAX_VX); + } else if (hit_h) { + hit = 1; + p_vx = addsign (-p_vx, PLAYER_MAX_VX); + } + + if (hit) { + #ifdef PLAYER_FLICKERS + if (p_estado == EST_NORMAL) + #endif + { + #ifdef MODE_128K + p_killme = SFX_SPIKES; + #else + p_killme = 4; + #endif + } + } + #endif + + // Select animation frame + + #ifdef PLAYER_CUSTOM_ANIMATION + #include "my/custom_animation.h" + #elif defined PLAYER_GENITAL + if (p_vx || p_vy) { + ++ p_subframe; + if (p_subframe == 4) { + p_subframe = 0; + p_frame = !p_frame; + #ifdef PLAYER_STEP_SOUND + step (); + #endif + } + } + + p_next_frame = player_cells [p_facing + p_frame]; + #elif defined PLAYER_BOOTEE + gpit = p_facing << 2; + if (p_vy == 0) { + p_next_frame = player_cells [gpit]; + } else if (p_vy < 0) { + p_next_frame = player_cells [gpit + 1]; + } else { + p_next_frame = player_cells [gpit + 2]; + } + #else + if (!possee && !p_gotten) { + p_next_frame = player_cells [8 + p_facing]; + } else { + gpit = p_facing << 2; + if (p_vx == 0) { + rda = 1; + } else { + rda = ((gpx + 4) >> 3) & 3; + } + p_next_frame = player_cells [gpit + rda]; + } + #endif +} + +void player_deplete (void) { + p_life = (p_life > p_kill_amt) ? p_life - p_kill_amt : 0; +} + +void player_kill (unsigned char sound) { + p_killme = 0; + + player_deplete (); + + #ifdef MODE_128K + PLAY_SOUND (sound); + #else + beep_fx (sound); + #endif + + #ifdef CP_RESET_WHEN_DYING + #ifdef CP_RESET_ALSO_FLAGS + mem_load (); + #else + n_pant = sg_pool [MAX_FLAGS]; + p_x = sg_pool [MAX_FLAGS + 1] << 10; + p_y = sg_pool [MAX_FLAGS + 2] << 10; + #endif + o_pant = 0xff; // Reload + #endif + + #ifdef PLAYER_FLICKERS + p_estado = EST_PARP; + p_ct_estado = 50; + #endif +} + diff --git a/examples/helmet/dev/helmet.tap b/examples/helmet/dev/helmet.tap index b10ce8fb..47433557 100644 Binary files a/examples/helmet/dev/helmet.tap and b/examples/helmet/dev/helmet.tap differ diff --git a/examples/helmet/dev/mainloop.h b/examples/helmet/dev/mainloop.h index 504226eb..9875ead0 100644 --- a/examples/helmet/dev/mainloop.h +++ b/examples/helmet/dev/mainloop.h @@ -12,7 +12,7 @@ void main (void) { di #endasm - #ifdef MODE_128K + #if defined MODE_128K || defined MIN_FAPS_PER_FRAME sp_InitIM2(0xf1f1); sp_CreateGenericISR(0xf1f1); sp_RegisterHook(255, ISR); @@ -20,8 +20,15 @@ void main (void) { #asm ei #endasm + #endif + + #ifdef MODE_128K + #ifdef USE_ARKOS_PLAYER + arkos_stop(); + #else + wyz_init (); + #endif - wyz_init (); #endif cortina (); @@ -48,13 +55,13 @@ void main (void) { // Sprite creation #ifdef NO_MASKS - sp_player = sp_CreateSpr (sp_OR_SPRITE, 3, sprite_2_a); + sp_player = sp_CreateSpr (NO_MASKS, 3, sprite_2_a); sp_AddColSpr (sp_player, sprite_2_b); sp_AddColSpr (sp_player, sprite_2_c); p_current_frame = p_next_frame = sprite_2_a; - for (gpit = 0; gpit < 3; gpit ++) { - sp_moviles [gpit] = sp_CreateSpr(sp_OR_SPRITE, 3, sprite_9_a); + for (gpit = 0; gpit < MAX_ENEMS; gpit ++) { + sp_moviles [gpit] = sp_CreateSpr(NO_MASKS, 3, sprite_9_a); sp_AddColSpr (sp_moviles [gpit], sprite_9_b); sp_AddColSpr (sp_moviles [gpit], sprite_9_c); en_an_current_frame [gpit] = sprite_9_a; @@ -98,7 +105,7 @@ void main (void) { #include "my/ci/after_load.h" while (1) { - #ifdef ACTIVATE_SCRIPTING + #if defined ACTIVATE_SCRIPTING && !defined MODE_128K main_script_offset = (int) (main_script); #endif @@ -114,7 +121,22 @@ void main (void) { #include "my/ci/before_game.h" + #ifdef NO_RESET_STATS + p_objs = 0; + p_keys = 0; + p_killed = 0; + #ifdef MAX_AMMO + #ifdef INITIAL_AMMO + p_ammo = INITIAL_AMMO; + #else + p_ammo = MAX_AMMO; + #endif + #endif + #endif + #ifdef COMPRESSED_LEVELS + silent_level = 0; + #ifdef ENABLE_CHECKPOINTS if (sg_do_load) level = sg_level; else level = 0; #endif @@ -134,9 +156,12 @@ void main (void) { { #ifdef COMPRESSED_LEVELS - #include "my/level_screen.h" + if (silent_level == 0) { + #include "my/level_screen.h" + } + silent_level = 0; - prepare_level (level); + prepare_level (); #endif #ifndef DIRECT_TO_PLAY @@ -161,17 +186,19 @@ void main (void) { #ifdef COMPRESSED_LEVELS if (success) { #ifdef MODE_128K - //wyz_play_music (6); + //PLAY_MUSIC (6); #endif - zone_clear (); + if (silent_level == 0) zone_clear (); #ifdef ACTIVATE_SCRIPTING if (script_result != 3) #else if (warp_to_level == 0) #endif - ++ level; + { + level ++; + } if (level >= MAX_LEVELS #ifdef ACTIVATE_SCRIPTING @@ -183,7 +210,7 @@ void main (void) { } } else { #ifdef MODE_128K - //wyz_play_music (8); + //PLAY_MUSIC (8); #endif #if defined(TIMER_ENABLE) && defined(TIMER_GAMEOVER_0) && defined(SHOW_TIMER_OVER) @@ -193,7 +220,7 @@ void main (void) { #endif #ifdef MODE_128K - wyz_stop_sound (); + STOP_SOUND (); #endif break; } @@ -201,7 +228,7 @@ void main (void) { if (success) { game_ending (); } else { - //wyz_play_music (8); + //PLAY_MUSIC (8); game_over (); } #endif diff --git a/examples/helmet/dev/mainloop/flick_screen.h b/examples/helmet/dev/mainloop/flick_screen.h index c1c039b9..97b4515c 100644 --- a/examples/helmet/dev/mainloop/flick_screen.h +++ b/examples/helmet/dev/mainloop/flick_screen.h @@ -13,7 +13,7 @@ } #if defined (COMPRESSED_LEVELS) - if (gpx == 224 && p_vx > 0 && x_pant < (level_data->map_w - 1)) + if (gpx == 224 && p_vx > 0 && x_pant < (level_data.map_w - 1)) #else if (gpx == 224 && p_vx > 0 && x_pant < (MAP_W - 1)) #endif @@ -27,7 +27,7 @@ #if MAP_H > 1 if (gpy == 0 && p_vy < 0 && y_pant > 0) { #if defined (COMPRESSED_LEVELS) - n_pant -= level_data->map_w; + n_pant -= level_data.map_w; #else n_pant -= MAP_W; #endif @@ -37,8 +37,8 @@ } #if defined (COMPRESSED_LEVELS) - if (gpy == 144 && p_vy > 0 && y_pant < (level_data->map_h - 1)) { - n_pant += level_data->map_w; + if (gpy == 144 && p_vy > 0 && y_pant < (level_data.map_h - 1)) { + n_pant += level_data.map_w; #else if (gpy == 144 && p_vy > 0 && y_pant < (MAP_H - 1)) { n_pant += MAP_W; @@ -62,8 +62,8 @@ #if MAP_H > 1 #if defined (COMPRESSED_LEVELS) - if (gpy == 0 && p_vy < 0 && n_pant >= level_data->map_w) { - n_pant -= level_data->map_w; + if (gpy == 0 && p_vy < 0 && n_pant >= level_data.map_w) { + n_pant -= level_data.map_w; #else if (gpy == 0 && p_vy < 0 && n_pant >= MAP_W) { n_pant -= MAP_W; @@ -74,8 +74,8 @@ if (gpy == 144 && p_vy > 0) { // 9216 = 144 * 64 #if defined (COMPRESSED_LEVELS) - if (n_pant < level_data->map_w * (level_data->map_h - 1)) { - n_pant += level_data->map_w; + if (n_pant < level_data.map_w * (level_data.map_h - 1)) { + n_pant += level_data.map_w; #else if (n_pant < MAP_W * MAP_H - MAP_W) { n_pant += MAP_W; diff --git a/examples/helmet/dev/mainloop/game_loop.h b/examples/helmet/dev/mainloop/game_loop.h index 5f33e522..98217950 100644 --- a/examples/helmet/dev/mainloop/game_loop.h +++ b/examples/helmet/dev/mainloop/game_loop.h @@ -3,9 +3,18 @@ // game_loop.h - Da game loop. + #asm + ; Makes debugging easier + ._game_loop_init + #endasm + playing = 1; player_init (); + #ifdef OBJECT_COUNT + flags [OBJECT_COUNT] = p_objs; + #endif + #ifndef COMPRESSED_LEVELS hotspots_init (); #endif @@ -35,9 +44,9 @@ #ifdef MODE_128K // Play music #ifdef COMPRESSED_LEVELS - wyz_play_music (levels [level].music_id); + PLAY_MUSIC (levels [level].music_id); #else - wyz_play_music (1); + PLAY_MUSIC (1); #endif #endif @@ -67,8 +76,8 @@ #ifdef PLAYER_CHECK_MAP_BOUNDARIES #ifdef COMPRESSED_LEVELS - x_pant = n_pant % level_data->map_w; - y_pant = n_pant / level_data->map_w; + x_pant = n_pant % level_data.map_w; + y_pant = n_pant / level_data.map_w; #else x_pant = n_pant % MAP_W; y_pant = n_pant / MAP_W; #endif @@ -86,18 +95,15 @@ o_pant = 0xff; while (playing) { + #asm + ; Makes debugging easier + ._game_loop_do + #endasm + #ifdef DEBUG_KEYS - /* if (sp_KeyPressed (KEY_M)) { ++ p_objs; beep_fx (0); } if (sp_KeyPressed (KEY_H)) { ++ n_pant; beep_fx (0); } if (sp_KeyPressed (KEY_Y)) { -- n_pant; beep_fx (0); } - */ - - if (sp_KeyPressed (KEY_Y) && sp_KeyPressed (KEY_H)) { - beep_fx (0); - success = 1; - playing = 0; - } #endif p_kill_amt = 1; @@ -185,8 +191,10 @@ #endif if (p_killme) { + if (p_life) { player_kill (p_killme); #include "my/ci/on_player_killed.h" + } else playing = 0; } #ifdef PLAYER_CAN_FIRE @@ -195,7 +203,7 @@ #endif #ifdef ENABLE_TILANIMS - do_tilanims (); + tilanims_do (); #endif // Detect fire zone @@ -211,6 +219,23 @@ if (o_pant == n_pant) { #include "mainloop/update_sprites.h" + // Limit frame rate + + #ifdef MIN_FAPS_PER_FRAME + #asm + .ml_min_faps_loop + ld a, (_isrc) + cp MIN_FAPS_PER_FRAME + jr nc, ml_min_faps_loop_end + halt + jr ml_min_faps_loop + + .ml_min_faps_loop_end + xor a + ld (_isrc), a + #endasm + #endif + sp_UpdateNow(); } @@ -234,7 +259,7 @@ if (sp_KeyPressed (KEY_Z)) { if (!key_z_pressed) { #ifdef MODE_128K - wyz_play_sound (0); + PLAY_SOUND (0); #else beep_fx (2); #endif @@ -269,8 +294,7 @@ if (sp_KeyPressed (KEY_H)) { sp_WaitForNoKey (); #ifdef MODE_128K - wyz_stop_sound (); - wyz_play_sound (1); + player_on = 0; #endif clear_sprites (); pause_screen (); @@ -278,11 +302,7 @@ sp_WaitForNoKey (); draw_scr (); #ifdef MODE_128K - #ifdef COMPRESSED_LEVELS - //wyz_play_music (levels [level].music_id); - #else - //wyz_play_music (1); - #endif + player_on = 1; #endif } if (sp_KeyPressed (KEY_Y)) { @@ -292,7 +312,12 @@ // Flick the screen ? - #include "mainloop/flick_screen.h" + #if defined ACTIVATE_SCRIPTING && defined COMPRESSED_LEVELS + if (script_result != 3) + #endif + { + #include "mainloop/flick_screen.h" + } // Win game condition @@ -316,7 +341,8 @@ } // Game over condition - if (p_life == 0 + #if defined ACTIVATE_SCRIPTING || (defined(TIMER_ENABLE) && defined(TIMER_GAMEOVER_0)) + if (0 #ifdef ACTIVATE_SCRIPTING || (script_result == 2) #endif @@ -326,14 +352,16 @@ ) { playing = 0; } + #endif #include "my/ci/extra_routines.h" } + sp_UpdateNow (); sp_WaitForNoKey (); #ifdef MODE_128K - wyz_stop_sound (); + STOP_SOUND (); #endif #include "my/ci/after_game_loop.h" diff --git a/examples/helmet/dev/mk1.c b/examples/helmet/dev/mk1.c index 0b7a4908..ba5f994d 100644 --- a/examples/helmet/dev/mk1.c +++ b/examples/helmet/dev/mk1.c @@ -2,7 +2,7 @@ // Copyleft 2010-2014, 2020 by the Mojon Twins // mk1.c -#define DEBUG_KEYS +//#define DEBUG_KEYS #include // We are using some stuff from splib2 directly. @@ -21,6 +21,10 @@ #define FIXBITS 6 #define MAX_ENEMS 3 +// Fiddle if you need +#define MAX_TILANIMS 16 +#define TILANIMS_PRIME 7 + /* splib2 memory map 61440 - 61696 IM2 vector table 61697 - 61936 FREEPOOL (240 bytes) @@ -55,7 +59,7 @@ #endif #endif -#define NUMBLOCKS (40 + (MAX_PROJECTILES * 5)) +#define NUMBLOCKS (((1 + MAX_ENEMS) * 10) + (MAX_PROJECTILES * 5)) unsigned char AD_FREE [NUMBLOCKS * 15]; @@ -91,9 +95,16 @@ unsigned char AD_FREE [NUMBLOCKS * 15]; #include "my/ci/extra_vars.h" #ifdef MODE_128K - #include "wyzplayer.h" + #ifdef USE_ARKOS_PLAYER + #include "sound/arkosplayer.h" + #else + #include "sound/wyzplayer.h" + #endif #else - #include "beeper.h" + #include "sound/beeper.h" + #ifdef MIN_FAPS_PER_FRAME + #include "engine/isr.h" + #endif #endif #include "printer.h" @@ -132,5 +143,5 @@ unsigned char AD_FREE [NUMBLOCKS * 15]; #ifndef MODE_128K // From beepola. Phaser engine by Shiru. - #include "music.h" + #include "sound/music.h" #endif diff --git a/examples/helmet/dev/my/ci/after_game_loop.h b/examples/helmet/dev/my/ci/after_game_loop.h index c7b67b6e..fa9bfec9 100644 --- a/examples/helmet/dev/my/ci/after_game_loop.h +++ b/examples/helmet/dev/my/ci/after_game_loop.h @@ -2,5 +2,5 @@ // Copyleft 2010-2014, 2020 by the Mojon Twins _x = 1; _y = 0; _t = 71; -_gp_gen = " "; +_gp_gen = (unsigned char *) (" "); print_str (); diff --git a/examples/helmet/dev/my/ci/enems_custom_respawn.h b/examples/helmet/dev/my/ci/enems_custom_respawn.h new file mode 100644 index 00000000..a06ef557 --- /dev/null +++ b/examples/helmet/dev/my/ci/enems_custom_respawn.h @@ -0,0 +1,5 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// deactivate RESPAWN_ON_ENTER and write your own routine here! + diff --git a/examples/helmet/dev/my/ci/entering_screen.h b/examples/helmet/dev/my/ci/entering_screen.h index 8991efab..da175099 100644 --- a/examples/helmet/dev/my/ci/entering_screen.h +++ b/examples/helmet/dev/my/ci/entering_screen.h @@ -6,9 +6,9 @@ // General text if (flags [1]) { - _gp_gen = "BOMBS ARE SET! RETURN TO BASE!"; + _gp_gen = (unsigned char *) ("BOMBS ARE SET! RETURN TO BASE!"); } else { - _gp_gen = " SET 5 BOMBS IN EVIL COMPUTER"; + _gp_gen = (unsigned char *) (" SET 5 BOMBS IN EVIL COMPUTER"); } _x = 1; _y = 0; _t = 71; print_str (); @@ -21,7 +21,7 @@ if (n_pant == 0) { if (flags [1]) { _gp_gen = decos_bombs; draw_decorations (); } else { - _gp_gen = " SET BOMBS IN EVIL COMPUTER "; + _gp_gen = (unsigned char *) (" SET BOMBS IN EVIL COMPUTER "); _x = 1; _y = 0; _t = 71; print_str (); } diff --git a/examples/helmet/dev/my/ci/extra_routines.h b/examples/helmet/dev/my/ci/extra_routines.h index d6aa34f3..dbb14145 100644 --- a/examples/helmet/dev/my/ci/extra_routines.h +++ b/examples/helmet/dev/my/ci/extra_routines.h @@ -15,7 +15,7 @@ if (n_pant == 0 && flags [1] == 0 && gpy < 96 && p_objs == 5) { } _x = 1; _y = 0; _t = 71; - _gp_gen = " DONE! NOW GO BACK TO BASE! "; + _gp_gen = (unsigned char *) (" DONE! NOW GO BACK TO BASE! "); print_str (); } @@ -24,7 +24,7 @@ if (flags [0]) { flags [0] = 0; beep_fx (9); _x = 1; _y = 0; _t = 71; - _gp_gen = " HALF NEW MOTORBIKE FOR SALE! "; + _gp_gen = (unsigned char *) (" HALF NEW MOTORBIKE FOR SALE! "); print_str (); } } diff --git a/examples/helmet/dev/my/config.h b/examples/helmet/dev/my/config.h index cb6cb270..61a4eb4e 100644 --- a/examples/helmet/dev/my/config.h +++ b/examples/helmet/dev/my/config.h @@ -8,6 +8,9 @@ // ============================================================================ //#define MODE_128K // Read the docs! +//#define MIN_FAPS_PER_FRAME 2 // Limits the max # of fps to 50/N +//#define USE_ARKOS_PLAYER // Use Arkos instead of Wyz player for 128k Music +//#define ARKOS_SFX_CHANNEL 0 // SFX Channel (0-2) //#define VENG_SELECTOR // Very advanced! //#define USE_MAP_CUSTOM_DECODER @@ -28,6 +31,7 @@ //#define PER_LEVEL_SPRITESET // use a different spriteset for each level in 48K #define MAX_LEVELS 3 // # of compressed levels //#define REFILL_ME // If defined, refill player on each level +//#define NO_RESET_STATS // If defined, player stats are not reset per level // ============================================================================ // II. Engine type @@ -74,6 +78,8 @@ #define DEATH_COUNT_AND 7 #define DEATH_COUNT_ADD 11 // Frames to wait = ADD + (rand & AND) #define PURSUERS_BASE_CELL 3 // If defined, type 7 enemies are always # +//#define PURSUERS_BASE_CELL 3 // If defined, type 7 enemies are always # +#define PURSUERS_MAX_V 2 // 1, 2, 4. //#define ENABLE_FANTIES // If defined, Fanties are enabled! //#define FANTIES_BASE_CELL 2 // Base sprite cell (0, 1, 2 or 3) @@ -138,6 +144,7 @@ #define SCRIPTING_KEY_NONE // No action key. //#define ENABLE_EXTERN_CODE // Enables custom code to be run from the script using EXTERN n //#define ENABLE_FIRE_ZONE // Allows to define a zone which auto-triggers "FIRE" +//#define SCRIPT_PAGE 3 // In MODE_128K & COMPRESSED_LEVELS // Timer // ----- diff --git a/examples/helmet/dev/my/fixed_screens.h b/examples/helmet/dev/my/fixed_screens.h index 348830f6..748fdcc4 100644 --- a/examples/helmet/dev/my/fixed_screens.h +++ b/examples/helmet/dev/my/fixed_screens.h @@ -26,10 +26,10 @@ void game_ending (void) { #endif // Custom for Helmet - _x = 8; _y = 7; _t = 70; _gp_gen = "CONGRATULATIONS!"; print_str (); - _x = 2; _y = 9; _t = 71; _gp_gen = "YOU MANAGED TO SET THE BOMBS"; print_str (); - _x = 4; _y = 10; _gp_gen = "AND DESTROY THE COMPUTER"; print_str (); - _x = 5; _y = 11; _gp_gen = "MISSION ACCOMPLISHED!!"; print_str (); + _x = 8; _y = 7; _t = 70; _gp_gen = (unsigned char *) ("CONGRATULATIONS!"); print_str (); + _x = 2; _y = 9; _t = 71; _gp_gen = (unsigned char *) ("YOU MANAGED TO SET THE BOMBS"); print_str (); + _x = 4; _y = 10; _gp_gen = (unsigned char *) ("AND DESTROY THE COMPUTER"); print_str (); + _x = 5; _y = 11; _gp_gen = (unsigned char *) ("MISSION ACCOMPLISHED!!"); print_str (); sp_UpdateNowEx (0); #ifdef MODE_128K @@ -49,7 +49,7 @@ void dr (void) { } void game_over (void) { - gen_pt = " GAME OVER! "; dr (); + gen_pt = (unsigned char *) (" GAME OVER! "); dr (); #ifdef MODE_128K #else @@ -63,7 +63,7 @@ void game_over (void) { #if defined(TIMER_ENABLE) && defined(SHOW_TIMER_OVER) void time_over (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " TIME'S UP! "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" TIME'S UP! "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); @@ -79,13 +79,13 @@ void game_over (void) { #ifdef PAUSE_ABORT void pause_screen (void) { - gen_pt = " PAUSED "; dr (); + gen_pt = (unsigned char *) (" PAUSED "); dr (); } #endif #ifdef COMPRESSED_LEVELS void zone_clear (void) { - gen_pt = " ZONE CLEAR "; dr (); + gen_pt = (unsigned char *) (" ZONE CLEAR "); dr (); espera_activa (250); } #endif diff --git a/examples/helmet/dev/my/levelset.h b/examples/helmet/dev/my/levelset.h index 871a9484..86059e06 100644 --- a/examples/helmet/dev/my/levelset.h +++ b/examples/helmet/dev/my/levelset.h @@ -12,7 +12,9 @@ typedef struct { unsigned char resource_id; unsigned char music_id; + #ifdef ACTIVATE_SCRIPTING unsigned int script_offset; + #endif } LEVEL; #else // 48K format: diff --git a/examples/helmet/dev/my/title_screen.h b/examples/helmet/dev/my/title_screen.h index 86ae601c..d4342db9 100644 --- a/examples/helmet/dev/my/title_screen.h +++ b/examples/helmet/dev/my/title_screen.h @@ -9,7 +9,7 @@ #ifdef MODE_128K get_resource (TITLE_BIN, 16384); - wyz_play_music (0); + PLAY_MUSIC (0); #else #asm ld hl, _s_title diff --git a/examples/helmet/dev/pantallas.h b/examples/helmet/dev/pantallas.h index b1fbc674..2734d92b 100644 --- a/examples/helmet/dev/pantallas.h +++ b/examples/helmet/dev/pantallas.h @@ -12,17 +12,17 @@ #asm ._s_title - BINARY "title.bin" + BINARY "..\bin\title.bin" ._s_marco #endasm #ifndef DIRECT_TO_PLAY #asm - BINARY "marco.bin" + BINARY "..\bin\marco.bin" #endasm #endif #asm ._s_ending - BINARY "ending.bin" + BINARY "..\bin\ending.bin" #endasm #endif diff --git a/examples/helmet/dev/printer.h b/examples/helmet/dev/printer.h index 101eb0d0..7e05d920 100644 --- a/examples/helmet/dev/printer.h +++ b/examples/helmet/dev/printer.h @@ -14,46 +14,46 @@ unsigned char qtile (unsigned char x, unsigned char y) { #if defined (USE_AUTO_TILE_SHADOWS) || defined (USE_AUTO_SHADOWS) unsigned char attr_mk2 (void) { - // x + 15 * y = x + (16 - 1) * y = x + 16 * y - y = x + (y << 4) - y. - // if (cx1 < 0 || cy1 < 0 || cx1 > 14 || cy1 > 9) return 0; - // return map_attr [cx1 + (cy1 << 4) - cy1]; - #asm - ld a, (_cx1) - cp 15 - jr nc, _attr_reset - - ld a, (_cy1) - cp 10 - jr c, _attr_do - - ._attr_reset - ld hl, 0 - ret - - ._attr_do - ld a, (_cy1) - ld b, a - sla a - sla a - sla a - sla a - sub b - ld b, a - ld a, (_cx1) - add b - ld e, a - ld d, 0 - ld hl, _map_attr - add hl, de - ld a, (hl) - - ld h, 0 - ld l, a - ret - #endasm + // x + 15 * y = x + (16 - 1) * y = x + 16 * y - y = x + (y << 4) - y. + // if (cx1 < 0 || cy1 < 0 || cx1 > 14 || cy1 > 9) return 0; + // return map_attr [cx1 + (cy1 << 4) - cy1]; + #asm + ld a, (_cx1) + cp 15 + jr nc, _attr_reset + + ld a, (_cy1) + cp 10 + jr c, _attr_do + + ._attr_reset + ld hl, 0 + ret + + ._attr_do + ld a, (_cy1) + ld b, a + sla a + sla a + sla a + sla a + sub b + ld b, a + ld a, (_cx1) + add b + ld e, a + ld d, 0 + ld hl, _map_attr + add hl, de + ld a, (hl) + + ld h, 0 + ld l, a + ret + #endasm } #endif - + #ifdef COMPRESSED_LEVELS #define ATTR_OFFSET 1536 #else @@ -609,7 +609,8 @@ void update_tile (void) { #ifdef ENABLE_TILANIMS // Detect tilanims if (_t >= ENABLE_TILANIMS) { - add_tilanim (_x, _y, _t); + _n = (_x << 4) | _y; + tilanims_add (); } #endif diff --git a/examples/helmet/dev/prototypes.h b/examples/helmet/dev/prototypes.h index aae155dd..843aaf1a 100644 --- a/examples/helmet/dev/prototypes.h +++ b/examples/helmet/dev/prototypes.h @@ -7,6 +7,18 @@ #define ENABLE_SIMPLE_COCOS #endif +#ifdef MODE_128K + #ifdef USE_ARKOS_PLAYER + #define PLAY_MUSIC arkos_play_music + #define PLAY_SOUND arkos_play_sound + #define STOP_SOUND arkos_stop_sound + #else + #define PLAY_MUSIC wyz_play_music + #define PLAY_SOUND wyz_play_sound + #define STOP_SOUND wyz_stop_sound + #endif +#endif + // Engine // breakable.h @@ -74,6 +86,7 @@ char player_hidden (void); void run_fire_script (void); void process_tile (void); void draw_scr_background (void); +void draw_scr_hotspots_locks (void); void draw_scr (void); void select_joyfunc (void); unsigned char mons_col_sc_x (void); @@ -108,12 +121,15 @@ void tape_load (void);// TODO! void sg_submenu (void); // tilanim.h -void add_tilanim (unsigned char x, unsigned char y, unsigned char t); -void do_tilanims (void); +void tilanims_add (void); +void tilanims_do (void); +void tilanims_reset (void); -// wyzplayer.h +#ifdef MODE_128K +// wyzplayer.h / arcos_player.h void ISR (void); -void wyz_init (void); -void wyz_play_sound (unsigned char fx_number); -void wyz_play_music (unsigned char song_number); -void wyz_stop_sound (void); +void INIT_PLAYER (void); +void PLAY_SOUND (unsigned char fx_number); +void PLAY_MUSIC (unsigned char song_number); +void STOP_SOUND (void); +#endif diff --git a/examples/helmet/dev/setenv.bat b/examples/helmet/dev/setenv.bat index e034d8d5..a543b050 100644 --- a/examples/helmet/dev/setenv.bat +++ b/examples/helmet/dev/setenv.bat @@ -1,6 +1,5 @@ @echo off -set Z88DK_PATH=c:\z88dk10 -set PATH=%Z88DK_PATH%\bin;%PATH% +set Z88DK_PATH=c:\z88dk +set PATH=%Z88DK_PATH%\bin.x86;%PATH% set Z80_OZFILES=%Z88DK_PATH%\Lib\ set ZCCCFG=%Z88DK_PATH%\Lib\Config\ -zcc diff --git a/examples/helmet/dev/sound/arkos-addresses.h b/examples/helmet/dev/sound/arkos-addresses.h new file mode 100644 index 00000000..fa3225d7 --- /dev/null +++ b/examples/helmet/dev/sound/arkos-addresses.h @@ -0,0 +1,9 @@ +#define SFXS_SONG 0xd10c +#define ATINIT 0xc68c +#define ATPLAY 0xc000 +#define ATSFXINIT 0xc6f0 +#define ATSFXPLAY 0xc704 +#define ATSFXSTOP 0xc745 +#define ATSFXSTOPALL 0xc6f7 +#define ATSTOP 0xc6e1 +#define SONG_LIST 0xd5b7 diff --git a/examples/helmet/dev/sound/arkosplayer.h b/examples/helmet/dev/sound/arkosplayer.h new file mode 100644 index 00000000..c149b1b9 --- /dev/null +++ b/examples/helmet/dev/sound/arkosplayer.h @@ -0,0 +1,118 @@ +// MT Engine MK2 +// Copyleft 2014 the Mojon Twins + +// arkosplayer.h +// Arkos Player hook functions + +// This code is based on the original integration by Syx & Nightwolf +// In fact, this code IS the original integration by Syx & Nightwolf. +// I just changed the way params are passed (thanks @reidrac) +// I just automated the process & reindented to meet my own personal taste. + +#include "sound\arkos-addresses.h" + +// Start. + +// isr +#asm + defw 0 +#endasm + +void ISR(void) { + #asm + ld b, 1 + call SetRAMBank + call ATPLAY + ld b, 0 + call SetRAMBank + + ld hl, _isrc + inc (hl) + #endasm +} + +void arkos_stop (void) { + #asm + ld b, 1 + call SetRAMBank + ld a, 201 + ld (ATPLAY),A + ld b, 0 + call SetRAMBank + #endasm +} + +void __FASTCALL__ arkos_play_sound (unsigned char fx_number) { + #asm + di + ld b,1 + call SetRAMBank + + ; __FASTCALL__ -> fx_number is in l! + ld a, ARKOS_SFX_CHANNEL + ld h, 15 + ld e, 50 + ld d, 0 + ld bc, 0 + call ATSFXPLAY + + ld b,0 + call SetRAMBank + ei + #endasm +} + +void __FASTCALL__ arkos_play_music (unsigned char song_number) { + #asm + di + ld b, 1 + call SetRAMBank + + ; Reactivate sound generation + ld a, 175 + ld (ATPLAY),A + + ; Initialize song + ; __FASTCALL__ -> song_number is in l! + ld a, l + add a, a + ld hl, SONG_LIST + add a,l + jr nc, salta_inc_song + inc h + salta_inc_song: + ld l,a + ld e, (hl) + inc hl + ld d, (hl) + + call ATINIT + + ld de, SFXS_SONG + call ATSFXINIT + + ld b, 0 + call SetRAMBank + ei + #endasm +} + +void arkos_stop_sound (void) +{ + #asm + di + ld b,1 + call SetRAMBank + + call ATSFXSTOPALL + call ATSTOP + + ; Turn off sound generation + ld a,201 + ld (ATPLAY),A + + ld b,0 + call SetRAMBank + ei + #endasm +} diff --git a/examples/helmet/dev/beeper.h b/examples/helmet/dev/sound/beeper.h similarity index 100% rename from examples/helmet/dev/beeper.h rename to examples/helmet/dev/sound/beeper.h diff --git a/examples/helmet/dev/music.h b/examples/helmet/dev/sound/music.h similarity index 100% rename from examples/helmet/dev/music.h rename to examples/helmet/dev/sound/music.h diff --git a/examples/helmet/dev/sound/wyzplayer.h b/examples/helmet/dev/sound/wyzplayer.h new file mode 100644 index 00000000..b06fedd7 --- /dev/null +++ b/examples/helmet/dev/sound/wyzplayer.h @@ -0,0 +1,91 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// WYZ player hook functions + +// WYZ player and songs are loaded into RAM 1 ($C000). +// In each interrupt, we just page in RAM 1, call the player, +// then page back RAM 0 and exit. + +// The player is, thus, compiled to $C000, and its addresses +// are: + +#define WYZPLAYERINIT 0xC018 // INIT_BUFFERS EQU 0C018H +#define WYZPLAYERISR 0xC000 // INICIO EQU 0C000H +#define INICIAEFECTO 0xC47E // INICIA_EFECTO EQU 0C46BH +#define CARGA_CANCION 0xC087 // CARGA_CANCION EQU 0C087H +#define SILENCIA_PLAYER 0xC062 // PLAYER_OFF EQU 0C062H + +// Start. + +// isr +#asm + defw 0 // 2 bytes libres +#endasm + +void ISR(void) { + #asm + ld a, (_player_on) + or a + ret z + ld b, 1 + call SetRAMBank + call WYZPLAYERISR + ld b, 0 + call SetRAMBank + + ld hl, _isrc + inc (hl) + #endasm +} + +void wyz_init (void) { + #asm + ld b,1 + call SetRAMBank + call WYZPLAYERINIT + ld b,0 + call SetRAMBank + #endasm +} + +void __FASTCALL__ wyz_play_sound (unsigned char fx_number) { + #asm + di + ld b, 1 + call SetRAMBank + ; __FASTCALL__ -> fx_number is in l! + ld b, l + call INICIAEFECTO + ld b, 0 + call SetRAMBank + ei + #endasm +} + +void __FASTCALL__ wyz_play_music (unsigned char song_number) { + #asm + di + ld b, 1 + call SetRAMBank + ; __FASTCALL__ -> song_number is in l! + ld a, l + call CARGA_CANCION + ld b, 0 + call SetRAMBank + ei + #endasm + song_playing = song_number; +} + +void wyz_stop_sound (void) { + #asm + di + ld b,1 + call SetRAMBank + call SILENCIA_PLAYER + ld b,0 + call SetRAMBank + ei + #endasm +} diff --git a/examples/helmet/dev/tilanim.h b/examples/helmet/dev/tilanim.h index 3e62c5a7..cfeaafaf 100644 --- a/examples/helmet/dev/tilanim.h +++ b/examples/helmet/dev/tilanim.h @@ -2,43 +2,102 @@ // Copyleft 2010-2014, 2020 by the Mojon Twins // tilanim.h -// Rutina para animar tiles. -#define MAX_TILANIMS 64 -#define UPDATE_FREQ 7 -unsigned char max_tilanims; -unsigned char tacount; +void tilanims_reset (void) { + #asm + ld hl, _tilanims_ft + ld de, _tilanims_ft + 1 + ld bc, MAX_TILANIMS - 1 + xor a + ld (hl), a + ldir + ld (_tacount), a + ld (_tait), a + ld (_max_tilanims), a + #endasm +} + +void tilanims_add (void) { + #asm + ld de, (_max_tilanims) + ld d, 0 -typedef struct { - unsigned char xy; - unsigned char ft; -} TILANIM; + ld a, (__n) + ld hl, _tilanims_xy + add hl, de + ld (hl), a -TILANIM tilanims [MAX_TILANIMS]; + ld a, (__t) + ld hl, _tilanims_ft + add hl, de + ld (hl), a -void add_tilanim (unsigned char x, unsigned char y, unsigned char t) { - tilanims [max_tilanims].xy = (x << 4) + y; - tilanims [max_tilanims].ft = t; - - ++ max_tilanims; + ld a, e + inc a + ld (_max_tilanims), a + #endasm } -unsigned char tait; -void do_tilanims (void) { - if (max_tilanims == 0) return; - - tacount = (tacount + 1) & UPDATE_FREQ; - if (!tacount) { - // Select tile - tait = rand () % max_tilanims; - - // Flip bit 7: - tilanims [tait].ft = tilanims [tait].ft ^ 128; +void tilanims_do (void) { + #asm + ld a, (_max_tilanims) + or a + ret z + + ld a, (_tait) + add TILANIMS_PRIME + cp MAX_TILANIMS + jr c, _tilanims_tait_0_skip + sub MAX_TILANIMS + ._tilanims_tait_0_skip + ld (_tait), a + + // Check counter for tilanim #tait + ld d, 0 + ld e, a + + // Check of active + ld hl, _tilanims_ft + add hl, de + ld a, (hl) + or a + ret z + + // Flip bit 7 + ld hl, _tilanims_ft + add hl, de + ld a, (hl) + xor 128 + ld (hl), a + + // Which tile? + bit 7, a + jr z, _tilanims_no_flick + + inc a + ._tilanims_no_flick + and 127 + ld (__t), a // Draw tile - _x = tilanims [tait].xy >> 4; - _y = tilanims [tait].xy & 15; - _t = (tilanims [tait].ft & 127) + (tilanims [tait].ft >> 7); - draw_invalidate_coloured_tile_gamearea (); - } + ld hl, _tilanims_xy + add hl, de + ld a, (hl) + ld c, a + srl a + srl a + srl a + and 0xfe + add VIEWPORT_X + ld (__x), a + + ld a, c + and 15 + sla a + add VIEWPORT_Y + ld (__y), a + + call _draw_coloured_tile + call _invalidate_tile + #endasm } diff --git a/examples/helmet/dev/wyzplayer.h b/examples/helmet/dev/wyzplayer.h deleted file mode 100644 index dea53369..00000000 --- a/examples/helmet/dev/wyzplayer.h +++ /dev/null @@ -1,85 +0,0 @@ -// MTE MK1 (la Churrera) v5.0 -// Copyleft 2010-2014, 2020 by the Mojon Twins - -// WYZ player hook functions - -// WYZ player and songs are loaded into RAM 1 ($C000). -// In each interrupt, we just page in RAM 1, call the player, -// then page back RAM 0 and exit. - -// The player is, thus, compiled to $C000, and its addresses -// are: - -#define WYZPLAYERINIT 0xC018 // INIT_BUFFERS EQU 0C018H -#define WYZPLAYERISR 0xC000 // INICIO EQU 0C000H -#define INICIAEFECTO 0xC47E // INICIA_EFECTO EQU 0C46BH -#define CARGA_CANCION 0xC087 // CARGA_CANCION EQU 0C087H -#define SILENCIA_PLAYER 0xC062 // PLAYER_OFF EQU 0C062H - -// Start. - -// isr -#asm - defw 0 // 2 bytes libres -#endasm - -void ISR(void) { - #asm - ld b, 1 - call SetRAMBank - call WYZPLAYERISR - ld b, 0 - call SetRAMBank - #endasm -} - -void wyz_init (void) { - #asm - ld b,1 - call SetRAMBank - call WYZPLAYERINIT - ld b,0 - call SetRAMBank - #endasm -} - -void __FASTCALL__ wyz_play_sound (unsigned char fx_number) { - #asm - di - ld b, 1 - call SetRAMBank - ; __FASTCALL__ -> fx_number is in l! - ld b, l - call INICIAEFECTO - ld b, 0 - call SetRAMBank - ei - #endasm -} - -void __FASTCALL__ wyz_play_music (unsigned char song_number) { - #asm - di - ld b, 1 - call SetRAMBank - ; __FASTCALL__ -> song_number is in l! - ld a, l - call CARGA_CANCION - ld b, 0 - call SetRAMBank - ei - #endasm - song_playing = song_number; -} - -void wyz_stop_sound (void) { - #asm - di - ld b,1 - call SetRAMBank - call SILENCIA_PLAYER - ld b,0 - call SetRAMBank - ei - #endasm -} diff --git a/examples/helmet/dev/zcc_opt.def b/examples/helmet/dev/zcc_opt.def deleted file mode 100644 index 3cbd4251..00000000 --- a/examples/helmet/dev/zcc_opt.def +++ /dev/null @@ -1,8 +0,0 @@ - -IF !DEFINED_STACKPTR - defc DEFINED_STACKPTR = 1 - defc STACKPTR = 61936 -ENDIF - - DEFINE DEFINED_myzorg - defc myzorg = 24000 diff --git a/lib/splib2/Makefile.bat b/lib/splib2/Makefile.bat new file mode 100644 index 00000000..9915ae59 --- /dev/null +++ b/lib/splib2/Makefile.bat @@ -0,0 +1,21 @@ +@echo off +call setenv.bat +if [%1]==[install] goto install + +cd cwrapper +copy ..\SPconfig.def . +rem gencompile "zcc +zx -vn -make-lib -I.." sp_c.lst +gencompile "zcc +zx -vn -c -I.." sp_c.lst +del SPconfig.def +cd .. + +rem z80asm -I. -d -ns -nm -Mo -DFORzx -xsplib2_mk2 @sp.lst +z80asm -I. -d -DFORzx -xsplib2_mk2 @sp.lst + +:install +echo Copying +copy splib2_mk2.lib %Z88DK_PATH%\lib\clibs +copy spritepack.h %Z88DK_PATH%\include\ + +echo done! +pause diff --git a/lib/splib2/SPconfig.def b/lib/splib2/SPconfig.def new file mode 100644 index 00000000..2528d75e --- /dev/null +++ b/lib/splib2/SPconfig.def @@ -0,0 +1,90 @@ +; +; Sprite Pack V2.2 Configuration File +; Alvin Albrecht 07.2003 +; +; Customize the following options prior to compiling the library. +; +; +; * DISPLAY RESOLUTION +; +; Define exactly one of these as true: +; + DEFC DISP_SPECTRUM = 1 +; for a 256x192 pixel, 32x24 colour Spectrum display +; + DEFC DISP_HICOLOUR = 0 +; for a 256x192 pixel, 32x192 colour hi-colour display (Timex only) +; + DEFC DISP_HIRES = 0 +; for a 512x192 pixel monochrome hi-res display (Timex only) +; + DEFC DISP_TMXDUAL = 0 +; for spectrum display using double buffering (Timex dual screen mode). +; also set DISP_SPECTRUM to 1 and NOFLICKER to 0 +; +; +; * DISPLAY SIZE +; +; Specify what rows of the display Sprite Pack will manage: +; + DEFC SP_ROWSTART = 0 ; inclusive + DEFC SP_ROWEND = 24 ; non-inclusive +; +; +; * SPECIFY SCREEN DRAW METHODS & VARIABLES +; + DEFC NOFLICKER = 1 +; for no-flicker mode where a character is completely drawn +; in a buffer before being copied to the screen +; + DEFC SCROLLER = 0 +; to activate scroller mode where the first sprite in each +; character is drawn as load-type regardless of its actual type +; + DEFC COMPRESS = 0 +; to compress sprite graphics so that xor, or and load sprites +; do not need an (unused) mask byte in their definitions; this means +; that xor, or and load sprites can share graphic definitions but mask +; sprite graphics (which require the mask byte) must have an +; independent definition with the mask byte present. BUGGED! +; + DEFC SProtatetbl = $f000 +; the base address of the horizontal rotate table must be a +; multiple of $1000; actual memory occupied is SProtatetbl+$200 +; to SProtatetbl+$fff +; + DEFC USEPLANES = 0 +; If set, use sprite planes. +; +; +; * IM2 INTERRUPT VECTOR TABLE +; + DEFC IM2TABLE = $f000 ; LSB = $00 +; the base address of the im 2 interrupt vector table; +; occupies 257 bytes if EVENVECTORS is false, 256 otherwise +; + DEFC EVENVECTORS = 0 +; if devices will only place even vectors on the data bus, +; define this variable as true +; +; +; * DYNAMIC BLOCK MEMORY ALLOCATOR +; + DEFC NUMQUEUES = 1 +; the number of memory queues managed by the dynamic block +; memory allocator +; +; +; * AY-3-89xx SOUND CHIP PORT ASSIGNMENTS +; + DEFC AYREG_2068 = $f5 + DEFC AYDAT_2068 = $f6 + DEFC AYREG_128 = $fffd + DEFC AYDAT_128 = $bffd + DEFC AYREG_FULLER = $3f + DEFC AYDAT_FULLER = $5f +; + DEFC AYREG_DEFAULT = AYREG_128 + DEFC AYDAT_DEFAULT = AYDAT_128 +; +; diff --git a/lib/splib2/backgroundtiles/SPGetTiles.asm b/lib/splib2/backgroundtiles/SPGetTiles.asm new file mode 100644 index 00000000..3c01c1f1 --- /dev/null +++ b/lib/splib2/backgroundtiles/SPGetTiles.asm @@ -0,0 +1,52 @@ +; +; Get Background Tiles +; Alvin Albrecht 07.2003 +; + +INCLUDE "SPconfig.def" + +XLIB SPGetTiles +LIB SPCompDListAddr + +; Get Background Tiles +; +; Copy the background tiles in a rectangle on screen +; into memory. PutTiles can be used to print the +; rectangle of tiles to screen. +; +; enter : hl = destination address +; A = row coord of top left corner of rectangle +; C = col coord of top left corner of rectangle +; D = width of rectangle +; E = height of rectangle +; uses : af, bc, de, hl + +.SPGetTiles + push hl ; save dest address + push de ; save rectangle size + call SPCompDListAddr ; hl = DList Address + pop bc ; bc = rectangle size + pop de ; de = dest address + + ld a,c ; a = height + ld c,$ff +.rowloop + push bc ; save b = width + push hl ; save DList address at start of row +.colloop + ldi ; copy tile colour + ldi ; copy tile character + inc hl + inc hl ; hl = next column's DList address + djnz colloop + pop hl ; hl = DList at start of row +IF DISP_HIRES + inc h +ELSE + ld c,4*32 + add hl,bc ; add row displacement +ENDIF + pop bc ; restore b = width + dec a ; finished full height? + jp nz, rowloop + ret diff --git a/lib/splib2/backgroundtiles/SPGetTiles.o b/lib/splib2/backgroundtiles/SPGetTiles.o new file mode 100644 index 00000000..572db351 Binary files /dev/null and b/lib/splib2/backgroundtiles/SPGetTiles.o differ diff --git a/lib/splib2/backgroundtiles/SPIterateDList.asm b/lib/splib2/backgroundtiles/SPIterateDList.asm new file mode 100644 index 00000000..91a8d30a --- /dev/null +++ b/lib/splib2/backgroundtiles/SPIterateDList.asm @@ -0,0 +1,61 @@ +; +; IterateDList +; Alvin Albrecht 06.2003 +; + +INCLUDE "SPconfig.def" + +XLIB SPIterateDList +LIB SPCompDListAddr + +; IterateDList +; +; Iterates over display list entries one character at a time for +; characters within a bounding rectangle in row major order, calling +; the hook function for each character. The hook function is handed +; a pointer to the display list entry on the stack. +; +; Hook function can safely use af,bc,de,hl (the iterator uses +; the exchange set). +; +; enter: IY = user supplied hook address +; A = row top left corner +; C = col top left corner +; D = width +; E = height +; uses : all except IX, AF' + +.SPIterateDList + push de + call SPCompDListAddr ; hl = DList Address + pop de ; d = width, e = height +IF DISP_HIRES + ld c,4*64 +ELSE + ld c,4*32 +ENDIF + +.rowloop + ld b,d ; b = width + push hl ; save DList Address at start of row +.colloop + push hl + push hl + exx + pop hl + call JPIY ; call hook with hl = DList address + exx + pop hl + inc hl + inc hl + inc hl + inc hl ; hl = next column's DList address + djnz colloop + pop hl ; hl = DList at start of row + add hl,bc ; add row displacement + dec e ; finished full height? + jp nz, rowloop + ret + +.JPIY + jp (iy) diff --git a/lib/splib2/backgroundtiles/SPIterateDList.o b/lib/splib2/backgroundtiles/SPIterateDList.o new file mode 100644 index 00000000..3226fa6c Binary files /dev/null and b/lib/splib2/backgroundtiles/SPIterateDList.o differ diff --git a/lib/splib2/backgroundtiles/SPPallette.asm b/lib/splib2/backgroundtiles/SPPallette.asm new file mode 100644 index 00000000..3231337d --- /dev/null +++ b/lib/splib2/backgroundtiles/SPPallette.asm @@ -0,0 +1,36 @@ +; +; Set Pallette Array Entry +; Alvin Albrecht 06.2003 +; + +INCLUDE "SPconfig.def" + +XLIB SPPallette +LIB SPTileArray + +; Associate Colour with Pallette Entry Code +; +; ONLY VALID FOR HI-COLOUR MODE +; +; enter : de = address of colour array to associate with pallette entry +; a = pallette entry code +; exit : de = old colour array +; uses : af, de, hl + +.SPPallette +IF DISP_HICOLOUR + add a,SPTileArray%256 + ld l,a + ld h,SPTileArray/256+2 + jp nc, noinc + inc h +.noinc + ld a,(hl) + ld (hl),e + ld e,a + inc h + ld a,(hl) + ld (hl),d + ld d,a +ENDIF + ret diff --git a/lib/splib2/backgroundtiles/SPPallette.o b/lib/splib2/backgroundtiles/SPPallette.o new file mode 100644 index 00000000..62f2f4c8 Binary files /dev/null and b/lib/splib2/backgroundtiles/SPPallette.o differ diff --git a/lib/splib2/backgroundtiles/SPPrintAt.asm b/lib/splib2/backgroundtiles/SPPrintAt.asm new file mode 100644 index 00000000..1a5bf7d8 --- /dev/null +++ b/lib/splib2/backgroundtiles/SPPrintAt.asm @@ -0,0 +1,26 @@ +; +; PrintAt +; Alvin Albrecht 01.2003 +; + +XLIB SPPrintAt +LIB SPCompDListAddr + +; Print Background Bitmap at Character Position, no invalidation +; +; enter: A = row position (0..23) +; C = col position (0..31/63) +; D = pallette # +; E = graphic # +; exit : HL = display list address for coordinate +; used : af, b, hl + +.SPPrintAt + push de + call SPCompDListAddr ; hl = display list address for coordinates + pop de + ld (hl),d + inc hl + ld (hl),e ; store background tile + dec hl + ret diff --git a/lib/splib2/backgroundtiles/SPPrintAt.o b/lib/splib2/backgroundtiles/SPPrintAt.o new file mode 100644 index 00000000..9ceade68 Binary files /dev/null and b/lib/splib2/backgroundtiles/SPPrintAt.o differ diff --git a/lib/splib2/backgroundtiles/SPPrintAtDiff.asm b/lib/splib2/backgroundtiles/SPPrintAtDiff.asm new file mode 100644 index 00000000..df801491 --- /dev/null +++ b/lib/splib2/backgroundtiles/SPPrintAtDiff.asm @@ -0,0 +1,56 @@ +; +; PrintAtDiff +; Alvin Albrecht 01.2003 +; + +XLIB SPPrintAtDiff +LIB SPCompDListAddr, SPCompDirtyAddr, SPbit2mask, SPtbllookup + +; Print Background Bitmap at Character Position, only invalidating +; if the background tile is actually changed. +; +; enter: A = row position (0..23) +; C = col position (0..31/63) +; D = pallette # +; E = graphic # +; exit : DE = display list address for coordinate +; HL = dirty chars array address +; C = mask for dirty char +; used : af, bc, de, hl + +.SPPrintAtDiff + ld b,a + push bc + push de + call SPCompDListAddr ; hl = display list address for coordinates + pop de + pop bc + ld a,(hl) + cp d + jr nz, change1 + inc hl + ld a,(hl) + dec hl + cp e + jr z, nochange + +.back + inc hl + ld (hl),e + dec hl + +.nochange + ld a,b ; row, col position + push hl ; save display list addr + call SPCompDirtyAddr ; hl = dirty chars array address, a = bit position + ld de,SPbit2mask + call SPtbllookup + ld c,a + or (hl) + ld (hl),a ; mark char as dirty + pop de + ret + +.change1 + ld (hl),d + jp back diff --git a/lib/splib2/backgroundtiles/SPPrintAtDiff.o b/lib/splib2/backgroundtiles/SPPrintAtDiff.o new file mode 100644 index 00000000..45db5b6e Binary files /dev/null and b/lib/splib2/backgroundtiles/SPPrintAtDiff.o differ diff --git a/lib/splib2/backgroundtiles/SPPrintAtInv.asm b/lib/splib2/backgroundtiles/SPPrintAtInv.asm new file mode 100644 index 00000000..981fcc67 --- /dev/null +++ b/lib/splib2/backgroundtiles/SPPrintAtInv.asm @@ -0,0 +1,36 @@ +; +; PrintAtInv +; Alvin Albrecht 01.2003 +; + +XLIB SPPrintAtInv +LIB SPCompDListAddr, SPCompDirtyAddr, SPbit2mask, SPtbllookup + +; Print Background Bitmap at Character Position, with invalidation +; +; enter: A = row position (0..23) +; C = col position (0..31/63) +; D = pallette # +; E = graphic # +; exit : DE = display list address for coordinate +; HL = dirty array chars address +; C = dirty char mask +; used : af, bc, de, hl + +.SPPrintAtInv + push de + call SPCompDListAddr ; hl = display list address for coordinates + pop de + ld (hl),d + inc hl + ld (hl),e ; store background tile + dec hl + push hl + call SPCompDirtyAddr ; hl = dirty chars array address, a = bit position + ld de,SPbit2mask + call SPtbllookup + ld c,a + or (hl) + ld (hl),a ; mark char as dirty + pop de + ret diff --git a/lib/splib2/backgroundtiles/SPPrintAtInv.o b/lib/splib2/backgroundtiles/SPPrintAtInv.o new file mode 100644 index 00000000..77be913f Binary files /dev/null and b/lib/splib2/backgroundtiles/SPPrintAtInv.o differ diff --git a/lib/splib2/backgroundtiles/SPPrintString.asm b/lib/splib2/backgroundtiles/SPPrintString.asm new file mode 100644 index 00000000..83939225 --- /dev/null +++ b/lib/splib2/backgroundtiles/SPPrintString.asm @@ -0,0 +1,476 @@ +; +; PrintString +; Alvin Albrecht 06.2003 +; + +INCLUDE "SPconfig.def" + +XLIB SPPrintString +LIB SPCompDListAddr, SPCompDirtyAddr, SPbit2mask, SPtbllookup + +; A Complex Print String Implementation +; +; The string to print is pointed at by HL and terminates with a 0 byte. +; Characters are printed as background tiles (ie a tile# and colour/pallette) +; with the following special character codes understood: +; +; code meaning +; ---- ------- +; 0 terminate string +; 5 NOP (ignored) +; 6 goto N* (goto x coordinate on same line) +; 7 print string at address W* +; 8 left +; 9 right +; 10 up +; 11 down +; 12 home (to top left of bounds rectangle) +; 13 carriage return (move to start of next line in bounds rectangle) +; 14 repeat N* +; 15 endrepeat +; 16 ink N* +; 17 paper N* +; 18 flash N* +; 19 bright N* +; 20 attribute N* +; 21 invalidate N* +; 22 AT y(N*),x(N*) (relative to bounds rectangle) +; 23 AT dy(N*), dx(N*) (relative to current position in bounds rectangle) +; 24 xwrap N* +; 25 yinc N* +; 26 push state +; 27 escape, next char is literal not special code +; 28 pop state +; 29 transparent char +; +; * N is a single byte parameter following the code. +; * W is a 16-bit parameter following the code. +; +; All printing is done within a bounds rectangle. No printing outside this +; bounds rectangle will occur. To print full screen, use a bounds rectangle +; that encompasses the full screen (eg ClipStruct). +; +; enter: HL = address of string to print +; E = flags (bit 0 = invalidate?, bit 1 = xwrap?, bit 2 = yinc?, bit3 = onscreen?) +; B = current x coordinate (relative to bounds rect IY) +; C = current y coordinate (relative to bounds rect IY) +; HL' = DList Address +; DE' = Dirty Chars Array Address +; B' = Dirty Chars Bit +; C' = current colour +; IY+0 = row coordinate \ +; IY+1 = col coordinate | Bounds Rectangle +; IY+2 = height in chars | Must Fit On Screen +; IY+3 = width in chars / +; +; The C API maintains a structure to retain the print state between calls. +; Doing something similar from assembly language may be helpful. + +.SPPrintString +.psloop + ld a,(hl) + or a + ret z ; return on end of string character + inc hl + cp 30 + jp nc, printable + cp 5 + jp c, printable + + ; here we have a special code [5,29] + + push hl + ld d,a + add a,a ; get address of handler from jump table + ld h,jumptbl/256 + add a,jumptbl%256 + ld l,a + jp nc, nospill + inc h +.nospill + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + ld a,d ; restore A to code + ex (sp),hl + ret + +.jumptbl + defw printable, printable, printable, printable + defw printable, codeNOP, codeGotoX, codePString + defw codeLeft, codeRight, codeUp, codeDown + defw codeHome, codeReturn, codeRepeat, codeEndRepeat + defw codeInk, codePaper, codeFlash, codeBright + defw codeAttribute, codeInvalidate, codeAt, codeAtRel + defw codeXWrap, codeYInc, codePush, codeEscape + defw codePop, codeTransparent + +.printable ; a = tile# + bit 3,e ; currently on screen? + jp z, codeRight + exx + ld (hl),c + inc hl + ld (hl),a + dec hl + exx + bit 0,e ; invalidate? + jp z, codeRight + exx + ld a,(de) + or b ; invalidate this char cell + ld (de),a + exx + jp codeRight + +.codeLeft + dec b + exx + dec hl + dec hl + dec hl + dec hl ; move DList left one char + rrc b ; move dirty chars left one char + jp nc, noadjcl + dec de +.noadjcl + exx + jp checkbounds + +.codeRight + inc b + exx + inc hl + inc hl + inc hl + inc hl ; move DList one char right + rlc b ; move Dirty Char one char right + jp nc, noadjcr + inc de +.noadjcr + exx + jp checkbounds + +.codeUp + exx + push bc +IF DISP_HIRES + ld bc,-256 +ELSE + ld bc,-128 +ENDIF + add hl,bc ; move DList up one char +IF DISP_HIRES + ld bc,-8 +ELSE + ld bc,-4 +ENDIF + ex de,hl + add hl,bc ; move dirty chars up one char + ex de,hl + pop bc + exx + dec c + jp checkbounds + +.codeDown + exx + push bc +IF DISP_HIRES + ld bc,256 +ELSE + ld bc,128 +ENDIF + add hl,bc ; move DList down one char +IF DISP_HIRES + ld bc,8 +ELSE + ld bc,4 +ENDIF + ex de,hl + add hl,bc ; move dirty chars down one char + ex de,hl + pop bc + exx + inc c + jp checkbounds + +.checkbounds + bit 3,e + jp z, computepos + ld a,b + cp (iy+3) + jp c, cb1 + jp computepos +.cb1 + ld a,c + cp (iy+2) + jp c, psloop +.gooff + res 3,e + jp psloop + +.computepos + res 3,e + bit 1,e + jr nz, wrapmode + ld a,b + cp (iy+3) + jp nc, psloop + ld a,c + cp (iy+2) + jp nc, psloop +.computepos2 + set 3,e + push bc + exx + pop hl + ld a,h + add a,(iy+1) + push bc + ld c,a + ld a,l + add a,(iy+0) + call SPCompDListAddr + push hl + call SPCompDirtyAddr + ld de,SPbit2mask + call SPtbllookup + ex de,hl + pop hl + pop bc + ld b,a + exx + jp psloop +.correctrightwrap + sub (iy+3) + cp (iy+3) + jp nc, correctrightwrap + ld b,a + ld a,1 + jp endcorrect +.wrapmode + ld a,b + cp (iy+3) + jp c, wy + or a + jp p, correctrightwrap +.correctleftwrap + add a,(iy+3) + jp m, correctleftwrap + ld b,a + ld a,255 +.endcorrect + bit 2,e + jp z, wy + add a,c + ld c,a +.wy + ld a,c + cp (iy+2) + jp c, computepos2 + jp psloop + +.codeHome + ld bc,0 ; top left corner of bounds rect + jp computepos2 + +.codeReturn + inc c ; y++ + ld b,0 ; x = 0 + jp computepos + +.codeRepeat + ld a,(hl) ; # times to repeat + inc hl +.reploop + push hl ; save string position at start of repeat block + push af ; save # remaining iterations + call psloop ; returns after endrepeat or 0 terminator + pop af + dec a ; any more iterations? + jr z, nomoreiter + pop hl ; restore string pointer for next repeat + jp reploop +.nomoreiter + pop af ; trash saved string position + jp psloop + +.codeEndRepeat + ret + +.codeInk + ld a,(hl) ; parameter following INK (0-7) + and $07 + inc hl + exx + ex af,af' ; save ink colour + ld a,c ; get current attribute + and $f8 ; clear current ink + ld c,a + ex af,af' ; get new ink colour + or c + ld c,a ; set new ink colour + exx + jp psloop + +.codePaper + ld a,(hl) ; parameter following PAPER (0-7) + inc hl + rla + rla + rla + and $38 ; move paper to bits 5:3 + exx + ex af,af' + ld a,c ; get current attribute + and $c7 ; throw away current paper colour + ld c,a + ex af,af' ; get new paper colour + or c + ld c,a ; set new attribute + exx + jp psloop + +.codeFlash + ld a,(hl) ; parameter following FLASH (0/1) + inc hl + exx + rl c + rra + rr c + exx + jp psloop + +.codeBright + ld a,(hl) ; parameter following BRIGHT (0/1) + inc hl + exx + rra + jp nc,nobright + set 6,c + exx + jp psloop +.nobright + res 6,c + exx + jp psloop + +.codeAttribute + ld a,(hl) ; parameter following ATTRIBUTE + inc hl + exx + ld c,a + exx + jp psloop + +.codeInvalidate + ld a,(hl) ; parameter following INVALIDATE (0/1) + inc hl + rr e + rra + rl e + jp psloop + +.codeAt + ld c,(hl) + inc hl + ld b,(hl) + inc hl + jp computepos + +.codeAtRel + ld a,(hl) + add a,c + ld c,a + inc hl + ld a,(hl) + add a,b + ld b,a + inc hl + jp computepos + +.codeXWrap + ld a,(hl) ; parameter following XWRAP (0/1) + inc hl + rra + jp nc, noxwrap + set 1,e + jp computepos +.noxwrap + res 1,e + jp psloop + +.codeYInc + ld a,(hl) ; parameter following YINC (0/1) + inc hl + rra + jp nc, noywrap + set 2,e + jp psloop +.noywrap + res 2,e + jp psloop + +.codePush + push bc + push de + exx + push bc + push de + push hl + exx + jp psloop + +.codePop + exx + pop hl + pop de + pop bc + exx + pop de + pop bc + jp psloop + +.codeEscape + ld a,(hl) ; char following ESCAPE + inc hl + jp printable + +.codeTransparent + ld a,e + and $09 + cp $09 ; on screen and invalidate? + jp nz, codeRight + exx + ld a,(de) + or b + ld (de),a ; invalidate char + ld a,c + cp $80 + jr z, noclr2 + ld (hl),a +.noclr2 + exx + jp codeRight + +.codePString + ld a,(hl) + inc hl + ld d,(hl) + inc hl + push hl + ld h,d + ld l,a + call psloop + pop hl + jp psloop + +.codeGotoX + ld b,(hl) + inc hl + jp computepos + +.codeNOP + jp computepos diff --git a/lib/splib2/backgroundtiles/SPPrintString.o b/lib/splib2/backgroundtiles/SPPrintString.o new file mode 100644 index 00000000..cd1a445e Binary files /dev/null and b/lib/splib2/backgroundtiles/SPPrintString.o differ diff --git a/lib/splib2/backgroundtiles/SPPutTiles.asm b/lib/splib2/backgroundtiles/SPPutTiles.asm new file mode 100644 index 00000000..286398be --- /dev/null +++ b/lib/splib2/backgroundtiles/SPPutTiles.asm @@ -0,0 +1,54 @@ +; +; Put Background Tiles +; Alvin Albrecht 07.2003 +; + +INCLUDE "SPconfig.def" + +XLIB SPPutTiles +LIB SPCompDListAddr + +; Get Background Tiles +; +; Copy background tiles from a buffer to a rectangle on +; screen. Inverse of "GetTiles" +; +; enter : hl = source address (buffer) +; A = row coord of top left corner of rectangle +; C = col coord of top left corner of rectangle +; D = width of rectangle +; E = height of rectangle +; uses : af, bc, de, hl + +.SPPutTiles + push hl ; save source + push de ; save rectangle size + call SPCompDListAddr ; hl = DList Address + pop bc ; bc = rectangle size + pop de ; de = source + ex de,hl ; de = DListAddr, hl = source buffer + + ld a,c ; a = height + ld c,$ff +.rowloop + push bc ; save b = width + push de ; save DList address at start of row +.colloop + ldi ; copy tile colour + ldi ; copy tile character + inc de + inc de ; de = next column's DList address + djnz colloop + pop de ; de = DList at start of row +IF DISP_HIRES + inc d +ELSE + ex de,hl + ld c,4*32 + add hl,bc ; add row displacement + ex de,hl +ENDIF + pop bc ; restore b = width + dec a ; finished full height? + jp nz, rowloop + ret diff --git a/lib/splib2/backgroundtiles/SPPutTiles.o b/lib/splib2/backgroundtiles/SPPutTiles.o new file mode 100644 index 00000000..d839e015 Binary files /dev/null and b/lib/splib2/backgroundtiles/SPPutTiles.o differ diff --git a/lib/splib2/backgroundtiles/SPScreenStr.asm b/lib/splib2/backgroundtiles/SPScreenStr.asm new file mode 100644 index 00000000..e8e8a1d7 --- /dev/null +++ b/lib/splib2/backgroundtiles/SPScreenStr.asm @@ -0,0 +1,24 @@ +; +; ScreenStr +; Alvin Albrecht 01.2003 +; + +XLIB SPScreenStr +LIB SPCompDListAddr + +; Return background tile occupying a specific character coordinate +; +; enter: A = row position (0..23) +; C = col position (0..31/63) +; exit : HL = display list address for coordinate +; D = pallette # +; E = graphic # +; used : af, b, de, hl + +.SPScreenStr + call SPCompDListAddr ; hl = display list address for coordinates + ld d,(hl) + inc hl + ld e,(hl) ; store background tile + dec hl + ret diff --git a/lib/splib2/backgroundtiles/SPScreenStr.o b/lib/splib2/backgroundtiles/SPScreenStr.o new file mode 100644 index 00000000..3478f54c Binary files /dev/null and b/lib/splib2/backgroundtiles/SPScreenStr.o differ diff --git a/lib/splib2/backgroundtiles/SPTileEntry.asm b/lib/splib2/backgroundtiles/SPTileEntry.asm new file mode 100644 index 00000000..4805874d --- /dev/null +++ b/lib/splib2/backgroundtiles/SPTileEntry.asm @@ -0,0 +1,32 @@ +; +; Set Tile Array Entry +; Alvin Albrecht 06.2003 +; + +INCLUDE "SPconfig.def" + +XLIB SPTileEntry +LIB SPTileArray + +; Associate Address of Graphic with Character Code +; +; enter : de = address of graphic to associate with character code +; a = character code +; exit : de = old graphic address +; uses : af, de, hl + +.SPTileEntry + add a,SPTileArray%256 + ld l,a + ld h,SPTileArray/256 + jp nc, noinc + inc h +.noinc + ld a,(hl) + ld (hl),e + ld e,a + inc h + ld a,(hl) + ld (hl),d + ld d,a + ret diff --git a/lib/splib2/backgroundtiles/SPTileEntry.o b/lib/splib2/backgroundtiles/SPTileEntry.o new file mode 100644 index 00000000..02133343 Binary files /dev/null and b/lib/splib2/backgroundtiles/SPTileEntry.o differ diff --git a/lib/splib2/blockmemoryalloc/SPAddMemory.asm b/lib/splib2/blockmemoryalloc/SPAddMemory.asm new file mode 100644 index 00000000..5ca3e5ce --- /dev/null +++ b/lib/splib2/blockmemoryalloc/SPAddMemory.asm @@ -0,0 +1,53 @@ +; +; Dynamic Block Memory Allocator +; Alvin Albrecht 2002 +; Fixed 08.2003 +; +; Comprised of: +; InitAlloc, AddMemory, BlockFit, BlockAlloc, FreeBlock +; +; Symbol "NUMQUEUES", indicating number of memory queues, +; needs to be defined externally prior to compilation. +; + + +XLIB SPAddMemory +LIB SPFreeBlock +XREF SPfb1, SPfb2 +defw SPFreeBlock + +; AddMemory +; +; Enter: A = Queue # +; B = # of memory blocks to add to queue A +; DE = size of memory blocks in bytes (not including hidden ID byte) +; HL = address of free memory from which to draw these blocks +; Exit : HL = address just past the memory reserved +; Uses : F, B, HL, BC', HL', DE' + +.SPAddMemory + push af + push hl + exx + pop de + ld (de),a + call SPfb1 + +.ib1 + exx + inc hl + add hl,de + pop af + djnz ib2 + ret + +.ib2 + push af + push hl + exx + pop hl + ex de,hl + ld (de),a + inc de + call SPfb2 + jp ib1 diff --git a/lib/splib2/blockmemoryalloc/SPAddMemory.o b/lib/splib2/blockmemoryalloc/SPAddMemory.o new file mode 100644 index 00000000..9d907de9 Binary files /dev/null and b/lib/splib2/blockmemoryalloc/SPAddMemory.o differ diff --git a/lib/splib2/blockmemoryalloc/SPBlockAlloc.asm b/lib/splib2/blockmemoryalloc/SPBlockAlloc.asm new file mode 100644 index 00000000..afcdffda --- /dev/null +++ b/lib/splib2/blockmemoryalloc/SPBlockAlloc.asm @@ -0,0 +1,51 @@ +; +; Dynamic Block Memory Allocator +; Alvin Albrecht 2002 +; +; Comprised of: +; InitAlloc, AddMemory, BlockFit, BlockAlloc, FreeBlock +; +; Symbol "NUMQUEUES", indicating number of memory queues, +; needs to be defined externally prior to compilation. +; + + +XLIB SPBlockAlloc +LIB SPqueuetable +XDEF SPalloc + +; BlockAlloc +; +; Enter: A = Queue # +; Exit : DE=HL = Address of memory block +; Carry = Success +; Time : Success 140 +; Fail 78 +; Uses : AF, HL, DE + +.SPBlockAlloc + add a,a + add a,SPqueuetable % 256 + ld l,a + ld h,SPqueuetable / 256 + jp nc, SPalloc + inc h + +.SPalloc + ld e,(hl) + inc hl + ld d,(hl) + ld a,d + or e + ret z + inc de + ld a,(de) + ld (hl),a + dec hl + dec de + ld a,(de) + ld (hl),a + ld l,e + ld h,d + scf + ret diff --git a/lib/splib2/blockmemoryalloc/SPBlockAlloc.o b/lib/splib2/blockmemoryalloc/SPBlockAlloc.o new file mode 100644 index 00000000..8477db4e Binary files /dev/null and b/lib/splib2/blockmemoryalloc/SPBlockAlloc.o differ diff --git a/lib/splib2/blockmemoryalloc/SPBlockCount.asm b/lib/splib2/blockmemoryalloc/SPBlockCount.asm new file mode 100644 index 00000000..12ca8a47 --- /dev/null +++ b/lib/splib2/blockmemoryalloc/SPBlockCount.asm @@ -0,0 +1,41 @@ +; +; Dynamic Block Memory Allocator +; Alvin Albrecht 03.2003 +; +; Comprised of: +; InitAlloc, AddMemory, BlockFit, BlockAlloc, BlockCount, FreeBlock +; +; Symbol "NUMQUEUES", indicating number of memory queues, +; needs to be defined externally prior to compilation. +; + + +XLIB SPBlockCount +LIB SPqueuetable + +; BlockCount +; +; Enter: A = Queue # +; Exit : BC = Number of Available Blocks in Queue +; Uses : AF, BC, HL, DE +; + +.SPBlockCount + ld bc,0 + add a,a + add a,SPqueuetable % 256 + ld l,a + ld h,SPqueuetable / 256 + jp nc, loop + inc h + +.loop + ld e,(hl) + inc hl + ld d,(hl) + ld a,d + or e + ret z + inc bc + ex de,hl + jp loop diff --git a/lib/splib2/blockmemoryalloc/SPBlockCount.o b/lib/splib2/blockmemoryalloc/SPBlockCount.o new file mode 100644 index 00000000..ff89c152 Binary files /dev/null and b/lib/splib2/blockmemoryalloc/SPBlockCount.o differ diff --git a/lib/splib2/blockmemoryalloc/SPBlockFit.asm b/lib/splib2/blockmemoryalloc/SPBlockFit.asm new file mode 100644 index 00000000..f270eea1 --- /dev/null +++ b/lib/splib2/blockmemoryalloc/SPBlockFit.asm @@ -0,0 +1,43 @@ +; +; Dynamic Block Memory Allocator +; Alvin Albrecht 2002 +; +; Comprised of: +; InitAlloc, AddMemory, BlockFit, BlockAlloc, FreeBlock +; +; Symbol "NUMQUEUES", indicating number of memory queues, +; needs to be defined externally prior to compilation. +; + + +XLIB SPBlockFit +LIB SPqueuetable, SPBlockAlloc +XREF SPalloc +defw SPBlockAlloc + +; BlockFit +; +; Enter: A = Queue # +; B = # Queues to check +; Exit : DE = Address of memory block +; Carry = Success +; Uses : AF, B, HL, DE +; +; If the pools are arranged such that pool i contains memory blocks +; that are smaller than pool j, with i +#include +#include + +int main(int argc, char **argv) +{ + char *ptr; + char buff[256]; + char command[512]; + FILE *in; + + if (argc < 3) { + fprintf(stderr, "Usage: %s BaseCommandString FileWithList\n", argv[0]); + exit(1); + } + + if ((in = fopen(argv[2],"r")) == NULL) { + fprintf(stderr, "%s: Couldn't open \"%s\"\n", argv[0], argv[2]); + exit(2); + } + + while (!feof(in)) { + fgets(buff,256,in); + for (ptr=buff; (*ptr!='\0') && (!isspace(*ptr)); ptr++); + *ptr='\0'; + printf("\nFILE = \"%s\"\n\n", buff); + if (*buff != '\0') { + sprintf(command,"%s %s",argv[1],buff); + system(command); + } + } + + fclose(in); + return 0; +} + diff --git a/lib/splib2/cwrapper/GenCompile.exe b/lib/splib2/cwrapper/GenCompile.exe new file mode 100644 index 00000000..79a7769c Binary files /dev/null and b/lib/splib2/cwrapper/GenCompile.exe differ diff --git a/lib/splib2/cwrapper/sp_AddColSpr.c b/lib/splib2/cwrapper/sp_AddColSpr.c new file mode 100644 index 00000000..defde45c --- /dev/null +++ b/lib/splib2/cwrapper/sp_AddColSpr.c @@ -0,0 +1,50 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +int sp_AddColSpr(struct sp_SS *sprite, void *graphic) +{ +#asm + LIB SPAddColSpr + + ld hl,2 + add hl,sp + ;ld a,(hl) + ;ex af,af + ;inc hl + ;inc hl + ld e,(hl) + inc hl + ld d,(hl) + inc hl + ld c,(hl) + inc hl + ld b,(hl) + defb $dd + ld l,c + defb $dd + ld h,b + call SPAddColSpr + ld hl,1 + ccf + ret nc + dec l +#endasm +} + +/* enter: IX = sprite structure address + DE = sprite column definition + A' = (spectrum ) colour attribute for entire column + (hi-colour) colour threshold (0..7) + (hi-res ) unused + exit : carry for success +*/ diff --git a/lib/splib2/cwrapper/sp_AddColSpr.o b/lib/splib2/cwrapper/sp_AddColSpr.o new file mode 100644 index 00000000..d09ef225 Binary files /dev/null and b/lib/splib2/cwrapper/sp_AddColSpr.o differ diff --git a/lib/splib2/cwrapper/sp_AddMemory.c b/lib/splib2/cwrapper/sp_AddMemory.c new file mode 100644 index 00000000..15ea7f33 --- /dev/null +++ b/lib/splib2/cwrapper/sp_AddMemory.c @@ -0,0 +1,46 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_AddMemory(uchar queue, uchar number, uint size, void *addr) +{ +#asm + LIB SPAddMemory + + ld hl,8 + add hl,sp + ld a,(hl) + dec hl + dec hl + ld b,(hl) + dec hl + ld d,(hl) + dec hl + ld e,(hl) + dec hl + ex af,af + ld a,(hl) + dec hl + ld l,(hl) + ld h,a + ex af,af + call SPAddMemory +#endasm +} + +/* + enter: A = Pool #, 0..MAXBLKS-1 + B = # of memory blocks to add to pool A + DE = size of memory blocks in bytes + HL = address of free memory from which to draw these blocks + exit : HL = address just past the memory taken +*/ diff --git a/lib/splib2/cwrapper/sp_AddMemory.o b/lib/splib2/cwrapper/sp_AddMemory.o new file mode 100644 index 00000000..c9a6e27f Binary files /dev/null and b/lib/splib2/cwrapper/sp_AddMemory.o differ diff --git a/lib/splib2/cwrapper/sp_BlockAlloc.c b/lib/splib2/cwrapper/sp_BlockAlloc.c new file mode 100644 index 00000000..b57b3f3c --- /dev/null +++ b/lib/splib2/cwrapper/sp_BlockAlloc.c @@ -0,0 +1,32 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_BlockAlloc(uchar queue) +{ +#asm + LIB SPBlockAlloc + + ld hl,2 + add hl,sp + ld a,(hl) + call SPBlockAlloc + ccf + ret nc + ld hl,0 +#endasm +} + +/* enter: A = Pool #, 0..MAXBLKS-1 + exit : DE=HL = Address of memory block + Carry = Success +*/ diff --git a/lib/splib2/cwrapper/sp_BlockAlloc.o b/lib/splib2/cwrapper/sp_BlockAlloc.o new file mode 100644 index 00000000..58c3fcd8 Binary files /dev/null and b/lib/splib2/cwrapper/sp_BlockAlloc.o differ diff --git a/lib/splib2/cwrapper/sp_BlockCount.c b/lib/splib2/cwrapper/sp_BlockCount.c new file mode 100644 index 00000000..154489a2 --- /dev/null +++ b/lib/splib2/cwrapper/sp_BlockCount.c @@ -0,0 +1,31 @@ + +/* + * Sprite Pack V2.1 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 03.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +uint sp_BlockCount(uchar queue) +{ +#asm + LIB SPBlockCount + + ld hl,2 + add hl,sp + ld a,(hl) + call SPBlockCount + ld l,c + ld h,b +#endasm +} + +/* +; Enter: A = Queue # +; Exit : BC = Number of Available Blocks in Queue +*/ diff --git a/lib/splib2/cwrapper/sp_BlockCount.o b/lib/splib2/cwrapper/sp_BlockCount.o new file mode 100644 index 00000000..1746a1b8 Binary files /dev/null and b/lib/splib2/cwrapper/sp_BlockCount.o differ diff --git a/lib/splib2/cwrapper/sp_BlockFit.c b/lib/splib2/cwrapper/sp_BlockFit.c new file mode 100644 index 00000000..9a5e7089 --- /dev/null +++ b/lib/splib2/cwrapper/sp_BlockFit.c @@ -0,0 +1,36 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_BlockFit(uchar queue, uchar numcheck) +{ +#asm + LIB SPBlockFit + + ld hl,2 + add hl,sp + ld b,(hl) + inc hl + inc hl + ld a,(hl) + call SPBlockFit + ccf + ret nc + ld hl,0 +#endasm +} + +/* enter: A = Pool #, 0..MAXBLKS-1 + B = # Pools to check, 1..MAXBLKS-A + exit : DE=HL = Address of memory block + Carry = Success +*/ diff --git a/lib/splib2/cwrapper/sp_BlockFit.o b/lib/splib2/cwrapper/sp_BlockFit.o new file mode 100644 index 00000000..ed77ef39 Binary files /dev/null and b/lib/splib2/cwrapper/sp_BlockFit.o differ diff --git a/lib/splib2/cwrapper/sp_Border.c b/lib/splib2/cwrapper/sp_Border.c new file mode 100644 index 00000000..48661273 --- /dev/null +++ b/lib/splib2/cwrapper/sp_Border.c @@ -0,0 +1,28 @@ + +/* + * Sprite Pack V2.2 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 07.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_Border(uchar colour) +{ +#asm + LIB SPBorder + + ld hl,2 + add hl,sp + ld a,(hl) + call SPBorder +#endasm +} + +/* +; enter: a = border colour 0..7 +*/ diff --git a/lib/splib2/cwrapper/sp_Border.o b/lib/splib2/cwrapper/sp_Border.o new file mode 100644 index 00000000..e3e6173a Binary files /dev/null and b/lib/splib2/cwrapper/sp_Border.o differ diff --git a/lib/splib2/cwrapper/sp_CharDown.c b/lib/splib2/cwrapper/sp_CharDown.c new file mode 100644 index 00000000..18cc0f77 --- /dev/null +++ b/lib/splib2/cwrapper/sp_CharDown.c @@ -0,0 +1,32 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_CharDown(void *scrnaddr) +{ +#asm + LIB SPCharDown + + ld hl,2 + add hl,sp + ld e,(hl) + inc hl + ld d,(hl) + ex de,hl + call SPCharDown +#endasm +} + +/* enter: HL = valid screen address + exit : Carry = moved off screen + HL = moves one character down +*/ diff --git a/lib/splib2/cwrapper/sp_CharDown.o b/lib/splib2/cwrapper/sp_CharDown.o new file mode 100644 index 00000000..1fd084b0 Binary files /dev/null and b/lib/splib2/cwrapper/sp_CharDown.o differ diff --git a/lib/splib2/cwrapper/sp_CharLeft.c b/lib/splib2/cwrapper/sp_CharLeft.c new file mode 100644 index 00000000..0a489f5e --- /dev/null +++ b/lib/splib2/cwrapper/sp_CharLeft.c @@ -0,0 +1,33 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_CharLeft(void *scrnaddr) +{ +#asm + LIB SPCharLeft + + ld hl,2 + add hl,sp + ld e,(hl) + inc hl + ld d,(hl) + ex de,hl + or a + call SPCharLeft +#endasm +} + +/* enter: HL = valid screen address, carry reset + exit : Carry = moved off screen + HL = moves one character left, with line wrap +*/ diff --git a/lib/splib2/cwrapper/sp_CharLeft.o b/lib/splib2/cwrapper/sp_CharLeft.o new file mode 100644 index 00000000..ccd17dfe Binary files /dev/null and b/lib/splib2/cwrapper/sp_CharLeft.o differ diff --git a/lib/splib2/cwrapper/sp_CharRight.c b/lib/splib2/cwrapper/sp_CharRight.c new file mode 100644 index 00000000..4d9c6bf1 --- /dev/null +++ b/lib/splib2/cwrapper/sp_CharRight.c @@ -0,0 +1,33 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_CharRight(void *scrnaddr) +{ +#asm + LIB SPCharRight + + ld hl,2 + add hl,sp + ld e,(hl) + inc hl + ld d,(hl) + ex de,hl + or a + call SPCharRight +#endasm +} + +/* enter: HL = valid screen address, $4000-$57ff, carry reset + exit : Carry = moved off screen + HL = moves one character right, with line wrap +*/ diff --git a/lib/splib2/cwrapper/sp_CharRight.o b/lib/splib2/cwrapper/sp_CharRight.o new file mode 100644 index 00000000..956cf17d Binary files /dev/null and b/lib/splib2/cwrapper/sp_CharRight.o differ diff --git a/lib/splib2/cwrapper/sp_CharUp.c b/lib/splib2/cwrapper/sp_CharUp.c new file mode 100644 index 00000000..7cd13708 --- /dev/null +++ b/lib/splib2/cwrapper/sp_CharUp.c @@ -0,0 +1,32 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_CharUp(void *scrnaddr) +{ +#asm + LIB SPCharUp + + ld hl,2 + add hl,sp + ld e,(hl) + inc hl + ld d,(hl) + ex de,hl + call SPCharUp +#endasm +} + +/* enter: HL = valid screen address + exit : Carry = moved off screen + HL = moves one character up +*/ diff --git a/lib/splib2/cwrapper/sp_CharUp.o b/lib/splib2/cwrapper/sp_CharUp.o new file mode 100644 index 00000000..e1cc56b2 Binary files /dev/null and b/lib/splib2/cwrapper/sp_CharUp.o differ diff --git a/lib/splib2/cwrapper/sp_ClearRect.c b/lib/splib2/cwrapper/sp_ClearRect.c new file mode 100644 index 00000000..d85b5680 --- /dev/null +++ b/lib/splib2/cwrapper/sp_ClearRect.c @@ -0,0 +1,67 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003, 06.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_ClearRect(struct sp_Rect *area, uchar colour, uchar graphic, uchar affect) +{ +#asm + LIB SPClearRect + XREF SPClearRectP + + ld hl,2 + add hl,sp + ld a,(hl) + inc hl + inc hl + ex af,af + ld e,(hl) + inc hl + inc hl + ld d,(hl) + inc hl + inc hl + + ld a,(hl) + inc hl + ld h,(hl) + ld l,a ; hl = area + + ld b,(hl) + inc hl + ld c,(hl) + inc hl + ld a,(hl) + inc hl + ld l,(hl) + ld h,b + ld b,a + ld a,c + ld c,l + ld l,a + + call SPClearRectP +#endasm +} +#asm + defw SPClearRect +#endasm + +/* + enter: H = row coord top left corner + L = col coord top left corner + B = row height in characters + C = col width in characters + D = background tile pallette # (colour) + E = background tile graphic # + A' = bit 0 is 1 to affect background tile + bit 1 is 1 to affect sprites +*/ diff --git a/lib/splib2/cwrapper/sp_ClearRect.o b/lib/splib2/cwrapper/sp_ClearRect.o new file mode 100644 index 00000000..d494dabf Binary files /dev/null and b/lib/splib2/cwrapper/sp_ClearRect.o differ diff --git a/lib/splib2/cwrapper/sp_CompDListAddr.c b/lib/splib2/cwrapper/sp_CompDListAddr.c new file mode 100644 index 00000000..bd29cd91 --- /dev/null +++ b/lib/splib2/cwrapper/sp_CompDListAddr.c @@ -0,0 +1,33 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_CompDListAddr(uchar row, uchar col) +{ +#asm + LIB SPCompDListAddr + + ld hl,2 + add hl,sp + ld c,(hl) + inc hl + inc hl + ld a,(hl) + call SPCompDListAddr +#endasm +} + +/* +; enter: A = row position (0..23) +; C = col position (0..31/63) +; exit : HL = display list address +*/ diff --git a/lib/splib2/cwrapper/sp_CompDListAddr.o b/lib/splib2/cwrapper/sp_CompDListAddr.o new file mode 100644 index 00000000..8bf39efa Binary files /dev/null and b/lib/splib2/cwrapper/sp_CompDListAddr.o differ diff --git a/lib/splib2/cwrapper/sp_CompDirtyAddr.c b/lib/splib2/cwrapper/sp_CompDirtyAddr.c new file mode 100644 index 00000000..4616b7c4 --- /dev/null +++ b/lib/splib2/cwrapper/sp_CompDirtyAddr.c @@ -0,0 +1,43 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_CompDirtyAddr(uchar row, uchar col, uchar *mask) +{ +#asm + LIB SPCompDirtyAddr + + ld hl,6 + add hl,sp + ld a,(hl) + dec hl + dec hl + ld c,(hl) + dec hl + push hl + call SPCompDirtyAddr + pop de + ex de,hl + ld b,(hl) + dec hl + ld c,(hl) + ex de,hl + ld (bc),a +#endasm +} + +/* +; enter: A = row position (0..23) +; C = col position (0..31/63) +; exit : HL = dirty char address +; A = bit position of char within dirty byte +*/ diff --git a/lib/splib2/cwrapper/sp_CompDirtyAddr.o b/lib/splib2/cwrapper/sp_CompDirtyAddr.o new file mode 100644 index 00000000..c1c597ce Binary files /dev/null and b/lib/splib2/cwrapper/sp_CompDirtyAddr.o differ diff --git a/lib/splib2/cwrapper/sp_ComputePos.c b/lib/splib2/cwrapper/sp_ComputePos.c new file mode 100644 index 00000000..9d781a02 --- /dev/null +++ b/lib/splib2/cwrapper/sp_ComputePos.c @@ -0,0 +1,45 @@ + +/* + * Sprite Pack V2.2 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 06.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_ComputePos(struct sp_PSS *ps, uchar x, uchar y) +{ +#asm + LIB SPPrintString, sp_pssread, sp_psswrite + + ld hl,2 + add hl,sp + ld d,(hl) + ld e,22 + inc hl + inc hl + ld c,(hl) + ld b,0 + inc hl + inc hl + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + push hl + push bc + push de + call sp_pssread + ld hl,0 + add hl,sp + call SPPrintString + pop hl + pop hl + pop hl + call sp_psswrite +#endasm +} diff --git a/lib/splib2/cwrapper/sp_ComputePos.o b/lib/splib2/cwrapper/sp_ComputePos.o new file mode 100644 index 00000000..3674407f Binary files /dev/null and b/lib/splib2/cwrapper/sp_ComputePos.o differ diff --git a/lib/splib2/cwrapper/sp_CreateGenericISR.c b/lib/splib2/cwrapper/sp_CreateGenericISR.c new file mode 100644 index 00000000..51a77ab1 --- /dev/null +++ b/lib/splib2/cwrapper/sp_CreateGenericISR.c @@ -0,0 +1,30 @@ +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_CreateGenericISR(void *addr) +{ +#asm + LIB SPCreateGenericISR + + pop hl + pop de + push de + push hl + call SPCreateGenericISR + ex de,hl +#endasm +} + +/* +; enter: de = address to place ISR +; exit : de = address just past ISR +*/ diff --git a/lib/splib2/cwrapper/sp_CreateGenericISR.o b/lib/splib2/cwrapper/sp_CreateGenericISR.o new file mode 100644 index 00000000..4b0ed3e9 Binary files /dev/null and b/lib/splib2/cwrapper/sp_CreateGenericISR.o differ diff --git a/lib/splib2/cwrapper/sp_CreateSpr.c b/lib/splib2/cwrapper/sp_CreateSpr.c new file mode 100644 index 00000000..6bba0042 --- /dev/null +++ b/lib/splib2/cwrapper/sp_CreateSpr.c @@ -0,0 +1,60 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +/* returns no carry if success */ +struct sp_SS *sp_CreateSpr(uchar type, uchar rows, void *graphic) +{ +#asm + LIB SPCreateSpr + + ld hl,2 + add hl,sp ; hl points past ret address + ;ld a,(hl) ; 'extra' parameter is colour or threshold info + ;ex af,af' ; a' = extra + ;inc hl + ;inc hl + ;ld c,(hl) ; c = plane + ld c, 0 + ;inc hl + ;inc hl + ld e,(hl) + inc hl + ld d,(hl) ; de = sprite graphic + inc hl + ld b,(hl) ; b = # rows in sprite + inc hl + inc hl + ld a,(hl) ; sprite type + or c + ld c,a ; c = sprite attribute + + call SPCreateSpr ; carry = success, ix = sprite struct address + + push ix + pop hl ; hl = sprite struct + ccf ; no carry indicates success, compatible with C "iferror(..)" +#endasm +} + +/* + enter: B = #rows + C = sprite attribute + bits 7..6 = 00 (mask-type), 01 (or-type), 10 (xor-type), 11 (load-type) + bits 5..0 = sprite plane 0..63, lower means closer to viewer + DE = sprite column definition (bitdef) + A' = (spectrum ) colour attribute for column + = (hi-colour) colour threshold (0..7) + = (hi-res ) unused + exit : IX = sprite structure address + carry for success +*/ diff --git a/lib/splib2/cwrapper/sp_CreateSpr.o b/lib/splib2/cwrapper/sp_CreateSpr.o new file mode 100644 index 00000000..fbb55ef9 Binary files /dev/null and b/lib/splib2/cwrapper/sp_CreateSpr.o differ diff --git a/lib/splib2/cwrapper/sp_DeleteSpr.c b/lib/splib2/cwrapper/sp_DeleteSpr.c new file mode 100644 index 00000000..37f53566 --- /dev/null +++ b/lib/splib2/cwrapper/sp_DeleteSpr.c @@ -0,0 +1,31 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_DeleteSpr(struct sp_SS *sprite) +{ +#asm + LIB SPDeleteSpr + + ld hl,2 + add hl,sp + ld e,(hl) + inc hl + ld d,(hl) + call SPDeleteSpr +#endasm +} + +/* + enter: DE = sprite structure address +*/ + diff --git a/lib/splib2/cwrapper/sp_DeleteSpr.o b/lib/splib2/cwrapper/sp_DeleteSpr.o new file mode 100644 index 00000000..61c8657e Binary files /dev/null and b/lib/splib2/cwrapper/sp_DeleteSpr.o differ diff --git a/lib/splib2/cwrapper/sp_EmptyISR.c b/lib/splib2/cwrapper/sp_EmptyISR.c new file mode 100644 index 00000000..24e379ed --- /dev/null +++ b/lib/splib2/cwrapper/sp_EmptyISR.c @@ -0,0 +1,20 @@ +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_EmptyISR(void) +{ +#asm + LIB SPEmptyISR + + jp SPEmptyISR +#endasm +} diff --git a/lib/splib2/cwrapper/sp_EmptyISR.o b/lib/splib2/cwrapper/sp_EmptyISR.o new file mode 100644 index 00000000..b64a82c8 Binary files /dev/null and b/lib/splib2/cwrapper/sp_EmptyISR.o differ diff --git a/lib/splib2/cwrapper/sp_FreeBlock.c b/lib/splib2/cwrapper/sp_FreeBlock.c new file mode 100644 index 00000000..1b580494 --- /dev/null +++ b/lib/splib2/cwrapper/sp_FreeBlock.c @@ -0,0 +1,30 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_FreeBlock(void *addr) +{ +#asm + LIB SPFreeBlock + + ld hl,2 + add hl,sp + ld e,(hl) + inc hl + ld d,(hl) + call SPFreeBlock +#endasm +} + +/* + enter: DE = address of a block, as returned by BlockAlloc or BlockFit +*/ diff --git a/lib/splib2/cwrapper/sp_FreeBlock.o b/lib/splib2/cwrapper/sp_FreeBlock.o new file mode 100644 index 00000000..12a72c90 Binary files /dev/null and b/lib/splib2/cwrapper/sp_FreeBlock.o differ diff --git a/lib/splib2/cwrapper/sp_GetAttrAddr.c b/lib/splib2/cwrapper/sp_GetAttrAddr.c new file mode 100644 index 00000000..c7622607 --- /dev/null +++ b/lib/splib2/cwrapper/sp_GetAttrAddr.c @@ -0,0 +1,33 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_GetAttrAddr(void *scrnaddr) +{ +#asm + LIB SPGetAttrAddr + + ld hl,2 + add hl,sp + ld e,(hl) + inc hl + ld d,(hl) + ex de,hl + call SPGetAttrAddr + ex de,hl +#endasm +} + +/* + enter: hl = screen address + exit : de = address of attribute square +*/ diff --git a/lib/splib2/cwrapper/sp_GetAttrAddr.o b/lib/splib2/cwrapper/sp_GetAttrAddr.o new file mode 100644 index 00000000..38884190 Binary files /dev/null and b/lib/splib2/cwrapper/sp_GetAttrAddr.o differ diff --git a/lib/splib2/cwrapper/sp_GetCharAddr.c b/lib/splib2/cwrapper/sp_GetCharAddr.c new file mode 100644 index 00000000..503d4bfa --- /dev/null +++ b/lib/splib2/cwrapper/sp_GetCharAddr.c @@ -0,0 +1,33 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_GetCharAddr(uchar row, uchar col) +{ +#asm + LIB SPGetCharAddr + + ld hl,2 + add hl,sp + ld a,(hl) + inc hl + inc hl + ld h,(hl) + ld l,a + call SPGetCharAddr +#endasm +} + +/* + enter: h = y coord 0..23, l = x coord 0..31/63 + exit : hl = screen address +*/ diff --git a/lib/splib2/cwrapper/sp_GetCharAddr.o b/lib/splib2/cwrapper/sp_GetCharAddr.o new file mode 100644 index 00000000..3186e441 Binary files /dev/null and b/lib/splib2/cwrapper/sp_GetCharAddr.o differ diff --git a/lib/splib2/cwrapper/sp_GetKey.c b/lib/splib2/cwrapper/sp_GetKey.c new file mode 100644 index 00000000..ca736e6f --- /dev/null +++ b/lib/splib2/cwrapper/sp_GetKey.c @@ -0,0 +1,32 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +uchar sp_GetKey(void) /* returns ascii code, 0 if no key pressed */ +{ +#asm + LIB SPGetKey + + call SPGetKey + jr c, keyok + xor a + +.keyok + ld l,a + ld h,0 + ccf +#endasm +} + +/* +; exit : carry flag set: key is registered, a = ascii code +*/ diff --git a/lib/splib2/cwrapper/sp_GetKey.o b/lib/splib2/cwrapper/sp_GetKey.o new file mode 100644 index 00000000..6b6e9b01 Binary files /dev/null and b/lib/splib2/cwrapper/sp_GetKey.o differ diff --git a/lib/splib2/cwrapper/sp_GetScrnAddr.c b/lib/splib2/cwrapper/sp_GetScrnAddr.c new file mode 100644 index 00000000..c3f22f00 --- /dev/null +++ b/lib/splib2/cwrapper/sp_GetScrnAddr.c @@ -0,0 +1,48 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_GetScrnAddr(uint xcoord, uchar ycoord, uchar *mask) +{ +#asm + LIB SPGetScrnAddr + + ld hl,7 + add hl,sp + ld b,(hl) + dec hl + ld c,(hl) ; bc = x coord + dec hl + dec hl + push hl + ld h,(hl) + ld l,c + ld a,h + rrc b + call SPGetScrnAddr + ex de,hl + ex (sp),hl + dec hl + ld d,(hl) + dec hl + ld e,(hl) ; de = mask + ex de,hl + ld (hl),b + pop hl +#endasm +} + +/* + enter: a = h = y coord 0..191, l = x coord 0..255 + carry = add 256 to x coord (hi-res only) + exit : de = screen address, b = pixel mask +*/ diff --git a/lib/splib2/cwrapper/sp_GetScrnAddr.o b/lib/splib2/cwrapper/sp_GetScrnAddr.o new file mode 100644 index 00000000..b3022eb5 Binary files /dev/null and b/lib/splib2/cwrapper/sp_GetScrnAddr.o differ diff --git a/lib/splib2/cwrapper/sp_GetTiles.c b/lib/splib2/cwrapper/sp_GetTiles.c new file mode 100644 index 00000000..14802f71 --- /dev/null +++ b/lib/splib2/cwrapper/sp_GetTiles.c @@ -0,0 +1,49 @@ + +/* + * Sprite Pack V2.2 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 07.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_GetTiles(struct sp_Rect *r, void *dest) +{ +#asm + LIB SPGetTiles + + ld hl,2 + add hl,sp + ld e,(hl) + inc hl + ld d,(hl) + inc hl + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + ld b,(hl) + inc hl + ld c,(hl) + inc hl + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + ld a,b + ex de,hl + call SPGetTiles +#endasm +} + +/* +; enter : hl = dest address +; A = row coord of top left corner of rectangle +; C = col coord of top left corner of rectangle +; D = width of rectangle +; E = height of rectangle +*/ diff --git a/lib/splib2/cwrapper/sp_GetTiles.o b/lib/splib2/cwrapper/sp_GetTiles.o new file mode 100644 index 00000000..fbeac5e0 Binary files /dev/null and b/lib/splib2/cwrapper/sp_GetTiles.o differ diff --git a/lib/splib2/cwrapper/sp_InitAlloc.c b/lib/splib2/cwrapper/sp_InitAlloc.c new file mode 100644 index 00000000..80a2dc94 --- /dev/null +++ b/lib/splib2/cwrapper/sp_InitAlloc.c @@ -0,0 +1,21 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_InitAlloc(void) +{ +#asm + LIB SPInitAlloc + + call SPInitAlloc +#endasm +} diff --git a/lib/splib2/cwrapper/sp_InitAlloc.o b/lib/splib2/cwrapper/sp_InitAlloc.o new file mode 100644 index 00000000..1a5dfa7d Binary files /dev/null and b/lib/splib2/cwrapper/sp_InitAlloc.o differ diff --git a/lib/splib2/cwrapper/sp_InitIM2.c b/lib/splib2/cwrapper/sp_InitIM2.c new file mode 100644 index 00000000..7879fc44 --- /dev/null +++ b/lib/splib2/cwrapper/sp_InitIM2.c @@ -0,0 +1,31 @@ +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +/* void sp_InitIM2(void (*isr)(void)) */ +void sp_InitIM2(void *isr) +{ +#asm + LIB SPInitIM2 + + ld hl,2 + add hl,sp + ld c,(hl) + inc hl + ld b,(hl) + call SPInitIM2 +#endasm +} + +/* +; Selects IM2. Interrupts should be disabled prior to calling. +; enter: bc = address of default interrupt handler +*/ diff --git a/lib/splib2/cwrapper/sp_InitIM2.o b/lib/splib2/cwrapper/sp_InitIM2.o new file mode 100644 index 00000000..d9497e6a Binary files /dev/null and b/lib/splib2/cwrapper/sp_InitIM2.o differ diff --git a/lib/splib2/cwrapper/sp_Initialize.c b/lib/splib2/cwrapper/sp_Initialize.c new file mode 100644 index 00000000..b443f81c --- /dev/null +++ b/lib/splib2/cwrapper/sp_Initialize.c @@ -0,0 +1,32 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 05.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_Initialize(uchar colour, uchar graphic) +{ +#asm + LIB SPInitialize + + ld hl,2 + add hl,sp + ld e,(hl) + inc hl + inc hl + ld d,(hl) + call SPInitialize +#endasm +} + +/* +; enter: e = default background tile # (graphic) +; d = default background pallette # (colour) +*/ diff --git a/lib/splib2/cwrapper/sp_Initialize.o b/lib/splib2/cwrapper/sp_Initialize.o new file mode 100644 index 00000000..5be97935 Binary files /dev/null and b/lib/splib2/cwrapper/sp_Initialize.o differ diff --git a/lib/splib2/cwrapper/sp_Inkey.c b/lib/splib2/cwrapper/sp_Inkey.c new file mode 100644 index 00000000..dad03bf2 --- /dev/null +++ b/lib/splib2/cwrapper/sp_Inkey.c @@ -0,0 +1,37 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +uchar sp_Inkey(void) /* returns ascii code, 0 if no key pressed */ +{ +#asm + LIB SPGetKey + XREF SPInkey + + call SPInkey + jr c, keyok + xor a + +.keyok + ld l,a + ld h,0 + ccf +#endasm +} +#asm + defw SPGetKey +#endasm + +/* +; exit : carry flag set: key is registered, a = ascii code +*/ + diff --git a/lib/splib2/cwrapper/sp_Inkey.o b/lib/splib2/cwrapper/sp_Inkey.o new file mode 100644 index 00000000..1f269466 Binary files /dev/null and b/lib/splib2/cwrapper/sp_Inkey.o differ diff --git a/lib/splib2/cwrapper/sp_InstallISR.c b/lib/splib2/cwrapper/sp_InstallISR.c new file mode 100644 index 00000000..35bff6b6 --- /dev/null +++ b/lib/splib2/cwrapper/sp_InstallISR.c @@ -0,0 +1,37 @@ +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +/* void (*old_isr)(void) sp_InstallISR(uchar vector, void (*isr)(void)) */ +void *sp_InstallISR(uchar vector, void *isr) +{ +#asm + LIB SPInstallISR + + ld hl,2 + add hl,sp + ld e,(hl) + inc hl + ld d,(hl) + inc hl + ld l,(hl) + call SPInstallISR + ex de,hl +#endasm +} + +/* +; INTERRUPTS SHOULD BE DISABLED PRIOR TO CALLING! +; +; enter: l = vector to install on (even, 0..254) +; de = ISR address +; exit : de = old ISR address +*/ diff --git a/lib/splib2/cwrapper/sp_InstallISR.o b/lib/splib2/cwrapper/sp_InstallISR.o new file mode 100644 index 00000000..66d1002f Binary files /dev/null and b/lib/splib2/cwrapper/sp_InstallISR.o differ diff --git a/lib/splib2/cwrapper/sp_IntIntervals.c b/lib/splib2/cwrapper/sp_IntIntervals.c new file mode 100644 index 00000000..e0b36f67 --- /dev/null +++ b/lib/splib2/cwrapper/sp_IntIntervals.c @@ -0,0 +1,54 @@ +/* + * Sprite Pack V2.1 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 03.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +int sp_IntIntervals(struct sp_Interval *i1, struct sp_Interval *i2, struct sp_Interval *result) +{ +#asm + LIB SPIntIvals + + pop bc + pop hl + pop iy + pop ix + push hl + push hl + push hl + push bc + push hl + call SPIntIvals + pop hl + ld (hl),c + inc hl + ld (hl),b + inc hl + ld (hl),e + inc hl + ld (hl),d + ld hl,0 + ret c + inc l +#endasm +} + +/* +; enter: ix+0 = x1 low +; ix+1 = x1 hi +; ix+2 = x2 low +; ix+3 = x2 hi +; iy+0 = y1 low +; iy+1 = y1 hi +; iy+2 = y2 low +; iy+3 = y2 hi +; +; exit : carry = no intersection +; otherwise the resulting intersect interval is [bc,de] +*/ diff --git a/lib/splib2/cwrapper/sp_IntIntervals.o b/lib/splib2/cwrapper/sp_IntIntervals.o new file mode 100644 index 00000000..236cbd44 Binary files /dev/null and b/lib/splib2/cwrapper/sp_IntIntervals.o differ diff --git a/lib/splib2/cwrapper/sp_IntLargeRect.c b/lib/splib2/cwrapper/sp_IntLargeRect.c new file mode 100644 index 00000000..34e5990e --- /dev/null +++ b/lib/splib2/cwrapper/sp_IntLargeRect.c @@ -0,0 +1,89 @@ + +/* + * Sprite Pack V2.1 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 03.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +int sp_IntLargeRect(struct sp_LargeRect *r1, struct sp_LargeRect *r2, struct sp_LargeRect *result) +{ +#asm + LIB SPIntLargeRect + + ld hl,7 + add hl,sp + ld d,(hl) + dec hl + ld e,(hl) + dec hl + ld b,(hl) + dec hl + ld c,(hl) + defb $dd + ld l,e + defb $dd + ld h,d + defb $fd + ld l,c + defb $fd + ld h,b + call SPIntLargeRect + ld hl,0 + ret c + ld hl,10 + add hl,sp + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + ld bc,7 + add hl,bc + pop bc + ld (hl),b + dec hl + ld (hl),c + dec hl + pop bc + ld (hl),b + dec hl + ld (hl),c + dec hl + pop bc + ld (hl),b + dec hl + ld (hl),c + dec hl + pop bc + ld (hl),b + dec hl + ld (hl),c + ld hl,1 +#endasm +} + +/* +; enter: Rectangle #1: +; +; ix+0/1 xtop +; ix+2/3 xbot +; ix+4/5 xleft +; ix+6/7 xright +; +; Rectangle #2: +; +; iy+0/1 ytop +; iy+2/3 ybot +; iy+4/5 yleft +; iy+6/7 yright +; +; exit : carry = resulting rectangle is empty +; otherwise the result of the intersection is on stack: +; pop order = right, left, bottom, top +*/ + diff --git a/lib/splib2/cwrapper/sp_IntLargeRect.o b/lib/splib2/cwrapper/sp_IntLargeRect.o new file mode 100644 index 00000000..69e13495 Binary files /dev/null and b/lib/splib2/cwrapper/sp_IntLargeRect.o differ diff --git a/lib/splib2/cwrapper/sp_IntPtInterval.c b/lib/splib2/cwrapper/sp_IntPtInterval.c new file mode 100644 index 00000000..9193e250 --- /dev/null +++ b/lib/splib2/cwrapper/sp_IntPtInterval.c @@ -0,0 +1,44 @@ +/* + * Sprite Pack V2.1 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 03.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +int sp_IntPtInterval(uint x, struct sp_Interval *i) +{ +#asm + LIB SPPtInIval + + pop bc + pop hl + ld c,(hl) + inc hl + ld b,(hl) + inc hl + ld e,(hl) + inc hl + ld d,(hl) + pop hl + push hl + push hl + push bc + call SPPtInIval + ld hl,0 + ret c + inc l +#endasm +} + +/* +; enter: bc = x1 (left end of range, inclusive) +; de = x2 (right end of range, inclusive) +; hl = x +; +; exit : carry = point not in interval +*/ diff --git a/lib/splib2/cwrapper/sp_IntPtInterval.o b/lib/splib2/cwrapper/sp_IntPtInterval.o new file mode 100644 index 00000000..0c891e93 Binary files /dev/null and b/lib/splib2/cwrapper/sp_IntPtInterval.o differ diff --git a/lib/splib2/cwrapper/sp_IntPtLargeRect.c b/lib/splib2/cwrapper/sp_IntPtLargeRect.c new file mode 100644 index 00000000..dc98ec71 --- /dev/null +++ b/lib/splib2/cwrapper/sp_IntPtLargeRect.c @@ -0,0 +1,46 @@ + +/* + * Sprite Pack V2.1 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 03.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +int sp_IntPtLargeRect(uint x, uint y, struct sp_LargeRect *r) +{ +#asm + LIB SPPtInLargeRect + + pop bc + pop ix + pop hl + pop de + push de + push hl + push hl + push bc + call SPPtInLargeRect + ld hl,0 + ret c + inc l +#endasm +} + +/* +; enter: Rectangle #1: +; +; ix+0/1 xtop +; ix+2/3 xbot +; ix+4/5 xleft +; ix+6/7 xright +; +; hl = y coordinate +; de = x coordinate +; +; exit : carry = not in rectangle +*/ diff --git a/lib/splib2/cwrapper/sp_IntPtLargeRect.o b/lib/splib2/cwrapper/sp_IntPtLargeRect.o new file mode 100644 index 00000000..fe8f660a Binary files /dev/null and b/lib/splib2/cwrapper/sp_IntPtLargeRect.o differ diff --git a/lib/splib2/cwrapper/sp_IntRect.c b/lib/splib2/cwrapper/sp_IntRect.c new file mode 100644 index 00000000..bb1815e0 --- /dev/null +++ b/lib/splib2/cwrapper/sp_IntRect.c @@ -0,0 +1,90 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +int sp_IntRect(struct sp_Rect *r1, struct sp_Rect *r2, struct sp_Rect *result) +/* zero return = no overlap or use "iferror(...)" */ +{ +#asm + LIB sp_fixcliprect, SPIntRect + + ld hl,7 + add hl,sp + + ld iy,-4 ; allocate a ClipStruct on stack + add iy,sp + ld sp,iy + + ld d,(hl) + dec hl + ld e,(hl) ; de = r1 + dec hl + call sp_fixcliprect ; converted to clip rect and stored at iy + + ld d,(hl) + dec hl + ld e,(hl) ; de = r2 + dec hl + push hl + ex de,hl + ld b,(hl) + inc hl + ld c,(hl) + inc hl + ld d,(hl) + inc hl + ld e,(hl) + + call SPIntRect + pop hl + ld a,(hl) + dec hl + ld l,(hl) + ld h,a ; hl = result + ld (hl),b + inc hl + ld (hl),c + inc hl + ld (hl),d + inc hl + ld (hl),e + + pop hl + pop hl + + ld hl,1 + ret nc + dec l +#endasm +} + +/* + enter: Rectangle #1: + + B = row coord top left corner + C = col coord top left corner + D = row height in chars + E = col width in chars + + Rectangle #2 (aka clipping rectangle): + + (iy+0) = row coord top left corner + (iy+1) = row coord bottom right corner + 1 + (iy+2) = col coord top left corner + (iy+3) = col coord bottom right corner + 1 + + exit : carry = resulting rectangle is empty + B = row coord top left corner of intersection + C = col coord top left corner of intersection + D = row height in chars of intersection + E = col width in chars of intersection +*/ diff --git a/lib/splib2/cwrapper/sp_IntRect.o b/lib/splib2/cwrapper/sp_IntRect.o new file mode 100644 index 00000000..e13bde13 Binary files /dev/null and b/lib/splib2/cwrapper/sp_IntRect.o differ diff --git a/lib/splib2/cwrapper/sp_Invalidate.c b/lib/splib2/cwrapper/sp_Invalidate.c new file mode 100644 index 00000000..2bbc6f98 --- /dev/null +++ b/lib/splib2/cwrapper/sp_Invalidate.c @@ -0,0 +1,62 @@ + + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_Invalidate(struct sp_Rect *area, struct sp_Rect *clip) +{ +#asm + LIB sp_fixcliprect, SPInvalidate + XREF SPInvalidateP + + ld hl,2 + add hl,sp + + ld iy,-4 + add iy,sp + ld sp,iy + + ld e,(hl) + inc hl + ld d,(hl) + inc hl + call sp_fixcliprect + + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + ld b,(hl) + inc hl + ld c,(hl) + inc hl + ld d,(hl) + inc hl + ld e,(hl) + + call SPInvalidateP + pop hl + pop hl +#endasm +} + +#asm + defw SPInvalidate +#endasm + +/* + enter: B = row coord top left corner + C = col coord top left corner + D = height in chars + E = width in chars + IY = clipping rectangle, set it to "ClipStruct" for full screen +*/ diff --git a/lib/splib2/cwrapper/sp_Invalidate.o b/lib/splib2/cwrapper/sp_Invalidate.o new file mode 100644 index 00000000..3d24cfdb Binary files /dev/null and b/lib/splib2/cwrapper/sp_Invalidate.o differ diff --git a/lib/splib2/cwrapper/sp_IterateDList.c b/lib/splib2/cwrapper/sp_IterateDList.c new file mode 100644 index 00000000..ba4aa555 --- /dev/null +++ b/lib/splib2/cwrapper/sp_IterateDList.c @@ -0,0 +1,43 @@ + +/* + * Sprite Pack V2.1 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 06.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_IterateDList(struct sp_Rect *r, void *hook) +{ +#asm + LIB SPIterateDList + + pop hl + pop iy + pop de + push de + push iy + push hl + ex de,hl + ld a,(hl) + inc hl + ld c,(hl) + inc hl + ld e,(hl) + inc hl + ld d,(hl) + call SPIterateDList +#endasm +} + +/* +; enter: IY = user supplied hook address +; A = row top left corner +; C = col top left corner +; D = width +; E = height +*/ diff --git a/lib/splib2/cwrapper/sp_IterateDList.o b/lib/splib2/cwrapper/sp_IterateDList.o new file mode 100644 index 00000000..43c74dc2 Binary files /dev/null and b/lib/splib2/cwrapper/sp_IterateDList.o differ diff --git a/lib/splib2/cwrapper/sp_IterateSprChar.c b/lib/splib2/cwrapper/sp_IterateSprChar.c new file mode 100644 index 00000000..c31be530 --- /dev/null +++ b/lib/splib2/cwrapper/sp_IterateSprChar.c @@ -0,0 +1,36 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +/*void sp_IterateSprChar(struct sp_SS *sprite, void (*hook)(sp_CS *cs))*/ +void sp_IterateSprChar(struct sp_SS *sprite, void *hook) +{ +#asm + LIB SPIterateSprChar + + pop hl + pop iy + pop ix + push ix + push iy + push hl + call SPIterateSprChar +#endasm +} + +/* + enter: IX = sprite structure address + IY = user supplied subroutine address + user hook can use all registers safely + (af & hl change between calls) + hook routine entered with hl = char struct + 0 +*/ diff --git a/lib/splib2/cwrapper/sp_IterateSprChar.o b/lib/splib2/cwrapper/sp_IterateSprChar.o new file mode 100644 index 00000000..75480550 Binary files /dev/null and b/lib/splib2/cwrapper/sp_IterateSprChar.o differ diff --git a/lib/splib2/cwrapper/sp_JoyFuller.c b/lib/splib2/cwrapper/sp_JoyFuller.c new file mode 100644 index 00000000..3ba6ce4f --- /dev/null +++ b/lib/splib2/cwrapper/sp_JoyFuller.c @@ -0,0 +1,27 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +uchar sp_JoyFuller(void) +{ +#asm + LIB SPJoyFuller + + call SPJoyFuller + ld l,a + ld h,0 +#endasm +} + +/* + exit: a = FxxxRLDU active low +*/ diff --git a/lib/splib2/cwrapper/sp_JoyFuller.o b/lib/splib2/cwrapper/sp_JoyFuller.o new file mode 100644 index 00000000..b2bedd3c Binary files /dev/null and b/lib/splib2/cwrapper/sp_JoyFuller.o differ diff --git a/lib/splib2/cwrapper/sp_JoyKempston.c b/lib/splib2/cwrapper/sp_JoyKempston.c new file mode 100644 index 00000000..a6aae7fa --- /dev/null +++ b/lib/splib2/cwrapper/sp_JoyKempston.c @@ -0,0 +1,27 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +uchar sp_JoyKempston(void) +{ +#asm + LIB SPJoyKempston + + call SPJoyKempston + ld l,a + ld h,0 +#endasm +} + +/* + exit: a = FxxxRLDU active low +*/ diff --git a/lib/splib2/cwrapper/sp_JoyKempston.o b/lib/splib2/cwrapper/sp_JoyKempston.o new file mode 100644 index 00000000..6f0e12da Binary files /dev/null and b/lib/splib2/cwrapper/sp_JoyKempston.o differ diff --git a/lib/splib2/cwrapper/sp_JoyKeyboard.c b/lib/splib2/cwrapper/sp_JoyKeyboard.c new file mode 100644 index 00000000..f2816a13 --- /dev/null +++ b/lib/splib2/cwrapper/sp_JoyKeyboard.c @@ -0,0 +1,44 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +uchar sp_JoyKeyboard(struct sp_UDK *keys) +{ +#asm + LIB SPJoyKeyboard + + ld hl,2 + add hl,sp + ld e,(hl) + inc hl + ld d,(hl) + call SPJoyKeyboard + ld l,a + ld h,0 +#endasm +} + +/* +; enter: de points at a 5-entry table, each entry holds +; a key row value (byte) followed by a mask (byte). +; The key row byte is the same byte that would appear +; in the MSB of a port read of the keyboard. The mask +; byte isolates the key within the byte. "LookupKey" +; will provide this information for a particular key +; given its ascii code. +; de + 0/1 fire key: key row / mask +; de + 2/3 right key: key row / mask +; de + 4/5 left key: key row / mask +; de + 6/7 down key: key row / mask +; de + 8/9 up key: key row / mask +; exit : a = F111RLDU active low +*/ diff --git a/lib/splib2/cwrapper/sp_JoyKeyboard.o b/lib/splib2/cwrapper/sp_JoyKeyboard.o new file mode 100644 index 00000000..5e84af43 Binary files /dev/null and b/lib/splib2/cwrapper/sp_JoyKeyboard.o differ diff --git a/lib/splib2/cwrapper/sp_JoySinclair1.c b/lib/splib2/cwrapper/sp_JoySinclair1.c new file mode 100644 index 00000000..a785ddee --- /dev/null +++ b/lib/splib2/cwrapper/sp_JoySinclair1.c @@ -0,0 +1,27 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +uchar sp_JoySinclair1(void) +{ +#asm + LIB SPJoySinclair1 + + call SPJoySinclair1 + ld l,a + ld h,0 +#endasm +} + +/* + exit: a = FxxxRLDU active low +*/ diff --git a/lib/splib2/cwrapper/sp_JoySinclair1.o b/lib/splib2/cwrapper/sp_JoySinclair1.o new file mode 100644 index 00000000..df1c9f2d Binary files /dev/null and b/lib/splib2/cwrapper/sp_JoySinclair1.o differ diff --git a/lib/splib2/cwrapper/sp_JoySinclair2.c b/lib/splib2/cwrapper/sp_JoySinclair2.c new file mode 100644 index 00000000..0629d4a1 --- /dev/null +++ b/lib/splib2/cwrapper/sp_JoySinclair2.c @@ -0,0 +1,27 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +uchar sp_JoySinclair2(void) +{ +#asm + LIB SPJoySinclair2 + + call SPJoySinclair2 + ld l,a + ld h,0 +#endasm +} + +/* + exit: a = FxxxRLDU active low +*/ diff --git a/lib/splib2/cwrapper/sp_JoySinclair2.o b/lib/splib2/cwrapper/sp_JoySinclair2.o new file mode 100644 index 00000000..6c532793 Binary files /dev/null and b/lib/splib2/cwrapper/sp_JoySinclair2.o differ diff --git a/lib/splib2/cwrapper/sp_JoyTimexEither.c b/lib/splib2/cwrapper/sp_JoyTimexEither.c new file mode 100644 index 00000000..bc8a51d4 --- /dev/null +++ b/lib/splib2/cwrapper/sp_JoyTimexEither.c @@ -0,0 +1,27 @@ + +/* + * Sprite Pack V2.2 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 09.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +uchar sp_JoyTimexEither(void) +{ +#asm + LIB SPJoyTimexEither + + call SPJoyTimexEither + ld l,a + ld h,0 +#endasm +} + +/* + exit: a = FxxxRLDU active low +*/ diff --git a/lib/splib2/cwrapper/sp_JoyTimexEither.o b/lib/splib2/cwrapper/sp_JoyTimexEither.o new file mode 100644 index 00000000..4dd5dd97 Binary files /dev/null and b/lib/splib2/cwrapper/sp_JoyTimexEither.o differ diff --git a/lib/splib2/cwrapper/sp_JoyTimexLeft.c b/lib/splib2/cwrapper/sp_JoyTimexLeft.c new file mode 100644 index 00000000..f9dc4ede --- /dev/null +++ b/lib/splib2/cwrapper/sp_JoyTimexLeft.c @@ -0,0 +1,27 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +uchar sp_JoyTimexLeft(void) +{ +#asm + LIB SPJoyTimexLeft + + call SPJoyTimexLeft + ld l,a + ld h,0 +#endasm +} + +/* + exit: a = FxxxRLDU active low +*/ diff --git a/lib/splib2/cwrapper/sp_JoyTimexLeft.o b/lib/splib2/cwrapper/sp_JoyTimexLeft.o new file mode 100644 index 00000000..95e9969e Binary files /dev/null and b/lib/splib2/cwrapper/sp_JoyTimexLeft.o differ diff --git a/lib/splib2/cwrapper/sp_JoyTimexRight.c b/lib/splib2/cwrapper/sp_JoyTimexRight.c new file mode 100644 index 00000000..e62a4cc8 --- /dev/null +++ b/lib/splib2/cwrapper/sp_JoyTimexRight.c @@ -0,0 +1,27 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +uchar sp_JoyTimexRight(void) +{ +#asm + LIB SPJoyTimexRight + + call SPJoyTimexRight + ld l,a + ld h,0 +#endasm +} + +/* + exit: a = FxxxRLDU active low +*/ diff --git a/lib/splib2/cwrapper/sp_JoyTimexRight.o b/lib/splib2/cwrapper/sp_JoyTimexRight.o new file mode 100644 index 00000000..898cf42c Binary files /dev/null and b/lib/splib2/cwrapper/sp_JoyTimexRight.o differ diff --git a/lib/splib2/cwrapper/sp_KeyPressed.c b/lib/splib2/cwrapper/sp_KeyPressed.c new file mode 100644 index 00000000..65680976 --- /dev/null +++ b/lib/splib2/cwrapper/sp_KeyPressed.c @@ -0,0 +1,35 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +int sp_KeyPressed(uint scancode) +{ +#asm + LIB SPKeyPressed + + ld hl,2 + add hl,sp + ld c,(hl) + inc hl + ld b,(hl) + call SPKeyPressed + ld hl,0 + ret nc + inc l +#endasm +} + +/* +; enter : c = scan row +; b = key mask +; exit : carry = key is pressed +*/ diff --git a/lib/splib2/cwrapper/sp_KeyPressed.o b/lib/splib2/cwrapper/sp_KeyPressed.o new file mode 100644 index 00000000..6078325a Binary files /dev/null and b/lib/splib2/cwrapper/sp_KeyPressed.o differ diff --git a/lib/splib2/cwrapper/sp_ListAdd.c b/lib/splib2/cwrapper/sp_ListAdd.c new file mode 100644 index 00000000..5da442b8 --- /dev/null +++ b/lib/splib2/cwrapper/sp_ListAdd.c @@ -0,0 +1,52 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +int sp_ListAdd(struct sp_List *list, void *item) +{ + struct sp_ListNode *node; + + node = u_malloc(sizeof(struct sp_ListNode)); + +#asm + LIB SPListAdd + + pop hl ; hl = node + ld a,h + or l + ret z + ex de,hl + ld hl,2 + add hl,sp + ld c,(hl) + inc hl + ld b,(hl) + inc hl + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + ex de,hl + call SPListAdd + ld hl,1 + ret +#endasm +} + +/* +; enter: de = LIST * +; bc = item * +; hl = address of new sp_ListNode container +; exit : new item inserted after current, current points at new item +*/ + + diff --git a/lib/splib2/cwrapper/sp_ListAdd.o b/lib/splib2/cwrapper/sp_ListAdd.o new file mode 100644 index 00000000..d93d5f5d Binary files /dev/null and b/lib/splib2/cwrapper/sp_ListAdd.o differ diff --git a/lib/splib2/cwrapper/sp_ListAppend.c b/lib/splib2/cwrapper/sp_ListAppend.c new file mode 100644 index 00000000..14eef7e6 --- /dev/null +++ b/lib/splib2/cwrapper/sp_ListAppend.c @@ -0,0 +1,50 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +int sp_ListAppend(struct sp_List *list, void *item) +{ + struct sp_ListNode *node; + + node = u_malloc(sizeof(struct sp_ListNode)); + +#asm + LIB SPListAppend + + pop hl ; hl = node + ld a,h + or l + ret z + ex de,hl + ld hl,2 + add hl,sp + ld c,(hl) + inc hl + ld b,(hl) + inc hl + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + ex de,hl + call SPListAppend + ld hl,1 + ret +#endasm +} + +/* +; enter: de = LIST * +; bc = item * +; hl = address of new sp_ListNode container +; exit : new item appended to end of list, current points at new item +*/ diff --git a/lib/splib2/cwrapper/sp_ListAppend.o b/lib/splib2/cwrapper/sp_ListAppend.o new file mode 100644 index 00000000..3c80aa68 Binary files /dev/null and b/lib/splib2/cwrapper/sp_ListAppend.o differ diff --git a/lib/splib2/cwrapper/sp_ListConcat.c b/lib/splib2/cwrapper/sp_ListConcat.c new file mode 100644 index 00000000..b269836b --- /dev/null +++ b/lib/splib2/cwrapper/sp_ListConcat.c @@ -0,0 +1,37 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_ListConcat(struct sp_List *list1, struct sp_List *list2) +{ +#asm + LIB SPListConcat + + ld hl,2 + add hl,sp + ld e,(hl) + inc hl + ld d,(hl) + inc hl + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + ex de,hl + call SPListConcat +#endasm +} + +/* +; enter: hl = list2, de = list1 +; exit : list1 = list1 concat list2, list2 is deleted +*/ diff --git a/lib/splib2/cwrapper/sp_ListConcat.o b/lib/splib2/cwrapper/sp_ListConcat.o new file mode 100644 index 00000000..ed8e1a84 Binary files /dev/null and b/lib/splib2/cwrapper/sp_ListConcat.o differ diff --git a/lib/splib2/cwrapper/sp_ListCount.c b/lib/splib2/cwrapper/sp_ListCount.c new file mode 100644 index 00000000..68ea328b --- /dev/null +++ b/lib/splib2/cwrapper/sp_ListCount.c @@ -0,0 +1,33 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +uint sp_ListCount(struct sp_List *list) +{ +#asm + LIB SPListCount + + ld hl,2 + add hl,sp + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + call SPListCount + ex de,hl +#endasm +} + +/* +; enter: hl = LIST * +; exit : de = # items in list +*/ diff --git a/lib/splib2/cwrapper/sp_ListCount.o b/lib/splib2/cwrapper/sp_ListCount.o new file mode 100644 index 00000000..83fdc38d Binary files /dev/null and b/lib/splib2/cwrapper/sp_ListCount.o differ diff --git a/lib/splib2/cwrapper/sp_ListCreate.c b/lib/splib2/cwrapper/sp_ListCreate.c new file mode 100644 index 00000000..0612efe3 --- /dev/null +++ b/lib/splib2/cwrapper/sp_ListCreate.c @@ -0,0 +1,36 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +struct sp_List *sp_ListCreate(void) +{ + struct sp_List *ls; + + ls = u_malloc(sizeof(struct sp_List)); + +#asm + LIB SPListCreate + + pop hl ; hl = ls + ld a,h + or l + ret z + ex de,hl + call SPListCreate + ret +#endasm +} + +/* +; enter: de = address of new sp_List container +; exit : hl = LIST* +*/ diff --git a/lib/splib2/cwrapper/sp_ListCreate.o b/lib/splib2/cwrapper/sp_ListCreate.o new file mode 100644 index 00000000..0214b6ee Binary files /dev/null and b/lib/splib2/cwrapper/sp_ListCreate.o differ diff --git a/lib/splib2/cwrapper/sp_ListCurr.c b/lib/splib2/cwrapper/sp_ListCurr.c new file mode 100644 index 00000000..e7b747fc --- /dev/null +++ b/lib/splib2/cwrapper/sp_ListCurr.c @@ -0,0 +1,37 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_ListCurr(struct sp_List *list) +{ +#asm + LIB SPListCurr + + ld hl,2 + add hl,sp + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + call SPListCurr + ccf + ex de,hl + ret nc + ld hl,0 +#endasm +} + +/* +; enter: hl = LIST * +; exit : no carry = list empty or current points outside list +; de = current item in list +*/ diff --git a/lib/splib2/cwrapper/sp_ListCurr.o b/lib/splib2/cwrapper/sp_ListCurr.o new file mode 100644 index 00000000..834a3b28 Binary files /dev/null and b/lib/splib2/cwrapper/sp_ListCurr.o differ diff --git a/lib/splib2/cwrapper/sp_ListFirst.c b/lib/splib2/cwrapper/sp_ListFirst.c new file mode 100644 index 00000000..f2b8be3b --- /dev/null +++ b/lib/splib2/cwrapper/sp_ListFirst.c @@ -0,0 +1,38 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_ListFirst(struct sp_List *list) +{ +#asm + LIB SPListFirst + + ld hl,2 + add hl,sp + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + call SPListFirst + ccf + ex de,hl + ret nc + ld hl,0 +#endasm +} + +/* +; enter: hl = LIST * +; exit : no carry = list empty +; de = item at start of list +; current pointer changed to point at first item in list +*/ diff --git a/lib/splib2/cwrapper/sp_ListFirst.o b/lib/splib2/cwrapper/sp_ListFirst.o new file mode 100644 index 00000000..d4efc7fa Binary files /dev/null and b/lib/splib2/cwrapper/sp_ListFirst.o differ diff --git a/lib/splib2/cwrapper/sp_ListFree.c b/lib/splib2/cwrapper/sp_ListFree.c new file mode 100644 index 00000000..dc05d55e --- /dev/null +++ b/lib/splib2/cwrapper/sp_ListFree.c @@ -0,0 +1,39 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_ListFree(struct sp_List *list, void *freeitem) +{ +#asm + LIB SPListFree + + ld hl,2 + add hl,sp + ld c,(hl) + inc hl + ld b,(hl) + inc hl + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + call SPListFree +#endasm +} + +/* +; enter: hl = LIST * +; bc = itemfree +; exit : The entire list is deleted. +; Itemfree is called once for each item in the list with +; de = item (and item on stack). +*/ diff --git a/lib/splib2/cwrapper/sp_ListFree.o b/lib/splib2/cwrapper/sp_ListFree.o new file mode 100644 index 00000000..eb4860ed Binary files /dev/null and b/lib/splib2/cwrapper/sp_ListFree.o differ diff --git a/lib/splib2/cwrapper/sp_ListInsert.c b/lib/splib2/cwrapper/sp_ListInsert.c new file mode 100644 index 00000000..08dc41da --- /dev/null +++ b/lib/splib2/cwrapper/sp_ListInsert.c @@ -0,0 +1,50 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +int sp_ListInsert(struct sp_List *list, void *item) +{ + struct sp_ListNode *node; + + node = u_malloc(sizeof(struct sp_ListNode)); + +#asm + LIB SPListInsert + + pop hl ; hl = node + ld a,h + or l + ret z + ex de,hl + ld hl,2 + add hl,sp + ld c,(hl) + inc hl + ld b,(hl) + inc hl + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + ex de,hl + call SPListInsert + ld hl,1 + ret +#endasm +} + +/* +; enter: de = LIST * +; bc = item * +; hl = address of new sp_ListNode container +; exit : new item inserted before current, current points at new item +*/ diff --git a/lib/splib2/cwrapper/sp_ListInsert.o b/lib/splib2/cwrapper/sp_ListInsert.o new file mode 100644 index 00000000..cac1e5c5 Binary files /dev/null and b/lib/splib2/cwrapper/sp_ListInsert.o differ diff --git a/lib/splib2/cwrapper/sp_ListLast.c b/lib/splib2/cwrapper/sp_ListLast.c new file mode 100644 index 00000000..bad1da64 --- /dev/null +++ b/lib/splib2/cwrapper/sp_ListLast.c @@ -0,0 +1,38 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_ListLast(struct sp_List *list) +{ +#asm + LIB SPListLast + + ld hl,2 + add hl,sp + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + call SPListLast + ccf + ex de,hl + ret nc + ld hl,0 +#endasm +} + +/* +; enter: hl = LIST * +; exit : no carry = list empty +; de = item at end of list +; current pointer changed to point at last item in list +*/ diff --git a/lib/splib2/cwrapper/sp_ListLast.o b/lib/splib2/cwrapper/sp_ListLast.o new file mode 100644 index 00000000..f90e0b26 Binary files /dev/null and b/lib/splib2/cwrapper/sp_ListLast.o differ diff --git a/lib/splib2/cwrapper/sp_ListNext.c b/lib/splib2/cwrapper/sp_ListNext.c new file mode 100644 index 00000000..57b0edfa --- /dev/null +++ b/lib/splib2/cwrapper/sp_ListNext.c @@ -0,0 +1,38 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_ListNext(struct sp_List *list) +{ +#asm + LIB SPListNext + + ld hl,2 + add hl,sp + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + call SPListNext + ccf + ex de,hl + ret nc + ld hl,0 +#endasm +} + +/* +; enter: hl = LIST * +; exit : no carry = list empty or current pointer is past end of list +; de = next item after current in list +; current pointer changed to point at next item in list +*/ diff --git a/lib/splib2/cwrapper/sp_ListNext.o b/lib/splib2/cwrapper/sp_ListNext.o new file mode 100644 index 00000000..6845e48b Binary files /dev/null and b/lib/splib2/cwrapper/sp_ListNext.o differ diff --git a/lib/splib2/cwrapper/sp_ListPrepend.c b/lib/splib2/cwrapper/sp_ListPrepend.c new file mode 100644 index 00000000..893b83b2 --- /dev/null +++ b/lib/splib2/cwrapper/sp_ListPrepend.c @@ -0,0 +1,50 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +int sp_ListPrepend(struct sp_List *list, void *item) +{ + struct sp_ListNode *node; + + node = u_malloc(sizeof(struct sp_ListNode)); + +#asm + LIB SPListPrepend + + pop hl ; hl = node + ld a,h + or l + ret z + ex de,hl + ld hl,2 + add hl,sp + ld c,(hl) + inc hl + ld b,(hl) + inc hl + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + ex de,hl + call SPListPrepend + ld hl,1 + ret +#endasm +} + +/* +; enter: de = LIST * +; bc = item * +; hl = address of new sp_ListNode container +; exit : new item prepended to start of list, current points at new item +*/ diff --git a/lib/splib2/cwrapper/sp_ListPrepend.o b/lib/splib2/cwrapper/sp_ListPrepend.o new file mode 100644 index 00000000..6a4bd7e4 Binary files /dev/null and b/lib/splib2/cwrapper/sp_ListPrepend.o differ diff --git a/lib/splib2/cwrapper/sp_ListPrev.c b/lib/splib2/cwrapper/sp_ListPrev.c new file mode 100644 index 00000000..bcbdc032 --- /dev/null +++ b/lib/splib2/cwrapper/sp_ListPrev.c @@ -0,0 +1,38 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_ListPrev(struct sp_List *list) +{ +#asm + LIB SPListPrev + + ld hl,2 + add hl,sp + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + call SPListPrev + ccf + ex de,hl + ret nc + ld hl,0 +#endasm +} + +/* +; enter: hl = LIST * +; exit : no carry = list empty or current pointer is before start of list +; de = prev item before current in list +; current pointer changed to point at prev item in list +*/ diff --git a/lib/splib2/cwrapper/sp_ListPrev.o b/lib/splib2/cwrapper/sp_ListPrev.o new file mode 100644 index 00000000..4ef342f7 Binary files /dev/null and b/lib/splib2/cwrapper/sp_ListPrev.o differ diff --git a/lib/splib2/cwrapper/sp_ListRemove.c b/lib/splib2/cwrapper/sp_ListRemove.c new file mode 100644 index 00000000..f97895e7 --- /dev/null +++ b/lib/splib2/cwrapper/sp_ListRemove.c @@ -0,0 +1,36 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_ListRemove(struct sp_List *list) +{ +#asm + LIB SPListRemove + + pop bc + pop hl + push hl + push bc + call SPListRemove + ccf + ex de,hl + ret nc + ld hl,0 +#endasm +} + +/* +; enter: hl = LIST * +; exit : no carry = list empty or current is not INLIST +; de = item removed +; remove current item from list, current moves to next item +*/ diff --git a/lib/splib2/cwrapper/sp_ListRemove.o b/lib/splib2/cwrapper/sp_ListRemove.o new file mode 100644 index 00000000..84cf33e5 Binary files /dev/null and b/lib/splib2/cwrapper/sp_ListRemove.o differ diff --git a/lib/splib2/cwrapper/sp_ListSearch.c b/lib/splib2/cwrapper/sp_ListSearch.c new file mode 100644 index 00000000..73119143 --- /dev/null +++ b/lib/splib2/cwrapper/sp_ListSearch.c @@ -0,0 +1,48 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_ListSearch(struct sp_List *list, void *match, void *item1) +{ +#asm + LIB SPListSearch + + ld hl,2 + add hl,sp + ld e,(hl) + inc hl + ld d,(hl) + inc hl + ld c,(hl) + inc hl + ld b,(hl) + inc hl + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + call SPListSearch + ccf + ex de,hl + ret nc + ld hl,0 +#endasm +} + +/* +; enter: hl = list +; de = item1 +; bc = match +; exit : no carry = item not found, current points past end of list +; de = item found +; current points at found item +*/ diff --git a/lib/splib2/cwrapper/sp_ListSearch.o b/lib/splib2/cwrapper/sp_ListSearch.o new file mode 100644 index 00000000..4df33c10 Binary files /dev/null and b/lib/splib2/cwrapper/sp_ListSearch.o differ diff --git a/lib/splib2/cwrapper/sp_ListTrim.c b/lib/splib2/cwrapper/sp_ListTrim.c new file mode 100644 index 00000000..5af8adf7 --- /dev/null +++ b/lib/splib2/cwrapper/sp_ListTrim.c @@ -0,0 +1,36 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_ListTrim(struct sp_List *list) +{ +#asm + LIB SPListTrim + + pop bc + pop hl + push hl + push bc + call SPListTrim + ccf + ex de,hl + ret nc + ld hl,0 +#endasm +} + +/* +; enter: hl = LIST * +; exit : no carry = list empty +; de = last item in list +; last item removed from list and current points to new last item +*/ diff --git a/lib/splib2/cwrapper/sp_ListTrim.o b/lib/splib2/cwrapper/sp_ListTrim.o new file mode 100644 index 00000000..c43d750f Binary files /dev/null and b/lib/splib2/cwrapper/sp_ListTrim.o differ diff --git a/lib/splib2/cwrapper/sp_LookupKey.c b/lib/splib2/cwrapper/sp_LookupKey.c new file mode 100644 index 00000000..96120e40 --- /dev/null +++ b/lib/splib2/cwrapper/sp_LookupKey.c @@ -0,0 +1,40 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +uint sp_LookupKey(uchar c) /* use "iferror(..)" to see if code not found */ +{ +#asm + LIB SPLookupKey + + ld hl,2 + add hl,sp + ld a,(hl) + call SPLookupKey + jr nc, notfound + ld l,c + ld h,b + or a + ret + +.notfound + scf +#endasm +} + +/* +; enter: a = ascii code +; exit : No carry = ascii code not found +; Else: c = scan row, b = mask +; bit 7 of b set if CAPS needs to be pressed +; bit 6 of b set if SYM SHIFT needs to be pressed +*/ diff --git a/lib/splib2/cwrapper/sp_LookupKey.o b/lib/splib2/cwrapper/sp_LookupKey.o new file mode 100644 index 00000000..3eab5d0a Binary files /dev/null and b/lib/splib2/cwrapper/sp_LookupKey.o differ diff --git a/lib/splib2/cwrapper/sp_MouseAMX.c b/lib/splib2/cwrapper/sp_MouseAMX.c new file mode 100644 index 00000000..ac73d346 --- /dev/null +++ b/lib/splib2/cwrapper/sp_MouseAMX.c @@ -0,0 +1,57 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_MouseAMX(uint *xcoord, uchar *ycoord, uchar *buttons) +{ +#asm + INCLUDE "SPconfig.def" + LIB SPMouseAMX + + ld hl,2 + add hl,sp + push hl + call SPMouseAMX + ld a,e ; a = buttons + ld c,l + ld b,h ; bc = pixel coords, carry=+256 to x coord + pop hl + ld e,(hl) + inc hl + ld d,(hl) + inc hl + ld (de),a + ld e,(hl) + inc hl + ld d,(hl) + inc hl + ld a,b + ld (de),a + ld e,(hl) + inc hl + ld d,(hl) + ld a,c + ld (de),a + inc de + ld a,0 +IF DISP_HIRES + adc a,0 +ENDIF + ld (de),a +#endasm +} + +/* +; exit : a = h = y coord 0..191 +; l = x coord 0.255, hi-res: carry set adds 256 +; e = 1111111L active low button press +*/ diff --git a/lib/splib2/cwrapper/sp_MouseAMX.o b/lib/splib2/cwrapper/sp_MouseAMX.o new file mode 100644 index 00000000..28bee3ab Binary files /dev/null and b/lib/splib2/cwrapper/sp_MouseAMX.o differ diff --git a/lib/splib2/cwrapper/sp_MouseAMXInit.c b/lib/splib2/cwrapper/sp_MouseAMXInit.c new file mode 100644 index 00000000..9bcf0368 --- /dev/null +++ b/lib/splib2/cwrapper/sp_MouseAMXInit.c @@ -0,0 +1,35 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_MouseAMXInit(uchar xvector, uchar yvector) +{ +#asm + LIB SPMouseAMXInit + + ld hl,2 + add hl,sp + ld c,(hl) + inc hl + inc hl + ld b,(hl) + call SPMouseAMXInit +#endasm +} + +/* +; DISABLE INTERRUPTS BEFORE CALLING! +; +; enter: +; b = im 2 vector for X interrupts (even, 0..254) +; c = im 2 vector for Y interrupts (even, 0..254) +*/ diff --git a/lib/splib2/cwrapper/sp_MouseAMXInit.o b/lib/splib2/cwrapper/sp_MouseAMXInit.o new file mode 100644 index 00000000..f79187a6 Binary files /dev/null and b/lib/splib2/cwrapper/sp_MouseAMXInit.o differ diff --git a/lib/splib2/cwrapper/sp_MouseKempston.c b/lib/splib2/cwrapper/sp_MouseKempston.c new file mode 100644 index 00000000..9eeb12b1 --- /dev/null +++ b/lib/splib2/cwrapper/sp_MouseKempston.c @@ -0,0 +1,57 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_MouseKempston(uint *xcoord, uchar *ycoord, uchar *buttons) +{ +#asm + INCLUDE "SPconfig.def" + LIB SPMouseKempston + + ld hl,2 + add hl,sp + push hl + call SPMouseKempston + ld a,e ; a = buttons + ld c,l + ld b,h ; bc = pixel coords, carry=+256 to x coord + pop hl + ld e,(hl) + inc hl + ld d,(hl) + inc hl + ld (de),a + ld e,(hl) + inc hl + ld d,(hl) + inc hl + ld a,b + ld (de),a + ld e,(hl) + inc hl + ld d,(hl) + ld a,c + ld (de),a + inc de + ld a,0 +IF DISP_HIRES + adc a,0 +ENDIF + ld (de),a +#endasm +} + +/* +; exit : a = h = y coord 0..191 +; l = x coord 0.255, hi-res mode: carry set adds 256 +; e = 111111RL active low button press +*/ diff --git a/lib/splib2/cwrapper/sp_MouseKempston.o b/lib/splib2/cwrapper/sp_MouseKempston.o new file mode 100644 index 00000000..267c7447 Binary files /dev/null and b/lib/splib2/cwrapper/sp_MouseKempston.o differ diff --git a/lib/splib2/cwrapper/sp_MouseSim.c b/lib/splib2/cwrapper/sp_MouseSim.c new file mode 100644 index 00000000..af3cab12 --- /dev/null +++ b/lib/splib2/cwrapper/sp_MouseSim.c @@ -0,0 +1,64 @@ + +/* + * Sprite Pack V2.1 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 06.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_MouseSim(struct sp_UDM *m, uint *xcoord, uchar *ycoord, uchar *buttons) +{ +#asm + INCLUDE "SPconfig.def" + LIB SPMouseSim + + ld hl,2 + add hl,sp + push hl + ld hl,10 + add hl,sp + ld a,(hl) + inc hl + ld h,(hl) + ld l,a ; hl = UDM + call SPMouseSim + ld a,e ; a = buttons + ld c,l + ld b,h ; bc = pixel coords, carry=+256 to x coord + pop hl + ld e,(hl) + inc hl + ld d,(hl) + inc hl + ld (de),a + ld e,(hl) + inc hl + ld d,(hl) + inc hl + ld a,b + ld (de),a + ld e,(hl) + inc hl + ld d,(hl) + ld a,c + ld (de),a + inc de + ld a,0 +IF DISP_HIRES + adc a,0 +ENDIF + ld (de),a +#endasm +} + +/* +; enter: hl = address of struct sp_UDM +; exit : a = h = y coord 0..191 +; l = x coord 0.255, hi-res: carry set adds 256 +; e = 1111111L active low button press +*/ diff --git a/lib/splib2/cwrapper/sp_MouseSim.o b/lib/splib2/cwrapper/sp_MouseSim.o new file mode 100644 index 00000000..1b080dfd Binary files /dev/null and b/lib/splib2/cwrapper/sp_MouseSim.o differ diff --git a/lib/splib2/cwrapper/sp_MoveSprAbs.c b/lib/splib2/cwrapper/sp_MoveSprAbs.c new file mode 100644 index 00000000..54d2abe7 --- /dev/null +++ b/lib/splib2/cwrapper/sp_MoveSprAbs.c @@ -0,0 +1,34 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_MoveSprAbs(struct sp_SS *sprite, struct sp_Rect *clip, int animate, uchar row, uchar col, uchar hpix, uchar vpix) +{ +#asm + LIB sp_moveabshelp, SPMoveSprAbs + + call sp_moveabshelp ; parse parameters + call SPMoveSprAbs + pop hl ; deallocate 4-byte clip struct on stack + pop hl ; that was allocated by sp_moveabshelp +#endasm +} + +/* + enter: IX = sprite structure address + BC = animate bitdef displacement (0 for no animation) + H = new row coord in chars + L = new col coord in chars + D = new horizontal rotation (0..7) ie horizontal pixel position + E = new vertical rotation (0..7) ie vertical pixel position + IY = clipping rectangle, set it to "ClipStruct" for full screen +*/ diff --git a/lib/splib2/cwrapper/sp_MoveSprAbs.o b/lib/splib2/cwrapper/sp_MoveSprAbs.o new file mode 100644 index 00000000..3678e588 Binary files /dev/null and b/lib/splib2/cwrapper/sp_MoveSprAbs.o differ diff --git a/lib/splib2/cwrapper/sp_MoveSprAbsC.c b/lib/splib2/cwrapper/sp_MoveSprAbsC.c new file mode 100644 index 00000000..88637021 --- /dev/null +++ b/lib/splib2/cwrapper/sp_MoveSprAbsC.c @@ -0,0 +1,29 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_MoveSprAbsC(struct sp_SS *sprite, struct sp_Rect *clip, int animate, uchar row, uchar col, uchar hpix, uchar vpix) +{ +#asm + LIB sp_moveabshelp, SPMoveSprAbs + XREF SPMoveSprAbsC + + call sp_moveabshelp ; parse parameters + call SPMoveSprAbsC + pop hl ; deallocate 4-byte clip struct on stack + pop hl ; that was allocated by sp_moveabshelp +#endasm +} + +#asm + defw SPMoveSprAbs +#endasm diff --git a/lib/splib2/cwrapper/sp_MoveSprAbsC.o b/lib/splib2/cwrapper/sp_MoveSprAbsC.o new file mode 100644 index 00000000..1a6505cd Binary files /dev/null and b/lib/splib2/cwrapper/sp_MoveSprAbsC.o differ diff --git a/lib/splib2/cwrapper/sp_MoveSprAbsNC.c b/lib/splib2/cwrapper/sp_MoveSprAbsNC.c new file mode 100644 index 00000000..0dcc4fb2 --- /dev/null +++ b/lib/splib2/cwrapper/sp_MoveSprAbsNC.c @@ -0,0 +1,29 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_MoveSprAbsNC(struct sp_SS *sprite, struct sp_Rect *clip, int animate, uchar row, uchar col, uchar hpix, uchar vpix) +{ +#asm + LIB sp_moveabshelp, SPMoveSprAbs + XREF SPMoveSprAbsNC + + call sp_moveabshelp ; parse parameters + call SPMoveSprAbsNC + pop hl ; deallocate 4-byte clip struct on stack + pop hl ; that was allocated by sp_moveabshelp +#endasm +} + +#asm + defw SPMoveSprAbs +#endasm diff --git a/lib/splib2/cwrapper/sp_MoveSprAbsNC.o b/lib/splib2/cwrapper/sp_MoveSprAbsNC.o new file mode 100644 index 00000000..732a3339 Binary files /dev/null and b/lib/splib2/cwrapper/sp_MoveSprAbsNC.o differ diff --git a/lib/splib2/cwrapper/sp_MoveSprAbs_Stub.c b/lib/splib2/cwrapper/sp_MoveSprAbs_Stub.c new file mode 100644 index 00000000..4d61c1e4 --- /dev/null +++ b/lib/splib2/cwrapper/sp_MoveSprAbs_Stub.c @@ -0,0 +1,29 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_MoveSprAbs_Stub(struct sp_SS *sprite, struct sp_Rect *clip, int animate, uchar row, uchar col, uchar hpix, uchar vpix) +{ +#asm + LIB SPMoveSprAbs +#endasm +} + +/* + enter: IX = sprite structure address + BC = animate bitdef displacement (0 for no animation) + H = new row coord in chars + L = new col coord in chars + D = new horizontal rotation (0..7) ie horizontal pixel position + E = new vertical rotation (0..7) ie vertical pixel position + IY = clipping rectangle, set it to "ClipStruct" for full screen +*/ diff --git a/lib/splib2/cwrapper/sp_MoveSprRel.c b/lib/splib2/cwrapper/sp_MoveSprRel.c new file mode 100644 index 00000000..d963c083 --- /dev/null +++ b/lib/splib2/cwrapper/sp_MoveSprRel.c @@ -0,0 +1,34 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_MoveSprRel(struct sp_SS *sprite, struct sp_Rect *clip, int animate, char rel_row, char rel_col, char rel_hpix, char rel_vpix) +{ +#asm + LIB sp_moveabshelp, SPMoveSprRel + + call sp_moveabshelp ; parse parameters -- cheat: same parameter order as MoveSprAbs + call SPMoveSprRel + pop hl ; deallocate 4-byte clip struct on stack + pop hl ; that was allocated by sp_moveabshelp +#endasm +} + +/* + enter: IX = sprite structure address + BC = animate bitdef displacement (0 for no animation) + H = relative row coord in chars (signed byte) + L = relative col coord in chars (signed byte) + D = relative horizontal pixel movement (signed byte) + E = relative vertical pixel movement (signed byte) + IY = clipping rectangle, set it to "ClipStruct" for full screen +*/ diff --git a/lib/splib2/cwrapper/sp_MoveSprRel.o b/lib/splib2/cwrapper/sp_MoveSprRel.o new file mode 100644 index 00000000..ecb21c6a Binary files /dev/null and b/lib/splib2/cwrapper/sp_MoveSprRel.o differ diff --git a/lib/splib2/cwrapper/sp_MoveSprRelC.c b/lib/splib2/cwrapper/sp_MoveSprRelC.c new file mode 100644 index 00000000..6f66ff0b --- /dev/null +++ b/lib/splib2/cwrapper/sp_MoveSprRelC.c @@ -0,0 +1,29 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_MoveSprRelC(struct sp_SS *sprite, struct sp_Rect *clip, int animate, char rel_row, char rel_col, char rel_hpix, char rel_vpix) +{ +#asm + LIB sp_moveabshelp, SPMoveSprRel + XREF SPMoveSprRelC + + call sp_moveabshelp ; parse parameters -- cheat: same parameter types as MoveSprAbs + call SPMoveSprRelC + pop hl ; deallocate 4-byte clip struct on stack + pop hl ; that was allocated by sp_moveabshelp +#endasm +} + +#asm + defw SPMoveSprRel +#endasm diff --git a/lib/splib2/cwrapper/sp_MoveSprRelC.o b/lib/splib2/cwrapper/sp_MoveSprRelC.o new file mode 100644 index 00000000..91d3a001 Binary files /dev/null and b/lib/splib2/cwrapper/sp_MoveSprRelC.o differ diff --git a/lib/splib2/cwrapper/sp_MoveSprRelNC.c b/lib/splib2/cwrapper/sp_MoveSprRelNC.c new file mode 100644 index 00000000..825c35a3 --- /dev/null +++ b/lib/splib2/cwrapper/sp_MoveSprRelNC.c @@ -0,0 +1,29 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_MoveSprRelNC(struct sp_SS *sprite, struct sp_Rect *clip, int animate, char rel_row, char rel_col, char rel_hpix, char rel_vpix) +{ +#asm + LIB sp_moveabshelp, SPMoveSprRel + XREF SPMoveSprRelNC + + call sp_moveabshelp ; parse parameters -- cheat: same parameter types as MoveSprAbs + call SPMoveSprRelNC + pop hl ; deallocate 4-byte clip struct on stack + pop hl ; that was allocated by sp_moveabshelp +#endasm +} + +#asm + defw SPMoveSprRel +#endasm diff --git a/lib/splib2/cwrapper/sp_MoveSprRelNC.o b/lib/splib2/cwrapper/sp_MoveSprRelNC.o new file mode 100644 index 00000000..8838e5c5 Binary files /dev/null and b/lib/splib2/cwrapper/sp_MoveSprRelNC.o differ diff --git a/lib/splib2/cwrapper/sp_PFill.c b/lib/splib2/cwrapper/sp_PFill.c new file mode 100644 index 00000000..01f5e2d3 --- /dev/null +++ b/lib/splib2/cwrapper/sp_PFill.c @@ -0,0 +1,53 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +int sp_PFill(uint xcoord, uchar ycoord, void *pattern, uint stackdepth) +{ +#asm + LIB SPPFill + + ld hl,2 + add hl,sp + ld c,(hl) + inc hl + ld b,(hl) + inc hl + ld e,(hl) + inc hl + ld d,(hl) + inc hl ; bc, de set up + ld a,(hl) ; a = ycoord + inc hl + inc hl + ex af,af + inc hl + ld a,(hl) + rrca + ex af,af ; alternate carry set for top 256 pixels + dec hl + ld l,(hl) ; l = x coord + ld h,a ; h = y coord + call SPPFill + ld hl,1 + ret nc + dec l +#endasm +} + +/* +; enter: h = y coord, l = x coord, bc = max stack depth, de = address of fill pattern +; In hi-res mode, carry flag is most significant bit of x coord +; used : ix, af, bc, de, hl +; exit : no carry = success, carry = had to bail queue was too small +; stack: 3*bc+30 bytes, not including the call to PFILL or interrupts +*/ diff --git a/lib/splib2/cwrapper/sp_PFill.o b/lib/splib2/cwrapper/sp_PFill.o new file mode 100644 index 00000000..2fe3357a Binary files /dev/null and b/lib/splib2/cwrapper/sp_PFill.o differ diff --git a/lib/splib2/cwrapper/sp_Pallette.c b/lib/splib2/cwrapper/sp_Pallette.c new file mode 100644 index 00000000..6bd25c57 --- /dev/null +++ b/lib/splib2/cwrapper/sp_Pallette.c @@ -0,0 +1,35 @@ +/* + * Sprite Pack V2.2 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 06.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_Pallette(uchar c, void *addr) +{ +#asm + LIB SPPallette + + ld hl,2 + add hl,sp + ld e,(hl) + inc hl + ld d,(hl) + inc hl + ld a,(hl) + call SPPallette + ex de,hl +#endasm +} + +/* +; enter : de = address of colour array to associate with pallette entry +; a = pallette entry code +; exit : de = old colour array +*/ + diff --git a/lib/splib2/cwrapper/sp_Pallette.o b/lib/splib2/cwrapper/sp_Pallette.o new file mode 100644 index 00000000..dc323e3d Binary files /dev/null and b/lib/splib2/cwrapper/sp_Pallette.o differ diff --git a/lib/splib2/cwrapper/sp_Pause.c b/lib/splib2/cwrapper/sp_Pause.c new file mode 100644 index 00000000..7997c672 --- /dev/null +++ b/lib/splib2/cwrapper/sp_Pause.c @@ -0,0 +1,33 @@ + +/* + * Sprite Pack V2.2 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 06.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +uint sp_Pause(uint ticks) +{ +#asm + LIB SPPause + + ld hl,2 + add hl,sp + ld c,(hl) + inc hl + ld b,(hl) + call SPPause + ld l,c + ld h,b +#endasm +} + +/* +; enter : bc = ticks +; exit : carry = exited early because of key press, bc=remaining time +*/ diff --git a/lib/splib2/cwrapper/sp_Pause.o b/lib/splib2/cwrapper/sp_Pause.o new file mode 100644 index 00000000..7cc8fc5a Binary files /dev/null and b/lib/splib2/cwrapper/sp_Pause.o differ diff --git a/lib/splib2/cwrapper/sp_PixelDown.c b/lib/splib2/cwrapper/sp_PixelDown.c new file mode 100644 index 00000000..ce3881d1 --- /dev/null +++ b/lib/splib2/cwrapper/sp_PixelDown.c @@ -0,0 +1,35 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_PixelDown(void *scrnaddr) +{ +#asm + LIB SPPixelDown + + ld hl,2 + add hl,sp + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + or a + call SPPixelDown + ccf +#endasm +} + +/* + enter: HL = valid screen address + exit : No Carry = moved off screen + HL = moves one pixel down +*/ diff --git a/lib/splib2/cwrapper/sp_PixelDown.o b/lib/splib2/cwrapper/sp_PixelDown.o new file mode 100644 index 00000000..210d839a Binary files /dev/null and b/lib/splib2/cwrapper/sp_PixelDown.o differ diff --git a/lib/splib2/cwrapper/sp_PixelLeft.c b/lib/splib2/cwrapper/sp_PixelLeft.c new file mode 100644 index 00000000..95742d7f --- /dev/null +++ b/lib/splib2/cwrapper/sp_PixelLeft.c @@ -0,0 +1,45 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 06.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_PixelLeft(void *scrnaddr, uchar *mask) +{ +#asm + LIB SPPixelLeft + + ld hl,2 + add hl,sp + ld e,(hl) + inc hl + ld d,(hl) + inc hl + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + ld a,(de) + ld b,a + push de + call SPPixelLeft + pop de + ld a,b + ld (de),a +#endasm +} + +/* +; enter: HL = valid screen address +; B = pixel mask for screen byte +; exit : Carry = moved off screen +; HL, B moved left one pixel +*/ + diff --git a/lib/splib2/cwrapper/sp_PixelLeft.o b/lib/splib2/cwrapper/sp_PixelLeft.o new file mode 100644 index 00000000..e46a223d Binary files /dev/null and b/lib/splib2/cwrapper/sp_PixelLeft.o differ diff --git a/lib/splib2/cwrapper/sp_PixelRight.c b/lib/splib2/cwrapper/sp_PixelRight.c new file mode 100644 index 00000000..df31df99 --- /dev/null +++ b/lib/splib2/cwrapper/sp_PixelRight.c @@ -0,0 +1,44 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 06.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_PixelRight(void *scrnaddr, uchar *mask) +{ +#asm + LIB SPPixelRight + + ld hl,2 + add hl,sp + ld e,(hl) + inc hl + ld d,(hl) + inc hl + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + ld a,(de) + ld b,a + push de + call SPPixelRight + pop de + ld a,b + ld (de),a +#endasm +} + +/* +; enter: HL = valid screen address +; B = pixel mask for screen byte +; exit : Carry = moved off screen +; HL, B moved right one pixel +*/ diff --git a/lib/splib2/cwrapper/sp_PixelRight.o b/lib/splib2/cwrapper/sp_PixelRight.o new file mode 100644 index 00000000..d8244076 Binary files /dev/null and b/lib/splib2/cwrapper/sp_PixelRight.o differ diff --git a/lib/splib2/cwrapper/sp_PixelUp.c b/lib/splib2/cwrapper/sp_PixelUp.c new file mode 100644 index 00000000..371cbcd1 --- /dev/null +++ b/lib/splib2/cwrapper/sp_PixelUp.c @@ -0,0 +1,33 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_PixelUp(void *scrnaddr) +{ +#asm + LIB SPPixelUp + + ld hl,2 + add hl,sp + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + call SPPixelUp +#endasm +} + +/* + enter: HL = valid screen address + exit : Carry = moved off screen + HL = moves one pixel up +*/ diff --git a/lib/splib2/cwrapper/sp_PixelUp.o b/lib/splib2/cwrapper/sp_PixelUp.o new file mode 100644 index 00000000..28df26d1 Binary files /dev/null and b/lib/splib2/cwrapper/sp_PixelUp.o differ diff --git a/lib/splib2/cwrapper/sp_PrintAt.c b/lib/splib2/cwrapper/sp_PrintAt.c new file mode 100644 index 00000000..17e64136 --- /dev/null +++ b/lib/splib2/cwrapper/sp_PrintAt.c @@ -0,0 +1,40 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_PrintAt(uchar row, uchar col, uchar colour, uchar graphic) +{ +#asm + LIB SPPrintAt + + ld hl,2 + add hl,sp + ld e,(hl) + inc hl + inc hl + ld d,(hl) + inc hl + inc hl + ld c,(hl) + inc hl + inc hl + ld a,(hl) + call SPPrintAt +#endasm +} + +/* + enter: A = row position (0..23) + C = col position (0..31) or (0..63 for sprites-hires) + D = pallette # + E = graphic # +*/ diff --git a/lib/splib2/cwrapper/sp_PrintAt.o b/lib/splib2/cwrapper/sp_PrintAt.o new file mode 100644 index 00000000..ae4a8707 Binary files /dev/null and b/lib/splib2/cwrapper/sp_PrintAt.o differ diff --git a/lib/splib2/cwrapper/sp_PrintAtDiff.c b/lib/splib2/cwrapper/sp_PrintAtDiff.c new file mode 100644 index 00000000..00b53727 --- /dev/null +++ b/lib/splib2/cwrapper/sp_PrintAtDiff.c @@ -0,0 +1,40 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_PrintAtDiff(uchar row, uchar col, uchar colour, uchar graphic) +{ +#asm + LIB SPPrintAtDiff + + ld hl,2 + add hl,sp + ld e,(hl) + inc hl + inc hl + ld d,(hl) + inc hl + inc hl + ld c,(hl) + inc hl + inc hl + ld a,(hl) + call SPPrintAtDiff +#endasm +} + +/* + enter: A = row position (0..23) + C = col position (0..31) or (0..63 for sprites-hires) + D = pallette # + E = graphic # +*/ diff --git a/lib/splib2/cwrapper/sp_PrintAtDiff.o b/lib/splib2/cwrapper/sp_PrintAtDiff.o new file mode 100644 index 00000000..3fd8aed6 Binary files /dev/null and b/lib/splib2/cwrapper/sp_PrintAtDiff.o differ diff --git a/lib/splib2/cwrapper/sp_PrintAtInv.c b/lib/splib2/cwrapper/sp_PrintAtInv.c new file mode 100644 index 00000000..19108e89 --- /dev/null +++ b/lib/splib2/cwrapper/sp_PrintAtInv.c @@ -0,0 +1,40 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_PrintAtInv(uchar row, uchar col, uchar colour, uchar graphic) +{ +#asm + LIB SPPrintAtInv + + ld hl,2 + add hl,sp + ld e,(hl) + inc hl + inc hl + ld d,(hl) + inc hl + inc hl + ld c,(hl) + inc hl + inc hl + ld a,(hl) + call SPPrintAtInv +#endasm +} + +/* + enter: A = row position (0..23) + C = col position (0..31) or (0..63 for sprites-hires) + D = pallette # + E = graphic # +*/ diff --git a/lib/splib2/cwrapper/sp_PrintAtInv.o b/lib/splib2/cwrapper/sp_PrintAtInv.o new file mode 100644 index 00000000..26720391 Binary files /dev/null and b/lib/splib2/cwrapper/sp_PrintAtInv.o differ diff --git a/lib/splib2/cwrapper/sp_PrintString.c b/lib/splib2/cwrapper/sp_PrintString.c new file mode 100644 index 00000000..c7ddbab6 --- /dev/null +++ b/lib/splib2/cwrapper/sp_PrintString.c @@ -0,0 +1,37 @@ + +/* + * Sprite Pack V2.2 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 06.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_PrintString(struct sp_PSS *ps, uchar *s) +{ +#asm + LIB SPPrintString, sp_pssread, sp_psswrite + + ld hl,2 + add hl,sp + ld e,(hl) + inc hl + ld d,(hl) + inc hl + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + push hl + push de + call sp_pssread + pop hl + call SPPrintString + pop hl + call sp_psswrite +#endasm +} diff --git a/lib/splib2/cwrapper/sp_PrintString.o b/lib/splib2/cwrapper/sp_PrintString.o new file mode 100644 index 00000000..d1720ad6 Binary files /dev/null and b/lib/splib2/cwrapper/sp_PrintString.o differ diff --git a/lib/splib2/cwrapper/sp_PutTiles.c b/lib/splib2/cwrapper/sp_PutTiles.c new file mode 100644 index 00000000..b15f8c4c --- /dev/null +++ b/lib/splib2/cwrapper/sp_PutTiles.c @@ -0,0 +1,49 @@ + +/* + * Sprite Pack V2.2 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 07.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_PutTiles(struct sp_Rect *r, void *src) +{ +#asm + LIB SPPutTiles + + ld hl,2 + add hl,sp + ld e,(hl) + inc hl + ld d,(hl) + inc hl + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + ld b,(hl) + inc hl + ld c,(hl) + inc hl + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + ld a,b + ex de,hl + call SPPutTiles +#endasm +} + +/* +; enter : hl = source address (buffer) +; A = row coord of top left corner of rectangle +; C = col coord of top left corner of rectangle +; D = width of rectangle +; E = height of rectangle +*/ diff --git a/lib/splib2/cwrapper/sp_PutTiles.o b/lib/splib2/cwrapper/sp_PutTiles.o new file mode 100644 index 00000000..cc87698e Binary files /dev/null and b/lib/splib2/cwrapper/sp_PutTiles.o differ diff --git a/lib/splib2/cwrapper/sp_Random32.c b/lib/splib2/cwrapper/sp_Random32.c new file mode 100644 index 00000000..55633d51 --- /dev/null +++ b/lib/splib2/cwrapper/sp_Random32.c @@ -0,0 +1,31 @@ + +/* + * Sprite Pack V2.1 + * Alvin Albrecht 03.2003 + */ + +#include "spritepack.h" + +uint sp_Random32(uint *hi) +{ +#asm + LIB SPRandom32 + + ld hl,2 + add hl,sp + ld e,(hl) + inc hl + ld d,(hl) + push de + call SPRandom32 + ex (sp),hl + ld (hl),e + inc hl + ld (hl),d + pop hl +#endasm +} + +/* + after calling : de,hl = 32 bit "random" number. +*/ diff --git a/lib/splib2/cwrapper/sp_Random32.o b/lib/splib2/cwrapper/sp_Random32.o new file mode 100644 index 00000000..b8e72bd4 Binary files /dev/null and b/lib/splib2/cwrapper/sp_Random32.o differ diff --git a/lib/splib2/cwrapper/sp_RegisterHook.c b/lib/splib2/cwrapper/sp_RegisterHook.c new file mode 100644 index 00000000..c899c482 --- /dev/null +++ b/lib/splib2/cwrapper/sp_RegisterHook.c @@ -0,0 +1,19 @@ +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +/* void sp_RegisterHook(uchar vector, void (*hook)(void)) */ +void sp_RegisterHook(uchar vector, void *hook) +{ + sp_RegisterHookLast(vector, hook); +} + +/* THERE MUST BE TWO FREE BYTES PRIOR TO YOUR HOOK !!! */ diff --git a/lib/splib2/cwrapper/sp_RegisterHook.o b/lib/splib2/cwrapper/sp_RegisterHook.o new file mode 100644 index 00000000..8fbeee20 Binary files /dev/null and b/lib/splib2/cwrapper/sp_RegisterHook.o differ diff --git a/lib/splib2/cwrapper/sp_RegisterHookFirst.c b/lib/splib2/cwrapper/sp_RegisterHookFirst.c new file mode 100644 index 00000000..c387638e --- /dev/null +++ b/lib/splib2/cwrapper/sp_RegisterHookFirst.c @@ -0,0 +1,35 @@ +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +/* void sp_RegisterHookFirst(uchar vector, void (*hook)(void)) */ +void sp_RegisterHookFirst(uchar vector, void *hook) +{ +#asm + LIB SPRegisterHookFirst + + ld hl,2 + add hl,sp + ld e,(hl) + inc hl + ld d,(hl) + inc hl + ld l,(hl) + call SPRegisterHookFirst +#endasm +} + +/* THERE MUST BE TWO FREE BYTES PRIOR TO YOUR HOOK !!! */ + +/* +; enter: de = address of hook +; l = interrupt vector +*/ diff --git a/lib/splib2/cwrapper/sp_RegisterHookFirst.o b/lib/splib2/cwrapper/sp_RegisterHookFirst.o new file mode 100644 index 00000000..c35f002d Binary files /dev/null and b/lib/splib2/cwrapper/sp_RegisterHookFirst.o differ diff --git a/lib/splib2/cwrapper/sp_RegisterHookLast.c b/lib/splib2/cwrapper/sp_RegisterHookLast.c new file mode 100644 index 00000000..b6d99669 --- /dev/null +++ b/lib/splib2/cwrapper/sp_RegisterHookLast.c @@ -0,0 +1,36 @@ +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +/* void sp_RegisterHookLast(uchar vector, void (*hook)(void)) */ +void sp_RegisterHookLast(uchar vector, void *hook) +{ +#asm + LIB SPRegisterHookLast + + ld hl,2 + add hl,sp + ld c,(hl) + inc hl + ld b,(hl) + inc hl + ld l,(hl) + call SPRegisterHookLast +#endasm +} + +/* THERE MUST BE TWO FREE BYTES PRIOR TO YOUR HOOK !!! */ + +/* +; enter: bc = address of hook +; l = interrupt vector +*/ + diff --git a/lib/splib2/cwrapper/sp_RegisterHookLast.o b/lib/splib2/cwrapper/sp_RegisterHookLast.o new file mode 100644 index 00000000..67c483ee Binary files /dev/null and b/lib/splib2/cwrapper/sp_RegisterHookLast.o differ diff --git a/lib/splib2/cwrapper/sp_RemoveDList.c b/lib/splib2/cwrapper/sp_RemoveDList.c new file mode 100644 index 00000000..ab1467f5 --- /dev/null +++ b/lib/splib2/cwrapper/sp_RemoveDList.c @@ -0,0 +1,34 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_RemoveDList(struct sp_SS *sprite) +{ +#asm + LIB SPRemoveDList + + ld hl,2 + add hl,sp + ld e,(hl) + inc hl + ld d,(hl) + defb $dd + ld l,e + defb $dd + ld h,d + call SPRemoveDList +#endasm +} + +/* + enter: IX = sprite structure address +*/ diff --git a/lib/splib2/cwrapper/sp_RemoveDList.o b/lib/splib2/cwrapper/sp_RemoveDList.o new file mode 100644 index 00000000..c4e21c18 Binary files /dev/null and b/lib/splib2/cwrapper/sp_RemoveDList.o differ diff --git a/lib/splib2/cwrapper/sp_RemoveHook.c b/lib/splib2/cwrapper/sp_RemoveHook.c new file mode 100644 index 00000000..41ad510d --- /dev/null +++ b/lib/splib2/cwrapper/sp_RemoveHook.c @@ -0,0 +1,38 @@ +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +/* int sp_RemoveHook(uchar vector, void (*hook)(void)) */ +int sp_RemoveHook(uchar vector, void *hook) +{ +#asm + LIB SPRemoveHook + + ld hl,2 + add hl,sp + ld c,(hl) + inc hl + ld b,(hl) + inc hl + ld l,(hl) + call SPRemoveHook + ld hl,1 + ccf + ret nc + dec l +#endasm +} + +/* +; enter: bc = address of hook +; l = interrupt vector +; exit : Carry flag reset if hook not found +*/ diff --git a/lib/splib2/cwrapper/sp_RemoveHook.o b/lib/splib2/cwrapper/sp_RemoveHook.o new file mode 100644 index 00000000..30048caf Binary files /dev/null and b/lib/splib2/cwrapper/sp_RemoveHook.o differ diff --git a/lib/splib2/cwrapper/sp_ScreenStr.c b/lib/splib2/cwrapper/sp_ScreenStr.c new file mode 100644 index 00000000..4d388f0d --- /dev/null +++ b/lib/splib2/cwrapper/sp_ScreenStr.c @@ -0,0 +1,36 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +uint sp_ScreenStr(uchar row, uchar col) +{ +#asm + LIB SPScreenStr + + ld hl,2 + add hl,sp + ld c,(hl) + inc hl + inc hl + ld a,(hl) + call SPScreenStr + ex de,hl +#endasm +} + +/* + enter: A = row position (0..23) + C = col position (0..31) or (0..63 for sprites-hires) + exit : HL = address of (A,L) in display list struct background bitmap LO + D = pallette # + E = graphic # +*/ diff --git a/lib/splib2/cwrapper/sp_ScreenStr.o b/lib/splib2/cwrapper/sp_ScreenStr.o new file mode 100644 index 00000000..a2cc9a6b Binary files /dev/null and b/lib/splib2/cwrapper/sp_ScreenStr.o differ diff --git a/lib/splib2/cwrapper/sp_SetMousePosAMX.c b/lib/splib2/cwrapper/sp_SetMousePosAMX.c new file mode 100644 index 00000000..9d88d093 --- /dev/null +++ b/lib/splib2/cwrapper/sp_SetMousePosAMX.c @@ -0,0 +1,39 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 02.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_SetMousePosAMX(uint xcoord, uchar ycoord) +{ +#asm + INCLUDE "SPconfig.def" + LIB SPSetMousePosAMX + + ld hl,2 + add hl,sp + ld d,(hl) + inc hl + inc hl + ld e,(hl) + inc hl +IF DISP_HIRES + ld a,(hl) + rra +ENDIF + ex de,hl + call SPSetMousePosAMX +#endasm +} + +/* +; enter: h = y coord 0..191 +; l = x coord 0.255, hi-res: carry set adds 256 +*/ diff --git a/lib/splib2/cwrapper/sp_SetMousePosAMX.o b/lib/splib2/cwrapper/sp_SetMousePosAMX.o new file mode 100644 index 00000000..d156c6e1 Binary files /dev/null and b/lib/splib2/cwrapper/sp_SetMousePosAMX.o differ diff --git a/lib/splib2/cwrapper/sp_SetMousePosKempston.c b/lib/splib2/cwrapper/sp_SetMousePosKempston.c new file mode 100644 index 00000000..91bf5844 --- /dev/null +++ b/lib/splib2/cwrapper/sp_SetMousePosKempston.c @@ -0,0 +1,39 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 02.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_SetMousePosKempston(uint xcoord, uchar ycoord) +{ +#asm + INCLUDE "SPconfig.def" + LIB SPSetMousePosKempston + + ld hl,2 + add hl,sp + ld d,(hl) + inc hl + inc hl + ld e,(hl) + inc hl +IF DISP_HIRES + ld a,(hl) + rra +ENDIF + ex de,hl + call SPSetMousePosKempston +#endasm +} + +/* +; enter: h = y coord 0..191 +; l = x coord 0.255, hi-res: carry set adds 256 +*/ diff --git a/lib/splib2/cwrapper/sp_SetMousePosKempston.o b/lib/splib2/cwrapper/sp_SetMousePosKempston.o new file mode 100644 index 00000000..be4735f8 Binary files /dev/null and b/lib/splib2/cwrapper/sp_SetMousePosKempston.o differ diff --git a/lib/splib2/cwrapper/sp_SetMousePosSim.c b/lib/splib2/cwrapper/sp_SetMousePosSim.c new file mode 100644 index 00000000..0b78bad4 --- /dev/null +++ b/lib/splib2/cwrapper/sp_SetMousePosSim.c @@ -0,0 +1,45 @@ + +/* + * Sprite Pack V2.1 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 06.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_SetMousePosSim(struct sp_UDM *m, uint xcoord, uchar ycoord) +{ +#asm + INCLUDE "SPconfig.def" + LIB SPSetMousePosSim + + ld hl,2 + add hl,sp + ld d,(hl) + inc hl + inc hl + ld e,(hl) + inc hl +IF DISP_HIRES + ld a,(hl) + rra +ENDIF + inc hl + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + ex de,hl + call SPSetMousePosSim +#endasm +} + +/* +; enter: h = y coord 0..191 +; l = x coord 0.255, hi-res: carry set adds 256 +; de = struct sp_UDM +*/ diff --git a/lib/splib2/cwrapper/sp_SetMousePosSim.o b/lib/splib2/cwrapper/sp_SetMousePosSim.o new file mode 100644 index 00000000..a8a460b5 Binary files /dev/null and b/lib/splib2/cwrapper/sp_SetMousePosSim.o differ diff --git a/lib/splib2/cwrapper/sp_StackSpace.c b/lib/splib2/cwrapper/sp_StackSpace.c new file mode 100644 index 00000000..b8b847b3 --- /dev/null +++ b/lib/splib2/cwrapper/sp_StackSpace.c @@ -0,0 +1,25 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +int sp_StackSpace(void *addr) +{ +#asm + ld hl,3 + add hl,sp + ld d,(hl) + dec hl + ld e,(hl) + or a + sbc hl,de +#endasm +} diff --git a/lib/splib2/cwrapper/sp_StackSpace.o b/lib/splib2/cwrapper/sp_StackSpace.o new file mode 100644 index 00000000..16636e8a Binary files /dev/null and b/lib/splib2/cwrapper/sp_StackSpace.o differ diff --git a/lib/splib2/cwrapper/sp_Swap.c b/lib/splib2/cwrapper/sp_Swap.c new file mode 100644 index 00000000..d48d215f --- /dev/null +++ b/lib/splib2/cwrapper/sp_Swap.c @@ -0,0 +1,38 @@ + +/* + * Sprite Pack V2.1 + * Alvin Albrecht 03.2003 + */ + +#include "spritepack.h" + +void sp_Swap(void *addr1, void *addr2, uint bytes) +{ +#asm + LIB SPSwap + + ld hl,2 + add hl,sp + ld c,(hl) + inc hl + ld b,(hl) + inc hl + ld e,(hl) + inc hl + ld d,(hl) + inc hl + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + call SPSwap +#endasm +} + +/* +; An overlap-safe swap of two memory blocks. +; +; enter: bc = # bytes to swap +; hl = address of block 1 +; de = address of block 2 +*/ diff --git a/lib/splib2/cwrapper/sp_Swap.o b/lib/splib2/cwrapper/sp_Swap.o new file mode 100644 index 00000000..b01eea97 Binary files /dev/null and b/lib/splib2/cwrapper/sp_Swap.o differ diff --git a/lib/splib2/cwrapper/sp_SwapEndian.c b/lib/splib2/cwrapper/sp_SwapEndian.c new file mode 100644 index 00000000..47269938 --- /dev/null +++ b/lib/splib2/cwrapper/sp_SwapEndian.c @@ -0,0 +1,25 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_SwapEndian(void *ptr) +{ +#asm + ld hl,2 + add hl,sp + ld a,(hl) + inc hl + ld l,(hl) + ld h,a ; reverse endianness +#endasm +} + diff --git a/lib/splib2/cwrapper/sp_SwapEndian.o b/lib/splib2/cwrapper/sp_SwapEndian.o new file mode 100644 index 00000000..42d0caf4 Binary files /dev/null and b/lib/splib2/cwrapper/sp_SwapEndian.o differ diff --git a/lib/splib2/cwrapper/sp_TileArray.c b/lib/splib2/cwrapper/sp_TileArray.c new file mode 100644 index 00000000..91253ec7 --- /dev/null +++ b/lib/splib2/cwrapper/sp_TileArray.c @@ -0,0 +1,34 @@ +/* + * Sprite Pack V2.2 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 06.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_TileArray(uchar c, void *addr) +{ +#asm + LIB SPTileEntry + + ld hl,2 + add hl,sp + ld e,(hl) + inc hl + ld d,(hl) + inc hl + ld a,(hl) + call SPTileEntry + ex de,hl +#endasm +} + +/* +; enter : de = address of graphic to associate with character code +; a = character code +; exit : de = old graphic address +*/ diff --git a/lib/splib2/cwrapper/sp_TileArray.o b/lib/splib2/cwrapper/sp_TileArray.o new file mode 100644 index 00000000..996cc0e5 Binary files /dev/null and b/lib/splib2/cwrapper/sp_TileArray.o differ diff --git a/lib/splib2/cwrapper/sp_UpdateNow.c b/lib/splib2/cwrapper/sp_UpdateNow.c new file mode 100644 index 00000000..b6f70923 --- /dev/null +++ b/lib/splib2/cwrapper/sp_UpdateNow.c @@ -0,0 +1,21 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_UpdateNow(void) +{ +#asm + LIB SPUpdateNow + ld a, 1 + call SPUpdateNow +#endasm +} diff --git a/lib/splib2/cwrapper/sp_UpdateNow.o b/lib/splib2/cwrapper/sp_UpdateNow.o new file mode 100644 index 00000000..154ff7ce Binary files /dev/null and b/lib/splib2/cwrapper/sp_UpdateNow.o differ diff --git a/lib/splib2/cwrapper/sp_UpdateNowEx.c b/lib/splib2/cwrapper/sp_UpdateNowEx.c new file mode 100644 index 00000000..bf15738b --- /dev/null +++ b/lib/splib2/cwrapper/sp_UpdateNowEx.c @@ -0,0 +1,25 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_UpdateNowEx(unsigned char a) +{ +#asm + LIB SPUpdateNow + + ld hl, 2 + add hl, sp + ld a, (hl) + + call SPUpdateNow +#endasm +} diff --git a/lib/splib2/cwrapper/sp_UpdateNowEx.o b/lib/splib2/cwrapper/sp_UpdateNowEx.o new file mode 100644 index 00000000..7f6a3ab2 Binary files /dev/null and b/lib/splib2/cwrapper/sp_UpdateNowEx.o differ diff --git a/lib/splib2/cwrapper/sp_Validate.c b/lib/splib2/cwrapper/sp_Validate.c new file mode 100644 index 00000000..7f386654 --- /dev/null +++ b/lib/splib2/cwrapper/sp_Validate.c @@ -0,0 +1,62 @@ + + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_Validate(struct sp_Rect *area, struct sp_Rect *clip) +{ +#asm + LIB sp_fixcliprect, SPValidate + XREF SPValidateP + + ld hl,2 + add hl,sp + + ld iy,-4 + add iy,sp + ld sp,iy + + ld e,(hl) + inc hl + ld d,(hl) + inc hl + call sp_fixcliprect + + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + ld b,(hl) + inc hl + ld c,(hl) + inc hl + ld d,(hl) + inc hl + ld e,(hl) + + call SPValidateP + pop hl + pop hl +#endasm +} + +#asm + defw SPValidate +#endasm + +/* + enter: B = row coord top left corner + C = col coord top left corner + D = height in chars + E = width in chars + IY = clipping rectangle, set it to "ClipStruct" for full screen +*/ diff --git a/lib/splib2/cwrapper/sp_Validate.o b/lib/splib2/cwrapper/sp_Validate.o new file mode 100644 index 00000000..a8dc30e8 Binary files /dev/null and b/lib/splib2/cwrapper/sp_Validate.o differ diff --git a/lib/splib2/cwrapper/sp_Wait.c b/lib/splib2/cwrapper/sp_Wait.c new file mode 100644 index 00000000..85861b26 --- /dev/null +++ b/lib/splib2/cwrapper/sp_Wait.c @@ -0,0 +1,30 @@ + +/* + * Sprite Pack V2.2 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 06.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_Wait(uint ticks) +{ +#asm + LIB SPWait + + pop hl + pop bc + push bc + push hl + call SPWait +#endasm +} + +/* +; enter : bc = ticks +; used : af, bc +*/ diff --git a/lib/splib2/cwrapper/sp_Wait.o b/lib/splib2/cwrapper/sp_Wait.o new file mode 100644 index 00000000..55d06862 Binary files /dev/null and b/lib/splib2/cwrapper/sp_Wait.o differ diff --git a/lib/splib2/cwrapper/sp_WaitForKey.c b/lib/splib2/cwrapper/sp_WaitForKey.c new file mode 100644 index 00000000..dc08af81 --- /dev/null +++ b/lib/splib2/cwrapper/sp_WaitForKey.c @@ -0,0 +1,21 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_WaitForKey(void) +{ +#asm + LIB SPWaitForKey + + call SPWaitForKey +#endasm +} diff --git a/lib/splib2/cwrapper/sp_WaitForKey.o b/lib/splib2/cwrapper/sp_WaitForKey.o new file mode 100644 index 00000000..97b8567f Binary files /dev/null and b/lib/splib2/cwrapper/sp_WaitForKey.o differ diff --git a/lib/splib2/cwrapper/sp_WaitForNoKey.c b/lib/splib2/cwrapper/sp_WaitForNoKey.c new file mode 100644 index 00000000..f0fb7d65 --- /dev/null +++ b/lib/splib2/cwrapper/sp_WaitForNoKey.c @@ -0,0 +1,21 @@ + +/* + * Sprite Pack V2.0 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 01.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_WaitForNoKey(void) +{ +#asm + LIB SPWaitForNoKey + + call SPWaitForNoKey +#endasm +} diff --git a/lib/splib2/cwrapper/sp_WaitForNoKey.o b/lib/splib2/cwrapper/sp_WaitForNoKey.o new file mode 100644 index 00000000..cf9e5bdb Binary files /dev/null and b/lib/splib2/cwrapper/sp_WaitForNoKey.o differ diff --git a/lib/splib2/cwrapper/sp_c.lst b/lib/splib2/cwrapper/sp_c.lst new file mode 100644 index 00000000..2fd415ec --- /dev/null +++ b/lib/splib2/cwrapper/sp_c.lst @@ -0,0 +1,107 @@ +sp_AddColSpr.c +sp_AddMemory.c +sp_BlockAlloc.c +sp_BlockCount.c +sp_BlockFit.c +sp_Border.c +sp_CharDown.c +sp_CharLeft.c +sp_CharRight.c +sp_CharUp.c +sp_ClearRect.c +sp_CompDirtyAddr.c +sp_CompDListAddr.c +sp_ComputePos.c +sp_CreateSpr.c +sp_CreateGenericISR.c +sp_DeleteSpr.c +sp_EmptyISR.c +sp_FreeBlock.c +sp_GetAttrAddr.c +sp_GetCharAddr.c +sp_GetKey.c +sp_GetScrnAddr.c +sp_GetTiles.c +sp_InitAlloc.c +sp_InitIM2.c +sp_Initialize.c +sp_Inkey.c +sp_inp.c +sp_InstallISR.c +sp_IntIntervals.c +sp_IntLargeRect.c +sp_IntPtInterval.c +sp_IntPtLargeRect.c +sp_IntRect.c +sp_Invalidate.c +sp_IterateDList.c +sp_IterateSprChar.c +sp_JoyFuller.c +sp_JoyKempston.c +sp_JoyKeyboard.c +sp_JoySinclair1.c +sp_JoySinclair2.c +sp_JoyTimexEither.c +sp_JoyTimexLeft.c +sp_JoyTimexRight.c +sp_KeyPressed.c +sp_ListAdd.c +sp_ListAppend.c +sp_ListConcat.c +sp_ListCount.c +sp_ListCreate.c +sp_ListCurr.c +sp_ListFirst.c +sp_ListFree.c +sp_ListInsert.c +sp_ListLast.c +sp_ListNext.c +sp_ListPrepend.c +sp_ListPrev.c +sp_ListRemove.c +sp_ListSearch.c +sp_ListTrim.c +sp_LookupKey.c +sp_MouseAMX.c +sp_MouseAMXInit.c +sp_MouseKempston.c +sp_MouseSim.c +sp_MoveSprAbs.c +sp_MoveSprAbsC.c +sp_MoveSprAbsNC.c +sp_MoveSprRel.c +sp_MoveSprRelC.c +sp_MoveSprRelNC.c +sp_outp.c +sp_Pallette.c +sp_Pause.c +sp_PFill.c +sp_PixelDown.c +sp_PixelUp.c +sp_PixelLeft.c +sp_PixelRight.c +sp_PrintAt.c +sp_PrintAtDiff.c +sp_PrintAtInv.c +sp_PrintString.c +sp_PutTiles.c +sp_Random32.c +sp_RegisterHookFirst.c +sp_RegisterHookLast.c +sp_RegisterHook.c +sp_RemoveDList.c +sp_RemoveHook.c +sp_ScreenStr.c +sp_SetMousePosAMX.c +sp_SetMousePosKempston.c +sp_SetMousePosSim.c +sp_StackSpace.c +sp_Swap.c +sp_SwapEndian.c +sp_TileArray.c +sp_UpdateNow.c +sp_UpdateNowEx.c +sp_Validate.c +sp_Wait.c +sp_WaitForKey.c +sp_WaitForNoKey.c diff --git a/lib/splib2/cwrapper/sp_fixcliprect.asm b/lib/splib2/cwrapper/sp_fixcliprect.asm new file mode 100644 index 00000000..61c4c1e5 --- /dev/null +++ b/lib/splib2/cwrapper/sp_fixcliprect.asm @@ -0,0 +1,30 @@ + +; +; Sprite Pack V2.0 +; +; Spectrum and Timex Computers Game Engine +; Visit http://justme895.tripod.com/main.htm +; +; Alvin Albrecht 01.2003 +; + +XLIB sp_fixcliprect + +; Converts a sp_Rect pointed at by de into a ClipStruct point at by iy, +; the latter is expected by the assembly API. + +.sp_fixcliprect + ld a,(de) + ld (iy+0),a + inc de + ld a,(de) + ld (iy+2),a + inc de + ld a,(de) + add a,(iy+0) + ld (iy+1),a + inc de + ld a,(de) + add a,(iy+2) + ld (iy+3),a + ret diff --git a/lib/splib2/cwrapper/sp_fixcliprect.o b/lib/splib2/cwrapper/sp_fixcliprect.o new file mode 100644 index 00000000..6e3c54ab Binary files /dev/null and b/lib/splib2/cwrapper/sp_fixcliprect.o differ diff --git a/lib/splib2/cwrapper/sp_inp.c b/lib/splib2/cwrapper/sp_inp.c new file mode 100644 index 00000000..7660bfa3 --- /dev/null +++ b/lib/splib2/cwrapper/sp_inp.c @@ -0,0 +1,21 @@ + +/* + * Sprite Pack V2.2 + * Alvin Albrecht 09.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +uchar sp_inp(uint port) +{ +#asm + ld hl,2 + add hl,sp + ld c,(hl) + inc hl + ld b,(hl) + in l,(c) + ld h,0 +#endasm +} diff --git a/lib/splib2/cwrapper/sp_inp.o b/lib/splib2/cwrapper/sp_inp.o new file mode 100644 index 00000000..039b4918 Binary files /dev/null and b/lib/splib2/cwrapper/sp_inp.o differ diff --git a/lib/splib2/cwrapper/sp_moveabshelp.asm b/lib/splib2/cwrapper/sp_moveabshelp.asm new file mode 100644 index 00000000..f4d96bb8 --- /dev/null +++ b/lib/splib2/cwrapper/sp_moveabshelp.asm @@ -0,0 +1,61 @@ + +; +; Sprite Pack V2.0 +; +; Spectrum and Timex Computers Game Engine +; Visit http://justme895.tripod.com/main.htm +; +; Alvin Albrecht 01.2003 +; + +XLIB sp_moveabshelp +LIB sp_fixcliprect + +; Parse this C parameter list for MoveSprAbs functions: +; sp_SS *sprite, sp_Rect *clip, int animate, uchar row, uchar col, uchar hpix, uchar vpix + +.sp_moveabshelp + pop hl ; get return address + ld iy,-4 + add iy,sp + ld sp,iy ; allocate 4 bytes on stack for ClipStruct, pointed at by iy + push hl ; restore return address + + ld hl,21 + add hl,sp ; hl = top of parameter list + + ld d,(hl) + dec hl + ld e,(hl) ; de = sprite + dec hl + defb $dd + ld l,e + defb $dd + ld h,d ; ix = sprite structure + + ld d,(hl) + dec hl + ld e,(hl) ; de = clip + dec hl + call sp_fixcliprect + + ld b,(hl) + dec hl + ld c,(hl) ; bc = animate displacement + dec hl + + dec hl + ld d,(hl) ; d = row coord + dec hl + dec hl + ld e,(hl) ; e = col coord + dec hl + dec hl + ld a,(hl) + dec hl + dec hl + ld l,(hl) ; l = vertical pixel rotation + ld h,a ; h = horizontal pixel rotation + + ex de,hl + ret diff --git a/lib/splib2/cwrapper/sp_moveabshelp.o b/lib/splib2/cwrapper/sp_moveabshelp.o new file mode 100644 index 00000000..fd549e78 Binary files /dev/null and b/lib/splib2/cwrapper/sp_moveabshelp.o differ diff --git a/lib/splib2/cwrapper/sp_outp.c b/lib/splib2/cwrapper/sp_outp.c new file mode 100644 index 00000000..45d66ae3 --- /dev/null +++ b/lib/splib2/cwrapper/sp_outp.c @@ -0,0 +1,24 @@ + +/* + * Sprite Pack V2.2 + * Alvin Albrecht 09.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_outp(uint port, uchar value) +{ +#asm + ld hl,2 + add hl,sp + ld a,(hl) + inc hl + inc hl + ld c,(hl) + inc hl + ld b,(hl) + out (c),a +#endasm +} + diff --git a/lib/splib2/cwrapper/sp_outp.o b/lib/splib2/cwrapper/sp_outp.o new file mode 100644 index 00000000..ce45c561 Binary files /dev/null and b/lib/splib2/cwrapper/sp_outp.o differ diff --git a/lib/splib2/cwrapper/sp_pssread.asm b/lib/splib2/cwrapper/sp_pssread.asm new file mode 100644 index 00000000..e857cfd0 --- /dev/null +++ b/lib/splib2/cwrapper/sp_pssread.asm @@ -0,0 +1,50 @@ + +; +; Sprite Pack V2.2 +; +; Spectrum and Timex Computers Game Engine +; Visit http://justme895.tripod.com/main.htm +; +; Alvin Albrecht 06.2003 +; + +XLIB sp_pssread + +; Set up registers from "struct sp_PSS" pointed at by hl + +.sp_pssread + ld e,(hl) + inc hl + ld d,(hl) + inc hl + defb $fd + ld l,e + defb $fd + ld h,d + ld e,(hl) + inc hl + ld b,(hl) + inc hl + ld c,(hl) + inc hl + push hl + exx + pop hl + ld c,(hl) + inc hl + ld e,(hl) + inc hl + ld d,(hl) + inc hl + ld a,(hl) + inc hl + ex af,af' + ld a,(hl) + inc hl + ld b,(hl) + ld h,a + ex af,af' + ld l,a + ex de,hl + exx + ret diff --git a/lib/splib2/cwrapper/sp_pssread.o b/lib/splib2/cwrapper/sp_pssread.o new file mode 100644 index 00000000..0ddac2de Binary files /dev/null and b/lib/splib2/cwrapper/sp_pssread.o differ diff --git a/lib/splib2/cwrapper/sp_psswrite.asm b/lib/splib2/cwrapper/sp_psswrite.asm new file mode 100644 index 00000000..267ff865 --- /dev/null +++ b/lib/splib2/cwrapper/sp_psswrite.asm @@ -0,0 +1,41 @@ + +; +; Sprite Pack V2.2 +; +; Spectrum and Timex Computers Game Engine +; Visit http://justme895.tripod.com/main.htm +; +; Alvin Albrecht 06.2003 +; + +XLIB sp_psswrite + +; Store registers into "struct sp_PSS" pointed at by hl + +.sp_psswrite + inc hl + inc hl + ld (hl),e + inc hl + ld (hl),b + inc hl + ld (hl),c + inc hl + push hl + exx + ex (sp),hl + ld (hl),c + inc hl + ld a,b + pop bc + ld (hl),c + inc hl + ld (hl),b + inc hl + ld (hl),e + inc hl + ld (hl),d + inc hl + ld (hl),a + exx + ret diff --git a/lib/splib2/cwrapper/sp_psswrite.o b/lib/splib2/cwrapper/sp_psswrite.o new file mode 100644 index 00000000..629fdd55 Binary files /dev/null and b/lib/splib2/cwrapper/sp_psswrite.o differ diff --git a/lib/splib2/displaylist/SPCompDListAddr.asm b/lib/splib2/displaylist/SPCompDListAddr.asm new file mode 100644 index 00000000..f5dba1bf --- /dev/null +++ b/lib/splib2/displaylist/SPCompDListAddr.asm @@ -0,0 +1,36 @@ +; +; CompDListAddr +; Alvin Albrecht 01.2003 +; + +INCLUDE "SPconfig.def" + +XLIB SPCompDListAddr +LIB SPDisplayList + +; Compute display list address corresponding to a specific +; character coordinate. +; +; enter: A = row position (0..23) +; C = col position (0..31/63) +; exit : HL = display list address +; used : f, b, de, hl + +.SPCompDListAddr +IF DISP_HIRES + ld h,SProtatetbl/256 + 4 +ELSE + ld h,SProtatetbl/256 + 6 +ENDIF + ld l,a + ld e,(hl) + inc h + ld l,(hl) + ld h,e ; hl = row*32 or row*64 + ld b,0 + add hl,bc ; hl = row*32 + col + add hl,hl + add hl,hl ; hl = 4*(row*32 + col) + ld de,SPDisplayList + add hl,de + ret diff --git a/lib/splib2/displaylist/SPCompDListAddr.o b/lib/splib2/displaylist/SPCompDListAddr.o new file mode 100644 index 00000000..64781366 Binary files /dev/null and b/lib/splib2/displaylist/SPCompDListAddr.o differ diff --git a/lib/splib2/displaylist/SPCompDirtyAddr.asm b/lib/splib2/displaylist/SPCompDirtyAddr.asm new file mode 100644 index 00000000..8c20534f --- /dev/null +++ b/lib/splib2/displaylist/SPCompDirtyAddr.asm @@ -0,0 +1,37 @@ +; +; CompDirtyAddr +; Alvin Albrecht 01.2003 +; + +INCLUDE "SPconfig.def" + +XLIB SPCompDirtyAddr +LIB SPDirtyChars + +; Compute dirty chars address corresponding to a specific +; character coordinate. +; +; enter: A = row position (0..23) +; C = col position (0..31/63) +; exit : HL = dirty char address +; A = 7 - bit position of char within dirty byte +; used : af, bc, de, hl + +.SPCompDirtyAddr + add a,a + add a,a +IF DISP_HIRES + add a,a +ENDIF + ld l,a + ld h,0 ; hl = row*cols/8 + ld a,c + and $07 ; a = bit position of char within dirty byte + srl c + srl c + srl c + ld b,h + add hl,bc + ld de,SPDirtyChars + add hl,de + ret diff --git a/lib/splib2/displaylist/SPCompDirtyAddr.o b/lib/splib2/displaylist/SPCompDirtyAddr.o new file mode 100644 index 00000000..167ec0b9 Binary files /dev/null and b/lib/splib2/displaylist/SPCompDirtyAddr.o differ diff --git a/lib/splib2/globalvariables/SPAYconst.asm b/lib/splib2/globalvariables/SPAYconst.asm new file mode 100644 index 00000000..f5c1827b --- /dev/null +++ b/lib/splib2/globalvariables/SPAYconst.asm @@ -0,0 +1,10 @@ + +INCLUDE "SPconfig.def" + +XLIB SPAYReg +XDEF SPAYData + +.SPAYReg + defw AYREG_DEFAULT +.SPAYData + defw AYDAT_DEFAULT diff --git a/lib/splib2/globalvariables/SPAYconst.o b/lib/splib2/globalvariables/SPAYconst.o new file mode 100644 index 00000000..4e357e3a Binary files /dev/null and b/lib/splib2/globalvariables/SPAYconst.o differ diff --git a/lib/splib2/globalvariables/SPCClipStruct.asm b/lib/splib2/globalvariables/SPCClipStruct.asm new file mode 100644 index 00000000..736d1407 --- /dev/null +++ b/lib/splib2/globalvariables/SPCClipStruct.asm @@ -0,0 +1,12 @@ + +INCLUDE "SPconfig.def" + +XLIB SPCClipStruct + +.SPCClipStruct + defb 0, 0, SP_ROWEND-SP_ROWSTART +IF DISP_HIRES + defb 64 +ELSE + defb 32 +ENDIF diff --git a/lib/splib2/globalvariables/SPCClipStruct.o b/lib/splib2/globalvariables/SPCClipStruct.o new file mode 100644 index 00000000..fdfb996c Binary files /dev/null and b/lib/splib2/globalvariables/SPCClipStruct.o differ diff --git a/lib/splib2/globalvariables/SPClipStruct.asm b/lib/splib2/globalvariables/SPClipStruct.asm new file mode 100644 index 00000000..ac235199 --- /dev/null +++ b/lib/splib2/globalvariables/SPClipStruct.asm @@ -0,0 +1,11 @@ + +INCLUDE "SPconfig.def" +XLIB SPClipStruct + +.SPClipStruct + defb 0,SP_ROWEND-SP_ROWSTART +IF DISP_HIRES + defb 0,64 +ELSE + defb 0,32 +ENDIF diff --git a/lib/splib2/globalvariables/SPClipStruct.o b/lib/splib2/globalvariables/SPClipStruct.o new file mode 100644 index 00000000..e3f331fa Binary files /dev/null and b/lib/splib2/globalvariables/SPClipStruct.o differ diff --git a/lib/splib2/globalvariables/SPCompNullSprPtr.asm b/lib/splib2/globalvariables/SPCompNullSprPtr.asm new file mode 100644 index 00000000..b5343cef --- /dev/null +++ b/lib/splib2/globalvariables/SPCompNullSprPtr.asm @@ -0,0 +1,13 @@ + +INCLUDE "SPconfig.def" +XLIB SPCompNullSprPtr + +IF DISP_HICOLOUR +.SPCompNullSprPtr + defb $00,$80,$00,$80,$00,$80,$00,$80 + defb $00,$80,$00,$80,$00,$80,$00,$80 +ELSE +.SPCompNullSprPtr + defb $00,$00,$00,$00 + defb $00,$00,$00,$00 +ENDIF diff --git a/lib/splib2/globalvariables/SPCompNullSprPtr.o b/lib/splib2/globalvariables/SPCompNullSprPtr.o new file mode 100644 index 00000000..3af658d1 Binary files /dev/null and b/lib/splib2/globalvariables/SPCompNullSprPtr.o differ diff --git a/lib/splib2/globalvariables/SPDirtyChars.asm b/lib/splib2/globalvariables/SPDirtyChars.asm new file mode 100644 index 00000000..116f2f92 --- /dev/null +++ b/lib/splib2/globalvariables/SPDirtyChars.asm @@ -0,0 +1,15 @@ + +INCLUDE "SPconfig.def" + +XLIB SPDirtyChars + +.SPDirtyChars +IF DISP_HIRES + defs 64/8*(SP_ROWEND-SP_ROWSTART) +ELSE +IF DISP_TMXDUAL + defs 32/8*(SP_ROWEND-SP_ROWSTART)*2 + 256 +ELSE + defs 32/8*(SP_ROWEND-SP_ROWSTART) +ENDIF +ENDIF diff --git a/lib/splib2/globalvariables/SPDirtyChars.o b/lib/splib2/globalvariables/SPDirtyChars.o new file mode 100644 index 00000000..57c99fd7 Binary files /dev/null and b/lib/splib2/globalvariables/SPDirtyChars.o differ diff --git a/lib/splib2/globalvariables/SPDisplayList.asm b/lib/splib2/globalvariables/SPDisplayList.asm new file mode 100644 index 00000000..e439c978 --- /dev/null +++ b/lib/splib2/globalvariables/SPDisplayList.asm @@ -0,0 +1,11 @@ + +INCLUDE "SPconfig.def" + +XLIB SPDisplayList + +.SPDisplayList +IF DISP_HIRES + defs 4*64*(SP_ROWEND-SP_ROWSTART) +ELSE + defs 4*32*(SP_ROWEND-SP_ROWSTART) +ENDIF diff --git a/lib/splib2/globalvariables/SPDisplayList.o b/lib/splib2/globalvariables/SPDisplayList.o new file mode 100644 index 00000000..110fc67c Binary files /dev/null and b/lib/splib2/globalvariables/SPDisplayList.o differ diff --git a/lib/splib2/globalvariables/SPNullSprPtr.asm b/lib/splib2/globalvariables/SPNullSprPtr.asm new file mode 100644 index 00000000..3f54dc68 --- /dev/null +++ b/lib/splib2/globalvariables/SPNullSprPtr.asm @@ -0,0 +1,13 @@ + +INCLUDE "SPconfig.def" +XLIB SPNullSprPtr + +IF DISP_HICOLOUR +.SPNullSprPtr + defb $00,$ff,$80,$00,$ff,$80,$00,$ff,$80,$00,$ff,$80 + defb $00,$ff,$80,$00,$ff,$80,$00,$ff,$80,$00,$ff,$80 +ELSE +.SPNullSprPtr + defb $00,$ff,$00,$ff,$00,$ff,$00,$ff + defb $00,$ff,$00,$ff,$00,$ff,$00,$ff +ENDIF \ No newline at end of file diff --git a/lib/splib2/globalvariables/SPNullSprPtr.o b/lib/splib2/globalvariables/SPNullSprPtr.o new file mode 100644 index 00000000..2eed9a83 Binary files /dev/null and b/lib/splib2/globalvariables/SPNullSprPtr.o differ diff --git a/lib/splib2/globalvariables/SPTileArray.asm b/lib/splib2/globalvariables/SPTileArray.asm new file mode 100644 index 00000000..39399f5a --- /dev/null +++ b/lib/splib2/globalvariables/SPTileArray.asm @@ -0,0 +1,10 @@ + +INCLUDE "SPconfig.def" + +XLIB SPTileArray + +.SPTileArray + defs 512 ; LSB Tile Graphic, MSB Tile Graphic +IF DISP_HICOLOUR + defs 512 ; LSB Tile Pallette, MSB Tile Pallette +ENDIF diff --git a/lib/splib2/globalvariables/SPTileArray.o b/lib/splib2/globalvariables/SPTileArray.o new file mode 100644 index 00000000..8a021bbb Binary files /dev/null and b/lib/splib2/globalvariables/SPTileArray.o differ diff --git a/lib/splib2/globalvariables/SPbit2mask.asm b/lib/splib2/globalvariables/SPbit2mask.asm new file mode 100644 index 00000000..ea421d2b --- /dev/null +++ b/lib/splib2/globalvariables/SPbit2mask.asm @@ -0,0 +1,5 @@ + +XLIB SPbit2mask + +.SPbit2mask + defb $01,$02,$04,$08,$10,$20,$40,$80 diff --git a/lib/splib2/globalvariables/SPbit2mask.o b/lib/splib2/globalvariables/SPbit2mask.o new file mode 100644 index 00000000..7f3f9dc1 Binary files /dev/null and b/lib/splib2/globalvariables/SPbit2mask.o differ diff --git a/lib/splib2/globalvariables/SPbitleft2mask.asm b/lib/splib2/globalvariables/SPbitleft2mask.asm new file mode 100644 index 00000000..3e56a619 --- /dev/null +++ b/lib/splib2/globalvariables/SPbitleft2mask.asm @@ -0,0 +1,5 @@ + +XLIB SPbitleft2mask + +.SPbitleft2mask + defb $ff,$fe,$fc,$f8,$f0,$e0,$c0,$80 diff --git a/lib/splib2/globalvariables/SPbitleft2mask.o b/lib/splib2/globalvariables/SPbitleft2mask.o new file mode 100644 index 00000000..ce42ed45 Binary files /dev/null and b/lib/splib2/globalvariables/SPbitleft2mask.o differ diff --git a/lib/splib2/globalvariables/SPbitright2mask.asm b/lib/splib2/globalvariables/SPbitright2mask.asm new file mode 100644 index 00000000..6df9e61a --- /dev/null +++ b/lib/splib2/globalvariables/SPbitright2mask.asm @@ -0,0 +1,5 @@ + +XLIB SPbitright2mask + +.SPbitright2mask + defb $01,$03,$07,$0f,$1f,$3f,$7f,$ff diff --git a/lib/splib2/globalvariables/SPbitright2mask.o b/lib/splib2/globalvariables/SPbitright2mask.o new file mode 100644 index 00000000..aaa0cb27 Binary files /dev/null and b/lib/splib2/globalvariables/SPbitright2mask.o differ diff --git a/lib/splib2/globalvariables/SPkeytranstbl.asm b/lib/splib2/globalvariables/SPkeytranstbl.asm new file mode 100644 index 00000000..b7038a18 --- /dev/null +++ b/lib/splib2/globalvariables/SPkeytranstbl.asm @@ -0,0 +1,54 @@ +; +; Key Translation table +; Alvin Albrecht 2002 +; + +XLIB SPkeytranstbl + +; This table translates key presses into ascii codes. +; Used by 'GetKey' and 'LookupKey'. An effort has been made for this +; key translation table to emulate a PC keyboard with the 'CTRL' key represented +; by CAPS SHIFT + SYM SHIFT. + +.SPkeytranstbl + defb 255,'z','x','c','v' ; CAPS SHIFT, Z, X, C, V + defb 'a','s','d','f','g' ; A, S, D, F, G + defb 'q','w','e','r','t' ; Q, W, E, R, T + defb '1','2','3','4','5' ; 1, 2, 3, 4, 5 + defb '0','9','8','7','6' ; 0, 9, 8, 7, 6 + defb 'p','o','i','u','y' ; P, O, I, U, Y + defb 13,'l','k','j','h' ; ENTER, L, K, J, H + defb ' ',255,'m','n','b' ; SPACE, SYM SHIFT, M, N, B + + ; the following are CAPS SHIFTed + + defb 255,'Z','X','C','V' ; CAPS SHIFT, Z, X, C, V + defb 'A','S','D','F','G' ; A, S, D, F, G + defb 'Q','W','E','R','T' ; Q, W, E, R, T + defb 7,0,128,129,8 ; 1, 2, 3, 4, 5 + defb 12,8,9,11,10 ; 0, 9, 8, 7, 6 + defb 'P','O','I','U','Y' ; P, O, I, U, Y + defb 13,'L','K','J','H' ; ENTER, L, K, J, H + defb ' ',255,'M','N','B' ; SPACE, SYM SHIFT, M, N, B + + ; the following are SYM SHIFTed + + defb 255,':',96,'?','/' ; CAPS SHIFT, Z, X, C, V + defb '~','|',92,'{','}' ; A, S, D, F, G + defb 131,132,133,'<','>' ; Q, W, E, R, T + defb '!','@','#','$','%' ; 1, 2, 3, 4, 5 + defb '_',')','(',39,'&' ; 0, 9, 8, 7, 6 + defb 34,';',130,']','[' ; P, O, I, U, Y + defb 13,'=','+','-','^' ; ENTER, L, K, J, H + defb ' ',255,'.',',','*' ; SPACE, SYM SHIFT, M, N, B + + ; the following are CAPS SHIFTed and SYM SHIFTed ("CTRL" key) + + defb 255,26,24,3,22 ; CAPS SHIFT, Z, X, C, V + defb 1,19,4,6,7 ; A, S, D, F, G + defb 17,23,5,18,20 ; Q, W, E, R, T + defb 27,28,29,30,31 ; 1, 2, 3, 4, 5 + defb 127,255,134,'`',135 ; 0, 9, 8, 7, 6 + defb 16,15,9,21,25 ; P, O, I, U, Y + defb 13,12,11,10,8 ; ENTER, L, K, J, H + defb ' ',255,13,14,2 ; SPACE, SYM SHIFT, M, N, B diff --git a/lib/splib2/globalvariables/SPkeytranstbl.o b/lib/splib2/globalvariables/SPkeytranstbl.o new file mode 100644 index 00000000..87d34cc8 Binary files /dev/null and b/lib/splib2/globalvariables/SPkeytranstbl.o differ diff --git a/lib/splib2/globalvariables/SPqueuetable.asm b/lib/splib2/globalvariables/SPqueuetable.asm new file mode 100644 index 00000000..37ed239b --- /dev/null +++ b/lib/splib2/globalvariables/SPqueuetable.asm @@ -0,0 +1,20 @@ +; +; Dynamic Block Memory Allocator +; Alvin Albrecht 2002 +; +; Comprised of: +; InitAlloc, AddMemory, BlockFit, BlockAlloc, FreeBlock +; +; Symbol "NUMQUEUES", indicating number of memory queues, +; needs to be defined externally prior to compilation. +; + +INCLUDE "SPconfig.def" +XLIB SPqueuetable + +; Table holds one 2-byte entry per queue. This is a pointer to +; a linked list of available memory queues. It is zero if none +; are available. + +.SPqueuetable + defs NUMQUEUES * 2 diff --git a/lib/splib2/globalvariables/SPqueuetable.o b/lib/splib2/globalvariables/SPqueuetable.o new file mode 100644 index 00000000..198da29e Binary files /dev/null and b/lib/splib2/globalvariables/SPqueuetable.o differ diff --git a/lib/splib2/hashtable/GenCompile.c b/lib/splib2/hashtable/GenCompile.c new file mode 100644 index 00000000..8fcf6b1a --- /dev/null +++ b/lib/splib2/hashtable/GenCompile.c @@ -0,0 +1,37 @@ + +#include +#include +#include + +int main(int argc, char **argv) +{ + char *ptr; + char buff[256]; + char command[512]; + FILE *in; + + if (argc < 3) { + fprintf(stderr, "Usage: %s BaseCommandString FileWithList\n", argv[0]); + exit(1); + } + + if ((in = fopen(argv[2],"r")) == NULL) { + fprintf(stderr, "%s: Couldn't open \"%s\"\n", argv[0], argv[2]); + exit(2); + } + + while (!feof(in)) { + fgets(buff,256,in); + for (ptr=buff; (*ptr!='\0') && (!isspace(*ptr)); ptr++); + *ptr='\0'; + printf("\nFILE = \"%s\"\n\n", buff); + if (*buff != '\0') { + sprintf(command,"%s %s",argv[1],buff); + system(command); + } + } + + fclose(in); + return 0; +} + diff --git a/lib/splib2/hashtable/GenCompile.exe b/lib/splib2/hashtable/GenCompile.exe new file mode 100644 index 00000000..79a7769c Binary files /dev/null and b/lib/splib2/hashtable/GenCompile.exe differ diff --git a/lib/splib2/hashtable/sp_HashAdd.c b/lib/splib2/hashtable/sp_HashAdd.c new file mode 100644 index 00000000..f570d194 --- /dev/null +++ b/lib/splib2/hashtable/sp_HashAdd.c @@ -0,0 +1,39 @@ + +/* + * Sprite Pack V2.1 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 03.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_HashAdd(struct sp_HashTable *ht, void *key, void *value) +{ + uint i; + struct sp_HashCell *hc, *lag, *ls; + + ls = ht->table[i = (ht->hashfunc)(key, ht->size)]; + for (lag = NULL; ls != NULL; lag = ls, ls = ls->next) + if ((ht->match)(key, ls->key)) + break; + + if (ls) { + hc = ls->value; + ls->value = value; + return_nc hc; + } + + if ((hc = u_malloc(sizeof(struct sp_HashCell))) == NULL) + return_c NULL; + + hc->key = key; + hc->value = value; + hc->next = ht->table[i]; + ht->table[i] = hc; + + return_nc NULL; +} diff --git a/lib/splib2/hashtable/sp_HashCreate.c b/lib/splib2/hashtable/sp_HashCreate.c new file mode 100644 index 00000000..ce5ab6ed --- /dev/null +++ b/lib/splib2/hashtable/sp_HashCreate.c @@ -0,0 +1,36 @@ + +/* + * Sprite Pack V2.1 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 03.2003 + */ + +#define _SPLIB +#include +#include +#define NOREDEF +#include "spritepack.h" + +struct sp_HashTable *sp_HashCreate(uint size, void *hashfunc, void *match, void *delete) +{ + struct sp_HashTable *ht; + + if ((ht = u_malloc(sizeof(struct sp_HashTable))) == NULL) + return NULL; + + if ((ht->table = u_malloc(size*sizeof(struct sp_HashCell *))) == NULL) { + u_free(ht); + return NULL; + } + + memset(ht->table, 0, size*sizeof(struct sp_HashCell *)); + ht->size = size; + ht->hashfunc = hashfunc; + ht->match = match; + ht->delete = delete; + + return ht; +} diff --git a/lib/splib2/hashtable/sp_HashDelete.c b/lib/splib2/hashtable/sp_HashDelete.c new file mode 100644 index 00000000..0b58ba02 --- /dev/null +++ b/lib/splib2/hashtable/sp_HashDelete.c @@ -0,0 +1,29 @@ + +/* + * Sprite Pack V2.1 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 03.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void sp_HashDelete(struct sp_HashTable *ht) +{ + uint i; + struct sp_HashCell *temp, *ls; + + for (i=0; i != ht->size; i++) { + for (ls = ht->table[i]; ls != NULL; ls = temp) { + temp = ls->next; + (ht->delete)(ls); + u_free(ls); + } + } + + u_free(ht->table); + u_free(ht); +} diff --git a/lib/splib2/hashtable/sp_HashLookup.c b/lib/splib2/hashtable/sp_HashLookup.c new file mode 100644 index 00000000..ec394355 --- /dev/null +++ b/lib/splib2/hashtable/sp_HashLookup.c @@ -0,0 +1,23 @@ + +/* + * Sprite Pack V2.1 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 03.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +void *sp_HashLookup(struct sp_HashTable *ht, void *key) +{ + struct sp_HashCell *ls; + + for (ls = ht->table[(ht->hashfunc)(key, ht->size)]; ls != NULL; ls = ls->next) + if ((ht->match)(key, ls->key)) + return ls->value; + + return NULL; +} diff --git a/lib/splib2/hashtable/sp_HashRemove.c b/lib/splib2/hashtable/sp_HashRemove.c new file mode 100644 index 00000000..44bf04db --- /dev/null +++ b/lib/splib2/hashtable/sp_HashRemove.c @@ -0,0 +1,33 @@ + +/* + * Sprite Pack V2.1 + * + * Spectrum and Timex Computers Game Engine + * Visit http://justme895.tripod.com/main.htm + * + * Alvin Albrecht 03.2003 + */ + +#define _SPLIB +#include "spritepack.h" + +struct sp_HashCell *sp_HashRemove(struct sp_HashTable *ht, void *key) +{ + int i; + struct sp_HashCell *lag; + struct sp_HashCell *ls; + + ls = ht->table[i = (ht->hashfunc)(key, ht->size)]; + for (lag = NULL; ls != NULL; lag = ls, ls = ls->next) + if ((ht->match)(key, ls->key)) + break; + + if (ls) { + if (lag) + lag->next = ls->next; + else + ht->table[i] = ls->next; + } + + return ls; +} diff --git a/lib/splib2/hashtable/sp_c.lst b/lib/splib2/hashtable/sp_c.lst new file mode 100644 index 00000000..b77e24cf --- /dev/null +++ b/lib/splib2/hashtable/sp_c.lst @@ -0,0 +1,5 @@ +sp_HashAdd.c +sp_HashCreate.c +sp_HashDelete.c +sp_HashLookup.c +sp_HashRemove.c diff --git a/lib/splib2/hashtable/zcc_opt.def b/lib/splib2/hashtable/zcc_opt.def new file mode 100644 index 00000000..e69de29b diff --git a/lib/splib2/heap/GenCompile.c b/lib/splib2/heap/GenCompile.c new file mode 100644 index 00000000..8fcf6b1a --- /dev/null +++ b/lib/splib2/heap/GenCompile.c @@ -0,0 +1,37 @@ + +#include +#include +#include + +int main(int argc, char **argv) +{ + char *ptr; + char buff[256]; + char command[512]; + FILE *in; + + if (argc < 3) { + fprintf(stderr, "Usage: %s BaseCommandString FileWithList\n", argv[0]); + exit(1); + } + + if ((in = fopen(argv[2],"r")) == NULL) { + fprintf(stderr, "%s: Couldn't open \"%s\"\n", argv[0], argv[2]); + exit(2); + } + + while (!feof(in)) { + fgets(buff,256,in); + for (ptr=buff; (*ptr!='\0') && (!isspace(*ptr)); ptr++); + *ptr='\0'; + printf("\nFILE = \"%s\"\n\n", buff); + if (*buff != '\0') { + sprintf(command,"%s %s",argv[1],buff); + system(command); + } + } + + fclose(in); + return 0; +} + diff --git a/lib/splib2/heap/GenCompile.exe b/lib/splib2/heap/GenCompile.exe new file mode 100644 index 00000000..79a7769c Binary files /dev/null and b/lib/splib2/heap/GenCompile.exe differ diff --git a/lib/splib2/heap/sp_HeapAdd.c b/lib/splib2/heap/sp_HeapAdd.c new file mode 100644 index 00000000..625d33d3 --- /dev/null +++ b/lib/splib2/heap/sp_HeapAdd.c @@ -0,0 +1,13 @@ + +/* + * Sprite Pack V2.1 + * Alvin Albrecht 03.2003 + */ + +#include "spritepack.h" + +void sp_HeapAdd(void *item, void **array, uint n, void *compare) +{ + array[n+1] = item; + sp_HeapSiftUp(n+1, array, compare); +} diff --git a/lib/splib2/heap/sp_HeapAdd.err b/lib/splib2/heap/sp_HeapAdd.err new file mode 100644 index 00000000..b8e15109 --- /dev/null +++ b/lib/splib2/heap/sp_HeapAdd.err @@ -0,0 +1 @@ +Error: object file 'heap/sp_HeapAdd.o' version 1, expected version 14 diff --git a/lib/splib2/heap/sp_HeapExtract.c b/lib/splib2/heap/sp_HeapExtract.c new file mode 100644 index 00000000..a7ef0b9c --- /dev/null +++ b/lib/splib2/heap/sp_HeapExtract.c @@ -0,0 +1,13 @@ + +/* + * Sprite Pack V2.1 + * Alvin Albrecht 03.2003 + */ + +#include "spritepack.h" + +void sp_HeapExtract(void **array, uint n, void *compare) +{ + sp_Swap(array+1, array+n, sizeof(void *)); + sp_HeapSiftDown(1, array, n-1, compare); +} diff --git a/lib/splib2/heap/sp_HeapExtract.err b/lib/splib2/heap/sp_HeapExtract.err new file mode 100644 index 00000000..81ac45ed --- /dev/null +++ b/lib/splib2/heap/sp_HeapExtract.err @@ -0,0 +1 @@ +Error: object file 'heap/sp_HeapExtract.o' version 1, expected version 14 diff --git a/lib/splib2/heap/sp_HeapSiftDown.c b/lib/splib2/heap/sp_HeapSiftDown.c new file mode 100644 index 00000000..9f05cd71 --- /dev/null +++ b/lib/splib2/heap/sp_HeapSiftDown.c @@ -0,0 +1,22 @@ + +/* + * Sprite Pack V2.1 + * Alvin Albrecht 03.2003 + */ + +#include "spritepack.h" + +void sp_HeapSiftDown(uint start, void **array, uint n, void *compare) +{ + uint c; + + for (c = start*2; c < n; start = c, c = c*2) { + if ((c+1 <= n) && (compare(array[c+1], array[c]))) + c++; + if (compare(array[start], array[c])) + return; + sp_Swap(array+start, array+c, sizeof(void *)); + } + if ((c == n) && (compare(array[c], array[start]))) + sp_Swap(array+start, array+c, sizeof(void *)); +} diff --git a/lib/splib2/heap/sp_HeapSiftDown.err b/lib/splib2/heap/sp_HeapSiftDown.err new file mode 100644 index 00000000..8ff56cc3 --- /dev/null +++ b/lib/splib2/heap/sp_HeapSiftDown.err @@ -0,0 +1 @@ +Error: object file 'heap/sp_HeapSiftDown.o' version 1, expected version 14 diff --git a/lib/splib2/heap/sp_HeapSiftUp.c b/lib/splib2/heap/sp_HeapSiftUp.c new file mode 100644 index 00000000..9b9726dd --- /dev/null +++ b/lib/splib2/heap/sp_HeapSiftUp.c @@ -0,0 +1,84 @@ + +/* + * Sprite Pack V2.1 + * Alvin Albrecht 03.2003 + */ + +#include "spritepack.h" + +void sp_HeapSiftUp(uint start, void **array, void *compare) +{ + uint p; + + while ((start!=1) && (compare(array[start], array[p=start/2]))) { + sp_Swap(array+start, array+p, sizeof(void *)); + start = p; + } +} + +/* + +If I decide to move to assembler... + +; Siftup on Heap +; Alvin Albrecht 03.2003 +; +; +; The heap is an array of pointers 'void *array[N]' and is indexed by 1..N. +; 'array[0]' is unused. +; +; enter: bc = start index * 2 (the offset on array) +; de = array +; ix = address of compare function +; +; uses : af, bc, hl + +XLIB SPHeapSiftUp +LIB SPSwap + +.SPHeapSiftUp + ld a,c + and $fc + or b + ret z ; if start<=2 we've reached root so return + + push ix ; save compare + push bc ; save index + push de ; save array + ld l,c + ld h,b + add hl,de + ex de,hl ; hl = index, de = &array[index] + srl h + rr l + add hl,bc ; hl = &array[parent(index)] + + push hl + push de + push hl + push de + call JPIX ; compare(&array[parent(index)], &array[index]) + pop de + pop hl + pop de ; de = &array[index] + pop hl ; hl = &array[parent] + jr nc, done ; if no swap required we're done + + ld bc,2 + call SPSwap + pop de + pop bc + pop ix + srl b ; move up to parent + rr c + jp SPHeapSiftUp + +.done + pop de + pop bc + pop ix + ret + +.JPIX + jp (ix) +*/ diff --git a/lib/splib2/heap/sp_HeapSiftUp.err b/lib/splib2/heap/sp_HeapSiftUp.err new file mode 100644 index 00000000..44f1f1f0 --- /dev/null +++ b/lib/splib2/heap/sp_HeapSiftUp.err @@ -0,0 +1 @@ +Error: object file 'heap/sp_HeapSiftUp.o' version 1, expected version 14 diff --git a/lib/splib2/heap/sp_Heapify.c b/lib/splib2/heap/sp_Heapify.c new file mode 100644 index 00000000..a3bfc6fb --- /dev/null +++ b/lib/splib2/heap/sp_Heapify.c @@ -0,0 +1,17 @@ + +/* + * Sprite Pack V2.1 + * Alvin Albrecht 03.2003 + */ + +#include "spritepack.h" + +/* orders an unsorted array into a heap by building the heap from the bottom up */ + +void sp_Heapify(void **array, uint n, void *compare) +{ + uint i; + + for (i=n/2; i!=0; i--) + sp_HeapSiftDown(i, array, n, compare); +} diff --git a/lib/splib2/heap/sp_Heapify.err b/lib/splib2/heap/sp_Heapify.err new file mode 100644 index 00000000..ddbd8d0e --- /dev/null +++ b/lib/splib2/heap/sp_Heapify.err @@ -0,0 +1 @@ +Error: object file 'heap/sp_Heapify.o' version 1, expected version 14 diff --git a/lib/splib2/heap/sp_c.lst b/lib/splib2/heap/sp_c.lst new file mode 100644 index 00000000..9dd2ffb7 --- /dev/null +++ b/lib/splib2/heap/sp_c.lst @@ -0,0 +1,5 @@ +sp_HeapAdd.c +sp_HeapExtract.c +sp_Heapify.c +sp_HeapSiftDown.c +sp_HeapSiftUp.c diff --git a/lib/splib2/heap/zcc_opt.def b/lib/splib2/heap/zcc_opt.def new file mode 100644 index 00000000..e69de29b diff --git a/lib/splib2/huffman/GenCompile.c b/lib/splib2/huffman/GenCompile.c new file mode 100644 index 00000000..8fcf6b1a --- /dev/null +++ b/lib/splib2/huffman/GenCompile.c @@ -0,0 +1,37 @@ + +#include +#include +#include + +int main(int argc, char **argv) +{ + char *ptr; + char buff[256]; + char command[512]; + FILE *in; + + if (argc < 3) { + fprintf(stderr, "Usage: %s BaseCommandString FileWithList\n", argv[0]); + exit(1); + } + + if ((in = fopen(argv[2],"r")) == NULL) { + fprintf(stderr, "%s: Couldn't open \"%s\"\n", argv[0], argv[2]); + exit(2); + } + + while (!feof(in)) { + fgets(buff,256,in); + for (ptr=buff; (*ptr!='\0') && (!isspace(*ptr)); ptr++); + *ptr='\0'; + printf("\nFILE = \"%s\"\n\n", buff); + if (*buff != '\0') { + sprintf(command,"%s %s",argv[1],buff); + system(command); + } + } + + fclose(in); + return 0; +} + diff --git a/lib/splib2/huffman/GenCompile.exe b/lib/splib2/huffman/GenCompile.exe new file mode 100644 index 00000000..79a7769c Binary files /dev/null and b/lib/splib2/huffman/GenCompile.exe differ diff --git a/lib/splib2/huffman/SPHuffDecode.asm b/lib/splib2/huffman/SPHuffDecode.asm new file mode 100644 index 00000000..81a71a04 --- /dev/null +++ b/lib/splib2/huffman/SPHuffDecode.asm @@ -0,0 +1,49 @@ +; +; Static Huffman Decoder +; Alvin Albrecht 03.2003 +; + +XLIB SPHuffDecode + +; enter: hl = root of decoder tree +; de = memory address of encoded message +; c = next bit in de's byte to interpret (bit mask) +; exit : a = next decoded symbol +; de and c are updated for decoding the next symbol +; uses : af, c, de, hl + +.nextcodebit + srl c ; move mask right one bit + jp nc, SPHuffDecode + inc de ; move on to next byte + ld c,$80 + +.SPHuffDecode + inc hl + inc hl + inc hl ; hl = root.left+1 + ld a,(hl) ; if msb of left pointer = 0 then this is a leaf + or a + jp nz, notleaf + dec hl ; a leaf, decoded symbol is stored at root.left + ld a,(hl) + ret ; return with a = decoded symbol, de = next address, c = next bit + +.notleaf + ld a,(de) ; get current byte + and c ; mask off bit + jr z, goleft ; if code bit is 0, move left along tree + + inc hl + ld a,(hl) + inc hl + ld h,(hl) + ld l,a ; hl = root.right + jp nextcodebit + +.goleft + ld a,(hl) + dec hl + ld l,(hl) + ld h,a ; hl = root.left + jp nextcodebit diff --git a/lib/splib2/huffman/SPHuffEncode.asm b/lib/splib2/huffman/SPHuffEncode.asm new file mode 100644 index 00000000..0de37e95 --- /dev/null +++ b/lib/splib2/huffman/SPHuffEncode.asm @@ -0,0 +1,79 @@ +; +; Static Huffman Encoder +; Alvin Albrecht 03.2003 +; + +XLIB SPHuffEncode + +; enter: hl = addr of encoder array (array indexed by symbols pointing at decoder tree leaves) +; c = symbol to encode +; de = memory address to write encoded symbol to +; a = next bit in de to write to (bit mask) +; exit : hl = memory address to write next encoded symbol to +; c = next bit in hl to write to (bit mask) +; uses : af, bc, de, hl, b', de', hl' + +.SPHuffEncode + ld b,0 + add hl,bc + add hl,bc ; hl = &encoder[c] contains pointer to symbol's leaf node + ld c,a ; c = next memory bit to write to + ld a,(hl) + inc hl + ld h,(hl) + ld l,a ; hl = decoder tree leaf for symbol + push hl + exx + pop hl ; hl = decoder tree leaf for symbol + ld b,0 ; b = # of encoded bits on stack + +.encode + ld e,(hl) + inc hl + ld a,(hl) + or a + jp nz, notdone ; if parent of this node is NULL (msb), done encoding! + ld a,b ; a = # of encoded bits on stack + exx + ex de,hl ; hl = memory address to write symbol to + or a + ret z ; if no encoded bits, return done + + ld b,a +.writeloop + pop af + ld a,c + jr nz, encoderight + cpl ; encode a left movement in tree by writing a 0 bit + and (hl) + ld (hl),a + jp cont +.encoderight + or (hl) ; encode a right movement in tree by writing a 1 bit + ld (hl),a +.cont + srl c ; move to next bit in memory + jp nc, cont2 ; if byte still not filled + inc hl ; move on to next memory byte + ld c,$80 ; start with first bit in byte +.cont2 + djnz writeloop + ret + +.notdone + ld d,a ; de = parent node + inc de + inc de ; de = parent.left + dec hl ; hl = child + ld a,(de) ; find out if hl is a left child or right child + cp l + inc de ; de = parent.left+1 + jr nz, foundchild + ld a,(de) + cp h +.foundchild + push af ; save: nz = right child, z = left child + inc b ; one more encoded bit on stack + ld hl,-3 + add hl,de ; hl = parent + jp encode ; on to the next encoded bit diff --git a/lib/splib2/huffman/sp_HuffAccumulate.c b/lib/splib2/huffman/sp_HuffAccumulate.c new file mode 100644 index 00000000..3d3b1294 --- /dev/null +++ b/lib/splib2/huffman/sp_HuffAccumulate.c @@ -0,0 +1,11 @@ +/* + * Sprite Pack V2.1 + * Alvin Albrecht 03.2003 + */ + +#include "spritepack.h" + +void sp_HuffAccumulate(struct sp_HuffmanCodec *hc, uchar c) +{ + (hc->u.heap[c])->u.freq++; +} diff --git a/lib/splib2/huffman/sp_HuffCreate.c b/lib/splib2/huffman/sp_HuffCreate.c new file mode 100644 index 00000000..07442202 --- /dev/null +++ b/lib/splib2/huffman/sp_HuffCreate.c @@ -0,0 +1,40 @@ +/* + * Sprite Pack V2.1 + * Alvin Albrecht 03.2003 + */ + +#include +#define NOREDEF +#include "spritepack.h" + +struct sp_HuffmanCodec *sp_HuffCreate(uint symbols) +{ + struct sp_HuffmanCodec *hc; + struct sp_HuffmanLeaf *hl; + struct sp_HuffmanLeaf **heap; + uint i; + + if ((hc = u_malloc(sizeof(struct sp_HuffmanCodec))) == NULL) + return NULL; + memset(hc, 0, sizeof(struct sp_HuffmanCodec)); + + hc->symbols = i = symbols; + if ((hc->u.heap = heap = u_malloc(i*sizeof(struct sp_HuffmanLeaf *))) == NULL) { + u_free(hc); + return NULL; + } + + while (i != 0) { + if ((heap[--i] = hl = u_malloc(sizeof(struct sp_HuffmanLeaf))) == NULL) { + while (++i != symbols) + u_free(heap[i-1]); + u_free(heap); + u_free(hc); + return NULL; + } + hl->u.freq = 0; + hl->c = i; + } + + return hc; +} diff --git a/lib/splib2/huffman/sp_HuffDecode.c b/lib/splib2/huffman/sp_HuffDecode.c new file mode 100644 index 00000000..562b34db --- /dev/null +++ b/lib/splib2/huffman/sp_HuffDecode.c @@ -0,0 +1,50 @@ +/* + * Sprite Pack V2.1 + * Alvin Albrecht 03.2003 + */ + +#include "spritepack.h" + +uchar sp_HuffDecode(struct sp_HuffmanCodec *hc) +{ +#asm + LIB SPHuffDecode + + ld hl,2 + add hl,sp + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + inc hl + inc hl + push hl + ld e,(hl) + inc hl + ld d,(hl) + inc hl + ld c,(hl) + inc hl + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + call SPHuffDecode + pop hl + ld (hl),e + inc hl + ld (hl),d + inc hl + ld (hl),c + ld l,a + ld h,0 +#endasm +} + +/* +; enter: hl = root of decoder tree +; de = memory address of encoded message +; c = next bit in de's byte to interpret (bit mask) +; exit : a = next decoded symbol +; de and c are updated for decoding the next symbol +*/ diff --git a/lib/splib2/huffman/sp_HuffDelete.c b/lib/splib2/huffman/sp_HuffDelete.c new file mode 100644 index 00000000..faf8c812 --- /dev/null +++ b/lib/splib2/huffman/sp_HuffDelete.c @@ -0,0 +1,33 @@ +/* + * Sprite Pack V2.1 + * Alvin Albrecht 03.2003 + */ + +#include "spritepack.h" + +void traverseTree(struct sp_HuffmanJoin *hj) +{ + if (hj->left < 256) { + u_free(hj); + return; + } + traverseTree(hj->left); + traverseTree(hj->right); + u_free(hj); +} + +void sp_HuffDelete(struct sp_HuffmanCodec *hc) +{ + uint i; + + if (hc->root) { + traverseTree(hc->root); + u_free(hc->u.encoder); + } else { + for (i=hc->symbols; i!=0; i--) + traverseTree(hc->u.encoder[i-1]); + u_free(hc->u.encoder); + } + + u_free(hc); +} diff --git a/lib/splib2/huffman/sp_HuffEncode.c b/lib/splib2/huffman/sp_HuffEncode.c new file mode 100644 index 00000000..c1caca66 --- /dev/null +++ b/lib/splib2/huffman/sp_HuffEncode.c @@ -0,0 +1,55 @@ +/* + * Sprite Pack V2.1 + * Alvin Albrecht 03.2003 + */ + +#include "spritepack.h" + +void sp_HuffEncode(struct sp_HuffmanCodec *hc, uchar c) +{ +#asm + LIB SPHuffEncode + + ld hl,2 + add hl,sp + ld c,(hl) + inc hl + inc hl + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + inc hl + inc hl + push hl + ld e,(hl) + inc hl + ld d,(hl) + inc hl + ld a,(hl) + inc hl + inc hl + inc hl + ld b,(hl) + inc hl + ld h,(hl) + ld l,b + call SPHuffEncode + pop de + ex de,hl + ld (hl),e + inc hl + ld (hl),d + inc hl + ld (hl),c +#endasm +} + +/* +; enter: hl = addr of encoder array (array indexed by symbols pointing at decoder tree leaves) +; c = symbol to encode +; de = memory address to write encoded symbol to +; a = next bit in de to write to (bit mask) +; exit : hl = memory address to write next encoded symbol to +; c = next bit in hl to write to (bit mask) +*/ diff --git a/lib/splib2/huffman/sp_HuffExtract.c b/lib/splib2/huffman/sp_HuffExtract.c new file mode 100644 index 00000000..bba82c28 --- /dev/null +++ b/lib/splib2/huffman/sp_HuffExtract.c @@ -0,0 +1,59 @@ +/* + * Sprite Pack V2.1 + * Alvin Albrecht 03.2003 + */ + +#include "spritepack.h" + +int compare(struct sp_HuffmanLeaf *h1, struct sp_HuffmanLeaf *h2) +{ + if (h1->u.freq < h2->u.freq) + return_c(1); + return_nc(0); +} + +void traverseHuffTree(struct sp_HuffmanJoin *hj, struct sp_HuffmanLeaf **heap) +{ + if (hj->left < 256) { /* if this is really a sp_HuffmanLeaf */ + heap[hj->left] = hj; + return; + } + traverseHuffTree(hj->left, heap); + traverseHuffTree(hj->right, heap); +} + +int sp_HuffExtract(struct sp_HuffmanCodec *hc, uint n) +{ + struct sp_HuffmanLeaf **heap; + struct sp_HuffmanJoin *hj1, *hj2, *hj3; + + /* change frequency table into a min-heap */ + if (n == 0) + sp_Heapify(heap = hc->u.heap-1, n = hc->symbols, compare); + + /* create huffman decoder tree */ + while (n != 1) { + if ((hj3 = u_malloc(sizeof(struct sp_HuffmanJoin))) == NULL) + return_c n; + + sp_HeapExtract(heap, n, compare); + hj1 = heap[n--]; + sp_HeapExtract(heap, n, compare); + hj2 = heap[n--]; + + hj3->u.freq = hj1->u.freq + hj2->u.freq; + hj1->u.parent = hj3; + hj2->u.parent = hj3; + hj3->left = hj1; + hj3->right = hj2; + + sp_HeapAdd(hj3, heap, n++, compare); + } + hj3->u.parent = NULL; + hc->root = heap[1]; + + /* create encoder array */ + traverseHuffTree(hc->root, heap+1); + + return_nc 0; +} diff --git a/lib/splib2/huffman/sp_HuffGetState.c b/lib/splib2/huffman/sp_HuffGetState.c new file mode 100644 index 00000000..ef362508 --- /dev/null +++ b/lib/splib2/huffman/sp_HuffGetState.c @@ -0,0 +1,12 @@ +/* + * Sprite Pack V2.1 + * Alvin Albrecht 03.2003 + */ + +#include "spritepack.h" + +void *sp_HuffGetState(struct sp_HuffmanCodec *hc, uchar *bit) +{ + *bit = hc->bit; + return hc->addr; +} diff --git a/lib/splib2/huffman/sp_HuffSetState.c b/lib/splib2/huffman/sp_HuffSetState.c new file mode 100644 index 00000000..d5ab1c4d --- /dev/null +++ b/lib/splib2/huffman/sp_HuffSetState.c @@ -0,0 +1,12 @@ +/* + * Sprite Pack V2.1 + * Alvin Albrecht 03.2003 + */ + +#include "spritepack.h" + +void sp_HuffSetState(struct sp_HuffmanCodec *hc, void *addr, uchar bit) +{ + hc->bit = bit; + hc->addr = addr; +} diff --git a/lib/splib2/huffman/sp_c.lst b/lib/splib2/huffman/sp_c.lst new file mode 100644 index 00000000..d51e2a4e --- /dev/null +++ b/lib/splib2/huffman/sp_c.lst @@ -0,0 +1,7 @@ +sp_HuffCreate.c +sp_HuffDecode.c +sp_HuffDelete.c +sp_HuffEncode.c +sp_HuffExtract.c +sp_HuffGetState.c +sp_HuffSetState.c diff --git a/lib/splib2/huffman/zcc_opt.def b/lib/splib2/huffman/zcc_opt.def new file mode 100644 index 00000000..e69de29b diff --git a/lib/splib2/input/SPGetKey.asm b/lib/splib2/input/SPGetKey.asm new file mode 100644 index 00000000..a08f0fe4 --- /dev/null +++ b/lib/splib2/input/SPGetKey.asm @@ -0,0 +1,159 @@ +; +; GetKey +; Alvin Albrecht 2002 +; +; Scans the keyboard and returns an ascii code representing a +; single keypress. "GetKey" operates as a state machine. First +; it debounces a key by ignoring it until a minimum time +; "SPkeydebounce" (byte) is passed. Then it will wait until +; the key has been pressed for a period "SPkeystartrepeat" (byte) +; at which time it will start to repeat the key at a rate +; "SPkeyrepeatperiod" (byte). If more than one key is pressed, +; no key is registered and the state machine returns to the +; debounce state. Time intervals depend on how often GetKey +; is called. If GetKey is part of an interrupt service routine +; then time is measured in 1/50s (Europe) or 1/60s (N. America). +; +; Key to ascii code translation is done by lookup table pointed +; at by "SPkeytranstbl". +; + +XLIB SPGetKey +LIB SPkeytranstbl, SPtbllookup +XDEF SPInkey +XDEF SPkeydebounce, SPkeystartrepeat, SPkeyrepeatperiod + +; +; Local Static Variables +; + +.state + defb 0 ; 0 = debounce, 1 = start repeat, 2 = repeat +.count + defb 0 ; how long a key has been pressed + +; +; Global Static Variables +; + +.SPkeydebounce + defb 0 +.SPkeystartrepeat + defb 15 +.SPkeyrepeatperiod + defb 4 + + +; Inkey +; +; Read a key without waiting for debounce, etc. +; uses : af,bc,de,hl,af' +; +; If GetKey() is part of an ISR, Inkey might *very* +; occasionally cause an extra keypress to be read +; by GetKey(). Look into "KeyPressed" as an alternative. + +.SPInkey + ld hl,(state) ; get state AND count + push hl ; save them + ld a,255 + ld (count),a ; pretend key has been pressed forever + call SPGetKey + pop hl + ld (state),hl ; restore state AND count + ret + + +; GetKey +; +; uses : af,bc,de,hl,af' +; exit : carry flag set: key is registered, a = ascii code +; +; A key is registered only if it is the sole key pressed on the keyboard. + +.SPGetKey + ld bc,$fefe ; get ready to scan all rows on keyboard + ld d,$fe ; d = max 1 keypress + xor a ; a = current key index + ld h,a ; index of last keypress + +.scanloop + in e,(c) ; read status of key row + ld l,5 ; 5 keys in row + +.keyrowloop + rrc e ; is this key pressed? + jp c, nopress + or a + jr z, nopress ; ignore CAPS + cp 36 + jr z, nopress ; ignore SYM SHIFT + inc d ; another key pressed + jr z, toomanykeys ; exit if more than one + ld h,a ; remember which key + +.nopress + inc a ; on to the next key index + dec l + jp nz, keyrowloop + +.nextscanrow + rlc b ; on to the next key row + jp c, scanloop + + inc d ; check if a single key was pressed + jr nz, nokeys + + ld a,(count) ; increase length of time key has been pressed + inc a + jr z, atmaxcount + ld (count),a + +.atmaxcount + ld l,a ; l = length of time key has been pressed + ld de,SPkeydebounce + ld a,(state) + call SPtbllookup ; a = length of time key needs to be pressed in order to register + cp l + ret nc ; if key hasn't been held down long enough + + ld a,(state) ; advance GetKey state machine + inc a + cp 3 + jr nc, skip + ld (state),a + +.skip + xor a + ld (count),a ; reset keypress count + ld e,h + ld d,0 ; de = index of key pressed + ld hl,SPkeytranstbl + add hl,de + + ld a,$fe ; check on CAPS key + in a,($fe) + and $01 + jr nz, nocaps + ld e,40 + add hl,de + +.nocaps + ld a,$7f ; check on SYM SHIFT + in a,($fe) + and $02 + jr nz, nosym + ld e,80 + add hl,de + +.nosym + ld a,(hl) ; a = ascii code + scf ; indicate key was registered + ret + +.toomanykeys +.nokeys + ld hl,0 + ld (state),hl ; zero state AND count + xor a + ret diff --git a/lib/splib2/input/SPGetKey.o b/lib/splib2/input/SPGetKey.o new file mode 100644 index 00000000..fe697fdd Binary files /dev/null and b/lib/splib2/input/SPGetKey.o differ diff --git a/lib/splib2/input/SPJoyFuller.asm b/lib/splib2/input/SPJoyFuller.asm new file mode 100644 index 00000000..08670198 --- /dev/null +++ b/lib/splib2/input/SPJoyFuller.asm @@ -0,0 +1,22 @@ +; +; JoyFuller +; Alvin Albrecht 2002 +; +; Reads Fuller Box joystick. +; + +XLIB SPJoyFuller + +; JoyFuller +; +; Reads Fuller Box joystick. +; You must make sure the relevant hardware is present +; or you may get false readings. +; +; exit: a = F111RLDU active low +; uses: af + +.SPJoyFuller + in a,($7f) ; FXXXRLDU active low + or $70 + ret diff --git a/lib/splib2/input/SPJoyFuller.o b/lib/splib2/input/SPJoyFuller.o new file mode 100644 index 00000000..321c9280 Binary files /dev/null and b/lib/splib2/input/SPJoyFuller.o differ diff --git a/lib/splib2/input/SPJoyKempston.asm b/lib/splib2/input/SPJoyKempston.asm new file mode 100644 index 00000000..aa936afd --- /dev/null +++ b/lib/splib2/input/SPJoyKempston.asm @@ -0,0 +1,35 @@ +; +; JoyKempston +; Alvin Albrecht 2002 +; +; Reads Kempston joystick. +; + +XLIB SPJoyKempston +LIB SPtbllookup + +; JoyKempston +; +; Reads Kempston joystick. +; You must make sure the real hardware is +; present or you may get false readings. +; +; exit: a = F111RLDU active low +; uses: af, de + +.SPJoyKempston + in a,($1f) ; 000FUDLR active high + cpl ; active low + and $1f + ld de,kemptbl ; use table to transform + jp SPtbllookup + +.kemptbl + defb $70,$78,$74,$7c + defb $72,$7a,$76,$7e + defb $71,$79,$75,$7d + defb $73,$7b,$77,$7f + defb $f0,$f8,$f4,$fc + defb $f2,$fa,$f6,$fe + defb $f1,$f9,$f5,$fd + defb $f3,$fb,$f7,$ff diff --git a/lib/splib2/input/SPJoyKempston.o b/lib/splib2/input/SPJoyKempston.o new file mode 100644 index 00000000..fd9402d3 Binary files /dev/null and b/lib/splib2/input/SPJoyKempston.o differ diff --git a/lib/splib2/input/SPJoyKeyboard.asm b/lib/splib2/input/SPJoyKeyboard.asm new file mode 100644 index 00000000..8f05d8f1 --- /dev/null +++ b/lib/splib2/input/SPJoyKeyboard.asm @@ -0,0 +1,52 @@ +; +; JoyKeyboard +; Alvin Albrecht 2002 +; +; Five keys are read corresponding to Fire, Right, Left, Up, Down +; as in a joystick read. Returns the same result as the low level +; joystick functions. +; +; enter: de points at a 5-entry table, each entry holds +; a key row value (byte) followed by a mask (byte). +; The key row byte is the same byte that would appear +; in the MSB of a port read of the keyboard. The mask +; byte isolates the key within the byte. "LookupKey" +; will provide this information for a particular key +; given its ascii code. +; de + 0/1 fire key: key row / mask +; de + 2/3 right key: key row / mask +; de + 4/5 left key: key row / mask +; de + 6/7 down key: key row / mask +; de + 8/9 up key: key row / mask +; exit : a = F111RLDU active low +; uses : af,bc,de,hl + +XLIB SPJoyKeyboard + +.SPJoyKeyboard + ld bc,$f7ff ; b = doing R, c = F111RLDU inactive (active low) + ex de,hl ; hl = table of user-defined keys + ld a,(hl) + in a,($fe) + inc hl + and (hl) + jr nz, nofire + res 7,c + +.nofire +.jkloop + inc hl + ld a,(hl) ; key row + in a,($fe) ; read state of keys on row + inc hl + and (hl) ; isolate specific key in row + jr nz, nopress + ld a,b + and c ; indicate keypress + ld c,a + +.nopress + rrc b + jp c, jkloop + ld a,c + ret diff --git a/lib/splib2/input/SPJoyKeyboard.o b/lib/splib2/input/SPJoyKeyboard.o new file mode 100644 index 00000000..16d1a511 Binary files /dev/null and b/lib/splib2/input/SPJoyKeyboard.o differ diff --git a/lib/splib2/input/SPJoySinclair1.asm b/lib/splib2/input/SPJoySinclair1.asm new file mode 100644 index 00000000..99dbf93b --- /dev/null +++ b/lib/splib2/input/SPJoySinclair1.asm @@ -0,0 +1,33 @@ +; +; JoySinclair1 +; Alvin Albrecht 2002 +; +; Reads Sinclair 1 joystick. +; + +XLIB SPJoySinclair1 +LIB SPtbllookup + +; JoySinclair1 +; +; Reads Sinclair 1 joystick (keys 6..0). +; +; exit: a = F111RLDU active low +; uses: af, de + +.SPJoySinclair1 + ld a,$ef + in a,($fe) + and $1f ; 000LRDUF active low + ld de,sinc1tbl ; use table to transform + jp SPtbllookup + +.sinc1tbl + defb $70,$f0,$71,$f1 + defb $72,$f2,$73,$f3 + defb $78,$f8,$79,$f9 + defb $7a,$fa,$7b,$fb + defb $74,$f4,$75,$f5 + defb $76,$f6,$77,$f7 + defb $7c,$fc,$7d,$fd + defb $7e,$fe,$7f,$ff diff --git a/lib/splib2/input/SPJoySinclair1.o b/lib/splib2/input/SPJoySinclair1.o new file mode 100644 index 00000000..416cf78a Binary files /dev/null and b/lib/splib2/input/SPJoySinclair1.o differ diff --git a/lib/splib2/input/SPJoySinclair2.asm b/lib/splib2/input/SPJoySinclair2.asm new file mode 100644 index 00000000..fddff352 --- /dev/null +++ b/lib/splib2/input/SPJoySinclair2.asm @@ -0,0 +1,33 @@ +; +; JoySinclair2 +; Alvin Albrecht 2002 +; +; Reads Sinclair 2 joystick. +; + +XLIB SPJoySinclair2 +LIB SPtbllookup + +; JoySinclair2 +; +; Reads Sinclair 2 joystick (keys 1..5). +; +; exit: a = F111RLDU active low +; uses: af, de + +.SPJoySinclair2 + ld a,$f7 ; key row 1..5 + in a,($fe) + and $1f ; 000FUDRL active low + ld de,sinc2tbl ; use table to transform + jp SPtbllookup + +.sinc2tbl + defb $70,$74,$78,$7c + defb $72,$76,$7a,$7e + defb $71,$75,$79,$7d + defb $73,$77,$7b,$7f + defb $f0,$f4,$f8,$fc + defb $f2,$f6,$fa,$fe + defb $f1,$f5,$f9,$fd + defb $f3,$f7,$fb,$ff diff --git a/lib/splib2/input/SPJoySinclair2.o b/lib/splib2/input/SPJoySinclair2.o new file mode 100644 index 00000000..46b8b711 Binary files /dev/null and b/lib/splib2/input/SPJoySinclair2.o differ diff --git a/lib/splib2/input/SPJoyTimexEither.asm b/lib/splib2/input/SPJoyTimexEither.asm new file mode 100644 index 00000000..7d2e2901 --- /dev/null +++ b/lib/splib2/input/SPJoyTimexEither.asm @@ -0,0 +1,25 @@ +; +; JoyTimexEither +; Alvin Albrecht 9.2003 +; + +XLIB SPJoyTimexEither +LIB SPtmxsetup + +; JoyTimexEither +; +; Reads both joysticks on TS2068, effectively ORing result +; You must make sure the relevant hardware is present +; or you may get false readings. +; +; exit: a = F111RLDU active low +; uses: af + +.SPJoyTimexEither + di ; can't allow writes to AY during an isr + call SPtmxsetup + ld a,3 ; both joysticks + in a,($f6) ; FXXXRLDU active low + or $70 + ei + ret diff --git a/lib/splib2/input/SPJoyTimexEither.o b/lib/splib2/input/SPJoyTimexEither.o new file mode 100644 index 00000000..544b05a3 Binary files /dev/null and b/lib/splib2/input/SPJoyTimexEither.o differ diff --git a/lib/splib2/input/SPJoyTimexLeft.asm b/lib/splib2/input/SPJoyTimexLeft.asm new file mode 100644 index 00000000..8727b1b6 --- /dev/null +++ b/lib/splib2/input/SPJoyTimexLeft.asm @@ -0,0 +1,27 @@ +; +; JoyTimexLeft +; Alvin Albrecht 2002 +; +; Reads TS2068 left joystick. +; + +XLIB SPJoyTimexLeft +LIB SPtmxsetup + +; JoyTimexLeft +; +; Reads right side joystick on TS2068. +; You must make sure the relevant hardware is present +; or you may get false readings. +; +; exit: a = F111RLDU active low +; uses: af + +.SPJoyTimexLeft + di ; can't allow writes to AY during an isr + call SPtmxsetup + ld a,2 ; left joystick + in a,($f6) ; FXXXRLDU active low + or $70 + ei + ret diff --git a/lib/splib2/input/SPJoyTimexLeft.o b/lib/splib2/input/SPJoyTimexLeft.o new file mode 100644 index 00000000..ef58026c Binary files /dev/null and b/lib/splib2/input/SPJoyTimexLeft.o differ diff --git a/lib/splib2/input/SPJoyTimexRight.asm b/lib/splib2/input/SPJoyTimexRight.asm new file mode 100644 index 00000000..1215d6d5 --- /dev/null +++ b/lib/splib2/input/SPJoyTimexRight.asm @@ -0,0 +1,27 @@ +; +; JoyTimexRight +; Alvin Albrecht 2002 +; +; Reads right TS2068 joystick. +; + +XLIB SPJoyTimexRight +LIB SPtmxsetup + +; JoyTimex1 +; +; Reads left side joystick on TS2068. +; You must make sure the relevant hardware is present +; or you may get false readings. +; +; exit: a = F111RLDU active low +; uses: af + +.SPJoyTimexRight + di ; can't allow writes to AY during an isr + call SPtmxsetup + ld a,1 ; right joystick + in a,($f6) ; FXXXRLDU active low + or $70 + ei + ret diff --git a/lib/splib2/input/SPJoyTimexRight.o b/lib/splib2/input/SPJoyTimexRight.o new file mode 100644 index 00000000..8a0e3469 Binary files /dev/null and b/lib/splib2/input/SPJoyTimexRight.o differ diff --git a/lib/splib2/input/SPKeyPressed.asm b/lib/splib2/input/SPKeyPressed.asm new file mode 100644 index 00000000..63e0051b --- /dev/null +++ b/lib/splib2/input/SPKeyPressed.asm @@ -0,0 +1,43 @@ +; +; Key Pressed? +; Alvin Albrecht 01.2003 +; + +XLIB SPKeyPressed + +; Determines if a key is pressed using the scan code +; returned by "LookupKey". +; +; enter : c = scan row +; b = key mask +; exit : carry = key is pressed +; used : af, b + +.SPKeyPressed + bit 7,b + jp z, nocaps + + ld a,$fe ; check on CAPS key + in a,($fe) + and $01 + ret nz ; CAPS not pressed, return no carry = fail + +.nocaps + bit 6,b + jp z, nosym + + ld a,$7f ; check on SYM SHIFT + in a,($fe) + and $02 + ret nz ; SYM not pressed, return no carry = fail + +.nosym + ld a,b + and $1f + ld b,c + ld c,$fe + in b,(c) + and b + ret nz ; key not pressed, return no carry = fail + scf + ret diff --git a/lib/splib2/input/SPKeyPressed.o b/lib/splib2/input/SPKeyPressed.o new file mode 100644 index 00000000..877cc832 Binary files /dev/null and b/lib/splib2/input/SPKeyPressed.o differ diff --git a/lib/splib2/input/SPLookupKey.asm b/lib/splib2/input/SPLookupKey.asm new file mode 100644 index 00000000..2fc87660 --- /dev/null +++ b/lib/splib2/input/SPLookupKey.asm @@ -0,0 +1,73 @@ +; +; LookupKey +; Alvin Albrecht 01.2003 +; + +XLIB SPLookupKey +LIB SPkeytranstbl, SPbit2mask, SPtbllookup + +; Given the ascii code of a character, returns the scan row and mask +; corresponding to the key that needs to be pressed to generate the +; character. Eg: Calling LookupKey with character 'a' will return +; '$fd' for key row and '$01' for the mask. You could then check to +; see if the key is pressed with the following bit of code: +; +; ld a,$fd +; in a,($fe) +; and $01 +; jr z, a_is_pressed +; +; The mask returned will have bit 7 set and bit 6 set to +; indicate if CAPS, SYM SHIFTS also have to be pressed to generate the +; ascii code, respectively. + +; enter: a = ascii code +; exit : No carry = ascii code not found +; Else: c = scan row, b = mask +; bit 7 of b set if CAPS needs to be pressed +; bit 6 of b set if SYM SHIFT needs to be pressed + +.SPLookupKey + or a + ld hl,SPkeytranstbl + ld bc,160 + cpir + ret nz ; no carry if ascii code not found! + + ld a,159 + sub c ; index into key translation table + ;ld b,0 ; mask + + cp 80 ; ascii code requires SYM SHIFT? + jp c, nosym + sub 80 + set 6,b + +.nosym + cp 40 ; ascii code requires CAPS SHIFT? + jp c, nocaps + sub 40 + set 7,b + +.nocaps + ld c,0 + +.div5loop ; speed is not of the essence + cp 5 ; a simple divide by 5 routine + jr c, donedivide + sub 5 + inc c + jp div5loop + +.donedivide ; c = index/5, a = index%5 + ld de,SPbit2mask + call SPtbllookup + or b + ld b,a ; key mask + ld a,c + ld de,SPbit2mask + call SPtbllookup + cpl + ld c,a ; key row + scf + ret diff --git a/lib/splib2/input/SPLookupKey.o b/lib/splib2/input/SPLookupKey.o new file mode 100644 index 00000000..fbb8a66b Binary files /dev/null and b/lib/splib2/input/SPLookupKey.o differ diff --git a/lib/splib2/input/SPMouseAMX.asm b/lib/splib2/input/SPMouseAMX.asm new file mode 100644 index 00000000..f22a0249 --- /dev/null +++ b/lib/splib2/input/SPMouseAMX.asm @@ -0,0 +1,75 @@ +; +; AMX Mouse +; Alvin Albrecht 01.2003 +; 08.2003: Read buttons fixed. + +INCLUDE "SPconfig.def" + +XLIB SPMouseAMX +LIB SPMouseAMXInit, SPtbllookup +XREF SPAMXxcoord, SPAMXycoord +defw SPMouseAMXInit + +; Mouse AMX +; +; Don't forget to initialize the AMX interface. +; +; exit : a = h = y coord 0..191 +; l = x coord 0.255, hi-res: carry set adds 256 +; e = 11111MRL active low button press +; used : af,de,hl + +.SPMouseAMX + ld e,$1f + in a,($df) ; mouse button state will randomly + or e ; fluctuate except when the mouse + ld e,a ; buttons are really pressed! + in a,($df) + or e + ld e,a + in a,($df) + or e + ld e,a + in a,($df) + or e + ld e,a + in a,($df) + or e + ld e,a + in a,($df) + or e + ld e,a + in a,($df) + or e + ld e,a + in a,($df) + or e + rlca + rlca + rlca + and $07 + ld de,AMXButTbl + call SPtbllookup + ld e,a + + ld a,(SPAMXycoord+1) + cp 8*(SP_ROWEND - SP_ROWSTART) ; keep it in spritepack's row range + jp c, notoutofrange + ld a,8*(SP_ROWEND - SP_ROWSTART) - 1 + ld (SPAMXycoord+1),a +.notoutofrange + ld h,a +IF DISP_HIRES + ld a,(SPAMXxcoord) + rla + ld a,(SPAMXxcoord+1) + rla +ELSE + ld a,(SPAMXxcoord+1) +ENDIF + ld l,a + ld a,h + ret + +.AMXButTbl + defb $f8, $fc, $fa, $fe, $f9, $fd, $fb, $ff diff --git a/lib/splib2/input/SPMouseAMX.o b/lib/splib2/input/SPMouseAMX.o new file mode 100644 index 00000000..e3a71a31 Binary files /dev/null and b/lib/splib2/input/SPMouseAMX.o differ diff --git a/lib/splib2/input/SPMouseAMXInit.asm b/lib/splib2/input/SPMouseAMXInit.asm new file mode 100644 index 00000000..070b7594 --- /dev/null +++ b/lib/splib2/input/SPMouseAMXInit.asm @@ -0,0 +1,175 @@ +; +; AMX Mouse Initialization +; Alvin Albrecht 01.2003 +; + +INCLUDE "SPconfig.def" + +XLIB SPMouseAMXInit +XDEF SPAMXDX, SPAMXDY, SPAMXxcoord, SPAMXycoord +LIB SPInstallISR + +; References: +; 1. http://www.breezer.demon.co.uk/spec/tech/hware.html +; Has an excerpt of the Z80 Emulator's documentation on the AMX Mouse. +; Information is incorrect about mouse buttons. Used the Spectaculator +; emulator as reference for button behaviour. +; 2. "Z80 Data Book," Mostek Microcomputer Corporation, August 1978. +; Technical documentation of the Z80 PIO Chip. + +; AMX Mouse +; +; The AMX mouse is interfaced to the Spectrum using a Z80 PIO chip +; configured in input mode. Port A of the chip is associated +; with X movement and port B is associated with Y movement. The +; mouse interface will generate an interrupt on port A or port B +; each time it is moved a distance of "one mickey" in the X or +; Y direction respectively. It is the program's job to field +; these interrupts and update internal state representing the +; mouse's absolute position. Once an interrupt has occurred, +; reading the data port (A or B) will return 0 (positive) or +; 1 (negative) to indicate movement direction. +; +; Needless to say you must have interrupt mode 2 enabled to +; catch AMX mouse interrupts. +; +; Port Addresses: +; +; (Mapped to PIO chip) +; $1f Data Port A +; $3f Data Port B +; $5f Control Port A +; $7f Control Port B +; +; (Separate from PIO chip) +; $df State of three mouse buttons: bit 7 = left, bit 6 = right active, +; bit 5 = middle, active low. The mouse buttons are either or both +; not debounced or open collector. The former adds random transitions +; around a mouse press / depress and the latter adds random transitions +; when the mouse is left unpressed, caused by ULA attribute bytes on +; a floating bus. You must take this into consideration when getting +; a reliable read of the mouse buttons' state. +; +; Note that the AMX Mouse interface conflicts with the Kempston +; joystick interface ($1f), the Disciple disk interface ($1f) and +; the Multiface ($3f). + +; +; Global Static Variables +; + +.SPAMXDX ; change in X position for each interrupt received +IF DISP_HIRES + defw $0080 +ELSE + defw $0100 +ENDIF + +.SPAMXDY ; change in Y position for each interrupt received + defw $0100 + +.SPAMXxcoord ; place mouse at top left corner of screen initially + defw 0 ; coords are 16 bit fixed point, with binary point +.SPAMXycoord ; between two bytes (except HIRES mode where binary + defw 0 ; point is between bits 6 and 7 of 16 bit word). + + +; MouseAMXInit +; +; Initializes AMX interface and places vectors into the im 2 +; interrupt vector table. "InitIM2" should have been called +; first to create the table. Once this is called you +; can read the xcoord, ycoord of the mouse directly from +; AMXxoord or AMXycoord. Or you can use the MouseAMX subroutine. +; +; DISABLE INTERRUPTS BEFORE CALLING! +; +; enter: +; b = im 2 vector for X interrupts (even, 0..254) +; c = im 2 vector for Y interrupts (even, 0..254) + +.SPMouseAMXInit + ld l,b + ld de,XInterrupt + call SPInstallISR ; place ISR address into im 2 vector table + + ld l,c + ld de,YInterrupt + call SPInstallISR ; place ISR address into im 2 vector table + + ld a,b + out ($5f),a ; PIO vector for X + ld a,$97 + out ($5f),a ; PIO enable interrupt generation for X + ld a,$4f + out ($5f),a ; PIO select input mode for X + + ld a,c + out ($7f),a ; PIO vector for Y + ld a,$97 + out ($7f),a ; PIO enable interrupt generation for Y + ld a,$4f + out ($7f),a ; PIO select input mode for Y + ret + + +; interrupt service routines + +.XInterrupt + push af + push de + push hl + + ld de,(SPAMXDX) + ld hl,(SPAMXxcoord) + + in a,($1f) + or a + jr z,posx + sbc hl,de + jp nc, contx + ld hl,0 + jp contx + +.posx + add hl,de + jp nc, contx + ld hl,$ffff + +.contx + ld (SPAMXxcoord),hl + pop hl + pop de + pop af + ei + reti + + +.YInterrupt + push af + push de + push hl + + ld de,(SPAMXDY) + ld hl,(SPAMXycoord) + + in a,($3f) + or a + jr z,posy + add hl,de + jp nc, conty + ld hl,$ffff + jp conty + +.posy + sbc hl,de + jp nc, conty + ld hl,0 + +.conty + ld (SPAMXycoord),hl + pop hl + pop de + pop af + ei + reti diff --git a/lib/splib2/input/SPMouseAMXInit.o b/lib/splib2/input/SPMouseAMXInit.o new file mode 100644 index 00000000..f35bc29e Binary files /dev/null and b/lib/splib2/input/SPMouseAMXInit.o differ diff --git a/lib/splib2/input/SPMouseKempston.asm b/lib/splib2/input/SPMouseKempston.asm new file mode 100644 index 00000000..3290a9d3 --- /dev/null +++ b/lib/splib2/input/SPMouseKempston.asm @@ -0,0 +1,112 @@ +; +; Kempston Mouse +; Based on Chris Cowley's Basic Mouse Driver code +; 03.2003 +; + +INCLUDE "SPconfig.def" +XLIB SPMouseKempston +XDEF SPKEMPX, SPKEMPY + +; +; Local Statics +; + +.SPKEMPX +.xcoord + defw 0 + +.SPKEMPY +.ycoord + defb 0 + +.kempx + defb 0 + +.kempy + defb 0 + + +; MouseKempston +; +; exit : a = h = y coord 0..191 +; l = x coord 0.255, hi-res mode: carry set adds 256 +; e = 111111RL active low button press +; used : af,de,hl + +.SPMouseKempston + ld a,(kempx) + ld e,a ; e = last x coord reported by kempston + ld a,$fb + in a,($df) ; current x coord reported by kempston + ld (kempx),a + sub e + ld hl,(xcoord) + jp pe, overflow ; if overflow, kill the x movement +.nooverflow + ld e,a + ld d,0 + jp p,posdx + dec d ; de = signed dx, positive for right movement +.posdx + add hl,de + bit 7,h + jp z, xleftokay + ld hl,0 ; hit left border, set x to 0 + jp xokay +.xleftokay +IF DISP_HIRES + bit 1,h +ELSE + bit 0,h +ENDIF + jp z, xokay +IF DISP_HIRES + ld hl,511 +ELSE + ld hl,255 ; hit right border, set x to 255 +ENDIF +.xokay + ld (xcoord),hl ; hl = x coord + +.overflow + ld a,$fa + in a,($df) + and $03 + ld e,a + rla + srl e + or $fc + or e + ld e,a ; e = buttons 111111RL active low + + ld a,(kempy) + ld d,a ; d = last y coord reported by kempston + ld a,$ff + in a,($df) ; a = current y coord reported by kempston + ld (kempy),a + sub d + ld d,a ; d = dy, positive for up + ld a,(ycoord) ; a = current mouse y coord + sub d + cp 192 + jp c, yokay + ld a,(ycoord) ; y moved off screen, stop it at screen edge + cp 96 ; were we closer to the top or bottom of the screen? + jr c, yattop + ld a,191 + jp yokay +.yattop + xor a +.yokay + cp 8*(SP_ROWEND - SP_ROWSTART) + jp c, rowinrange + ld a,8*(SP_ROWEND - SP_ROWSTART) - 1 + +.rowinrange + ld (ycoord),a +IF DISP_HIRES + rrc h +ENDIF + ld h,a + ret diff --git a/lib/splib2/input/SPMouseKempston.o b/lib/splib2/input/SPMouseKempston.o new file mode 100644 index 00000000..4e0b0418 Binary files /dev/null and b/lib/splib2/input/SPMouseKempston.o differ diff --git a/lib/splib2/input/SPMouseSim.asm b/lib/splib2/input/SPMouseSim.asm new file mode 100644 index 00000000..18ecb890 --- /dev/null +++ b/lib/splib2/input/SPMouseSim.asm @@ -0,0 +1,205 @@ +; Simulated Mouse +; Alvin Albrecht 06.2003 + +INCLUDE "SPconfig.def" + +XLIB SPMouseSim + +; Simulated Mouse +; +; Simulates a mouse with keyboard or joystick. The longer the +; user selects a direction, the faster the mouse moves. +; +; enter: hl = address of struct sp_UDM +; exit : a = h = y coord 0..191 +; l = x coord 0.255, hi-res: carry set adds 256 +; e = 1111111L active low button press +; used : af',af,bc,de,hl + +; *** last maxcount in struct sp_UDM must be 255 + +.nomovement ; hl = UDM.delta, a' = F1111111 active low + inc hl + inc hl + ld (hl),0 ; state = 0 + inc hl + ld (hl),0 ; count = 0 + ex af,af' + ld e,255 + rla + rl e ; e = 1111111L active low + ld bc,4 + add hl,bc ; hl = UDM.x+1 + ld c,(hl) ; c = x coord + dec hl +IF DISP_HIRES + ld b,(hl) ; b = LSB x coord +ENDIF + dec hl + ld a,(hl) ; a = y coord + cp 8*(SP_ROWEND - SP_ROWSTART) + jp c, notoutofrange2 + ld a,8*(SP_ROWEND - SP_ROWSTART) - 1 + ld (hl),a +.notoutofrange2 + ld h,a ; a = h = y coord + ld l,c ; l = x coord +IF DISP_HIRES + sla b + rl l +ENDIF + ret + +.SPMouseSim + ld c,(hl) + inc hl + ld b,(hl) ; bc = keys struct + inc hl + ld e,(hl) + inc hl + ld d,(hl) + inc hl + push hl ; save UDM.delta + ex de,hl ; hl = joystick function + push bc ; push keys struct parameter, C compatible + ld e,c + ld d,b ; de = parameter, machine code compatible + call JPHL + pop bc + pop hl ; hl = UDM.delta + ld c,a + ex af,af' ; a' = F111RLDU active low + + ld a,c + inc a + and $0f + jr z, nomovement + + ld e,(hl) + inc hl + ld d,(hl) ; de = address of delta array + inc hl ; hl = UDM.state + ld a,(hl) ; a = state = index into delta array + inc hl ; hl = UDM.count + ld c,a + add a,a + add a,a + add a,c + add a,e + ld e,a + jp nc, noinc + inc d ; de = delta[state] +.noinc + ld a,(hl) + inc a ; increase current count + jp nz, nowrap + dec a +.nowrap + ld (hl),a ; store new count value + dec a + ex de,hl ; de = UDM.count, hl = delta[state] + cp (hl) + jp c, samestate ; if not past maxcount for current state + + ex de,hl ; hl = UDM.count, de = delta[state] + ld (hl),0 ; current count = 0 + dec hl + inc (hl) ; move to next state + inc hl + ex de,hl ; de = UDM.count, hl = delta[state] + +.samestate + inc hl ; hl = delta.dx + inc de ; de = UDM.y + ld c,(hl) + inc hl + ld b,(hl) + inc hl + push bc ; save dx + ld c,(hl) + inc hl + ld b,(hl) ; bc = dy + ex de,hl ; hl = UDM.y + ld e,(hl) + inc hl + ld d,(hl) + ex de,hl ; hl = y, de = UDM.y+1 + +.up + ex af,af' ; a = F111RLDU active low + rrca + jr c, down + rrca ; swallow down, only doing up + or a + sbc hl,bc + jp nc, endvertical + ld hl,0 + jp endvertical +.down + rrca + jr c, endvertical + add hl,bc + ex af,af' + ld a,h + cp 8*(SP_ROWEND - SP_ROWSTART) + jp c, notoutofrange + ld a,8*(SP_ROWEND - SP_ROWSTART) - 1 + ld h,a +.notoutofrange + ex af,af' + +.endvertical ; a = ??F111RL + ex de,hl ; de = new y, hl = UDM.y+1 + ld (hl),d + dec hl + ld (hl),e ; store new y + inc hl + inc hl ; hl = UDM.x + pop bc ; bc = dx + ld e,(hl) + inc hl + ld d,(hl) + ex de,hl ; hl = x, de = UDM.x+1 + +.left + rrca + jr c,right + rrca ; swallow right + or a + sbc hl,bc + jp nc, endhorizontal + ld hl,0 + jp endhorizontal +.right + rrca + jr c, endhorizontal + add hl,bc + jp nc, endhorizontal + ld hl,$ffff + +.endhorizontal ; a = ????F111 + ex de,hl ; de = new x, hl = UDM.x+1 + ld (hl),d + dec hl + ld (hl),e ; store new x + dec hl ; hl = UDM.y+1 + +IF DISP_HIRES + ld c,e ; c = LSB of x coord +ENDIF + and $08 + ld e,255 + jp nz, nofire + dec e +.nofire ; e = 1111111L active low + ld h,(hl) + ld a,h ; a = h = y coord + ld l,d ; l = x coord +IF DISP_HIRES + sla c + rl l +ENDIF + ret + +.JPHL + jp (hl) diff --git a/lib/splib2/input/SPMouseSim.o b/lib/splib2/input/SPMouseSim.o new file mode 100644 index 00000000..a3643abe Binary files /dev/null and b/lib/splib2/input/SPMouseSim.o differ diff --git a/lib/splib2/input/SPPause.asm b/lib/splib2/input/SPPause.asm new file mode 100644 index 00000000..4b42f361 --- /dev/null +++ b/lib/splib2/input/SPPause.asm @@ -0,0 +1,28 @@ +; +; Pause +; Alvin Albrecht 06.2003 +; + +XLIB SPPause + +; Simulates the Basic Pause command. +; +; Measures passed time in interrupts. Causes death if ints disabled. +; +; enter : bc = ticks +; exit : carry = exited early because of key press, bc=remaining time +; used : af, bc + +.SPPause + halt + dec bc + ld a,b + or c + ret z + xor a + in a,($fe) + and 31 + cp 31 + jr z, SPPause + scf + ret diff --git a/lib/splib2/input/SPPause.o b/lib/splib2/input/SPPause.o new file mode 100644 index 00000000..43de0861 Binary files /dev/null and b/lib/splib2/input/SPPause.o differ diff --git a/lib/splib2/input/SPSetMousePosAMX.asm b/lib/splib2/input/SPSetMousePosAMX.asm new file mode 100644 index 00000000..89b504a0 --- /dev/null +++ b/lib/splib2/input/SPSetMousePosAMX.asm @@ -0,0 +1,34 @@ +; +; AMX Mouse Position +; Alvin Albrecht 02.2003 +; + +INCLUDE "SPconfig.def" + +XLIB SPSetMousePosAMX +LIB SPMouseAMXInit +XREF SPAMXxcoord, SPAMXycoord +defw SPMouseAMXInit + +; Set Position for AMX Mouse +; +; Don't forget to initialize the AMX interface. +; +; enter: h = y coord 0..191 +; l = x coord 0.255, hi-res: carry set adds 256 +; used : af, l + +.SPSetMousePosAMX + di +IF DISP_HIRES + rr l + ld a,0 + rra + ld (SPAMXxcoord),a +ENDIF + ld a,l + ld (SPAMXxcoord+1),a + ld a,h + ld (SPAMXycoord+1),a + ei + ret diff --git a/lib/splib2/input/SPSetMousePosAMX.o b/lib/splib2/input/SPSetMousePosAMX.o new file mode 100644 index 00000000..87b707d4 Binary files /dev/null and b/lib/splib2/input/SPSetMousePosAMX.o differ diff --git a/lib/splib2/input/SPSetMousePosKempston.asm b/lib/splib2/input/SPSetMousePosKempston.asm new file mode 100644 index 00000000..d19a5f01 --- /dev/null +++ b/lib/splib2/input/SPSetMousePosKempston.asm @@ -0,0 +1,33 @@ +; +; Kempston Mouse Position +; Alvin Albrecht 02.2003 +; + +INCLUDE "SPconfig.def" + +XLIB SPSetMousePosKempston +LIB SPMouseKempston +XREF SPKEMPX, SPKEMPY + +; Set Position for Kempston Mouse +; +; enter: h = y coord 0..191 +; l = x coord 0.255, hi-res: carry set adds 256 +; used : af + +.SPSetMousePosKempston + push af + push hl + call SPMouseKempston ; to zero out kempston readings + pop hl + pop af +IF DISP_HIRES + ld a,0 + adc a,0 + ld (SPKEMPX+1),a +ENDIF + ld a,l + ld (SPKEMPX),a + ld a,h + ld (SPKEMPY),a + ret diff --git a/lib/splib2/input/SPSetMousePosKempston.o b/lib/splib2/input/SPSetMousePosKempston.o new file mode 100644 index 00000000..df520016 Binary files /dev/null and b/lib/splib2/input/SPSetMousePosKempston.o differ diff --git a/lib/splib2/input/SPSetMousePosSim.asm b/lib/splib2/input/SPSetMousePosSim.asm new file mode 100644 index 00000000..e214ca00 --- /dev/null +++ b/lib/splib2/input/SPSetMousePosSim.asm @@ -0,0 +1,41 @@ +; +; Simulated Mouse Position +; Alvin Albrecht 06.2003 +; + +INCLUDE "SPconfig.def" + +XLIB SPSetMousePosSim + +; Set Position for Simulated Mouse +; +; enter: h = y coord 0..191 +; l = x coord 0.255, hi-res: carry set adds 256 +; de = struct sp_UDM +; used : (af'),af,bc,de,hl + +.SPSetMousePosSim + ex de,hl ; hl = UDM, d = y coord, e = x coord +IF DISP_HIRES + ex af,af' ; save carry flag +ENDIF + ld bc,6 + add hl,bc ; hl = UDM.state + xor a + ld (hl),a ; state = 0 + inc hl + ld (hl),a ; count = 0 + inc hl + ld (hl),a + inc hl + ld (hl),d ; set y coord + inc hl +IF DISP_HIRES + ex af,af' + rr e + rra +ENDIF + ld (hl),a + inc hl + ld (hl),e ; set x coord + ret diff --git a/lib/splib2/input/SPSetMousePosSim.o b/lib/splib2/input/SPSetMousePosSim.o new file mode 100644 index 00000000..4ff5c2ba Binary files /dev/null and b/lib/splib2/input/SPSetMousePosSim.o differ diff --git a/lib/splib2/input/SPWait.asm b/lib/splib2/input/SPWait.asm new file mode 100644 index 00000000..3621be91 --- /dev/null +++ b/lib/splib2/input/SPWait.asm @@ -0,0 +1,21 @@ +; +; Wait +; Alvin Albrecht 06.2003 +; + +XLIB SPWait + +; Waits a Fixed Period of Time +; +; Measures passed time in interrupts. Causes death if ints disabled. +; +; enter : bc = ticks +; used : af, bc + +.SPWait + halt + dec bc + ld a,b + or c + ret z + jp SPWait diff --git a/lib/splib2/input/SPWait.o b/lib/splib2/input/SPWait.o new file mode 100644 index 00000000..2bd72092 Binary files /dev/null and b/lib/splib2/input/SPWait.o differ diff --git a/lib/splib2/input/SPWaitForKey.asm b/lib/splib2/input/SPWaitForKey.asm new file mode 100644 index 00000000..96245427 --- /dev/null +++ b/lib/splib2/input/SPWaitForKey.asm @@ -0,0 +1,17 @@ +; +; WaitForKey +; Alvin Albrecht 2002 +; +; Return when a key is pressed. +; +; uses: af + +XLIB SPWaitForKey + +.SPWaitForKey + xor a + in a,($fe) + and 31 + cp 31 + jr z, SPWaitForKey + ret diff --git a/lib/splib2/input/SPWaitForKey.o b/lib/splib2/input/SPWaitForKey.o new file mode 100644 index 00000000..a5ff6d57 Binary files /dev/null and b/lib/splib2/input/SPWaitForKey.o differ diff --git a/lib/splib2/input/SPWaitForNoKey.asm b/lib/splib2/input/SPWaitForNoKey.asm new file mode 100644 index 00000000..ebb6006c --- /dev/null +++ b/lib/splib2/input/SPWaitForNoKey.asm @@ -0,0 +1,17 @@ +; +; WaitForNoKey +; Alvin Albrecht 2002 +; +; Return when no keys are pressed. +; +; uses: af + +XLIB SPWaitForNoKey + +.SPWaitForNoKey + xor a + in a,($fe) + and $1f + cp 31 + jr nz, SPWaitForNoKey + ret diff --git a/lib/splib2/input/SPWaitForNoKey.o b/lib/splib2/input/SPWaitForNoKey.o new file mode 100644 index 00000000..1662f0ea Binary files /dev/null and b/lib/splib2/input/SPWaitForNoKey.o differ diff --git a/lib/splib2/input/SPtbllookup.asm b/lib/splib2/input/SPtbllookup.asm new file mode 100644 index 00000000..a4ee0bea --- /dev/null +++ b/lib/splib2/input/SPtbllookup.asm @@ -0,0 +1,19 @@ + +XLIB SPtbllookup + +; enter: +; de = table base +; a = table byte index +; +; exit: +; a = table entry + +.SPtbllookup + add a,e + ld e,a + jp nc, noinc + inc d + +.noinc + ld a,(de) + ret diff --git a/lib/splib2/input/SPtbllookup.o b/lib/splib2/input/SPtbllookup.o new file mode 100644 index 00000000..81e2034a Binary files /dev/null and b/lib/splib2/input/SPtbllookup.o differ diff --git a/lib/splib2/input/SPtmxsetup.asm b/lib/splib2/input/SPtmxsetup.asm new file mode 100644 index 00000000..3942ee7f --- /dev/null +++ b/lib/splib2/input/SPtmxsetup.asm @@ -0,0 +1,12 @@ + +XLIB SPtmxsetup + +.SPtmxsetup + ld a,7 + out ($f5),a ; select R7 on AY chip + in a,($f6) ; read R7 + and $bf ; bit 6 = 0 selects i/o port A read + out ($f6),a + ld a,14 + out ($f5),a ; select R14, attached to i/o port A + ret diff --git a/lib/splib2/input/SPtmxsetup.o b/lib/splib2/input/SPtmxsetup.o new file mode 100644 index 00000000..1b37b2b9 Binary files /dev/null and b/lib/splib2/input/SPtmxsetup.o differ diff --git a/lib/splib2/input/zcc_opt.def b/lib/splib2/input/zcc_opt.def new file mode 100644 index 00000000..e69de29b diff --git a/lib/splib2/interrupts/SPCreateGenericISR.asm b/lib/splib2/interrupts/SPCreateGenericISR.asm new file mode 100644 index 00000000..2c5325d1 --- /dev/null +++ b/lib/splib2/interrupts/SPCreateGenericISR.asm @@ -0,0 +1,94 @@ +; +; Create Generic ISR +; Alvin Albrecht 01.2003 +; +; For installing a generic interrupt service routine on a particular +; im 2 vector: Call "CreateGenericISR" to copy the routine to a +; particular memory address. The size of the routine is available in +; "GENERICISRSIZE". Then place the address of the new GenericISR +; into the interrupt vector table with a call to "InstallISR". +; +; The generic ISR allows multiple hooks to be installed on a particular +; vector. It calls each installed hook one after the other. If any +; hook sets the carry flag prior to returning, the ISR terminates +; without calling further hooks down the chain. + + +XLIB SPCreateGenericISR +XDEF GENERICISRSIZE, GENERICLISTDISP + +; Create Generic ISR +; +; Copies the generic ISR routine to a new location pointed at in 'DE'. +; This location should be stored in the interrupt vector table for the +; corresponding vector. A new copy is necessary so that the generic +; ISR has its own private hook list. +; +; enter: de = address to place ISR +; exit : de = address just past ISR +; uses : bc, de, hl + +.SPCreateGenericISR + ld hl,GenericISR + ld bc,GENERICISRSIZE + ldir + ret + +.GenericISR + call pushreg +.position + ld hl,0 + call runhooks + jp popreg + +.pushreg + ex (sp),hl + push af + push bc + push de + exx + ex af,af' + push af + push bc + push de + push hl + push ix + push iy + exx +.JPHL + jp (hl) + +.runhooks + ld a,h + or l + ret z + push hl + inc hl + inc hl + call JPHL + pop hl + ret c + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + jp runhooks + +.popreg + pop iy + pop ix + pop hl + pop de + pop bc + pop af + exx + ex af,af' + pop de + pop bc + pop af + pop hl + ei + reti + +DEFC GENERICISRSIZE = pushreg - GenericISR +DEFC GENERICLISTDISP = position - GenericISR + 1 diff --git a/lib/splib2/interrupts/SPCreateGenericISR.o b/lib/splib2/interrupts/SPCreateGenericISR.o new file mode 100644 index 00000000..d60ba0f9 Binary files /dev/null and b/lib/splib2/interrupts/SPCreateGenericISR.o differ diff --git a/lib/splib2/interrupts/SPEmptyISR.asm b/lib/splib2/interrupts/SPEmptyISR.asm new file mode 100644 index 00000000..fbd08b9d --- /dev/null +++ b/lib/splib2/interrupts/SPEmptyISR.asm @@ -0,0 +1,14 @@ +; +; Empty ISR routine +; Alvin Albrecht 01.2003 +; + +XLIB SPEmptyISR + +; An empty, do-nothing interrupt service routine for catching +; unknown vectors or for use as a default handler while +; initializing the IM 2 mode. + +.SPEmptyISR + ei + reti diff --git a/lib/splib2/interrupts/SPEmptyISR.o b/lib/splib2/interrupts/SPEmptyISR.o new file mode 100644 index 00000000..e4e75b5b Binary files /dev/null and b/lib/splib2/interrupts/SPEmptyISR.o differ diff --git a/lib/splib2/interrupts/SPInitIM2.asm b/lib/splib2/interrupts/SPInitIM2.asm new file mode 100644 index 00000000..222cf1cc --- /dev/null +++ b/lib/splib2/interrupts/SPInitIM2.asm @@ -0,0 +1,37 @@ +; +; IM2 Interrupt Initialization +; Alvin Albrecht 01.2003 +; + +INCLUDE "SPconfig.def" +XLIB SPInitIM2 + +; Init IM2 +; +; Creates an interrupt vector table with all vectors initialized to jump to +; a default interrupt service routine. The interrupt vector table is placed +; at address "IM2TABLE" and is either 256 bytes long if "EVENVECTORS" is 1 or +; 257 bytes long if "EVENVECTORS" is 0. The latter option is made available +; for machines where peripherals may put an odd vector on the bus, against +; Zilog's recommended im2 scheme. +; +; Selects IM2. Interrupts should be disabled prior to calling. +; +; enter: bc = address of default interrupt handler + +.SPInitIM2 + ld hl,IM2TABLE + ld e,l + ld d,h + ld (hl),c + inc hl + ld (hl),b + inc hl + ex de,hl + ld bc,255-EVENVECTORS + ldir + + ld a,IM2TABLE/256 + ld i,a + im 2 + ret diff --git a/lib/splib2/interrupts/SPInitIM2.o b/lib/splib2/interrupts/SPInitIM2.o new file mode 100644 index 00000000..4d90d7a0 Binary files /dev/null and b/lib/splib2/interrupts/SPInitIM2.o differ diff --git a/lib/splib2/interrupts/SPInstallISR.asm b/lib/splib2/interrupts/SPInstallISR.asm new file mode 100644 index 00000000..6c266117 --- /dev/null +++ b/lib/splib2/interrupts/SPInstallISR.asm @@ -0,0 +1,28 @@ +; +; Install ISR +; Alvin Albrecht 01.2003 +; + +INCLUDE "SPconfig.def" +XLIB SPInstallISR + +; Simply stores ISR address into interrupt vector table. +; +; INTERRUPTS SHOULD BE DISABLED PRIOR TO CALLING! +; +; enter: l = vector to install on (even, 0..254) +; de = new ISR address +; exit : de = old ISR address +; used : af, de, h + +.SPInstallISR + ld h,IM2TABLE/256 + ld a,(hl) + ld (hl),e + ld e,a + inc hl + ld a,(hl) + ld (hl),d + ld d,a + dec l + ret diff --git a/lib/splib2/interrupts/SPInstallISR.o b/lib/splib2/interrupts/SPInstallISR.o new file mode 100644 index 00000000..7ee08fef Binary files /dev/null and b/lib/splib2/interrupts/SPInstallISR.o differ diff --git a/lib/splib2/interrupts/SPRegisterHookFirst.asm b/lib/splib2/interrupts/SPRegisterHookFirst.asm new file mode 100644 index 00000000..401f6c90 --- /dev/null +++ b/lib/splib2/interrupts/SPRegisterHookFirst.asm @@ -0,0 +1,44 @@ +; +; Register hook at front of list +; Alvin Albrecht 01.2003 +; + +INCLUDE "SPconfig.def" + +XLIB SPRegisterHookFirst +LIB SPCreateGenericISR +XREF GENERICLISTDISP +defw SPCreateGenericISR + +; For use with the Generic ISR. Installs a hook at the front of +; the list of registered hooks. +; +; INTERRUPTS MUST BE DISABLED BEFORE CALLING! +; +; *** Hooks must have two free bytes available just +; before the start of the subroutine. +; +; enter: de = address of hook +; l = interrupt vector +; used : bc, de ,hl + +.SPRegisterHookFirst + ld h,IM2TABLE/256 + ld c,(hl) + inc hl + ld b,(hl) + ld hl,GENERICLISTDISP + add hl,bc ; hl is address of hook list for this ISR + ld c,(hl) + inc hl + ld b,(hl) ; bc = first hook + dec de + dec de + ld (hl),d + dec hl + ld (hl),e ; store new hook as first one + ex de,hl + ld (hl),c + inc hl + ld (hl),b ; hook after new one is former first hook + ret diff --git a/lib/splib2/interrupts/SPRegisterHookFirst.o b/lib/splib2/interrupts/SPRegisterHookFirst.o new file mode 100644 index 00000000..50f9222a Binary files /dev/null and b/lib/splib2/interrupts/SPRegisterHookFirst.o differ diff --git a/lib/splib2/interrupts/SPRegisterHookLast.asm b/lib/splib2/interrupts/SPRegisterHookLast.asm new file mode 100644 index 00000000..91d3ae5c --- /dev/null +++ b/lib/splib2/interrupts/SPRegisterHookLast.asm @@ -0,0 +1,54 @@ +; +; Register hook at end of list +; Alvin Albrecht 01.2003 +; + +INCLUDE "SPconfig.def" + +XLIB SPRegisterHookLast +XDEF SPRegisterHook +LIB SPCreateGenericISR +XREF GENERICLISTDISP +defw SPCreateGenericISR + +; For use with the Generic ISR. Installs a hook at the end of +; the list of registered hooks. +; +; INTERRUPTS MUST BE DISABLED BEFORE CALLING! +; +; *** Hooks must have two free bytes available just +; before the start of the subroutine. +; +; enter: bc = address of hook +; l = interrupt vector +; used : bc, de ,hl + +.SPRegisterHook +.SPRegisterHookLast + ld h,IM2TABLE/256 + ld e,(hl) + inc hl + ld d,(hl) + ld hl,GENERICLISTDISP + add hl,de ; hl = address of hook list + +.loop + ld e,(hl) + inc hl + ld d,(hl) ; get address of next hook + ld a,d + or e + jr z, done ; if it's zero, we've found the end of the list + ex de,hl ; otherwise keep going + jp loop + +.done + xor a + dec bc + ld (bc),a + dec bc + ld (bc),a ; mark end of list in new hook + ld (hl),b + dec hl + ld (hl),c ; store new hook at end of list + ret diff --git a/lib/splib2/interrupts/SPRegisterHookLast.o b/lib/splib2/interrupts/SPRegisterHookLast.o new file mode 100644 index 00000000..9d861b5c Binary files /dev/null and b/lib/splib2/interrupts/SPRegisterHookLast.o differ diff --git a/lib/splib2/interrupts/SPRemoveHook.asm b/lib/splib2/interrupts/SPRemoveHook.asm new file mode 100644 index 00000000..2c1fa229 --- /dev/null +++ b/lib/splib2/interrupts/SPRemoveHook.asm @@ -0,0 +1,60 @@ +; +; Remove hook +; Alvin Albrecht 01.2003 +; + +INCLUDE "SPconfig.def" + +XLIB SPRemoveHook +LIB SPCreateGenericISR +XREF GENERICLISTDISP +defw SPCreateGenericISR + +; For use with the Generic ISR. +; Removes a hook from the ISR's list of hooks. +; +; INTERRUPTS MUST BE DISABLED BEFORE CALLING! +; +; enter: bc = address of hook +; l = interrupt vector +; exit : Carry flag reset if hook not found +; used : af, bc, de ,hl + +.SPRemoveHook + ld h,IM2TABLE/256 + ld e,(hl) + inc hl + ld d,(hl) + ld hl,GENERICLISTDISP + add hl,de ; hl = address of hook list + dec bc + dec bc + +.loop + ld e,(hl) + inc hl + ld d,(hl) ; de = next hook + ld a,d + or e + ret z ; reached end without finding hook to remove + ld a,d + cp b + jr nz, nomatch + ld a,e + cp c + jr z, match + +.nomatch + ex de,hl + jp loop + +.match ; hl points at hook to remove + 1 + dec hl + ld a,(bc) + ld (hl),a + inc bc + inc hl + ld a,(bc) + ld (hl),a + scf ; successful removal + ret diff --git a/lib/splib2/interrupts/SPRemoveHook.o b/lib/splib2/interrupts/SPRemoveHook.o new file mode 100644 index 00000000..be3cddbb Binary files /dev/null and b/lib/splib2/interrupts/SPRemoveHook.o differ diff --git a/lib/splib2/linkedlist/SPListAdd.asm b/lib/splib2/linkedlist/SPListAdd.asm new file mode 100644 index 00000000..923772cb --- /dev/null +++ b/lib/splib2/linkedlist/SPListAdd.asm @@ -0,0 +1,102 @@ +; +; void ListAdd(LIST *list, void *item, uchar nodeQueue) +; Alvin Albrecht 02.2003 +; + +XLIB SPListAdd +LIB SPListAppend, SPListPrepend, SPemptylistadd +XREF SPListAppend2, SPListPrepend2 +defw SPListAppend, SPListPrepend + +; enter: de = LIST * +; bc = item * +; hl = address of new sp_ListNode container +; exit : new item inserted after current, current points at new item +; uses : af, bc, de, hl + +.SPListAdd + ld (hl),c + inc hl + ld (hl),b ; store user item into new NODE + inc hl ; hl = new NODE.next + ex de,hl ; hl = LIST*, de = new NODE.next + ld a,(hl) + inc (hl) ; increase item count + inc hl + jp nz, noinchi + inc (hl) + jp cont +.noinchi + or (hl) ; hl = LIST.count+1, de = new NODE.next, item count & item done + jp z, SPemptylistadd ; if there are no items in list jump to emptylistadd helper +.cont + inc hl ; hl = LIST.state, de = new NODE.next, item count & item done + ld a,(hl) + or a + jp z, SPListPrepend2 ; if current points before start of list + dec a + jp nz, SPListAppend2 ; if current points past end of list + inc hl ; hl = LIST.current + + ; adding into non-empty list -- insert after current item + ; hl = LIST.current, de = new NODE.next + + push hl ; save LIST.current + ld a,(hl) + inc hl + ld l,(hl) + ld h,a ; hl = current NODE + inc hl + inc hl ; hl = current NODE.next + ldi + ldi ; copy current NODE.next into new NODE.next + dec hl ; hl = current NODE.next + 1 + push de ; save new NODE.prev + dec de + dec de + dec de + dec de ; de = new NODE + ld (hl),e + dec hl ; hl = current NODE.next + ld (hl),d ; current NODE.next = new NODE + dec hl + dec hl ; hl = current NODE + ex de,hl ; de = current NODE, hl = new NODE + ex (sp),hl ; hl = new NODE.prev, stack = new NODE then LIST.current + ld (hl),d + inc hl ; hl = new NODE.prev + 1 + ld (hl),e ; new NODE.prev = current NODE + dec hl + dec hl ; hl = new NODE.next + 1 + ld e,(hl) + dec hl + ld d,(hl) ; de = next NODE, hl = new NODE.next + ld a,d + or a + jr z, newtail ; if there is no next node, this is the new tail of the list + ld hl,4 + add hl,de ; hl = next NODE.prev + pop de ; de = new NODE + ld (hl),d + inc hl + ld (hl),e ; next NODE.prev = new NODE + + pop hl ; hl = LIST.current + ld (hl),d + inc hl + ld (hl),e ; current = new NODE + ret + +.newtail ; hl = new NODE.next, stack = new NODE then LIST.current + pop de ; de = new NODE + pop hl ; hl = LIST.current + ld (hl),d + inc hl + ld (hl),e ; current = new NODE + inc hl + inc hl + inc hl + ld (hl),d + inc hl + ld (hl),e ; tail = new NODE + ret diff --git a/lib/splib2/linkedlist/SPListAdd.o b/lib/splib2/linkedlist/SPListAdd.o new file mode 100644 index 00000000..c32da8eb Binary files /dev/null and b/lib/splib2/linkedlist/SPListAdd.o differ diff --git a/lib/splib2/linkedlist/SPListAppend.asm b/lib/splib2/linkedlist/SPListAppend.asm new file mode 100644 index 00000000..adb61792 --- /dev/null +++ b/lib/splib2/linkedlist/SPListAppend.asm @@ -0,0 +1,68 @@ +; +; void ListAppend(LIST *list, void *item, uchar nodeQueue) +; Alvin Albrecht 02.2003 +; + +XLIB SPListAppend +XDEF SPListAppend2 +LIB SPemptylistadd + +; enter: de = LIST * +; bc = item * +; hl = address of new sp_ListNode container +; exit : new item appended to end of list, current points at new item +; uses : af, bc, de, hl + +.SPListAppend + ld (hl),c + inc hl + ld (hl),b ; store user item into new NODE + inc hl ; hl = new NODE.next + ex de,hl ; hl = LIST*, de = new NODE.next + ld a,(hl) + inc (hl) ; increase item count + inc hl + jp nz, noinchi + inc (hl) + jp cont +.noinchi + or (hl) ; hl = LIST.count+1, de = new NODE.next, item count & item done + jp z, SPemptylistadd ; if there are no items in list jump to emptylistadd helper +.cont + inc hl ; hl = LIST.state, de = new NODE.next, item count & item done +.SPListAppend2 + ld (hl),1 ; current INLIST + inc hl + dec de + dec de ; de = new NODE + push de ; save new NODE + ld (hl),d + inc hl + ld (hl),e ; current = new NODE + inc hl + inc hl + inc hl ; hl = tail + inc de + inc de ; de = new NODE.next + xor a + ld (de),a + inc de + ld (de),a ; new NODE.next = NULL + inc de ; de = new NODE.prev + ldi + ldi ; new NODE.prev = tail + dec hl + ld e,(hl) + dec hl ; hl = tail + ld d,(hl) ; de = old tail NODE + pop bc ; bc = new NODE + ld (hl),b + inc hl + ld (hl),c ; tail = new NODE + ex de,hl ; hl = old tail NODE + inc hl + inc hl ; hl = old tail NODE.next + ld (hl),b + inc hl + ld (hl),c ; old tail NODE.next = new NODE + ret diff --git a/lib/splib2/linkedlist/SPListAppend.o b/lib/splib2/linkedlist/SPListAppend.o new file mode 100644 index 00000000..142e84f4 Binary files /dev/null and b/lib/splib2/linkedlist/SPListAppend.o differ diff --git a/lib/splib2/linkedlist/SPListConcat.asm b/lib/splib2/linkedlist/SPListConcat.asm new file mode 100644 index 00000000..d6903719 --- /dev/null +++ b/lib/splib2/linkedlist/SPListConcat.asm @@ -0,0 +1,144 @@ +; +; void ListConcat(LIST *list1, LIST *list2) +; Alvin Albrecht 02.2003 +; + +XLIB SPListConcat +XREF _u_free + +; enter: hl = list2, de = list1 +; exit : list1 = list1 concat list2, list2 is deleted +; uses : af, bc, de, hl + +.SPListConcat + push hl ; save list2 + ld a,(hl) + inc hl + or (hl) + jp z, list2nonempty + + ; list2 is empty, do nothing + + pop de + push de + ld hl,(_u_free) + call JPHL ; free(list2) + pop de + ret + +.list2nonempty + ex de,hl ; de = list2.count+1, hl = list1 + ld a,(hl) + inc hl + or (hl) + jp nz, list1nonempty + + ; list1 empty, copy list2 + + dec de + dec hl + ex de,hl ; hl = list2, de = list1 + ld bc,9 + ldir ; copy list2 into list1 + dec de + dec de + dec de + ex de,hl ; hl = list1.head+1 + ld e,(hl) + dec hl + ld d,(hl) ; de = list1 head + dec hl + ld (hl),e + dec hl + ld (hl),d ; list1.current = list1 head + dec hl + ld (hl),1 ; INLIST + pop de + push de + ld hl,(_u_free) + call JPHL ; free(list2) + pop de + ret + + ; both lists nonempty + +.list1nonempty ; de = list2.count+1, hl = list1.count+1 + dec de + dec hl + ld a,(de) + add a,(hl) + ld (hl),a + inc de + inc hl + ld a,(de) + adc a,(hl) + ld (hl),a ; ** list1 count += list2 count + inc hl ; hl = list1.state + inc de + inc de + inc de + inc de ; de = list2.head + ld a,(hl) + cp 2 ; ** state = AFTER? + jp nz, list1notafter + + ld (hl),1 ; ** list1.state = INLIST + inc hl + ld a,(de) + ld (hl),a + inc de ; de = list2.head+1 + inc hl ; hl = list1.current+1 + ld a,(de) + ld (hl),a ; ** list1 current = list2 head + dec de ; de = list2.head + inc hl + inc hl + inc hl ; hl = list1.tail + jp rejoin1 + +.list1notafter ; de = list2.head, hl = list1.state + ld bc,5 + add hl,de ; hl = list1.tail +.rejoin1 + ld b,(hl) + inc hl ; hl = list1.tail+1 + ld c,(hl) ; bc = list1 tail NODE + inc bc + inc bc ; bc = list1 tail NODE.next + ld a,(de) + ld (bc),a + inc de ; de = list2.head+1 + inc bc + ld a,(de) + ld (bc),a ; ** list1 tail NODE.next = list2 head NODE + + ex de,hl ; hl = list2.head+1, de = list1.tail+1 + ld c,(hl) + dec hl ; hl = list2.head + ld b,(hl) ; bc = list2 head NODE + inc bc + inc bc + inc bc + inc bc + inc bc ; bc = list2 head NODE.prev+1 + ld a,(de) + ld (bc),a + dec bc + dec de ; de = list1.tail + ld a,(de) + ld (bc),a ; ** list2 head NODE.prev = list1 tail NODE + + inc hl + inc hl ; hl = list2.tail + ldi + ldi ; ** list1 tail = list2 tail + + pop de + push de + ld hl,(_u_free) + call JPHL ; free(list2) + pop de + ret + +.JPHL + jp (hl) diff --git a/lib/splib2/linkedlist/SPListConcat.o b/lib/splib2/linkedlist/SPListConcat.o new file mode 100644 index 00000000..57575666 Binary files /dev/null and b/lib/splib2/linkedlist/SPListConcat.o differ diff --git a/lib/splib2/linkedlist/SPListCount.asm b/lib/splib2/linkedlist/SPListCount.asm new file mode 100644 index 00000000..eb29f815 --- /dev/null +++ b/lib/splib2/linkedlist/SPListCount.asm @@ -0,0 +1,17 @@ +; +; uint ListCount(LIST *list) +; Alvin Albrecht 02.2003 +; + +XLIB SPListCount + +; enter: hl = LIST * +; exit : de = # items in list +; uses : af, de + +.SPListCount + ld e,(hl) + inc hl + ld d,(hl) + dec hl + ret diff --git a/lib/splib2/linkedlist/SPListCount.o b/lib/splib2/linkedlist/SPListCount.o new file mode 100644 index 00000000..b8bb7f0e Binary files /dev/null and b/lib/splib2/linkedlist/SPListCount.o differ diff --git a/lib/splib2/linkedlist/SPListCreate.asm b/lib/splib2/linkedlist/SPListCreate.asm new file mode 100644 index 00000000..97867221 --- /dev/null +++ b/lib/splib2/linkedlist/SPListCreate.asm @@ -0,0 +1,35 @@ +; +; LIST *ListCreate(uchar listQueue) +; Alvin Albrecht 02.2003 +; + +XLIB SPListCreate +XDEF SPzerolist + +; enter: de = address of new sp_List container +; exit : hl = LIST* +; uses : af, de, hl + +.SPListCreate +.SPzerolist + ld l,e + ld h,d + xor a + ld (de),a + inc de + ld (de),a + inc de + ld (de),a + inc de + ld (de),a + inc de + ld (de),a + inc de + ld (de),a + inc de + ld (de),a + inc de + ld (de),a + inc de + ld (de),a + ret diff --git a/lib/splib2/linkedlist/SPListCreate.o b/lib/splib2/linkedlist/SPListCreate.o new file mode 100644 index 00000000..edf479a2 Binary files /dev/null and b/lib/splib2/linkedlist/SPListCreate.o differ diff --git a/lib/splib2/linkedlist/SPListCurr.asm b/lib/splib2/linkedlist/SPListCurr.asm new file mode 100644 index 00000000..7a880b8c --- /dev/null +++ b/lib/splib2/linkedlist/SPListCurr.asm @@ -0,0 +1,31 @@ +; +; void *ListCurr(LIST *list) +; Alvin Albrecht 02.2003 +; + +XLIB SPListCurr + +; enter: hl = LIST * +; exit : no carry = list empty or current points outside list +; de = current item in list +; uses : af, de, hl + +.SPListCurr + ld a,(hl) + inc hl + or (hl) + ret z ; nothing in list + inc hl + ld a,(hl) ; state of current pointer 0=BEFORE, 1=INLIST, 2=AFTER + dec a + ret nz ; if not INLIST, not pointing at an item, nc=failure + inc hl + ld d,(hl) + inc hl + ld e,(hl) ; de = current's NODE + ex de,hl + ld e,(hl) + inc hl + ld d,(hl) ; de = current NODE's item + scf + ret diff --git a/lib/splib2/linkedlist/SPListCurr.o b/lib/splib2/linkedlist/SPListCurr.o new file mode 100644 index 00000000..c918548e Binary files /dev/null and b/lib/splib2/linkedlist/SPListCurr.o differ diff --git a/lib/splib2/linkedlist/SPListFirst.asm b/lib/splib2/linkedlist/SPListFirst.asm new file mode 100644 index 00000000..7f61f79d --- /dev/null +++ b/lib/splib2/linkedlist/SPListFirst.asm @@ -0,0 +1,37 @@ +; +; void *ListFirst(LIST *list) +; Alvin Albrecht 02.2003 +; + +XLIB SPListFirst + +; enter: hl = LIST * +; exit : no carry = list empty +; de = item at start of list +; current pointer changed to point at first item in list +; uses : af, bc, de, hl + +.SPListFirst + ld a,(hl) + inc hl + or (hl) + ret z ; nothing in list + inc hl + ld (hl),1 ; current will be INLIST + inc hl + ld e,l + ld d,h ; de points at current + inc hl + inc hl ; hl points at head + ldi + ldi ; copy head to current + dec hl + ld e,(hl) + dec hl + ld d,(hl) ; de = NODE stored at head of list + ex de,hl + ld e,(hl) + inc hl + ld d,(hl) ; de = user's item + scf + ret diff --git a/lib/splib2/linkedlist/SPListFirst.o b/lib/splib2/linkedlist/SPListFirst.o new file mode 100644 index 00000000..8ae13eb3 Binary files /dev/null and b/lib/splib2/linkedlist/SPListFirst.o differ diff --git a/lib/splib2/linkedlist/SPListFree.asm b/lib/splib2/linkedlist/SPListFree.asm new file mode 100644 index 00000000..213f9dc5 --- /dev/null +++ b/lib/splib2/linkedlist/SPListFree.asm @@ -0,0 +1,61 @@ +; +; void ListFree(LIST *list, void (*itemfree)(void *item)) +; Alvin Albrecht 02.2003 +; + +XLIB SPListFree +XREF _u_free + +; enter: hl = LIST * +; bc = itemfree +; exit : The entire list is deleted. +; Itemfree is called once for each item in the list with +; de = item (and item on stack). +; uses : af, bc, de, hl + +.SPListFree + push hl ; save list + ld de,5 + add hl,de ; hl = head + +.while + ld a,(hl) + or a + jr z, done + inc hl + ld l,(hl) + ld h,a ; hl = next NODE + ld e,(hl) + inc hl ; hl = NODE.item+1 + ld d,(hl) ; de = item + push hl + push bc + push hl + push de ; push for C interface + ld l,c + ld h,b ; hl = itemfree function + ld a,h + or l + call nz, JPHL + pop de + pop de ; de = NODE.item+1 + dec de + push de + ld hl,(_u_free) + call JPHL ; free node container + pop de + pop bc + pop hl + inc hl + jp while + +.done + pop de ; de = list + ld hl,(_u_free) + push de + call JPHL ; free list container + pop de + ret + +.JPHL + jp (hl) diff --git a/lib/splib2/linkedlist/SPListFree.o b/lib/splib2/linkedlist/SPListFree.o new file mode 100644 index 00000000..2d9bf1d4 Binary files /dev/null and b/lib/splib2/linkedlist/SPListFree.o differ diff --git a/lib/splib2/linkedlist/SPListInsert.asm b/lib/splib2/linkedlist/SPListInsert.asm new file mode 100644 index 00000000..8b1a7554 --- /dev/null +++ b/lib/splib2/linkedlist/SPListInsert.asm @@ -0,0 +1,23 @@ +; +; void ListInsert(LIST *list, void *item, uchar nodeQueue) +; Alvin Albrecht 02.2003 +; + +XLIB SPListInsert +LIB SPListAdd, SPListPrev + +; enter: de = LIST * +; bc = item * +; hl = address of new sp_ListNode container +; exit : new item inserted before current, current points at new item +; uses : af, bc, de, hl + +.SPListInsert + push de + push bc + push hl + call SPListPrev ; move current pointer to previous item + pop hl + pop bc + pop de + jp SPListAdd diff --git a/lib/splib2/linkedlist/SPListInsert.o b/lib/splib2/linkedlist/SPListInsert.o new file mode 100644 index 00000000..063fcd50 Binary files /dev/null and b/lib/splib2/linkedlist/SPListInsert.o differ diff --git a/lib/splib2/linkedlist/SPListLast.asm b/lib/splib2/linkedlist/SPListLast.asm new file mode 100644 index 00000000..d49ded39 --- /dev/null +++ b/lib/splib2/linkedlist/SPListLast.asm @@ -0,0 +1,37 @@ +; +; void *ListLast(LIST *list) +; Alvin Albrecht 02.2003 +; + +XLIB SPListLast + +; enter: hl = LIST * +; exit : no carry = list empty +; de = item at end of list +; current pointer changed to point at last item in list +; uses : af, bc, de, hl + +.SPListLast + ld a,(hl) + inc hl + or (hl) + ret z ; nothing in list + inc hl + ld (hl),1 ; current will be INLIST + inc hl + ld e,l + ld d,h ; de points at current + ld bc,4 + add hl,de ; hl points at tail + ldi + ldi ; copy tail to current + dec hl + ld e,(hl) + dec hl + ld d,(hl) ; de = NODE stored at tail of list + ex de,hl + ld e,(hl) + inc hl + ld d,(hl) ; de = user's item + scf + ret diff --git a/lib/splib2/linkedlist/SPListLast.o b/lib/splib2/linkedlist/SPListLast.o new file mode 100644 index 00000000..6aaa74ad Binary files /dev/null and b/lib/splib2/linkedlist/SPListLast.o differ diff --git a/lib/splib2/linkedlist/SPListNext.asm b/lib/splib2/linkedlist/SPListNext.asm new file mode 100644 index 00000000..4c084535 --- /dev/null +++ b/lib/splib2/linkedlist/SPListNext.asm @@ -0,0 +1,79 @@ +; +; void *ListNext(LIST *list) +; Alvin Albrecht 02.2003 +; + +XLIB SPListNext + +; enter: hl = LIST * +; exit : no carry = list empty or current pointer is past end of list +; de = next item after current in list +; current pointer changed to point at next item in list +; uses : af, bc, de, hl + +.SPListNext + ld a,(hl) + inc hl + or (hl) + ret z ; fail if no items in list + inc hl ; hl = state + ld a,(hl) ; 0 = BEFORE, 1 = INLIST, 2 = AFTER + or a + jr z, currbefore + dec a + ret nz ; return failure if current is AFTER end of list + + ; current pointer INLIST + + inc hl + ld d,(hl) + inc hl ; hl = current + 1 + ld e,(hl) ; de = NODE for current ptr + inc de + inc de ; de = NODE.next + ld a,(de) ; if NODE->next == NULL, moving past end of list + or a + jr z, movedpastend + ld b,a + inc de + ld a,(de) + ld e,a + ld d,b ; de = NODE->next + ld (hl),e + dec hl + ld (hl),d ; current ptr = next NODE + ex de,hl ; hl = next NODE + ld e,(hl) + inc hl + ld d,(hl) ; de = list item + scf + ret +.movedpastend ; hl = current+1, de = current NODE.next + ld (hl),0 + dec hl + ld (hl),0 ; mark current pointing at nothing + dec hl + ld (hl),2 ; mark current pointing after end of list + ret ; carry flag reset indicates failure + + ; current ptr BEFORE start of list + +.currbefore ; hl = state + ld (hl),1 ; mark current as INLIST + inc hl + ld e,l + ld d,h ; de = current + inc hl + inc hl ; hl = head + ldi + ldi ; copy head into current + ex de,hl ; hl = head + ld d,(hl) + inc hl + ld e,(hl) + ex de,hl ; hl = head's NODE + ld e,(hl) + inc hl + ld d,(hl) ; de = list item + scf + ret diff --git a/lib/splib2/linkedlist/SPListNext.o b/lib/splib2/linkedlist/SPListNext.o new file mode 100644 index 00000000..dc3a461a Binary files /dev/null and b/lib/splib2/linkedlist/SPListNext.o differ diff --git a/lib/splib2/linkedlist/SPListPrepend.asm b/lib/splib2/linkedlist/SPListPrepend.asm new file mode 100644 index 00000000..28909baf --- /dev/null +++ b/lib/splib2/linkedlist/SPListPrepend.asm @@ -0,0 +1,67 @@ +; +; void ListPrepend(LIST *list, void *item, uchar nodeQueue) +; Alvin Albrecht 02.2003 +; + +XLIB SPListPrepend +XDEF SPListPrepend2 +LIB SPemptylistadd + +; enter: de = LIST * +; bc = item * +; hl = address of new sp_ListNode container +; exit : new item prepended to start of list, current points at new item +; uses : af, bc, de, hl + +.SPListPrepend + ld (hl),c + inc hl + ld (hl),b ; store user item into new NODE + inc hl ; hl = new NODE.next + ex de,hl ; hl = LIST*, de = new NODE.next + ld a,(hl) + inc (hl) ; increase item count + inc hl + jp nz, noinchi + inc (hl) + jp cont +.noinchi + or (hl) ; hl = LIST.count+1, de = new NODE.next, item count & item done + jp z, SPemptylistadd ; if there are no items in list jump to emptylistadd helper +.cont + inc hl ; hl = LIST.state, de = new NODE.next, item count & item done +.SPListPrepend2 + ld (hl),1 ; current INLIST + inc hl + dec de + dec de ; de = new NODE + push de ; save new NODE + ld (hl),d + inc hl + ld (hl),e ; current = new NODE + inc hl ; hl = head + inc de + inc de ; de = new NODE.next + ldi + ldi ; new NODE.next = head, hl = tail + xor a + ld (de),a + inc de + ld (de),a ; new NODE.prev = NULL + dec hl + ld e,(hl) + dec hl ; hl = head + ld d,(hl) ; de = old head NODE + pop bc ; bc = new NODE + ld (hl),b + inc hl + ld (hl),c ; head = new NODE + ex de,hl ; hl = old head NODE + inc hl + inc hl + inc hl + inc hl ; hl = old head NODE.prev + ld (hl),b + inc hl + ld (hl),c ; old head NODE.prev = new NODE + ret diff --git a/lib/splib2/linkedlist/SPListPrepend.o b/lib/splib2/linkedlist/SPListPrepend.o new file mode 100644 index 00000000..3f0b4aa0 Binary files /dev/null and b/lib/splib2/linkedlist/SPListPrepend.o differ diff --git a/lib/splib2/linkedlist/SPListPrev.asm b/lib/splib2/linkedlist/SPListPrev.asm new file mode 100644 index 00000000..de753b4a --- /dev/null +++ b/lib/splib2/linkedlist/SPListPrev.asm @@ -0,0 +1,83 @@ +; +; void *ListPrev(LIST *list) +; Alvin Albrecht 02.2003 +; + +XLIB SPListPrev + +; enter: hl = LIST * +; exit : no carry = list empty or current pointer is before start of list +; de = prev item before current in list +; current pointer changed to point at prev item in list +; uses : af, bc, de, hl + +.SPListPrev + ld a,(hl) + inc hl + or (hl) + ret z ; fail if no items in list + inc hl ; hl = state + ld a,(hl) ; 0 = BEFORE, 1 = INLIST, 2 = AFTER + or a + ret z ; return failure if current is BEFORE start of list + dec a + jr nz, currafter ; if current pointer is past end of list + + ; current pointer INLIST + + inc hl + ld d,(hl) + inc hl ; hl = current + 1 + ld e,(hl) ; de = NODE for current ptr + inc de + inc de + inc de + inc de ; de = NODE.prev + ld a,(de) ; if NODE->prev == NULL, moving past start of list + or a + jr z, movedpaststart + ld b,a + inc de + ld a,(de) + ld e,a + ld d,b ; de = NODE->prev + ld (hl),e + dec hl + ld (hl),d ; current ptr = prev NODE + ex de,hl ; hl = prev NODE + ld e,(hl) + inc hl + ld d,(hl) ; de = list item + scf + ret +.movedpaststart ; hl = current+1, de = current NODE.prev + ld (hl),0 + dec hl + ld (hl),0 ; mark current pointing at nothing + dec hl + ld (hl),0 ; mark current pointing before start of list + ret ; carry flag reset indicates failure + + ; current ptr AFTER end of list + +.currafter ; hl = state + ld (hl),1 ; mark current as INLIST + inc hl + ld e,l + ld d,h ; de = current + inc hl + inc hl + inc hl + inc hl ; hl = tail + ldi + ldi ; copy tail into current + dec hl ; hl = tail+1 + ld e,(hl) + dec hl + ld d,(hl) + ex de,hl ; hl = tail's NODE + ld e,(hl) + inc hl + ld d,(hl) ; de = list item + scf + ret diff --git a/lib/splib2/linkedlist/SPListPrev.o b/lib/splib2/linkedlist/SPListPrev.o new file mode 100644 index 00000000..b09cba28 Binary files /dev/null and b/lib/splib2/linkedlist/SPListPrev.o differ diff --git a/lib/splib2/linkedlist/SPListRemove.asm b/lib/splib2/linkedlist/SPListRemove.asm new file mode 100644 index 00000000..3f1fa7b8 --- /dev/null +++ b/lib/splib2/linkedlist/SPListRemove.asm @@ -0,0 +1,144 @@ +; +; void *ListRemove(LIST *list) +; Alvin Albrecht 02.2003 +; + +XLIB SPListRemove +XREF _u_free + +; enter: hl = LIST * +; exit : no carry = list empty or current is not INLIST +; de = item removed +; remove current item from list, current moves to next item +; uses : af, bc, de, hl + +.SPListRemove + ld a,(hl) + ld c,a + inc hl + ld b,(hl) ; bc = count + or b + ret z ; return fail if list empty + inc hl + ld a,(hl) ; a = current's state = 1 INLIST, 0 BEFORE, 2 AFTER + dec a + ret nz ; return fail if current is not INLIST + + dec bc ; one less item in list + dec hl + ld (hl),b + dec hl + ld (hl),c ; ** store new count in list + inc hl + inc hl + inc hl ; hl = current + ld d,(hl) + inc hl ; hl = current + 1 + ld e,(hl) ; de = current NODE + push de ; save current NODE + ex de,hl ; hl = current NODE, de = current+1 + ld c,(hl) + inc hl + ld b,(hl) ; bc = item + push bc ; save item + inc hl ; hl = current NODE.next + ld b,(hl) + inc hl + ld c,(hl) ; bc = next NODE + inc hl ; hl = current NODE.prev + ex de,hl ; de = current NODE.prev, hl = current+1 + ld (hl),c + dec hl ; hl = current + ld (hl),b ; ** current = next NODE + push hl ; save current + ld a,b + or a + jr z, nonext ; if there is no next NODE + + ; there is a next node + ; hl = current, bc = next NODE, de = current NODE.prev + + ld hl,5 + add hl,bc ; hl = next NODE.prev + 1 + ex de,hl ; de = next NODE.prev + 1, hl = current NODE.prev + ld b,(hl) + inc hl ; hl = current NODE.prev + 1 + ld c,(hl) ; bc = prev NODE + ex de,hl ; de = current NODE.prev+1, hl = next NODE.prev+1 + ld (hl),c + dec hl ; hl = next NODE.prev + ld (hl),b ; ** next NODE.prev = prev NODE + ld de,-4 + add hl,de ; hl = next NODE, bc = prev NODE + +.rejoin1 + ld a,b + or a + jr z, noprev + + ; there is a previous node + ; hl = next NODE, bc = prev NODE + + inc bc + inc bc ; bc = prev NODE.next + ld a,h + ld (bc),a + inc bc + ld a,l + ld (bc),a ; ** prev NODE.next = next NODE + + pop hl ; pop current +.rejoin2 + pop bc ; pop item + pop de ; pop current NODE + push bc ; save item + push de ; save memory pointer parameter for C call + ld hl,(_u_free) + call JPHL ; void (*free)(sp_ListNode *de) + pop de + pop de ; pop item + scf + ret + + + ; removing first node in list + +.noprev ; hl = next NODE, bc = prev NODE + pop de + ex de,hl ; de = next NODE, hl = current + dec hl + ld a,d + or a ; if next NODE == NULL, list is emptying, make BEFORE + jr z, okaynext + ld a,1 ; INLIST +.okaynext + ld (hl),a ; state = INLIST or BEFORE + inc hl + inc hl + inc hl ; hl = head + ld (hl),d + inc hl + ld (hl),e ; ** head = next NODE + jp rejoin2 + + + ; removing last node in list + +.nonext ; hl = current, de = current NODE.prev + dec hl + ld (hl),2 ; current now points after end of list, state = AFTER + ld bc,5 + add hl,bc ; hl = tail + ex de,hl ; de = tail, hl = current NODE.prev + ld b,(hl) + inc hl + ld c,(hl) ; bc = prev NODE + ex de,hl ; hl = tail + ld (hl),b + inc hl + ld (hl),c ; ** tail = prev NODE + ld hl,0 ; hl = next NODE = NULL, bc = prev NODE + jp rejoin1 + +.JPHL + jp (hl) diff --git a/lib/splib2/linkedlist/SPListRemove.o b/lib/splib2/linkedlist/SPListRemove.o new file mode 100644 index 00000000..4cf569cf Binary files /dev/null and b/lib/splib2/linkedlist/SPListRemove.o differ diff --git a/lib/splib2/linkedlist/SPListSearch.asm b/lib/splib2/linkedlist/SPListSearch.asm new file mode 100644 index 00000000..e45dbf9d --- /dev/null +++ b/lib/splib2/linkedlist/SPListSearch.asm @@ -0,0 +1,64 @@ +; +; void *ListSearch(LIST *list, int (*match)(void *item1, void *item2), void *item1) +; Alvin Albrecht 02.2003 +; + +XLIB SPListSearch +LIB SPListCurr, SPListNext + +; enter: hl = list +; de = item1 +; bc = match +; exit : no carry = item not found, current points past end of list +; de = item found +; current points at found item +; +; Searches list of items from current item, calling user function "match" +; on each of them. If match returns with carry set the search stops. +; uses : af, bc, de, hl + +.SPListSearch + push hl ; save list + push bc ; save match + push de ; save item1 + call SPListCurr + +.loop + jr nc, fail ; de = next item to examine + pop bc ; bc = item1 + pop hl ; hl = match + push hl ; save match + push bc ; save item1 + + push bc ; pushes for C interface + push de + call JPHL ; call "match" + pop de + pop bc + jr c, matched ; match returns carry to stop iteration + + ld hl,4 + add hl,sp + ld e,(hl) + inc hl + ld d,(hl) + ex de,hl ; hl = list + call SPListNext + jp loop + +.fail + ld hl,6 + add hl,sp + ld sp,hl ; clear off stack + or a + ret ; no carry = fail + +.matched + ld hl,6 + add hl,sp + ld sp,hl + scf + ret + +.JPHL + jp (hl) diff --git a/lib/splib2/linkedlist/SPListSearch.o b/lib/splib2/linkedlist/SPListSearch.o new file mode 100644 index 00000000..81674496 Binary files /dev/null and b/lib/splib2/linkedlist/SPListSearch.o differ diff --git a/lib/splib2/linkedlist/SPListTrim.asm b/lib/splib2/linkedlist/SPListTrim.asm new file mode 100644 index 00000000..bce5ba7a --- /dev/null +++ b/lib/splib2/linkedlist/SPListTrim.asm @@ -0,0 +1,110 @@ +; +; void *ListTrim(LIST *list) +; Alvin Albrecht 02.2003 +; + +XLIB SPListTrim +LIB SPListCreate +XREF SPzerolist, _u_free +defw SPListCreate + +; enter: hl = LIST * +; exit : no carry = list empty +; de = last item in list +; last item removed from list and current points to new last item +; uses : af, bc, de, hl + +.SPListTrim + ld e,(hl) + inc hl + ld d,(hl) + ld a,d + or e + ret z ; fail if list empty + dec hl ; hl = list + dec de ; count = count - 1 + ld a,d + or e + jp nz, morethanone + + ; getting rid of only item in list + + push hl ; save list + ld de,5 + add hl,de ; hl = head + ld d,(hl) + inc hl + ld e,(hl) ; de = NODE + ex de,hl ; hl = NODE + ld e,(hl) + inc hl + ld d,(hl) ; de = item + push de ; save item + ex de,hl + dec de ; de = NODE + push de + ld hl,(_u_free) + call JPHL ; free NODE + pop de + pop hl + ex (sp),hl ; hl = list, stack = item + ex de,hl + call SPzerolist + pop de ; de = item + scf + ret + + ; more than one item in list + +.morethanone ; hl = list, de = new count + ld (hl),e + inc hl + ld (hl),d ; count-- + inc hl + ld (hl),1 ; state = INLIST + ld de,5 + add hl,de ; hl = tail + ld d,(hl) + inc hl ; hl = tail+1 + ld e,(hl) ; de = tail NODE + ex de,hl ; hl = tail NODE, de = tail+1 + ld c,(hl) + inc hl + ld b,(hl) ; bc = item + push bc ; save item + ld bc,4 + add hl,bc ; hl = tail NODE.prev+1 + ld c,(hl) + dec hl + ld b,(hl) ; bc = prev NODE + dec hl ; hl = tail NODE.next+1 + ex de,hl ; de = tail NODE.next+1, hl = tail+1 + ld (hl),c + dec hl ; hl = tail + ld (hl),b ; tail = prev NODE + dec hl + dec hl + dec hl ; hl = current+1 + ld (hl),c + dec hl ; hl = current + ld (hl),b ; current = prev NODE + ld l,c + ld h,b + inc hl + inc hl ; hl = prev NODE.next + ld (hl),0 + inc hl + ld (hl),0 ; prev NODE.next = NULL + dec de + dec de + dec de ; de = tail NODE + push de + ld hl,(_u_free) + call JPHL ; free tail NODE + pop de + pop de ; de = item + scf + ret + +.JPHL + jp (hl) diff --git a/lib/splib2/linkedlist/SPListTrim.o b/lib/splib2/linkedlist/SPListTrim.o new file mode 100644 index 00000000..fb6e67f9 Binary files /dev/null and b/lib/splib2/linkedlist/SPListTrim.o differ diff --git a/lib/splib2/linkedlist/SPemptylistadd.asm b/lib/splib2/linkedlist/SPemptylistadd.asm new file mode 100644 index 00000000..131e4352 --- /dev/null +++ b/lib/splib2/linkedlist/SPemptylistadd.asm @@ -0,0 +1,46 @@ +; +; SPemptylistadd Helper Function +; Alvin Albrecht 02.2003 +; + +XLIB SPemptylistadd + +; enter: hl = LIST.count+1 +; de = new NODE.next +; item stored in new NODE +; exit : initialize list data structures for one item +; carry set to indicate success + +.SPemptylistadd + dec hl + ld (hl),1 + inc hl + ld (hl),0 ; list count = 1 + inc hl + ld (hl),1 ; current is INLIST + inc hl ; hl = current + dec de + dec de ; de = new NODE + ld (hl),d + inc hl + ld (hl),e ; current = new NODE + inc hl + ld (hl),d + inc hl + ld (hl),e ; head = new NODE + inc hl + ld (hl),d + inc hl + ld (hl),e ; tail = new NODE + inc de + inc de ; de = new NODE.next + xor a + ld (de),a + inc de + ld (de),a ; new NODE.next = NULL + inc de + ld (de),a + inc de + ld (de),a ; new NODE.prev = NULL + scf + ret diff --git a/lib/splib2/linkedlist/SPemptylistadd.o b/lib/splib2/linkedlist/SPemptylistadd.o new file mode 100644 index 00000000..549a45f8 Binary files /dev/null and b/lib/splib2/linkedlist/SPemptylistadd.o differ diff --git a/lib/splib2/miscellaneous/SPBorder.asm b/lib/splib2/miscellaneous/SPBorder.asm new file mode 100644 index 00000000..e138377d --- /dev/null +++ b/lib/splib2/miscellaneous/SPBorder.asm @@ -0,0 +1,48 @@ +; +; Set Border Colour +; Alvin Albrecht 07.2003 +; + +INCLUDE "SPconfig.def" + +XLIB SPBorder +XDEF SPBorderClr + +.SPBorderClr +IF DISP_HIRES + defb $00 +ELSE + defb $07 +ENDIF + +; Set Border Colour +; +; Stores border colour in variable SPBorderClr. +; In hi-res mode, the "border colour" selects the +; paper colour with the ink colour selected by +; the Timex hardware. +; +; enter: a = border colour 0..7 +; exit : border colour changed +; +; used : af,c + +.SPBorder +IF !DISP_HIRES + and $07 + ld (SPBorderClr),a + out ($fe),a +ELSE + and $07 + ld (SPBorderClr),a + xor $07 + rlca + rlca + rlca + ld c,a + in a,($ff) + and $c7 + or c + out ($ff),a +ENDIF + ret diff --git a/lib/splib2/miscellaneous/SPBorder.o b/lib/splib2/miscellaneous/SPBorder.o new file mode 100644 index 00000000..ff5b4195 Binary files /dev/null and b/lib/splib2/miscellaneous/SPBorder.o differ diff --git a/lib/splib2/miscellaneous/SPInitialize.asm b/lib/splib2/miscellaneous/SPInitialize.asm new file mode 100644 index 00000000..1dc0a27f --- /dev/null +++ b/lib/splib2/miscellaneous/SPInitialize.asm @@ -0,0 +1,149 @@ +; +; Initialize Sprite Pack's Background Tile & Sprite Module +; Alvin Albrecht 06.2003 +; + +INCLUDE "SPconfig.def" +XLIB SPInitialize +LIB SPDisplayList, SPDirtyChars, SPTileArray + +; Initialize +; +; Performs the following sequence: +; +; 1. Clears display list to the "default background tile" +; 2. Marks the entire display list dirty so that it +; will be redrawn on the next update. +; 3. Creates the horizontal rotation tables. +; 4. Initializes the Tile Array, mapping the graphics to +; the ROM character set and the pallette (for Hi-Colour mode +; only) to a solid black on white. +; +; enter: e = default background tile # (graphic) +; d = default background pallette # (colour) +; + +.SPInitialize + + ; initialize display list + + ld hl,SPDisplayList + ld (hl),d + inc hl + ld (hl),e + inc hl + ld (hl),0 + inc hl + ld (hl),0 + ld hl,SPDisplayList + ld de,SPDisplayList+4 +IF DISP_HIRES + ld bc,4*(64*(SP_ROWEND-SP_ROWSTART)-1) +ELSE + ld bc,4*(32*(SP_ROWEND-SP_ROWSTART)-1) +ENDIF + ldir + + ; mark entire screen dirty + + ld hl,SPDirtyChars + ld de,SPDirtyChars+1 + ld (hl),$ff +IF DISP_HIRES + ld bc,8*(SP_ROWEND-SP_ROWSTART)-1 +ELSE + ld bc,4*(SP_ROWEND-SP_ROWSTART)-1 +ENDIF + ldir + + ; set up horizontal rotate table + + ld c,7 ; rotate by C +.rottbllp + ld a,c + add a,a + or SProtatetbl/256 + ld h,a + ld l,0 +.entrylp + ld b,c + ld e,l + xor a +.rotlp + srl e + rra + djnz rotlp + ld (hl),e + inc h + ld (hl),a + dec h + inc l + jp nz, entrylp + dec c + jp nz, rottbllp + + ; set display mode + +IF DISP_HIRES + ld a,$86 + out ($ff),a ; video mode 512x192, black on white, int enable +ENDIF +IF DISP_HICOLOUR + ld a,$82 + out ($ff),a ; hi-colour video mode, int enable +ENDIF + + ; initialize tile array + + ld hl,SPTileArray + ld de,15360 + ld b,0 +.loop + ld a,(hl) + ld (hl),e + inc h + ld c,a + or (hl) + jr nz, usertile + ld (hl),d +.cont1 +IF DISP_HICOLOUR + inc h + ld a,(hl) + ld (hl),BONW % 256 + inc h + ld c,a + or (hl) + jr nz, userpallette + ld (hl),BONW / 256 + dec h +.cont2 + dec h +ENDIF + dec h + inc hl + ld a,8 + add a,e + ld e,a + jp nc, noadd + inc d +.noadd + djnz loop + ret + +.usertile + dec h + ld (hl),c + inc h + jr cont1 +IF DISP_HICOLOUR +.userpallette + dec h + ld (hl),c + jr cont2 +ENDIF + +IF DISP_HICOLOUR +.BONW + defb 56,56,56,56,56,56,56,56 +ENDIF diff --git a/lib/splib2/miscellaneous/SPInitialize.o b/lib/splib2/miscellaneous/SPInitialize.o new file mode 100644 index 00000000..18c5823a Binary files /dev/null and b/lib/splib2/miscellaneous/SPInitialize.o differ diff --git a/lib/splib2/miscellaneous/SPIntIvals.asm b/lib/splib2/miscellaneous/SPIntIvals.asm new file mode 100644 index 00000000..a119f670 --- /dev/null +++ b/lib/splib2/miscellaneous/SPIntIvals.asm @@ -0,0 +1,101 @@ +; +; IntIvals +; Alvin Albrecht 03.2003 +; + +XLIB SPIntIvals +LIB SPPtInIval + +; Intersect Intervals +; +; Returns the intersection of two intervals [x1,x2] and [y1,y2]. +; +; NOTE: In cases where the result would be two disjoint intervals, +; only one is returned. +; +; enter: ix+0 = x1 low +; ix+1 = x1 hi +; ix+2 = x2 low +; ix+3 = x2 hi +; iy+0 = y1 low +; iy+1 = y1 hi +; iy+2 = y2 low +; iy+3 = y2 hi +; +; exit : carry = no intersection +; otherwise the resulting intersect interval is [bc,de] +; +; used : f, bc, de, hl + +.SPIntIvals + ld l,(ix+0) + ld h,(ix+1) ; hl = x1 + ld c,(iy+0) + ld b,(iy+1) ; bc = y1 + ld e,(iy+2) + ld d,(iy+3) ; de = y2 + push de ; save y2 + push hl ; save x1 + call SPPtInIval ; is x1 in [y1,y2]? + jr c, notinival ; if no + + + ; bc = y1, stack = x1 then y2 + + ld l,(ix+2) + ld h,(ix+3) ; hl = x2 + pop bc ; bc = x1 + sbc hl,bc + ex de,hl ; de = x2-x1 + pop hl ; hl = y2 + or a + sbc hl,bc ; hl = y2-x1 + or a + sbc hl,de ; if ((y2-x1) < (x2-x1)) set carry + jr c, retY2 +.retX2 + ld e,(ix+2) + ld d,(ix+3) ; return interval [bc,de] = [x1,x2] + ret +.retY2 + ld e,(iy+2) + ld d,(iy+3) + or a + ret ; return interval [bc,de] = [x1,y2] + + + ; bc = y1, stack = x1 then y2, carry flag set + +.notinival + ld l,c + ld h,b ; hl = y1 + pop bc ; bc = x1 + push hl ; save y1 + ld e,(ix+2) + ld d,(ix+3) ; de = x2 + push de ; save x2 + call SPPtInIval + jr c, failintival ; if (y1 not in [x1,x2]) then fail intersection + + + ; bc = x1, stack = x2 y1 y2 + + pop hl ; hl = x2 + pop bc ; bc = y1 + sbc hl,bc + ex de,hl ; de = x2-y1 + pop hl ; hl = y2 + or a + sbc hl,bc ; hl = y2-y1 + ex de,hl + or a + sbc hl,de ; if ((x2-y1) < (y2-y1)) set carry + jp nc, retY2 ; return [y1,y2] + or a + jp retX2 ; return [y1,x2] + +.failintival + pop hl + pop hl + pop hl + ret ; carry = no intersection diff --git a/lib/splib2/miscellaneous/SPIntIvals.o b/lib/splib2/miscellaneous/SPIntIvals.o new file mode 100644 index 00000000..16ee5603 Binary files /dev/null and b/lib/splib2/miscellaneous/SPIntIvals.o differ diff --git a/lib/splib2/miscellaneous/SPIntLargeRect.asm b/lib/splib2/miscellaneous/SPIntLargeRect.asm new file mode 100644 index 00000000..e9ac7ee2 --- /dev/null +++ b/lib/splib2/miscellaneous/SPIntLargeRect.asm @@ -0,0 +1,55 @@ +; +; IntLargeRect +; Alvin Albrecht 03.2003 +; + +XLIB SPIntLargeRect +LIB SPIntIvals + +; Intersect Large Rectangles +; +; enter: Rectangle #1: +; +; ix+0/1 xtop +; ix+2/3 xbot +; ix+4/5 xleft +; ix+6/7 xright +; +; Rectangle #2: +; +; iy+0/1 ytop +; iy+2/3 ybot +; iy+4/5 yleft +; iy+6/7 yright +; +; exit : carry = resulting rectangle is empty +; otherwise the result of the intersection is on stack: +; pop order = right, left, bottom, top + +.SPIntLargeRect + pop af + ex af,af' ; save return address in af' + call SPIntIvals ; intersect [xb,xt] and [yb,yt] + jr c, failintlarge2 ; if no intersection + push bc + push de ; save resulting [top,bot] on stack + ld bc,4 + add ix,bc + add iy,bc + call SPIntIvals ; intersect [xl,xr] and [yl,yr] + jr c, failintlarge1 ; if no intersection + push bc + push de ; save resulting [left,right] on stack + ex af,af' + push af ; restore return address + or a ; no carry = result is non-empty + ret + +.failintlarge1 + pop bc + pop de +.failintlarge2 + ex af,af' + push af ; restore return address + scf ; carry = empty result + ret diff --git a/lib/splib2/miscellaneous/SPIntLargeRect.o b/lib/splib2/miscellaneous/SPIntLargeRect.o new file mode 100644 index 00000000..56c40d51 Binary files /dev/null and b/lib/splib2/miscellaneous/SPIntLargeRect.o differ diff --git a/lib/splib2/miscellaneous/SPIntRect.asm b/lib/splib2/miscellaneous/SPIntRect.asm new file mode 100644 index 00000000..772d1193 --- /dev/null +++ b/lib/splib2/miscellaneous/SPIntRect.asm @@ -0,0 +1,138 @@ +; +; IntRect +; Alvin Albrecht 03.2003 +; + +XLIB SPIntRect +XDEF SPIntSmallIval, SPPtInSmallIval + +; Intersect Rectangles +; +; enter: Rectangle #1: +; +; B = row coord top left corner +; C = col coord top left corner +; D = row height in chars +; E = col width in chars +; +; Rectangle #2: +; +; (iy+0) = row coord top left corner +; (iy+1) = row coord bottom right corner + 1 +; (iy+2) = col coord top left corner +; (iy+3) = col coord bottom right corner + 1 +; +; exit : carry = resulting rectangle is empty +; B = row coord top left corner of intersection +; C = col coord top left corner of intersection +; D = row height in chars of intersection +; E = col width in chars of intersection +; +; WORST: 756 + +.SPIntRect + ld h,b ; h = Rect#1 row coord top + ld a,d + add a,b + dec a + ld l,a ; l = Rect#1 row coord bot + ld d,c ; d = Rect#1 col left + ld a,e + add a,c + dec a + ld e,a ; e = Rect#1 col right + ld b,(iy+0) ; b = Rect#2 row coord top + ld c,(iy+1) ; c = Rect#2 row coord bot+1 + dec c + push de + call SPIntSmallIval + pop de + ret c ; if no intersection + ex de,hl ; h = Rect#1 col left, l = Rect#1 col right, de = row result + ld b,(iy+2) ; b = Rect#2 col coord left + ld c,(iy+3) ; c = Rect#2 col coord right+1 + dec c + push de + call SPIntSmallIval + pop de + ret c ; if no intersection + + ; d = row coord top, e = row coord bot + ; h = col coord left, l = col coord right + + ld b,d ; set up registers for return result + ld c,h + ld a,e + sub d + inc a + ld d,a + ld a,l + sub h + inc a + ld e,a + or a + ret + +; intersect intervals [h,l] = [b,c] intersect [h,l] carry=no intersection +.SPIntSmallIval + ld a,b + ld d,h + ld e,l + call SPPtInSmallIval ; is b in [h,l] + jr c, tryotherway + + ld a,c ; b is left edge of intersection + sub b + ld d,a ; d = c-b + ld a,l + sub b ; a = l-b + cp d + ld h,b + ccf + ret nc + ld l,c + or a + ret + +.tryotherway + ld a,h + ld d,b + ld e,c + call SPPtInSmallIval ; is h in [b,c] + ret c ; if no, report no intersection + + ld a,l ; h is left edge of intersection + sub h + ld d,a ; d = l-h + ld a,c + sub h ; a = c-h + cp d + ret nc + ld l,c + or a + ret + + +; is a in the interval d-e? carry=no +.SPPtInSmallIval + ex af,af' + ld a,e ; does interval d-e wrap? + cp d + jr c, broken + + ex af,af' + cp d + ret c ; return fail if ae else success + +.broken + ex af,af' + cp d + ret nc ; return sucess if a>=d + ld d,a + ld a,e + cp d + ret ; return sucess if e>=a diff --git a/lib/splib2/miscellaneous/SPIntRect.o b/lib/splib2/miscellaneous/SPIntRect.o new file mode 100644 index 00000000..3a05ae3c Binary files /dev/null and b/lib/splib2/miscellaneous/SPIntRect.o differ diff --git a/lib/splib2/miscellaneous/SPMultDEA.asm b/lib/splib2/miscellaneous/SPMultDEA.asm new file mode 100644 index 00000000..6fb463ff --- /dev/null +++ b/lib/splib2/miscellaneous/SPMultDEA.asm @@ -0,0 +1,28 @@ +; +; MultDEA +; Alvin Albrecht 2002 +; + +XLIB SPMultDEA + +; Multiply 16 by 8 +; +; enter: DE = 16 bit multiplicand +; A = 8 bit multiplicand +; exit : HL = A*DE % 65536 +; used : F, B, HL +; time : 390 + +.SPMultDEA + ld hl,0 + ld b,8 + +.m8lp + add hl,hl + rlca + jr nc, noadd8 + add hl,de + +.noadd8 + djnz m8lp + ret diff --git a/lib/splib2/miscellaneous/SPMultDEA.o b/lib/splib2/miscellaneous/SPMultDEA.o new file mode 100644 index 00000000..bca394c6 Binary files /dev/null and b/lib/splib2/miscellaneous/SPMultDEA.o differ diff --git a/lib/splib2/miscellaneous/SPMultDEAC.asm b/lib/splib2/miscellaneous/SPMultDEAC.asm new file mode 100644 index 00000000..ae097f82 --- /dev/null +++ b/lib/splib2/miscellaneous/SPMultDEAC.asm @@ -0,0 +1,29 @@ +; +; MultDEAC +; Alvin Albrecht 2002 +; + +XLIB SPMultDEAC + +; Multiply 16 by 16 +; +; enter: DE = 16 bit multiplicand +; AC = 16 bit multiplicand +; exit : HL = AC*DE % 65536 +; used : AF, BC, HL +; time : 886 + +.SPMultDEAC + ld hl,0 + ld b,16 + +.m16lp + add hl,hl + sla c + rla + jr nc, noadd16 + add hl,de + +.noadd16 + djnz m16lp + ret diff --git a/lib/splib2/miscellaneous/SPMultDEAC.o b/lib/splib2/miscellaneous/SPMultDEAC.o new file mode 100644 index 00000000..b0421ce8 Binary files /dev/null and b/lib/splib2/miscellaneous/SPMultDEAC.o differ diff --git a/lib/splib2/miscellaneous/SPMultUnsigned.asm b/lib/splib2/miscellaneous/SPMultUnsigned.asm new file mode 100644 index 00000000..e7c0b1a1 --- /dev/null +++ b/lib/splib2/miscellaneous/SPMultUnsigned.asm @@ -0,0 +1,35 @@ + +; Fast Unsigned Multiply +; Thanks to Nick Fleming for the code. + +; Routine : fast_unsigned_multiply (unsigned) +; +; Before calling : bc = number to multiply +; de = number to multiply +; +; after calling : de = high word of result +; hl = low word of result +; +; registers changed : bc, de, hl, a, flags. +; +; Notes: +; -------- +; Does the sum de,hl = bc * de +; Based on the excellent multiply routines +; found in Rodney Zaks "Programming the z80" (Sybex) + +XLIB SPMultUnsigned + +.SPMultUnsigned + ld hl,0 + ld a,16 +.fumult + add hl,hl + rl e + rl d + jp nc, fum_noadd + add hl,bc +.fum_noadd + dec a + jp nz,fumult + ret diff --git a/lib/splib2/miscellaneous/SPMultUnsigned.o b/lib/splib2/miscellaneous/SPMultUnsigned.o new file mode 100644 index 00000000..0cbdc9a4 Binary files /dev/null and b/lib/splib2/miscellaneous/SPMultUnsigned.o differ diff --git a/lib/splib2/miscellaneous/SPPFill.asm b/lib/splib2/miscellaneous/SPPFill.asm new file mode 100644 index 00000000..20b229f5 --- /dev/null +++ b/lib/splib2/miscellaneous/SPPFill.asm @@ -0,0 +1,470 @@ +; +; SPFill +; + +INCLUDE "SPconfig.def" +XLIB SPPFill +LIB SPGetScrnAddr, SPPixelUp, SPPixelDown, SPCharLeft, SPCharRight + +; Patterned Flood Fill +; Alvin Albrecht 2002 +; +; +; This subroutine does a byte-at-a-time breadth-first patterned flood fill. +; It works by allocating a circular queue on the stack, with the size of the +; queue determined by an input parameter. The queue is divided into three +; contiguous blocks: the pattern block, the investigate block and the new block. +; The queue contains 3-byte structures (described below) with a special structure +; delimiting each block. The physical end of the queue is marked with a special +; byte. The contents of the queue grow down in memory. +; +; The pattern block holds pixels that have been blackened on screen and are +; only waiting to have the pattern applied to them before they are removed +; from the queue. +; +; The investigate block holds pixels that have been blackened on screen and +; are waiting to be investigated before they become part of the pattern +; block. 'Investigating' a pixel means trying to expand the fill in all +; four directions. Any successful expansion causes the new pixel to be +; added to the new block. +; +; The new block holds pixels that have been blackened on screen and are +; waiting to become part of the investigate block. The new block expands +; as the investigate block is investigated. +; +; The pattern fill algorithm follows these steps: +; 1. Examine the investigate block. Add new pixels to the new block if an +; expansion is possible. +; 2. Pattern the pattern block. All pixels waiting to be patterned are +; patterned on screen. +; 3. The investigate block becomes the pattern block. +; The new block becomes the investigate block. +; 4. Repeat until the investigate block is empty. +; +; The algorithm may bail out prematurely if the queue fills up. Bailing +; out causes any pending pixels in the queue to be patterned before the +; subroutine exits. If PFILL would continue to run by refusing to enter +; new pixels when the queue is full, there would be no guarantee that +; the subroutine would ever return. +; +; In English, the idea behind the patterned flood fill is simple. The +; start pixel grows out in a circular shape (actually a diamond). A +; fill boundary two pixels thick is maintained in that circular shape. +; The outermost boundary is the frontier, and is where the flood fill +; is growing from (ie the investigate block). The inner boundary is +; the pattern block, waiting to be patterned. A solid inner boundary +; is necessary to prevent the flood-fill frontier pixels from growing +; back toward the starting pixel through holes in the pattern. Once +; the frontier pixels are investigated, the innermost boundary is +; patterned. The newly investigated pixels become the outermost +; boundary (the investigate block) and the old investigate block becomes +; the new pattern block. +; +; Each entry in the queue is a 3-byte struct that grows down in memory: +; screen address (2-bytes, MSB first) +; fill byte (1-byte) +; A screen address with MSB < 0x40 is used to indicate the end of a block. +; A screen address with MSB >= 0x80 is used to mark the physical end of the Q. +; +; The fill pattern is a typical 8x8 pixel character, stored in 8 bytes. + +; enter: h = y coord, l = x coord, bc = max stack depth, de = address of fill pattern +; In hi-res mode, carry flag is most significant bit of x coord +; used : ix, af, bc, de, hl +; exit : no carry = success, carry = had to bail queue was too small +; stack: 3*bc+30 bytes, not including the call to PFILL or interrupts + +.SPPFill + push de ; save (pattern pointer) variable + dec bc ; we will start with one struct in the queue + push bc ; save max stack depth variable + + ld a,h + call SPGetScrnAddr ; de = screen address, b = pixel byte + ex de,hl ; hl = screen address + call bytefill ; b = fill byte + jr c, viable + pop bc + pop de + ret + +.viable + ex de,hl ; de = screen address, b = fill byte + ld hl,-7 + add hl,sp + push hl ; create pattern block pointer = top of queue + push hl + pop ix ; ix = top of queue + dec hl + dec hl + dec hl + push hl ; create investigate block pointer + ld hl,-12 + add hl,sp + push hl ; create new block pointer + + xor a + push af + dec sp ; mark end of pattern block + push de ; screen address and fill byte are + push bc ; first struct in investigate block + inc sp + push af + dec sp ; mark end of investigate block + + ld c,(ix+7) + ld b,(ix+8) ; bc = max stack depth - 1 + inc bc + ld l,c + ld h,b + add hl,bc ; space required = 3*BC (max depth) + 10 + add hl,bc ; but have already taken 9 bytes + ld c,l + ld b,h ; bc = # uninitialized bytes in queue + ld hl,0 + sbc hl,bc ; negate hl, additions above will not set carry + add hl,sp + ld (hl),0 ; zero last byte in queue + ld sp,hl ; move stack below queue + ld a,$80 + push af ; mark end of queue with $80 byte + inc sp + ld e,l + ld d,h + inc de + dec bc + ldir ; zero the uninitialized bytes in queue + +; NOTE: Must move the stack before clearing the queue, otherwise if an interrupt +; occurred, garbage could overwrite portions of the (just cleared) queue. + +; ix = top of queue, bottom of queue marked with 0x80 byte + +; Variables indexed by ix, LSB first: +; ix + 11/12 return address +; ix + 09/10 fill pattern pointer +; ix + 07/08 max stack depth +; ix + 05/06 pattern block pointer +; ix + 03/04 investigate block pointer +; ix + 01/02 new block pointer + +; A picture of memory at this point: +; +;+-----------------------+ higher addresses +;| | | +;|- return address -| \|/ +;| | V +;+-----------------------+ lower addresses +;| fill | +;|- pattern pointer -| +;| | +;+-----------------------+ +;| | +;|- max stack depth -| +;| | +;+-----------------------+ +;| | +;|- pattern block -| +;| | +;+-----------------------+ +;| | +;|- investigate block -| +;| | +;+-----------------------+ +;| | +;|- new block -| +;| | +;+-----------------------+ +;| end of block marker | <- ix = pattern block = top of queue +;| ? | +;| ? | +;+-----------------------+ +;| screen address MSB | <- investigate block +;| screen address LSB | +;| fill byte | +;+-----------------------+ +;| end of block marker | +;| ? | +;| ? | +;+-----------------------+ +;| 0 | <- new block +;| 0 | +;| 0 | +;+-----------------------+ +;| | +;| ...... | size is a multiple of 3 bytes +;| rest of queue | +;| all zeroed | +;| ...... | +;| | +;+-----------------------+ +;| 0x80 | <- sp, special byte marks end of queue +;+-----------------------+ + +.pfloop + ld l,(ix+3) + ld h,(ix+4) ; hl = investigate block + ld e,(ix+1) + ld d,(ix+2) ; de = new block + call investigate + ld (ix+1),e + ld (ix+2),d ; save new block + ld (ix+3),l + ld (ix+4),h ; save investigate block + + ld l,(ix+5) + ld h,(ix+6) ; hl = pattern block + ld c,(ix+7) + ld b,(ix+8) ; bc = max stack depth (available space) + call applypattern + ld (ix+7),c + ld (ix+8),b ; save stack depth + ld (ix+5),l + ld (ix+6),h ; save pattern block + + ld a,(hl) ; done if the investigate block was empty + cp 0x40 + jp nc, pfloop + +.endpfill + ld de,11 ; return address is at ix+11 + add ix,de + ld sp,ix + or a ; make sure carry is clear, indicating success + ret + +; IN/OUT: hl = investigate block, de = new block + +.investigate + ld a,(hl) + cp 0x80 ; bit 15 of screen addr set if time to wrap + jp c, inowrap + push ix + pop hl ; hl = ix = top of queue + ld a,(hl) + +.inowrap + cp 0x40 ; screen address < 0x4000 marks end of block + jp c, endinv ; are we done yet? + ld b,a + dec hl + ld c,(hl) ; bc = screen address + dec hl + ld a,(hl) ; a = fill byte + dec hl + push hl ; save spot in investigate block + ld l,c + ld h,b ; hl = screen address + ld b,a ; b = fill byte + +.goup + push hl ; save screen address + call SPPixelUp ; move screen address up one pixel + jr c, updeadend ; if went off-screen + push bc ; save fill byte + call bytefill + call c, addnew ; if up is not dead end, add this to new block + pop bc ; restore fill byte + +.updeadend + pop hl ; restore screen address + +.godown + push hl ; save screen address + call SPPixelDown ; move screen address down one pixel + jr c, downdeadend + push bc ; save fill byte + call bytefill + call c, addnew ; if down is not dead end, add this to new block + pop bc ; restore fill byte + +.downdeadend + pop hl ; restore screen address + +.goleft + bit 7,b ; can only move left if leftmost bit of fill byte set + jr z, goright + ld a,l + and 31 + jr nz, okleft + bit 5,h ; for hi-res mode: column = 1 if l=0 and bit 5 of h is set + jr z, goright + +.okleft + push hl ; save screen address + call SPCharLeft + push bc ; save fill byte + ld b,0x01 ; set rightmost pixel for incoming byte + call bytefill + call c, addnew ; if left is not dead end, add this to new block + pop bc ; restore fill byte + pop hl ; restore screen address + +.goright + bit 0,b ; can only move right if rightmost bit of fill byte set + jr z, nextinv + or a ; clear carry + call SPCharRight + jr c, nextinv ; went off screen + ld a,l + and 31 + jr z, nextinv ; wrapped around line + ld b,0x80 ; set leftmost pixel for incoming byte + call bytefill + call c, addnew ; if right is not dead end, add this to new block + +.nextinv + pop hl ; hl = spot in investigate block + jp investigate + +.endinv + dec hl + dec hl + dec hl ; investigate block now points at new block + + ld a,(de) ; check if new block is at end of queue + cp 0x80 + jr c, nowrapnew + defb 0xdd + ld e,l + defb 0xdd + ld d,h ; de = ix = top of queue + +.nowrapnew + xor a + ld (de),a ; store end marker for new block + dec de + dec de + dec de + ret + +; enter b = incoming byte, hl = screen address +; exit b = fill byte, screen blackened with fill byte + +.bytefill + ld a,b + xor (hl) ; zero out incoming pixels that + and b ; run into set pixels in display + ret z + +.bfloop + ld b,a + rra ; expand incoming pixels + ld c,a ; to the right and left + ld a,b ; within byte + add a,a + or c + or b + ld c,a + xor (hl) ; zero out pixels that run into + and c ; set pixels on display + cp b + jp nz, bfloop ; keep going until incoming byte does not change + + or (hl) + ld (hl),a ; fill byte on screen + scf ; indicate that this was a viable step + ret + +; add incoming fill byte and screen address to new block +; enter b = incoming byte, hl = screen address, de = new block + +.addnew + push hl ; save screen address + ld l,(ix+7) + ld h,(ix+8) ; hl = max stack depth + ld a,h + or l + jr z, bail ; no space in queue so bail! + dec hl ; available queue space decreases by one struct + ld (ix+7),l + ld (ix+8),h + pop hl ; hl = screen address + + ld a,(de) ; check if new block is at end of queue + cp 0x80 + jr c, annowrap + defb 0xdd + ld e,l + defb 0xdd + ld d,h ; de = ix = top of queue + +.annowrap + ex de,hl + ld (hl),d ; make struct, store screen address (2 bytes) + dec hl + ld (hl),e + dec hl + ld (hl),b ; store fill byte (1 byte) + dec hl + ex de,hl + ret + +; if the queue filled up, we need to bail. Bailing means patterning any set pixels +; which may still be on the display. If we didnt bail and tried to trudge along, +; there is no guarantee the fill would ever return. + +.bail + pop hl ; hl = screen address, b = fill byte + ld a,b + xor (hl) + ld (hl),a ; clear this byte on screen + + xor a + ld (de),a ; mark end of new block + + ld l,(ix+5) + ld h,(ix+6) ; hl = pattern block + call applypattern ; for pattern block + call applypattern ; for investigate block + call applypattern ; for new block + + ld de,11 ; return address is at ix+11 + add ix,de + ld sp,ix + scf ; indicate we had to bail + ret + +; hl = pattern block, bc = max stack depth (available space) + +.applypattern + ld a,(hl) + cp 0x80 ; bit 15 of screen addr set if time to wrap + jp c, apnowrap + push ix + pop hl ; hl = ix = top of queue + ld a,(hl) + +.apnowrap + cp 0x40 ; screen address < 0x4000 marks end of block + jr c, endapply ; are we done yet? + + and 0x07 ; use scan line 0..7 to index pattern + add a,(ix+9) + ld e,a + ld a,0 + adc a,(ix+10) + ld d,a ; de points into fill pattern + ld a,(de) ; a = pattern + + ld d,(hl) + dec hl + ld e,(hl) ; de = screen address + dec hl + + and (hl) ; and pattern with fill byte + sub (hl) ; or in complement of fill byte + dec a + ex de,hl + and (hl) ; apply pattern to screen + ld (hl),a + ex de,hl + dec hl + inc bc ; increase available queue space + jp applypattern + +.endapply + dec hl + dec hl + dec hl ; pattern block now pts at investigate block + ret diff --git a/lib/splib2/miscellaneous/SPPFill.o b/lib/splib2/miscellaneous/SPPFill.o new file mode 100644 index 00000000..39add33b Binary files /dev/null and b/lib/splib2/miscellaneous/SPPFill.o differ diff --git a/lib/splib2/miscellaneous/SPPtInIval.asm b/lib/splib2/miscellaneous/SPPtInIval.asm new file mode 100644 index 00000000..7154cae5 --- /dev/null +++ b/lib/splib2/miscellaneous/SPPtInIval.asm @@ -0,0 +1,47 @@ +; +; PointInIval +; Alvin Albrecht 03.2003 +; + +XLIB SPPtInIval + +; Point In Interval? +; +; Returns carry flag set if the point x is in [x1,x2]. +; +; enter: bc = x1 (left end of range, inclusive) +; de = x2 (right end of range, inclusive) +; hl = x +; +; exit : carry = point not in interval +; +; used : f, de, hl + +.SPPtInIval + push hl + ld l,e + ld h,d + or a + sbc hl,bc ; x2 - x1 + jr c, broken ; if (x2 < x1) goto broken + + pop hl + push hl + sbc hl,bc ; x - x1 + pop hl + ret c ; if (x < x1) return not in interval (carry) + ex de,hl + sbc hl,de ; x2 - x + ret ; if (x2 < x) return not in interval (carry) + +.broken + pop hl + push hl + or a + sbc hl,bc ; x - x1 + pop hl + ret nc ; if (x >= x1) return in interval (no carry) + ex de,hl + or a + sbc hl,de ; x2 - x + ret ; if (x <= x2) return in interval (no carry) diff --git a/lib/splib2/miscellaneous/SPPtInIval.o b/lib/splib2/miscellaneous/SPPtInIval.o new file mode 100644 index 00000000..aaca948d Binary files /dev/null and b/lib/splib2/miscellaneous/SPPtInIval.o differ diff --git a/lib/splib2/miscellaneous/SPPtInLargeRect.asm b/lib/splib2/miscellaneous/SPPtInLargeRect.asm new file mode 100644 index 00000000..65285197 --- /dev/null +++ b/lib/splib2/miscellaneous/SPPtInLargeRect.asm @@ -0,0 +1,40 @@ +; +; PtInLargeRect +; Alvin Albrecht 03.2003 +; + +XLIB SPPtInLargeRect +LIB SPPtInIval + +; Point In Large Rectangle? +; +; enter: Rectangle #1: +; +; ix+0/1 xtop +; ix+2/3 xbot +; ix+4/5 xleft +; ix+6/7 xright +; +; hl = y coordinate +; de = x coordinate +; +; exit : carry = not in rectangle +; +; used : f, bc, de, hl +; + +.SPPtInLargeRect + push de ; save x coordinate + ld c,(ix+0) + ld b,(ix+1) + ld e,(ix+2) + ld d,(ix+3) + call SPPtInIval ; is y in [xtop,xbot]? + pop hl + ret c ; return if fail + ld c,(ix+4) + ld b,(ix+5) + ld e,(ix+6) + ld d,(ix+7) + call SPPtInIval ; is x in [xleft,xright]? + ret diff --git a/lib/splib2/miscellaneous/SPPtInLargeRect.o b/lib/splib2/miscellaneous/SPPtInLargeRect.o new file mode 100644 index 00000000..281f1275 Binary files /dev/null and b/lib/splib2/miscellaneous/SPPtInLargeRect.o differ diff --git a/lib/splib2/miscellaneous/SPRandom32.asm b/lib/splib2/miscellaneous/SPRandom32.asm new file mode 100644 index 00000000..8a493daa --- /dev/null +++ b/lib/splib2/miscellaneous/SPRandom32.asm @@ -0,0 +1,48 @@ + +; 32-Bit Random Number Generator +; Thanks to Nick Fleming for the code. + +; Routine : random_number +; +; Before calling : n/a +; +; after calling : de,hl = 32 bit "random" number. +; +; registers changed : de, a, hl, flags. +; +; Notes: +; -------- +; generates a 32 bit pseudo-random number from a seed +; variable. +; +; Uses the formula i(new) = a * i + c (mod 2^32) +; +; to generate some numbers. a and c are constants, and +; i is the 'seed' for the new number. +; +; IMPORTANT: I've not checked it for distributions or +; the period before it repeats. +; +; One of the problems is that most modern random number +; examples use 32 bits (even Knuth !!) so there isn't a lot +; of good data available for 16 bit generators. +; +; Ref : See the book 'numerical recipes in C' +; or online at http://lib-www.lanl.gov/numerical/bookcpdf.html +; for more info on random numbers. + +XLIB SPRandom32 +XDEF SPRand32Seed +LIB SPMultUnsigned + +.SPRand32Seed + defw 31415 ; chose 'pi' as starting seed :-) + +.SPRandom32 + ld bc,(SPRand32Seed) + ld de,16807 ; 7^5 + call SPMultUnsigned + ld bc,8343 + add hl,bc + ld (SPRand32Seed),hl ; store high word of result as new seed. + ret diff --git a/lib/splib2/miscellaneous/SPRandom32.o b/lib/splib2/miscellaneous/SPRandom32.o new file mode 100644 index 00000000..87e544a4 Binary files /dev/null and b/lib/splib2/miscellaneous/SPRandom32.o differ diff --git a/lib/splib2/miscellaneous/SPSwap.asm b/lib/splib2/miscellaneous/SPSwap.asm new file mode 100644 index 00000000..b9546b96 --- /dev/null +++ b/lib/splib2/miscellaneous/SPSwap.asm @@ -0,0 +1,20 @@ +; Swap Memory Blocks +; Alvin Albrecht 03.2003 +; + +XLIB SPSwap + +; An overlap-safe swap of two memory blocks. +; +; enter: bc = # bytes to swap +; hl = address of block 1 +; de = address of block 2 + +.SPSwap + ld a,(de) + ldi + dec hl + ld (hl),a + inc hl + jp pe, SPSwap + ret diff --git a/lib/splib2/miscellaneous/SPSwap.o b/lib/splib2/miscellaneous/SPSwap.o new file mode 100644 index 00000000..e8401097 Binary files /dev/null and b/lib/splib2/miscellaneous/SPSwap.o differ diff --git a/lib/splib2/readme b/lib/splib2/readme new file mode 100644 index 00000000..2e08e06f --- /dev/null +++ b/lib/splib2/readme @@ -0,0 +1,104 @@ + +Sprite Pack V2.2 + +Game Engine for Sinclair and Timex Computers +Alvin Albrecht 09.2003 + +http://www.geocities.com/aralbrec +The website is still a mess but is being worked on. A +nearly complete tutorial is now available there. + +SP supports four different video modes: the normal +Spectrum display mode (256x192 pixel, 32x24 colour), +the Timex hi-colour mode (256x192 pixel, 32x192 colour), +the Timex hi-res mode (512x192 pixel monochrome) +and the Timex dual screen mode (double buffered Spectrum +display). You must select the appropriate mode you +are interested in prior to compiling the library. +Needless to say, you will need a Timex machine or an +emulated Timex machine to run programs using anything +other than the Spectrum display mode. + + +Installation Steps: + +To compile a fresh library with customizable settings. +(Some versions of the library have been compiled for +you already -- see below). +1. Edit "SPconfig.def" file to select lib configuration. +2. Run "Makefile.bat" to compile lib. + +To copy the lib into standard directories so that it +can be found by the linker. +3. Enter "copy splib2.lib \z88dk\lib\clibs" +4. Enter "copy spritepack.h \z88dk\include" + +NOTE to non-msdos users: the "makefile" batch program needs +modification to work on anything else. Yes, I will get +a real makefile utility sometime in the future. A few +pre-compiled libraries are sitting in the main directory +for your convenience. "splib2a.lib", "splib2b.lib", +"splib2c.lib" and "splib2d.lib" are pre-compiled libraries +supporting the Spectrum, dual-screen, hi-colour and +hi-res video modes respectively. Rename the lib +of interest to "splib2.lib" and copy it to the correct +destination directory as in step 3 above. The default +settings used are in the file "SPconfig.def". + +Now compile C or assembler programs as usual, remembering +to include the "spritepack.h" header in your source files and +to link to the library with "-lsplib2" in the compile command. +Eg: zcc +zx -vn myprog.c -o myprog.bin -lsplib2 -lndos + +You have the right to use and abuse this software as +you see fit but please include an acknowledgement in +your projects. + + +IMPORTANT: + +The following functions use the IY register: + +sp_PrintString() + +sp_IterateSprChar() +sp_MoveSprAbs*() +sp_MoveSprRel*() + +sp_IntRect() +sp_IntIntervals() +sp_IntLargeRect() + +sp_IterateDList() +sp_Invalidate() +sp_Validate() + +Basic's interrupt service routine expects the IY +register to remain unchanged. This means that if +any of these functions are called, interrupts must +either be disabled or you must replace the Basic +ISR with one of your own. Otherwise your programs +will crash. + + +CREDITS: + +February 6, 2003 + Chris Cowley for much improved Kempston Mouse support based + on code found in his Basic mouse driver. The improved code + causes the mouse to stay within screen boundaries rather + than loop across screen boundaries. It also allows pixel size + mouse movements in the 512x192 hi-res mode. + .\input\SPMouseKempston.asm + +March 29, 2003 + Nick Fleming for the 32-bit random number generator + and an unsigned 32-bit multiply routine, both spotted + in his 2003 crap games competition entry 'Nun Chaser'. + .\miscellaneous\SPRandom32.asm + .\miscellaneous\SPMultUnsigned.asm + +August 29, 2003 + Jonathan Needle, author of Spectaculator, for providing + information on the AMX mouse. + .\input\SPMouseAMXInit.asm diff --git a/lib/splib2/screenaddress/SPCharDown.asm b/lib/splib2/screenaddress/SPCharDown.asm new file mode 100644 index 00000000..ff6d6f1b --- /dev/null +++ b/lib/splib2/screenaddress/SPCharDown.asm @@ -0,0 +1,33 @@ +; +; CharDown +; Alvin Albrecht 2002 +; + +INCLUDE "SPconfig.def" +XLIB SPCharDown + +; Char Down +; +; Adjusts screen address HL to move eight pixels down on the display. +; +; enter: HL = valid screen address +; exit : Carry = moved off screen +; HL = moves one character down +; used : AF, HL + +.SPCharDown + ld a,l + add a,$20 + ld l,a + ret nc + ld a,h + add a,$08 + ld h,a +IF DISP_HIRES + and $18 + cp $18 +ELSE + cp $58 +ENDIF + ccf + ret diff --git a/lib/splib2/screenaddress/SPCharDown.o b/lib/splib2/screenaddress/SPCharDown.o new file mode 100644 index 00000000..d0fa6702 Binary files /dev/null and b/lib/splib2/screenaddress/SPCharDown.o differ diff --git a/lib/splib2/screenaddress/SPCharLeft.asm b/lib/splib2/screenaddress/SPCharLeft.asm new file mode 100644 index 00000000..216798c7 --- /dev/null +++ b/lib/splib2/screenaddress/SPCharLeft.asm @@ -0,0 +1,54 @@ +; +; CharLeft +; Alvin Albrecht 2002 +; + +INCLUDE "SPconfig.def" +XLIB SPCharLeft + +; Char Left +; +; Adjusts screen address HL to move one character to the left +; on the display. Start of line wraps to the previous row. +; +; enter: HL = valid screen address +; Carry reset +; exit : Carry = moved off screen +; HL = moves one character left, with line wrap +; used : AF, HL + +IF !DISP_HIRES + +.SPCharLeft + ld a,l + dec l + or a + ret nz + ld a,h + sub $08 + ld h,a + cp $40 + ret + +ELSE + +.SPCharLeft + ld a,h + xor $20 + ld h,a + cp $58 + ccf + ret nc + ld a,l + dec l + or a + ret nz + ld a,h + sub $08 + ld h,a + and $18 + cp $18 + ccf + ret + +ENDIF diff --git a/lib/splib2/screenaddress/SPCharLeft.o b/lib/splib2/screenaddress/SPCharLeft.o new file mode 100644 index 00000000..795ff825 Binary files /dev/null and b/lib/splib2/screenaddress/SPCharLeft.o differ diff --git a/lib/splib2/screenaddress/SPCharRight.asm b/lib/splib2/screenaddress/SPCharRight.asm new file mode 100644 index 00000000..a6f8982b --- /dev/null +++ b/lib/splib2/screenaddress/SPCharRight.asm @@ -0,0 +1,49 @@ +; +; CharRight +; Alvin Albrecht 2002 +; + +INCLUDE "SPconfig.def" +XLIB SPCharRight + +; Char Right +; +; Adjusts screen address HL to move one character to the right +; on the display. End of line wraps to the next row. +; +; enter: HL = valid screen address +; Carry reset +; exit : Carry = moved off screen +; HL = moves one character right, with line wrap +; used : AF, HL + +IF !DISP_HIRES + +.SPCharRight + inc l + ret nz + ld a,8 + add a,h + ld h,a + cp $58 + ccf + ret + +ELSE + +.SPCharRight + ld a,h + xor $20 + ld h,a + cp $58 + ret nc + inc l + ret nz + ld a,8 + add a,h + ld h,a + cp $58 + ccf + ret + +ENDIF diff --git a/lib/splib2/screenaddress/SPCharRight.o b/lib/splib2/screenaddress/SPCharRight.o new file mode 100644 index 00000000..e14a1e12 Binary files /dev/null and b/lib/splib2/screenaddress/SPCharRight.o differ diff --git a/lib/splib2/screenaddress/SPCharUp.asm b/lib/splib2/screenaddress/SPCharUp.asm new file mode 100644 index 00000000..1b029082 --- /dev/null +++ b/lib/splib2/screenaddress/SPCharUp.asm @@ -0,0 +1,33 @@ +; +; CharUp +; Alvin Albrecht 2002 +; + +INCLUDE "SPconfig.def" +XLIB SPCharUp + +; Char Up +; +; Adjusts screen address HL to move eight pixels up on the display. +; +; enter: HL = valid screen address +; exit : Carry = moved off screen +; HL = moves one character up +; used : AF, HL + +.SPCharUp + ld a,l + sub $20 + ld l,a + ret nc + ld a,h + sub $08 + ld h,a +IF DISP_HIRES + and $18 + cp $18 + ccf +ELSE + cp $40 +ENDIF + ret diff --git a/lib/splib2/screenaddress/SPCharUp.o b/lib/splib2/screenaddress/SPCharUp.o new file mode 100644 index 00000000..f657cf61 Binary files /dev/null and b/lib/splib2/screenaddress/SPCharUp.o differ diff --git a/lib/splib2/screenaddress/SPGetAttrAddr.asm b/lib/splib2/screenaddress/SPGetAttrAddr.asm new file mode 100644 index 00000000..ca8475d3 --- /dev/null +++ b/lib/splib2/screenaddress/SPGetAttrAddr.asm @@ -0,0 +1,48 @@ +; +; GetAttrAddr +; Alvin Albrecht 2002 +; + +INCLUDE "SPconfig.def" +XLIB SPGetAttrAddr + +; Get Attribute Address +; +; Computes the attribute address corresponding to a screen +; address such as returned by 'GetCharAddr' or 'GetScrnAddr'. +; +; enter: hl = screen address +; exit : de = address of attribute square +; uses : af, de + +IF DISP_SPECTRUM + +.SPGetAttrAddr + ld e,l + ld a,h + or $07 + xor $85 + rrca + rrca + rrca + ld d,a + ret + +ELSE +IF DISP_HICOLOUR + +.SPGetAttrAddr + ld e,l + ld d,h + set 5,d + ret + +ELSE + +.SPGetAttrAddr + ld e,l + ld d,h + ret ; There are no attributes in hi-res mode + +ENDIF +ENDIF diff --git a/lib/splib2/screenaddress/SPGetAttrAddr.o b/lib/splib2/screenaddress/SPGetAttrAddr.o new file mode 100644 index 00000000..ef9494aa Binary files /dev/null and b/lib/splib2/screenaddress/SPGetAttrAddr.o differ diff --git a/lib/splib2/screenaddress/SPGetCharAddr.asm b/lib/splib2/screenaddress/SPGetCharAddr.asm new file mode 100644 index 00000000..b5db33cb --- /dev/null +++ b/lib/splib2/screenaddress/SPGetCharAddr.asm @@ -0,0 +1,56 @@ +; +; GetCharAddr +; Alvin Albrecht 2002 +; + +INCLUDE "SPconfig.def" +XLIB SPGetCharAddr + +; Get Character Address +; +; Computes the screen address of the top of a character square. +; (0,0) is located at the top left corner of the screen. +; +; enter: h = y coord 0..23, l = x coord 0..31 (0..63 for hi-res mode) +; exit : hl = screen address +; uses : af,c,hl + +IF !DISP_HIRES + +.SPGetCharAddr + ld a,h + rrca + rrca + rrca + and $e0 + or l + ld l,a + ld a,h + and $18 + or $40 + ld h,a + ret + +ELSE + +.SPGetCharAddr + ld a,h + and $18 + or $40 + srl l + jr nc, notodd + or $20 + +.notodd + ld c,a + ld a,h + rrca + rrca + rrca + and $e0 + or l + ld l,a + ld h,c + ret + +ENDIF diff --git a/lib/splib2/screenaddress/SPGetCharAddr.o b/lib/splib2/screenaddress/SPGetCharAddr.o new file mode 100644 index 00000000..f837af1f Binary files /dev/null and b/lib/splib2/screenaddress/SPGetCharAddr.o differ diff --git a/lib/splib2/screenaddress/SPGetScrnAddr.asm b/lib/splib2/screenaddress/SPGetScrnAddr.asm new file mode 100644 index 00000000..19a76e8f --- /dev/null +++ b/lib/splib2/screenaddress/SPGetScrnAddr.asm @@ -0,0 +1,105 @@ +; +; GetScrnAddr +; Alvin Albrecht 2002 +; + +INCLUDE "SPconfig.def" +XLIB SPGetScrnAddr + +; Get Screen Address +; +; Computes the screen address given a valid pixel coordinate. +; (0,0) is located at the top left corner of the screen. +; +; enter: a = h = y coord +; l = x coord +; In hi-res mode, Carry is most significant bit of x coord (0..511 pixels) +; exit : de = screen address, b = pixel mask +; uses : af, b, de, hl + +IF !DISP_HIRES + +.SPGetScrnAddr + and $07 + or $40 + ld d,a + ld a,h + rra + rra + rra + and $18 + or d + ld d,a + + ld a,l + and $07 + ld b,a + ld a,$80 + jr z, norotate + +.rotloop + rra + djnz rotloop + +.norotate + ld b,a + srl l + srl l + srl l + ld a,h + rla + rla + and $e0 + or l + ld e,a + ret + +ELSE + +.SPGetScrnAddr + ld b,0 + ld d,b + rr l + rl b + srl l + rl b + srl l + rl b + srl l + jr nc, notodd + ld d,$20 + +.notodd + ld a,b + or a + ld a,$80 + jr z, norotate + +.rotloop + rra + djnz rotloop + +.norotate + ld b,a + ld a,h + and $07 + or $40 + or d + ld d,a + ld a,h + rra + rra + rra + and $18 + or d + ld d,a + + ld a,h + rla + rla + and $e0 + or l + ld e,a + ret + +ENDIF diff --git a/lib/splib2/screenaddress/SPGetScrnAddr.o b/lib/splib2/screenaddress/SPGetScrnAddr.o new file mode 100644 index 00000000..982c19de Binary files /dev/null and b/lib/splib2/screenaddress/SPGetScrnAddr.o differ diff --git a/lib/splib2/screenaddress/SPPixelDown.asm b/lib/splib2/screenaddress/SPPixelDown.asm new file mode 100644 index 00000000..146619f8 --- /dev/null +++ b/lib/splib2/screenaddress/SPPixelDown.asm @@ -0,0 +1,41 @@ +; +; PixelDown +; Alvin Albrecht 2002 +; + +INCLUDE "SPconfig.def" +XLIB SPPixelDown + +; Pixel Down +; +; Adjusts screen address HL to move one pixel down in the display. +; (0,0) is located at the top left corner of the screen. +; +; enter: HL = valid screen address +; exit : Carry = moved off screen +; HL = moves one pixel down +; used : AF, HL + +.SPPixelDown + inc h + ld a,h + and $07 + ret nz + ld a,h + sub $08 + ld h,a + ld a,l + add a,$20 + ld l,a + ret nc + ld a,h + add a,$08 + ld h,a +IF DISP_HIRES + and $18 + cp $18 +ELSE + cp $58 +ENDIF + ccf + ret diff --git a/lib/splib2/screenaddress/SPPixelDown.o b/lib/splib2/screenaddress/SPPixelDown.o new file mode 100644 index 00000000..161aa66c Binary files /dev/null and b/lib/splib2/screenaddress/SPPixelDown.o differ diff --git a/lib/splib2/screenaddress/SPPixelLeft.asm b/lib/splib2/screenaddress/SPPixelLeft.asm new file mode 100644 index 00000000..2e03acd6 --- /dev/null +++ b/lib/splib2/screenaddress/SPPixelLeft.asm @@ -0,0 +1,44 @@ +; +; PixelLeft +; Alvin Albrecht 06.2003 +; + +INCLUDE "SPconfig.def" +XLIB SPPixelLeft + +; Pixel Left +; +; Adjusts screen address HL and pixel mask B to move left +; one pixel on screen. +; +; enter: HL = valid screen address +; B = pixel mask for screen byte +; exit : Carry = moved off screen +; HL, B moved left one pixel +; used : AF, HL + +.SPPixelLeft +IF !DISP_HIRES + rlc b + ret nc + ld a,l + dec l + and $1f + ret nz + scf + ret +ELSE + rlc b + ret nc + ld a,h + xor $20 + ld h,a + and $20 + ret z + ld a,l + dec l + and $1f + ret nz + scf + ret +ENDIF diff --git a/lib/splib2/screenaddress/SPPixelLeft.o b/lib/splib2/screenaddress/SPPixelLeft.o new file mode 100644 index 00000000..d77ed598 Binary files /dev/null and b/lib/splib2/screenaddress/SPPixelLeft.o differ diff --git a/lib/splib2/screenaddress/SPPixelRight.asm b/lib/splib2/screenaddress/SPPixelRight.asm new file mode 100644 index 00000000..51f9e3ae --- /dev/null +++ b/lib/splib2/screenaddress/SPPixelRight.asm @@ -0,0 +1,44 @@ +; +; PixelRight +; Alvin Albrecht 06.2003 +; + +INCLUDE "SPconfig.def" +XLIB SPPixelRight + +; Pixel Right +; +; Adjusts screen address HL and pixel mask B to move right +; one pixel on screen. +; +; enter: HL = valid screen address +; B = pixel mask for screen byte +; exit : Carry = moved off screen +; HL, B moved right one pixel +; used : AF, HL + +.SPPixelRight +IF !DISP_HIRES + rrc b + ret nc + inc l + ld a,l + and $1f + ret nz + scf + ret +ELSE + rrc b + ret nc + ld a,h + xor $20 + ld h,a + and $20 + ret nz + inc l + ld a,l + and $1f + ret nz + scf + ret +ENDIF diff --git a/lib/splib2/screenaddress/SPPixelRight.o b/lib/splib2/screenaddress/SPPixelRight.o new file mode 100644 index 00000000..7b654108 Binary files /dev/null and b/lib/splib2/screenaddress/SPPixelRight.o differ diff --git a/lib/splib2/screenaddress/SPPixelUp.asm b/lib/splib2/screenaddress/SPPixelUp.asm new file mode 100644 index 00000000..21d894e5 --- /dev/null +++ b/lib/splib2/screenaddress/SPPixelUp.asm @@ -0,0 +1,41 @@ +; +; PixelUp +; Alvin Albrecht 2002 +; + +INCLUDE "SPconfig.def" +XLIB SPPixelUp + +; Pixel Up +; +; Adjusts screen address HL to move one pixel up in the display. +; (0,0) is located at the top left corner of the screen. +; +; enter: HL = valid screen address +; exit : Carry = moved off screen +; HL = moves one pixel up +; used : AF, HL + +.SPPixelUp + ld a,h + dec h + and $07 + ret nz + ld a,$08 + add a,h + ld h,a + ld a,l + sub $20 + ld l,a + ret nc + ld a,h + sub $08 + ld h,a +IF DISP_HIRES + and $18 + cp $18 + ccf +ELSE + cp $40 +ENDIF + ret diff --git a/lib/splib2/screenaddress/SPPixelUp.o b/lib/splib2/screenaddress/SPPixelUp.o new file mode 100644 index 00000000..34074cbd Binary files /dev/null and b/lib/splib2/screenaddress/SPPixelUp.o differ diff --git a/lib/splib2/setenv.bat b/lib/splib2/setenv.bat new file mode 100644 index 00000000..a543b050 --- /dev/null +++ b/lib/splib2/setenv.bat @@ -0,0 +1,5 @@ +@echo off +set Z88DK_PATH=c:\z88dk +set PATH=%Z88DK_PATH%\bin.x86;%PATH% +set Z80_OZFILES=%Z88DK_PATH%\Lib\ +set ZCCCFG=%Z88DK_PATH%\Lib\Config\ diff --git a/lib/splib2/sp.lst b/lib/splib2/sp.lst new file mode 100644 index 00000000..63ff2b5a --- /dev/null +++ b/lib/splib2/sp.lst @@ -0,0 +1,225 @@ +backgroundtiles\SPGetTiles +backgroundtiles\SPIterateDList +backgroundtiles\SPPallette +backgroundtiles\SPPrintAt +backgroundtiles\SPPrintAtInv +backgroundtiles\SPPrintAtDiff +backgroundtiles\SPPrintString +backgroundtiles\SPPutTiles +backgroundtiles\SPScreenStr +backgroundtiles\SPTileEntry +blockmemoryalloc\SPAddMemory +blockmemoryalloc\SPBlockFit +blockmemoryalloc\SPBlockAlloc +blockmemoryalloc\SPBlockCount +blockmemoryalloc\SPFreeBlock +blockmemoryalloc\SPInitAlloc +cwrapper\sp_AddColSpr +cwrapper\sp_AddMemory +cwrapper\sp_BlockAlloc +cwrapper\sp_BlockCount +cwrapper\sp_BlockFit +cwrapper\sp_Border +cwrapper\sp_CharDown +cwrapper\sp_CharLeft +cwrapper\sp_CharRight +cwrapper\sp_CharUp +cwrapper\sp_ClearRect +cwrapper\sp_CompDirtyAddr +cwrapper\sp_CompDListAddr +cwrapper\sp_ComputePos +cwrapper\sp_CreateSpr +cwrapper\sp_CreateGenericISR +cwrapper\sp_DeleteSpr +cwrapper\sp_EmptyISR +cwrapper\sp_fixcliprect +cwrapper\sp_FreeBlock +cwrapper\sp_GetAttrAddr +cwrapper\sp_GetCharAddr +cwrapper\sp_GetKey +cwrapper\sp_GetScrnAddr +cwrapper\sp_GetTiles +cwrapper\sp_InitAlloc +cwrapper\sp_InitIM2 +cwrapper\sp_Initialize +cwrapper\sp_Inkey +cwrapper\sp_inp +cwrapper\sp_InstallISR +cwrapper\sp_IntIntervals +cwrapper\sp_IntLargeRect +cwrapper\sp_IntPtInterval +cwrapper\sp_IntPtLargeRect +cwrapper\sp_IntRect +cwrapper\sp_Invalidate +cwrapper\sp_IterateDList +cwrapper\sp_IterateSprChar +cwrapper\sp_JoyFuller +cwrapper\sp_JoyKempston +cwrapper\sp_JoyKeyboard +cwrapper\sp_JoySinclair1 +cwrapper\sp_JoySinclair2 +cwrapper\sp_JoyTimexEither +cwrapper\sp_JoyTimexLeft +cwrapper\sp_JoyTimexRight +cwrapper\sp_KeyPressed +cwrapper\sp_ListAdd +cwrapper\sp_ListAppend +cwrapper\sp_ListConcat +cwrapper\sp_ListCount +cwrapper\sp_ListCreate +cwrapper\sp_ListCurr +cwrapper\sp_ListFirst +cwrapper\sp_ListFree +cwrapper\sp_ListInsert +cwrapper\sp_ListLast +cwrapper\sp_ListNext +cwrapper\sp_ListPrepend +cwrapper\sp_ListPrev +cwrapper\sp_ListRemove +cwrapper\sp_ListSearch +cwrapper\sp_ListTrim +cwrapper\sp_LookupKey +cwrapper\sp_MouseAMX +cwrapper\sp_MouseAMXInit +cwrapper\sp_MouseKempston +cwrapper\sp_MouseSim +cwrapper\sp_moveabshelp +cwrapper\sp_MoveSprAbs +cwrapper\sp_MoveSprAbsC +cwrapper\sp_MoveSprAbsNC +cwrapper\sp_MoveSprRel +cwrapper\sp_MoveSprRelC +cwrapper\sp_MoveSprRelNC +cwrapper\sp_outp +cwrapper\sp_Pallette +cwrapper\sp_Pause +cwrapper\sp_PFill +cwrapper\sp_PixelDown +cwrapper\sp_PixelUp +cwrapper\sp_PixelLeft +cwrapper\sp_PixelRight +cwrapper\sp_PrintAt +cwrapper\sp_PrintAtDiff +cwrapper\sp_PrintAtInv +cwrapper\sp_PrintString +cwrapper\sp_PutTiles +cwrapper\sp_pssread +cwrapper\sp_psswrite +cwrapper\sp_Random32 +cwrapper\sp_RegisterHookFirst +cwrapper\sp_RegisterHookLast +cwrapper\sp_RegisterHook +cwrapper\sp_RemoveDList +cwrapper\sp_RemoveHook +cwrapper\sp_ScreenStr +cwrapper\sp_SetMousePosAMX +cwrapper\sp_SetMousePosKempston +cwrapper\sp_SetMousePosSim +cwrapper\sp_StackSpace +cwrapper\sp_Swap +cwrapper\sp_SwapEndian +cwrapper\sp_TileArray +cwrapper\sp_UpdateNow +cwrapper\sp_UpdateNowEx +cwrapper\sp_Validate +cwrapper\sp_Wait +cwrapper\sp_WaitForKey +cwrapper\sp_WaitForNoKey +displaylist\SPCompDListAddr +displaylist\SPCompDirtyAddr +globalvariables\SPbit2mask +globalvariables\SPbitleft2mask +globalvariables\SPbitright2mask +globalvariables\SPAYconst +globalvariables\SPClipStruct +globalvariables\SPCClipStruct +globalvariables\SPDirtyChars +globalvariables\SPDisplayList +globalvariables\SPkeytranstbl +globalvariables\SPNullSprPtr +globalvariables\SPCompNullSprPtr +globalvariables\SPqueuetable +globalvariables\SPTileArray +input\SPGetKey +input\SPJoyFuller +input\SPJoyKempston +input\SPJoyKeyboard +input\SPJoySinclair1 +input\SPJoySinclair2 +input\SPJoyTimexEither +input\SPJoyTimexLeft +input\SPJoyTimexRight +input\SPKeyPressed +input\SPLookupKey +input\SPMouseKempston +input\SPMouseAMX +input\SPMouseAMXInit +input\SPMouseSim +input\SPPause +input\SPSetMousePosAMX +input\SPSetMousePosKempston +input\SPSetMousePosSim +input\SPtbllookup +input\SPtmxsetup +input\SPWait +input\SPWaitForKey +input\SPWaitForNoKey +interrupts\SPCreateGenericISR +interrupts\SPEmptyISR +interrupts\SPInitIM2 +interrupts\SPInstallISR +interrupts\SPRegisterHookFirst +interrupts\SPRegisterHookLast +interrupts\SPRemoveHook +linkedlist\SPemptylistadd +linkedlist\SPListAdd +linkedlist\SPListAppend +linkedlist\SPListConcat +linkedlist\SPListCount +linkedlist\SPListCreate +linkedlist\SPListCurr +linkedlist\SPListFirst +linkedlist\SPListFree +linkedlist\SPListInsert +linkedlist\SPListLast +linkedlist\SPListNext +linkedlist\SPListPrepend +linkedlist\SPListPrev +linkedlist\SPListRemove +linkedlist\SPListSearch +linkedlist\SPListTrim +miscellaneous\SPBorder +miscellaneous\SPInitialize +miscellaneous\SPIntIvals +miscellaneous\SPIntLargeRect +miscellaneous\SPIntRect +miscellaneous\SPMultDEA +miscellaneous\SPMultDEAC +miscellaneous\SPMultUnsigned +miscellaneous\SPPFill +miscellaneous\SPPtInIval +miscellaneous\SPPtInLargeRect +miscellaneous\SPRandom32 +miscellaneous\SPSwap +screenaddress\SPCharUp +screenaddress\SPCharLeft +screenaddress\SPCharRight +screenaddress\SPCharDown +screenaddress\SPGetAttrAddr +screenaddress\SPGetCharAddr +screenaddress\SPGetScrnAddr +screenaddress\SPPixelUp +screenaddress\SPPixelDown +screenaddress\SPPixelLeft +screenaddress\SPPixelRight +sprites\SPAddColSpr +sprites\SPCreateSpr +sprites\SPDeleteSpr +sprites\SPIterateSprChar +sprites\SPMoveSprAbs +sprites\SPMoveSprRel +sprites\SPRemoveDList +updater\SPClearRect +updater\SPInvalidate +updater\SPUpdateNow +updater\SPValidate diff --git a/lib/splib2/splib2_mk2.lib b/lib/splib2/splib2_mk2.lib new file mode 100644 index 00000000..26bcce6d Binary files /dev/null and b/lib/splib2/splib2_mk2.lib differ diff --git a/lib/splib2/spritepack.h b/lib/splib2/spritepack.h new file mode 100644 index 00000000..9d6d1d2e --- /dev/null +++ b/lib/splib2/spritepack.h @@ -0,0 +1,623 @@ + +#ifndef _SPRITEPACK_H +#define _SPRITEPACK_H + +/* + * Sprite Pack V2.2 for the Z88DK Small C+ Cross Compiler + * + * Visit http://www.geocities.com/aralbrec + * for a tutorial introduction. + * + * Z88DK: http://z88dk.sourceforge.net/ + * + * The library supports all the video modes of the + * Spectrum and Timex machines and a number of + * input devices. The package should be customized + * by editing the SPconfig.def file and then compiled to + * create a customized lib by running the makefile. + * + * Alvin Albrecht 08.2003 + */ + +#undef NULL +#define NULL 0 + +#ifndef NOREDEF +typedef unsigned char uchar; +typedef unsigned int uint; +#endif + +/* User's Memory Allocation Policy */ + +extern void *u_malloc; /* void *(*u_malloc)(uint bytes) */ +extern void *u_free; /* void (*u_free)(void *addr) */ + + +/* sprite types */ + +#define sp_MASK_SPRITE 0x00 +#define sp_OR_SPRITE 0x40 +#define sp_XOR_SPRITE 0x80 +#define sp_LOAD_SPRITE 0xc0 + + +/* masks for joystick functions */ + +#define sp_FIRE 0x80 +#define sp_RIGHT 0x08 +#define sp_LEFT 0x04 +#define sp_DOWN 0x02 +#define sp_UP 0x01 + + +/* masks for mouse buttons */ + +#define sp_MLEFT 0x01 +#define sp_BUT1 0x01 +#define sp_MMID 0x04 +#define sp_BUT3 0x04 +#define sp_MRIGHT 0x02 +#define sp_BUT2 0x02 + + +/* Print String Struct Flags */ + +#define sp_PSS_INVALIDATE 0x01 +#define sp_PSS_XWRAP 0x02 +#define sp_PSS_YINC 0x04 + + +/* Clear Rectangle Flags */ + +#define sp_CR_TILES 0x01 +#define sp_CR_SPRITES 0x02 +#define sp_CR_ALL 0x03 + + +/* Colour Attributes */ + +#define BLACK 0x00 +#define BLUE 0x01 +#define RED 0x02 +#define MAGENTA 0x03 +#define GREEN 0x04 +#define CYAN 0x05 +#define YELLOW 0x06 +#define WHITE 0x07 +#define INK_BLACK 0x00 +#define INK_BLUE 0x01 +#define INK_RED 0x02 +#define INK_MAGENTA 0x03 +#define INK_GREEN 0x04 +#define INK_CYAN 0x05 +#define INK_YELLOW 0x06 +#define INK_WHITE 0x07 +#define PAPER_BLACK 0x00 +#define PAPER_BLUE 0x08 +#define PAPER_RED 0x10 +#define PAPER_MAGENTA 0x18 +#define PAPER_GREEN 0x20 +#define PAPER_CYAN 0x28 +#define PAPER_YELLOW 0x30 +#define PAPER_WHITE 0x38 +#define BRIGHT 0x40 +#define FLASH 0x80 +#define TRANSPARENT 0x80 + + +/* AY Chip Port Addresses - don't use, incomplete + +#define AYREG_2068 0xf5 +#define AYDAT_2068 0xf6 +#define AYREG_128 0xfffd +#define AYDAT_128 0xbffd +#define AYREG_FULLER 0x3f +#define AYDAT_FULLER 0x5f + +struct sp_AYSTATE { + uint mask; + uchar R13, R12, R11, R10, R9, R8, R7, R6, R5, R4, R3, R2, R1, R0; +}; + +struct sp_AYPSG2 { + uchar count; + uchar *addr; + uint map; +}; + +*/ + + +/* SP's Sprite Struct */ + +struct sp_SS { + uchar row; /* -------- */ + uchar col; /* struct */ + uchar height; /* sp_Rect */ + uchar width; /* -------- */ + uchar hor_rot; + uchar ver_rot; + uchar *first; /* big endian!! */ + uchar *last_col; + uchar *last; + uchar plane; + uchar type; +}; + + +/* SP's Char Struct */ + +struct sp_CS { + uchar *next_in_spr; /* big endian!! */ + uchar *prev; /* big endian!! */ + uchar spr_attr; /* sprite type (bits 6..7) | sprite plane (bits 0..5) */ + uchar *left_graphic; + uchar *graphic; + uchar hor_rot; + uchar colour; /* attribute in spectrum mode, threshold in hi-colour mode */ + uchar *next; /* big endian!! */ + uchar unused; +}; + + +/* Small Rectangles with 8-bit coordinates (used by SP where units are characters) */ + +struct sp_Rect { + uchar row_coord; /* coordinate of top left corner */ + uchar col_coord; + uchar height; /* size */ + uchar width; +}; + + +/* SP's Print String Struct */ + +struct sp_PSS { + struct sp_Rect *bounds; /* bounding rectangle for printed text */ + uchar flags; /* bit 0=invalidate?, 1=xwrap?, 2=yinc?, 3=onscreen? (res) */ + uchar x; /* current x coordinate relative to bounding rect */ + uchar y; /* current y coordinate relative to bounding rect */ + uchar colour; /* current attribute */ + void *dlist; /* reserved */ + void *dirtychars; /* reserved */ + uchar dirtybit; /* reserved */ +}; + + +/* Large Rectangles with 16-bit coordinates (not used by SP itself) */ + +struct sp_LargeRect { + uint top; /* Interval #1 */ + uint bottom; + uint left; /* Interval #2 */ + uint right; +}; + +struct sp_Interval { /* [x1,x2] */ + uint x1; /* left side */ + uint x2; /* right side */ +}; + + +/* user defined keys structure */ + +struct sp_UDK { + uint fire; /* These are word long scan codes. */ + uint right; /* Use "LookupKey" to get scan codes. */ + uint left; + uint down; + uint up; +}; + + +/* structures for simulated mouse */ + +struct sp_MD { /* mouse delta */ + uchar maxcount; + uint dx; + uint dy; +}; + +struct sp_UDM { + struct sp_UDK *keys; /* parameter if JoyKeyboard() is used else ignored */ + void *joyfunc; /* joystick function for reading input */ + struct sp_MD **delta; /* pointer to array of sp_MD; last max count must be 255 */ + uchar state; /* current index into delta array */ + uchar count; /* current count */ + uint y; /* current (x,y) coordinate, fixed point */ + uint x; +}; + + +/* LIST structures for linked list ADT */ + +struct sp_ListNode { /* Invisible to User */ + void *item; + struct sp_ListNode *next; + struct sp_ListNode *prev; +}; + +struct sp_List { + uint count; /* number of NODEs in list */ + uchar state; /* state of curr ptr: 1 = INLIST, 0 = BEFORE, 2 = AFTER */ + struct sp_ListNode *current; /* points at current NODE in list, big endian */ + struct sp_ListNode *head; /* points at first NODE in list, big endian */ + struct sp_ListNode *tail; /* points at last NODE in list, big endian */ +}; + + +/* HASH TABLE structures for hashtable ADT */ + +struct sp_HashCell { + void *key; + void *value; + struct sp_HashCell *next; +}; + +struct sp_HashTable { + uint size; /* size of table */ + struct sp_HashCell **table; /* table of 'buckets'*/ + void *hashfunc; /* uint (*hashfunc)(void *key, uint size) */ + void *match; /* int (*match)(void *key1, void *key2); also set crry if = */ + void *delete; /* void (*delete)(struct sp_HashCell *hc); delete key,value */ +}; + + +/* Huffman Codec Structs */ + +struct sp_HuffmanJoin { + union { + uint freq; + void *parent; + } u; + void *left; + void *right; +}; + +struct sp_HuffmanLeaf { + union { + uint freq; + void *parent; + } u; + uint c; /* msb = 0 to indicate leaf node, lsb is symbol */ +}; + +struct sp_HuffmanCodec { + uint symbols; /* no. of source symbols 1..256 */ + void *addr; /* current memory address pointer */ + uchar bit; /* current bit within memory address */ + void *root; /* root of decoder tree */ + union { + struct sp_HuffmanLeaf **heap; /* array accumulates symbol frequencies */ + struct sp_HuffmanLeaf **encoder; /* arr indexed by symbol pts at leaves in dec. tree */ + /* ^ only required if encoding, can free this array after sp_HuffExtract */ + } u; +}; + + +/* SP Variables -- declare these in your main.c file exactly once if needed */ + +/* + +extern struct sp_Rect *sp_ClipStruct; +#asm +LIB SPCClipStruct +._sp_ClipStruct defw SPCClipStruct +#endasm + +extern uchar *sp_NullSprPtr; +#asm +LIB SPNullSprPtr +._sp_NullSprPtr defw SPNullSprPtr +#endasm + +extern uchar *sp_CompNullSprPtr; // for COMPRESSed sprites +#asm +LIB SPCompNullSprPtr +._sp_CompNullSprPtr defw SPCompNullSprPtr +#endasm + +extern uchar *sp_KeyDebounce; // requires sp_GetKey() +#asm +XREF SPkeydebounce +._sp_KeyDebounce defw SPkeydebounce +#endasm + +extern uchar *sp_KeyStartRepeat; // requires sp_GetKey() +#asm +XREF SPkeystartrepeat +._sp_KeyStartRepeat defw SPkeystartrepeat +#endasm + +extern uchar *sp_KeyRepeatPeriod; // requires sp_GetKey() +#asm +XREF SPkeyrepeatperiod +._sp_KeyRepeatPeriod defw SPkeyrepeatperiod +#endasm + +extern uchar *sp_KeyTransTable; +#asm +LIB SPkeytranstbl +._sp_KeyTransTable defw SPkeytranstbl +#endasm + +extern uint *sp_GenericISRSize; // requires sp_CreateGenericISR() +#asm +XREF GENERICISRSIZE +._sp_GenericISRSize defw GENERICISRSIZE +#endasm + +extern uint *sp_MouseAMXdx; // requires sp_MouseAMXInit() +#asm +XREF SPAMXDX +._sp_MouseAMXdx defw SPAMXDX +#endasm + +extern uint *sp_MouseAMXdy; // requires sp_MouseAMXInit() +#asm +XREF SPAMXDY +._sp_MouseAMXdy defw SPAMXDY +#endasm + +extern uchar *sp_Screen; // for DISP_TMXDUAL double buffering +#asm +XREF SPScreen +._sp_Screen defw SPScreen +#endasm + +extern uint *sp_Random32Seed; // requires sp_Random32() +#asm +XREF SPRand32Seed +._sp_Random32Seed defw SPRand32Seed +#endasm + +extern uchar *sp_AY_RegPort; +#asm +LIB SPAYReg +._sp_AY_Reg defw SPAYReg +#endasm + +extern uchar *sp_AY_DataPort; +#asm +LIB SPAYReg +XREF SPAYData +._sp_AY_Data defw SPAYData +#endasm + +extern uchar *sp_BorderClr; // requires sp_Border() +#asm +XREF SPBorderClr +._sp_BorderClr defw SPBorderClr +#endasm + +*/ + + +/* interrupt mode 2 */ + +extern void __LIB__ sp_InitIM2(void *default_isr); /* void (*default_isr)(void) */ +extern void __LIB__ *sp_InstallISR(uchar vector, void *isr); /* void (*isr)(void) */ +extern void __LIB__ sp_EmptyISR(void); +extern void __LIB__ *sp_CreateGenericISR(void *addr); +extern void __LIB__ sp_RegisterHook(uchar vector, void *hook); /* void (*hook)(void) */ +extern void __LIB__ sp_RegisterHookFirst(uchar vector, void *hook); /* void (*hook)(void) */ +extern void __LIB__ sp_RegisterHookLast(uchar vector, void *hook); /* void (*hook)(void) */ +extern int __LIB__ sp_RemoveHook(uchar vector, void *hook); /* void (*hook)(void) */ + + +/* miscellaneous functions */ + +extern void __LIB__ sp_Initialize(uchar colour, uchar udg); +extern void __LIB__ *sp_SwapEndian(void *ptr); +extern void __LIB__ sp_Swap(void *addr1, void *addr2, uint bytes); +extern int __LIB__ sp_PFill(uint xcoord, uchar ycoord, void *pattern, uint stackdepth); +extern int __LIB__ sp_StackSpace(void *addr); /* returns "SP - addr" */ +extern uint __LIB__ sp_Random32(uint *hi); /* returns 32 bit random number */ +extern void __LIB__ sp_Border(uchar colour); /* set border colour */ +extern uchar __LIB__ sp_inp(uint port); +extern void __LIB__ sp_outp(uint port, uchar value); + + +/* rectangle, interval and point intersections (miscellaneous directory) */ + +extern int __LIB__ sp_IntRect(struct sp_Rect *r1, struct sp_Rect *r2, struct sp_Rect *result); +extern int __LIB__ sp_IntLargeRect(struct sp_LargeRect *r1, struct sp_LargeRect *r2, struct sp_LargeRect *result); +extern int __LIB__ sp_IntPtLargeRect(uint x, uint y, struct sp_LargeRect *r); +extern int __LIB__ sp_IntIntervals(struct sp_Interval *i1, struct sp_Interval *i2, struct sp_Interval *result); +extern int __LIB__ sp_IntPtInterval(uint x, struct sp_Interval *i); + + +/* sprites */ + +extern struct sp_SS __LIB__ *sp_CreateSpr(uchar type, uchar rows, void *graphic); +extern int __LIB__ sp_AddColSpr(struct sp_SS *sprite, void *graphic); +extern void __LIB__ sp_DeleteSpr(struct sp_SS *sprite); +extern void __LIB__ sp_IterateSprChar(struct sp_SS *sprite, void *hook); + /* void (*hook)(struct sp_CS *cs)) */ +extern void __LIB__ sp_RemoveDList(struct sp_SS *sprite); +extern void __LIB__ sp_MoveSprAbs(struct sp_SS *sprite, struct sp_Rect *clip, int animate, uchar row, uchar col, uchar hpix, uchar vpix); +extern void __LIB__ sp_MoveSprAbsC(struct sp_SS *sprite, struct sp_Rect *clip, int animate, uchar row, uchar col, uchar hpix, uchar vpix); +extern void __LIB__ sp_MoveSprAbsNC(struct sp_SS *sprite, struct sp_Rect *clip, int animate, uchar row, uchar col, uchar hpix, uchar vpix); +extern void __LIB__ sp_MoveSprRel(struct sp_SS *sprite, struct sp_Rect *clip, int animate, char rel_row, char rel_col, char rel_hpix, char rel_vpix); +extern void __LIB__ sp_MoveSprRelC(struct sp_SS *sprite, struct sp_Rect *clip, int animate, char rel_row, char rel_col, char rel_hpix, char rel_vpix); +extern void __LIB__ sp_MoveSprRelNC(struct sp_SS *sprite, struct sp_Rect *clip, int animate, char rel_row, char rel_col, char rel_hpix, char rel_vpix); + + +/* background tiles */ + +extern void __LIB__ sp_PrintAt(uchar row, uchar col, uchar colour, uchar udg); +extern void __LIB__ sp_PrintAtInv(uchar row, uchar col, uchar colour, uchar udg); +extern uint __LIB__ sp_ScreenStr(uchar row, uchar col); +extern void __LIB__ sp_PrintAtDiff(uchar row, uchar col, uchar colour, uchar udg); +extern void __LIB__ sp_PrintString(struct sp_PSS *ps, uchar *s); +extern void __LIB__ sp_ComputePos(struct sp_PSS *ps, uchar x, uchar y); +extern void __LIB__ *sp_TileArray(uchar c, void *addr); +extern void __LIB__ *sp_Pallette(uchar c, void *addr); +extern void __LIB__ sp_GetTiles(struct sp_Rect *r, void *dest); +extern void __LIB__ sp_PutTiles(struct sp_Rect *r, void *src); +extern void __LIB__ sp_IterateDList(struct sp_Rect *r, void *hook); + /* ^ void (*hook)(void *dlist_addr) */ + + +/* dynamic block memory allocator */ + +extern void __LIB__ *sp_AddMemory(uchar queue, uchar number, uint size, void *addr); +extern void __LIB__ *sp_BlockAlloc(uchar queue); +extern void __LIB__ *sp_BlockFit(uchar queue, uchar numcheck); +extern void __LIB__ sp_FreeBlock(void *addr); +extern void __LIB__ sp_InitAlloc(void); +extern uint __LIB__ sp_BlockCount(uchar queue); + + +/* updater */ + +extern void __LIB__ sp_Invalidate(struct sp_Rect *area, struct sp_Rect *clip); +extern void __LIB__ sp_Validate(struct sp_Rect *area, struct sp_Rect *clip); +extern void __LIB__ sp_ClearRect(struct sp_Rect *area, uchar colour, uchar udg, uchar flags); +extern void __LIB__ sp_UpdateNow(void); +extern void __LIB__ sp_UpdateNowEx(unsigned char doSprites); +extern void __LIB__ *sp_CompDListAddr(uchar row, uchar col); +extern void __LIB__ *sp_CompDirtyAddr(uchar row, uchar col, uchar *mask); + + +/* input */ + +extern uchar __LIB__ sp_JoySinclair1(void); +extern uchar __LIB__ sp_JoySinclair2(void); +extern uchar __LIB__ sp_JoyTimexEither(void); +extern uchar __LIB__ sp_JoyTimexLeft(void); +extern uchar __LIB__ sp_JoyTimexRight(void); +extern uchar __LIB__ sp_JoyFuller(void); +extern uchar __LIB__ sp_JoyKempston(void); +extern uchar __LIB__ sp_JoyKeyboard(struct sp_UDK *keys); +extern void __LIB__ sp_WaitForKey(void); +extern void __LIB__ sp_WaitForNoKey(void); +extern uint __LIB__ sp_Pause(uint ticks); +extern void __LIB__ sp_Wait(uint ticks); +extern uint __LIB__ sp_LookupKey(uchar c); /* use "iferror(..)" to see if char not found */ +extern uchar __LIB__ sp_GetKey(void); /* returns ascii code, 0 if no key pressed */ +extern uchar __LIB__ sp_Inkey(void); /* returns ascii code, 0 if no key pressed */ +extern int __LIB__ sp_KeyPressed(uint scancode); +extern void __LIB__ sp_MouseAMXInit(uchar xvector, uchar yvector); +extern void __LIB__ sp_MouseAMX(uint *xcoord, uchar *ycoord, uchar *buttons); +extern void __LIB__ sp_SetMousePosAMX(uint xcoord, uchar ycoord); +extern void __LIB__ sp_MouseKempston(uint *xcoord, uchar *ycoord, uchar *buttons); +extern void __LIB__ sp_SetMousePosKempston(uint xcoord, uchar ycoord); +extern void __LIB__ sp_MouseSim(struct sp_UDM *m, uint *xcoord, uchar *ycoord, uchar *buttons); +extern void __LIB__ sp_SetMousePosSim(struct sp_UDM *m, uint xcoord, uchar ycoord); + + +/* screen address helpers */ + +extern void __LIB__ *sp_CharDown(void *scrnaddr); +extern void __LIB__ *sp_CharLeft(void *scrnaddr); +extern void __LIB__ *sp_CharRight(void *scrnaddr); +extern void __LIB__ *sp_CharUp(void *scrnaddr); +extern void __LIB__ *sp_GetAttrAddr(void *scrnaddr); +extern void __LIB__ *sp_GetCharAddr(uchar row, uchar col); +extern void __LIB__ *sp_GetScrnAddr(uint xcoord, uchar ycoord, uchar *mask); +extern void __LIB__ *sp_PixelDown(void *scrnaddr); +extern void __LIB__ *sp_PixelUp(void *scrnaddr); +extern void __LIB__ *sp_PixelLeft(void *scrnaddr, uchar *mask); +extern void __LIB__ *sp_PixelRight(void *scrnaddr, uchar *mask); + + +/* AY Sound Chip - don't use incomplete + +extern void __LIB__ sp_AY_Reset(void); +extern void __LIB__ sp_AY_Silence(void); +extern void __LIB__ sp_AY_SaveState(struct sp_AYSTATE *s, uint mask); +extern void __LIB__ sp_AY_RestoreState(struct sp_AYSTATE *s, uint mask); +extern void __LIB__ sp_AY_Out(uchar reg, uchar data); +extern uchar __LIB__ sp_AY_In(uchar reg); +extern uchar __LIB__ *sp_AY_OutList(uchar *addr); +extern void __LIB__ sp_AY_PlayPSG2(struct sp_AYPSG2 *s); + +*/ + + +/* linked list ADT */ + +extern struct sp_List __LIB__ *sp_ListCreate(void); +extern uint __LIB__ sp_ListCount(struct sp_List *list); +extern void __LIB__ *sp_ListFirst(struct sp_List *list); +extern void __LIB__ *sp_ListLast(struct sp_List *list); +extern void __LIB__ *sp_ListNext(struct sp_List *list); +extern void __LIB__ *sp_ListPrev(struct sp_List *list); +extern void __LIB__ *sp_ListCurr(struct sp_List *list); +extern int __LIB__ sp_ListAdd(struct sp_List *list, void *item); +extern int __LIB__ sp_ListInsert(struct sp_List *list, void *item); +extern int __LIB__ sp_ListAppend(struct sp_List *list, void *item); +extern int __LIB__ sp_ListPrepend(struct sp_List *list, void *item); +extern void __LIB__ *sp_ListRemove(struct sp_List *list); +extern void __LIB__ sp_ListConcat(struct sp_List *list1, struct sp_List *list2); +extern void __LIB__ sp_ListFree(struct sp_List *list, void *free); + /* void (*free)(void *item) */ +extern void __LIB__ *sp_ListTrim(struct sp_List *list); +extern void __LIB__ *sp_ListSearch(struct sp_List *list, void *match, void *item1); + /* int (*match)(void *item1, void *item2); Set carry if = */ + + +/* hashtable ADT */ + +extern struct sp_HashTable __LIB__ *sp_HashCreate(uint size, void *hashfunc, void *match, void *delete); +extern struct sp_HashCell __LIB__ *sp_HashRemove(struct sp_HashTable *ht, void *key); +extern void __LIB__ *sp_HashLookup(struct sp_HashTable *ht, void *key); +extern void __LIB__ *sp_HashAdd(struct sp_HashTable *ht, void *key, void *value); +extern void __LIB__ sp_HashDelete(struct sp_HashTable *ht); + + +/* heap array ADT aka priority queue */ + +/* + The heap is an array of void* with indices 1..N used to store items (you must allocate array) + In the following: + void *compare <--> int (*compare)(void *item1, void *item2) + return carry set and true if item1>item2 for max heap + return carry set and true if item1 threshold, rotate colour +.DUPnoclrrotate + ld ix,-22 + add ix,bc ; ix = sprite graphic + +.DUPclrrotate ; now do colours bottom up + ld c,$80 ; the transparent colour +IF NOFLICKER + inc de +ELSE + set 5,d +ENDIF + + ld a,(ix+23) + cp c ; if transparent colour, do not colour + jr z, DUPclear0 + ld (de),a + +.DUPclear0 +IF NOFLICKER + inc de +ELSE + dec d ; move up scan line +ENDIF + ld a,(ix+20) + cp c + jr z, DUPclear1 + ld (de),a + +.DUPclear1 +IF NOFLICKER + inc de +ELSE + dec d +ENDIF + ld a,(ix+17) + cp c + jr z, DUPclear2 + ld (de),a + +.DUPclear2 +IF NOFLICKER + inc de +ELSE + dec d +ENDIF + ld a,(ix+14) + cp c + jr z, DUPclear3 + ld (de),a + +.DUPclear3 +IF NOFLICKER + inc de +ELSE + dec d +ENDIF + ld a,(ix+11) + cp c + jr z, DUPclear4 + ld (de),a + +.DUPclear4 +IF NOFLICKER + inc de +ELSE + dec d +ENDIF + ld a,(ix+8) + cp c + jr z, DUPclear5 + ld (de),a + +.DUPclear5 +IF NOFLICKER + inc de +ELSE + dec d +ENDIF + ld a,(ix+5) + cp c + jr z, DUPclear6 + ld (de),a + +.DUPclear6 +IF NOFLICKER + inc de +ELSE + dec d +ENDIF + ld a,(ix+2) + cp c + jp z, clear7 + ld (de),a ; de back to top of char again (colour map) + jp clear7 +ENDIF + +.coloursprite + ld a,h ; have a look at the rotation + dec a + pop hl ; hl = char struct + 9 + inc hl ; point at colour threshold + cp (hl) + jp nc, clrrotate ; if rotation > threshold, rotate colour +.noclrrotate +IF !COMPRESS + ld ix,-22 +ELSE + ld ix,-14 +ENDIF + add ix,bc ; ix = sprite graphic + +.clrrotate ; now do colours bottom up + ld c,$80 ; the transparent colour +IF NOFLICKER + inc de +ELSE + set 5,d +ENDIF + +IF !COMPRESS + ld a,(ix+23) +ELSE + ld a,(ix+15) +ENDIF + cp c ; if transparent colour, do not colour + jr z, clear0 + ld (de),a + +.clear0 +IF NOFLICKER + inc de +ELSE + dec d ; move up scan line +ENDIF +IF !COMPRESS + ld a,(ix+20) +ELSE + ld a,(ix+13) +ENDIF + cp c + jr z, clear1 + ld (de),a + +.clear1 +IF NOFLICKER + inc de +ELSE + dec d +ENDIF +IF !COMPRESS + ld a,(ix+17) +ELSE + ld a,(ix+11) +ENDIF + cp c + jr z, clear2 + ld (de),a + +.clear2 +IF NOFLICKER + inc de +ELSE + dec d +ENDIF +IF !COMPRESS + ld a,(ix+14) +ELSE + ld a,(ix+9) +ENDIF + cp c + jr z, clear3 + ld (de),a + +.clear3 +IF NOFLICKER + inc de +ELSE + dec d +ENDIF +IF !COMPRESS + ld a,(ix+11) +ELSE + ld a,(ix+7) +ENDIF + cp c + jr z, clear4 + ld (de),a + +.clear4 +IF NOFLICKER + inc de +ELSE + dec d +ENDIF +IF !COMPRESS + ld a,(ix+8) +ELSE + ld a,(ix+5) +ENDIF + cp c + jr z, clear5 + ld (de),a + +.clear5 +IF NOFLICKER + inc de +ELSE + dec d +ENDIF +IF !COMPRESS + ld a,(ix+5) +ELSE + ld a,(ix+3) +ENDIF + cp c + jr z, clear6 + ld (de),a + +.clear6 +IF NOFLICKER + inc de +ELSE + dec d +ENDIF +IF !COMPRESS + ld a,(ix+2) +ELSE + ld a,(ix+1) +ENDIF + cp c + jr z, clear7 + ld (de),a ; de back to top of char again (colour map) + +.clear7 + +ELSE ; not DISP_HICOLOUR + +.coloursprite + pop hl ; hl = char struct + 9 +.skip_sprite_update + inc hl +IF DISP_SPECTRUM +;; na_th_an +; ld a,(hl) ; colour +; cp $80 ; special transparent colour +; jr z, clear +; ld (tempcolour),a + +.clear +ENDIF +ENDIF + + inc hl ; hl = char struct + 11 + ld a,(hl) + or a +IF NOFLICKER + jr z, copybuffer +ELSE + jr z, nomoresprites +ENDIF + inc hl + ld l,(hl) + ld h,a ; hl = char struct + 4 of next sprite + jp spriteloop + +IF NOFLICKER +.copybuffer + pop de ; de = screen address of top of char + ld hl,tempgraphic + ld a,(hl) ; copy buffered tempgraphic to screen + ld (de),a + inc d + inc hl + ld a,(hl) + ld (de),a + inc d + inc hl + ld a,(hl) + ld (de),a + inc d + inc hl + ld a,(hl) + ld (de),a + inc d + inc hl + ld a,(hl) + ld (de),a + inc d + inc hl + ld a,(hl) + ld (de),a + inc d + inc hl + ld a,(hl) + ld (de),a + inc d + inc hl + ld a,(hl) + ld (de),a + +IF DISP_HICOLOUR + inc hl ; copy colour to screen + set 5,d + ld a,(hl) + ld (de),a + inc hl + dec d + ld a,(hl) + ld (de),a + inc hl + dec d + ld a,(hl) + ld (de),a + inc hl + dec d + ld a,(hl) + ld (de),a + inc hl + dec d + ld a,(hl) + ld (de),a + inc hl + dec d + ld a,(hl) + ld (de),a + inc hl + dec d + ld a,(hl) + ld (de),a + inc hl + dec d + ld a,(hl) + ld (de),a +ENDIF +ENDIF + +.nomoresprites +IF DISP_SPECTRUM +IF DISP_TMXDUAL + ld a,d + and $20 + ld l,a + xor d +ELSE + ld a,d ; de = screen address of last scan line in char +ENDIF + xor $85 ; find corresponding attribute address + rrca + rrca + rrca +IF DISP_TMXDUAL + or l +ENDIF + ld d,a + ld a,(tempcolour) ; what's the final colour of this square? + ld (de),a +.skipupdatecol +ENDIF + + exx + pop af + ret + + +.masknorotate + ex de,hl ; hl = screen address + ld a,(bc) + ld e,a ; e = graphic + inc bc + ld a,(bc) ; a = mask + and (hl) ; portion of screen remaining + or e ; or in sprite graphic + ld (hl),a ; write to screen +IF NOFLICKER + inc hl +ELSE + inc h ; next scan line +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat 8 times in total for whole char + ld e,a + inc bc + ld a,(bc) + and (hl) + or e + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld e,a + inc bc + ld a,(bc) + and (hl) + or e + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld e,a + inc bc + ld a,(bc) + and (hl) + or e + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld e,a + inc bc + ld a,(bc) + and (hl) + or e + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld e,a + inc bc + ld a,(bc) + and (hl) + or e + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld e,a + inc bc + ld a,(bc) + and (hl) + or e + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld e,a + inc bc + ld a,(bc) + and (hl) + or e + ld (hl),a + ex de,hl +IF DISP_HICOLOUR + pop hl + inc hl +IF !COMPRESS + jp noclrrotate +ELSE + jp DUPnoclrrotate +ENDIF +ELSE + jp coloursprite ; back to colour the sprite +ENDIF + + +.loadtype + ld a,h ; have a look at the rotation being used + and $0e + jp z, loadnorotate ; if no rotation draw the fast way + + ld a,(bc) ; sprite graphic + ld l,a + ld a,(hl) ; rotated right + inc h + ld l,(ix+0) ; get graphic on the left + or (hl) ; a = graphic rotated right | graphic rot. right from left + dec h + ld (de),a ; write to screen +IF NOFLICKER + inc de +ELSE + inc d ; next scan line +ENDIF +IF !COMPRESS + inc bc ; skip mask +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat 8 times total for entire char + ld l,a + ld a,(hl) + inc h +IF DISP_HICOLOUR +IF !COMPRESS + ld l,(ix+3) +ELSE + ld l,(ix+2) +ENDIF +ELSE +IF !COMPRESS + ld l,(ix+2) +ELSE + ld l,(ix+1) +ENDIF +ENDIF + or (hl) + dec h + ld (de),a +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h +IF DISP_HICOLOUR +IF !COMPRESS + ld l,(ix+6) +ELSE + ld l,(ix+4) +ENDIF +ELSE +IF !COMPRESS + ld l,(ix+4) +ELSE + ld l,(ix+2) +ENDIF +ENDIF + or (hl) + dec h + ld (de),a +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h +IF DISP_HICOLOUR +IF !COMPRESS + ld l,(ix+9) +ELSE + ld l,(ix+6) +ENDIF +ELSE +IF !COMPRESS + ld l,(ix+6) +ELSE + ld l,(ix+3) +ENDIF +ENDIF + or (hl) + dec h + ld (de),a +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h +IF DISP_HICOLOUR +IF !COMPRESS + ld l,(ix+12) +ELSE + ld l,(ix+8) +ENDIF +ELSE +IF !COMPRESS + ld l,(ix+8) +ELSE + ld l,(ix+4) +ENDIF +ENDIF + or (hl) + dec h + ld (de),a +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h +IF DISP_HICOLOUR +IF !COMPRESS + ld l,(ix+15) +ELSE + ld l,(ix+10) +ENDIF +ELSE +IF !COMPRESS + ld l,(ix+10) +ELSE + ld l,(ix+5) +ENDIF +ENDIF + or (hl) + dec h + ld (de),a +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h +IF DISP_HICOLOUR +IF !COMPRESS + ld l,(ix+18) +ELSE + ld l,(ix+12) +ENDIF +ELSE +IF !COMPRESS + ld l,(ix+12) +ELSE + ld l,(ix+6) +ENDIF +ENDIF + or (hl) + dec h + ld (de),a +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h +IF DISP_HICOLOUR +IF !COMPRESS + ld l,(ix+21) +ELSE + ld l,(ix+14) +ENDIF +ELSE +IF !COMPRESS + ld l,(ix+14) +ELSE + ld l,(ix+7) +ENDIF +ENDIF + or (hl) + dec h + ld (de),a +IF !COMPRESS +IF DISP_HICOLOUR + inc bc +ENDIF +ENDIF + jp coloursprite + + +.loadnorotate +IF NOFLICKER + ld l,c + ld h,b ; hl = sprite graphic + ldi ; copy graphic to temp buffer +IF !COMPRESS + inc hl ; skip mask +ENDIF +IF DISP_HICOLOUR + inc hl ; skip colour for now +ENDIF + ldi ; repeat +IF !COMPRESS + inc hl +ENDIF +IF DISP_HICOLOUR + inc hl +ENDIF + ldi ; repeat +IF !COMPRESS + inc hl +ENDIF +IF DISP_HICOLOUR + inc hl +ENDIF + ldi ; repeat +IF !COMPRESS + inc hl +ENDIF +IF DISP_HICOLOUR + inc hl +ENDIF + ldi ; repeat +IF !COMPRESS + inc hl +ENDIF +IF DISP_HICOLOUR + inc hl +ENDIF + ldi ; repeat +IF !COMPRESS + inc hl +ENDIF +IF DISP_HICOLOUR + inc hl +ENDIF + ldi ; repeat +IF !COMPRESS + inc hl +ENDIF +IF DISP_HICOLOUR + inc hl +ENDIF + ldi ; repeat +IF COMPRESS + dec hl +ENDIF + dec de + ld c,l + ld b,h + +ELSE + + ld a,(bc) ; graphic + ld (de),a ; write to screen + inc d ; next scan line +IF !COMPRESS + inc bc ; skip mask +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat 8 times total for entire char + ld (de),a + inc d +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld (de),a + inc d +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld (de),a + inc d +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld (de),a + inc d +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld (de),a + inc d +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld (de),a + inc d +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld (de),a +IF !COMPRESS +IF DISP_HICOLOUR + inc bc +ENDIF +ENDIF +ENDIF + +IF DISP_HICOLOUR + pop hl + inc hl + jp noclrrotate +ELSE + jp coloursprite +ENDIF + +.xortype + ld a,h ; have a look at the rotation applied + and $0e + jp z, xornorotate ; if no rotation draw the fast way + + ld a,(bc) ; graphic + ld l,a + ld a,(hl) ; graphic rotated right + inc h + ld l,(ix+0) ; graphic from left + or (hl) ; a = final graphic + dec h + ex de,hl ; hl = screen address + xor (hl) ; xor graphic onto screen + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d ; next scan line +ENDIF +IF !COMPRESS + inc bc ; ignore mask +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat 8 times in total for entire char + ld l,a + ld a,(hl) + inc h +IF DISP_HICOLOUR + ld l,(ix+3) +ELSE + ld l,(ix+2) +ENDIF + or (hl) + dec h + ex de,hl + xor (hl) + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h +IF DISP_HICOLOUR + ld l,(ix+6) +ELSE + ld l,(ix+4) +ENDIF + or (hl) + dec h + ex de,hl + xor (hl) + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h +IF DISP_HICOLOUR + ld l,(ix+9) +ELSE + ld l,(ix+6) +ENDIF + or (hl) + dec h + ex de,hl + xor (hl) + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h +IF DISP_HICOLOUR + ld l,(ix+12) +ELSE + ld l,(ix+8) +ENDIF + or (hl) + dec h + ex de,hl + xor (hl) + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h +IF DISP_HICOLOUR + ld l,(ix+15) +ELSE + ld l,(ix+10) +ENDIF + or (hl) + dec h + ex de,hl + xor (hl) + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h +IF DISP_HICOLOUR + ld l,(ix+18) +ELSE + ld l,(ix+12) +ENDIF + or (hl) + dec h + ex de,hl + xor (hl) + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h +IF DISP_HICOLOUR + ld l,(ix+21) +ELSE + ld l,(ix+14) +ENDIF + or (hl) + dec h + ex de,hl + xor (hl) + ld (hl),a + ex de,hl +IF !COMPRESS +IF DISP_HICOLOUR + inc bc +ENDIF +ENDIF + jp coloursprite + + +.xornorotate + ex de,hl ; hl = screen address + ld a,(bc) ; graphic + xor (hl) ; xor onto screen + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h ; next scan line +ENDIF +IF !COMPRESS + inc bc ; skip mask +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat total of 8 times for entire char + xor (hl) + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + xor (hl) + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + xor (hl) + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + xor (hl) + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + xor (hl) + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + xor (hl) + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + xor (hl) + ld (hl),a + ex de,hl ; de = screen address +IF DISP_HICOLOUR +IF !COMPRESS + inc bc +ENDIF + pop hl + inc hl + jp noclrrotate +ELSE + jp coloursprite +ENDIF + +.ortype + ld a,h ; have a look at the rotation applied + and $0e + jp z, ornorotate ; if no rotation draw the fast way + + ld a,(bc) ; graphic + ld l,a + ld a,(hl) ; graphic rotated right + inc h + ld l,(ix+0) ; graphic from left + or (hl) ; a = final graphic + dec h + ex de,hl ; hl = screen address + or (hl) ; or graphic onto screen + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d ; next scan line +ENDIF +IF !COMPRESS + inc bc ; ignore mask +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat 8 times in total for entire char + ld l,a + ld a,(hl) + inc h +IF DISP_HICOLOUR + ld l,(ix+3) +ELSE + ld l,(ix+2) +ENDIF + or (hl) + dec h + ex de,hl + or (hl) + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h +IF DISP_HICOLOUR + ld l,(ix+6) +ELSE + ld l,(ix+4) +ENDIF + or (hl) + dec h + ex de,hl + or (hl) + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h +IF DISP_HICOLOUR + ld l,(ix+9) +ELSE + ld l,(ix+6) +ENDIF + or (hl) + dec h + ex de,hl + or (hl) + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h +IF DISP_HICOLOUR + ld l,(ix+12) +ELSE + ld l,(ix+8) +ENDIF + or (hl) + dec h + ex de,hl + or (hl) + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h +IF DISP_HICOLOUR + ld l,(ix+15) +ELSE + ld l,(ix+10) +ENDIF + or (hl) + dec h + ex de,hl + or (hl) + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h +IF DISP_HICOLOUR + ld l,(ix+18) +ELSE + ld l,(ix+12) +ENDIF + or (hl) + dec h + ex de,hl + or (hl) + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h +IF DISP_HICOLOUR + ld l,(ix+21) +ELSE + ld l,(ix+14) +ENDIF + or (hl) + dec h + ex de,hl + or (hl) + ld (hl),a + ex de,hl +IF !COMPRESS +IF DISP_HICOLOUR + inc bc +ENDIF +ENDIF + jp coloursprite + + +.ornorotate + ex de,hl ; hl = screen address + ld a,(bc) ; graphic + or (hl) ; or onto screen + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h ; next scan line +ENDIF +IF !COMPRESS + inc bc ; skip mask +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat total of 8 times for entire char + or (hl) + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + or (hl) + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + or (hl) + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + or (hl) + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + or (hl) + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + or (hl) + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF !COMPRESS + inc bc +ENDIF +IF DISP_HICOLOUR + inc bc ; skip colour for now +ENDIF + inc bc + + ld a,(bc) ; repeat + or (hl) + ld (hl),a + ex de,hl ; de = screen address +IF DISP_HICOLOUR +IF !COMPRESS + inc bc +ENDIF + pop hl + inc hl + jp noclrrotate +ELSE + jp coloursprite +ENDIF diff --git a/lib/splib2/updater/SPUpdateNow.o b/lib/splib2/updater/SPUpdateNow.o new file mode 100644 index 00000000..35f149ee Binary files /dev/null and b/lib/splib2/updater/SPUpdateNow.o differ diff --git a/lib/splib2/updater/SPUpdateNowOld.asm b/lib/splib2/updater/SPUpdateNowOld.asm new file mode 100644 index 00000000..c583a396 --- /dev/null +++ b/lib/splib2/updater/SPUpdateNowOld.asm @@ -0,0 +1,1961 @@ +; +; Update Now +; Alvin Albrecht 07.2003 +; +; Sprite Pack's screen updater. The updater supports four different +; screen modes with one chosen by defining the corresponding variable +; true and the others false: +; +; DISP_SPECTRUM +; 256x192 pixel, 32x24 colour Spectrum resolution +; DISP_HICOLOUR +; 256x192 pixel, 32x192 colour Timex hi-colour resolution +; DISP_HIRES +; 512x192 monochrome Timex hi-res resolution +; DISP_TMXDUAL +; uses second display file as spectrum resolution double buffer (Timex only) +; (also define DISP_SPECTRUM for this mode) +; +; The updater manages a portion of the screen defined by the row range. +; Sprite Pack will not touch the area outside this row range. +; +; SP_ROWSTART +; Starting row 0..23 +; SP_ROWEND +; Last row, non-inclusive. +; +; The updater performs a differential screen refresh. It divides the +; screen into character size tiles and only redraws those chars that +; have changed from the previous update. Keeping track of which chars +; change is a cooperative effort with Sprite Pack's drawing functions. +; The "Dirty Chars Array" stores this information: one bit is reserved +; per char with a set bit indicating the char is changed. As changes +; are made to the screen, Sprite Pack's functions set these bits and +; as the updater draws the screen, it resets the bits. The dirty chars +; array is mapped to the screen characters in left to right, top to +; bottom order. Each byte stores the status of 8 character tiles. +; +; Sprite Pack keeps track of what's on screen in a "Display List Array". +; Each character on screen is composed of a single background tile (first +; byte is attribute (spec) / pallette # (hi-colour) / ignored (hi-res), +; second byte is tile #) and a linked list of sprite char structures +; (a 2-byte pointer). Each character therefore needs a 4-byte entry in +; this array. Each character's 4-byte struct is mapped into the display +; list array in left to right, top to bottom order. +; +; Two additional modes are available: NOFLICKER mode and SCROLLER mode. +; You can turn either or both on by defining them true. NOFLICKER mode +; causes each screen character to be completely drawn in a background +; buffer before being copied to the screen. The penalty is a slower +; update rate. SCROLLER mode causes the first sprite in each character +; to be drawn as load-type regardless of the sprite's actual designated +; type. +; +; By defining COMPRESS true, or/xor/load sprite graphic definitions +; have their mask bytes removed, halving the space they occupy in memory. +; Doing this means that mask sprite graphic definitions will no longer +; be useable as or/xor/load sprite definitions. + +INCLUDE "SPconfig.def" +XLIB SPUpdateNow +LIB SPDisplayList, SPDirtyChars, SPTileArray + +IF DISP_TMXDUAL +XDEF SPScreen +.SPScreen + defb $20 ; indicates which display file to draw into ($20=secondary, 0=primary) +ENDIF + +; +; Private Static Variables +; + +IF NOFLICKER +.tempgraphic +IF DISP_HICOLOUR + defs 16 +ELSE + defs 8 +ENDIF +ENDIF + +IF DISP_SPECTRUM +.tempcolour + defb 0 +ENDIF + +; +; The screen draw subroutine. +; + +.SPUpdateNow + ld de,$4000 + (256 * (SP_ROWSTART ~ $18)) + (32 * (SP_ROWSTART ~ 7)) ; de = screen address +IF DISP_TMXDUAL + ld a,(SPScreen) + add a,d + ld d,a + ld bc,SPDisplayList ; start of display list + ld hl,SPDirtyChars ; start of dirty chars array +ELSE + ld hl,SPDisplayList + ld bc,SPDirtyChars +ENDIF + +.dirtyloop +IF DISP_TMXDUAL + ld a,(hl) ; examine dirty byte, one bit per 8 chars + inc h + or (hl) ; or in old dirty byte + dec h +ELSE + ld a,(bc) + or a +ENDIF + jp nz, dirtyarea ; if one of the chars is dirty, need to redraw +IF DISP_HIRES + ld a,4 +ELSE + ld a,8 ; otherwise advance screen address 8 chars to right +ENDIF + add a,e + ld e,a + jp nz, notacrossblk1 ; check if a screen block is crossed + ld a,8 ; and adjust if necessary + add a,d + ld d,a + +.notacrossblk1 + ld a,32 ; advance display list 8 chars (32 bytes) +IF DISP_TMXDUAL + add a,c + ld c,a + jp nc, noinc1 + inc b +ELSE + add a,l + ld l,a + jp nc, noinc1 + inc h +ENDIF + +.noinc1 +.reenter +IF DISP_TMXDUAL + inc hl ; advance dirty chars pointer + ld a,h ; are we done yet? +ELSE + inc bc + ld a,b +ENDIF +IF DISP_HIRES + cp 0 + (SPDirtyChars + 8 * (SP_ROWEND - SP_ROWSTART)) / 256 +ELSE + cp 0 + (SPDirtyChars + 4 * (SP_ROWEND - SP_ROWSTART)) / 256 +ENDIF + jp c,dirtyloop +IF DISP_TMXDUAL + ld a,l +ELSE + ld a,c +ENDIF +IF DISP_HIRES + cp 0 + (SPDirtyChars + 8 * (SP_ROWEND - SP_ROWSTART)) % 256 +ELSE + cp 0 + (SPDirtyChars + 4 * (SP_ROWEND - SP_ROWSTART)) % 256 +ENDIF + jp c,dirtyloop +IF DISP_TMXDUAL + ld a,(SPScreen) + xor $20 + ld (SPScreen),a ; draw into other display file next time +ENDIF + ret + + +.dirtyarea +IF DISP_TMXDUAL + push hl + ld l,c + ld h,b ; hl = display list +ELSE + push bc +ENDIF + ld bc,4 + rrca ; now must check each of the 8 chars in dirty byte + call c, drawchar ; if first char is dirty, redraw +IF DISP_HIRES + set 5,d +ELSE + inc e ; move screen address right one char +ENDIF + add hl,bc ; advance display list one char (4 bytes) + rrca ; repeat a total of 8 times + call c, drawchar +IF DISP_HIRES + res 5,d +ENDIF + inc e + add hl,bc + rrca ; repeat + call c, drawchar +IF DISP_HIRES + set 5,d +ELSE + inc e +ENDIF + add hl,bc + rrca ; repeat + call c, drawchar +IF DISP_HIRES + res 5,d +ENDIF + inc e + add hl,bc + rrca ; repeat + call c, drawchar +IF DISP_HIRES + set 5,d +ELSE + inc e +ENDIF + add hl,bc + rrca ; repeat + call c, drawchar +IF DISP_HIRES + res 5,d +ENDIF + inc e + add hl,bc + rrca ; repeat + call c, drawchar +IF DISP_HIRES + set 5,d +ELSE + inc e +ENDIF + add hl,bc + rrca ; repeat + call c, drawchar +IF DISP_HIRES + res 5,d +ENDIF + inc e ; move screen address right one char -- + jp nz, notacrossblk2 ; might cross a screen block here + ld a,8 ; adjust screen address if necessary + add a,d + ld d,a + +.notacrossblk2 + add hl,bc ; advance display list one char (4 bytes) +IF DISP_TMXDUAL + ld c,l + ld b,h ; bc = display list + pop hl ; hl = dirty chars array + ld a,(hl) + inc h + ld (hl),a ; copy new dirty chars byte to old dirty chars byte + dec h + ld (hl),0 ; clear new dirty byte +ELSE + pop bc + xor a + ld (bc),a +ENDIF + jp reenter ; check the next dirty byte + + +.tileonly +IF NOFLICKER + pop de ; pop screen address +IF DISP_HICOLOUR + ld a,$27 + add a,d + ld d,a +ENDIF +ENDIF + +IF DISP_HICOLOUR + ld a,(bc) ; copy tile colour to screen + ld (de),a + inc bc + dec d + ld a,(bc) + ld (de),a + inc bc + dec d + ld a,(bc) + ld (de),a + inc bc + dec d + ld a,(bc) + ld (de),a + inc bc + dec d + ld a,(bc) + ld (de),a + inc bc + dec d + ld a,(bc) + ld (de),a + inc bc + dec d + ld a,(bc) + ld (de),a + inc bc + dec d + ld a,(bc) + ld (de),a + res 5,d +ENDIF + + ex af,af' ; a = tile # + add a,SPTileArray%256 + ld l,a + ld h,SPTileArray/256 + jp nc, noinc11 + inc h +.noinc11 + ld c,(hl) + inc h + ld b,(hl) ; bc = tile graphic + + ld a,(bc) ; copy background tile graphics to screen + ld (de),a + inc bc + inc d + ld a,(bc) ; repeat 8 times total for entire char + ld (de),a + inc bc + inc d + ld a,(bc) ; repeat + ld (de),a + inc bc + inc d + ld a,(bc) ; repeat + ld (de),a + inc bc + inc d + ld a,(bc) ; repeat + ld (de),a + inc bc + inc d + ld a,(bc) ; repeat + ld (de),a + inc bc + inc d + ld a,(bc) ; repeat + ld (de),a + inc bc + inc d + ld a,(bc) ; repeat + ld (de),a + jp nomoresprites ; do colour + + +.drawchar + push af ; save dirty byte + push de ; store screen address + push hl ; store display list pointer + exx + pop hl +IF NOFLICKER +IF DISP_HICOLOUR + ld de,tempgraphic+8 +ELSE + ld de,tempgraphic ; write graphics to temporary buffer +ENDIF +ELSE + pop de +IF DISP_HICOLOUR + ld a,$27 + add a,d + ld d,a ; move to bottom of char in colour memory +ENDIF +ENDIF + +IF DISP_SPECTRUM + ld a,(hl) ; a = background colour + ld (tempcolour),a ; store colour of background tile + inc hl ; point at graphic tile +ENDIF +IF DISP_HIRES + inc hl ; point at graphic tile +ENDIF +IF DISP_HICOLOUR + push hl ; save DLIST + ld a,(hl) + add a,SPTileArray%256 + ld l,a + ld a,0 + adc a,SPTileArray/256 + 2 + ld h,a ; hl = address of pallette entry + ld c,(hl) + inc h + ld b,(hl) ; bc = colour address + pop hl + inc hl ; point at graphic tile +ENDIF + + ld a,(hl) + ex af,af' ; a' = graphic tile # + inc hl ; point at MSB sprite list + ld a,(hl) + or a + jr z, tileonly + +IF DISP_HICOLOUR ; copy tile colour to screen, bottom up +IF NOFLICKER + push hl + ld l,c + ld h,b + ldi + ldi + ldi + ldi + ldi + ldi + ldi + ldi + pop hl + ld de,tempgraphic +ELSE + ld a,(bc) ; copy tile colour to screen, bottom up + ld (de),a + inc bc + dec d + ld a,(bc) + ld (de),a + inc bc + dec d + ld a,(bc) + ld (de),a + inc bc + dec d + ld a,(bc) + ld (de),a + inc bc + dec d + ld a,(bc) + ld (de),a + inc bc + dec d + ld a,(bc) + ld (de),a + inc bc + dec d + ld a,(bc) + ld (de),a + inc bc + dec d + ld a,(bc) ; bc = last colour byte in background tile + ld (de),a + ld a,(hl) + res 5,d ; de = top of char screen address +ENDIF +ENDIF + + inc hl + ld l,(hl) + ld h,a ; hl = first sprite = char struct + 4 + +IF !SCROLLER + ld a,(hl) + cp $c0 ; is this first sprite a load sprite? + jr c, notload ; if so don't bother drawing background tile +ENDIF + + inc hl ; hl = char struct + 5 + ld c,(hl) + inc hl + ld b,(hl) + inc hl + defb $dd + ld l,c + defb $dd + ld h,b ; ix = sprite graphic left + ld c,(hl) + inc hl + ld b,(hl) ; bc = sprite graphic + inc hl + + push hl ; save char struct + 9 + ld h,(hl) ; h = msb of horizontal rotation table to use + jp loadtype + +IF !SCROLLER +.notload + push hl ; save char struct + 4 + ex af,af' ; a = tile # + add a,SPTileArray%256 + ld l,a + ld h,SPTileArray/256 + jp nc, noinc10 + inc h +.noinc10 + ld a,(hl) + inc h + ld h,(hl) + ld l,a ; hl = graphic tile address + +IF NOFLICKER + ldi + ldi + ldi + ldi + ldi + ldi + ldi + ld a,(hl) + ld (de),a +ELSE + ld a,(hl) ; copy background tile graphics to screen + ld (de),a + inc hl + inc d + ld a,(hl) ; repeat 8 times total for entire char + ld (de),a + inc hl + inc d + ld a,(hl) ; repeat + ld (de),a + inc hl + inc d + ld a,(hl) ; repeat + ld (de),a + inc hl + inc d + ld a,(hl) ; repeat + ld (de),a + inc hl + inc d + ld a,(hl) ; repeat + ld (de),a + inc hl + inc d + ld a,(hl) ; repeat + ld (de),a + inc hl + inc d + ld a,(hl) ; repeat + ld (de),a +ENDIF + pop hl ; hl = char struct + 4 +ENDIF + +.spriteloop +IF NOFLICKER + ld de,tempgraphic +ELSE + ld a,d ; move screen address back to top of char +IF DISP_TMXDUAL + and $f8 +ELSE + and $d8 +ENDIF + ld d,a +ENDIF + ld a,(hl) ; get sprite attribute (type | plane) + +.dosprite + inc hl ; hl = char struct + 5 + ld c,(hl) + inc hl + ld b,(hl) + inc hl + defb $dd + ld l,c + defb $dd + ld h,b ; ix = sprite graphic left + ld c,(hl) + inc hl + ld b,(hl) ; bc = sprite graphic + inc hl + + push hl ; save char struct + 9 + ld h,(hl) ; h = msb of horizontal rotation table to use + cp $c0 ; what kind of sprite is this? + jp nc, loadtype + cp $80 + jp nc, xortype + cp $40 + jp nc, ortype + + ; this must be a mask sprite + + ld a,h ; have a look at the rotation being used + and $0e + jp z, masknorotate ; if no rotation draw the fast way + + ld a,(bc) ; a = graphic + ld l,a + ld a,(hl) ; a = graphic rotated right + inc h + ld l,(ix+0) ; l = graphic left side + or (hl) ; a = graphic rotated right | graphic from left side + ex af,af' ; a' = final graphic + inc bc ; advance to mask + dec h + ld a,(bc) ; a = mask + ld l,a + ld a,(hl) ; a = mask rotated right + inc h + ld l,(ix+1) ; l = mask left side + or (hl) ; a = mask rotated right | mask from left side + ex de,hl ; hl = screen address, d = msb hor rotate table + and (hl) ; a = existing screen & mask + ld e,a + ex af,af' ; a = sprite graphic + or e ; a = sprite graphic | remaining portion of screen + ld (hl),a ; update screen + ex de,hl ; de = screen address, h = msb hor rotate table +IF NOFLICKER + inc de +ELSE + inc d ; next scan line in char +ENDIF + dec h + inc bc ; next sprite scan line + + ld a,(bc) ; repeat 8 times total for entire char + ld l,a + ld a,(hl) + inc h + ld l,(ix+2) + or (hl) + ex af,af' + inc bc + dec h + ld a,(bc) + ld l,a + ld a,(hl) + inc h + ld l,(ix+3) + or (hl) + ex de,hl + and (hl) + ld e,a + ex af,af' + or e + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF + dec h + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h + ld l,(ix+4) + or (hl) + ex af,af' + inc bc + dec h + ld a,(bc) + ld l,a + ld a,(hl) + inc h + ld l,(ix+5) + or (hl) + ex de,hl + and (hl) + ld e,a + ex af,af' + or e + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF + dec h + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h + ld l,(ix+6) + or (hl) + ex af,af' + inc bc + dec h + ld a,(bc) + ld l,a + ld a,(hl) + inc h + ld l,(ix+7) + or (hl) + ex de,hl + and (hl) + ld e,a + ex af,af' + or e + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF + dec h + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h + ld l,(ix+8) + or (hl) + ex af,af' + inc bc + dec h + ld a,(bc) + ld l,a + ld a,(hl) + inc h + ld l,(ix+9) + or (hl) + ex de,hl + and (hl) + ld e,a + ex af,af' + or e + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF + dec h + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h + ld l,(ix+10) + or (hl) + ex af,af' + inc bc + dec h + ld a,(bc) + ld l,a + ld a,(hl) + inc h + ld l,(ix+11) + or (hl) + ex de,hl + and (hl) + ld e,a + ex af,af' + or e + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF + dec h + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h + ld l,(ix+12) + or (hl) + ex af,af' + inc bc + dec h + ld a,(bc) + ld l,a + ld a,(hl) + inc h + ld l,(ix+13) + or (hl) + ex de,hl + and (hl) + ld e,a + ex af,af' + or e + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF + dec h + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h + ld l,(ix+14) + or (hl) + ex af,af' + inc bc + dec h + ld a,(bc) + ld l,a + ld a,(hl) + inc h + ld l,(ix+15) + or (hl) + ex de,hl + and (hl) + ld e,a + ex af,af' + or e + ld (hl),a + ex de,hl ; de points at last scan line in char + dec h + +.coloursprite + pop hl ; hl = char struct + 9 + inc hl + ld a,(hl) ; colour + +IF DISP_HICOLOUR + push hl ; save char struct + 10 +IF NOFLICKER + ld de,tempgraphic+8 +ELSE + set 5,d +ENDIF + add a,SPTileArray%256 + ld l,a + ld a,0 + adc a,SPTileArray/256 + 2 + ld h,a ; hl = address of pallette entry + ld a,(hl) + inc h + ld h,(hl) + ld l,a ; hl = pallette entry + ld c,$80 ; transparent colour + + ld a,(hl) + cp c + jr z, col1 + ld (de),a +.col1 + inc hl +IF NOFLICKER + inc de +ELSE + dec d +ENDIF + ld a,(hl) + cp c + jr z, col2 + ld (de),a +.col2 + inc hl +IF NOFLICKER + inc de +ELSE + dec d +ENDIF + ld a,(hl) + cp c + jr z, col3 + ld (de),a +.col3 + inc hl +IF NOFLICKER + inc de +ELSE + dec d +ENDIF + ld a,(hl) + cp c + jr z, col4 + ld (de),a +.col4 + inc hl +IF NOFLICKER + inc de +ELSE + dec d +ENDIF + ld a,(hl) + cp c + jr z, col5 + ld (de),a +.col5 + inc hl +IF NOFLICKER + inc de +ELSE + dec d +ENDIF + ld a,(hl) + cp c + jr z, col6 + ld (de),a +.col6 + inc hl +IF NOFLICKER + inc de +ELSE + dec d +ENDIF + ld a,(hl) + cp c + jr z, col7 + ld (de),a +.col7 + inc hl +IF NOFLICKER + inc de +ELSE + dec d +ENDIF + ld a,(hl) + cp c + jr z, col8 + ld (de),a +.col8 + pop hl +ENDIF + +IF DISP_SPECTRUM + cp $80 ; special transparent colour + jr z, clear + ld (tempcolour),a +.clear +ENDIF + + inc hl ; hl = char struct + 11 + ld a,(hl) + or a +IF NOFLICKER + jr z, copybuffer +ELSE + jr z, nomoresprites +ENDIF + inc hl + ld l,(hl) + ld h,a ; hl = char struct + 4 of next sprite + jp spriteloop + +IF NOFLICKER +.copybuffer + pop de ; de = screen address of top of char + ld hl,tempgraphic + ld a,(hl) ; copy buffered tempgraphic to screen + ld (de),a + inc d + inc hl + ld a,(hl) + ld (de),a + inc d + inc hl + ld a,(hl) + ld (de),a + inc d + inc hl + ld a,(hl) + ld (de),a + inc d + inc hl + ld a,(hl) + ld (de),a + inc d + inc hl + ld a,(hl) + ld (de),a + inc d + inc hl + ld a,(hl) + ld (de),a + inc d + inc hl + ld a,(hl) + ld (de),a + +IF DISP_HICOLOUR + inc hl ; copy colour to screen + set 5,d + ld a,(hl) + ld (de),a + inc hl + dec d + ld a,(hl) + ld (de),a + inc hl + dec d + ld a,(hl) + ld (de),a + inc hl + dec d + ld a,(hl) + ld (de),a + inc hl + dec d + ld a,(hl) + ld (de),a + inc hl + dec d + ld a,(hl) + ld (de),a + inc hl + dec d + ld a,(hl) + ld (de),a + inc hl + dec d + ld a,(hl) + ld (de),a +ENDIF +ENDIF + +.nomoresprites +IF DISP_SPECTRUM +IF DISP_TMXDUAL + ld a,d + and $20 + ld l,a + xor d +ELSE + ld a,d ; de = screen address of last scan line in char +ENDIF + xor $85 ; find corresponding attribute address + rrca + rrca + rrca +IF DISP_TMXDUAL + or l +ENDIF + ld d,a + ld a,(tempcolour) ; what's the final colour of this square? + ld (de),a +ENDIF + + exx + pop af + ret + + +.masknorotate + ex de,hl ; hl = screen address + ld a,(bc) + ld e,a ; e = graphic + inc bc + ld a,(bc) ; a = mask + and (hl) ; portion of screen remaining + or e ; or in sprite graphic + ld (hl),a ; write to screen +IF NOFLICKER + inc hl +ELSE + inc h ; next scan line +ENDIF + inc bc + + ld a,(bc) ; repeat 8 times in total for whole char + ld e,a + inc bc + ld a,(bc) + and (hl) + or e + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF + inc bc + + ld a,(bc) ; repeat + ld e,a + inc bc + ld a,(bc) + and (hl) + or e + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF + inc bc + + ld a,(bc) ; repeat + ld e,a + inc bc + ld a,(bc) + and (hl) + or e + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF + inc bc + + ld a,(bc) ; repeat + ld e,a + inc bc + ld a,(bc) + and (hl) + or e + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF + inc bc + + ld a,(bc) ; repeat + ld e,a + inc bc + ld a,(bc) + and (hl) + or e + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF + inc bc + + ld a,(bc) ; repeat + ld e,a + inc bc + ld a,(bc) + and (hl) + or e + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF + inc bc + + ld a,(bc) ; repeat + ld e,a + inc bc + ld a,(bc) + and (hl) + or e + ld (hl),a + ex de,hl + jp coloursprite ; back to colour the sprite + + +.loadtype + ld a,h ; have a look at the rotation being used + and $0e + jp z, loadnorotate ; if no rotation draw the fast way + + ld a,(bc) ; sprite graphic + ld l,a + ld a,(hl) ; rotated right + inc h + ld l,(ix+0) ; get graphic on the left + or (hl) ; a = graphic rotated right | graphic rot. right from left + dec h + ld (de),a ; write to screen +IF NOFLICKER + inc de +ELSE + inc d ; next scan line +ENDIF +IF !COMPRESS + inc bc ; skip mask +ENDIF + inc bc + + ld a,(bc) ; repeat 8 times total for entire char + ld l,a + ld a,(hl) + inc h +IF !COMPRESS + ld l,(ix+2) +ELSE + ld l,(ix+1) +ENDIF + or (hl) + dec h + ld (de),a +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h +IF !COMPRESS + ld l,(ix+4) +ELSE + ld l,(ix+2) +ENDIF + or (hl) + dec h + ld (de),a +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h +IF !COMPRESS + ld l,(ix+6) +ELSE + ld l,(ix+3) +ENDIF + or (hl) + dec h + ld (de),a +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h +IF !COMPRESS + ld l,(ix+8) +ELSE + ld l,(ix+4) +ENDIF + or (hl) + dec h + ld (de),a +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h +IF !COMPRESS + ld l,(ix+10) +ELSE + ld l,(ix+5) +ENDIF + or (hl) + dec h + ld (de),a +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h +IF !COMPRESS + ld l,(ix+12) +ELSE + ld l,(ix+6) +ENDIF + or (hl) + dec h + ld (de),a +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h +IF !COMPRESS + ld l,(ix+14) +ELSE + ld l,(ix+7) +ENDIF + or (hl) + dec h + ld (de),a + jp coloursprite + + +.loadnorotate +IF NOFLICKER + ld l,c + ld h,b ; hl = sprite graphic + ldi ; copy graphic to temp buffer +IF !COMPRESS + inc hl ; skip mask +ENDIF + ldi ; repeat +IF !COMPRESS + inc hl +ENDIF + ldi ; repeat +IF !COMPRESS + inc hl +ENDIF + ldi ; repeat +IF !COMPRESS + inc hl +ENDIF + ldi ; repeat +IF !COMPRESS + inc hl +ENDIF + ldi ; repeat +IF !COMPRESS + inc hl +ENDIF + ldi ; repeat +IF !COMPRESS + inc hl +ENDIF + ldi ; repeat +IF COMPRESS + dec hl +ENDIF + dec de + ld c,l + ld b,h + +ELSE + + ld a,(bc) ; graphic + ld (de),a ; write to screen + inc d ; next scan line +IF !COMPRESS + inc bc ; skip mask +ENDIF + inc bc + + ld a,(bc) ; repeat 8 times total for entire char + ld (de),a + inc d +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + ld (de),a + inc d +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + ld (de),a + inc d +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + ld (de),a + inc d +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + ld (de),a + inc d +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + ld (de),a + inc d +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + ld (de),a +ENDIF + jp coloursprite + +.xortype + ld a,h ; have a look at the rotation applied + and $0e + jp z, xornorotate ; if no rotation draw the fast way + + ld a,(bc) ; graphic + ld l,a + ld a,(hl) ; graphic rotated right + inc h + ld l,(ix+0) ; graphic from left + or (hl) ; a = final graphic + dec h + ex de,hl ; hl = screen address + xor (hl) ; xor graphic onto screen + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d ; next scan line +ENDIF +IF !COMPRESS + inc bc ; ignore mask +ENDIF + inc bc + + ld a,(bc) ; repeat 8 times in total for entire char + ld l,a + ld a,(hl) + inc h + ld l,(ix+2) + or (hl) + dec h + ex de,hl + xor (hl) + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h + ld l,(ix+4) + or (hl) + dec h + ex de,hl + xor (hl) + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h + ld l,(ix+6) + or (hl) + dec h + ex de,hl + xor (hl) + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h + ld l,(ix+8) + or (hl) + dec h + ex de,hl + xor (hl) + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h + ld l,(ix+10) + or (hl) + dec h + ex de,hl + xor (hl) + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h + ld l,(ix+12) + or (hl) + dec h + ex de,hl + xor (hl) + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h + ld l,(ix+14) + or (hl) + dec h + ex de,hl + xor (hl) + ld (hl),a + ex de,hl + jp coloursprite + + +.xornorotate + ex de,hl ; hl = screen address + ld a,(bc) ; graphic + xor (hl) ; xor onto screen + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h ; next scan line +ENDIF +IF !COMPRESS + inc bc ; skip mask +ENDIF + inc bc + + ld a,(bc) ; repeat total of 8 times for entire char + xor (hl) + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + xor (hl) + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + xor (hl) + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + xor (hl) + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + xor (hl) + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + xor (hl) + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + xor (hl) + ld (hl),a + ex de,hl ; de = screen address + jp coloursprite + +.ortype + ld a,h ; have a look at the rotation applied + and $0e + jp z, ornorotate ; if no rotation draw the fast way + + ld a,(bc) ; graphic + ld l,a + ld a,(hl) ; graphic rotated right + inc h + ld l,(ix+0) ; graphic from left + or (hl) ; a = final graphic + dec h + ex de,hl ; hl = screen address + or (hl) ; or graphic onto screen + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d ; next scan line +ENDIF +IF !COMPRESS + inc bc ; ignore mask +ENDIF + inc bc + + ld a,(bc) ; repeat 8 times in total for entire char + ld l,a + ld a,(hl) + inc h + ld l,(ix+2) + or (hl) + dec h + ex de,hl + or (hl) + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h + ld l,(ix+4) + or (hl) + dec h + ex de,hl + or (hl) + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h + ld l,(ix+6) + or (hl) + dec h + ex de,hl + or (hl) + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h + ld l,(ix+8) + or (hl) + dec h + ex de,hl + or (hl) + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h + ld l,(ix+10) + or (hl) + dec h + ex de,hl + or (hl) + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h + ld l,(ix+12) + or (hl) + dec h + ex de,hl + or (hl) + ld (hl),a + ex de,hl +IF NOFLICKER + inc de +ELSE + inc d +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + ld l,a + ld a,(hl) + inc h + ld l,(ix+14) + or (hl) + dec h + ex de,hl + or (hl) + ld (hl),a + ex de,hl + jp coloursprite + + +.ornorotate + ex de,hl ; hl = screen address + ld a,(bc) ; graphic + or (hl) ; or onto screen + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h ; next scan line +ENDIF +IF !COMPRESS + inc bc ; skip mask +ENDIF + inc bc + + ld a,(bc) ; repeat total of 8 times for entire char + or (hl) + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + or (hl) + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + or (hl) + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + or (hl) + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + or (hl) + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + or (hl) + ld (hl),a +IF NOFLICKER + inc hl +ELSE + inc h +ENDIF +IF !COMPRESS + inc bc +ENDIF + inc bc + + ld a,(bc) ; repeat + or (hl) + ld (hl),a + ex de,hl ; de = screen address + jp coloursprite diff --git a/lib/splib2/updater/SPValidate.asm b/lib/splib2/updater/SPValidate.asm new file mode 100644 index 00000000..5b8e061c --- /dev/null +++ b/lib/splib2/updater/SPValidate.asm @@ -0,0 +1,108 @@ +; +; Validate Rectangle +; Alvin Albrecht 01.2003 +; + +INCLUDE "SPconfig.def" + +XLIB SPValidate +XDEF SPValidateP +LIB SPIntRect, SPCompDirtyAddr, SPbitleft2mask, SPbitright2mask + + +; Validate Rectangle +; +; enter: B = row coord top left corner +; C = col coord top left corner +; D = row coord bottom right corner +; E = col coord bottom right corner +; IY = clipping rectangle, set it to "ClipStruct" for full screen + +.SPValidate + ld a,d + sub b + inc a + ld d,a ; d = row height + ld a,e + sub c + inc a + ld e,a ; e = col width + +.SPValidateP + call SPIntRect ; call here if D = height, E = width + ret c + + ; b = row, c = col, d = height, e = width + + push de + ld a,b + call SPCompDirtyAddr ; hl = address into dirty chars array, a = bit position + pop de + + dec e + ld b,a + add a,e + ld c,a + ld a,b + add a,SPbitleft2mask%256 + ld e,a + ld b,d + ld d,SPbitleft2mask/256 + jp nc, noinc1 + inc d + +.noinc1 + ld a,(de) + cpl + ld e,a + ld d,b + ld a,c + +.valcollp + cp 8 + jr nc, valfullchar + ;dec a + push de + ld b,e + add a,SPbitright2mask%256 + ld e,a + ld d,SPbitright2mask/256 + jp nc, noinc2 + inc d + +.noinc2 + ld a,(de) + cpl + or b + pop de + ld e,a + +.valfullchar + ld b,d + push hl + +.valrowlp + ld a,(hl) + and e + ld (hl),a +IF DISP_HIRES + ld a,64/8 +ELSE + ld a,32/8 +ENDIF + add a,l + ld l,a + jp nc, noinc3 + inc h + +.noinc3 + djnz valrowlp + pop hl + inc hl + ld e,$00 + ld a,c + sub 8 + ld c,a + ;ret z + jp nc, valcollp + ret diff --git a/lib/splib2/updater/SPValidate.o b/lib/splib2/updater/SPValidate.o new file mode 100644 index 00000000..c9b54d59 Binary files /dev/null and b/lib/splib2/updater/SPValidate.o differ diff --git a/lib/splib2/updater/timing.txt b/lib/splib2/updater/timing.txt new file mode 100644 index 00000000..46c70f87 --- /dev/null +++ b/lib/splib2/updater/timing.txt @@ -0,0 +1,50 @@ +update loop: + HIRES: 85 + 14.1875C + 364.5D + ELSE : 85 + 14.1875C + 316.5D + + + NOROTATE/NOFLICKER ROTATE/NOFLICKER +load spec 555 / +9 915 / +9 +load hires 474 / +9 834 / +9 +load hiclr 914 / +23 1333 / +23 + +(x)or spec 653 / +9 1069 / +9 +(x)or hires 572 / +9 988 / +9 +(x)or hiclr 1012 / +23 1485 / +23 + +mask spec 747 / +9 1629 / +9 +mask hires 666 / +9 1523 / +9 +mask hiclr 1100 / +23 2017 / +23 + +C = number chars = 32*24 +D = num dirty areas, max(C/8) +N = num chars needing update +S = num dirty chars with sprites +L = num dirty chars with sprite with 1st char load or SCROLLER mode + + +SPECTRUM: + +85 + 14.1875C + 316.5D ++ 393N + (32N NOFLICKER) ++ 152S + (202S NOFLICKER) +- 210L ++ sprites + + +HIRES: + +85 + 14.1875C + 364.5D ++ 320N + (32N NOFLICKER) ++ 205S + (202S NOFLICKER) +- 210L ++ sprites + + +HICLR: + +85 + 14.1875C + 316.5D ++ 526N + (32N NOFLICKER) ++ 4S + (398S NOFLICKER) +- 206L ++ sprites diff --git a/mk1.sublime-workspace b/mk1.sublime-workspace index 2746d218..d954c943 100644 --- a/mk1.sublime-workspace +++ b/mk1.sublime-workspace @@ -324,29 +324,38 @@ "buffers": [ { - "file": "src/utils/src/msc3_mk1.bas", + "file": "README.md", "settings": { - "buffer_size": 80254, + "buffer_size": 3871, "encoding": "UTF-8", "line_ending": "Windows" } }, { - "file": "/D/Proyectos/2019/20190731a - Bajas automáticas en Ficheros Junta/instrucciones.txt", + "file": "docs/tutorial-cap01.md", "settings": { - "buffer_size": 316, + "buffer_size": 20511, "encoding": "UTF-8", "line_ending": "Windows" } }, { - "file": "src/dev/definitions.h", + "file": "lib/splib2/setenv.bat", "settings": { - "buffer_size": 7303, - "encoding": "Western (Windows 1252)", + "buffer_size": 141, + "encoding": "UTF-8", + "line_ending": "Windows" + } + }, + { + "file": "src/dev/setenv.bat", + "settings": + { + "buffer_size": 141, + "encoding": "UTF-8", "line_ending": "Windows" } } @@ -411,14 +420,62 @@ }, "expanded_folders": [ - "/D/temp/MK1", - "/D/temp/MK1/src", - "/D/temp/MK1/src/dev", - "/D/temp/MK1/src/utils", - "/D/temp/MK1/src/utils/src" + "/D/temp/vmware_shared/MK1", + "/D/temp/vmware_shared/MK1/docs", + "/D/temp/vmware_shared/MK1/env", + "/D/temp/vmware_shared/MK1/lib", + "/D/temp/vmware_shared/MK1/src", + "/D/temp/vmware_shared/MK1/src/dev" ], "file_history": [ + "/D/temp/vmware_shared/MK1/examples/goku_mal/dev/my/ci/extra_functions.h", + "/D/temp/vmware_shared/MK1/examples/goku_mal/dev/my/fixed_screens.h", + "/D/temp/vmware_shared/MK1/examples/goku_mal/dev/my/config.h", + "/D/temp/vmware_shared/MK1/examples/goku_mal/dev/my/levelset.h", + "/D/temp/vmware_shared/MK1/examples/goku_mal/dev/my/ci/entering_game.h", + "/D/temp/vmware_shared/MK1/examples/goku_mal/dev/engine/c_levels.h", + "/D/temp/vmware_shared/MK1/examples/goku_mal/dev/compile.bat", + "/D/temp/vmware_shared/MK1/examples/goku_mal/dev/my/ci/after_load.h", + "/D/temp/vmware_shared/MK1/examples/goku_mal/dev/my/title_screen.h", + "/D/temp/vmware_shared/MK1/examples/goku_mal/dev/my/level_screen.h", + "/D/temp/vmware_shared/MK1/examples/goku_mal/dev/mainloop/game_loop.h", + "/D/temp/vmware_shared/MK1/examples/goku_mal/dev/my/ci/before_entering_screen.h", + "/D/Proyectos/2021/20210629a - Cambio de password desde SSOWeb en miCuenta/instrucciones.txt", + "/D/temp/vmware_shared/MK1/docs/tutorial-cap13.md", + "/D/temp/vmware_shared/MK1/examples/helmet/dev/engine/c_levels.h", + "/D/temp/vmware_shared/MK1/examples/helmet/dev/assets/levels.h", + "/D/temp/vmware_shared/MK1/examples/helmet/dev/compile.bat", + "/D/temp/vmware_shared/MK1/examples/helmet/dev/my/config.h", + "/D/temp/vmware_shared/MK1/examples/helmet/dev/my/fixed_screens.h", + "/D/temp/vmware_shared/MK1/examples/helmet/dev/my/ci/entering_screen.h", + "/D/temp/vmware_shared/MK1/examples/helmet/dev/mainloop.h", + "/D/temp/vmware_shared/MK1/examples/helmet/dev/mainloop/flick_screen.h", + "/D/temp/vmware_shared/MK1/examples/helmet/dev/my/ci/extra_routines.h", + "/D/temp/vmware_shared/MK1/examples/helmet/dev/my/ci/after_game_loop.h", + "/D/temp/vmware_shared/MK1/examples/goddess/dev/my/ci/entering_screen.h", + "/D/temp/vmware_shared/MK1/examples/goddess/dev/my/ci/hotspots_custom.h", + "/D/temp/vmware_shared/MK1/examples/goddess/dev/my/ci/before_game.h", + "/D/temp/vmware_shared/MK1/examples/goddess/dev/my/ci/entering_game.h", + "/Y/MK2/examples/Tokimal/dev/minimal.asm", + "/W/MK1/src/dev/lala_beta.asm", + "/W/MK1/src/dev/engine/player.h", + "/W/MK1/src/dev/my/fixed_screens.h", + "/Y/MK1_Pestecera/examples/jetpaco/dev/crt.asm", + "/W/MK1/src/dev/crt.asm", + "/W/MK1/src/dev/definitions.h", + "/W/MK1/src/dev/compile.bat", + "/W/MK1/src/dev/pantallas.h", + "/C/z88dk10/lib/spec_crt0.asm", + "/W/MK1/lib/splib2/setenv.bat", + "/W/MK1/lib/splib2/Makefile.bat", + "/W/MK1/lib/splib2/backgroundtiles/SPPrintString.asm", + "/W/MK1/lib/splib2/sp.lst", + "/W/MK1/lib/splib2/updater/SPUpdateNow.asm", + "/W/MK1/lib/splib2/cwrapper/GenCompile.c", + "/D/temp/MK1/src/utils/src/msc3_mk1.bas", + "/D/Proyectos/2019/20190731a - Bajas automáticas en Ficheros Junta/instrucciones.txt", + "/D/temp/MK1/src/dev/mainloop.h", "/D/temp/MK1/src/dev/definitions.h", "/D/temp/MK1/trash/6baddies/utils/src/ene2h.bas", "/D/temp/MK1/trash/6baddies/dev/assets/levels.h", @@ -499,54 +556,7 @@ "/D/temp/mw1311ws/makefilewithlua", "/C/Users/jcastano/AppData/Local/Temp/7zO0E105AB9/readsrc.txt", "/D/Proyectos/remote/descon01/consigna/LICENSE", - "/D/Proyectos/remote/descon01/consigna/saml-desarrollo.pem", - "/D/Proyectos/remote/descon01/consigna/public/robots.txt", - "/D/Proyectos/remote/descon01/consigna/saml.pem_antiguo", - "/D/temp/mw1311ws/readsrc.txt", - "/D/Proyectos/remote/descon01/consigna/public/license.txt", - "/D/Proyectos/remote/descon01/consigna/TODO", - "/D/Proyectos/remote/descon01/consigna/UPDATE-CodeIgniter", - "/D/Proyectos/remote/descon01/consigna/readme.certificate", - "/D/Proyectos/remote/descon01/consigna/README", - "/D/Proyectos/remote/descon01/consigna/INSTALL.SELinux", - "/D/Proyectos/remote/descon01/consigna/INSTALL", - "/D/Proyectos/remote/descon01/consigna/HEAD", - "/D/Proyectos/remote/descon01/consigna/description", - "/D/Proyectos/remote/descon01/consigna/BUGS", - "/D/Proyectos/remote/descon01/consigna/public/js/jquery.blockUI_2.31.js", - "/D/Proyectos/remote/descon01/consigna/public/js/configtest.js", - "/D/Proyectos/remote/descon01/consigna/public/js/iepngfix.htc", - "/D/Proyectos/remote/descon01/consigna/app/views/form-login.php", - "/D/Proyectos/remote/descon01/consigna/system/core/Input.php", - "/D/Proyectos/remote/descon01/consigna/system/core/Security.php", - "/D/Proyectos/remote/descon01/consigna/app/controllers/ficheros.php-deprecated", - "/D/Proyectos/remote/descon01/consigna/public/js/jquery.cluetip.js", - "/D/Proyectos/remote/descon01/consigna/public/js/jquery.dimensions.pack.js", - "/D/Proyectos/remote/descon01/consigna/public/js/jquery.overlay-1.2.3.pack.js", - "/D/Proyectos/remote/descon01/consigna/public/js/jquery.overlay-1.2.3.src.js", - "/D/Proyectos/remote/descon01/consigna/public/js/jquery.timers.js", - "/D/Proyectos/remote/descon01/consigna/public/js/pwdmeter.js", - "/D/Proyectos/remote/desbuz02/sftp-config.json", - "/D/Proyectos/remote/descon01/consigna/system/core/Common.php", - "/D/Proyectos/remote/descon01/consigna/system/libraries/Form_validation.php", - "/D/Proyectos/remote/descon01/consigna/public/js/interfaz.js", - "/D/Proyectos/remote/descon01/consigna/app/config/avanzadas.php", - "/D/Proyectos/remote/descon01/consigna/app/libraries/MY_Form_validation.php", - "/D/Proyectos/remote/descon01/consigna/app/controllers/api_v1/api.php", - "/D/Proyectos/remote/descon01/consigna/app/views/ver_fichero_denegado.php", - "/D/Proyectos/remote/descon01/consigna/app/views/antivirus/INFECTADO.php", - "/D/Proyectos/remote/descon01/consigna/app/views/form-envio-fichero.php", - "/D/Proyectos/remote/descon01/consigna/app/views/form-opciones-fichero.php", - "/D/Proyectos/remote/descon01/consigna/system/.htaccess", - "/D/Proyectos/remote/descon01/consigna/.htaccess", - "/D/Proyectos/remote/descon01/consigna/system/core/Exceptions.php", - "/D/Proyectos/remote/descon01/consigna/app/errors/error_general.php", - "/D/Proyectos/remote/descon01/consigna/app/errors/error_php.php", - "/D/Proyectos/remote/descon01/consigna/app/errors/error_db.php", - "/D/Proyectos/remote/descon01/consigna/app/errors/error_404.php", - "/C/Users/jcastano/Desktop/LDAP Browser/ldapescritura.juntadeandalucia.es - admin (2).cfg", - "/C/Users/jcastano/Desktop/LDAP Browser/ldap.juntadeandalucia.es - admin.cfg", - "/C/Users/jcastano/Downloads/20191119104404436 instrucciones.txt" + "/D/Proyectos/remote/descon01/consigna/saml-desarrollo.pem" ], "find": { @@ -557,6 +567,7 @@ "height": 128.0, "where_history": [ + "D:\\temp\\vmware_shared\\MK1\\docs", "D:\\temp\\MK1\\trash\\6baddies", "D:\\temp\\MK1\\src", "D:\\temp\\MK1\\trash\\6baddies\\dev", @@ -571,6 +582,17 @@ "case_sensitive": false, "find_history": [ + "level_data", + "level_data->", + "pursuers_max_v", + "font", + "font.bin", + "level_data->", + "spacer", + "0ch", + "p_next_frame", + "computepos", + "NO_MASKS", "timer_", "ctimer.(on|t|frames|count|zero)", "ctimer.(frames)", @@ -598,6 +620,7 @@ "regex": true, "replace_history": [ + "level_data.", "timer_\\1", "timer_t", "NO_MASKS", @@ -618,19 +641,19 @@ [ { "buffer": 0, - "file": "src/utils/src/msc3_mk1.bas", + "file": "README.md", "semi_transient": false, "settings": { - "buffer_size": 80254, + "buffer_size": 3871, "regions": { }, "selection": [ [ - 22847, - 22853 + 1341, + 1341 ] ], "settings": @@ -638,67 +661,92 @@ "incomplete_sync": null, "remote_loading": false, "synced": false, - "syntax": "Packages/Syntax QBasic/QBasic.tmLanguage", - "translate_tabs_to_spaces": false + "syntax": "Packages/Markdown Extended/Syntaxes/Markdown Extended.sublime-syntax" }, "translation.x": 0.0, - "translation.y": 8752.0, + "translation.y": 0.0, "zoom_level": 1.0 }, - "stack_index": 1, + "stack_index": 3, "type": "text" }, { "buffer": 1, - "file": "/D/Proyectos/2019/20190731a - Bajas automáticas en Ficheros Junta/instrucciones.txt", + "file": "docs/tutorial-cap01.md", "semi_transient": false, "settings": { - "buffer_size": 316, + "buffer_size": 20511, "regions": { }, "selection": [ [ - 0, - 0 + 17030, + 17030 ] ], "settings": { + "incomplete_sync": null, "remote_loading": false, "synced": false, - "syntax": "Packages/Text/Plain text.tmLanguage" + "syntax": "Packages/Markdown Extended/Syntaxes/Markdown Extended.sublime-syntax" }, "translation.x": 0.0, - "translation.y": 0.0, + "translation.y": 3276.0, "zoom_level": 1.0 }, "stack_index": 0, "type": "text" - } - ] - }, - { - "selected": 0, - "sheets": - [ + }, { "buffer": 2, - "file": "src/dev/definitions.h", - "semi_transient": true, + "file": "lib/splib2/setenv.bat", + "semi_transient": false, + "settings": + { + "buffer_size": 141, + "regions": + { + }, + "selection": + [ + [ + 10, + 10 + ] + ], + "settings": + { + "incomplete_sync": null, + "remote_loading": false, + "synced": false, + "syntax": "Packages/Batch File/Batch File.sublime-syntax" + }, + "translation.x": 0.0, + "translation.y": 0.0, + "zoom_level": 1.0 + }, + "stack_index": 1, + "type": "text" + }, + { + "buffer": 3, + "file": "src/dev/setenv.bat", + "semi_transient": false, "settings": { - "buffer_size": 7303, + "buffer_size": 141, "regions": { }, "selection": [ [ - 4964, - 4969 + 140, + 140 ] ], "settings": @@ -706,17 +754,21 @@ "incomplete_sync": null, "remote_loading": false, "synced": false, - "syntax": "Packages/C++/C++.sublime-syntax", - "translate_tabs_to_spaces": false + "syntax": "Packages/Batch File/Batch File.sublime-syntax" }, "translation.x": 0.0, - "translation.y": 2335.0, + "translation.y": 0.0, "zoom_level": 1.0 }, "stack_index": 2, "type": "text" } ] + }, + { + "sheets": + [ + ] } ], "incremental_find": @@ -747,7 +799,7 @@ "cols": [ 0.0, - 0.5, + 0.523501762632, 1.0 ], "rows": @@ -803,7 +855,7 @@ ], "width": 0.0 }, - "selected_group": 0, + "selected_group": 1, "settings": { }, @@ -811,7 +863,7 @@ "show_open_files": false, "show_tabs": true, "side_bar_visible": true, - "side_bar_width": 299.0, + "side_bar_width": 273.0, "status_bar_visible": true, "template_settings": { diff --git a/src/bin/ending.bin b/src/bin/ending.bin new file mode 100644 index 00000000..29da6ba0 Binary files /dev/null and b/src/bin/ending.bin differ diff --git a/src/bin/marco.bin b/src/bin/marco.bin new file mode 100644 index 00000000..62123e85 Binary files /dev/null and b/src/bin/marco.bin differ diff --git a/src/bin/title.bin b/src/bin/title.bin new file mode 100644 index 00000000..a7a3e2c5 Binary files /dev/null and b/src/bin/title.bin differ diff --git a/src/dev/assets/levels.h b/src/dev/assets/levels.h index f2e45409..bd29b455 100644 --- a/src/dev/assets/levels.h +++ b/src/dev/assets/levels.h @@ -64,7 +64,7 @@ extern unsigned char font [0]; ._font BINARY "font.bin" #endasm -extern LEVELHEADER level_data [0]; +extern LEVELHEADER level_data; #asm ._level_data defs 16 #endasm diff --git a/src/dev/assets/levels.h.bak b/src/dev/assets/levels.h.bak deleted file mode 100644 index c601614a..00000000 --- a/src/dev/assets/levels.h.bak +++ /dev/null @@ -1,119 +0,0 @@ -// MTE MK1 (la Churrera) v5.0 -// Copyleft 2010-2014, 2020 by the Mojon Twins - -// Levels.h - -// Contains data structures used for multi level games -// Prepared for 128K level bundles and standard 48K levels - -// Usually, 48K levels use the same sprites for all levels -// unless PER_LEVEL_SPRITESET is defined in 48K mode. - -// Level bundles used in 128K games contain: -// Level data, 16 bytes -// Map data, 75 or 150 * (MAP_W*MAP_H) bytes -// Bolts, 32 * 4 = 128 bytes -// Tileset, 2304 bytes -// Enemies, MAP_W * MAP_H * 3 * 10 bytes -// Hotspots, MAP_W * MAP_H * 3 bytes -// Behs, 48 bytes -// Spriteset, 2312 bytes - -// Definitions - -// You can adjust this number if you need the bytes **ONLY** in 48K mode. -#define MAX_CERROJOS 32 - -// Types: - -typedef struct { - unsigned char map_w, map_h; - unsigned char scr_ini, ini_x, ini_y; - unsigned char max_objs; - unsigned char enems_life; - unsigned char d01; // Reserved - unsigned char d02; - unsigned char d03; - unsigned char d04; - unsigned char d05; - unsigned char d06; - unsigned char d07; - unsigned char d08; - unsigned char d09; -} LEVELHEADER; - -typedef struct { - unsigned char np, x, y, st; -} CERROJOS; - -typedef struct { - unsigned char x, y; - unsigned char x1, y1, x2, y2; - char mx, my; - unsigned char t, life; -} MALOTE; - -typedef struct { - unsigned char xy, tipo, act; -} HOTSPOT; - -// This space will be overwritten by level data - -extern unsigned char font [0]; -#asm - ._font BINARY "font.bin" -#endasm - -extern LEVELHEADER level_data [0]; -#asm - ._level_data defs 16 -#endasm - -extern unsigned char mapa [0]; -#ifdef UNPACKED_MAP - #asm - ._mapa defs MAP_W * MAP_H * 150 - #endasm -#else - #asm - ._mapa defs MAP_W * MAP_H * 75 - #endasm -#endif - -#ifndef DEACTIVATE_KEYS - extern CERROJOS cerrojos [0]; - #asm - ._cerrojos defs 128 ; 32 * 4 - #endasm -#endif - -extern unsigned char tileset [0]; -#asm - ._tileset defs 1792 ; 192 * 8 + 256 -#endasm - -extern MALOTE malotes [0]; -#asm - ._malotes defs MAP_W * MAP_H * 3 * 10 -#endasm - -extern HOTSPOT hotspots [0]; -#asm - ._hotspots defs MAP_W * MAP_H * 3 -#endasm - -extern unsigned char behs [0]; -#asm - ._behs defs 48 -#endasm - -extern unsigned char sprites [0]; -#asm - ._sprites -#endasm - -#if defined MODE_128K || defined PER_LEVEL_SPRITESET - #include "assets/sprites-empty.h" -#else - #include "assets/sprites.h" -#endif diff --git a/src/dev/compile.bat b/src/dev/compile.bat index 547b3dec..46b15e70 100644 --- a/src/dev/compile.bat +++ b/src/dev/compile.bat @@ -66,7 +66,8 @@ rem cd ..\dev :compile echo Compilando guego -zcc +zx -vn mk1.c -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul +zcc +zx -vn mk1.c -O3 -crt0=crt.asm -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul +rem zcc +zx -vn mk1.c -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul ..\utils\printsize.exe %game%.bin ..\utils\printsize.exe scripts.bin diff --git a/src/dev/crt.asm b/src/dev/crt.asm new file mode 100644 index 00000000..27e0d47d --- /dev/null +++ b/src/dev/crt.asm @@ -0,0 +1,17 @@ + MODULE zx82_crt0 + INCLUDE "zcc_opt.def" + XREF _main ; main() is always external to crt0 code + + IF !STACKPTR + defc STACKPTR = $FFFF + ENDIF + + IF !CRT_ORG_CODE + defc CRT_ORG_CODE = 32768 + ENDIF + + org CRT_ORG_CODE + +start: + ld sp,STACKPTR + jp _main diff --git a/src/dev/definitions.h b/src/dev/definitions.h index 16e429ba..38f3bd82 100644 --- a/src/dev/definitions.h +++ b/src/dev/definitions.h @@ -6,7 +6,8 @@ .fsClipStruct defb 0, 24, 0, 32 #endasm -void *joyfunc = sp_JoyKeyboard; // Puntero a la función de manejo seleccionada. +//void *joyfunc = sp_JoyKeyboard; // Puntero a la función de manejo seleccionada. +unsigned int (*joyfunc)(struct sp_UDK *) = sp_JoyKeyboard; const void *joyfuncs [] = { sp_JoyKeyboard, sp_JoyKempston, sp_JoySinclair1 @@ -118,7 +119,7 @@ unsigned char p_tx, p_ty; #endif signed int ptgmx, ptgmy; -const unsigned char *spacer = " "; +unsigned char *spacer = " "; unsigned char enit; diff --git a/src/dev/engine/c_levels.h b/src/dev/engine/c_levels.h index 18b118a1..cbbaf91a 100644 --- a/src/dev/engine/c_levels.h +++ b/src/dev/engine/c_levels.h @@ -10,8 +10,8 @@ void prepare_level (void) { #endif { n_pant = level_data.scr_ini; - gpx = level_data->ini_x << 4; p_x = gpx << 6; - gpy = level_data->ini_y << 4; p_y = gpy << 6; + gpx = level_data.ini_x << 4; p_x = gpx << 6; + gpy = level_data.ini_y << 4; p_y = gpy << 6; } #ifdef ACTIVATE_SCRIPTING @@ -27,8 +27,8 @@ void prepare_level (void) { unpack ((unsigned int) levels [level].c_sprites, (unsigned int) (sprites + 16)); #endif - level_data->map_w = levels [level].map_w; - level_data->map_h = levels [level].map_h; + level_data.map_w = levels [level].map_w; + level_data.map_h = levels [level].map_h; #ifdef ACTIVATE_SCRIPTING if (script_result != 3) diff --git a/src/dev/engine/player.h b/src/dev/engine/player.h index 608bf647..59844d68 100644 --- a/src/dev/engine/player.h +++ b/src/dev/engine/player.h @@ -725,19 +725,19 @@ unsigned char player_move (void) { } } - p_next_frame = player_cells [p_facing + p_frame]; + p_next_frame = (unsigned char *) (player_cells [p_facing + p_frame]); #elif defined PLAYER_BOOTEE gpit = p_facing << 2; if (p_vy == 0) { - p_next_frame = player_cells [gpit]; + p_next_frame = (unsigned char *) (player_cells [gpit]); } else if (p_vy < 0) { - p_next_frame = player_cells [gpit + 1]; + p_next_frame = (unsigned char *) (player_cells [gpit + 1]); } else { - p_next_frame = player_cells [gpit + 2]; + p_next_frame = (unsigned char *) (player_cells [gpit + 2]); } #else if (!possee && !p_gotten) { - p_next_frame = player_cells [8 + p_facing]; + p_next_frame = (unsigned char *) (player_cells [8 + p_facing]); } else { gpit = p_facing << 2; if (p_vx == 0) { @@ -745,7 +745,7 @@ unsigned char player_move (void) { } else { rda = ((gpx + 4) >> 3) & 3; } - p_next_frame = player_cells [gpit + rda]; + p_next_frame = (unsigned char *) (player_cells [gpit + rda]); } #endif } diff --git a/src/dev/lala_beta.asm b/src/dev/lala_beta.asm new file mode 100644 index 00000000..8d9274df --- /dev/null +++ b/src/dev/lala_beta.asm @@ -0,0 +1,12529 @@ +;* * * * * Small-C/Plus z88dk * * * * * +; Version: 20100416.1 +; +; Reconstructed for z80 Module Assembler +; +; Module compile time: Mon Jun 28 10:12:12 2021 + + + + MODULE mk1.c + + + INCLUDE "z80_crt0.hdr" + + + LIB SPMoveSprAbs + LIB SPPrintAtInv + LIB SPTileArray + LIB SPInvalidate + LIB SPCompDListAddr +; SECTION text + +._keys + defw 383 + defw 479 + defw 735 + defw 509 + defw 507 + +; SECTION code + +; SECTION text + +._behs + defm "" + defb 0 + + defm "" + defb 8 + + defm "" + defb 8 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 8 + + defm "" + defb 8 + + defm "" + defb 1 + + defm "" + defb 8 + + defm "" + defb 8 + + defm "" + defb 8 + + defm "" + defb 8 + + defm "" + defb 8 + + defm "" + defb 8 + + defm "" + defb 10 + + defm "" + defb 10 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + +; SECTION code + + + .vpClipStruct defb 2, 2 + 20, 1, 1 + 30 + .fsClipStruct defb 0, 24, 0, 32 +; SECTION text + +._joyfunc + defw sp_JoyKeyboard + +; SECTION code + +; SECTION text + +._joyfuncs + defw sp_JoyKeyboard + defw sp_JoyKempston + defw sp_JoySinclair1 + +; SECTION code + + +._my_malloc + ld hl,0 % 256 ;const + push hl + call sp_BlockAlloc + pop bc + ret + + +; SECTION text + +._u_malloc + defw _my_malloc + +; SECTION code + +; SECTION text + +._u_free + defw sp_FreeBlock + +; SECTION code + +; SECTION text + +._spacer + defw i_1+0 +; SECTION code + +; SECTION text + +._warp_to_level + defm "" + defb 0 + +; SECTION code + + + ; aPPack decompressor + ; original source by dwedit + ; very slightly adapted by utopian + ; optimized by Metalbrain + ;hl = source + ;de = dest + .depack ld ixl,128 + .apbranch1 ldi + .aploop0 ld ixh,1 ;LWM = 0 + .aploop call ap_getbit + jr nc,apbranch1 + call ap_getbit + jr nc,apbranch2 + ld b,0 + call ap_getbit + jr nc,apbranch3 + ld c,16 ;get an offset + .apget4bits call ap_getbit + rl c + jr nc,apget4bits + jr nz,apbranch4 + ld a,b + .apwritebyte ld (de),a ;write a 0 + inc de + jr aploop0 + .apbranch4 and a + ex de,hl ;write a previous byte (1-15 away from dest) + sbc hl,bc + ld a,(hl) + add hl,bc + ex de,hl + jr apwritebyte + .apbranch3 ld c,(hl) ;use 7 bit offset, length = 2 or 3 + inc hl + rr c + ret z ;if a zero is encountered here, it is EOF + ld a,2 + adc a,b + push hl + ld iyh,b + ld iyl,c + ld h,d + ld l,e + sbc hl,bc + ld c,a + jr ap_finishup2 + .apbranch2 call ap_getgamma ;use a gamma code * 256 for offset, another gamma code for length + dec c + ld a,c + sub ixh + jr z,ap_r0_gamma ;if gamma code is 2, use old r0 offset, + dec a + ;do I even need this code? + ;bc=bc*256+(hl), lazy 16bit way + ld b,a + ld c,(hl) + inc hl + ld iyh,b + ld iyl,c + push bc + call ap_getgamma + ex (sp),hl ;bc = len, hl=offs + push de + ex de,hl + ld a,4 + cp d + jr nc,apskip2 + inc bc + or a + .apskip2 ld hl,127 + sbc hl,de + jr c,apskip3 + inc bc + inc bc + .apskip3 pop hl ;bc = len, de = offs, hl=junk + push hl + or a + .ap_finishup sbc hl,de + pop de ;hl=dest-offs, bc=len, de = dest + .ap_finishup2 ldir + pop hl + ld ixh,b + jr aploop + .ap_r0_gamma call ap_getgamma ;and a new gamma code for length + push hl + push de + ex de,hl + ld d,iyh + ld e,iyl + jr ap_finishup + .ap_getbit ld a,ixl + add a,a + ld ixl,a + ret nz + ld a,(hl) + inc hl + rla + ld ixl,a + ret + .ap_getgamma ld bc,1 + .ap_getgammaloop call ap_getbit + rl c + rl b + call ap_getbit + jr c,ap_getgammaloop + ret + ._s_title + BINARY "..\bin\title.bin" + ._s_marco + BINARY "..\bin\marco.bin" + ._s_ending + BINARY "..\bin\ending.bin" + +._blackout + ld hl, 22528 + ld (hl), 0 + push hl + pop de + inc de + ld bc, 767 + ldir + ret + + +; SECTION text + +._mapa + defm "" + defb 18 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "UUQ" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "UUU" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "UUUR" + defb 0 + + defm "" + defb 0 + + defm "" + defb 224 + + defm "" + defb 21 + + defm "UUU" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 226 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 208 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 25 + + defm "" + defb 208 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 3 + + defm "331" + defb 153 + + defm "" + defb 208 + + defm "" + defb 0 + + defm "" + defb 21 + + defm "UUU" + defb 0 + + defm "" + defb 192 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 11 + + defm "" + defb 203 + + defm "" + defb 176 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "UUU" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 5 + + defm "U" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "@UPUU" + defb 0 + + defm "" + defb 0 + + defm "" + defb 6 + + defm "eU" + defb 5 + + defm "UQ" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 17 + + defm "" + defb 16 + + defm "" + defb 18 + + defm "" + defb 17 + + defm "" + defb 16 + + defm "" + defb 4 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 0 + + defm "`" + defb 0 + + defm "3333$" + defb 0 + + defm "" + defb 0 + + defm "" + defb 5 + + defm "UUUQ`" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 6 + + defm "`" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 6 + + defm "`" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "`" + defb 0 + + defm "@" + defb 0 + + defm "" + defb 0 + + defm "" + defb 4 + + defm "" + defb 0 + + defm "`" + defb 0 + + defm "" + defb 6 + + defm "`" + defb 0 + + defm "" + defb 0 + + defm "f" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 4 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "f" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "f" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 6 + + defm "`" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 192 + + defm "" + defb 0 + + defm "" + defb 176 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 203 + + defm "" + defb 192 + + defm "" + defb 188 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "UUU[" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "UUUUP" + defb 0 + + defm "" + defb 0 + + defm "UUUUUP" + defb 0 + + defm "UUUUUUP" + defb 1 + + defm "" + defb 18 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "!" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 3 + + defm "1" + defb 17 + + defm " 333" + defb 0 + + defm "1" + defb 16 + + defm "" + defb 0 + + defm "" + defb 3 + + defm "33 " + defb 0 + + defm "3333" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 3 + + defm "3330" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "31" + defb 3 + + defm "3" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 3 + + defm "3" + defb 0 + + defm "30" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "3333" + defb 0 + + defm "" + defb 0 + + defm "P" + defb 1 + + defm "" + defb 3 + + defm "33$" + defb 0 + + defm "" + defb 5 + + defm "" + defb 0 + + defm "'wwq`" + defb 0 + + defm "" + defb 16 + + defm "" + defb 1 + + defm "" + defb 17 + + defm "!" + defb 17 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "A" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 6 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 12 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "UUUUP" + defb 0 + + defm "" + defb 0 + + defm "UUUUUP" + defb 0 + + defm "UUUUUUPUUUUUUUUUUUUUUU" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 240 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 2 + + defm "" + defb 26 + + defm "" + defb 153 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 9 + + defm "" + defb 157 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm " " + defb 154 + + defm "" + defb 157 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 10 + + defm "" + defb 9 + + defm "" + defb 157 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 17 + + defm " " + defb 0 + + defm "" + defb 154 + + defm "" + defb 145 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 0 + + defm "" + defb 10 + + defm "" + defb 9 + + defm " " + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 145 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 9 + + defm "" + defb 16 + + defm "" + defb 1 + + defm "" + defb 0 + + defm "" + defb 17 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 161 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 30 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "32" + defb 0 + + defm "" + defb 4 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 3 + + defm "3" + defb 16 + + defm "" + defb 4 + + defm "`" + defb 1 + + defm "" + defb 0 + + defm "" + defb 16 + + defm "31" + defb 0 + + defm "`" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 3 + + defm "<" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "3" + defb 17 + + defm "" + defb 224 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 2 + + defm "" + defb 19 + + defm "0" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 2 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "31" + defb 0 + + defm "@" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 3 + + defm "3" + defb 16 + + defm "" + defb 6 + + defm "`" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "31" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "@" + defb 0 + + defm "" + defb 0 + + defm "f" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "f" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 4 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "@" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "f" + defb 0 + + defm "" + defb 0 + + defm "" + defb 6 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 12 + + defm "" + defb 12 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 6 + + defm "`" + defb 0 + + defm "" + defb 176 + + defm "" + defb 176 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 13 + + defm "" + defb 13 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 160 + + defm "" + defb 160 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 16 + + defm "" + defb 3 + + defm "3331" + defb 0 + + defm " " + defb 3 + + defm "3331" + defb 16 + + defm "" + defb 1 + + defm "" + defb 3 + + defm "33" + defb 16 + + defm "3" + defb 1 + + defm "" + defb 0 + + defm "" + defb 16 + + defm "330" + defb 3 + + defm "3 " + defb 1 + + defm "" + defb 3 + + defm "" + defb 16 + + defm "3330" + defb 0 + + defm "" + defb 16 + + defm "0" + defb 3 + + defm "3330" + defb 1 + + defm "" + defb 192 + + defm "33" + defb 16 + + defm "33p" + defb 21 + + defm "P30" + defb 3 + + defm "3" + defb 17 + + defm "" + defb 2 + + defm "" + defb 18 + + defm "" + defb 3 + + defm "33" + defb 16 + + defm "2" + defb 0 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "330" + defb 3 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 16 + + defm "" + defb 4 + + defm "" + defb 132 + + defm "D" + defb 132 + + defm "D" + defb 132 + + defm "A" + defb 4 + + defm "" + defb 221 + + defm "" + defb 221 + + defm "" + defb 221 + + defm "" + defb 221 + + defm "" + defb 221 + + defm "" + defb 221 + + defm "" + defb 16 + + defm "" + defb 217 + + defm "" + defb 153 + + defm "" + defb 153 + + defm "" + defb 153 + + defm "" + defb 153 + + defm "" + defb 153 + + defm "" + defb 145 + + defm "" + defb 10 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 16 + + defm "" + defb 1 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "w" + defb 16 + + defm "33" + defb 0 + + defm "" + defb 3 + + defm "31" + defb 17 + + defm "" + defb 3 + + defm "30" + defb 0 + + defm "33" + defb 0 + + defm "" + defb 16 + + defm "33" + defb 0 + + defm "" + defb 3 + + defm "3" + defb 16 + + defm "" + defb 1 + + defm "" + defb 3 + + defm "30" + defb 0 + + defm "30" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 17 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 16 + + defm "33" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "!" + defb 192 + + defm "30" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 17 + + defm "" + defb 16 + + defm "3" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 12 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 3 + + defm "0" + defb 0 + + defm "" + defb 0 + + defm "" + defb 12 + + defm "" + defb 177 + + defm "333" + defb 0 + + defm "" + defb 0 + + defm "1" + defb 17 + + defm "" + defb 19 + + defm "330" + defb 0 + + defm "" + defb 3 + + defm "" + defb 0 + + defm "" + defb 2 + + defm "" + defb 16 + + defm "33" + defb 0 + + defm "" + defb 0 + + defm "33" + defb 16 + + defm "" + defb 3 + + defm "30" + defb 0 + + defm "" + defb 3 + + defm "31 " + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "!" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 23 + + defm "w " + defb 0 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 0 + + defm "" + defb 2 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "1" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 2 + + defm "" + defb 3 + + defm "33" + defb 2 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 16 + + defm "333" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 3 + + defm "331" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 16 + + defm "3" + defb 18 + + defm "" + defb 17 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 3 + + defm "3" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "31" + defb 224 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 3 + + defm "3 `" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 16 + + defm "31" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 3 + + defm ";" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 2 + + defm "" + defb 3 + + defm "31" + defb 17 + + defm "" + defb 0 + + defm "" + defb 224 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "33" + defb 0 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 3 + + defm "3332" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "2www" + defb 22 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 17 + + defm "" + defb 18 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 7 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 215 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 9 + + defm "" + defb 215 + + defm "" + defb 7 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "p" + defb 0 + + defm "" + defb 170 + + defm "" + defb 215 + + defm "" + defb 212 + + defm "p" + defb 0 + + defm "}" + defb 0 + + defm "" + defb 0 + + defm "" + defb 9 + + defm "" + defb 217 + + defm "" + defb 221 + + defm "" + defb 0 + + defm "" + defb 13 + + defm "" + defb 160 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 169 + + defm "" + defb 170 + + defm "" + defb 157 + + defm "" + defb 13 + + defm "" + defb 144 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 160 + + defm "" + defb 10 + + defm "" + defb 160 + + defm "" + defb 170 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 3 + + defm "33331" + defb 0 + + defm " 33333" + defb 16 + + defm "" + defb 1 + + defm "" + defb 3 + + defm "33332" + defb 0 + + defm "" + defb 18 + + defm "" + defb 3 + + defm "3333" + defb 16 + + defm "" + defb 1 + + defm "" + defb 0 + + defm "33331" + defb 0 + + defm "" + defb 16 + + defm "33333" + defb 16 + + defm "" + defb 1 + + defm "" + defb 3 + + defm "33331" + defb 0 + + defm "" + defb 16 + + defm "33333" + defb 16 + + defm "" + defb 1 + + defm "wwww" + defb 16 + + defm "1" + defb 0 + + defm "" + defb 17 + + defm "!" + defb 17 + + defm "!" + defb 17 + + defm "" + defb 3 + + defm " " + defb 0 + + defm "" + defb 16 + + defm "33" + defb 0 + + defm "" + defb 3 + + defm "30" + defb 1 + + defm "" + defb 16 + + defm "30" + defb 0 + + defm "33" + defb 0 + + defm "" + defb 27 + + defm "" + defb 3 + + defm "3" + defb 0 + + defm "" + defb 3 + + defm "30" + defb 1 + + defm "" + defb 17 + + defm "" + defb 3 + + defm "0" + defb 0 + + defm "3" + defb 17 + + defm "" + defb 0 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "3" + defb 0 + + defm "" + defb 3 + + defm "0" + defb 0 + + defm "" + defb 1 + + defm "" + defb 3 + + defm "30" + defb 0 + + defm "33" + defb 0 + + defm "" + defb 16 + + defm "33" + defb 0 + + defm "" + defb 3 + + defm "30" + defb 1 + + defm "" + defb 3 + + defm "30" + defb 0 + + defm "33" + defb 0 + + defm "" + defb 23 + + defm "www" + defb 183 + + defm "wp" + defb 1 + + defm "" + defb 18 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "333" + defb 0 + + defm "" + defb 0 + + defm "33#330" + defb 0 + + defm "" + defb 3 + + defm "31333" + defb 0 + + defm "" + defb 0 + + defm "3<" + defb 17 + + defm "" + defb 16 + + defm "30" + defb 0 + + defm "" + defb 3 + + defm "3" + defb 17 + + defm "" + defb 0 + + defm "" + defb 3 + + defm "3" + defb 0 + + defm "" + defb 0 + + defm "30" + defb 19 + + defm "330" + defb 0 + + defm "" + defb 3 + + defm "31333" + defb 3 + + defm "31" + defb 3 + + defm "#33033" + defb 0 + + defm "1wwww" + defb 16 + + defm "33" + defb 17 + + defm "" + defb 17 + + defm "" + defb 18 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 16 + + defm "31" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 3 + + defm "1" + defb 18 + + defm "" + defb 17 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 16 + + defm "3" + defb 0 + + defm "" + defb 0 + + defm " " + defb 0 + + defm "" + defb 0 + + defm "" + defb 3 + + defm "3" + defb 224 + + defm "31" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "30" + defb 3 + + defm "3" + defb 17 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 17 + + defm "" + defb 3 + + defm "331" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 30 + + defm "" + defb 3 + + defm "33" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 0 + + defm "3>" + defb 1 + + defm "" + defb 7 + + defm "w" + defb 0 + + defm "" + defb 16 + + defm "33" + defb 0 + + defm "" + defb 16 + + defm "UP" + defb 1 + + defm "wuUR" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 18 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "3333" + defb 16 + + defm "" + defb 14 + + defm "" + defb 0 + + defm "" + defb 3 + + defm "0" + defb 0 + + defm "" + defb 0 + + defm "1" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "3" + defb 0 + + defm "" + defb 0 + + defm "" + defb 3 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 3 + + defm "0" + defb 14 + + defm "" + defb 0 + + defm "2" + defb 224 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "3" + defb 0 + + defm "" + defb 0 + + defm "" + defb 3 + + defm "" + defb 16 + + defm "`" + defb 0 + + defm "" + defb 3 + + defm "0" + defb 0 + + defm "" + defb 0 + + defm "1" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "U" + defb 0 + + defm "" + defb 0 + + defm "" + defb 5 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 17 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 17 + + defm "" + defb 0 + + defm "" + defb 6 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "@" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 12 + + defm "" + defb 0 + + defm "" + defb 6 + + defm "" + defb 192 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 4 + + defm "`" + defb 0 + + defm "" + defb 6 + + defm "@" + defb 0 + + defm "" + defb 0 + + defm "" + defb 4 + + defm "`" + defb 0 + + defm "" + defb 0 + + defm "" + defb 6 + + defm "LD" + defb 180 + + defm "`" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 6 + + defm "ff`" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 17 + + defm "" + defb 18 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 16 + + defm "1" + defb 0 + + defm " " + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 3 + + defm "" + defb 16 + + defm "" + defb 1 + + defm "" + defb 3 + + defm "33331" + defb 0 + + defm "" + defb 16 + + defm "33333 " + defb 2 + + defm "" + defb 17 + + defm "!" + defb 3 + + defm "" + defb 17 + + defm "!" + defb 17 + + defm "" + defb 0 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "0" + defb 0 + + defm "" + defb 0 + + defm " " + defb 1 + + defm "" + defb 3 + + defm "33331" + defb 0 + + defm "" + defb 16 + + defm "33333" + defb 16 + + defm "" + defb 2 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 18 + + defm "" + defb 17 + + defm "" + defb 3 + + defm "1" + defb 0 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "3" + defb 16 + + defm "" + defb 0 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 18 + + defm "" + defb 17 + + defm "" + defb 18 + + defm "" + defb 17 + + defm "" + defb 16 + + defm "" + defb 1 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 3 + + defm "0" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "3" + defb 0 + + defm "0" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 3 + + defm "0" + defb 1 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "3" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 12 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 3 + + defm "0" + defb 3 + + defm "" + defb 0 + + defm "" + defb 11 + + defm "" + defb 187 + + defm "" + defb 203 + + defm "{" + defb 199 + + defm "wp" + defb 1 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 18 + + defm "" + defb 17 + + defm "" + defb 3 + + defm "3" + defb 17 + + defm "!" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 16 + + defm "3" + defb 17 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 3 + + defm "0 " + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "3" + defb 0 + + defm "30330" + defb 18 + + defm "" + defb 0 + + defm "" + defb 3 + + defm "3" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 2 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "30" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 19 + + defm "0" + defb 3 + + defm "3" + defb 3 + + defm "331ww" + defb 188 + + defm "" + defb 0 + + defm "333" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 3 + + defm "31 " + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 18 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 188 + + defm "331" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 3 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "2" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "3333" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 3 + + defm "331" + defb 0 + + defm "" + defb 0 + + defm "" + defb 4 + + defm "" + defb 28 + + defm "8" + defb 8 + + defm "" + defb 3 + + defm "$" + defb 132 + + defm "" + defb 132 + + defm "" + defb 221 + + defm "" + defb 221 + + defm "" + defb 221 + + defm "" + defb 221 + + defm "" + defb 209 + + defm "" + defb 221 + + defm "" + defb 221 + + defm "" + defb 218 + + defm "" + defb 169 + + defm "" + defb 153 + + defm "" + defb 170 + + defm "" + defb 169 + + defm "" + defb 17 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 17 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 224 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 224 + + defm "" + defb 1 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 30 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "`" + defb 0 + + defm "" + defb 0 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 224 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 15 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 22 + + defm "" + defb 0 + + defm "" + defb 4 + + defm "" + defb 128 + + defm "" + defb 1 + + defm "" + defb 188 + + defm "" + defb 0 + + defm "" + defb 1 + + defm "" + defb 0 + + defm "" + defb 4 + + defm "" + defb 221 + + defm "" + defb 221 + + defm "" + defb 221 + + defm "" + defb 221 + + defm "" + defb 12 + + defm "" + defb 20 + + defm "D" + defb 217 + + defm "" + defb 154 + + defm "" + defb 169 + + defm "" + defb 153 + + defm "" + defb 157 + + defm "" + defb 221 + + defm "" + defb 221 + + defm "" + defb 217 + + defm "" + defb 153 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 6 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "HD" + defb 132 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "M" + defb 221 + + defm "" + defb 221 + + defm "" + defb 212 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "M" + defb 153 + + defm "" + defb 153 + + defm "" + defb 153 + + defm "" + defb 212 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "M" + defb 153 + + defm "" + defb 153 + + defm "" + defb 153 + + defm "" + defb 153 + + defm "" + defb 212 + + defm "" + defb 132 + + defm "-" + defb 153 + + defm "" + defb 153 + + defm "" + defb 154 + + defm "" + defb 170 + + defm "" + defb 153 + + defm "" + defb 221 + + defm "" + defb 221 + + defm "" + defb 153 + + defm "" + defb 154 + + defm "" + defb 170 + + defm "" + defb 0 + + defm "" + defb 10 + + defm "" + defb 153 + + defm "" + defb 153 + + defm "" + defb 154 + + defm "" + defb 170 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 10 + + defm "" + defb 169 + + defm "" + defb 153 + + defm "" + defb 1 + + defm "" + defb 3 + + defm "33331" + defb 0 + + defm "" + defb 16 + + defm "3330" + defb 17 + + defm " " + defb 1 + + defm "" + defb 3 + + defm "333 " + defb 1 + + defm "" + defb 0 + + defm " 3" + defb 192 + + defm "30" + defb 3 + + defm "" + defb 16 + + defm "" + defb 1 + + defm "" + defb 3 + + defm ";" + defb 3 + + defm "" + defb 192 + + defm "31" + defb 0 + + defm "" + defb 240 + + defm "<" + defb 188 + + defm "" + defb 11 + + defm "" + defb 3 + + defm "3" + defb 240 + + defm "" + defb 17 + + defm "" + defb 27 + + defm "" + defb 188 + + defm "" + defb 188 + + defm "" + defb 187 + + defm "" + defb 3 + + defm "" + defb 17 + + defm "" + defb 29 + + defm "" + defb 221 + + defm "" + defb 221 + + defm "" + defb 221 + + defm "" + defb 221 + + defm "" + defb 221 + + defm "" + defb 220 + + defm "" + defb 17 + + defm "" + defb 153 + + defm "" + defb 153 + + defm "" + defb 170 + + defm "" + defb 169 + + defm "" + defb 153 + + defm "" + defb 153 + + defm "" + defb 221 + + defm "" + defb 217 + + defm "" + defb 154 + + defm "" + defb 160 + + defm "" + defb 0 + + defm "" + defb 170 + + defm "" + defb 170 + + defm "" + defb 170 + + defm "" + defb 153 + + defm "" + defb 0 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "3333330" + defb 3 + + defm "" + defb 3 + + defm "30303" + defb 0 + + defm "" + defb 0 + + defm "0" + defb 3 + + defm "" + defb 3 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "0" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm " D" + defb 132 + + defm "D" + defb 132 + + defm "D" + defb 132 + + defm "A-" + defb 221 + + defm "" + defb 221 + + defm "" + defb 221 + + defm "" + defb 221 + + defm "" + defb 221 + + defm "" + defb 221 + + defm "" + defb 221 + + defm "" + defb 154 + + defm "" + defb 169 + + defm "" + defb 153 + + defm "" + defb 153 + + defm "" + defb 154 + + defm "" + defb 169 + + defm "" + defb 153 + + defm "" + defb 154 + + defm "" + defb 0 + + defm "" + defb 169 + + defm "" + defb 153 + + defm "" + defb 154 + + defm "" + defb 0 + + defm "" + defb 169 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "" + defb 16 + + defm "33" + defb 16 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 3 + + defm "1" + defb 17 + + defm "333331" + defb 17 + + defm "#3" + defb 3 + + defm "03" + defb 17 + + defm "" + defb 17 + + defm "" + defb 17 + + defm "0" + defb 0 + + defm "" + defb 0 + + defm "" + defb 3 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 0 + + defm "" + defb 16 + + defm "" + defb 0 + + defm "" + defb 4 + + defm "HD@31HD" + defb 221 + + defm "" + defb 221 + + defm "" + defb 221 + + defm "D" + defb 3 + + defm "" + defb 29 + + defm "" + defb 221 + + defm "" + defb 217 + + defm "" + defb 169 + + defm "" + defb 153 + + defm "" + defb 157 + + defm "" + defb 212 + + defm "" + defb 2 + + defm "" + defb 154 + + defm "" + defb 153 + + defm "" + defb 160 + + defm "" + defb 169 + + defm "" + defb 169 + + defm "" + defb 153 + + defm "" + defb 212 + + defm "" + defb 26 + + defm "" + defb 10 + + defm "" + defb 160 + + defm "" + defb 0 + + defm "" + defb 160 + + defm "" + defb 170 + + defm "" + defb 154 + + defm "" + defb 209 + +; SECTION code + + +; SECTION text + +._cerrojos + defb 5 + defb 6 + defb 8 + defb 0 + defb 25 + defb 8 + defb 5 + defb 0 + defb 27 + defb 1 + defb 5 + defb 0 + defb 27 + defb 13 + defb 5 + defb 0 + +; SECTION code + + ._tileset + BINARY "tileset.bin" +; SECTION text + +._malotes + defb 64 + defb 16 + defb 64 + defb 16 + defb 64 + defb 128 + defb 0 + defb 4 + defb 3 + defb 208 + defb 16 + defb 208 + defb 16 + defb 96 + defb 16 + defb -2 + defb 0 + defb 0 + defb 192 + defb 0 + defb 192 + defb 0 + defb 112 + defb 0 + defb -2 + defb 0 + defb 0 + defb 128 + defb 0 + defb 128 + defb 0 + defb 128 + defb 64 + defb 0 + defb 1 + defb 2 + defb 144 + defb 16 + defb 144 + defb 16 + defb 176 + defb 96 + defb 2 + defb 2 + defb 2 + defb 48 + defb 64 + defb 48 + defb 64 + defb 48 + defb 128 + defb 0 + defb 1 + defb 4 + defb 16 + defb 32 + defb 16 + defb 32 + defb 96 + defb 32 + defb 2 + defb 0 + defb 1 + defb 144 + defb 96 + defb 144 + defb 96 + defb 144 + defb 0 + defb 0 + defb -1 + defb 3 + defb 176 + defb 0 + defb 176 + defb 0 + defb 176 + defb 80 + defb 0 + defb 1 + defb 2 + defb 96 + defb 112 + defb 96 + defb 112 + defb 48 + defb 112 + defb -1 + defb 0 + defb 3 + defb 48 + defb 0 + defb 48 + defb 0 + defb 48 + defb 32 + defb 0 + defb 1 + defb 1 + defb 208 + defb 0 + defb 208 + defb 0 + defb 208 + defb 64 + defb 0 + defb 2 + defb 1 + defb 64 + defb 0 + defb 64 + defb 0 + defb 64 + defb 80 + defb 0 + defb 1 + defb 1 + defb 96 + defb 0 + defb 96 + defb 0 + defb 96 + defb 64 + defb 0 + defb 1 + defb 1 + defb 160 + defb 0 + defb 160 + defb 0 + defb 208 + defb 80 + defb 2 + defb 2 + defb 2 + defb 80 + defb 112 + defb 80 + defb 112 + defb 16 + defb 112 + defb -2 + defb 0 + defb 2 + defb 96 + defb 0 + defb 96 + defb 0 + defb 0 + defb 0 + defb -1 + defb 0 + defb 2 + defb 224 + defb 0 + defb 224 + defb 0 + defb 224 + defb 48 + defb 0 + defb 1 + defb 2 + defb 192 + defb 48 + defb 192 + defb 48 + defb 128 + defb 48 + defb -1 + defb 0 + defb 4 + defb 160 + defb 16 + defb 160 + defb 16 + defb 160 + defb 96 + defb 0 + defb 2 + defb 1 + defb 16 + defb 96 + defb 16 + defb 96 + defb 80 + defb 128 + defb 4 + defb 4 + defb 2 + defb 16 + defb 80 + defb 16 + defb 80 + defb 96 + defb 48 + defb 1 + defb -1 + defb 1 + defb 16 + defb 16 + defb 16 + defb 16 + defb 96 + defb 16 + defb 2 + defb 0 + defb 2 + defb 160 + defb 0 + defb 160 + defb 0 + defb 160 + defb 144 + defb 0 + defb 2 + defb 3 + defb 48 + defb 32 + defb 48 + defb 32 + defb 144 + defb 32 + defb 2 + defb 0 + defb 3 + defb 112 + defb 48 + defb 112 + defb 48 + defb 112 + defb 128 + defb 0 + defb 1 + defb 2 + defb 160 + defb 96 + defb 160 + defb 96 + defb 160 + defb 0 + defb 0 + defb -2 + defb 3 + defb 96 + defb 128 + defb 96 + defb 128 + defb 96 + defb 16 + defb 0 + defb -2 + defb 4 + defb 144 + defb 16 + defb 144 + defb 16 + defb 176 + defb 112 + defb 2 + defb 2 + defb 3 + defb 112 + defb 48 + defb 112 + defb 48 + defb 32 + defb 16 + defb -2 + defb -2 + defb 1 + defb 64 + defb 128 + defb 64 + defb 128 + defb 208 + defb 128 + defb 1 + defb 0 + defb 4 + defb 208 + defb 112 + defb 208 + defb 112 + defb 112 + defb 112 + defb -1 + defb 0 + defb 1 + defb 64 + defb 16 + defb 64 + defb 16 + defb 96 + defb 16 + defb 1 + defb 0 + defb 3 + defb 16 + defb 128 + defb 16 + defb 128 + defb 160 + defb 128 + defb 1 + defb 0 + defb 4 + defb 48 + defb 112 + defb 48 + defb 112 + defb 48 + defb 64 + defb 0 + defb -1 + defb 4 + defb 80 + defb 48 + defb 80 + defb 48 + defb 160 + defb 96 + defb 2 + defb 2 + defb 2 + defb 208 + defb 112 + defb 208 + defb 112 + defb 128 + defb 112 + defb -1 + defb 0 + defb 3 + defb 208 + defb 80 + defb 208 + defb 80 + defb 208 + defb 16 + defb 0 + defb -1 + defb 2 + defb 16 + defb 16 + defb 16 + defb 16 + defb 96 + defb 128 + defb 4 + defb 4 + defb 3 + defb 64 + defb 0 + defb 64 + defb 0 + defb 112 + defb 48 + defb 2 + defb 2 + defb 1 + defb 16 + defb 64 + defb 16 + defb 64 + defb 80 + defb 112 + defb 1 + defb 1 + defb 2 + defb 208 + defb 16 + defb 208 + defb 16 + defb 192 + defb 128 + defb -2 + defb 2 + defb 3 + defb 16 + defb 0 + defb 16 + defb 0 + defb 112 + defb 32 + defb 1 + defb 1 + defb 2 + defb 208 + defb 0 + defb 208 + defb 0 + defb 176 + defb 48 + defb -2 + defb 2 + defb 3 + defb 64 + defb 64 + defb 64 + defb 64 + defb 96 + defb 0 + defb 1 + defb -1 + defb 1 + defb 160 + defb 112 + defb 160 + defb 112 + defb 160 + defb 64 + defb 0 + defb -1 + defb 4 + defb 192 + defb 32 + defb 192 + defb 32 + defb 48 + defb 32 + defb -1 + defb 0 + defb 4 + defb 64 + defb 0 + defb 64 + defb 0 + defb 176 + defb 16 + defb 1 + defb 1 + defb 3 + defb 192 + defb 48 + defb 192 + defb 48 + defb 80 + defb 48 + defb -1 + defb 0 + defb 4 + defb 112 + defb 32 + defb 112 + defb 32 + defb 176 + defb 32 + defb 1 + defb 0 + defb 3 + defb 64 + defb 80 + defb 64 + defb 80 + defb 192 + defb 112 + defb 2 + defb 2 + defb 2 + defb 192 + defb 48 + defb 192 + defb 48 + defb 32 + defb 48 + defb -1 + defb 0 + defb 4 + defb 16 + defb 32 + defb 16 + defb 32 + defb 128 + defb 32 + defb 1 + defb 0 + defb 1 + defb 16 + defb 64 + defb 16 + defb 64 + defb 112 + defb 112 + defb 2 + defb 2 + defb 2 + defb 208 + defb 64 + defb 208 + defb 64 + defb 128 + defb 64 + defb -1 + defb 0 + defb 2 + defb 48 + defb 16 + defb 48 + defb 16 + defb 48 + defb 80 + defb 0 + defb 2 + defb 1 + defb 64 + defb 32 + defb 64 + defb 32 + defb 64 + defb 80 + defb 0 + defb 2 + defb 3 + defb 16 + defb 112 + defb 16 + defb 112 + defb 112 + defb 112 + defb 1 + defb 0 + defb 1 + defb 192 + defb 128 + defb 192 + defb 128 + defb 192 + defb 16 + defb 0 + defb -1 + defb 4 + defb 112 + defb 48 + defb 112 + defb 48 + defb 16 + defb 48 + defb -2 + defb 0 + defb 3 + defb 176 + defb 48 + defb 176 + defb 48 + defb 32 + defb 48 + defb -1 + defb 0 + defb 1 + defb 176 + defb 64 + defb 176 + defb 64 + defb 48 + defb 64 + defb -1 + defb 0 + defb 1 + defb 16 + defb 0 + defb 16 + defb 0 + defb 192 + defb 32 + defb 2 + defb 2 + defb 2 + defb 32 + defb 112 + defb 32 + defb 112 + defb 192 + defb 112 + defb 2 + defb 0 + defb 4 + defb 192 + defb 32 + defb 192 + defb 32 + defb 48 + defb 32 + defb -2 + defb 0 + defb 4 + defb 176 + defb 80 + defb 176 + defb 80 + defb 48 + defb 80 + defb -1 + defb 0 + defb 1 + defb 208 + defb 80 + defb 208 + defb 80 + defb 32 + defb 80 + defb -1 + defb 0 + defb 4 + defb 64 + defb 64 + defb 64 + defb 64 + defb 176 + defb 64 + defb 1 + defb 0 + defb 2 + defb 16 + defb 0 + defb 16 + defb 0 + defb 0 + defb 144 + defb -3 + defb 3 + defb 2 + defb 16 + defb 48 + defb 16 + defb 48 + defb 208 + defb 48 + defb 1 + defb 0 + defb 4 + defb 96 + defb 64 + defb 96 + defb 64 + defb 96 + defb 128 + defb 0 + defb 1 + defb 1 + defb 208 + defb 80 + defb 208 + defb 80 + defb 128 + defb 128 + defb -2 + defb 2 + defb 3 + defb 96 + defb 32 + defb 96 + defb 32 + defb 96 + defb 96 + defb 0 + defb 2 + defb 6 + defb 128 + defb 80 + defb 128 + defb 80 + defb 224 + defb 80 + defb 2 + defb 0 + defb 4 + defb 96 + defb 112 + defb 96 + defb 112 + defb 16 + defb 112 + defb -1 + defb 0 + defb 3 + defb 112 + defb 16 + defb 112 + defb 16 + defb 112 + defb 80 + defb 0 + defb 1 + defb 2 + defb 48 + defb 96 + defb 48 + defb 96 + defb 48 + defb 0 + defb 0 + defb -2 + defb 1 + defb 176 + defb 48 + defb 176 + defb 48 + defb 176 + defb 128 + defb 0 + defb 2 + defb 3 + defb 160 + defb 32 + defb 160 + defb 32 + defb 192 + defb 80 + defb 2 + defb 2 + defb 1 + defb 96 + defb 48 + defb 96 + defb 48 + defb 96 + defb 0 + defb 0 + defb -1 + defb 2 + defb 144 + defb 144 + defb 144 + defb 144 + defb 48 + defb 144 + defb -1 + defb 0 + defb 3 + defb 32 + defb 80 + defb 32 + defb 80 + defb 32 + defb 16 + defb 0 + defb -2 + defb 1 + defb 192 + defb 80 + defb 192 + defb 80 + defb 192 + defb 32 + defb 0 + defb -2 + defb 2 + defb 112 + defb 80 + defb 112 + defb 80 + defb 112 + defb 32 + defb 0 + defb -1 + defb 3 + defb 208 + defb 48 + defb 208 + defb 48 + defb 32 + defb 48 + defb -1 + defb 0 + defb 4 + defb 64 + defb 32 + defb 64 + defb 32 + defb 192 + defb 32 + defb 1 + defb 0 + defb 2 + defb 80 + defb 96 + defb 80 + defb 96 + defb 112 + defb 96 + defb 1 + defb 0 + defb 1 + defb 112 + defb 16 + defb 112 + defb 16 + defb 16 + defb 80 + defb -2 + defb 2 + defb 3 + defb 176 + defb 64 + defb 176 + defb 64 + defb 176 + defb 96 + defb 0 + defb 1 + defb 1 + defb 208 + defb 80 + defb 208 + defb 80 + defb 208 + defb 128 + defb 0 + defb 1 + defb 1 + +; SECTION code + +; SECTION text + +._hotspots + defb 22 + defb 2 + defb 0 + defb 120 + defb 2 + defb 0 + defb 113 + defb 1 + defb 0 + defb 216 + defb 1 + defb 0 + defb 81 + defb 1 + defb 0 + defb 24 + defb 1 + defb 0 + defb 98 + defb 1 + defb 0 + defb 115 + defb 1 + defb 0 + defb 69 + defb 1 + defb 0 + defb 129 + defb 2 + defb 0 + defb 209 + defb 2 + defb 0 + defb 18 + defb 1 + defb 0 + defb 200 + defb 1 + defb 0 + defb 100 + defb 1 + defb 0 + defb 148 + defb 1 + defb 0 + defb 34 + defb 1 + defb 0 + defb 66 + defb 1 + defb 0 + defb 209 + defb 1 + defb 0 + defb 19 + defb 1 + defb 0 + defb 113 + defb 1 + defb 0 + defb 133 + defb 1 + defb 0 + defb 35 + defb 1 + defb 0 + defb 70 + defb 1 + defb 0 + defb 87 + defb 1 + defb 0 + defb 129 + defb 1 + defb 0 + defb 87 + defb 1 + defb 0 + defb 114 + defb 1 + defb 0 + defb 100 + defb 1 + defb 0 + defb 129 + defb 1 + defb 0 + defb 212 + defb 1 + defb 0 + +; SECTION code + + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_1_a + defb 0, 255 + defb 2, 252 + defb 5, 248 + defb 10, 240 + defb 13, 240 + defb 26, 224 + defb 96, 128 + defb 67, 128 + defb 38, 192 + defb 18, 224 + defb 23, 224 + defb 99, 128 + defb 128, 0 + defb 96, 128 + defb 16, 224 + defb 39, 192 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_1_b + defb 0, 255 + defb 64, 63 + defb 32, 31 + defb 32, 31 + defb 80, 15 + defb 8, 7 + defb 4, 3 + defb 226, 1 + defb 212, 3 + defb 208, 7 + defb 240, 7 + defb 236, 3 + defb 2, 1 + defb 28, 3 + defb 136, 7 + defb 228, 3 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_1_c + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_2_a + defb 2, 252 + defb 5, 248 + defb 10, 240 + defb 13, 240 + defb 26, 224 + defb 112, 128 + defb 67, 128 + defb 38, 192 + defb 18, 224 + defb 23, 224 + defb 35, 192 + defb 64, 128 + defb 80, 128 + defb 40, 208 + defb 8, 240 + defb 19, 224 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_2_b + defb 64, 63 + defb 32, 31 + defb 16, 15 + defb 80, 15 + defb 8, 7 + defb 4, 3 + defb 226, 1 + defb 212, 3 + defb 208, 7 + defb 240, 7 + defb 232, 7 + defb 4, 3 + defb 20, 3 + defb 152, 7 + defb 16, 15 + defb 200, 7 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_2_c + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_3_a + defb 3, 252 + defb 6, 248 + defb 13, 240 + defb 10, 240 + defb 20, 224 + defb 33, 192 + defb 66, 128 + defb 118, 128 + defb 23, 224 + defb 35, 192 + defb 32, 192 + defb 40, 192 + defb 40, 192 + defb 24, 224 + defb 9, 240 + defb 6, 249 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_3_b + defb 64, 63 + defb 32, 31 + defb 80, 15 + defb 16, 15 + defb 12, 3 + defb 226, 1 + defb 212, 3 + defb 208, 7 + defb 240, 7 + defb 232, 7 + defb 8, 7 + defb 24, 7 + defb 152, 7 + defb 16, 15 + defb 144, 15 + defb 96, 159 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_3_c + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_4_a + defb 3, 252 + defb 6, 248 + defb 13, 240 + defb 10, 240 + defb 20, 224 + defb 33, 192 + defb 66, 128 + defb 118, 128 + defb 23, 224 + defb 35, 192 + defb 32, 192 + defb 40, 192 + defb 40, 192 + defb 24, 224 + defb 9, 240 + defb 6, 249 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_4_b + defb 64, 63 + defb 32, 31 + defb 80, 15 + defb 16, 15 + defb 12, 3 + defb 226, 1 + defb 212, 3 + defb 208, 7 + defb 240, 7 + defb 232, 7 + defb 8, 7 + defb 24, 7 + defb 152, 7 + defb 16, 15 + defb 144, 15 + defb 96, 159 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_4_c + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_5_a + defb 0, 255 + defb 2, 252 + defb 4, 248 + defb 4, 248 + defb 10, 240 + defb 16, 224 + defb 32, 192 + defb 71, 128 + defb 43, 192 + defb 11, 224 + defb 15, 224 + defb 55, 192 + defb 64, 128 + defb 56, 192 + defb 17, 224 + defb 39, 192 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_5_b + defb 0, 255 + defb 64, 63 + defb 160, 31 + defb 80, 15 + defb 176, 15 + defb 88, 7 + defb 6, 1 + defb 194, 1 + defb 100, 3 + defb 72, 7 + defb 232, 7 + defb 198, 1 + defb 1, 0 + defb 6, 1 + defb 8, 7 + defb 228, 3 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_5_c + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_6_a + defb 2, 252 + defb 4, 248 + defb 8, 240 + defb 10, 240 + defb 16, 224 + defb 32, 192 + defb 71, 128 + defb 43, 192 + defb 11, 224 + defb 15, 224 + defb 23, 224 + defb 32, 192 + defb 40, 192 + defb 25, 224 + defb 8, 240 + defb 19, 224 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_6_b + defb 64, 63 + defb 160, 31 + defb 80, 15 + defb 176, 15 + defb 88, 7 + defb 14, 1 + defb 194, 1 + defb 100, 3 + defb 72, 7 + defb 232, 7 + defb 196, 3 + defb 2, 1 + defb 10, 1 + defb 20, 11 + defb 16, 15 + defb 200, 7 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_6_c + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_7_a + defb 2, 252 + defb 4, 248 + defb 10, 240 + defb 8, 240 + defb 48, 192 + defb 71, 128 + defb 43, 192 + defb 11, 224 + defb 15, 224 + defb 23, 224 + defb 16, 224 + defb 24, 224 + defb 25, 224 + defb 8, 240 + defb 9, 240 + defb 6, 249 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_7_b + defb 192, 63 + defb 96, 31 + defb 176, 15 + defb 80, 15 + defb 40, 7 + defb 132, 3 + defb 66, 1 + defb 110, 1 + defb 232, 7 + defb 196, 3 + defb 4, 3 + defb 20, 3 + defb 20, 3 + defb 24, 7 + defb 144, 15 + defb 96, 159 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_7_c + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_8_a + defb 2, 252 + defb 4, 248 + defb 10, 240 + defb 8, 240 + defb 48, 192 + defb 71, 128 + defb 43, 192 + defb 11, 224 + defb 15, 224 + defb 23, 224 + defb 16, 224 + defb 24, 224 + defb 25, 224 + defb 8, 240 + defb 9, 240 + defb 6, 249 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_8_b + defb 192, 63 + defb 96, 31 + defb 176, 15 + defb 80, 15 + defb 40, 7 + defb 132, 3 + defb 66, 1 + defb 110, 1 + defb 232, 7 + defb 196, 3 + defb 4, 3 + defb 20, 3 + defb 20, 3 + defb 24, 7 + defb 144, 15 + defb 96, 159 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_8_c + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_9_a + defb 0, 252 + defb 3, 248 + defb 5, 240 + defb 7, 240 + defb 11, 224 + defb 21, 192 + defb 42, 128 + defb 40, 128 + defb 40, 129 + defb 40, 131 + defb 40, 131 + defb 36, 129 + defb 32, 139 + defb 16, 199 + defb 8, 227 + defb 0, 247 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_9_b + defb 0, 63 + defb 192, 31 + defb 160, 15 + defb 224, 15 + defb 208, 7 + defb 168, 3 + defb 84, 1 + defb 20, 1 + defb 20, 129 + defb 20, 193 + defb 20, 193 + defb 36, 129 + defb 4, 209 + defb 8, 227 + defb 16, 199 + defb 0, 239 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_9_c + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_10_a + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 252 + defb 3, 248 + defb 5, 240 + defb 7, 224 + defb 27, 128 + defb 101, 0 + defb 138, 0 + defb 144, 4 + defb 72, 3 + defb 36, 129 + defb 0, 219 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_10_b + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 63 + defb 192, 31 + defb 160, 15 + defb 224, 7 + defb 216, 1 + defb 166, 0 + defb 81, 0 + defb 9, 32 + defb 18, 192 + defb 36, 129 + defb 0, 219 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_10_c + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_11_a + defb 0, 248 + defb 7, 240 + defb 15, 128 + defb 111, 0 + defb 146, 0 + defb 140, 0 + defb 105, 0 + defb 115, 0 + defb 27, 128 + defb 28, 192 + defb 15, 224 + defb 3, 240 + defb 7, 128 + defb 124, 0 + defb 254, 0 + defb 124, 1 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_11_b + defb 12, 97 + defb 146, 0 + defb 210, 0 + defb 52, 1 + defb 220, 1 + defb 152, 3 + defb 48, 7 + defb 240, 7 + defb 96, 15 + defb 192, 19 + defb 140, 33 + defb 222, 0 + defb 190, 0 + defb 252, 1 + defb 248, 3 + defb 112, 7 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_11_c + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_12_a + defb 96, 15 + defb 144, 0 + defb 151, 0 + defb 211, 0 + defb 108, 0 + defb 8, 128 + defb 51, 128 + defb 63, 128 + defb 27, 192 + defb 28, 192 + defb 7, 224 + defb 111, 224 + defb 243, 128 + defb 124, 0 + defb 62, 0 + defb 12, 1 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_12_b + defb 12, 225 + defb 18, 0 + defb 210, 0 + defb 52, 1 + defb 220, 1 + defb 80, 3 + defb 48, 7 + defb 240, 7 + defb 96, 15 + defb 224, 15 + defb 128, 31 + defb 192, 31 + defb 128, 1 + defb 126, 0 + defb 255, 0 + defb 126, 0 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_12_c + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_13_a + defb 0, 255 + defb 52, 195 + defb 72, 131 + defb 136, 7 + defb 136, 7 + defb 8, 5 + defb 133, 0 + defb 0, 0 + defb 131, 0 + defb 129, 0 + defb 3, 136 + defb 66, 136 + defb 16, 236 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_13_b + defb 0, 255 + defb 44, 195 + defb 18, 193 + defb 17, 224 + defb 17, 224 + defb 16, 160 + defb 161, 0 + defb 0, 0 + defb 193, 0 + defb 129, 0 + defb 192, 17 + defb 66, 17 + defb 8, 55 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_13_c + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_14_a + defb 0, 255 + defb 0, 255 + defb 32, 223 + defb 64, 189 + defb 65, 188 + defb 96, 152 + defb 147, 8 + defb 9, 0 + defb 131, 0 + defb 130, 0 + defb 0, 4 + defb 128, 3 + defb 4, 131 + defb 68, 131 + defb 18, 225 + defb 6, 249 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_14_b + defb 0, 255 + defb 0, 255 + defb 4, 251 + defb 2, 189 + defb 130, 61 + defb 6, 25 + defb 201, 16 + defb 144, 0 + defb 193, 0 + defb 65, 0 + defb 0, 32 + defb 1, 192 + defb 32, 193 + defb 34, 193 + defb 72, 135 + defb 96, 159 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_14_c + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_15_a + defb 0, 0 + defb 47, 0 + defb 95, 0 + defb 47, 0 + defb 23, 128 + defb 11, 192 + defb 5, 224 + defb 3, 240 + defb 0, 248 + defb 1, 252 + defb 1, 252 + defb 0, 254 + defb 0, 255 + defb 0, 255 + defb 0, 252 + defb 0, 254 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_15_b + defb 0, 0 + defb 250, 0 + defb 244, 0 + defb 250, 0 + defb 212, 1 + defb 232, 3 + defb 208, 7 + defb 160, 15 + defb 0, 31 + defb 128, 63 + defb 192, 31 + defb 32, 15 + defb 16, 199 + defb 16, 199 + defb 32, 15 + defb 0, 31 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_15_c + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_16_a + defb 0, 0 + defb 47, 0 + defb 95, 0 + defb 47, 0 + defb 23, 128 + defb 11, 192 + defb 5, 224 + defb 3, 240 + defb 0, 248 + defb 1, 252 + defb 0, 254 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_16_b + defb 0, 0 + defb 250, 0 + defb 244, 0 + defb 250, 0 + defb 212, 1 + defb 232, 3 + defb 208, 7 + defb 160, 15 + defb 0, 31 + defb 128, 63 + defb 224, 15 + defb 16, 7 + defb 8, 227 + defb 8, 227 + defb 8, 3 + defb 0, 135 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_16_c + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + defb 0, 255 + ._sprite_18_a + defb 0, 255, 0, 255, 0, 255, 0, 255 + defb 0, 255, 0, 255, 0, 255, 0, 255 + defb 0, 255, 0, 255, 0, 255, 0, 255 + defb 0, 255, 0, 255, 0, 255, 0, 255 + defb 0, 255, 0, 255, 0, 255, 0, 255 + defb 0, 255, 0, 255, 0, 255, 0, 255 + ._sprite_18_b + defb 0, 255, 0, 255, 0, 255, 0, 255 + defb 0, 255, 0, 255, 0, 255, 0, 255 + defb 0, 255, 0, 255, 0, 255, 0, 255 + defb 0, 255, 0, 255, 0, 255, 0, 255 + defb 0, 255, 0, 255, 0, 255, 0, 255 + defb 0, 255, 0, 255, 0, 255, 0, 255 + ._sprite_18_c + defb 0, 255, 0, 255, 0, 255, 0, 255 + defb 0, 255, 0, 255, 0, 255, 0, 255 + defb 0, 255, 0, 255, 0, 255, 0, 255 + defb 0, 255, 0, 255, 0, 255, 0, 255 + defb 0, 255, 0, 255, 0, 255, 0, 255 + defb 0, 255, 0, 255, 0, 255, 0, 255 + .playsfx + ;di + ld l,a + ld h,0 + add hl,hl + ld de,proclist + add hl,de + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + ld de,0 + jp (hl) + .sound1 ;enemy destroyed + ex de,hl + ld bc,500 + .sound1l0 + ld a,(hl) + and 16 + out ($FE),a + ld e,a + inc a + sla a + sla a + .sound1l1 + dec a + jr nz,sound1l1 + out ($FE),a + ld a,e + inc a + add a,a + add a,a + add a,a + .sound1l2 + dec a + jr nz,sound1l2 + ld a,b + inc hl + dec bc + ld a,b + or c + jr nz,sound1l0 + ;ei + ret + .sound2 ;enemy hit + ex de,hl + ld bc,40*256+100 + .sound2l0 + ld a,(hl) + and 16 + out ($FE),a + inc hl + ld a,c + .sound2l1 + dec a + jr nz,sound2l1 + out ($FE),a + ld a,c + .sound2l2 + dec a + jr nz,sound2l2 + djnz sound2l0 + ;ei + ret + .sound3 ;something + ex de,hl + ld b,100 + ld de,$1020 + .sound3l0 + ld a,(hl) + and d + out ($FE),a + inc hl + ld a,e + .sound3l0a + dec a + jr nz,sound3l0a + djnz sound3l0 + ld b,250 + .sound3l1 + ld a,(hl) + and d + out ($FE),a + inc hl + ld a,2 + .sound3l2 + dec a + jr nz,sound3l2 + xor a + out ($FE),a + ld a,e + .sound3l3 + dec a + jr nz,sound3l3 + djnz sound3l1 + ;ei + ret + .sound4 ;jump + ld bc,20*256+250 + .sound4l0 + ld a,16 + out ($FE),a + ld a,4 + .sound4l1 + dec a + jr nz,sound4l1 + out ($FE),a + ld a,c + .sound4l2 + dec a + jr nz,sound4l2 + dec c + dec c + djnz sound4l0 + ;ei + ret + .sound5 ;player hit + ex de,hl + ld bc,100*256+16 + .sound5l0 + ld a,(hl) + and c + out ($FE),a + inc hl + ld a,110 + sub b + ld e,a + and c + out ($FE),a + .sound5l1 + dec e + jr nz,sound5l1 + djnz sound5l0 + ;ei + ret + .sound6 ;enemy destroyed 2 + ex de,hl + ld bc,20*256+16 + .sound6l0 + ld a,(hl) + inc hl + and c + out ($FE),a + xor a + .sound6l0a + dec a + jr nz,sound6l0a + djnz sound6l0 + .sound6l1 + ld a,(hl) + inc hl + and c + out ($FE),a + .sound6l2 + dec a + jr nz,sound6l2 + djnz sound6l1 + ;ei + ret + .sound7 ;shot + ex de,hl + ld bc,100*256 + .sound7l0 + ld a,(hl) + inc hl + or c + and 16 + out ($FE),a + ld a,(hl) + srl a + srl a + .sound7l1 + dec a + jr nz,sound7l1 + ld a,c + add a,4 + ld c,a + djnz sound7l0 + ;ei + ret + .sound8 ;take item + ld a,200 + jr soundItem + .sound9 + ld a,175 + jr soundItem + .sound10 + ld a,100 + .soundItem + ld (frq),a + ld b,4 + ld d,128 + .sound8l2 + push bc + ;.frq=$+1 + ; ld bc,2*256+200 + defb 1 ;ld bc + .frq + defb 200 ;+200 + defb 2 ;2*256 + .sound8l0 + push bc + ld b,50 + .sound8l1 + xor 16 + and 16 + out ($FE),a + ld e,a + ld a,d + .sound8l2b + dec a + jr nz,sound8l2b + out ($FE),a + ld a,129 + sub d + .sound8l3 + dec a + jr nz,sound8l3 + ld a,e + ld e,c + .sound8l4 + dec e + jr nz,sound8l4 + djnz sound8l1 + pop bc + ld a,c + sub 16 + ld c,a + djnz sound8l0 + pop bc + srl d + srl d + djnz sound8l2 + ;ei + ret + .proclist + defw sound1 + defw sound2 + defw sound3 + defw sound4 + defw sound5 + defw sound6 + defw sound7 + defw sound8 + defw sound9 + defw sound10 + +._beep_fx + ld hl,2 ;const + add hl,sp + ld l,(hl) + ld h,0 + ld (_asm_int),hl + ld a, (_asm_int) + call playsfx + ret + + + +._attr + ld hl,4 ;const + add hl,sp + ld e,(hl) + ld d,0 + ld hl,15 ;const + call l_uge + jp c,i_16 + ld hl,2 ;const + add hl,sp + ld e,(hl) + ld d,0 + ld hl,10 ;const + call l_uge + jp nc,i_15 +.i_16 + ld hl,0 % 256 ;const + ret + + +.i_15 + ld hl,_map_attr + push hl + ld hl,6 ;const + add hl,sp + ld l,(hl) + ld h,0 + push hl + ld hl,6 ;const + add hl,sp + ld e,(hl) + ld d,0 + ld l,#(4 % 256) + call l_asl + pop de + add hl,de + ex de,hl + ld hl,6-2 ;const + add hl,sp + ld l,(hl) + ld h,0 + ex de,hl + and a + sbc hl,de + pop de + add hl,de + ld l,(hl) + ld h,0 + ret + + + +._qtile + ld hl,_map_buff + push hl + ld hl,6 ;const + add hl,sp + ld l,(hl) + ld h,0 + push hl + ld hl,6 ;const + add hl,sp + ld e,(hl) + ld d,0 + ld l,#(4 % 256) + call l_asl + pop de + add hl,de + ex de,hl + ld hl,6-2 ;const + add hl,sp + ld l,(hl) + ld h,0 + ex de,hl + and a + sbc hl,de + pop de + add hl,de + ld l,(hl) + ld h,0 + ret + + + +._draw_coloured_tile + ld a, (__x) + ld c, a + ld a, (__y) + call SPCompDListAddr + ex de, hl + ld a, (__t) + sla a + sla a + add 64 + ld hl, _tileset + 2048 + ld b, 0 + ld c, a + add hl, bc + ld c, a + ld a, (hl) + ld (de), a + inc de + inc hl + ld a, c + ld (de), a + inc de + inc a + ld c, a + inc de + inc de + ld a, (hl) + ld (de), a + inc de + inc hl + ld a, c + ld (de), a + inc a + ex de, hl + ld bc, 123 + add hl, bc + ex de, hl + ld c, a + ld a, (hl) + ld (de), a + inc de + inc hl + ld a, c + ld (de), a + inc de + inc a + ld c, a + inc de + inc de + ld a, (hl) + ld (de), a + inc de + ld a, c + ld (de), a + ret + + + +._invalidate_tile + ; Invalidate Rectangle + ; + ; enter: B = row coord top left corner + ; C = col coord top left corner + ; D = row coord bottom right corner + ; E = col coord bottom right corner + ; IY = clipping rectangle, set it to "ClipStruct" for full screen + ld a, (__x) + ld c, a + inc a + ld e, a + ld a, (__y) + ld b, a + inc a + ld d, a + ld iy, fsClipStruct + call SPInvalidate + ret + + + +._invalidate_viewport + ; Invalidate Rectangle + ; + ; enter: B = row coord top left corner + ; C = col coord top left corner + ; D = row coord bottom right corner + ; E = col coord bottom right corner + ; IY = clipping rectangle, set it to "ClipStruct" for full screen + ld b, 2 + ld c, 1 + ld d, 2+19 + ld e, 1+29 + ld iy, vpClipStruct + call SPInvalidate + ret + + + +._draw_invalidate_coloured_tile_g + call _draw_coloured_tile_gamearea + call _invalidate_tile + ret + + + +._draw_coloured_tile_gamearea + ld a,(__x) + ld e,a + ld d,0 + ld l,#(1 % 256) + call l_asl + ld de,1 + add hl,de + ld h,0 + ld a,l + ld (__x),a + ld a,(__y) + ld e,a + ld d,0 + ld l,#(1 % 256) + call l_asl + ld de,2 + add hl,de + ld h,0 + ld a,l + ld (__y),a + call _draw_coloured_tile + ret + + + +._draw_decorations + ld hl, (__gp_gen) + ._draw_decorations_loop + ld a, (hl) + cp 0xff + ret z + ld a, (hl) + inc hl + ld c, a + and 0x0f + ld (__y), a + ld a, c + srl a + srl a + srl a + srl a + ld (__x), a + ld a, (hl) + inc hl + ld (__t), a + push hl + ld b, 0 + ld c, a + ld hl, _behs + add hl, bc + ld a, (hl) + ld (__n), a + call _update_tile + pop hl + jr _draw_decorations_loop + ret + + +; SECTION text + +._utaux + defm "" + defb 0 + +; SECTION code + + + +._update_tile + ld a, (__x) + ld c, a + ld a, (__y) + ld b, a + sla a + sla a + sla a + sla a + sub b + add c + ld b, 0 + ld c, a + ld hl, _map_attr + add hl, bc + ld a, (__n) + ld (hl), a + ld hl, _map_buff + add hl, bc + ld a, (__t) + ld (hl), a + call _draw_coloured_tile_gamearea + ld a, (_is_rendering) + or a + ret nz + call _invalidate_tile + ret + + + +._print_number2 + ld a,(__t) + ld e,a + ld d,0 + ld hl,10 ;const + call l_div_u + ld de,16 + add hl,de + ld h,0 + ld a,l + ld (_rda),a + ld a,(__t) + ld e,a + ld d,0 + ld hl,10 ;const + call l_div_u + ex de,hl + ld de,16 + add hl,de + ld h,0 + ld a,l + ld (_rdb),a + ; enter: A = row position (0..23) + ; C = col position (0..31/63) + ; D = pallette # + ; E = graphic # + ld a, (_rda) + ld e, a + ld d, 7 + ld a, (__x) + ld c, a + ld a, (__y) + call SPPrintAtInv + ld a, (_rdb) + ld e, a + ld d, 7 + ld a, (__x) + inc a + ld c, a + ld a, (__y) + call SPPrintAtInv + ret + + + +._draw_objs + ld a,#(30 % 256 % 256) + ld (__x),a + ld a,#(0 % 256 % 256) + ld (__y),a + ld hl,(_p_objs) + ld h,0 + ld a,l + ld (__t),a + call _print_number2 + ret + + + +._print_str + ld hl, (__gp_gen) + .print_str_loop + ld a, (hl) + or a + ret z + inc hl + sub 32 + ld e, a + ld a, (__t) + ld d, a + ld a, (__x) + ld c, a + cp 31 + jr z, print_str_no_inc_a + inc a + .print_str_no_inc_a + ld (__x), a + ld a, (__y) + push hl + call SPPrintAtInv + pop hl + jr print_str_loop + ret + + + +._clear_sprites + ld ix, (_sp_player) + ld iy, vpClipStruct + ld bc, 0 + ld hl, 0xdede + ld de, 0 + call SPMoveSprAbs + xor a + .hide_sprites_enems_loop + ld (_gpit), a + sla a + ld c, a + ld b, 0 + ld hl, _sp_moviles + add hl, bc + ld e, (hl) + inc hl + ld d, (hl) + push de + pop ix + ld iy, vpClipStruct + ld bc, 0 + ld hl, 0xfefe + ld de, 0 + call SPMoveSprAbs + ld a, (_gpit) + inc a + cp 3 + jr nz, hide_sprites_enems_loop + ret + + + +._collide + ld hl,(_gpx) + ld h,0 + ld bc,8 + add hl,bc + ex de,hl + ld hl,(_cx2) + ld h,0 + call l_uge + jp nc,i_19 + ld hl,(_gpx) + ld h,0 + push hl + ld hl,(_cx2) + ld h,0 + ld bc,8 + add hl,bc + pop de + call l_ule + jp nc,i_19 + ld hl,(_gpy) + ld h,0 + ld bc,8 + add hl,bc + ex de,hl + ld hl,(_cy2) + ld h,0 + call l_uge + jp nc,i_19 + ld hl,(_gpy) + ld h,0 + push hl + ld hl,(_cy2) + ld h,0 + ld bc,8 + add hl,bc + pop de + call l_ule + jp nc,i_19 + ld hl,1 ;const + jr i_20 +.i_19 + ld hl,0 ;const +.i_20 + ld h,0 + ret + + + +._cm_two_points + ld a, (_cx1) + cp 15 + jr nc, _cm_two_points_at1_reset + ld a, (_cy1) + cp 10 + jr c, _cm_two_points_at1_do + ._cm_two_points_at1_reset + xor a + jr _cm_two_points_at1_done + ._cm_two_points_at1_do + ld a, (_cy1) + ld b, a + sla a + sla a + sla a + sla a + sub b + ld b, a + ld a, (_cx1) + add b + ld e, a + ld d, 0 + ld hl, _map_attr + add hl, de + ld a, (hl) + ._cm_two_points_at1_done + ld (_at1), a + ld a, (_cx2) + cp 15 + jr nc, _cm_two_points_at2_reset + ld a, (_cy2) + cp 10 + jr c, _cm_two_points_at2_do + ._cm_two_points_at2_reset + xor a + jr _cm_two_points_at2_done + ._cm_two_points_at2_do + ld a, (_cy2) + ld b, a + sla a + sla a + sla a + sla a + sub b + ld b, a + ld a, (_cx2) + add b + ld e, a + ld d, 0 + ld hl, _map_attr + add hl, de + ld a, (hl) + ._cm_two_points_at2_done + ld (_at2), a + ret + + + +._rand + .rand16 + ld hl, _seed + ld a, (hl) + ld e, a + inc hl + ld a, (hl) + ld d, a + ;; Ahora DE = [SEED] + ld a, d + ld h, e + ld l, 253 + or a + sbc hl, de + sbc a, 0 + sbc hl, de + ld d, 0 + sbc a, d + ld e, a + sbc hl, de + jr nc, nextrand + inc hl + .nextrand + ld d, h + ld e, l + ld hl, _seed + ld a, e + ld (hl), a + inc hl + ld a, d + ld (hl), a + ;; Ahora [SEED] = HL + ld l, e + ret + ret + + + +._abs + pop bc + pop hl + push hl + push bc + xor a + or h + jp p,i_21 + pop bc + pop hl + push hl + push bc + call l_neg + ret + + +.i_21 + pop bc + pop hl + push hl + push bc + ret + + +.i_22 + ret + + + +._step + ld a, 16 + out (254), a + nop + nop + nop + nop + nop + nop + nop + nop + nop + xor 16 + out (254), a + ret + + + +._cortina + ;; Antes que nada vamos a limpiar el PAPER de toda la pantalla + ;; para que no queden artefactos feos + ld de, 22528 ; Apuntamos con DE a la zona de atributos + ld b, 3 ; Procesamos 3 tercios + .clearb1 + push bc + ld b, 0 ; Procesamos los 256 atributos de cada tercio + .clearb2 + ld a, (de) ; Nos traemos un atributo + and 199 ; Le hacemos la máscara 11000111 y dejamos PAPER a 0 + ld (de), a ; Y lo volvemos a poner + inc de ; Siguiente atributo + djnz clearb2 + pop bc + djnz clearb1 + ;; Y ahora el código original que escribí para UWOL: + ld a, 8 + .repitatodo + ld c, a ; Salvamos el contador de "repitatodo" en 'c' + ld hl, 16384 + ld a, 12 + .bucle + ld b, a ; Salvamos el contador de "bucle" en 'b' + ld a, 0 + .bucle1 + sla (hl) + inc hl + dec a + jr nz, bucle1 + ld a, 0 + .bucle2 + srl (hl) + inc hl + dec a + jr nz, bucle2 + ld a, b ; Restituimos el contador de "bucle" a 'a' + dec a + jr nz, bucle + ld a, c ; Restituimos el contador de "repitatodo" a 'a' + dec a + jr nz, repitatodo + ret + + +; SECTION text + +._player_cells + defw _sprite_5_a + defw _sprite_6_a + defw _sprite_7_a + defw _sprite_6_a + defw _sprite_1_a + defw _sprite_2_a + defw _sprite_3_a + defw _sprite_2_a + defw _sprite_8_a + defw _sprite_4_a + +; SECTION code + +; SECTION text + +._enem_cells + defw _sprite_9_a + defw _sprite_10_a + defw _sprite_11_a + defw _sprite_12_a + defw _sprite_13_a + defw _sprite_14_a + defw _sprite_15_a + defw _sprite_16_a + +; SECTION code + + +._lame_sound + ld hl,4 % 256 ;const + ld a,l + ld (_gpit),a +.i_27 + ld hl,(_rda) + ld h,0 + push hl + call _beep_fx + pop bc + ld hl,(_rdb) + ld h,0 + push hl + call _beep_fx + pop bc +.i_25 + ld hl,(_gpit) + ld h,0 + dec hl + ld a,l + ld (_gpit),a + ld a,h + or l + jp nz,i_27 +.i_26 + ld hl,9 % 256 ;const + push hl + call _beep_fx + pop bc + ret + + + +._game_ending + call sp_UpdateNow + call _blackout + ld hl, _s_ending + ld de, 16384 + call depack + ld a,#(7 % 256 % 256) + ld (_rda),a + ld hl,2 % 256 ;const + ld a,l + ld (_rdb),a + call _lame_sound + ld hl,500 ;const + push hl + call _espera_activa + pop bc + ret + + + +._game_over + ld a,#(10 % 256 % 256) + ld (__x),a + ld a,#(11 % 256 % 256) + ld (__y),a + ld a,#(79 % 256 % 256) + ld (__t),a + ld hl,(_0ch) + ld (__gp_gen),hl + call _print_str + ld a,#(10 % 256 % 256) + ld (__x),a + ld a,#(12 % 256 % 256) + ld (__y),a + ld a,#(79 % 256 % 256) + ld (__t),a + ld hl,i_1+13 + ld (__gp_gen),hl + call _print_str + ld a,#(10 % 256 % 256) + ld (__x),a + ld a,#(13 % 256 % 256) + ld (__y),a + ld a,#(79 % 256 % 256) + ld (__t),a + ld hl,(_0ch) + ld (__gp_gen),hl + call _print_str + call sp_UpdateNow + ld a,#(7 % 256 % 256) + ld (_rda),a + ld hl,2 % 256 ;const + ld a,l + ld (_rdb),a + call _lame_sound + ld hl,500 ;const + push hl + call _espera_activa + pop bc + ret + + + +._addsign + ld hl,4 ;const + add hl,sp + call l_gint ; + xor a + or h + jp m,i_28 + pop bc + pop hl + push hl + push bc + ret + + +.i_28 + pop bc + pop hl + push hl + push bc + call l_neg + ret + + +.i_29 + ret + + + +._espera_activa +.i_30 + call sp_GetKey + ld a,h + or l + jp nz,i_30 +.i_31 +.i_34 + ld hl,250 % 256 ;const + ld a,l + ld (_gpjt),a +.i_37 + ld hl,1 % 256 ;const + ld a,l + ld (_gpit),a +.i_35 + ld hl,(_gpjt) + ld h,0 + dec hl + ld a,l + ld (_gpjt),a + ld a,h + or l + jp nz,i_37 +.i_36 + call sp_GetKey + ld a,h + or l + jp nz,i_33 +.i_38 +.i_32 + pop de + pop hl + dec hl + push hl + push de + ld a,h + or l + jp nz,i_34 +.i_33 + ret + + + +._locks_init + ld hl,0 % 256 ;const + ld a,l + ld (_gpit),a + jp i_41 +.i_39 + ld hl,(_gpit) + ld h,0 + inc hl + ld a,l + ld (_gpit),a +.i_41 + ld a,(_gpit) + cp #(4 % 256) + jp z,i_40 + jp nc,i_40 + ld hl,_cerrojos + push hl + ld hl,(_gpit) + ld h,0 + add hl,hl + add hl,hl + pop de + add hl,de + inc hl + inc hl + inc hl + ld (hl),#(1 % 256 % 256) + ld l,(hl) + ld h,0 + jp i_39 +.i_40 + ret + + + +._process_tile + ld hl,(_x0) + ld h,0 + push hl + ld hl,(_y0) + ld h,0 + push hl + call _qtile + pop bc + pop bc + ld de,15 ;const + ex de,hl + call l_eq + jp nc,i_43 + ld a,(_p_keys) + and a + jr nz,i_44_i_43 +.i_43 + jp i_42 +.i_44_i_43 + ld hl,0 % 256 ;const + ld a,l + ld (_gpit),a + jp i_47 +.i_45 + ld hl,(_gpit) + ld h,0 + inc hl + ld a,l + ld (_gpit),a +.i_47 + ld a,(_gpit) + cp #(4 % 256) + jp z,i_46 + jp nc,i_46 + ld hl,_cerrojos + push hl + ld hl,(_gpit) + ld h,0 + add hl,hl + add hl,hl + pop de + add hl,de + inc hl + ld a,(_x0) + cp (hl) + jp nz,i_49 + ld hl,_cerrojos + push hl + ld hl,(_gpit) + ld h,0 + add hl,hl + add hl,hl + pop de + add hl,de + inc hl + inc hl + ld a,(_y0) + cp (hl) + jp nz,i_49 + ld hl,_cerrojos + push hl + ld hl,(_gpit) + ld h,0 + add hl,hl + add hl,hl + pop de + add hl,de + ld a,(_n_pant) + cp (hl) + jr z,i_50_i_49 +.i_49 + jp i_48 +.i_50_i_49 + ld hl,_cerrojos + push hl + ld hl,(_gpit) + ld h,0 + add hl,hl + add hl,hl + pop de + add hl,de + inc hl + inc hl + inc hl + ld (hl),#(0 % 256 % 256) + ld l,(hl) + ld h,0 + jp i_46 +.i_48 + jp i_45 +.i_46 + ld hl,(_x0) + ld h,0 + ld a,l + ld (__x),a + ld hl,(_y0) + ld h,0 + ld a,l + ld (__y),a + ld a,#(0 % 256 % 256) + ld (__t),a + ld hl,0 % 256 ;const + ld a,l + ld (__n),a + call _update_tile + ld hl,(_p_keys) + ld h,0 + dec hl + ld a,l + ld (_p_keys),a + ld hl,8 % 256 ;const + push hl + call _beep_fx + pop bc +.i_42 + ret + + + +._draw_scr_background + ld hl,_mapa + push hl + ld hl,(_n_pant) + ld h,0 + ld de,75 + call l_mult + pop de + add hl,de + ld (_map_pointer),hl + ld hl,(_n_pant) + ld h,0 + ld (_seed),hl + ld a,#(1 % 256 % 256) + ld (__x),a + ld a,#(2 % 256 % 256) + ld (__y),a + ld hl,0 % 256 ;const + ld a,l + ld (_gpit),a + jp i_53 +.i_51 + ld hl,(_gpit) + ld h,0 + inc hl + ld a,l + ld (_gpit),a +.i_53 + ld a,(_gpit) + ld e,a + ld d,0 + ld hl,150 ;const + call l_ult + jp nc,i_52 + ld a, (_gpit) + and 1 + jr nz, _draw_scr_packed_existing + ._draw_scr_packed_new + ld hl, (_map_pointer) + ld a, (hl) + ld (_gpc), a + inc hl + ld (_map_pointer), hl + srl a + srl a + srl a + srl a + jr _draw_scr_packed_done + ._draw_scr_packed_existing + ld a, (_gpc) + and 15 + ._draw_scr_packed_done + ld (__t), a + ld b, 0 + ld c, a + ld hl, _behs + add hl, bc + ld a, (hl) + ld bc, (_gpit) + ld b, 0 + ld hl, _map_attr + add hl, bc + ld (hl), a + ld a, (__t) + or a + jr nz, _draw_scr_packed_noalt + ._draw_scr_packed_alt + call _rand + ld a, l + and 15 + cp 1 + jr z, _draw_scr_packed_alt_subst + ld a, (__t) + jr _draw_scr_packed_noalt + ._draw_scr_packed_alt_subst + ld a, 19 + ld (__t), a + ._draw_scr_packed_noalt + ld hl, _map_buff + add hl, bc + ld (hl), a + call _draw_coloured_tile + ld a, (__x) + add 2 + cp 30 + 1 + jr c, _advance_worm_no_inc_y + ld a, (__y) + add 2 + ld (__y), a + ld a, 1 + ._advance_worm_no_inc_y + ld (__x), a + jp i_51 +.i_52 + ret + + + +._draw_scr_hotspots_locks + ld a, 240 + ld (_hotspot_y), a + ld a, (_n_pant) + ld b, a + sla a + add b + ld c, a + ld b, 0 + ld hl, _hotspots + add hl, bc + ld a, (hl) + ld b, a + srl a + srl a + srl a + srl a + ld (__x), a + ld a, b + and 15 + ld (__y), a + inc hl + ld b, (hl) + inc hl + ld c, (hl) + xor a + or b + jr z, _hotspots_setup_done + xor a + or c + jr z, _hotspots_setup_done + ._hotspots_setup_do + ld a, (__x) + ld e, a + sla a + sla a + sla a + sla a + ld (_hotspot_x), a + ld a, (__y) + ld d, a + sla a + sla a + sla a + sla a + ld (_hotspot_y), a + sub d + add e + ld e, a + ld d, 0 + ld hl, _map_buff + add hl, de + ld a, (hl) + ld (_orig_tile), a + ld a, b + cp 3 + jp nz, _hotspots_setup_set + ._hotspots_setup_set_refill + xor a + ._hotspots_setup_set + add 16 + ld (__t), a + call _draw_coloured_tile_gamearea + ._hotspots_setup_done + ld hl, _cerrojos + ld b, 4 + ._open_locks_loop + push bc + ld a, (_n_pant) + ld c, a + ld b, (hl) + inc hl + ld d, (hl) + inc hl + ld e, (hl) + inc hl + ld a, (hl) + inc hl + or a + jr nz, _open_locks_done + ld a, b + cp c + jr nz, _open_locks_done + ._open_locks_do + ld a, d + ld (__x), a + ld a, e + ld (__y), a + sla a + sla a + sla a + sla a + sub e + add d + ld b, 0 + ld c, a + xor a + push hl + ld hl, _map_attr + add hl, bc + ld (hl), a + ld hl, _map_buff + add hl, bc + ld (hl), a + ld (__t), a + call _draw_coloured_tile_gamearea + pop hl + ._open_locks_done + pop bc + dec b + jr nz, _open_locks_loop + ret + + + +._draw_scr + ld hl,1 % 256 ;const + ld a,l + ld (_is_rendering),a + call _draw_scr_background + call _enems_load + call _draw_scr_hotspots_locks + call _invalidate_viewport + ld hl,0 % 256 ;const + ld a,l + ld (_is_rendering),a + ret + + + +._select_joyfunc + ; Music generated by beepola + call musicstart +.i_54 + call sp_GetKey + ld h,0 + ld a,l + ld (_gpjt),a + cp #(49 % 256) + jr z,i_57_uge + jp c,i_57 +.i_57_uge + ld a,(_gpjt) + cp #(51 % 256) + jr z,i_58_i_57 + jr c,i_58_i_57 +.i_57 + jp i_56 +.i_58_i_57 + ld hl,_joyfuncs + push hl + ld hl,(_gpjt) + ld h,0 + ld bc,-49 + add hl,bc + add hl,hl + pop de + add hl,de + call l_gint ; + ld (_joyfunc),hl + jp i_55 +.i_56 + jp i_54 +.i_55 + ret + + + +._player_init + ld a,#(32 % 256 % 256) + ld (_gpx),a + ld e,a + ld d,0 + ld l,#(6 % 256) + call l_asl + ld (_p_x),hl + ld a,#(32 % 256 % 256) + ld (_gpy),a + ld e,a + ld d,0 + ld l,#(6 % 256) + call l_asl + ld (_p_y),hl + ld hl,0 ;const + ld (_p_vy),hl + ld (_p_vx),hl + ld a,#(1 % 256 % 256) + ld (_p_cont_salto),a + ld a,#(0 % 256 % 256) + ld (_p_saltando),a + ld a,#(0 % 256 % 256) + ld (_p_frame),a + ld a,#(0 % 256 % 256) + ld (_p_subframe),a + ld a,#(1 % 256 % 256) + ld (_p_facing),a + ld a,#(0 % 256 % 256) + ld (_p_estado),a + ld a,#(0 % 256 % 256) + ld (_p_ct_estado),a + ld a,#(99 % 256 % 256) + ld (_p_life),a + ld a,#(0 % 256 % 256) + ld (_p_disparando),a + ld a,#(0 % 256 % 256) + ld (_p_objs),a + ld a,#(0 % 256 % 256) + ld (_p_keys),a + ld hl,0 % 256 ;const + ld a,l + ld (_p_killed),a + ret + + + +._player_calc_bounding_box + ld a, (_gpx) + add 4 + srl a + srl a + srl a + srl a + ld (_ptx1), a + ld a, (_gpx) + add 11 + srl a + srl a + srl a + srl a + ld (_ptx2), a + ld a, (_gpy) + add 8 + srl a + srl a + srl a + srl a + ld (_pty1), a + ld a, (_gpy) + add 15 + srl a + srl a + srl a + srl a + ld (_pty2), a + ret + + + +._player_move + ; Signed comparisons are hard + ; p_vy <= 512 - 32 + ; We are going to take a shortcut. + ; If p_vy < 0, just add 32. + ; If p_vy > 0, we can use unsigned comparition anyway. + ld hl, (_p_vy) + bit 7, h + jr nz, _player_gravity_add ; < 0 + ld de, 512 - 32 + or a + push hl + sbc hl, de + pop hl + jr nc, _player_gravity_maximum + ._player_gravity_add + ld de, 32 + add hl, de + jr _player_gravity_vy_set + ._player_gravity_maximum + ld hl, 512 + ._player_gravity_vy_set + ld (_p_vy), hl + ._player_gravity_done + ld a, (_p_gotten) + or a + jr z, _player_gravity_p_gotten_done + xor a + ld (_p_vy), a + ._player_gravity_p_gotten_done + ld de,(_p_y) + ld hl,(_p_vy) + add hl,de + ld (_p_y),hl + ld a,(_p_gotten) + and a + jp z,i_59 + ld de,(_p_y) + ld hl,(_ptgmy) + add hl,de + ld (_p_y),hl +.i_59 + ld hl,(_p_y) + xor a + or h + jp p,i_60 + ld hl,0 ;const + ld (_p_y),hl +.i_60 + ld hl,(_p_y) + ld de,9216 ;const + ex de,hl + call l_gt + jp nc,i_61 + ld hl,9216 ;const + ld (_p_y),hl +.i_61 + ld hl,(_p_y) + ex de,hl + ld l,#(6 % 256) + call l_asr + ld h,0 + ld a,l + ld (_gpy),a + call _player_calc_bounding_box + ld a,#(0 % 256 % 256) + ld (_hit_v),a + ld hl,(_ptx1) + ld h,0 + ld a,l + ld (_cx1),a + ld hl,(_ptx2) + ld h,0 + ld a,l + ld (_cx2),a + ld de,(_p_vy) + ld hl,(_ptgmy) + add hl,de + xor a + or h + jp p,i_62 + ld hl,(_pty1) + ld h,0 + ld a,l + ld (_cy2),a + ld h,0 + ld a,l + ld (_cy1),a + call _cm_two_points + ld hl,_at1 + ld a,(hl) + and #(8 % 256) + jp nz,i_64 + ld hl,_at2 + ld a,(hl) + and #(8 % 256) + jp z,i_63 +.i_64 + ld hl,0 ;const + ld (_p_vy),hl + ld hl,(_pty1) + ld h,0 + inc hl + ex de,hl + ld l,#(4 % 256) + call l_asl + ld bc,-8 + add hl,bc + ld h,0 + ld a,l + ld (_gpy),a + ld e,a + ld d,0 + ld l,#(6 % 256) + call l_asl + ld (_p_y),hl +.i_63 +.i_62 + ld de,(_p_vy) + ld hl,(_ptgmy) + add hl,de + xor a + or h + jp m,i_66 + or l + jp z,i_66 + ld hl,(_pty2) + ld h,0 + ld a,l + ld (_cy2),a + ld h,0 + ld a,l + ld (_cy1),a + call _cm_two_points + ld hl,_at1 + ld a,(hl) + and #(8 % 256) + jp nz,i_68 + ld hl,_at2 + ld a,(hl) + and #(8 % 256) + jp nz,i_68 + ld hl,(_gpy) + ld h,0 + dec hl + ld de,15 ;const + ex de,hl + call l_and + ld de,8 ;const + ex de,hl + call l_ult + jp nc,i_69 + ld hl,_at1 + ld a,(hl) + and #(4 % 256) + jp nz,i_70 + ld hl,_at2 + ld a,(hl) + and #(4 % 256) + jp z,i_69 +.i_70 + ld hl,1 ;const + jr i_72 +.i_69 + ld hl,0 ;const +.i_72 + ld a,h + or l + jp nz,i_68 + jr i_73 +.i_68 + ld hl,1 ;const +.i_73 + ld a,h + or l + jp z,i_67 + ld hl,0 ;const + ld (_p_vy),hl + ld hl,(_pty2) + ld h,0 + dec hl + ex de,hl + ld l,#(4 % 256) + call l_asl + ld h,0 + ld a,l + ld (_gpy),a + ld e,a + ld d,0 + ld l,#(6 % 256) + call l_asl + ld (_p_y),hl +.i_67 +.i_66 + ld hl,(_p_vy) + ld a,h + or l + jp z,i_74 + ld hl,_at1 + ld a,(hl) + rrca + jp c,i_75 + ld hl,_at2 + ld a,(hl) + rrca + jp c,i_75 + ld hl,0 ;const + jr i_76 +.i_75 + ld hl,1 ;const +.i_76 + ld h,0 + ld a,l + ld (_hit_v),a +.i_74 + ld a,(_gpx) + ld e,a + ld d,0 + ld l,#(4 % 256) + call l_asr_u + ld h,0 + ld a,l + ld (_gpxx),a + ld a,(_gpy) + ld e,a + ld d,0 + ld l,#(4 % 256) + call l_asr_u + ld h,0 + ld a,l + ld (_gpyy),a + ld hl,(_gpy) + ld h,0 + ld bc,16 + add hl,bc + ex de,hl + ld l,#(4 % 256) + call l_asr_u + ld h,0 + ld a,l + ld (_cy2),a + ld h,0 + ld a,l + ld (_cy1),a + ld hl,(_ptx1) + ld h,0 + ld a,l + ld (_cx1),a + ld hl,(_ptx2) + ld h,0 + ld a,l + ld (_cx2),a + call _cm_two_points + ld hl,_at1 + ld a,(hl) + and #(12 % 256) + jp nz,i_77 + ld hl,_at2 + ld a,(hl) + and #(12 % 256) + jp z,i_79 +.i_77 + ld a,(_gpy) + ld e,a + ld d,0 + ld hl,15 ;const + call l_and + ld de,8 ;const + ex de,hl + call l_ult + jp nc,i_79 + ld hl,1 ;const + jr i_80 +.i_79 + ld hl,0 ;const +.i_80 + ld h,0 + ld a,l + ld (_possee),a + ld a,(_pad0) + ld e,a + ld d,0 + ld hl,128 ;const + call l_and + ld de,0 ;const + ex de,hl + call l_eq + ld hl,0 ;const + rl l + ld h,0 + ld a,l + ld (_rda),a + and a + jp z,i_81 + ld a,(_p_saltando) + and a + jp nz,i_82 + ld a,(_possee) + and a + jp nz,i_84 + ld a,(_p_gotten) + and a + jp nz,i_84 + ld a,(_hit_v) + and a + jp z,i_83 +.i_84 + ld a,#(1 % 256 % 256) + ld (_p_saltando),a + ld a,#(0 % 256 % 256) + ld (_p_cont_salto),a + ld hl,3 % 256 ;const + push hl + call _beep_fx + pop bc +.i_83 + jp i_86 +.i_82 + ld hl,(_p_vy) + push hl + ld a,(_p_cont_salto) + ld e,a + ld d,0 + ld l,#(1 % 256) + call l_asr_u + ld de,128 + ex de,hl + and a + sbc hl,de + pop de + ex de,hl + and a + sbc hl,de + ld (_p_vy),hl + ld de,65216 ;const + ex de,hl + call l_lt + jp nc,i_87 + ld hl,65216 ;const + ld (_p_vy),hl +.i_87 + ld hl,(_p_cont_salto) + ld h,0 + inc hl + ld a,l + ld (_p_cont_salto),a + cp #(9 % 256) + jp nz,i_88 + ld hl,0 % 256 ;const + ld a,l + ld (_p_saltando),a +.i_88 +.i_86 + jp i_89 +.i_81 + ld hl,0 % 256 ;const + ld a,l + ld (_p_saltando),a +.i_89 + ld a,(_pad0) + ld e,a + ld d,0 + ld hl,4 ;const + call l_and + ld de,0 ;const + ex de,hl + call l_eq + jp c,i_91 + ld a,(_pad0) + ld e,a + ld d,0 + ld hl,8 ;const + call l_and + ld de,0 ;const + ex de,hl + call l_eq + jp c,i_91 + ld hl,0 ;const + jr i_92 +.i_91 + ld hl,1 ;const +.i_92 + call l_lneg + jp nc,i_90 + ld hl,(_p_vx) + xor a + or h + jp m,i_93 + or l + jp z,i_93 + ld hl,(_p_vx) + ld bc,-32 + add hl,bc + ld (_p_vx),hl + xor a + or h + jp p,i_94 + ld hl,0 ;const + ld (_p_vx),hl +.i_94 + jp i_95 +.i_93 + ld hl,(_p_vx) + xor a + or h + jp p,i_96 + ld hl,(_p_vx) + ld bc,32 + add hl,bc + ld (_p_vx),hl + xor a + or h + jp m,i_97 + or l + jp z,i_97 + ld hl,0 ;const + ld (_p_vx),hl +.i_97 +.i_96 +.i_95 + ld hl,0 % 256 ;const + ld a,l + ld (_wall_h),a +.i_90 + ld hl,_pad0 + ld a,(hl) + and #(4 % 256) + jp nz,i_98 + ld hl,(_p_vx) + ld de,65344 ;const + ex de,hl + call l_gt + jp nc,i_99 + ld a,#(0 % 256 % 256) + ld (_p_facing),a + ld hl,(_p_vx) + ld bc,-24 + add hl,bc + ld (_p_vx),hl +.i_99 +.i_98 + ld hl,_pad0 + ld a,(hl) + and #(8 % 256) + jp nz,i_100 + ld hl,(_p_vx) + ld de,192 ;const + ex de,hl + call l_lt + jp nc,i_101 + ld hl,(_p_vx) + ld bc,24 + add hl,bc + ld (_p_vx),hl + ld hl,1 % 256 ;const + ld a,l + ld (_p_facing),a +.i_101 +.i_100 + ld de,(_p_x) + ld hl,(_p_vx) + add hl,de + ld (_p_x),hl + ex de,hl + ld hl,(_ptgmx) + add hl,de + ld (_p_x),hl + xor a + or h + jp p,i_102 + ld hl,0 ;const + ld (_p_x),hl +.i_102 + ld hl,(_p_x) + ld de,14336 ;const + ex de,hl + call l_gt + jp nc,i_103 + ld hl,14336 ;const + ld (_p_x),hl +.i_103 + ld hl,(_gpx) + ld h,0 + ld a,l + ld (_gpox),a + ld hl,(_p_x) + ex de,hl + ld l,#(6 % 256) + call l_asr + ld h,0 + ld a,l + ld (_gpx),a + call _player_calc_bounding_box + ld a,#(0 % 256 % 256) + ld (_hit_h),a + ld hl,(_pty1) + ld h,0 + ld a,l + ld (_cy1),a + ld hl,(_pty2) + ld h,0 + ld a,l + ld (_cy2),a + ld de,(_p_vx) + ld hl,(_ptgmx) + add hl,de + xor a + or h + jp p,i_104 + ld hl,(_ptx1) + ld h,0 + ld a,l + ld (_cx2),a + ld h,0 + ld a,l + ld (_cx1),a + call _cm_two_points + ld hl,_at1 + ld a,(hl) + and #(8 % 256) + jp nz,i_106 + ld hl,_at2 + ld a,(hl) + and #(8 % 256) + jp z,i_105 +.i_106 + ld hl,0 ;const + ld (_p_vx),hl + ld hl,(_ptx1) + ld h,0 + inc hl + ex de,hl + ld l,#(4 % 256) + call l_asl + ld bc,-4 + add hl,bc + ld h,0 + ld a,l + ld (_gpx),a + ld e,a + ld d,0 + ld l,#(6 % 256) + call l_asl + ld (_p_x),hl + ld hl,3 % 256 ;const + ld a,l + ld (_wall_h),a + jp i_108 +.i_105 + ld hl,_at1 + ld a,(hl) + rrca + jp c,i_109 + ld hl,_at2 + ld a,(hl) + rrca + jp c,i_109 + ld hl,0 ;const + jr i_110 +.i_109 + ld hl,1 ;const +.i_110 + ld h,0 + ld a,l + ld (_hit_h),a +.i_108 +.i_104 + ld de,(_p_vx) + ld hl,(_ptgmx) + add hl,de + xor a + or h + jp m,i_111 + or l + jp z,i_111 + ld hl,(_ptx2) + ld h,0 + ld a,l + ld (_cx2),a + ld h,0 + ld a,l + ld (_cx1),a + call _cm_two_points + ld hl,_at1 + ld a,(hl) + and #(8 % 256) + jp nz,i_113 + ld hl,_at2 + ld a,(hl) + and #(8 % 256) + jp z,i_112 +.i_113 + ld hl,0 ;const + ld (_p_vx),hl + ld a,(_ptx1) + ld e,a + ld d,0 + ld l,#(4 % 256) + call l_asl + ld bc,4 + add hl,bc + ld h,0 + ld a,l + ld (_gpx),a + ld e,a + ld d,0 + ld l,#(6 % 256) + call l_asl + ld (_p_x),hl + ld hl,4 % 256 ;const + ld a,l + ld (_wall_h),a + jp i_115 +.i_112 + ld hl,_at1 + ld a,(hl) + rrca + jp c,i_116 + ld hl,_at2 + ld a,(hl) + rrca + jp c,i_116 + ld hl,0 ;const + jr i_117 +.i_116 + ld hl,1 ;const +.i_117 + ld h,0 + ld a,l + ld (_hit_h),a +.i_115 +.i_111 + ld hl,(_gpx) + ld h,0 + ld bc,8 + add hl,bc + ex de,hl + ld l,#(4 % 256) + call l_asr_u + ld h,0 + ld a,l + ld (_p_tx),a + ld h,0 + ld a,l + ld (_cx1),a + ld hl,(_gpy) + ld h,0 + ld bc,8 + add hl,bc + ex de,hl + ld l,#(4 % 256) + call l_asr_u + ld h,0 + ld a,l + ld (_p_ty),a + ld h,0 + ld a,l + ld (_cy1),a + ld hl,(_cx1) + ld h,0 + push hl + ld hl,(_cy1) + ld h,0 + push hl + call _attr + pop bc + pop bc + ld h,0 + ld a,l + ld (_rdb),a + ld hl,_rdb + ld a,(hl) + rlca + jp nc,i_118 +.i_118 + ld a,(_wall_h) + cp #(3 % 256) + jp nz,i_119 + ld hl,(_gpx) + ld h,0 + inc hl + inc hl + inc hl + ex de,hl + ld l,#(4 % 256) + call l_asr_u + ld h,0 + ld a,l + ld (_cx1),a + ld hl,(_cx1) + ld h,0 + push hl + ld hl,(_cy1) + ld h,0 + push hl + call _attr + pop bc + pop bc + ld de,10 ;const + ex de,hl + call l_eq + jp nc,i_120 + ld hl,(_cy1) + ld h,0 + ld a,l + ld (_y1),a + ld h,0 + ld a,l + ld (_y0),a + ld hl,(_cx1) + ld h,0 + ld a,l + ld (_x0),a + ld hl,(_cx1) + ld h,0 + dec hl + ld h,0 + ld a,l + ld (_x1),a + call _process_tile +.i_120 + jp i_121 +.i_119 + ld a,(_wall_h) + cp #(4 % 256) + jp nz,i_122 + ld hl,(_gpx) + ld h,0 + ld bc,12 + add hl,bc + ex de,hl + ld l,#(4 % 256) + call l_asr_u + ld h,0 + ld a,l + ld (_cx1),a + ld hl,(_cx1) + ld h,0 + push hl + ld hl,(_cy1) + ld h,0 + push hl + call _attr + pop bc + pop bc + ld de,10 ;const + ex de,hl + call l_eq + jp nc,i_123 + ld hl,(_cy1) + ld h,0 + ld a,l + ld (_y1),a + ld h,0 + ld a,l + ld (_y0),a + ld hl,(_cx1) + ld h,0 + ld a,l + ld (_x0),a + ld hl,(_cx1) + ld h,0 + inc hl + ld h,0 + ld a,l + ld (_x1),a + call _process_tile +.i_123 +.i_122 +.i_121 + ld a,#(0 % 256 % 256) + ld (_hit),a + ld a,(_hit_v) + and a + jp z,i_124 + ld a,#(1 % 256 % 256) + ld (_hit),a + ld hl,(_p_vy) + call l_neg + push hl + ld hl,192 ;const + push hl + call _addsign + pop bc + pop bc + ld (_p_vy),hl + jp i_125 +.i_124 + ld a,(_hit_h) + and a + jp z,i_126 + ld a,#(1 % 256 % 256) + ld (_hit),a + ld hl,(_p_vx) + call l_neg + push hl + ld hl,192 ;const + push hl + call _addsign + pop bc + pop bc + ld (_p_vx),hl +.i_126 +.i_125 + ld a,(_hit) + and a + jp z,i_127 + ld hl,4 % 256 ;const + ld a,l + ld (_p_killme),a +.i_127 + ld hl,(_possee) + ld h,0 + call l_lneg + jp nc,i_129 + ld hl,(_p_gotten) + ld h,0 + call l_lneg + jr c,i_130_i_129 +.i_129 + jp i_128 +.i_130_i_129 + ld hl,_player_cells + push hl + ld hl,(_p_facing) + ld h,0 + ld de,8 + add hl,de + add hl,hl + pop de + add hl,de + call l_gint ; + ld (_p_next_frame),hl + jp i_131 +.i_128 + ld a,(_p_facing) + ld e,a + ld d,0 + ld l,#(2 % 256) + call l_asl + ld h,0 + ld a,l + ld (_gpit),a + ld hl,(_p_vx) + ld a,h + or l + jp nz,i_132 + ld hl,1 % 256 ;const + ld a,l + ld (_rda),a + jp i_133 +.i_132 + ld hl,(_gpx) + ld h,0 + ld bc,4 + add hl,bc + ex de,hl + ld l,#(3 % 256) + call l_asr_u + ld de,3 ;const + ex de,hl + call l_and + ld h,0 + ld a,l + ld (_rda),a +.i_133 + ld hl,_player_cells + push hl + ld hl,(_gpit) + ld h,0 + ex de,hl + ld hl,(_rda) + ld h,0 + add hl,de + add hl,hl + pop de + add hl,de + call l_gint ; + ld (_p_next_frame),hl +.i_131 + ret + + + +._player_deplete + ld hl,(_p_life) + ld h,0 + ex de,hl + ld hl,(_p_kill_amt) + ld h,0 + call l_ugt + jp nc,i_134 + ld hl,(_p_life) + ld h,0 + ex de,hl + ld hl,(_p_kill_amt) + ld h,0 + ex de,hl + and a + sbc hl,de + jp i_135 +.i_134 + ld hl,0 ;const +.i_135 + ld h,0 + ld a,l + ld (_p_life),a + ret + + + +._player_kill + ld hl,0 % 256 ;const + ld a,l + ld (_p_killme),a + call _player_deplete + ld hl,2 ;const + add hl,sp + ld l,(hl) + ld h,0 + push hl + call _beep_fx + pop bc + ret + + + +._enems_draw_current + ld hl,_malotes + push hl + ld hl,(_enoffsmasi) + ld h,0 + ld b,h + ld c,l + add hl,bc + add hl,bc + ld b,h + ld c,l + add hl,bc + add hl,bc + pop de + add hl,de + ld l,(hl) + ld h,0 + ld a,l + ld (__en_x),a + ld hl,_malotes + push hl + ld hl,(_enoffsmasi) + ld h,0 + ld b,h + ld c,l + add hl,bc + add hl,bc + ld b,h + ld c,l + add hl,bc + add hl,bc + pop de + add hl,de + inc hl + ld l,(hl) + ld h,0 + ld a,l + ld (__en_y),a + ; enter: IX = sprite structure address + ; IY = clipping rectangle, set it to "ClipStruct" for full screen + ; BC = animate bitdef displacement (0 for no animation) + ; H = new row coord in chars + ; L = new col coord in chars + ; D = new horizontal rotation (0..7) ie horizontal pixel position + ; E = new vertical rotation (0..7) ie vertical pixel position + ld a, (_enit) + sla a + ld c, a + ld b, 0 + ld hl, _sp_moviles + add hl, bc + ld e, (hl) + inc hl + ld d, (hl) + push de + pop ix + ld iy, vpClipStruct + ld hl, _en_an_current_frame + add hl, bc + ld e, (hl) + inc hl + ld d, (hl) + ld hl, _en_an_next_frame + add hl, bc + ld a, (hl) + inc hl + ld h, (hl) + ld l, a + or a + sbc hl, de + push bc + ld b, h + ld c, l + ld a, (__en_y) + srl a + srl a + srl a + add 2 + ld h, a + ld a, (__en_x) + srl a + srl a + srl a + add 1 + ld l, a + ld a, (__en_x) + and 7 + ld d, a + ld a, (__en_y) + and 7 + ld e, a + call SPMoveSprAbs + pop bc + ld hl, _en_an_current_frame + add hl, bc + ex de, hl + ld hl, _en_an_next_frame + add hl, bc + ldi + ldi + ret + + + +._enems_load + ld hl,(_n_pant) + ld h,0 + ld b,h + ld c,l + add hl,bc + add hl,bc + ld h,0 + ld a,l + ld (_enoffs),a + ld hl,0 % 256 ;const + ld a,l + ld (_enit),a + jp i_138 +.i_136 + ld hl,(_enit) + ld h,0 + inc hl + ld a,l + ld (_enit),a +.i_138 + ld a,(_enit) + cp #(3 % 256) + jp z,i_137 + jp nc,i_137 + ld de,_en_an_frame + ld hl,(_enit) + ld h,0 + add hl,de + ld (hl),#(0 % 256 % 256) + ld de,_en_an_state + ld hl,(_enit) + ld h,0 + add hl,de + ld (hl),#(0 % 256 % 256) + ld de,_en_an_count + ld hl,(_enit) + ld h,0 + add hl,de + ld (hl),#(3 % 256 % 256) + ld hl,(_enoffs) + ld h,0 + ex de,hl + ld hl,(_enit) + ld h,0 + add hl,de + ld h,0 + ld a,l + ld (_enoffsmasi),a + ld hl,_en_an_next_frame + push hl + ld hl,(_enit) + ld h,0 + add hl,hl + pop de + add hl,de + push hl + ld hl,_sprite_18_a + pop de + call l_pint + ld hl,_malotes + push hl + ld hl,(_enoffsmasi) + ld h,0 + ld b,h + ld c,l + add hl,bc + add hl,bc + ld b,h + ld c,l + add hl,bc + add hl,bc + pop de + add hl,de + ld bc,8 + add hl,bc + call l_gchar + ld de,31 ;const + ex de,hl + call l_and +.i_141 + ld a,l + cp #(1% 256) + jp z,i_142 + cp #(2% 256) + jp z,i_143 + cp #(3% 256) + jp z,i_144 + cp #(4% 256) + jp z,i_145 + jp i_140 +.i_142 +.i_143 +.i_144 +.i_145 + ld de,_en_an_base_frame + ld hl,(_enit) + ld h,0 + add hl,de + push hl + ld hl,_malotes + push hl + ld hl,(_enoffsmasi) + ld h,0 + ld b,h + ld c,l + add hl,bc + add hl,bc + ld b,h + ld c,l + add hl,bc + add hl,bc + pop de + add hl,de + ld bc,8 + add hl,bc + call l_gchar + dec hl + add hl,hl + pop de + ld a,l + ld (de),a +.i_140 + jp i_136 +.i_137 + ret + + + +._enems_kill + ld hl,__en_t + call l_gchar + ld de,7 ;const + ex de,hl + call l_ne + jp nc,i_146 + ld hl,__en_t + call l_gchar + ld de,16 ;const + ex de,hl + call l_or + ld a,l + call l_sxt + ld a,l + ld (__en_t),a +.i_146 + ld hl,(_p_killed) + ld h,0 + inc hl + ld a,l + ld (_p_killed),a + ret + + + +._enems_move + ld hl,0 ;const + ld (_ptgmy),hl + ld (_ptgmx),hl + ld h,0 + ld a,l + ld (_p_gotten),a + ld h,0 + ld a,l + ld (_tocado),a + ld hl,0 % 256 ;const + ld a,l + ld (_enit),a + jp i_149 +.i_147 + ld hl,_enit + ld a,(hl) + inc (hl) +.i_149 + ld a,(_enit) + cp #(3 % 256) + jp z,i_148 + jp nc,i_148 + ld a,#(0 % 256 % 256) + ld (_active),a + ld hl,(_enoffs) + ld h,0 + ex de,hl + ld hl,(_enit) + ld h,0 + add hl,de + ld h,0 + ld a,l + ld (_enoffsmasi),a + ld hl, (_enoffsmasi) + ld h, 0 + ld d, h + ld e, l + add hl, hl + add hl, hl + add hl, hl + add hl, de + ld de, _malotes + add hl, de + ld (__baddies_pointer), hl + ld a, (hl) + ld (__en_x), a + inc hl + ld a, (hl) + ld (__en_y), a + inc hl + ld a, (hl) + ld (__en_x1), a + inc hl + ld a, (hl) + ld (__en_y1), a + inc hl + ld a, (hl) + ld (__en_x2), a + inc hl + ld a, (hl) + ld (__en_y2), a + inc hl + ld a, (hl) + ld (__en_mx), a + inc hl + ld a, (hl) + ld (__en_my), a + inc hl + ld a, (hl) + ld (__en_t), a + and 0x1f + ld (_rdt), a + ld hl,(_gpx) + ld h,0 + ld bc,12 + add hl,bc + ex de,hl + ld hl,(__en_x) + ld h,0 + call l_uge + jp nc,i_150 + ld hl,(_gpx) + ld h,0 + push hl + ld hl,(__en_x) + ld h,0 + ld bc,12 + add hl,bc + pop de + call l_ule + jp nc,i_150 + ld hl,1 ;const + jr i_151 +.i_150 + ld hl,0 ;const +.i_151 + ld h,0 + ld a,l + ld (_pregotten),a + ld hl,(_rdt) + ld h,0 +.i_154 + ld a,l + cp #(1% 256) + jp z,i_155 + cp #(2% 256) + jp z,i_156 + cp #(3% 256) + jp z,i_157 + cp #(4% 256) + jp z,i_158 + jp i_153 +.i_155 +.i_156 +.i_157 +.i_158 + ld a, 1 + ld (_active), a + ld a, (__en_mx) + ld c, a + ld a, (__en_x) + add a, c + ld (__en_x), a + ld c, a + ld a, (__en_x1) + cp c + jr z, _enems_lm_change_axis_x + ld a, (__en_x2) + cp c + jr nz, _enems_lm_change_axis_x_done + ._enems_lm_change_axis_x + ld a, (__en_mx) + neg + ld (__en_mx), a + ._enems_lm_change_axis_x_done + ld a, (__en_my) + ld c, a + ld a, (__en_y) + add a, c + ld (__en_y), a + ld c, a + ld a, (__en_y1) + cp c + jr z, _enems_lm_change_axis_y + ld a, (__en_y2) + cp c + jr nz, _enems_lm_change_axis_y_done + ._enems_lm_change_axis_y + ld a, (__en_my) + neg + ld (__en_my), a + ._enems_lm_change_axis_y_done +.i_153 + ld a,(_active) + and a + jp z,i_159 + ld de,_en_an_base_frame + ld hl,(_enit) + ld h,0 + add hl,de + ld e,(hl) + ld d,0 + ld hl,99 ;const + call l_ne + jp nc,i_160 + ld bc, (_enit) + ld b, 0 + ld hl, _en_an_count + add hl, bc + ld a, (hl) + inc a + ld (hl), a + cp 4 + jr nz, _enems_move_update_frame_done + xor a + ld (hl), a + ld hl, _en_an_frame + add hl, bc + ld a, (hl) + xor 1 + ld (hl), a + ld hl, _en_an_base_frame + add hl, bc + ld d, (hl) + add d ; A = en_an_base_frame [enit] + en_an_frame [enit]] + sla c ; Index 16 bits; it never overflows. + ld hl, _en_an_next_frame + add hl, bc + ex de, hl ; DE -> en_an_next_frame [enit] + sla a + ld c, a + ld b, 0 + ld hl, _enem_cells + add hl, bc ; HL -> enem_cells [en_an_base_frame [enit] + en_an_frame [enit]] + ldi + ldi ; Copy 16 bit + ._enems_move_update_frame_done +.i_160 + ld hl,__en_t + call l_gchar + ld de,4 ;const + ex de,hl + call l_eq + jp nc,i_161 + ld a,(_pregotten) + and a + jp z,i_162 + ld hl,__en_mx + call l_gchar + ld a,h + or l + jp z,i_163 + ld hl,(_gpy) + ld h,0 + ld bc,17 + add hl,bc + ex de,hl + ld hl,(__en_y) + ld h,0 + call l_uge + jp nc,i_165 + ld hl,(_gpy) + ld h,0 + ld bc,8 + add hl,bc + ex de,hl + ld hl,(__en_y) + ld h,0 + call l_ule + jr c,i_166_i_165 +.i_165 + jp i_164 +.i_166_i_165 + ld a,#(1 % 256 % 256) + ld (_p_gotten),a + ld hl,__en_mx + call l_gchar + ex de,hl + ld l,#(6 % 256) + call l_asl + ld (_ptgmx),hl + ld hl,(__en_y) + ld h,0 + ld bc,-16 + add hl,bc + ld h,0 + ld a,l + ld (_gpy),a + ld e,a + ld d,0 + ld l,#(6 % 256) + call l_asl + ld (_p_y),hl +.i_164 +.i_163 + ld hl,__en_my + call l_gchar + ld de,0 ;const + ex de,hl + call l_lt + jp nc,i_168 + ld hl,(_gpy) + ld h,0 + ld bc,18 + add hl,bc + ex de,hl + ld hl,(__en_y) + ld h,0 + call l_uge + jp nc,i_168 + ld hl,(_gpy) + ld h,0 + ld bc,8 + add hl,bc + ex de,hl + ld hl,(__en_y) + ld h,0 + call l_ule + jp c,i_170 +.i_168 + jr i_168_i_169 +.i_169 + ld a,h + or l + jp nz,i_170 +.i_168_i_169 + ld hl,__en_my + call l_gchar + ld de,0 ;const + ex de,hl + call l_gt + jp nc,i_171 + ld hl,(_gpy) + ld h,0 + ld bc,17 + add hl,bc + push hl + ld hl,__en_my + call l_gchar + pop de + add hl,de + ex de,hl + ld hl,(__en_y) + ld h,0 + call l_uge + jp nc,i_171 + ld hl,(_gpy) + ld h,0 + ld bc,8 + add hl,bc + ex de,hl + ld hl,(__en_y) + ld h,0 + call l_ule + jp nc,i_171 + ld hl,1 ;const + jr i_172 +.i_171 + ld hl,0 ;const +.i_172 + ld a,h + or l + jp nz,i_170 + jr i_173 +.i_170 + ld hl,1 ;const +.i_173 + ld a,h + or l + jp z,i_167 + ld a,#(1 % 256 % 256) + ld (_p_gotten),a + ld hl,__en_my + call l_gchar + ex de,hl + ld l,#(6 % 256) + call l_asl + ld (_ptgmy),hl + ld hl,(__en_y) + ld h,0 + ld bc,-16 + add hl,bc + ld h,0 + ld a,l + ld (_gpy),a + ld e,a + ld d,0 + ld l,#(6 % 256) + call l_asl + ld (_p_y),hl +.i_167 +.i_162 + jp i_174 +.i_161 + ld hl,(__en_x) + ld h,0 + ld a,l + ld (_cx2),a + ld hl,(__en_y) + ld h,0 + ld a,l + ld (_cy2),a + ld hl,(_tocado) + ld h,0 + call l_lneg + jp nc,i_176 + call _collide + ld a,h + or l + jp z,i_176 + ld a,(_p_estado) + cp #(0 % 256) + jr z,i_177_i_176 +.i_176 + jp i_175 +.i_177_i_176 + ld a,#(1 % 256 % 256) + ld (_tocado),a + ld a,#(4 % 256 % 256) + ld (_p_killme),a + ld hl,__en_mx + call l_gchar + push hl + ld hl,192 ;const + push hl + call _addsign + pop bc + pop bc + ld (_p_vx),hl + ld hl,__en_my + call l_gchar + push hl + ld hl,192 ;const + push hl + call _addsign + pop bc + pop bc + ld (_p_vy),hl +.i_175 +.i_174 +.i_178 +.i_159 + ld hl, (__baddies_pointer) + ld a, (__en_x) + ld (hl), a + inc hl + ld a, (__en_y) + ld (hl), a + inc hl + ld a, (__en_x1) + ld (hl), a + inc hl + ld a, (__en_y1) + ld (hl), a + inc hl + ld a, (__en_x2) + ld (hl), a + inc hl + ld a, (__en_y2) + ld (hl), a + inc hl + ld a, (__en_mx) + ld (hl), a + inc hl + ld a, (__en_my) + ld (hl), a + inc hl + ld a, (__en_t) + ld (hl), a + inc hl + jp i_147 +.i_148 + ret + + + +._hotspots_init + ld hl,0 % 256 ;const + ld a,l + ld (_gpit),a +.i_179 + ld a,(_gpit) + cp #(30 % 256) + jp z,i_180 + jp nc,i_180 + ld hl,_hotspots + push hl + ld hl,(_gpit) + ld h,0 + ld b,h + ld c,l + add hl,bc + add hl,bc + pop de + add hl,de + inc hl + inc hl + ld (hl),#(1 % 256 % 256) + ld hl,(_gpit) + ld h,0 + inc hl + ld a,l + ld (_gpit),a + jp i_179 +.i_180 + ret + + + +._hotspots_do + ld hl,_hotspots + push hl + ld hl,(_n_pant) + ld h,0 + ld b,h + ld c,l + add hl,bc + add hl,bc + pop de + add hl,de + inc hl + inc hl + ld l,(hl) + ld h,0 + ld a,h + or l + jp nz,i_181 + ret + + +.i_181 + ld hl,(_hotspot_x) + ld h,0 + ld a,l + ld (_cx2),a + ld hl,(_hotspot_y) + ld h,0 + ld a,l + ld (_cy2),a + call _collide + ld a,h + or l + jp z,i_182 + ld a,#(1 % 256 % 256) + ld (_hotspot_destroy),a + ld hl,_hotspots + push hl + ld hl,(_n_pant) + ld h,0 + ld b,h + ld c,l + add hl,bc + add hl,bc + pop de + add hl,de + inc hl + ld l,(hl) + ld h,0 +.i_185 + ld a,l + cp #(1% 256) + jp z,i_186 + cp #(2% 256) + jp z,i_187 + cp #(3% 256) + jp z,i_188 + jp i_184 +.i_186 + ld hl,(_p_objs) + ld h,0 + inc hl + ld a,l + ld (_p_objs),a + ld hl,9 % 256 ;const + push hl + call _beep_fx + pop bc + jp i_184 +.i_187 + ld hl,_p_keys + ld a,(hl) + inc (hl) + ld hl,7 % 256 ;const + push hl + call _beep_fx + pop bc + jp i_184 +.i_188 + ld hl,(_p_life) + ld h,0 + ld bc,10 + add hl,bc + ld h,0 + ld a,l + ld (_p_life),a + cp #(99 % 256) + jp z,i_189 + jp c,i_189 + ld hl,99 % 256 ;const + ld a,l + ld (_p_life),a +.i_189 + ld hl,8 % 256 ;const + push hl + call _beep_fx + pop bc +.i_184 + ld a,(_hotspot_destroy) + and a + jp z,i_190 + ld hl,_hotspots + push hl + ld hl,(_n_pant) + ld h,0 + ld b,h + ld c,l + add hl,bc + add hl,bc + pop de + add hl,de + inc hl + inc hl + ld (hl),#(0 % 256 % 256) + ld a,(_hotspot_x) + ld e,a + ld d,0 + ld l,#(4 % 256) + call l_asr_u + ld h,0 + ld a,l + ld (__x),a + ld a,(_hotspot_y) + ld e,a + ld d,0 + ld l,#(4 % 256) + call l_asr_u + ld h,0 + ld a,l + ld (__y),a + ld hl,(_orig_tile) + ld h,0 + ld a,l + ld (__t),a + call _draw_invalidate_coloured_tile_g + ld hl,240 % 256 ;const + ld a,l + ld (_hotspot_y),a +.i_190 +.i_182 + ret + + + +._main + di + call _cortina + ld hl,0 % 256 ;const + push hl + push hl + call sp_Initialize + pop bc + pop bc + ld hl,0 % 256 ;const + push hl + call sp_Border + pop bc + ld hl,0 % 256 ;const + push hl + ld hl,40 % 256 ;const + push hl + ld hl,14 ;const + push hl + ld hl,_AD_FREE + push hl + call sp_AddMemory + pop bc + pop bc + pop bc + pop bc + ld hl,_tileset + ld (_gen_pt),hl + ld hl,0 % 256 ;const + ld a,l + ld (_gpit),a +.i_193 + ld hl,(_gpit) + ld h,0 + push hl + ld hl,(_gen_pt) + push hl + call sp_TileArray + pop bc + pop bc + ld hl,(_gen_pt) + ld bc,8 + add hl,bc + ld (_gen_pt),hl + ld hl,_gpit + ld a,(hl) + inc (hl) +.i_191 + ld hl,(_gpit) + ld h,0 + ld a,h + or l + jp nz,i_193 +.i_192 + ld hl,0 % 256 ;const + push hl + ld hl,3 % 256 ;const + push hl + ld hl,_sprite_2_a + push hl + call sp_CreateSpr + pop bc + pop bc + pop bc + ld (_sp_player),hl + push hl + ld hl,_sprite_2_b + push hl + call sp_AddColSpr + pop bc + pop bc + ld hl,(_sp_player) + push hl + ld hl,_sprite_2_c + push hl + call sp_AddColSpr + pop bc + pop bc + ld hl,_sprite_2_a + ld (_p_next_frame),hl + ld (_p_current_frame),hl + ld hl,0 % 256 ;const + ld a,l + ld (_gpit),a + jp i_196 +.i_194 + ld hl,_gpit + ld a,(hl) + inc (hl) +.i_196 + ld a,(_gpit) + cp #(3 % 256) + jp z,i_195 + jp nc,i_195 + ld hl,_sp_moviles + push hl + ld hl,(_gpit) + ld h,0 + add hl,hl + pop de + add hl,de + push hl + ld hl,0 % 256 ;const + push hl + ld hl,3 % 256 ;const + push hl + ld hl,_sprite_9_a + push hl + call sp_CreateSpr + pop bc + pop bc + pop bc + pop de + call l_pint + ld hl,_sp_moviles + push hl + ld hl,(_gpit) + ld h,0 + add hl,hl + pop de + add hl,de + ld e,(hl) + inc hl + ld d,(hl) + push de + ld hl,_sprite_9_b + push hl + call sp_AddColSpr + pop bc + pop bc + ld hl,_sp_moviles + push hl + ld hl,(_gpit) + ld h,0 + add hl,hl + pop de + add hl,de + ld e,(hl) + inc hl + ld d,(hl) + push de + ld hl,_sprite_9_c + push hl + call sp_AddColSpr + pop bc + pop bc + ld hl,_en_an_current_frame + push hl + ld hl,(_gpit) + ld h,0 + add hl,hl + pop de + add hl,de + push hl + ld hl,_en_an_next_frame + push hl + ld hl,(_gpit) + ld h,0 + add hl,hl + pop de + add hl,de + push hl + ld hl,_sprite_9_a + pop de + call l_pint + pop de + call l_pint + jp i_194 +.i_195 +.i_197 + ld hl,0 % 256 ;const + ld a,l + ld (_level),a + call sp_UpdateNow + call _blackout + ld hl, _s_title + ld de, 16384 + call depack + call _select_joyfunc + call _cortina + call sp_UpdateNow + ld hl, _s_marco + ld de, 16384 + call depack + ; Makes debugging easier + ._game_loop_init + ld hl,1 % 256 ;const + ld a,l + ld (_playing),a + call _player_init + call _hotspots_init + call _locks_init + ld a,#(24 % 256 % 256) + ld (_n_pant),a + ld a,#(0 % 256 % 256) + ld (_maincounter),a + ld hl,0 % 256 ;const + ld a,l + ld (_half_life),a + ld h,0 + ld a,l + ld (_success),a + ld h,0 + ld a,l + ld (_p_killme),a + ld hl,255 % 256 ;const + ld a,l + ld (_killed_old),a + ld h,0 + ld a,l + ld (_life_old),a + ld h,0 + ld a,l + ld (_keys_old),a + ld h,0 + ld a,l + ld (_objs_old),a + ld hl,255 % 256 ;const + ld a,l + ld (_o_pant),a +.i_199 + ld hl,(_playing) + ld h,0 + ld a,h + or l + jp z,i_200 + ; Makes debugging easier + ._game_loop_do + ld a,#(1 % 256 % 256) + ld (_p_kill_amt),a + ld hl,(_joyfunc) + push hl + ld hl,_keys + pop de + ld bc,i_201 + push hl + push bc + push de + ld a,1 + ret +.i_201 + pop bc + ld h,0 + ld a,l + ld (_pad0),a + ld hl,(_o_pant) + ld h,0 + ex de,hl + ld hl,(_n_pant) + ld h,0 + call l_ne + jp nc,i_202 + call _draw_scr + ld hl,(_n_pant) + ld h,0 + ld a,l + ld (_o_pant),a +.i_202 + ld hl,(_p_objs) + ld h,0 + ex de,hl + ld hl,(_objs_old) + ld h,0 + call l_ne + jp nc,i_203 + call _draw_objs + ld hl,(_p_objs) + ld h,0 + ld a,l + ld (_objs_old),a +.i_203 + ld hl,(_p_life) + ld h,0 + ex de,hl + ld hl,(_life_old) + ld h,0 + call l_ne + jp nc,i_204 + ld a,#(5 % 256 % 256) + ld (__x),a + ld a,#(0 % 256 % 256) + ld (__y),a + ld hl,(_p_life) + ld h,0 + ld a,l + ld (__t),a + call _print_number2 + ld hl,(_p_life) + ld h,0 + ld a,l + ld (_life_old),a +.i_204 + ld hl,(_p_keys) + ld h,0 + ex de,hl + ld hl,(_keys_old) + ld h,0 + call l_ne + jp nc,i_205 + ld a,#(16 % 256 % 256) + ld (__x),a + ld a,#(0 % 256 % 256) + ld (__y),a + ld hl,(_p_keys) + ld h,0 + ld a,l + ld (__t),a + call _print_number2 + ld hl,(_p_keys) + ld h,0 + ld a,l + ld (_keys_old),a +.i_205 + ld hl,_maincounter + ld a,(hl) + inc (hl) + ld hl,(_half_life) + ld h,0 + call l_lneg + ld hl,0 ;const + rl l + ld h,0 + ld a,l + ld (_half_life),a + call _player_move + call _enems_move + ld a,(_p_killme) + and a + jp z,i_206 + ld a,(_p_life) + and a + jp z,i_207 + ld hl,(_p_killme) + ld h,0 + push hl + call _player_kill + pop bc + jp i_208 +.i_207 + ld hl,0 % 256 ;const + ld a,l + ld (_playing),a +.i_208 +.i_206 + ld hl,(_o_pant) + ld h,0 + ex de,hl + ld hl,(_n_pant) + ld h,0 + call l_eq + jp nc,i_209 + ld hl,0 % 256 ;const + ld a,l + ld (_enit),a + jp i_212 +.i_210 + ld hl,_enit + ld a,(hl) + inc (hl) +.i_212 + ld a,(_enit) + cp #(3 % 256) + jp z,i_211 + jp nc,i_211 + ld hl,(_enoffs) + ld h,0 + ex de,hl + ld hl,(_enit) + ld h,0 + add hl,de + ld h,0 + ld a,l + ld (_enoffsmasi),a + call _enems_draw_current + jp i_210 +.i_211 + ld a,(_p_estado) + ld e,a + ld d,0 + ld hl,2 ;const + call l_and + ld de,0 ;const + ex de,hl + call l_eq + jp c,i_214 + ld a,(_half_life) + cp #(0 % 256) + jp nz,i_213 +.i_214 + ld ix, (_sp_player) + ld iy, vpClipStruct + ld hl, (_p_next_frame) + ld de, (_p_current_frame) + or a + sbc hl, de + ld b, h + ld c, l + ld a, (_gpy) + srl a + srl a + srl a + add 2 + ld h, a + ld a, (_gpx) + srl a + srl a + srl a + add 1 + ld l, a + ld a, (_gpx) + and 7 + ld d, a + ld a, (_gpy) + and 7 + ld e, a + call SPMoveSprAbs + jp i_216 +.i_213 + ld ix, (_sp_player) + ld iy, vpClipStruct + ld hl, (_p_next_frame) + ld de, (_p_current_frame) + or a + sbc hl, de + ld b, h + ld c, l + ld hl, 0xfefe + ld de, 0 + call SPMoveSprAbs +.i_216 + ld hl,(_p_next_frame) + ld (_p_current_frame),hl + call sp_UpdateNow +.i_209 + call _hotspots_do + ld a,(_gpx) + cp #(0 % 256) + jp nz,i_218 + ld hl,(_p_vx) + ld de,0 ;const + ex de,hl + call l_lt + jr c,i_219_i_218 +.i_218 + jp i_217 +.i_219_i_218 + ld hl,(_n_pant) + ld h,0 + dec hl + ld a,l + ld (_n_pant),a + ld a,#(224 % 256 % 256) + ld (_gpx),a + ld hl,14336 ;const + ld (_p_x),hl +.i_217 + ld a,(_gpx) + cp #(224 % 256) + jp nz,i_221 + ld hl,(_p_vx) + ld de,0 ;const + ex de,hl + call l_gt + jr c,i_222_i_221 +.i_221 + jp i_220 +.i_222_i_221 + ld hl,(_n_pant) + ld h,0 + inc hl + ld a,l + ld (_n_pant),a + ld hl,0 ;const + ld (_p_x),hl + ld h,0 + ld a,l + ld (_gpx),a +.i_220 + ld a,(_gpy) + cp #(0 % 256) + jp nz,i_224 + ld hl,(_p_vy) + ld de,0 ;const + ex de,hl + call l_lt + jp nc,i_224 + ld a,(_n_pant) + cp #(6 % 256) + jr z,i_224_uge + jp c,i_224 +.i_224_uge + jr i_225_i_224 +.i_224 + jp i_223 +.i_225_i_224 + ld hl,(_n_pant) + ld h,0 + ld bc,-6 + add hl,bc + ld h,0 + ld a,l + ld (_n_pant),a + ld a,#(144 % 256 % 256) + ld (_gpy),a + ld hl,9216 ;const + ld (_p_y),hl +.i_223 + ld a,(_gpy) + cp #(144 % 256) + jp nz,i_227 + ld hl,(_p_vy) + ld de,0 ;const + ex de,hl + call l_gt + jr c,i_228_i_227 +.i_227 + jp i_226 +.i_228_i_227 + ld a,(_n_pant) + cp #(24 % 256) + jp z,i_229 + jp nc,i_229 + ld hl,(_n_pant) + ld h,0 + ld bc,6 + add hl,bc + ld h,0 + ld a,l + ld (_n_pant),a + ld hl,0 ;const + ld (_p_y),hl + ld h,0 + ld a,l + ld (_gpy),a + ld hl,(_p_vy) + ld de,256 ;const + ex de,hl + call l_gt + jp nc,i_230 + ld hl,256 ;const + ld (_p_vy),hl +.i_230 +.i_229 +.i_226 + ld hl,0 ;const + ld a,h + or l + jp nz,i_232 + ld a,(_p_objs) + cp #(25 % 256) + jp nz,i_231 +.i_232 + ld a,#(1 % 256 % 256) + ld (_success),a + ld hl,0 % 256 ;const + ld a,l + ld (_playing),a +.i_231 + jp i_199 +.i_200 + call sp_UpdateNow + call sp_WaitForNoKey + ld hl,(_success) + ld h,0 + ld a,h + or l + jp z,i_234 + call _game_ending + jp i_235 +.i_234 + call _game_over +.i_235 + call _cortina + call _clear_sprites + jp i_197 +.i_198 + ret + + + ; ***************************************************************************** + ; * phaser1 engine, with synthesised drums + ; * + ; * original code by shiru - .http + ; * modified by chris cowley + ; * + ; * produced by beepola v1.05.01 + ; ****************************************************************************** + .musicstart + ld hl,musicdata ; <- pointer to music data. change + ; this to play a different song + ld a,(hl) ; get the loop start pointer + ld (pattern_loop_begin),a + inc hl + ld a,(hl) ; get the song end pointer + ld (pattern_loop_end),a + inc hl + ld e,(hl) + inc hl + ld d,(hl) + inc hl + ld (instrum_tbl),hl + ld (current_inst),hl + add hl,de + ld (pattern_addr),hl + xor a + ld (pattern_ptr),a ; set the pattern pointer to zero + ld h,a + ld l,a + ld (note_ptr),hl ; set the note offset (within this pattern) to 0 + .player + ;di + push iy + ;ld a,border_col + xor a + ld h,$00 + ld l,a + ld (cnt_1a),hl + ld (cnt_1b),hl + ld (div_1a),hl + ld (div_1b),hl + ld (cnt_2),hl + ld (div_2),hl + ld (out_1),a + ld (out_2),a + jr main_loop + ; ******************************************************************************************************** + ; * next_pattern + ; * + ; * select the next pattern in sequence (and handle looping if weve reached pattern_loop_end + ; * execution falls through to playnote to play the first note from our next pattern + ; ******************************************************************************************************** + .next_pattern + ld a,(pattern_ptr) + inc a + inc a + defb $fe ; cp n + .pattern_loop_end defb 0 + jr nz,no_pattern_loop + ; handle pattern looping at and of song + defb $3e ; ld a,n + .pattern_loop_begin defb 0 + .no_pattern_loop ld (pattern_ptr),a + ld hl,$0000 + ld (note_ptr),hl ; start of pattern (note_ptr = 0) + .main_loop + ld iyl,0 ; set channel = 0 + .read_loop + ld hl,(pattern_addr) + ld a,(pattern_ptr) + ld e,a + ld d,0 + add hl,de + ld e,(hl) + inc hl + ld d,(hl) ; now de = start of pattern data + ld hl,(note_ptr) + inc hl ; increment the note pointer and... + ld (note_ptr),hl ; ..store it + dec hl + add hl,de ; now hl = address of note data + ld a,(hl) + or a + jr z,next_pattern ; select next pattern + bit 7,a + jp z,render ; play the currently defined note(s) and drum + ld iyh,a + and $3f + cp $3c + jp nc,other ; other parameters + add a,a + ld b,0 + ld c,a + ld hl,freq_table + add hl,bc + ld e,(hl) + inc hl + ld d,(hl) + ld a,iyl ; iyl = 0 for channel 1, or = 1 for channel 2 + or a + jr nz,set_note2 + ld (div_1a),de + ex de,hl + defb $dd,$21 ; ld ix,nn + .current_inst + defw $0000 + ld a,(ix+$00) + or a + jr z,l809b ; original code jumps into byte 2 of the djnz (invalid opcode fd) + ld b,a + .l8098 add hl,hl + djnz l8098 + .l809b ld e,(ix+$01) + ld d,(ix+$02) + add hl,de + ld (div_1b),hl + ld iyl,1 ; set channel = 1 + ld a,iyh + and $40 + jr z,read_loop ; no phase reset + ld hl,out_1 ; reset phaser + res 4,(hl) + ld hl,$0000 + ld (cnt_1a),hl + ld h,(ix+$03) + ld (cnt_1b),hl + jr read_loop + .set_note2 + ld (div_2),de + ld a,iyh + ld hl,out_2 + res 4,(hl) + ld hl,$0000 + ld (cnt_2),hl + jp read_loop + .set_stop + ld hl,$0000 + ld a,iyl + or a + jr nz,set_stop2 + ; stop channel 1 note + ld (div_1a),hl + ld (div_1b),hl + ld hl,out_1 + res 4,(hl) + ld iyl,1 + jp read_loop + .set_stop2 + ; stop channel 2 note + ld (div_2),hl + ld hl,out_2 + res 4,(hl) + jp read_loop + .other cp $3c + jr z,set_stop ; stop note + cp $3e + jr z,skip_ch1 ; no changes to channel 1 + inc hl ; instrument change + ld l,(hl) + ld h,$00 + add hl,hl + ld de,(note_ptr) + inc de + ld (note_ptr),de ; increment the note pointer + defb $01 ; ld bc,nn + .instrum_tbl + defw $0000 + add hl,bc + ld (current_inst),hl + jp read_loop + .skip_ch1 + ld iyl,$01 + jp read_loop + .exit_player + ld hl,$2758 + exx + pop iy + ;ei + ret + .render + and $7f ; l813a + cp $76 + jp nc,drums + ld d,a + exx + defb $21 ; ld hl,nn + .cnt_1a defw $0000 + defb $dd,$21 ; ld ix,nn + .cnt_1b defw $0000 + defb $01 ; ld bc,nn + .div_1a defw $0000 + defb $11 ; ld de,nn + .div_1b defw $0000 + defb $3e ; ld a,n + .out_1 defb $0 + exx + ex af,af ; beware! + defb $21 ; ld hl,nn + .cnt_2 defw $0000 + defb $01 ; ld bc,nn + .div_2 defw $0000 + defb $3e ; ld a,n + .out_2 defb $00 + .play_note + ; read keyboard + ld e,a + xor a + in a,($fe) + or $e0 + inc a + .player_wait_key + jr nz,exit_player + ld a,e + ld e,0 + .l8168 exx + ex af,af ; beware! + add hl,bc + out ($fe),a + jr c,l8171 + jr l8173 + .l8171 xor $10 + .l8173 add ix,de + jr c,l8179 + jr l817b + .l8179 xor $10 + .l817b ex af,af ; beware! + out ($fe),a + exx + add hl,bc + jr c,l8184 + jr l8186 + .l8184 xor $10 + .l8186 nop + jp l818a + .l818a exx + ex af,af ; beware! + add hl,bc + out ($fe),a + jr c,l8193 + jr l8195 + .l8193 xor $10 + .l8195 add ix,de + jr c,l819b + jr l819d + .l819b xor $10 + .l819d ex af,af ; beware! + out ($fe),a + exx + add hl,bc + jr c,l81a6 + jr l81a8 + .l81a6 xor $10 + .l81a8 nop + jp l81ac + .l81ac exx + ex af,af ; beware! + add hl,bc + out ($fe),a + jr c,l81b5 + jr l81b7 + .l81b5 xor $10 + .l81b7 add ix,de + jr c,l81bd + jr l81bf + .l81bd xor $10 + .l81bf ex af,af ; beware! + out ($fe),a + exx + add hl,bc + jr c,l81c8 + jr l81ca + .l81c8 xor $10 + .l81ca nop + jp l81ce + .l81ce exx + ex af,af ; beware! + add hl,bc + out ($fe),a + jr c,l81d7 + jr l81d9 + .l81d7 xor $10 + .l81d9 add ix,de + jr c,l81df + jr l81e1 + .l81df xor $10 + .l81e1 ex af,af ; beware! + out ($fe),a + exx + add hl,bc + jr c,l81ea + jr l81ec + .l81ea xor $10 + .l81ec dec e + jp nz,l8168 + exx + ex af,af ; beware! + add hl,bc + out ($fe),a + jr c,l81f9 + jr l81fb + .l81f9 xor $10 + .l81fb add ix,de + jr c,l8201 + jr l8203 + .l8201 xor $10 + .l8203 ex af,af ; beware! + out ($fe),a + exx + add hl,bc + jr c,l820c + jr l820e + .l820c xor $10 + .l820e dec d + jp nz,play_note + ld (cnt_2),hl + ld (out_2),a + exx + ex af,af ; beware! + ld (cnt_1a),hl + ld (cnt_1b),ix + ld (out_1),a + jp main_loop + ; ************************************************************ + ; * drums - synthesised + ; ************************************************************ + .drums + add a,a ; on entry a=$75+drum number (i.e. $76 to $7e) + ld b,0 + ld c,a + ld hl,drum_table - 236 + add hl,bc + ld e,(hl) + inc hl + ld d,(hl) + ex de,hl + jp (hl) + .drum_tone1 ld l,16 + jr drum_tone + .drum_tone2 ld l,12 + jr drum_tone + .drum_tone3 ld l,8 + jr drum_tone + .drum_tone4 ld l,6 + jr drum_tone + .drum_tone5 ld l,4 + jr drum_tone + .drum_tone6 ld l,2 + .drum_tone + ld de,3700 + ld bc,$0101 + xor a + .dt_loop0 out ($fe),a + dec b + jr nz,dt_loop1 + xor 16 + ld b,c + ex af,af ; beware! + ld a,c + add a,l + ld c,a + ex af,af ; beware! + .dt_loop1 dec e + jr nz,dt_loop0 + dec d + jr nz,dt_loop0 + jp main_loop + .drum_noise1 ld de,2480 + ld ixl,1 + jr drum_noise + .drum_noise2 ld de,1070 + ld ixl,10 + jr drum_noise + .drum_noise3 ld de,365 + ld ixl,101 + .drum_noise + ld h,d + ld l,e + xor a + ld c,a + .dn_loop0 ld a,(hl) + and 16 + or c + out ($fe),a + ld b,ixl + .dn_loop1 djnz dn_loop1 + inc hl + dec e + jr nz,dn_loop0 + dec d + jr nz,dn_loop0 + jp main_loop + .pattern_addr defw $0000 + .pattern_ptr defb 0 + .note_ptr defw $0000 + ; ************************************************************** + ; * frequency table + ; ************************************************************** + .freq_table + defw 178,189,200,212,225,238,252,267,283,300,318,337 + defw 357,378,401,425,450,477,505,535,567,601,637,675 + defw 715,757,802,850,901,954,1011,1071,1135,1202,1274,1350 + defw 1430,1515,1605,1701,1802,1909,2023,2143,2270,2405,2548,2700 + defw 2860,3030,3211,3402,3604,3818,4046,4286,4541,4811,5097,5400 + ; ***************************************************************** + ; * synth drum lookup table + ; ***************************************************************** + .drum_table + defw drum_tone1,drum_tone2,drum_tone3,drum_tone4,drum_tone5,drum_tone6 + defw drum_noise1,drum_noise2,drum_noise3 + .musicdata + defb 0 ; pattern loop begin * 2 + defb 16 ; song length * 2 + defw 8 ; offset to start of song (length of instrument table) + defb 1 ; multiple + defw 10 ; detune + defb 0 ; phase + defb 1 ; multiple + defw 5 ; detune + defb 1 ; phase + .patterndata + defw pat0 + defw pat1 + defw pat0 + defw pat1 + defw pat2 + defw pat3 + defw pat2 + defw pat3 + ; *** pattern data - $00 marks the end of a pattern *** + .pat0 + defb $bd,0 + defb 152 + defb 140 + defb 6 + defb 157 + defb 140 + defb 6 + defb 159 + defb 188 + defb 6 + defb 152 + defb 140 + defb 6 + defb 157 + defb 6 + defb 159 + defb 6 + defb 152 + defb 6 + defb 159 + defb 6 + defb 151 + defb 139 + defb 6 + defb 157 + defb 139 + defb 6 + defb 159 + defb 188 + defb 6 + defb 151 + defb 139 + defb 6 + defb 157 + defb 6 + defb 159 + defb 6 + defb 151 + defb 6 + defb 159 + defb 6 + defb $00 + .pat1 + defb $bd,0 + defb 150 + defb 138 + defb 6 + defb 157 + defb 138 + defb 6 + defb 159 + defb 188 + defb 6 + defb 150 + defb 138 + defb 6 + defb 157 + defb 6 + defb 159 + defb 6 + defb 150 + defb 6 + defb 159 + defb 6 + defb 149 + defb 137 + defb 6 + defb 159 + defb 137 + defb 6 + defb 157 + defb 188 + defb 6 + defb 149 + defb 137 + defb 6 + defb 159 + defb 6 + defb 157 + defb 145 + defb 6 + defb 149 + defb 6 + defb 159 + defb 6 + defb $00 + .pat2 + defb $bd,2 + defb 140 + defb 152 + defb 24 + defb 140 + defb 6 + defb 141 + defb 6 + defb 140 + defb 12 + defb 139 + defb 163 + defb 24 + defb 139 + defb 6 + defb 140 + defb 6 + defb 139 + defb 12 + defb $00 + .pat3 + defb 138 + defb 150 + defb 24 + defb 138 + defb 6 + defb 139 + defb 6 + defb 138 + defb 12 + defb 137 + defb 161 + defb 30 + defb 133 + defb 145 + defb 18 + defb $00 +; SECTION text + +.i_1 + defm " " + defb 0 + + defm " GAME OVER! " + defb 0 + +; SECTION code + + + +; --- Start of Static Variables --- + +; SECTION bss + +.__en_t defs 1 +.__en_x defs 1 +.__en_y defs 1 +._sp_moviles defs 6 +._gpen_cx defs 1 +._gpen_cy defs 1 +.__en_x1 defs 1 +.__en_y1 defs 1 +.__en_x2 defs 1 +.__en_y2 defs 1 +._en_an_base_frame defs 3 +._hotspot_x defs 1 +._hotspot_y defs 1 +._half_life defs 1 +.__en_mx defs 1 +.__en_my defs 1 +._map_pointer defs 2 +._en_an_state defs 3 +._flags defs 32 +._p_facing defs 1 +._p_frame defs 1 +._pregotten defs 1 +._hit_h defs 1 +._p_kill_amt defs 1 +._hit_v defs 1 +._killed_old defs 1 +._gpaux defs 1 +._map_attr defs 150 +._active defs 1 +._p_ct_estado defs 1 +._level defs 1 +._hotspot_destroy defs 1 +._x0 defs 1 +._y0 defs 1 +._x1 defs 1 +._y1 defs 1 +.__n defs 1 +.__t defs 1 +.__x defs 1 +.__y defs 1 +._life_old defs 1 +.__gp_gen defs 2 +._gen_pt defs 2 +._p_current_frame defs 2 +._ptgmx defs 2 +._ptgmy defs 2 +._en_an_current_frame defs 6 +._sp_player defs 2 +._enoffs defs 1 +._p_estado defs 1 +._p_killed defs 1 +._p_ammo defs 1 +._gpen_x defs 1 +._gpen_y defs 1 +._pad0 defs 1 +._p_killme defs 1 +._n_pant defs 1 +._p_cont_salto defs 1 +._o_pant defs 1 +._p_life defs 1 +._enit defs 1 +._p_fuel defs 1 +._p_objs defs 1 +._p_gotten defs 1 +._gpcx defs 1 +._gpcy defs 1 +._gpit defs 1 +._gpjt defs 1 +._p_keys defs 1 +._playing defs 1 +._gpox defs 1 +._seed defs 2 +._isrc defs 1 +._p_tx defs 1 +._p_ty defs 1 +._asm_int_2 defs 2 +._p_vx defs 2 +._p_vy defs 2 +._gpxx defs 1 +._gpyy defs 1 +._objs_old defs 1 +._maincounter defs 1 +._ptx1 defs 1 +._ptx2 defs 1 +._pty1 defs 1 +._pty2 defs 1 +._asm_number defs 1 +._p_next_frame defs 2 +._en_an_next_frame defs 6 +._at1 defs 1 +._at2 defs 1 +.__en_life defs 1 +._cx1 defs 1 +._cy1 defs 1 +._cx2 defs 1 +._cy2 defs 1 +._p_subframe defs 1 +._gpc defs 1 +._gpd defs 1 +._hit defs 1 +._rda defs 1 +._rdb defs 1 +._rdc defs 1 +._p_x defs 2 +._AD_FREE defs 600 +._p_y defs 2 +._gpx defs 1 +._gpy defs 1 +._rdd defs 1 +._rdn defs 1 +._itj defs 2 +._keys_old defs 1 +._rdt defs 1 +._rdx defs 1 +._rdy defs 1 +._wall_h defs 1 +._enoffsmasi defs 1 +._wall_v defs 1 +._tocado defs 1 +._is_rendering defs 1 +._slevel defs 1 +._p_facing_h defs 1 +.__baddies_pointer defs 2 +._p_facing_v defs 1 +._p_saltando defs 1 +._possee defs 1 +._orig_tile defs 1 +._en_an_frame defs 3 +._success defs 1 +._en_an_count defs 3 +._p_disparando defs 1 +; SECTION code + + + +; --- Start of Scope Defns --- + + LIB sp_GetKey + LIB sp_BlockAlloc + XDEF __en_t + LIB sp_ScreenStr + XDEF __en_x + XDEF __en_y + XDEF _hotspots + XDEF _mons_col_sc_x + XDEF _mons_col_sc_y + XDEF _draw_scr + LIB sp_PixelUp + XDEF _prepare_level + LIB sp_JoyFuller + LIB sp_MouseAMXInit + XDEF _blackout_area + LIB sp_MouseAMX + XDEF _sp_moviles + XDEF _gpen_cx + XDEF _tilanims_do + XDEF _gpen_cy + XDEF __en_x1 + LIB sp_SetMousePosAMX + XDEF __en_y1 + XDEF _u_malloc + LIB sp_Validate + LIB sp_HashAdd + XDEF _cortina + XDEF __en_x2 + XDEF __en_y2 + LIB sp_Border + XDEF _sg_submenu + LIB sp_Inkey + XDEF _enems_kill + XDEF _enems_load + XDEF _en_an_base_frame + XDEF _enems_init + XDEF _draw_objs + XDEF _hotspot_x + XDEF _hotspot_y + LIB sp_CreateSpr + LIB sp_MoveSprAbs + LIB sp_BlockCount + LIB sp_AddMemory + XDEF _half_life + XDEF __en_mx + XDEF __en_my + XDEF _map_pointer + XDEF _en_an_state + XDEF _enems_move + LIB sp_PrintAt + LIB sp_Pause + XDEF _flags + LIB sp_ListFirst + LIB sp_HeapSiftUp + LIB sp_ListCount + XDEF _p_facing + XDEF _invalidate_tile + XDEF _p_frame + LIB sp_Heapify + XDEF _malotes + LIB sp_MoveSprRel + XDEF _tilanims_add + XDEF _pregotten + XDEF _hit_h + XDEF _blackout + LIB sp_TileArray + LIB sp_MouseSim + LIB sp_BlockFit + XDEF _map_buff + defc _map_buff = 61697 + XDEF _p_kill_amt + XDEF _hit_v + LIB sp_HeapExtract + LIB sp_HuffExtract + XDEF _killed_old + LIB sp_SetMousePosSim + XDEF _gpaux + XDEF _joyfuncs + XDEF _time_over + LIB sp_ClearRect + LIB sp_HuffGetState + XDEF _map_attr + XDEF _invalidate_viewport + XDEF _active + XDEF _p_ct_estado + LIB sp_ListAppend + XDEF _level + LIB sp_ListCreate + LIB sp_ListConcat + XDEF _limit + XDEF _hotspot_destroy + LIB sp_JoyKempston + LIB sp_UpdateNow + LIB sp_MouseKempston + LIB sp_PrintString + LIB sp_PixelDown + LIB sp_MoveSprAbsC + LIB sp_PixelLeft + XDEF _hotspots_init + XDEF _x0 + LIB sp_InitAlloc + XDEF _espera_activa + XDEF _y0 + XDEF _x1 + XDEF _y1 + LIB sp_DeleteSpr + XDEF _get_resource + LIB sp_JoyTimexEither + XDEF __n + XDEF _player_kill + XDEF __t + XDEF _player_init + XDEF __x + XDEF _player_hidden + XDEF __y + XDEF _life_old + LIB sp_Invalidate + LIB sp_CreateGenericISR + LIB sp_JoyKeyboard + LIB sp_FreeBlock + XDEF _tape_load + LIB sp_PrintAtDiff + LIB sp_UpdateNowEx + XDEF _run_fire_script + XDEF _player_move + XDEF __gp_gen + XDEF _gen_pt + XDEF _tilanims_reset + XDEF _enems_draw_current + XDEF _s_marco + XDEF _sprite_10_a + XDEF _addsign + XDEF _sprite_10_b + XDEF _sprite_10_c + XDEF _sprite_11_a + XDEF _sprite_11_b + XDEF _tape_save + XDEF _sprite_11_c + XDEF _sprite_12_a + XDEF _sprite_12_b + XDEF _sprite_12_c + XDEF _sprite_13_a + XDEF _sprite_13_b + XDEF _sprite_13_c + XDEF _sprite_14_a + XDEF _sprite_14_b + XDEF _sprite_14_c + XDEF _cm_two_points + XDEF _sprite_15_a + XDEF _sprite_15_b + LIB sp_RegisterHookLast + LIB sp_IntLargeRect + LIB sp_IntPtLargeRect + LIB sp_HashDelete + LIB sp_GetCharAddr + XDEF _qtile + XDEF _mem_load + LIB sp_RemoveHook + XDEF _p_current_frame + XDEF _ptgmx + XDEF _ptgmy + XDEF _en_an_current_frame + XDEF _warp_to_level + XDEF _sprite_15_c + XDEF _sprite_16_a + XDEF _sprite_16_b + XDEF _sprite_16_c + LIB sp_MoveSprRelC + LIB sp_InitIM2 + XDEF _sprite_18_a + XDEF _sp_player + XDEF _beep_fx + LIB sp_GetTiles + XDEF _mem_save + LIB sp_Pallette + LIB sp_WaitForNoKey + XDEF _enoffs + XDEF _safe_byte + defc _safe_byte = 23296 + XDEF _locks_init + XDEF _utaux + LIB sp_JoySinclair1 + LIB sp_JoySinclair2 + LIB sp_ListPrepend + XDEF _behs + XDEF _draw_invalidate_coloured_tile_g + XDEF _p_estado + XDEF _bullets_fire + XDEF _p_killed + LIB sp_GetAttrAddr + XDEF _enem_cells + XDEF _p_ammo + XDEF _gpen_x + XDEF _gpen_y + LIB sp_HashCreate + XDEF _pad0 + XDEF _p_killme + LIB sp_Random32 + LIB sp_ListInsert + XDEF _n_pant + LIB sp_ListFree + XDEF _bullets_init + LIB sp_IntRect + LIB sp_ListLast + XDEF _p_cont_salto + LIB sp_ListCurr + XDEF _o_pant + XDEF _p_life + XDEF _enit + XDEF _print_number2 + XDEF _p_fuel + XDEF _pause_screen + XDEF _mapa + LIB sp_ListSearch + LIB sp_WaitForKey + XDEF _main + XDEF _draw_coloured_tile + LIB sp_Wait + LIB sp_GetScrnAddr + XDEF _attr + LIB sp_PutTiles + XDEF _joyfunc + XDEF _p_objs + XDEF _p_gotten + XDEF _gpcx + XDEF _gpcy + XDEF _s_title + XDEF _player_cells + LIB sp_RemoveDList + XDEF _gpit + XDEF _gpjt + XDEF _p_keys + XDEF _playing + XDEF _bullets_move + XDEF _player_calc_bounding_box + LIB sp_ListNext + XDEF _gpox + LIB sp_HuffDecode + XDEF _keys + XDEF _rand + LIB sp_Swap + XDEF _seed + XDEF _isrc + XDEF _p_tx + XDEF _p_ty + XDEF _print_str + XDEF _lame_sound + XDEF _asm_int_2 + XDEF _player_deplete + XDEF _p_vx + XDEF _p_vy + XDEF _gpxx + XDEF _gpyy + XDEF _objs_old + LIB sp_ListPrev + XDEF _maincounter + XDEF _ptx1 + XDEF _ptx2 + XDEF _pty1 + XDEF _pty2 + XDEF _asm_number + LIB sp_RegisterHook + LIB sp_ListRemove + LIB sp_ListTrim + LIB sp_MoveSprAbsNC + XDEF _break_wall + LIB sp_HuffDelete + XDEF _update_tile + XDEF _p_next_frame + XDEF _en_an_next_frame + XDEF _cerrojos + XDEF _at1 + XDEF _at2 + LIB sp_ListAdd + LIB sp_KeyPressed + XDEF _step + XDEF __en_life + LIB sp_PrintAtInv + XDEF _draw_coloured_tile_gamearea + XDEF _draw_scr_hotspots_locks + XDEF _cx1 + XDEF _cy1 + XDEF _cx2 + XDEF _cy2 + LIB sp_CompDListAddr + XDEF _draw_decorations + XDEF _p_subframe + XDEF _u_free + XDEF _abs + XDEF _game_ending + LIB sp_CharRight + XDEF _s_ending + XDEF _bullets_update + LIB sp_InstallISR + XDEF _gpc + XDEF _gpd + LIB sp_HuffAccumulate + LIB sp_HuffSetState + XDEF _hit + XDEF _hotspots_do + XDEF _sprite_1_a + XDEF _sprite_1_b + XDEF _sprite_1_c + XDEF _sprite_2_a + XDEF _sprite_2_b + XDEF _rda + XDEF _rdb + XDEF _rdc + LIB sp_SwapEndian + LIB sp_CharLeft + XDEF _p_x + XDEF _AD_FREE + LIB sp_CharDown + LIB sp_HeapSiftDown + LIB sp_HuffCreate + XDEF _p_y + XDEF _gpx + XDEF _gpy + XDEF _rdd + XDEF _rdn + XDEF _itj + LIB sp_HuffEncode + XDEF _keys_old + XDEF _rdt + XDEF _sprite_2_c + XDEF _sprite_3_a + XDEF _sprite_3_b + LIB sp_JoyTimexRight + LIB sp_PixelRight + XDEF _rdx + XDEF _rdy + XDEF _sprite_3_c + LIB sp_Initialize + XDEF _sprite_4_a + XDEF _sprite_4_b + XDEF _sprite_4_c + XDEF _process_tile + XDEF _tileset + XDEF _sprite_5_a + LIB sp_JoyTimexLeft + LIB sp_SetMousePosKempston + XDEF _sprite_5_b + XDEF _sprite_5_c + XDEF _sprite_6_a + LIB sp_ComputePos + XDEF _sprite_6_b + XDEF _sprite_6_c + XDEF _sprite_7_a + XDEF _sprite_7_b + XDEF _sprite_7_c + XDEF _sprite_8_a + XDEF _sprite_8_b + XDEF _sprite_8_c + XDEF _sprite_9_a + XDEF _sprite_9_b + XDEF _sprite_9_c + XDEF _wall_h + XDEF _enoffsmasi + XDEF _spacer + XDEF _wall_v + LIB sp_IntIntervals + XDEF _my_malloc + XDEF _tocado + XDEF _is_rendering + LIB sp_inp + XDEF _SetRAMBank + LIB sp_IterateSprChar + LIB sp_AddColSpr + LIB sp_outp + XDEF _simple_coco_init + XDEF _slevel + XDEF _asm_int + defc _asm_int = 23302 + XDEF _p_facing_h + LIB sp_IntPtInterval + LIB sp_RegisterHookFirst + XDEF __baddies_pointer + LIB sp_HashLookup + XDEF _p_facing_v + XDEF _p_saltando + LIB sp_PFill + XDEF _possee + LIB sp_HashRemove + LIB sp_CharUp + XDEF _collide + XDEF _orig_tile + XDEF _en_an_frame + XDEF _success + LIB sp_MoveSprRelNC + XDEF _simple_coco_shoot + XDEF _ram_destination + defc _ram_destination = 23299 + XDEF _en_an_count + XDEF _select_joyfunc + XDEF _unpack + XDEF _clear_sprites + XDEF _p_disparando + LIB sp_IterateDList + XDEF _distance + XDEF _draw_scr_background + XDEF _simple_coco_update + XDEF _game_over + LIB sp_LookupKey + LIB sp_HeapAdd + LIB sp_CompDirtyAddr + LIB sp_EmptyISR + XDEF _ram_address + defc _ram_address = 23297 + LIB sp_StackSpace + + +; --- End of Scope Defns --- + + +; --- End of Compilation --- diff --git a/src/dev/lala_beta.tap b/src/dev/lala_beta.tap index 109eff57..25d71b00 100644 Binary files a/src/dev/lala_beta.tap and b/src/dev/lala_beta.tap differ diff --git a/src/dev/mainloop.h b/src/dev/mainloop.h index 79f2cefe..9875ead0 100644 --- a/src/dev/mainloop.h +++ b/src/dev/mainloop.h @@ -161,7 +161,7 @@ void main (void) { } silent_level = 0; - prepare_level (level); + prepare_level (); #endif #ifndef DIRECT_TO_PLAY diff --git a/src/dev/mainloop/flick_screen.h b/src/dev/mainloop/flick_screen.h index c1c039b9..97b4515c 100644 --- a/src/dev/mainloop/flick_screen.h +++ b/src/dev/mainloop/flick_screen.h @@ -13,7 +13,7 @@ } #if defined (COMPRESSED_LEVELS) - if (gpx == 224 && p_vx > 0 && x_pant < (level_data->map_w - 1)) + if (gpx == 224 && p_vx > 0 && x_pant < (level_data.map_w - 1)) #else if (gpx == 224 && p_vx > 0 && x_pant < (MAP_W - 1)) #endif @@ -27,7 +27,7 @@ #if MAP_H > 1 if (gpy == 0 && p_vy < 0 && y_pant > 0) { #if defined (COMPRESSED_LEVELS) - n_pant -= level_data->map_w; + n_pant -= level_data.map_w; #else n_pant -= MAP_W; #endif @@ -37,8 +37,8 @@ } #if defined (COMPRESSED_LEVELS) - if (gpy == 144 && p_vy > 0 && y_pant < (level_data->map_h - 1)) { - n_pant += level_data->map_w; + if (gpy == 144 && p_vy > 0 && y_pant < (level_data.map_h - 1)) { + n_pant += level_data.map_w; #else if (gpy == 144 && p_vy > 0 && y_pant < (MAP_H - 1)) { n_pant += MAP_W; @@ -62,8 +62,8 @@ #if MAP_H > 1 #if defined (COMPRESSED_LEVELS) - if (gpy == 0 && p_vy < 0 && n_pant >= level_data->map_w) { - n_pant -= level_data->map_w; + if (gpy == 0 && p_vy < 0 && n_pant >= level_data.map_w) { + n_pant -= level_data.map_w; #else if (gpy == 0 && p_vy < 0 && n_pant >= MAP_W) { n_pant -= MAP_W; @@ -74,8 +74,8 @@ if (gpy == 144 && p_vy > 0) { // 9216 = 144 * 64 #if defined (COMPRESSED_LEVELS) - if (n_pant < level_data->map_w * (level_data->map_h - 1)) { - n_pant += level_data->map_w; + if (n_pant < level_data.map_w * (level_data.map_h - 1)) { + n_pant += level_data.map_w; #else if (n_pant < MAP_W * MAP_H - MAP_W) { n_pant += MAP_W; diff --git a/src/dev/mainloop/game_loop.h b/src/dev/mainloop/game_loop.h index 1752797a..3f59e563 100644 --- a/src/dev/mainloop/game_loop.h +++ b/src/dev/mainloop/game_loop.h @@ -76,8 +76,8 @@ #ifdef PLAYER_CHECK_MAP_BOUNDARIES #ifdef COMPRESSED_LEVELS - x_pant = n_pant % level_data->map_w; - y_pant = n_pant / level_data->map_w; + x_pant = n_pant % level_data.map_w; + y_pant = n_pant / level_data.map_w; #else x_pant = n_pant % MAP_W; y_pant = n_pant / MAP_W; #endif diff --git a/src/dev/my/fixed_screens.h b/src/dev/my/fixed_screens.h index 36e03655..e794b96d 100644 --- a/src/dev/my/fixed_screens.h +++ b/src/dev/my/fixed_screens.h @@ -36,7 +36,7 @@ void game_ending (void) { void game_over (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " GAME OVER! "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" GAME OVER! "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNow (); @@ -52,7 +52,7 @@ void game_over (void) { #if defined(TIMER_ENABLE) && defined(SHOW_TIMER_OVER) void time_over (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " TIME'S UP! "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" TIME'S UP! "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); @@ -69,7 +69,7 @@ void game_over (void) { #ifdef PAUSE_ABORT void pause_screen (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " PAUSED "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" PAUSED "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); } @@ -78,7 +78,7 @@ void game_over (void) { #ifdef COMPRESSED_LEVELS void zone_clear (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " ZONE CLEAR "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" ZONE CLEAR "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); espera_activa (250); diff --git a/src/dev/setenv.bat b/src/dev/setenv.bat index e034d8d5..a543b050 100644 --- a/src/dev/setenv.bat +++ b/src/dev/setenv.bat @@ -1,6 +1,5 @@ @echo off -set Z88DK_PATH=c:\z88dk10 -set PATH=%Z88DK_PATH%\bin;%PATH% +set Z88DK_PATH=c:\z88dk +set PATH=%Z88DK_PATH%\bin.x86;%PATH% set Z80_OZFILES=%Z88DK_PATH%\Lib\ set ZCCCFG=%Z88DK_PATH%\Lib\Config\ -zcc diff --git a/src/dev/zcc_opt.def b/src/dev/zcc_opt.def deleted file mode 100644 index 3cbd4251..00000000 --- a/src/dev/zcc_opt.def +++ /dev/null @@ -1,8 +0,0 @@ - -IF !DEFINED_STACKPTR - defc DEFINED_STACKPTR = 1 - defc STACKPTR = 61936 -ENDIF - - DEFINE DEFINED_myzorg - defc myzorg = 24000 diff --git a/src/utils/msc3_mk1.exe b/src/utils/msc3_mk1.exe index 9275b5d4..cfc19fa9 100644 Binary files a/src/utils/msc3_mk1.exe and b/src/utils/msc3_mk1.exe differ diff --git a/src/utils/src/msc3_mk1.bas b/src/utils/src/msc3_mk1.bas index a7b982fc..fbc0e463 100644 --- a/src/utils/src/msc3_mk1.bas +++ b/src/utils/src/msc3_mk1.bas @@ -1362,7 +1362,7 @@ if clausulasUsed (&H10) Then print #f3, " // readxy ();" print #f3, " // sc_terminado = (flags [sc_x] != sc_y);" print #f3, " #asm" - print #f3, " call _read_two_bytes_d_e" + print #f3, " call _read_two_bytes_D_E" print #f3, " // Set sc_terminado if flags [C] != E" print #f3, " ld b, 0" print #f3, " ld c, d" @@ -1385,7 +1385,7 @@ if clausulasUsed (&H11) Then print #f3, " // readxy ();" print #f3, " // sc_terminado = (flags [sc_x] >= sc_y);" print #f3, " #asm" - print #f3, " call _read_two_bytes_d_e" + print #f3, " call _read_two_bytes_D_E" print #f3, " // Set sc_terminado if flags [C] >= E" print #f3, " ld b, 0" print #f3, " ld c, d" @@ -1408,7 +1408,7 @@ if clausulasUsed (&H12) Then print #f3, " // readxy ();" print #f3, " // sc_terminado = (flags [sc_x] <= sc_y);" print #f3, " #asm" - print #f3, " call _read_two_bytes_d_e" + print #f3, " call _read_two_bytes_D_E" print #f3, " // Set sc_terminado if flags [C] <= E" print #f3, " // or... if E >= flags [C]" print #f3, " ld b, 0" @@ -1433,7 +1433,7 @@ if clausulasUsed (&H13) Then print #f3, " // readxy ();" print #f3, " // sc_terminado = (flags [sc_x] == sc_y);" print #f3, " #asm" - print #f3, " call _read_two_bytes_d_e" + print #f3, " call _read_two_bytes_D_E" print #f3, " // Set sc_terminado if flags [C] == E" print #f3, " ld b, 0" print #f3, " ld c, d" @@ -2166,9 +2166,9 @@ If actionsUsed (&HE6) Then print #f3, " // MUSIC n" print #f3, " sc_n = read_vbyte ();" print #f3, " if (sc_n == 0xff) {" - print #f3, " wyz_stop_sound ();" + print #f3, " STOP_SOUND ();" print #f3, " } else {" - print #f3, " wyz_play_music (sc_n);" + print #f3, " PLAY_MUSIC (sc_n);" print #f3, " }" print #f3, " break;" End If diff --git a/trash/6baddies/dev/lala_beta.tap b/trash/6baddies/dev/6baddies.tap similarity index 61% rename from trash/6baddies/dev/lala_beta.tap rename to trash/6baddies/dev/6baddies.tap index b0bef175..bec8da72 100644 Binary files a/trash/6baddies/dev/lala_beta.tap and b/trash/6baddies/dev/6baddies.tap differ diff --git a/trash/6baddies/dev/assets/levels.h b/trash/6baddies/dev/assets/levels.h index f2e45409..bd29b455 100644 --- a/trash/6baddies/dev/assets/levels.h +++ b/trash/6baddies/dev/assets/levels.h @@ -64,7 +64,7 @@ extern unsigned char font [0]; ._font BINARY "font.bin" #endasm -extern LEVELHEADER level_data [0]; +extern LEVELHEADER level_data; #asm ._level_data defs 16 #endasm diff --git a/trash/6baddies/dev/compile.bat b/trash/6baddies/dev/compile.bat index c170d20d..12afcaa0 100644 --- a/trash/6baddies/dev/compile.bat +++ b/trash/6baddies/dev/compile.bat @@ -2,7 +2,7 @@ if [%1]==[help] goto :help -set game=lala_beta +set game=6baddies if [%1]==[justcompile] goto :compile if [%1]==[clean] goto :clean @@ -66,7 +66,8 @@ rem cd ..\dev :compile echo Compilando guego -zcc +zx -vn mk1.c -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul +zcc +zx -vn mk1.c -O3 -crt0=crt.asm -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul +rem zcc +zx -vn mk1.c -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul ..\utils\printsize.exe %game%.bin ..\utils\printsize.exe scripts.bin diff --git a/trash/6baddies/dev/crt.asm b/trash/6baddies/dev/crt.asm new file mode 100644 index 00000000..27e0d47d --- /dev/null +++ b/trash/6baddies/dev/crt.asm @@ -0,0 +1,17 @@ + MODULE zx82_crt0 + INCLUDE "zcc_opt.def" + XREF _main ; main() is always external to crt0 code + + IF !STACKPTR + defc STACKPTR = $FFFF + ENDIF + + IF !CRT_ORG_CODE + defc CRT_ORG_CODE = 32768 + ENDIF + + org CRT_ORG_CODE + +start: + ld sp,STACKPTR + jp _main diff --git a/trash/6baddies/dev/definitions.h b/trash/6baddies/dev/definitions.h index 4203e824..38f3bd82 100644 --- a/trash/6baddies/dev/definitions.h +++ b/trash/6baddies/dev/definitions.h @@ -6,7 +6,8 @@ .fsClipStruct defb 0, 24, 0, 32 #endasm -void *joyfunc = sp_JoyKeyboard; // Puntero a la función de manejo seleccionada. +//void *joyfunc = sp_JoyKeyboard; // Puntero a la función de manejo seleccionada. +unsigned int (*joyfunc)(struct sp_UDK *) = sp_JoyKeyboard; const void *joyfuncs [] = { sp_JoyKeyboard, sp_JoyKempston, sp_JoySinclair1 @@ -56,7 +57,7 @@ unsigned char enoffs; // Aux char asm_number; -unsigned int asm_int; +unsigned int asm_int @ 23302; unsigned int asm_int_2; unsigned int seed; unsigned char half_life; @@ -118,7 +119,7 @@ unsigned char p_tx, p_ty; #endif signed int ptgmx, ptgmy; -const unsigned char *spacer = " "; +unsigned char *spacer = " "; unsigned char enit; diff --git a/trash/6baddies/dev/engine/c_levels.h b/trash/6baddies/dev/engine/c_levels.h index 18b118a1..cbbaf91a 100644 --- a/trash/6baddies/dev/engine/c_levels.h +++ b/trash/6baddies/dev/engine/c_levels.h @@ -10,8 +10,8 @@ void prepare_level (void) { #endif { n_pant = level_data.scr_ini; - gpx = level_data->ini_x << 4; p_x = gpx << 6; - gpy = level_data->ini_y << 4; p_y = gpy << 6; + gpx = level_data.ini_x << 4; p_x = gpx << 6; + gpy = level_data.ini_y << 4; p_y = gpy << 6; } #ifdef ACTIVATE_SCRIPTING @@ -27,8 +27,8 @@ void prepare_level (void) { unpack ((unsigned int) levels [level].c_sprites, (unsigned int) (sprites + 16)); #endif - level_data->map_w = levels [level].map_w; - level_data->map_h = levels [level].map_h; + level_data.map_w = levels [level].map_w; + level_data.map_h = levels [level].map_h; #ifdef ACTIVATE_SCRIPTING if (script_result != 3) diff --git a/trash/6baddies/dev/engine/enengine.h.bak b/trash/6baddies/dev/engine/enengine.h.bak deleted file mode 100644 index 4acb013d..00000000 --- a/trash/6baddies/dev/engine/enengine.h.bak +++ /dev/null @@ -1,632 +0,0 @@ -// MTE MK1 (la Churrera) v5.0 -// Copyleft 2010-2014, 2020 by the Mojon Twins - -// enengine.h - -#ifdef ENABLE_PURSUERS - void enems_pursuers_init (void) { - en_an_alive [enit] = 0; - en_an_dead_row [enit] = DEATH_COUNT_ADD + (rand () & DEATH_COUNT_AND); - } -#endif - -#ifndef COMPRESSED_LEVELS - #if defined(PLAYER_STEPS_ON_ENEMIES) || defined (PLAYER_CAN_FIRE) - void enems_init (void) { - enit = 0; - while (enit < MAP_W * MAP_H * MAX_ENEMS) { - malotes [enit].t = malotes [enit].t & 0xEF; // Clear bit 4 - #ifdef PLAYER_CAN_FIRE - malotes [enit].life = ENEMIES_LIFE_GAUGE; - #endif - enit ++; - } - } - #endif -#endif - -void enems_draw_current (void) { - _en_x = malotes [enoffsmasi].x; - _en_y = malotes [enoffsmasi].y; - - #asm - ; enter: IX = sprite structure address - ; IY = clipping rectangle, set it to "ClipStruct" for full screen - ; BC = animate bitdef displacement (0 for no animation) - ; H = new row coord in chars - ; L = new col coord in chars - ; D = new horizontal rotation (0..7) ie horizontal pixel position - ; E = new vertical rotation (0..7) ie vertical pixel position - - // sp_moviles [enit] = sp_moviles + enit*2 - ld a, (_enit) - sla a - ld c, a - ld b, 0 // BC = offset to [enit] in 16bit arrays - ld hl, _sp_moviles - add hl, bc - ld e, (hl) - inc hl - ld d, (hl) - push de - pop ix - - // Clipping rectangle - ld iy, vpClipStruct - - // Animation - // en_an_next_frame [enit] - en_an_current_frame [enit] - ld hl, _en_an_current_frame - add hl, bc // HL -> en_an_current_frame [enit] - ld e, (hl) - inc hl - ld d, (hl) // DE = en_an_current_frame [enit] - - ld hl, _en_an_next_frame - add hl, bc // HL -> en_an_next_frame [enit] - ld a, (hl) - inc hl - ld h, (hl) - ld l, a // HL = en_an_next_frame [enit] - - or a // clear carry - sbc hl, de // en_an_next_frame [enit] - en_an_current_frame [enit] - - push bc // Save for later - - ld b, h - ld c, l // ** BC = animate bitdef ** - - //VIEWPORT_Y + (rdy >> 3), VIEWPORT_X + (rdx >> 3) - ld a, (__en_y) - srl a - srl a - srl a - add VIEWPORT_Y - ld h, a - - ld a, (__en_x) - srl a - srl a - srl a - add VIEWPORT_X - ld l, a - - // rdx & 7, rdy & 7 - ld a, (__en_x) - and 7 - ld d, a - - ld a, (__en_y) - and 7 - ld e, a - - call SPMoveSprAbs - - // en_an_current_frame [enit] = en_an_next_frame [enit]; - - pop bc // Retrieve index - - ld hl, _en_an_current_frame - add hl, bc - ex de, hl // DE -> en_an_current_frame [enit] - - ld hl, _en_an_next_frame - add hl, bc // HL -> en_an_next_frame [enit] - - ldi - ldi - #endasm -} - -void enems_load (void) { - // Movemos y cambiamos a los enemigos según el tipo que tengan - enoffs = n_pant * MAX_ENEMS; - - for (enit = 0; enit < MAX_ENEMS; ++ enit) { - en_an_frame [enit] = 0; - en_an_state [enit] = 0; - en_an_count [enit] = 3; - enoffsmasi = enoffs + enit; - - #ifdef RESPAWN_ON_ENTER - // Back to life! - malotes [enoffsmasi].t &= 0xEF; - #ifdef PLAYER_CAN_FIRE - #if defined (COMPRESSED_LEVELS) && defined (MODE_128K) - malotes [enoffsmasi].life = level_data.enems_life; - #else - malotes [enoffsmasi].life = ENEMIES_LIFE_GAUGE; - #endif - #endif - #endif - - #include "my/ci/enems_custom_respawn.h" - - en_an_next_frame [enit] = sprite_18_a; - - switch (malotes [enoffsmasi].t & 0x1f) { - case 1: - case 2: - case 3: - case 4: - en_an_base_frame [enit] = (malotes [enoffsmasi].t - 1) << 1; - break; - - #ifdef ENABLE_ORTHOSHOOTERS - case 5: - #if ORTHOSHOOTERS_BASE_CELL==99 - en_an_base_frame [enit] = ORTHOSHOOTERS_BASE_CELL; - en_an_next_frame [enit] = sprite_18_a; - #else - en_an_base_frame [enit] = ORTHOSHOOTERS_BASE_CELL << 1; - #endif - en_an_state [enit] = malotes [enoffsmasi].t >> 6; - break; - #endif - - #ifdef ENABLE_FANTIES - case 6: - en_an_base_frame [enit] = FANTIES_BASE_CELL << 1; - en_an_x [enit] = malotes [enoffsmasi].x1 << 6; - en_an_y [enit] = malotes [enoffsmasi].y1 << 6; - en_an_vx [enit] = en_an_vy [enit] = 0; - - #ifdef PLAYER_CAN_FIRE - malotes [enoffsmasi].life = FANTIES_LIFE_GAUGE; - #endif - #ifdef FANTIES_TYPE_HOMING - en_an_state [enit] = TYPE_6_IDLE; - #endif - break; - #endif - - #ifdef ENABLE_PURSUERS - case 7: - enems_pursuers_init (); - break; - #endif - - #include "my/ci/enems_load.h" - } - - #include "my/ci/enems_extra_mods.h" - } -} - -void enems_kill (void) { - if (_en_t != 7) _en_t |= 16; - ++ p_killed; - - #ifdef BODY_COUNT_ON - flags [BODY_COUNT_ON] = p_killed; - #endif - - #include "my/ci/on_enems_killed.h" - - #ifdef ACTIVATE_SCRIPTING - run_script (2 * MAP_W * MAP_H + 5); // PLAYER_KILLS_ENEMY - #endif -} - -void enems_move (void) { - tocado = p_gotten = ptgmx = ptgmy = 0; - - for (enit = 0; enit < MAX_ENEMS; enit ++) { - active = 0; - enoffsmasi = enoffs + enit; - - // Copy array values to temporary variables as fast as possible - - #asm - // Those values are stored in this order: - // x, y, x1, y1, x2, y2, mx, my, t[, life] - // Point HL to baddies [enoffsmasi]. The struct is 9 or 10 bytes long - // so this is baddies + enoffsmasi*(9|10) depending on PLAYER_CAN_FIRE - ld hl, (_enoffsmasi) - ld h, 0 - - #if defined PLAYER_CAN_FIRE || defined COMPRESSED_LEVELS - add hl, hl // x2 - ld d, h - ld e, l // DE = x2 - add hl, hl // x4 - add hl, hl // x8 - - add hl, de // HL = x8 + x2 = x10 - #else - ld d, h - ld e, l // DE = x1 - add hl, hl // x2 - add hl, hl // x4 - add hl, hl // x8 - - add hl, de // HL = x8 + x1 = x9 - #endif - - ld de, _malotes - add hl, de - - ld (__baddies_pointer), hl // Save address for later - - ld a, (hl) - ld (__en_x), a - inc hl - - ld a, (hl) - ld (__en_y), a - inc hl - - ld a, (hl) - ld (__en_x1), a - inc hl - - ld a, (hl) - ld (__en_y1), a - inc hl - - ld a, (hl) - ld (__en_x2), a - inc hl - - ld a, (hl) - ld (__en_y2), a - inc hl - - ld a, (hl) - ld (__en_mx), a - inc hl - - ld a, (hl) - ld (__en_my), a - inc hl - - ld a, (hl) - ld (__en_t), a - and 0x1f - ld (_rdt), a - - #ifdef PLAYER_CAN_FIRE - inc hl - - ld a, (hl) - ld (__en_life), a - #endif - #endasm - - #if defined PLAYER_CAN_FIRE || defined ENABLE_PURSUERS - _en_cx = _en_x; _en_cy = _en_y; - #endif - - #ifdef MODE_128K - if (en_an_state [enit] == GENERAL_DYING) { - -- en_an_count [enit]; - if (en_an_count [enit] == 0) { - en_an_state [enit] = 0; - en_an_next_frame [enit] = sprite_18_a; - continue; - } - } - #endif - - #ifndef PLAYER_GENITAL - #if defined (BOUNDING_BOX_8_CENTERED) || defined (BOUNDING_BOX_8_BOTTOM) - pregotten = (gpx + 12 >= _en_x && gpx <= _en_x + 12); - #else - pregotten = (gpx + 15 >= _en_x && gpx <= _en_x + 15); - #endif - #endif - - switch (rdt) { - case 1: - case 2: - case 3: - case 4: - #ifdef ENABLE_ORTHOSHOOTERS - case 5: - #endif - #include "engine/enem_mods/enem_type_lineal.h" - #ifdef ENABLE_ORTHOSHOOTERS - if (rdt == 5) { - #include "engine/enem_mods/enem_type_orthoshooters.h" - } - #endif - break; - - #ifdef ENABLE_FANTIES - case 6: - #include "engine/enem_mods/enem_type_fanties.h" - break; - #endif - #ifdef ENABLE_PURSUERS - case 7: - #include "engine/enem_mods/enem_type_pursuers_asm.h" - break; - #endif - #include "my/ci/enems_move.h" - /* - default: - if (en_an_state [enit] != GENERAL_DYING) en_an_next_frame [enit] = sprite_18_a; - */ - } - - if (active) { - // Animate - if (en_an_base_frame [enit] != 99) { - /* - en_an_count [enit] ++; - if (en_an_count [enit] == 4) { - en_an_count [enit] = 0; - en_an_frame [enit] = !en_an_frame [enit]; - en_an_next_frame [enit] = enem_cells [en_an_base_frame [enit] + en_an_frame [enit]]; - } - */ - #asm - ld bc, (_enit) - ld b, 0 - - ld hl, _en_an_count - add hl, bc - ld a, (hl) - inc a - ld (hl), a - - cp 4 - jr nz, _enems_move_update_frame_done - - xor a - ld (hl), a - - ld hl, _en_an_frame - add hl, bc - ld a, (hl) - xor 1 - ld (hl), a - - ld hl, _en_an_base_frame - add hl, bc - ld d, (hl) - add d ; A = en_an_base_frame [enit] + en_an_frame [enit]] - - sla c ; Index 16 bits; it never overflows. - ld hl, _en_an_next_frame - add hl, bc - ex de, hl ; DE -> en_an_next_frame [enit] - - sla a - ld c, a - ld b, 0 - - ld hl, _enem_cells - add hl, bc ; HL -> enem_cells [en_an_base_frame [enit] + en_an_frame [enit]] - - ldi - ldi ; Copy 16 bit - ._enems_move_update_frame_done - #endasm - } - - // Collide with player - - #if !defined PLAYER_GENITAL && !defined DISABLE_PLATFORMS - // Platforms - if (_en_t == 4) { - if (pregotten) { - - // Horizontal moving platforms - if (_en_mx) { - if (gpy + 17 >= _en_y && gpy + 8 <= _en_y) { - p_gotten = 1; - ptgmx = _en_mx << 6; - gpy = (_en_y - 16); p_y = gpy << 6; - } - } - - // Vertical moving platforms - if ( - (_en_my < 0 && gpy + 18 >= _en_y && gpy + 8 <= _en_y) || - (_en_my > 0 && gpy + 17 + _en_my >= _en_y && gpy + 8 <= _en_y) - ) { - p_gotten = 1; - ptgmy = _en_my << 6; - gpy = (_en_y - 16); p_y = gpy << 6; - } - - } - } else - #endif - { - #include "my/ci/custom_enems_player_collision.h" - - cx2 = _en_x; cy2 = _en_y; - if (!tocado && collide () && p_estado == EST_NORMAL) { - #ifdef PLAYER_STEPS_ON_ENEMIES - // Step over enemy - #ifdef PLAYER_CAN_STEP_ON_FLAG - if (flags [PLAYER_CAN_STEP_ON_FLAG] != 0 && - gpy < _en_y - 2 && p_vy >= 0 && rdt >= PLAYER_MIN_KILLABLE) - #else - if (gpy < _en_y - 2 && p_vy >= 0 && rdt >= PLAYER_MIN_KILLABLE) - #endif - { - #ifdef MODE_128K - PLAY_SOUND (SFX_KILL_ENEMY_STEP); - en_an_state [enit] = GENERAL_DYING; - en_an_count [enit] = 12; - en_an_next_frame [enit] = sprite_17_a; - p_vy = -256; - #else - en_an_next_frame [enit] = sprite_17_a; - enems_draw_current (); - sp_UpdateNow (); - - beep_fx (5); - en_an_next_frame [enit] = sprite_18_a; - #endif - - enems_kill (); - } else - #endif - { - tocado = 1; - #if defined(SLOW_DRAIN) && defined(PLAYER_BOUNCES) - if (!lasttimehit || ((maincounter & 3) == 0)) { - #ifdef MODE_128K - p_killme = SFX_ENEMY_HIT; - #else - p_killme = 4; - #endif - } - #else - - #ifdef MODE_128K - p_killme = SFX_ENEMY_HIT; - #else - p_killme = 4; - #endif - #endif - - #ifdef PLAYER_BOUNCES - #ifdef ENABLE_FANTIES - if (_en_t == 6) { - p_vx = en_an_vx [enit] + en_an_vx [enit]; - p_vy = en_an_vy [enit] + en_an_vy [enit]; - } else - #endif - - #ifndef PLAYER_GENITAL - { - p_vx = addsign (_en_mx, PLAYER_MAX_VX); - p_vy = addsign (_en_my, PLAYER_MAX_VX); - } - #else - { - if (_en_mx) { - p_vx = addsign (gpx - _en_x, abs (_en_mx) << 8); - } - if (_en_my) { - p_vy = addsign (gpy - _en_y, abs (_en_my) << 8); - } - } - #endif - #endif - - #include "my/ci/on_enems_collision.h" - } - } - } - player_enem_collision_done: - - #ifdef PLAYER_CAN_FIRE - // Collide with bullets - #ifdef FIRE_MIN_KILLABLE - if (rdt >= FIRE_MIN_KILLABLE) - #endif - { - for (gpjt = 0; gpjt < MAX_BULLETS; gpjt ++) { - if (bullets_estado [gpjt] == 1) { - blx = bullets_x [gpjt] + 3; - bly = bullets_y [gpjt] + 3; - if (blx >= _en_x && blx <= _en_x + 15 && bly >= _en_y && bly <= _en_y + 15) { - #ifdef ENABLE_FANTIES - if (_en_t == 6) { - en_an_vx [enit] += addsign (bullets_mx [gpjt], 128); - } - #endif - _en_x = _en_cx; - _en_y = _en_cy; - en_an_next_frame [enit] = sprite_17_a; - bullets_estado [gpjt] = 0; - #if !defined PLAYER_GENITAL && !defined DISABLE_PLATFORMS - if (_en_t != 4) -- _en_life; - #else - -- _en_life; - #endif - - if (_en_life == 0) { - enems_draw_current (); - sp_UpdateNow (); - #ifdef MODE_128K - en_an_state [enit] = GENERAL_DYING; - en_an_count [enit] = 12; - PLAY_SOUND (SFX_KILL_ENEMY_SHOOT); - #else - beep_fx (5); - en_an_next_frame [enit] = sprite_18_a; - #endif - - #ifdef ENABLE_PURSUERS - enems_pursuers_init (); - #endif - - enems_kill (); - } - - #ifdef MODE_128K - PLAY_SOUND (SFX_HIT_ENEMY); - #else - beep_fx (1); - #endif - } - } - } - - } - #endif - - #include "my/ci/enems_extra_actions.h" - } - - #asm - // Those values are stored in this order: - // x, y, x1, y1, x2, y2, mx, my, t[, life] - - ld hl, (__baddies_pointer) // Restore pointer - - ld a, (__en_x) - ld (hl), a - inc hl - - ld a, (__en_y) - ld (hl), a - inc hl - - ld a, (__en_x1) - ld (hl), a - inc hl - - ld a, (__en_y1) - ld (hl), a - inc hl - - ld a, (__en_x2) - ld (hl), a - inc hl - - ld a, (__en_y2) - ld (hl), a - inc hl - - ld a, (__en_mx) - ld (hl), a - inc hl - - ld a, (__en_my) - ld (hl), a - inc hl - - ld a, (__en_t) - ld (hl), a - inc hl - - #ifdef PLAYER_CAN_FIRE - ld a, (__en_life) - ld (hl), a - #endif - #endasm - } - - #if defined(SLOW_DRAIN) && defined(PLAYER_BOUNCES) - lasttimehit = tocado; - #endif -} diff --git a/trash/6baddies/dev/engine/player.h b/trash/6baddies/dev/engine/player.h index 608bf647..59844d68 100644 --- a/trash/6baddies/dev/engine/player.h +++ b/trash/6baddies/dev/engine/player.h @@ -725,19 +725,19 @@ unsigned char player_move (void) { } } - p_next_frame = player_cells [p_facing + p_frame]; + p_next_frame = (unsigned char *) (player_cells [p_facing + p_frame]); #elif defined PLAYER_BOOTEE gpit = p_facing << 2; if (p_vy == 0) { - p_next_frame = player_cells [gpit]; + p_next_frame = (unsigned char *) (player_cells [gpit]); } else if (p_vy < 0) { - p_next_frame = player_cells [gpit + 1]; + p_next_frame = (unsigned char *) (player_cells [gpit + 1]); } else { - p_next_frame = player_cells [gpit + 2]; + p_next_frame = (unsigned char *) (player_cells [gpit + 2]); } #else if (!possee && !p_gotten) { - p_next_frame = player_cells [8 + p_facing]; + p_next_frame = (unsigned char *) (player_cells [8 + p_facing]); } else { gpit = p_facing << 2; if (p_vx == 0) { @@ -745,7 +745,7 @@ unsigned char player_move (void) { } else { rda = ((gpx + 4) >> 3) & 3; } - p_next_frame = player_cells [gpit + rda]; + p_next_frame = (unsigned char *) (player_cells [gpit + rda]); } #endif } diff --git a/trash/6baddies/dev/mainloop.h b/trash/6baddies/dev/mainloop.h index 0fb64d7c..9875ead0 100644 --- a/trash/6baddies/dev/mainloop.h +++ b/trash/6baddies/dev/mainloop.h @@ -11,7 +11,7 @@ void main (void) { #asm di #endasm - + #if defined MODE_128K || defined MIN_FAPS_PER_FRAME sp_InitIM2(0xf1f1); sp_CreateGenericISR(0xf1f1); @@ -21,13 +21,14 @@ void main (void) { ei #endasm #endif - + #ifdef MODE_128K #ifdef USE_ARKOS_PLAYER arkos_stop(); #else wyz_init (); #endif + #endif cortina (); @@ -84,7 +85,7 @@ void main (void) { #ifdef MASKED_BULLETS sp_bullets [gpit] = sp_CreateSpr (sp_MASK_SPRITE, 2, sprite_19_a); #else - sp_bullets [gpit] = sp_CreateSpr (NO_MASKS, 2, sprite_19_a); + sp_bullets [gpit] = sp_CreateSpr (sp_OR_SPRITE, 2, sprite_19_a); #endif sp_AddColSpr (sp_bullets [gpit], sprite_19_a+32); } @@ -95,7 +96,7 @@ void main (void) { #ifdef MASKED_BULLETS sp_cocos [gpit] = sp_CreateSpr (sp_MASK_SPRITE, 2, sprite_19_a); #else - sp_cocos [gpit] = sp_CreateSpr (NO_MASKS, 2, sprite_19_a); + sp_cocos [gpit] = sp_CreateSpr (sp_OR_SPRITE, 2, sprite_19_a); #endif sp_AddColSpr (sp_cocos [gpit], sprite_19_a+32); } @@ -160,7 +161,7 @@ void main (void) { } silent_level = 0; - prepare_level (level); + prepare_level (); #endif #ifndef DIRECT_TO_PLAY diff --git a/trash/6baddies/dev/mainloop/flick_screen.h b/trash/6baddies/dev/mainloop/flick_screen.h index c1c039b9..97b4515c 100644 --- a/trash/6baddies/dev/mainloop/flick_screen.h +++ b/trash/6baddies/dev/mainloop/flick_screen.h @@ -13,7 +13,7 @@ } #if defined (COMPRESSED_LEVELS) - if (gpx == 224 && p_vx > 0 && x_pant < (level_data->map_w - 1)) + if (gpx == 224 && p_vx > 0 && x_pant < (level_data.map_w - 1)) #else if (gpx == 224 && p_vx > 0 && x_pant < (MAP_W - 1)) #endif @@ -27,7 +27,7 @@ #if MAP_H > 1 if (gpy == 0 && p_vy < 0 && y_pant > 0) { #if defined (COMPRESSED_LEVELS) - n_pant -= level_data->map_w; + n_pant -= level_data.map_w; #else n_pant -= MAP_W; #endif @@ -37,8 +37,8 @@ } #if defined (COMPRESSED_LEVELS) - if (gpy == 144 && p_vy > 0 && y_pant < (level_data->map_h - 1)) { - n_pant += level_data->map_w; + if (gpy == 144 && p_vy > 0 && y_pant < (level_data.map_h - 1)) { + n_pant += level_data.map_w; #else if (gpy == 144 && p_vy > 0 && y_pant < (MAP_H - 1)) { n_pant += MAP_W; @@ -62,8 +62,8 @@ #if MAP_H > 1 #if defined (COMPRESSED_LEVELS) - if (gpy == 0 && p_vy < 0 && n_pant >= level_data->map_w) { - n_pant -= level_data->map_w; + if (gpy == 0 && p_vy < 0 && n_pant >= level_data.map_w) { + n_pant -= level_data.map_w; #else if (gpy == 0 && p_vy < 0 && n_pant >= MAP_W) { n_pant -= MAP_W; @@ -74,8 +74,8 @@ if (gpy == 144 && p_vy > 0) { // 9216 = 144 * 64 #if defined (COMPRESSED_LEVELS) - if (n_pant < level_data->map_w * (level_data->map_h - 1)) { - n_pant += level_data->map_w; + if (n_pant < level_data.map_w * (level_data.map_h - 1)) { + n_pant += level_data.map_w; #else if (n_pant < MAP_W * MAP_H - MAP_W) { n_pant += MAP_W; diff --git a/trash/6baddies/dev/mainloop/game_loop.h b/trash/6baddies/dev/mainloop/game_loop.h index 1752797a..3f59e563 100644 --- a/trash/6baddies/dev/mainloop/game_loop.h +++ b/trash/6baddies/dev/mainloop/game_loop.h @@ -76,8 +76,8 @@ #ifdef PLAYER_CHECK_MAP_BOUNDARIES #ifdef COMPRESSED_LEVELS - x_pant = n_pant % level_data->map_w; - y_pant = n_pant / level_data->map_w; + x_pant = n_pant % level_data.map_w; + y_pant = n_pant / level_data.map_w; #else x_pant = n_pant % MAP_W; y_pant = n_pant / MAP_W; #endif diff --git a/trash/6baddies/dev/my/fixed_screens.h b/trash/6baddies/dev/my/fixed_screens.h index 36e03655..e794b96d 100644 --- a/trash/6baddies/dev/my/fixed_screens.h +++ b/trash/6baddies/dev/my/fixed_screens.h @@ -36,7 +36,7 @@ void game_ending (void) { void game_over (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " GAME OVER! "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" GAME OVER! "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNow (); @@ -52,7 +52,7 @@ void game_over (void) { #if defined(TIMER_ENABLE) && defined(SHOW_TIMER_OVER) void time_over (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " TIME'S UP! "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" TIME'S UP! "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); @@ -69,7 +69,7 @@ void game_over (void) { #ifdef PAUSE_ABORT void pause_screen (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " PAUSED "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" PAUSED "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); } @@ -78,7 +78,7 @@ void game_over (void) { #ifdef COMPRESSED_LEVELS void zone_clear (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " ZONE CLEAR "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" ZONE CLEAR "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); espera_activa (250); diff --git a/trash/6baddies/dev/setenv.bat b/trash/6baddies/dev/setenv.bat index e034d8d5..a543b050 100644 --- a/trash/6baddies/dev/setenv.bat +++ b/trash/6baddies/dev/setenv.bat @@ -1,6 +1,5 @@ @echo off -set Z88DK_PATH=c:\z88dk10 -set PATH=%Z88DK_PATH%\bin;%PATH% +set Z88DK_PATH=c:\z88dk +set PATH=%Z88DK_PATH%\bin.x86;%PATH% set Z80_OZFILES=%Z88DK_PATH%\Lib\ set ZCCCFG=%Z88DK_PATH%\Lib\Config\ -zcc diff --git a/trash/6baddies/dev/zcc_opt.def b/trash/6baddies/dev/zcc_opt.def deleted file mode 100644 index 4548b859..00000000 --- a/trash/6baddies/dev/zcc_opt.def +++ /dev/null @@ -1,8 +0,0 @@ - -IF !DEFINED_STACKPTR - defc DEFINED_STACKPTR = 1 - defc STACKPTR = 61936 -ENDIF - - DEFINE DEFINED_myzorg - defc myzorg = 24000 diff --git a/trash/blip_blep/bin/ending.bin b/trash/blip_blep/bin/ending.bin new file mode 100644 index 00000000..e52dd56a Binary files /dev/null and b/trash/blip_blep/bin/ending.bin differ diff --git a/trash/blip_blep/bin/marco.bin b/trash/blip_blep/bin/marco.bin new file mode 100644 index 00000000..62123e85 Binary files /dev/null and b/trash/blip_blep/bin/marco.bin differ diff --git a/trash/blip_blep/bin/title.bin b/trash/blip_blep/bin/title.bin new file mode 100644 index 00000000..1c062e8b Binary files /dev/null and b/trash/blip_blep/bin/title.bin differ diff --git a/trash/blip_blep/dev/128k.h b/trash/blip_blep/dev/128k.h index 2f4b4b97..317fd7a2 100644 --- a/trash/blip_blep/dev/128k.h +++ b/trash/blip_blep/dev/128k.h @@ -6,99 +6,19 @@ void SetRAMBank(void) { #asm .SetRAMBank + ld a, b + or a + jp z, restISR + xor a + ld i, a + jp keepGoing + .restISR + ld a, $f0 + ld i, a + .keepGoing ld a, 16 or b ld bc, $7ffd out (C), a #endasm } -/* -// Esto lo empecé pero por ahora lo dejo aparcado :-/ -#ifdef MOVE_STUFF_TO_RAM_6 -typedef struct { - int x, y; - unsigned char x1, y1, x2, y2; - char mx, my; - char t; - unsigned char life; -} MALOTE; - -MALOTE malotes [3]; -MALOTE *malote_copy; - -void ram6_to_ram (void) { - // This function copies current screen data from RAM 6 to low RAM (new screen) - #asm - di - ld b, 6 - call SetRAMBank - #endasm - - // Map screen -#ifdef UNPACKED_MAP - map_pointer = 0xc000 + (n_pant * 150); -#else - map_pointer = 0xc000 + (n_pant * 75); -#endif - for (gpit = 0; gpit < 150; gpit ++) { -#ifdef UNPACKED_MAP - // Mapa tipo UNPACKED - gpd = *map_pointer ++; - map_buff [gpit] = gpd; -#else - // Mapa tipo PACKED - if (!(gpit & 1)) { - gpc = *map_pointer ++; - gpd = gpc >> 4; - } else { - gpd = gpc & 15; - } - map_buff [gpit] = gpd; -#endif - } - - // Enems - enoffs = n_pant * 3; -#ifdef UNPACKED_MAP - map_pointer = 0xc000 + MAP_W * MAP_H * 150 + 12 * enoffs; -#else - map_pointer = 0xc000 + MAP_W * MAP_H * 75 + 12 * enoffs; -#endif - malote_copy = malotes; - for (gpit = 0; gpit < 36; gpit ++) { - *malote_copy ++ = *map_pointer ++; - } - enoffs = 0; - - // Hotspots - // Bolts - - // Get back - #asm - di - ld b, 0 - call SetRAMBank - #endasm -} - -void ram_to_ram6 (void) { - // This function copies current screen data from low RAM to RAM 6 (update) - #asm - di - ld b, 6 - call SetRAMBank - #endasm - - // Enems - // Hotspots - // Bolts - - // Get back - #asm - di - ld b, 0 - call SetRAMBank - #endasm -} -#endif -*/ \ No newline at end of file diff --git a/trash/blip_blep/dev/aplib.h b/trash/blip_blep/dev/aplib.h index 88a31fda..11441f46 100644 --- a/trash/blip_blep/dev/aplib.h +++ b/trash/blip_blep/dev/aplib.h @@ -1,13 +1,6 @@ // MTE MK1 (la Churrera) v5.0 // Copyleft 2010-2014, 2020 by the Mojon Twins -unsigned int ram_address; -unsigned int ram_destination; - -#ifdef MODE_128K - unsigned char ram_page; -#endif - #asm ; aPPack decompressor diff --git a/trash/blip_blep/dev/assets/ay_fx_numbers.h b/trash/blip_blep/dev/assets/ay_fx_numbers.h index 411264ac..d1c0346e 100644 --- a/trash/blip_blep/dev/assets/ay_fx_numbers.h +++ b/trash/blip_blep/dev/assets/ay_fx_numbers.h @@ -1,20 +1,42 @@ // MTE MK1 (la Churrera) v5.0 // Copyleft 2010-2014, 2020 by the Mojon Twins -#define SFX_START 0 -#define SFX_BREAKABLE_HIT 1 -#define SFX_BREAKABLE_BREAK 2 -#define SFX_PUSH_BOX 3 -#define SFX_OPEN_LOCK 3 -#define SFX_SHOOT 4 -#define SFX_OBJECT_GET 5 -#define SFX_KILL_ENEMY_STEP 6 -#define SFX_KILL_ENEMY_SHOOT 6 -#define SFX_HIT_ENEMY 7 -#define SFX_ONE_OBJECT_GET 8 -#define SFX_ONE_OBJECT_WRONG 9 -#define SFX_KEY_GET 10 -#define SFX_REFILL_GET 11 -#define SFX_JUMP 12 -#define SFX_SPIKES 13 -#define SFX_ENEMY_HIT 14 +#ifdef USE_ARKOS_PLAYER + #define SFX_START 1 + #define SFX_BREAKABLE_HIT 1 + #define SFX_BREAKABLE_BREAK 2 + #define SFX_PUSH_BOX 3 + #define SFX_OPEN_LOCK 3 + #define SFX_SHOOT 4 + #define SFX_OBJECT_GET 5 + #define SFX_KILL_ENEMY_STEP 6 + #define SFX_KILL_ENEMY_SHOOT 6 + #define SFX_HIT_ENEMY 7 + #define SFX_ONE_OBJECT_GET 8 + #define SFX_ONE_OBJECT_WRONG 9 + #define SFX_KEY_GET 4 + #define SFX_REFILL_GET 11 + #define SFX_JUMP 2 + #define SFX_SPIKES 2 + #define SFX_ENEMY_HIT 8 + +#else + #define SFX_START 0 + #define SFX_BREAKABLE_HIT 1 + #define SFX_BREAKABLE_BREAK 2 + #define SFX_PUSH_BOX 3 + #define SFX_OPEN_LOCK 3 + #define SFX_SHOOT 4 + #define SFX_OBJECT_GET 5 + #define SFX_KILL_ENEMY_STEP 6 + #define SFX_KILL_ENEMY_SHOOT 6 + #define SFX_HIT_ENEMY 7 + #define SFX_ONE_OBJECT_GET 8 + #define SFX_ONE_OBJECT_WRONG 9 + #define SFX_KEY_GET 10 + #define SFX_REFILL_GET 11 + #define SFX_JUMP 12 + #define SFX_SPIKES 13 + #define SFX_ENEMY_HIT 14 + +#endif \ No newline at end of file diff --git a/trash/blip_blep/dev/assets/levels.h b/trash/blip_blep/dev/assets/levels.h index c601614a..bd29b455 100644 --- a/trash/blip_blep/dev/assets/levels.h +++ b/trash/blip_blep/dev/assets/levels.h @@ -14,7 +14,7 @@ // Map data, 75 or 150 * (MAP_W*MAP_H) bytes // Bolts, 32 * 4 = 128 bytes // Tileset, 2304 bytes -// Enemies, MAP_W * MAP_H * 3 * 10 bytes +// Enemies, MAP_W * MAP_H * MAX_ENEMS * 10 bytes // Hotspots, MAP_W * MAP_H * 3 bytes // Behs, 48 bytes // Spriteset, 2312 bytes @@ -64,7 +64,7 @@ extern unsigned char font [0]; ._font BINARY "font.bin" #endasm -extern LEVELHEADER level_data [0]; +extern LEVELHEADER level_data; #asm ._level_data defs 16 #endasm @@ -94,7 +94,7 @@ extern unsigned char tileset [0]; extern MALOTE malotes [0]; #asm - ._malotes defs MAP_W * MAP_H * 3 * 10 + ._malotes defs MAP_W * MAP_H * MAX_ENEMS * 10 #endasm extern HOTSPOT hotspots [0]; diff --git a/trash/blip_blep/dev/blip_blep.tap b/trash/blip_blep/dev/blip_blep.tap index e7f513a6..dfddf103 100644 Binary files a/trash/blip_blep/dev/blip_blep.tap and b/trash/blip_blep/dev/blip_blep.tap differ diff --git a/trash/blip_blep/dev/compile.bat b/trash/blip_blep/dev/compile.bat index 82ece3d4..621a995a 100644 --- a/trash/blip_blep/dev/compile.bat +++ b/trash/blip_blep/dev/compile.bat @@ -38,24 +38,65 @@ echo Importando GFX ..\..\..\src\utils\png2scr.exe ..\gfx\marco.png ..\gfx\marco.scr > nul ..\..\..\src\utils\png2scr.exe ..\gfx\ending.png ..\gfx\ending.scr > nul ..\..\..\src\utils\png2scr.exe ..\gfx\loading.png loading.bin > nul -..\..\..\src\utils\apultra.exe ..\gfx\title.scr title.bin > nul -..\..\..\src\utils\apultra.exe ..\gfx\marco.scr marco.bin > nul -..\..\..\src\utils\apultra.exe ..\gfx\ending.scr ending.bin > nul +..\..\..\src\utils\apultra.exe ..\gfx\title.scr ..\bin\title.bin > nul +..\..\..\src\utils\apultra.exe ..\gfx\marco.scr ..\bin\marco.bin > nul +..\..\..\src\utils\apultra.exe ..\gfx\ending.scr ..\bin\ending.bin > nul if [%1]==[justassets] goto :end +rem echo Running The Librarian +rem ..\utils\librarian2.exe list=..\bin\list.txt index=assets\librarian.h bins_prefix=..\bin\ rams_prefix=..\bin\ > nul + +rem *** Música AY: Descomenta el player que vayas a usar (Wyz o Arkos) *** + +rem echo Compilando musica 128k - Wyz Player +rem cd ..\mus +rem ..\utils\apultra.exe menu.mus menu.bin +rem ..\utils\apultra.exe level1.mus level1.bin +rem ..\utils\pasmo WYZproPlay47aZXc.ASM ..\bin\RAM1.bin +rem cd ..\dev + +rem echo Compilando musica 128k - Arkos Player +rem cd ..\mus_arkos +rem if [%1]==[nomus] goto :nomus +rem ..\utils\build_mus_bin.exe ram1.bin > nul +rem :nomus +rem copy ram1.bin ..\bin +rem copy arkos-addresses.h ..\dev\sound +rem cd ..\dev + :compile echo Compilando guego -zcc +zx -vn mk1.c -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul +zcc +zx -vn mk1.c -O3 -crt0=crt.asm -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul +rem zcc +zx -vn mk1.c -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul ..\..\..\src\utils\printsize.exe %game%.bin ..\..\..\src\utils\printsize.exe scripts.bin +rem *** Tipo de cargador *** + echo Construyendo cinta rem cambia LOADER por el nombre que quieres que salga en Program: ..\..\..\src\utils\bas2tap -a10 -sBLIP_BLEP loader\loader.bas loader.tap > nul ..\..\..\src\utils\bin2tap -o screen.tap -a 16384 loading.bin > nul ..\..\..\src\utils\bin2tap -o main.tap -a 24000 %game%.bin > nul copy /b loader.tap + screen.tap + main.tap %game%.tap > nul +rem echo Construyendo cinta 128k +rem ..\..\..\src\utils\imanol.exe ^ +rem in=loader\loaderzx.asm-orig ^ +rem out=loader\loader.asm ^ +rem ram1_length=?..\bin\RAM1.bin ^ +rem ram3_length=?..\bin\RAM3.bin ^ +rem mb_length=?%game%.bin > nul + +rem ..\utils\pasmo.exe loader\loader.asm ..\bin\loader.bin loader.txt + +rem cambia LOADER por el nombre que quieres que salga en Program: +rem ..\..\..\src\utils\GenTape.exe %game%.tap ^ +rem basic 'LOADER' 10 ..\bin\loader.bin ^ +rem data loading.bin ^ +rem data ..\bin\RAM1.bin ^ +rem data ..\bin\RAM3.bin ^ +rem data %game%.bin if [%1]==[justcompile] goto :end if [%1]==[noclean] goto :end diff --git a/trash/blip_blep/dev/crt.asm b/trash/blip_blep/dev/crt.asm new file mode 100644 index 00000000..27e0d47d --- /dev/null +++ b/trash/blip_blep/dev/crt.asm @@ -0,0 +1,17 @@ + MODULE zx82_crt0 + INCLUDE "zcc_opt.def" + XREF _main ; main() is always external to crt0 code + + IF !STACKPTR + defc STACKPTR = $FFFF + ENDIF + + IF !CRT_ORG_CODE + defc CRT_ORG_CODE = 32768 + ENDIF + + org CRT_ORG_CODE + +start: + ld sp,STACKPTR + jp _main diff --git a/trash/blip_blep/dev/definitions.h b/trash/blip_blep/dev/definitions.h index a15cd13b..38f3bd82 100644 --- a/trash/blip_blep/dev/definitions.h +++ b/trash/blip_blep/dev/definitions.h @@ -6,7 +6,8 @@ .fsClipStruct defb 0, 24, 0, 32 #endasm -void *joyfunc = sp_JoyKeyboard; // Puntero a la función de manejo seleccionada. +//void *joyfunc = sp_JoyKeyboard; // Puntero a la función de manejo seleccionada. +unsigned int (*joyfunc)(struct sp_UDK *) = sp_JoyKeyboard; const void *joyfuncs [] = { sp_JoyKeyboard, sp_JoyKempston, sp_JoySinclair1 @@ -31,8 +32,15 @@ void *u_free = sp_FreeBlock; // Safe stuff in low(est) RAM -unsigned char safe_byte @ 23296; +unsigned char safe_byte @ 23296; +unsigned int ram_address @ 23297; +unsigned int ram_destination @ 23299; + +#ifdef MODE_128K + unsigned char ram_page @ 23301; +#endif + // Globales muy globalizadas struct sp_SS *sp_player; @@ -49,7 +57,7 @@ unsigned char enoffs; // Aux char asm_number; -unsigned int asm_int; +unsigned int asm_int @ 23302; unsigned int asm_int_2; unsigned int seed; unsigned char half_life; @@ -111,7 +119,7 @@ unsigned char p_tx, p_ty; #endif signed int ptgmx, ptgmy; -const unsigned char *spacer = " "; +unsigned char *spacer = " "; unsigned char enit; @@ -173,7 +181,7 @@ unsigned char map_attr [150]; unsigned char map_buff [150] @ FREEPOOL; // Breakable walls/etc #ifdef BREAKABLE_WALLS - unsigned char brk_buff [150] @ 23297; + unsigned char brk_buff [150] @ 23296+16; #endif // posición del objeto (hotspot). Para no objeto, @@ -187,7 +195,7 @@ unsigned char hotspot_destroy; #ifndef MAX_FLAGS #define MAX_FLAGS 16 #endif -unsigned char flags[MAX_FLAGS]; +unsigned char flags[MAX_FLAGS]; // Globalized unsigned char o_pant; @@ -219,7 +227,7 @@ unsigned char maincounter; // Engine globals (for speed) & size! -unsigned char gpx, gpox, gpy, gpd, gpc, gpt; +unsigned char gpx, gpox, gpy, gpd, gpc; unsigned char gpxx, gpyy, gpcx, gpcy; unsigned char possee, hit_v, hit_h, hit, wall_h, wall_v; unsigned char gpen_x, gpen_y, gpen_cx, gpen_cy, gpaux; @@ -230,7 +238,7 @@ unsigned char *map_pointer; #ifdef PLAYER_CAN_FIRE unsigned char blx, bly; #endif -unsigned char rdx, rdy, rda, rdb, rdc, rdd, rdn; +unsigned char rdx, rdy, rda, rdb, rdc, rdd, rdn, rdt; // More stuff @@ -251,6 +259,7 @@ unsigned char objs_old, keys_old, life_old, killed_old; #ifdef COMPRESSED_LEVELS unsigned char *level_str = "LEVEL 0X"; + unsigned char silent_level = 0; #endif #ifdef GET_X_MORE @@ -271,12 +280,24 @@ unsigned char x0, y0, x1, y1; unsigned char ptx1, pty1, ptx2, pty2; unsigned char *_gp_gen; +#ifdef ENABLE_TILANIMS + unsigned char tait; + unsigned char max_tilanims; + unsigned char tacount; + unsigned char tilanims_xy [MAX_TILANIMS]; + unsigned char tilanims_ft [MAX_TILANIMS]; +#endif + +#if defined USE_AUTO_TILE_SHADOWS || defined USE_AUTO_SHADOWS || defined ENABLE_TILANIMS + unsigned char xx, yy; +#endif + #if defined USE_AUTO_TILE_SHADOWS || defined USE_AUTO_SHADOWS unsigned char c1, c2, c3, c4; unsigned char t1, t2, t3, t4; unsigned char nocast, _ta; - unsigned char xx, yy; #endif + #ifdef USE_AUTO_TILE_SHADOWS unsigned a1, a2, a3; unsigned char *gen_pt_alt; @@ -291,4 +312,7 @@ unsigned char *_gp_gen; #ifdef MODE_128K unsigned char song_playing = 0; + unsigned char player_on = 1; #endif + +unsigned char isrc; diff --git a/trash/blip_blep/dev/engine.h b/trash/blip_blep/dev/engine.h index e89eb1a9..bbbbfb9f 100644 --- a/trash/blip_blep/dev/engine.h +++ b/trash/blip_blep/dev/engine.h @@ -153,7 +153,7 @@ void espera_activa (int espera) { // Sonido #ifdef MODE_128K - wyz_play_sound (SFX_PUSH_BOX); + PLAY_SOUND (SFX_PUSH_BOX); #else beep_fx (2); #endif @@ -182,7 +182,7 @@ void espera_activa (int espera) { -- p_keys; #ifdef MODE_128K - wyz_play_sound (SFX_OPEN_LOCK); + PLAY_SOUND (SFX_OPEN_LOCK); #else beep_fx (8); #endif @@ -290,6 +290,7 @@ void draw_scr_background (void) { add hl, bc ld (hl), a + #ifdef PACKED_MAP_ALT_TILE ld a, (__t) or a jr nz, _draw_scr_packed_noalt @@ -305,10 +306,12 @@ void draw_scr_background (void) { jr _draw_scr_packed_noalt ._draw_scr_packed_alt_subst - ld a, 19 + ld a, PACKED_MAP_ALT_TILE ld (__t), a ._draw_scr_packed_noalt + #endif + ld hl, _map_buff add hl, bc @@ -326,15 +329,15 @@ void draw_scr_background (void) { #endasm #endif - draw_coloured_tile (); - - #if defined ENABLE_TILANIMS && defined UNPACKED_MAP - // Detect tilanims + #ifdef ENABLE_TILANIMS if (_t >= ENABLE_TILANIMS) { - add_tilanim ((_x - VIEWPORT_X) >> 1, (_y - VIEWPORT_Y) >> 1, _t); + _n = (((_x - VIEWPORT_X) << 3) & 0xf0) | ((_y - VIEWPORT_Y) >> 1); + tilanims_add (); } #endif - + + draw_coloured_tile (); + //_x += 2; if (_x == VIEWPORT_X + 30) { _x = VIEWPORT_X; _y += 2; } #asm ld a, (__x) @@ -355,34 +358,7 @@ void draw_scr_background (void) { #endif } -void draw_scr (void) { - is_rendering = 1; - - #ifdef ENABLE_TILANIMS - max_tilanims = 0; - #endif - - #ifdef ENABLE_FIRE_ZONE - f_zone_ac = 0; - #endif - - draw_scr_background (); - - // Object setup - - enems_load (); - - #ifdef ACTIVATE_SCRIPTING - #if defined LINE_OF_TEXT && !defined LINE_OF_TEXT_NO_AUTOERASE - _x = LINE_OF_TEXT_X; _y = LINE_OF_TEXT; _t = LINE_OF_TEXT_ATTR; _gp_gen = " "; print_str (); - #endif - // Ejecutamos los scripts de entrar en pantalla: - run_script (2 * MAP_W * MAP_H + 1); // ENTERING ANY - run_script (n_pant << 1); // ENTERING SCREEN n - #endif - - #include "my/ci/entering_screen.h" - +void draw_scr_hotspots_locks (void) { /* hotspot_y = 240; rdx = (hotspots [n_pant].xy >> 4); @@ -534,6 +510,14 @@ void draw_scr (void) { cp c jr nz, _open_locks_done + // Remove x=y=np=0 pseudobug in multilevel games + #ifdef COMPRESSED_LEVELS + ld a, b + or d + or e + jr z, _open_locks_done + #endif + ._open_locks_do ld a, d ld (__x), a @@ -573,6 +557,37 @@ void draw_scr (void) { jr nz, _open_locks_loop #endasm #endif +} + +void draw_scr (void) { + is_rendering = 1; + + #ifdef ENABLE_TILANIMS + tilanims_reset (); + #endif + + #ifdef ENABLE_FIRE_ZONE + f_zone_ac = 0; + #endif + + draw_scr_background (); + + // Object setup + + enems_load (); + + #ifdef ACTIVATE_SCRIPTING + #if defined LINE_OF_TEXT && !defined LINE_OF_TEXT_NO_AUTOERASE + _x = LINE_OF_TEXT_X; _y = LINE_OF_TEXT; _t = LINE_OF_TEXT_ATTR; _gp_gen = " "; print_str (); + #endif + // Ejecutamos los scripts de entrar en pantalla: + run_script (2 * MAP_W * MAP_H + 1); // ENTERING ANY + run_script (n_pant << 1); // ENTERING SCREEN n + #endif + + #include "my/ci/entering_screen.h" + + draw_scr_hotspots_locks (); #ifdef PLAYER_CAN_FIRE bullets_init (); @@ -609,7 +624,8 @@ void select_joyfunc (void) { } #ifdef MODE_128K - wyz_play_sound (SFX_START); + STOP_SOUND (); + PLAY_SOUND (SFX_START); sp_WaitForNoKey (); #endif } diff --git a/trash/blip_blep/dev/engine/breakable.h b/trash/blip_blep/dev/engine/breakable.h index 81e191c1..01e9423f 100644 --- a/trash/blip_blep/dev/engine/breakable.h +++ b/trash/blip_blep/dev/engine/breakable.h @@ -16,14 +16,14 @@ void break_wall (void) { } else { _n = _t = 0; update_tile (); #ifdef MODE_128K - gpix = SFX_BREAKABLE_BREAK + gpit = SFX_BREAKABLE_BREAK; #else gpit = 0; #endif #include "my/ci/on_wall_broken.h" } #ifdef MODE_128K - wyz_play_sound (gpit); + PLAY_SOUND (gpit); #else // Show what just happened before the sound interrupts the action sp_UpdateNow (); diff --git a/trash/blip_blep/dev/engine/bullets.h b/trash/blip_blep/dev/engine/bullets.h index 4dda4259..2278b516 100644 --- a/trash/blip_blep/dev/engine/bullets.h +++ b/trash/blip_blep/dev/engine/bullets.h @@ -54,10 +54,11 @@ void bullets_fire (void) { #ifdef PLAYER_CAN_FIRE_FLAG if (flags [PLAYER_CAN_FIRE_FLAG] == 0) return; #endif + #ifdef MAX_AMMO if (!p_ammo) return; - -- p_ammo; #endif + // Buscamos una bala libre for (b_it = 0; b_it < MAX_BULLETS; ++ b_it) { if (bullets_estado [b_it] == 0) { @@ -165,7 +166,7 @@ void bullets_fire (void) { #endif #ifdef MODE_128K - wyz_play_sound (SFX_SHOOT); + PLAY_SOUND (SFX_SHOOT); #else beep_fx (6); #endif @@ -180,8 +181,12 @@ void bullets_fire (void) { #include "my/ci/on_player_fires.h" - bullets_update (); + bullets_update (); + #ifdef MAX_AMMO + -- p_ammo; + #endif + break; } } diff --git a/trash/blip_blep/dev/engine/c_levels.h b/trash/blip_blep/dev/engine/c_levels.h index 0a76ee0c..cbbaf91a 100644 --- a/trash/blip_blep/dev/engine/c_levels.h +++ b/trash/blip_blep/dev/engine/c_levels.h @@ -10,12 +10,12 @@ void prepare_level (void) { #endif { n_pant = level_data.scr_ini; - gpx = level_data->ini_x << 4; p_x = gpx << 6; - gpy = level_data->ini_y << 4; p_y = gpy << 6; + gpx = level_data.ini_x << 4; p_x = gpx << 6; + gpy = level_data.ini_y << 4; p_y = gpy << 6; } #ifdef ACTIVATE_SCRIPTING - main_script_offset = levels [level]->script_offset; + main_script_offset = levels [level].script_offset; #endif #else unpack ((unsigned int) levels [level].c_map_bolts, (unsigned int) (mapa)); @@ -24,11 +24,11 @@ void prepare_level (void) { unpack ((unsigned int) levels [level].c_behs, (unsigned int) (behs)); #ifdef PER_LEVEL_SPRITESET - unpack ((unsigned int) levels [level].c_sprites, (unsigned int) (sprites)); + unpack ((unsigned int) levels [level].c_sprites, (unsigned int) (sprites + 16)); #endif - level_data->map_w = levels.map_w; - level_data->map_h = levels.map_h; + level_data.map_w = levels [level].map_w; + level_data.map_h = levels [level].map_h; #ifdef ACTIVATE_SCRIPTING if (script_result != 3) diff --git a/trash/blip_blep/dev/engine/enem_mods/enem_type_pursuers.h b/trash/blip_blep/dev/engine/enem_mods/enem_type_pursuers.h index 7cd62b19..601aa01f 100644 --- a/trash/blip_blep/dev/engine/enem_mods/enem_type_pursuers.h +++ b/trash/blip_blep/dev/engine/enem_mods/enem_type_pursuers.h @@ -9,8 +9,8 @@ _en_x = _en_x1; _en_y = _en_y1; en_an_alive [enit] = 1; - en_an_rawv [enit] = 1 << (rand () % 5); - if (en_an_rawv [enit] > 4) en_an_rawv [enit] = 2; + en_an_rawv [enit] = 1 << (rand () & 3); + if (en_an_rawv [enit] > PURSUERS_MAX_V) en_an_rawv [enit] = 2; en_an_dead_row [enit] = 11 + (rand () & 7); #if defined(PLAYER_STEPS_ON_ENEMIES) || defined(PLAYER_CAN_FIRE) _en_life = ENEMIES_LIFE_GAUGE; diff --git a/trash/blip_blep/dev/engine/enem_mods/enem_type_pursuers_asm.h b/trash/blip_blep/dev/engine/enem_mods/enem_type_pursuers_asm.h index 6980b4b1..6ce2cc20 100644 --- a/trash/blip_blep/dev/engine/enem_mods/enem_type_pursuers_asm.h +++ b/trash/blip_blep/dev/engine/enem_mods/enem_type_pursuers_asm.h @@ -34,19 +34,21 @@ ld a, 1 ld (hl), a - // en_an_rawv [enit] = 1 << (rand () % 5); + // en_an_rawv [enit] = 1 << (rand () & 3); push bc call _rand // rand -> L - ld de, 5 - ex de, hl - call l_div // l_div :: DE / HL -> HL = cociente; DE = resto - ex de, hl // HL = resto + + ld a, l + and 3 + ld l, a + ld h, 0 + ld de, 1 call l_asl // l_asl :: DE << HL -> HL ld a, l pop bc - cp 5 + cp PURSUERS_MAX_V+1 jr c, _eij_rawv_set ld a, 2 diff --git a/trash/blip_blep/dev/engine/enengine.h b/trash/blip_blep/dev/engine/enengine.h index 17dddc2c..4acb013d 100644 --- a/trash/blip_blep/dev/engine/enengine.h +++ b/trash/blip_blep/dev/engine/enengine.h @@ -14,8 +14,8 @@ #if defined(PLAYER_STEPS_ON_ENEMIES) || defined (PLAYER_CAN_FIRE) void enems_init (void) { enit = 0; - while (enit < MAP_W * MAP_H * 3) { - malotes [enit].t = malotes [enit].t & 15; + while (enit < MAP_W * MAP_H * MAX_ENEMS) { + malotes [enit].t = malotes [enit].t & 0xEF; // Clear bit 4 #ifdef PLAYER_CAN_FIRE malotes [enit].life = ENEMIES_LIFE_GAUGE; #endif @@ -121,7 +121,7 @@ void enems_draw_current (void) { void enems_load (void) { // Movemos y cambiamos a los enemigos según el tipo que tengan - enoffs = n_pant * 3; + enoffs = n_pant * MAX_ENEMS; for (enit = 0; enit < MAX_ENEMS; ++ enit) { en_an_frame [enit] = 0; @@ -141,6 +141,10 @@ void enems_load (void) { #endif #endif + #include "my/ci/enems_custom_respawn.h" + + en_an_next_frame [enit] = sprite_18_a; + switch (malotes [enoffsmasi].t & 0x1f) { case 1: case 2: @@ -184,13 +188,8 @@ void enems_load (void) { #endif #include "my/ci/enems_load.h" - - default: - en_an_next_frame [enit] = sprite_18_a; } - malotes [enoffsmasi].t &= 0x1f; - #include "my/ci/enems_extra_mods.h" } } @@ -227,7 +226,7 @@ void enems_move (void) { ld hl, (_enoffsmasi) ld h, 0 - #ifdef PLAYER_CAN_FIRE + #if defined PLAYER_CAN_FIRE || defined COMPRESSED_LEVELS add hl, hl // x2 ld d, h ld e, l // DE = x2 @@ -284,6 +283,8 @@ void enems_move (void) { ld a, (hl) ld (__en_t), a + and 0x1f + ld (_rdt), a #ifdef PLAYER_CAN_FIRE inc hl @@ -316,7 +317,7 @@ void enems_move (void) { #endif #endif - switch (_en_t) { + switch (rdt) { case 1: case 2: case 3: @@ -326,7 +327,7 @@ void enems_move (void) { #endif #include "engine/enem_mods/enem_type_lineal.h" #ifdef ENABLE_ORTHOSHOOTERS - if (_en_t == 5) { + if (rdt == 5) { #include "engine/enem_mods/enem_type_orthoshooters.h" } #endif @@ -443,13 +444,13 @@ void enems_move (void) { // Step over enemy #ifdef PLAYER_CAN_STEP_ON_FLAG if (flags [PLAYER_CAN_STEP_ON_FLAG] != 0 && - gpy < _en_y - 2 && p_vy >= 0 && _en_t >= PLAYER_MIN_KILLABLE) + gpy < _en_y - 2 && p_vy >= 0 && rdt >= PLAYER_MIN_KILLABLE) #else - if (gpy < _en_y - 2 && p_vy >= 0 && _en_t >= PLAYER_MIN_KILLABLE) + if (gpy < _en_y - 2 && p_vy >= 0 && rdt >= PLAYER_MIN_KILLABLE) #endif { #ifdef MODE_128K - wyz_play_sound (SFX_KILL_ENEMY_STEP); + PLAY_SOUND (SFX_KILL_ENEMY_STEP); en_an_state [enit] = GENERAL_DYING; en_an_count [enit] = 12; en_an_next_frame [enit] = sprite_17_a; @@ -519,7 +520,7 @@ void enems_move (void) { #ifdef PLAYER_CAN_FIRE // Collide with bullets #ifdef FIRE_MIN_KILLABLE - if (_en_t >= FIRE_MIN_KILLABLE) + if (rdt >= FIRE_MIN_KILLABLE) #endif { for (gpjt = 0; gpjt < MAX_BULLETS; gpjt ++) { @@ -548,7 +549,7 @@ void enems_move (void) { #ifdef MODE_128K en_an_state [enit] = GENERAL_DYING; en_an_count [enit] = 12; - wyz_play_sound (SFX_KILL_ENEMY_SHOOT); + PLAY_SOUND (SFX_KILL_ENEMY_SHOOT); #else beep_fx (5); en_an_next_frame [enit] = sprite_18_a; @@ -562,7 +563,7 @@ void enems_move (void) { } #ifdef MODE_128K - wyz_play_sound (SFX_HIT_ENEMY); + PLAY_SOUND (SFX_HIT_ENEMY); #else beep_fx (1); #endif diff --git a/trash/blip_blep/dev/engine/hotspots.h b/trash/blip_blep/dev/engine/hotspots.h index 10f9978c..3a1b3223 100644 --- a/trash/blip_blep/dev/engine/hotspots.h +++ b/trash/blip_blep/dev/engine/hotspots.h @@ -25,13 +25,13 @@ void hotspots_do (void) { if (p_objs == 0) { p_objs ++; #ifdef MODE_128K - wyz_play_sound (SFX_ONE_OBJECT_GET); + PLAY_SOUND (SFX_ONE_OBJECT_GET); #else beep_fx (9); #endif } else { #ifdef MODE_128K - wyz_play_sound (SFX_ONE_OBJECT_WRONG); + PLAY_SOUND (SFX_ONE_OBJECT_WRONG); #else beep_fx (4); #endif @@ -45,7 +45,7 @@ void hotspots_do (void) { #endif #ifdef MODE_128K - wyz_play_sound (SFX_OBJECT_GET); + PLAY_SOUND (SFX_OBJECT_GET); #else beep_fx (9); #endif @@ -70,7 +70,7 @@ void hotspots_do (void) { case 2: p_keys ++; #ifdef MODE_128K - wyz_play_sound (SFX_KEY_GET); + PLAY_SOUND (SFX_KEY_GET); #else beep_fx (7); #endif @@ -83,7 +83,7 @@ void hotspots_do (void) { if (p_life > PLAYER_LIFE) p_life = PLAYER_LIFE; #ifdef MODE_128K - wyz_play_sound (SFX_REFILL_GET); + PLAY_SOUND (SFX_REFILL_GET); #else beep_fx (8); #endif @@ -97,7 +97,7 @@ void hotspots_do (void) { else p_ammo = MAX_AMMO; #ifdef MODE_128K - wyz_play_sound (SFX_REFILL_GET); + PLAY_SOUND (SFX_REFILL_GET); #else beep_fx (9); #endif @@ -111,7 +111,7 @@ void hotspots_do (void) { else timer_t = 99; #ifdef MODE_128K - wyz_play_sound (SFX_REFILL_GET); + PLAY_SOUND (SFX_REFILL_GET); #else beep_fx (7); #endif @@ -122,7 +122,7 @@ void hotspots_do (void) { case 6: mem_save (); #ifdef MODE_128K - wyz_play_sound (SFX_START); + PLAY_SOUND (SFX_START); #else beep_fx (7); #endif diff --git a/trash/blip_blep/dev/engine/isr.h b/trash/blip_blep/dev/engine/isr.h new file mode 100644 index 00000000..76b5bf4a --- /dev/null +++ b/trash/blip_blep/dev/engine/isr.h @@ -0,0 +1,15 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// Very simple ISR which counts frames. + +#asm + defw 0 // 2 bytes libres +#endasm + +void ISR (void) { + #asm + ld hl, _isrc + inc (hl) + #endasm +} diff --git a/trash/blip_blep/dev/engine/player.h b/trash/blip_blep/dev/engine/player.h index 7256df57..59844d68 100644 --- a/trash/blip_blep/dev/engine/player.h +++ b/trash/blip_blep/dev/engine/player.h @@ -28,17 +28,20 @@ void player_init (void) { #if !defined(COMPRESSED_LEVELS) || defined(REFILL_ME) p_life = PLAYER_LIFE; #endif - p_objs = 0; - p_keys = 0; - p_killed = 0; p_disparando = 0; - #ifdef MAX_AMMO - #ifdef INITIAL_AMMO - p_ammo = INITIAL_AMMO; - #else - p_ammo = MAX_AMMO; + + #ifndef NO_RESET_STATS + p_objs = 0; + p_keys = 0; + p_killed = 0; + #ifdef MAX_AMMO + #ifdef INITIAL_AMMO + p_ammo = INITIAL_AMMO; + #else + p_ammo = MAX_AMMO; + #endif #endif - #endif + #endif #ifdef TIMER_ENABLE timer_count = 0; @@ -283,6 +286,7 @@ unsigned char player_move (void) { // Collision, may set possee, hit_v + // Velocity positive (going downwards) player_calc_bounding_box (); hit_v = 0; @@ -400,7 +404,7 @@ unsigned char player_move (void) { p_saltando = 1; p_cont_salto = 0; #ifdef MODE_128K - wyz_play_sound (SFX_JUMP); + PLAY_SOUND (SFX_JUMP); #else beep_fx (3); #endif @@ -426,7 +430,7 @@ unsigned char player_move (void) { p_saltando = 1; p_cont_salto = 0; #ifdef MODE_128K - wyz_play_sound (SFX_JUMP); + PLAY_SOUND (SFX_JUMP); #else beep_fx (3); #endif @@ -446,43 +450,47 @@ unsigned char player_move (void) { // MOVEMENT IN THE HORIZONTAL AXIS // *************************************************************************** - if ( ! ((pad0 & sp_LEFT) == 0 || (pad0 & sp_RIGHT) == 0)) { - #ifdef PLAYER_GENITAL - p_facing_h = 0xff; - #endif - if (p_vx > 0) { - p_vx -= PLAYER_RX; - if (p_vx < 0) p_vx = 0; - } else if (p_vx < 0) { - p_vx += PLAYER_RX; - if (p_vx > 0) p_vx = 0; + #ifndef PLAYER_DISABLE_DEFAULT_HENG + if ( ! ((pad0 & sp_LEFT) == 0 || (pad0 & sp_RIGHT) == 0)) { + #ifdef PLAYER_GENITAL + p_facing_h = 0xff; + #endif + if (p_vx > 0) { + p_vx -= PLAYER_RX; + if (p_vx < 0) p_vx = 0; + } else if (p_vx < 0) { + p_vx += PLAYER_RX; + if (p_vx > 0) p_vx = 0; + } + wall_h = 0; } - wall_h = 0; - } - if ((pad0 & sp_LEFT) == 0) { - #ifdef PLAYER_GENITAL - p_facing_h = FACING_LEFT; - #endif - if (p_vx > -PLAYER_MAX_VX) { - #ifndef PLAYER_GENITAL - p_facing = 0; + if ((pad0 & sp_LEFT) == 0) { + #ifdef PLAYER_GENITAL + p_facing_h = FACING_LEFT; #endif - p_vx -= PLAYER_AX; + if (p_vx > -PLAYER_MAX_VX) { + #ifndef PLAYER_GENITAL + p_facing = 0; + #endif + p_vx -= PLAYER_AX; + } } - } - if ((pad0 & sp_RIGHT) == 0) { - #ifdef PLAYER_GENITAL - p_facing_h = FACING_RIGHT; - #endif - if (p_vx < PLAYER_MAX_VX) { - p_vx += PLAYER_AX; - #ifndef PLAYER_GENITAL - p_facing = 1; + if ((pad0 & sp_RIGHT) == 0) { + #ifdef PLAYER_GENITAL + p_facing_h = FACING_RIGHT; #endif + if (p_vx < PLAYER_MAX_VX) { + p_vx += PLAYER_AX; + #ifndef PLAYER_GENITAL + p_facing = 1; + #endif + } } - } + #endif + + #include "my/ci/custom_heng.h" p_x = p_x + p_vx; #ifndef PLAYER_GENITAL @@ -606,7 +614,7 @@ unsigned char player_move (void) { #elif defined (BOUNDING_BOX_8_CENTERED) cy1 = (gpy + 3) >> 4; #else - cy1 = gpy >> 3; + cy1 = (gpy - 1) >> 3; #endif if (attr (cx1, cy1) == 10) { @@ -636,7 +644,7 @@ unsigned char player_move (void) { #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) cx1 = (gpx + 3) >> 4; #else - cx1 = gpx >> 4; + cx1 = (gpx - 1) >> 4; #endif if (attr (cx1, cy1) == 10) { @@ -717,19 +725,19 @@ unsigned char player_move (void) { } } - p_next_frame = player_cells [p_facing + p_frame]; + p_next_frame = (unsigned char *) (player_cells [p_facing + p_frame]); #elif defined PLAYER_BOOTEE gpit = p_facing << 2; if (p_vy == 0) { - p_next_frame = player_cells [gpit]; + p_next_frame = (unsigned char *) (player_cells [gpit]); } else if (p_vy < 0) { - p_next_frame = player_cells [gpit + 1]; + p_next_frame = (unsigned char *) (player_cells [gpit + 1]); } else { - p_next_frame = player_cells [gpit + 2]; + p_next_frame = (unsigned char *) (player_cells [gpit + 2]); } #else if (!possee && !p_gotten) { - p_next_frame = player_cells [8 + p_facing]; + p_next_frame = (unsigned char *) (player_cells [8 + p_facing]); } else { gpit = p_facing << 2; if (p_vx == 0) { @@ -737,7 +745,7 @@ unsigned char player_move (void) { } else { rda = ((gpx + 4) >> 3) & 3; } - p_next_frame = player_cells [gpit + rda]; + p_next_frame = (unsigned char *) (player_cells [gpit + rda]); } #endif } @@ -752,7 +760,7 @@ void player_kill (unsigned char sound) { player_deplete (); #ifdef MODE_128K - wyz_play_sound (sound); + PLAY_SOUND (sound); #else beep_fx (sound); #endif diff --git a/trash/blip_blep/dev/engine/player_wip.h b/trash/blip_blep/dev/engine/player_wip.h new file mode 100644 index 00000000..815761a3 --- /dev/null +++ b/trash/blip_blep/dev/engine/player_wip.h @@ -0,0 +1,884 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// player.h + +void player_init (void) { + // Inicializa player con los valores iniciales + // (de ahí lo de inicializar). + + #ifndef COMPRESSED_LEVELS + gpx = PLAYER_INI_X << 4; p_x = gpx << 6; + gpy = PLAYER_INI_Y << 4; p_y = gpy << 6; + #endif + p_vy = 0; + p_vx = 0; + p_cont_salto = 1; + p_saltando = 0; + p_frame = 0; + p_subframe = 0; + #ifdef PLAYER_GENITAL + p_facing = FACING_DOWN; + p_facing_v = p_facing_h = 0xff; + #else + p_facing = 1; + #endif + p_estado = EST_NORMAL; + p_ct_estado = 0; + #if !defined(COMPRESSED_LEVELS) || defined(REFILL_ME) + p_life = PLAYER_LIFE; + #endif + p_objs = 0; + p_keys = 0; + p_killed = 0; + p_disparando = 0; + #ifdef MAX_AMMO + #ifdef INITIAL_AMMO + p_ammo = INITIAL_AMMO; + #else + p_ammo = MAX_AMMO; + #endif + #endif + + #ifdef TIMER_ENABLE + timer_count = 0; + timer_zero = 0; + #ifdef TIMER_LAPSE + timer_frames = TIMER_LAPSE; + #endif + #ifdef TIMER_INITIAL + timer_t = TIMER_INITIAL; + #endif + #ifdef TIMER_START + timer_on = 1; + #else + timer_on = 0; + #endif + #endif +} + +void player_calc_bounding_box (void) { + #if defined (BOUNDING_BOX_8_BOTTOM) + #asm + ld a, (_gpx) + add 4 + srl a + srl a + srl a + srl a + ld (_ptx1), a + ld a, (_gpx) + add 11 + srl a + srl a + srl a + srl a + ld (_ptx2), a + ld a, (_gpy) + add 8 + srl a + srl a + srl a + srl a + ld (_pty1), a + ld a, (_gpy) + add 15 + srl a + srl a + srl a + srl a + ld (_pty2), a + #endasm + #elif defined (BOUNDING_BOX_8_CENTERED) + #asm + ld a, (_gpx) + add 4 + srl a + srl a + srl a + srl a + ld (_ptx1), a + ld a, (_gpx) + add 11 + srl a + srl a + srl a + srl a + ld (_ptx2), a + ld a, (_gpy) + add 4 + srl a + srl a + srl a + srl a + ld (_pty1), a + ld a, (_gpy) + add 11 + srl a + srl a + srl a + srl a + ld (_pty2), a + #endasm + #else + #asm + ld a, (_gpx) + srl a + srl a + srl a + srl a + ld (_ptx1), a + ld a, (_gpx) + add 15 + srl a + srl a + srl a + srl a + ld (_ptx2), a + ld a, (_gpy) + srl a + srl a + srl a + srl a + ld (_pty1), a + ld a, (_gpy) + add 15 + srl a + srl a + srl a + srl a + ld (_pty2), a + #endasm + #endif +} + +unsigned char player_move (void) { + + // *************************************************************************** + // MOVEMENT IN THE VERTICAL AXIS + // *************************************************************************** + + #if !defined PLAYER_GENITAL || defined VENG_SELECTOR + + #if !defined PLAYER_DISABLE_GRAVITY + #if defined VENG_SELECTOR && defined PLAYER_VKEYS + if (veng_selector != VENG_KEYS) + #endif + { + // Do gravity + + #asm + ; Signed comparisons are hard + ; p_vy <= PLAYER_MAX_VY_CAYENDO - PLAYER_G + + ; We are going to take a shortcut. + ; If p_vy < 0, just add PLAYER_G. + ; If p_vy > 0, we can use unsigned comparition anyway. + + ld hl, (_p_vy) + bit 7, h + jr nz, _player_gravity_add ; < 0 + + ld de, PLAYER_MAX_VY_CAYENDO - PLAYER_G + or a + push hl + sbc hl, de + pop hl + jr nc, _player_gravity_maximum + + ._player_gravity_add + ld de, PLAYER_G + add hl, de + jr _player_gravity_vy_set + + ._player_gravity_maximum + ld hl, PLAYER_MAX_VY_CAYENDO + + ._player_gravity_vy_set + ld (_p_vy), hl + + ._player_gravity_done + + #ifdef PLAYER_CUMULATIVE_JUMP + ld a, (_p_jmp_on) + or a + jr nz, _player_gravity_p_gotten_done + #endif + + ld a, (_p_gotten) + or a + jr z, _player_gravity_p_gotten_done + + xor a + ld (_p_vy), a + + ._player_gravity_p_gotten_done + #endasm + } + #endif + #endif + + #if defined PLAYER_GENITAL || (defined VENG_SELECTOR && defined PLAYER_VKEYS) + + #if defined (VENG_SELECTOR) + if (veng_selector == VENG_KEYS ) + #endif + { + // Pad do + + if ( ! ((pad0 & sp_UP) == 0 || (pad0 & sp_DOWN) == 0)) { + p_facing_v = 0xff; + wall_v = 0; + if (p_vy > 0) { + p_vy -= PLAYER_RX; + if (p_vy < 0) p_vy = 0; + } else if (p_vy < 0) { + p_vy += PLAYER_RX; + if (p_vy > 0) p_vy = 0; + } + } + + if ((pad0 & sp_UP) == 0) { + p_facing_v = FACING_UP; + if (p_vy > -PLAYER_MAX_VX) p_vy -= PLAYER_AX; + } + + if ((pad0 & sp_DOWN) == 0) { + p_facing_v = FACING_DOWN; + if (p_vy < PLAYER_MAX_VX) p_vy += PLAYER_AX; + } + } + #endif + + #ifdef PLAYER_HAS_JETPAC + #ifdef VENG_SELECTOR + if (veng_selector == VENG_JETPAC) + #endif + { + if ((pad0 & sp_UP) == 0) { + p_vy -= PLAYER_INCR_JETPAC; + if (p_vy < -PLAYER_MAX_VY_JETPAC) p_vy = -PLAYER_MAX_VY_JETPAC; + + #include "my/ci/on_jetpac_boost.h" + + p_jetpac_on = 1; + } else p_jetpac_on = 0; + } + #endif + + #include "my/ci/custom_veng.h" + + p_y += p_vy; + + #if !defined (PLAYER_GENITAL) + if (p_gotten) p_y += ptgmy; + #endif + + // Safe + + if (p_y < 0) p_y = 0; + if (p_y > 9216) p_y = 9216; + + gpy = p_y >> 6; + + // Collision, may set possee, hit_v + + #asm + call _player_calc_bounding_box + + xor a + ld (_hit_v), a + + ld a, (_ptx1) + ld (_cx1), a + ld a, (_ptx2) + ld (_cx2), a + + // Calculate vertical velocity + + ld a, (_p_vy) + #if !defined (PLAYER_GENITAL) + ld c, a + ld a, (_ptgmy) + add c + #endif + + // Skip if not moving in the vertical axis + + or a + jp z, _va_collision_done + + // Check sign + + bit 7, a + jr z, _va_collision_vy_positive + + ._va_collision_vy_negative + + // Velocity negative (going upwards) + + ld a, (_pty1) + ld (_cy1), a + ld (_cy2), a + + call _cm_two_points + + // if ((at1 & 8) || (at2 & 8)) { + ld a, (_at1) + and 8 + jr nz, _va_col_vy_neg_do + + ld a, (_at2) + and 8 + jr z, _va_collision_checkevil + + ._va_col_vy_neg_do + + #ifdef PLAYER_BOUNCE_WITH_WALLS + ld a, (_p_vy) + sra a + neg a + #else + xor a + #endif + ld (_p_vy), a + + ld a, (_pty1) + inc a + sla a + sla a + sla a + sla a + + #if defined (BOUNDING_BOX_8_BOTTOM) + // gpy = ((pty1 + 1) << 4) - 8; + sub 8 + #elif defined (BOUNDING_BOX_8_CENTERED) + // gpy = ((pty1 + 1) << 4) - 4; + sub 4 + #elif defined (BOUNDING_BOX_TINY_BOTTOM) + // gpy = ((pty1 + 1) << 4) - 14; + sub 14 + #else + // gpy = ((pty1 + 1) << 4); + #endif + + ld (_gpy), a + + // p_y = gpy << FIXBITS; 16 bits shift + ld d, 0 + ld e, a + ld l, FIXBITS + call l_asl + ld (_p_y), hl + + #if defined PLAYER_GENITAL || defined LOCKS_CHECK_VERTICAL + ld a, WTOP + ld (_wall_v), a + #endif + + jr _va_collision_checkevil + + ._va_collision_vy_positive + + // Velocity positive (going downwards) + ld a, (_pty2) + ld (_cy1), a + ld (_cy2), a + + call _cm_two_points + + #ifdef PLAYER_GENITAL + // if ((at1 & 8) || (at2 & 8)) { + ld a, (_at1) + and 8 + jr nz, _va_col_vy_pos_do + + ld a, (_at2) + and 8 + jr z, _va_collision_checkevil + #else + // if ((at1 & 8) || + ld a, (_at1) + and 8 + jr nz, _va_col_vy_pos_do + + // (at2 & 8) || + ld a, (_at2) + and 8 + jr nz, _va_col_vy_pos_do + + // (((gpy - 1) & 15) < 8 && + ld a, (_gpy) + dec a + and 15 + cp 8 + jr nc, _va_collision_checkevil + + // ((at1 & 4) || (at2 & 4)))) + ld a, (_at1) + and 4 + jr nz, _va_col_vy_pos_do + + ld a, (_at2) + and 4 + jr z, _va_collision_checkevil + #endif + ._va_col_vy_pos_do + + #ifdef PLAYER_BOUNCE_WITH_WALLS + ld a, (_p_vy) + sra a + neg a + #else + xor a + #endif + ld (_p_vy), a + + ld a, (_pty2) + dec a + sla a + sla a + sla a + sla a + + #ifdef BOUNDING_BOX_8_CENTERED + add 4 + #endif + + ld (_gpy), a + + // p_y = gpy << FIXBITS; 16 bits shift + ld d, 0 + ld e, a + ld l, FIXBITS + call l_asl + ld (_p_y), hl + + #if defined PLAYER_GENITAL || defined LOCKS_CHECK_VERTICAL + ld a, WBOTTOM + ld (_wall_v), a + #endif + + jr _va_collision_done + + ._va_collision_checkevil + + #ifndef DEACTIVATE_EVIL_TILE + #endasm + hit_v = ((at1 & 1) || (at2 & 1)); + #asm + #endif + + ._va_collision_done + #endasm + + gpxx = gpx >> 4; + gpyy = gpy >> 4; + + #ifndef PLAYER_GENITAL + cy1 = cy2 = (gpy + 16) >> 4; + cx1 = ptx1; cx2 = ptx2; + cm_two_points (); + possee = ((at1 & 12) || (at2 & 12)) && (gpy & 15) < 8; + #endif + + // Jump + + #ifdef PLAYER_HAS_JUMP + #ifdef VENG_SELECTOR + if (veng_selector == VENG_JUMP) + #endif + { + #if defined (PLAYER_CAN_FIRE) && !defined (USE_TWO_BUTTONS) + rda = (pad0 & sp_UP) == 0; + #elif defined (PLAYER_CAN_FIRE) && defined (USE_TWO_BUTTONS) + rda = isJoy ? ((pad0 & sp_UP) == 0) : (sp_KeyPressed (key_jump)); + #else + rda = (pad0 & sp_FIRE) == 0; + #endif + + if (rda) { + if (p_saltando == 0) { + if (possee || p_gotten || hit_v) { + p_saltando = 1; + p_cont_salto = 0; + #ifdef MODE_128K + PLAY_SOUND (SFX_JUMP); + #else + beep_fx (3); + #endif + } + } else { + p_vy -= (PLAYER_VY_INICIAL_SALTO + PLAYER_INCR_SALTO - (p_cont_salto >> 1)); + if (p_vy < -PLAYER_MAX_VY_SALTANDO) p_vy = -PLAYER_MAX_VY_SALTANDO; + ++ p_cont_salto; + if (p_cont_salto == 9) p_saltando = 0; + } + } else p_saltando = 0; + } + #endif + + // Bootee engine + + #ifdef PLAYER_BOOTEE + #ifdef VENG_SELECTOR + if (veng_selector == VENG_BOOTEE) + #endif + { + if ( p_saltando == 0 && (possee || p_gotten || hit_v) ) { + p_saltando = 1; + p_cont_salto = 0; + #ifdef MODE_128K + PLAY_SOUND (SFX_JUMP); + #else + beep_fx (3); + #endif + } + + if (p_saltando ) { + p_vy -= (PLAYER_VY_INICIAL_SALTO + PLAYER_INCR_SALTO - (p_cont_salto>>1)); + if (p_vy < -PLAYER_MAX_VY_SALTANDO) p_vy = -PLAYER_MAX_VY_SALTANDO; + ++ p_cont_salto; + if (p_cont_salto == 8) + p_saltando = 0; + } + } + #endif + + // *************************************************************************** + // MOVEMENT IN THE HORIZONTAL AXIS + // *************************************************************************** + + #ifndef PLAYER_DISABLE_DEFAULT_HENG + if ( ! ((pad0 & sp_LEFT) == 0 || (pad0 & sp_RIGHT) == 0)) { + #ifdef PLAYER_GENITAL + p_facing_h = 0xff; + #endif + if (p_vx > 0) { + p_vx -= PLAYER_RX; + if (p_vx < 0) p_vx = 0; + } else if (p_vx < 0) { + p_vx += PLAYER_RX; + if (p_vx > 0) p_vx = 0; + } + wall_h = 0; + } + + if ((pad0 & sp_LEFT) == 0) { + #ifdef PLAYER_GENITAL + p_facing_h = FACING_LEFT; + #endif + if (p_vx > -PLAYER_MAX_VX) { + #ifndef PLAYER_GENITAL + p_facing = 0; + #endif + p_vx -= PLAYER_AX; + } + } + + if ((pad0 & sp_RIGHT) == 0) { + #ifdef PLAYER_GENITAL + p_facing_h = FACING_RIGHT; + #endif + if (p_vx < PLAYER_MAX_VX) { + p_vx += PLAYER_AX; + #ifndef PLAYER_GENITAL + p_facing = 1; + #endif + } + } + #endif + + #include "my/ci/custom_heng.h" + + p_x = p_x + p_vx; + #ifndef PLAYER_GENITAL + p_x += ptgmx; + #endif + + // Safe + + if (p_x < 0) p_x = 0; + if (p_x > 14336) p_x = 14336; + + gpox = gpx; + gpx = p_x >> 6; + + // Collision. May set hit_h + player_calc_bounding_box (); + + hit_h = 0; + cy1 = pty1; cy2 = pty2; + + #if defined (PLAYER_GENITAL) + if (p_vx < 0) + #else + if (p_vx + ptgmx < 0) + #endif + { + cx1 = cx2 = ptx1; + cm_two_points (); + + if ((at1 & 8) || (at2 & 8)) { + #include "my/ci/bg_collision/obstacle_left.h" + + #ifdef PLAYER_BOUNCE_WITH_WALLS + p_vx = -(p_vx / 2); + #else + p_vx = 0; + #endif + + #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) || defined (BOUNDING_BOX_TINY_BOTTOM) + gpx = ((ptx1 + 1) << 4) - 4; + #else + gpx = ((ptx1 + 1) << 4); + #endif + + p_x = gpx << 6; + wall_h = WLEFT; + } + #ifndef DEACTIVATE_EVIL_TILE + else hit_h = ((at1 & 1) || (at2 & 1)); + #endif + + } + + #if defined (PLAYER_GENITAL) + if (p_vx > 0) + #else + if (p_vx + ptgmx > 0) + #endif + { + cx1 = cx2 = ptx2; + cm_two_points (); + + if ((at1 & 8) || (at2 & 8)) { + #include "my/ci/bg_collision/obstacle_right.h" + + #ifdef PLAYER_BOUNCE_WITH_WALLS + p_vx = -(p_vx / 2); + #else + p_vx = 0; + #endif + + #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) || defined (BOUNDING_BOX_TINY_BOTTOM) + gpx = (ptx1 << 4) + 4; + #else + gpx = (ptx1 << 4); + #endif + + p_x = gpx << 6; + wall_h = WRIGHT; + } + #ifndef DEACTIVATE_EVIL_TILE + else hit_h = ((at1 & 1) || (at2 & 1)); + #endif + + } + + // Priority to decide facing + + #ifdef PLAYER_GENITAL + #ifdef TOP_OVER_SIDE + if (p_facing_v != 0xff) { + p_facing = p_facing_v; + } else if (p_facing_h != 0xff) { + p_facing = p_facing_h; + } + #else + if (p_facing_h != 0xff) { + p_facing = p_facing_h; + } else if (p_facing_v != 0xff) { + p_facing = p_facing_v; + } + #endif + #endif + + cx1 = p_tx = (gpx + 8) >> 4; + cy1 = p_ty = (gpy + 8) >> 4; + + rdb = attr (cx1, cy1); + + // Special tiles + if (rdb & 128) { + #include "my/ci/on_special_tile.h" + } + + #if defined (PLAYER_PUSH_BOXES) || !defined (DEACTIVATE_KEYS) + #if defined PLAYER_GENITAL || defined LOCKS_CHECK_VERTICAL + if (wall_v == WTOP) { + // interact up + #if defined (BOUNDING_BOX_8_BOTTOM) + cy1 = (gpy + 7) >> 4; + #elif defined (BOUNDING_BOX_8_CENTERED) + cy1 = (gpy + 3) >> 4; + #else + cy1 = (gpy - 1) >> 3; + #endif + + if (attr (cx1, cy1) == 10) { + x0 = x1 = cx1; y0 = cy1; y1 = cy1 - 1; + process_tile (); + } + + } else if (wall_v == WBOTTOM) { + // interact down + #if defined (BOUNDING_BOX_8_BOTTOM) + cy1 = (gpy + 16) >> 4; + #elif defined (BOUNDING_BOX_8_CENTERED) + cy1 = (gpy + 12) >> 4; + #else + cy1 = (gpy + 16) >> 3; + #endif + + if (attr (cx1, cy1) == 10) { + x0 = x1 = cx1; y0 = cy1; y1 = cy1 + 1; + process_tile (); + } + } else + #endif + + if (wall_h == WLEFT) { + // interact left + #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) + cx1 = (gpx + 3) >> 4; + #else + cx1 = (gpx - 1) >> 4; + #endif + + if (attr (cx1, cy1) == 10) { + y0 = y1 = cy1; x0 = cx1; x1 = cx1 - 1; + process_tile (); + } + } else if (wall_h == WRIGHT) { + // interact right + #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) + cx1 = (gpx + 12) >> 4; + #else + cx1 = (gpx + 16) >> 4; + #endif + if (attr (cx1, cy1) == 10) { + y0 = y1 = cy1; x0 = cx1; x1 = cx1 + 1; + process_tile (); + } + } + #endif + + #ifdef PLAYER_CAN_FIRE + // Disparos + if ((pad0 & sp_FIRE) == 0 && p_disparando == 0) { + p_disparando = 1; + #ifdef FIRE_TO_PUSH + //if (pushed_any == 0) + #endif + bullets_fire (); + #ifdef FIRE_TO_PUSH + //else pushed_any = 0; + #endif + } + + if ((pad0 & sp_FIRE)) + p_disparando = 0; + + #endif + + #ifndef DEACTIVATE_EVIL_TILE + // Tiles que te matan. + // hit_v tiene preferencia sobre hit_h + hit = 0; + if (hit_v) { + hit = 1; + p_vy = addsign (-p_vy, PLAYER_MAX_VX); + } else if (hit_h) { + hit = 1; + p_vx = addsign (-p_vx, PLAYER_MAX_VX); + } + + if (hit) { + #ifdef PLAYER_FLICKERS + if (p_estado == EST_NORMAL) + #endif + { + #ifdef MODE_128K + p_killme = SFX_SPIKES; + #else + p_killme = 4; + #endif + } + } + #endif + + // Select animation frame + + #ifdef PLAYER_CUSTOM_ANIMATION + #include "my/custom_animation.h" + #elif defined PLAYER_GENITAL + if (p_vx || p_vy) { + ++ p_subframe; + if (p_subframe == 4) { + p_subframe = 0; + p_frame = !p_frame; + #ifdef PLAYER_STEP_SOUND + step (); + #endif + } + } + + p_next_frame = player_cells [p_facing + p_frame]; + #elif defined PLAYER_BOOTEE + gpit = p_facing << 2; + if (p_vy == 0) { + p_next_frame = player_cells [gpit]; + } else if (p_vy < 0) { + p_next_frame = player_cells [gpit + 1]; + } else { + p_next_frame = player_cells [gpit + 2]; + } + #else + if (!possee && !p_gotten) { + p_next_frame = player_cells [8 + p_facing]; + } else { + gpit = p_facing << 2; + if (p_vx == 0) { + rda = 1; + } else { + rda = ((gpx + 4) >> 3) & 3; + } + p_next_frame = player_cells [gpit + rda]; + } + #endif +} + +void player_deplete (void) { + p_life = (p_life > p_kill_amt) ? p_life - p_kill_amt : 0; +} + +void player_kill (unsigned char sound) { + p_killme = 0; + + player_deplete (); + + #ifdef MODE_128K + PLAY_SOUND (sound); + #else + beep_fx (sound); + #endif + + #ifdef CP_RESET_WHEN_DYING + #ifdef CP_RESET_ALSO_FLAGS + mem_load (); + #else + n_pant = sg_pool [MAX_FLAGS]; + p_x = sg_pool [MAX_FLAGS + 1] << 10; + p_y = sg_pool [MAX_FLAGS + 2] << 10; + #endif + o_pant = 0xff; // Reload + #endif + + #ifdef PLAYER_FLICKERS + p_estado = EST_PARP; + p_ct_estado = 50; + #endif +} + diff --git a/trash/blip_blep/dev/engine/simple_cocos.h b/trash/blip_blep/dev/engine/simple_cocos.h index 1c33a2a5..5a4da667 100644 --- a/trash/blip_blep/dev/engine/simple_cocos.h +++ b/trash/blip_blep/dev/engine/simple_cocos.h @@ -100,7 +100,71 @@ void simple_coco_update (void) { // Check collision (player) - // Check collision (BG) + #ifdef PLAYER_FLICKERS + ld a, (_p_estado) + or a + jr nz, _simple_coco_update_continue + #endif + + // rdx + 3 >= gpx && rdx + 3 <= gpx + 15 && + // rdx + 3 >= gpx && rdx <= gpx + 12 + + // rdx + 3 >= gpx + ld a, (_gpx) + ld c, a + ld a, (_rdx) + add 3 + cp c + jr c, _simple_coco_update_collpl_done + + // gpx + 12 >= rdx + ld a, (_rdx) + ld c, a + ld a, (_gpx) + add 12 + cp c + jr c, _simple_coco_update_collpl_done + + // rdy + 3 >= gpy && rdy + 3 <= gpy + 15 + // rdy + 3 >= gpy && rdy <= gpy + 12 + + // rdy + 3 >= gpy + ld a, (_gpy) + ld c, a + ld a, (_rdy) + add 3 + cp c + jr c, _simple_coco_update_collpl_done + + // gpy + 12 >= rdy + ld a, (_rdy) + ld c, a + ld a, (_gpy) + add 12 + cp c + jr c, _simple_coco_update_collpl_done + + // Kill player + ld a, 0xff + ld (_rdy), a // This effectively marks the coco for destruction + + #ifdef MODE_128K + ld a, SFX_ENEMY_HIT + #else + ld a, 4 + #endif + ld (_p_killme), a + + jr _simple_coco_update_continue + + ._simple_coco_update_collpl_done + + #endasm + + // Check collision (BG) + if (attr ((rdx + 3) >> 4, (rdy + 3) >> 4) & 12) rdy = 0xff; + + #asm ._simple_coco_update_continue // And update arrays diff --git a/trash/blip_blep/dev/mainloop.h b/trash/blip_blep/dev/mainloop.h index 96c8fd4b..9875ead0 100644 --- a/trash/blip_blep/dev/mainloop.h +++ b/trash/blip_blep/dev/mainloop.h @@ -12,7 +12,7 @@ void main (void) { di #endasm - #ifdef MODE_128K + #if defined MODE_128K || defined MIN_FAPS_PER_FRAME sp_InitIM2(0xf1f1); sp_CreateGenericISR(0xf1f1); sp_RegisterHook(255, ISR); @@ -20,8 +20,15 @@ void main (void) { #asm ei #endasm + #endif + + #ifdef MODE_128K + #ifdef USE_ARKOS_PLAYER + arkos_stop(); + #else + wyz_init (); + #endif - wyz_init (); #endif cortina (); @@ -48,13 +55,13 @@ void main (void) { // Sprite creation #ifdef NO_MASKS - sp_player = sp_CreateSpr (sp_OR_SPRITE, 3, sprite_2_a); + sp_player = sp_CreateSpr (NO_MASKS, 3, sprite_2_a); sp_AddColSpr (sp_player, sprite_2_b); sp_AddColSpr (sp_player, sprite_2_c); p_current_frame = p_next_frame = sprite_2_a; - for (gpit = 0; gpit < 3; gpit ++) { - sp_moviles [gpit] = sp_CreateSpr(sp_OR_SPRITE, 3, sprite_9_a); + for (gpit = 0; gpit < MAX_ENEMS; gpit ++) { + sp_moviles [gpit] = sp_CreateSpr(NO_MASKS, 3, sprite_9_a); sp_AddColSpr (sp_moviles [gpit], sprite_9_b); sp_AddColSpr (sp_moviles [gpit], sprite_9_c); en_an_current_frame [gpit] = sprite_9_a; @@ -98,7 +105,7 @@ void main (void) { #include "my/ci/after_load.h" while (1) { - #ifdef ACTIVATE_SCRIPTING + #if defined ACTIVATE_SCRIPTING && !defined MODE_128K main_script_offset = (int) (main_script); #endif @@ -114,7 +121,22 @@ void main (void) { #include "my/ci/before_game.h" + #ifdef NO_RESET_STATS + p_objs = 0; + p_keys = 0; + p_killed = 0; + #ifdef MAX_AMMO + #ifdef INITIAL_AMMO + p_ammo = INITIAL_AMMO; + #else + p_ammo = MAX_AMMO; + #endif + #endif + #endif + #ifdef COMPRESSED_LEVELS + silent_level = 0; + #ifdef ENABLE_CHECKPOINTS if (sg_do_load) level = sg_level; else level = 0; #endif @@ -134,9 +156,12 @@ void main (void) { { #ifdef COMPRESSED_LEVELS - #include "my/level_screen.h" + if (silent_level == 0) { + #include "my/level_screen.h" + } + silent_level = 0; - prepare_level (level); + prepare_level (); #endif #ifndef DIRECT_TO_PLAY @@ -161,17 +186,19 @@ void main (void) { #ifdef COMPRESSED_LEVELS if (success) { #ifdef MODE_128K - //wyz_play_music (6); + //PLAY_MUSIC (6); #endif - zone_clear (); + if (silent_level == 0) zone_clear (); #ifdef ACTIVATE_SCRIPTING if (script_result != 3) #else if (warp_to_level == 0) #endif - ++ level; + { + level ++; + } if (level >= MAX_LEVELS #ifdef ACTIVATE_SCRIPTING @@ -183,7 +210,7 @@ void main (void) { } } else { #ifdef MODE_128K - //wyz_play_music (8); + //PLAY_MUSIC (8); #endif #if defined(TIMER_ENABLE) && defined(TIMER_GAMEOVER_0) && defined(SHOW_TIMER_OVER) @@ -193,7 +220,7 @@ void main (void) { #endif #ifdef MODE_128K - wyz_stop_sound (); + STOP_SOUND (); #endif break; } @@ -201,11 +228,13 @@ void main (void) { if (success) { game_ending (); } else { - //wyz_play_music (8); + //PLAY_MUSIC (8); game_over (); } #endif - cortina (); + #if !defined (DIRECT_TO_PLAY) || !defined (COMPRESSED_LEVELS) + cortina (); + #endif } clear_sprites (); diff --git a/trash/blip_blep/dev/mainloop/flick_screen.h b/trash/blip_blep/dev/mainloop/flick_screen.h index c1c039b9..97b4515c 100644 --- a/trash/blip_blep/dev/mainloop/flick_screen.h +++ b/trash/blip_blep/dev/mainloop/flick_screen.h @@ -13,7 +13,7 @@ } #if defined (COMPRESSED_LEVELS) - if (gpx == 224 && p_vx > 0 && x_pant < (level_data->map_w - 1)) + if (gpx == 224 && p_vx > 0 && x_pant < (level_data.map_w - 1)) #else if (gpx == 224 && p_vx > 0 && x_pant < (MAP_W - 1)) #endif @@ -27,7 +27,7 @@ #if MAP_H > 1 if (gpy == 0 && p_vy < 0 && y_pant > 0) { #if defined (COMPRESSED_LEVELS) - n_pant -= level_data->map_w; + n_pant -= level_data.map_w; #else n_pant -= MAP_W; #endif @@ -37,8 +37,8 @@ } #if defined (COMPRESSED_LEVELS) - if (gpy == 144 && p_vy > 0 && y_pant < (level_data->map_h - 1)) { - n_pant += level_data->map_w; + if (gpy == 144 && p_vy > 0 && y_pant < (level_data.map_h - 1)) { + n_pant += level_data.map_w; #else if (gpy == 144 && p_vy > 0 && y_pant < (MAP_H - 1)) { n_pant += MAP_W; @@ -62,8 +62,8 @@ #if MAP_H > 1 #if defined (COMPRESSED_LEVELS) - if (gpy == 0 && p_vy < 0 && n_pant >= level_data->map_w) { - n_pant -= level_data->map_w; + if (gpy == 0 && p_vy < 0 && n_pant >= level_data.map_w) { + n_pant -= level_data.map_w; #else if (gpy == 0 && p_vy < 0 && n_pant >= MAP_W) { n_pant -= MAP_W; @@ -74,8 +74,8 @@ if (gpy == 144 && p_vy > 0) { // 9216 = 144 * 64 #if defined (COMPRESSED_LEVELS) - if (n_pant < level_data->map_w * (level_data->map_h - 1)) { - n_pant += level_data->map_w; + if (n_pant < level_data.map_w * (level_data.map_h - 1)) { + n_pant += level_data.map_w; #else if (n_pant < MAP_W * MAP_H - MAP_W) { n_pant += MAP_W; diff --git a/trash/blip_blep/dev/mainloop/game_loop.h b/trash/blip_blep/dev/mainloop/game_loop.h index e5442d9e..3f59e563 100644 --- a/trash/blip_blep/dev/mainloop/game_loop.h +++ b/trash/blip_blep/dev/mainloop/game_loop.h @@ -3,9 +3,18 @@ // game_loop.h - Da game loop. + #asm + ; Makes debugging easier + ._game_loop_init + #endasm + playing = 1; player_init (); + #ifdef OBJECT_COUNT + flags [OBJECT_COUNT] = p_objs; + #endif + #ifndef COMPRESSED_LEVELS hotspots_init (); #endif @@ -35,9 +44,9 @@ #ifdef MODE_128K // Play music #ifdef COMPRESSED_LEVELS - wyz_play_music (levels [level].music_id); + PLAY_MUSIC (levels [level].music_id); #else - wyz_play_music (1); + PLAY_MUSIC (1); #endif #endif @@ -67,8 +76,8 @@ #ifdef PLAYER_CHECK_MAP_BOUNDARIES #ifdef COMPRESSED_LEVELS - x_pant = n_pant % level_data->map_w; - y_pant = n_pant / level_data->map_w; + x_pant = n_pant % level_data.map_w; + y_pant = n_pant / level_data.map_w; #else x_pant = n_pant % MAP_W; y_pant = n_pant / MAP_W; #endif @@ -86,6 +95,11 @@ o_pant = 0xff; while (playing) { + #asm + ; Makes debugging easier + ._game_loop_do + #endasm + #ifdef DEBUG_KEYS if (sp_KeyPressed (KEY_M)) { ++ p_objs; beep_fx (0); } if (sp_KeyPressed (KEY_H)) { ++ n_pant; beep_fx (0); } @@ -176,7 +190,12 @@ simple_coco_update (); #endif - if (p_killme) player_kill (p_killme); + if (p_killme) { + if (p_life) { + player_kill (p_killme); + #include "my/ci/on_player_killed.h" + } else playing = 0; + } #ifdef PLAYER_CAN_FIRE // Move bullets @@ -184,7 +203,7 @@ #endif #ifdef ENABLE_TILANIMS - do_tilanims (); + tilanims_do (); #endif // Detect fire zone @@ -200,6 +219,23 @@ if (o_pant == n_pant) { #include "mainloop/update_sprites.h" + // Limit frame rate + + #ifdef MIN_FAPS_PER_FRAME + #asm + .ml_min_faps_loop + ld a, (_isrc) + cp MIN_FAPS_PER_FRAME + jr nc, ml_min_faps_loop_end + halt + jr ml_min_faps_loop + + .ml_min_faps_loop_end + xor a + ld (_isrc), a + #endasm + #endif + sp_UpdateNow(); } @@ -223,7 +259,7 @@ if (sp_KeyPressed (KEY_Z)) { if (!key_z_pressed) { #ifdef MODE_128K - wyz_play_sound (0); + PLAY_SOUND (0); #else beep_fx (2); #endif @@ -258,8 +294,7 @@ if (sp_KeyPressed (KEY_H)) { sp_WaitForNoKey (); #ifdef MODE_128K - wyz_stop_sound (); - wyz_play_sound (1); + player_on = 0; #endif clear_sprites (); pause_screen (); @@ -267,11 +302,7 @@ sp_WaitForNoKey (); draw_scr (); #ifdef MODE_128K - #ifdef COMPRESSED_LEVELS - //wyz_play_music (levels [level].music_id); - #else - //wyz_play_music (1); - #endif + player_on = 1; #endif } if (sp_KeyPressed (KEY_Y)) { @@ -281,7 +312,12 @@ // Flick the screen ? - #include "mainloop/flick_screen.h" + #if defined ACTIVATE_SCRIPTING && defined COMPRESSED_LEVELS + if (script_result != 3) + #endif + { + #include "mainloop/flick_screen.h" + } // Win game condition @@ -305,7 +341,8 @@ } // Game over condition - if (p_life == 0 + #if defined ACTIVATE_SCRIPTING || (defined(TIMER_ENABLE) && defined(TIMER_GAMEOVER_0)) + if (0 #ifdef ACTIVATE_SCRIPTING || (script_result == 2) #endif @@ -315,14 +352,16 @@ ) { playing = 0; } + #endif #include "my/ci/extra_routines.h" } + sp_UpdateNow (); sp_WaitForNoKey (); #ifdef MODE_128K - wyz_stop_sound (); + STOP_SOUND (); #endif #include "my/ci/after_game_loop.h" diff --git a/trash/blip_blep/dev/mk1.c b/trash/blip_blep/dev/mk1.c index 04a9fe4f..ba5f994d 100644 --- a/trash/blip_blep/dev/mk1.c +++ b/trash/blip_blep/dev/mk1.c @@ -21,6 +21,10 @@ #define FIXBITS 6 #define MAX_ENEMS 3 +// Fiddle if you need +#define MAX_TILANIMS 16 +#define TILANIMS_PRIME 7 + /* splib2 memory map 61440 - 61696 IM2 vector table 61697 - 61936 FREEPOOL (240 bytes) @@ -55,7 +59,7 @@ #endif #endif -#define NUMBLOCKS (40 + (MAX_PROJECTILES * 5)) +#define NUMBLOCKS (((1 + MAX_ENEMS) * 10) + (MAX_PROJECTILES * 5)) unsigned char AD_FREE [NUMBLOCKS * 15]; @@ -73,8 +77,6 @@ unsigned char AD_FREE [NUMBLOCKS * 15]; #include "assets/librarian.h" #endif -#include "my/ci/extra_vars.h" - #include "aplib.h" #include "pantallas.h" @@ -90,10 +92,19 @@ unsigned char AD_FREE [NUMBLOCKS * 15]; #include "assets/extrasprites.h" #endif +#include "my/ci/extra_vars.h" + #ifdef MODE_128K - #include "wyzplayer.h" + #ifdef USE_ARKOS_PLAYER + #include "sound/arkosplayer.h" + #else + #include "sound/wyzplayer.h" + #endif #else - #include "beeper.h" + #include "sound/beeper.h" + #ifdef MIN_FAPS_PER_FRAME + #include "engine/isr.h" + #endif #endif #include "printer.h" @@ -132,5 +143,5 @@ unsigned char AD_FREE [NUMBLOCKS * 15]; #ifndef MODE_128K // From beepola. Phaser engine by Shiru. - #include "music.h" + #include "sound/music.h" #endif diff --git a/trash/blip_blep/dev/my/ci/custom_heng.h b/trash/blip_blep/dev/my/ci/custom_heng.h new file mode 100644 index 00000000..f2a1f4b8 --- /dev/null +++ b/trash/blip_blep/dev/my/ci/custom_heng.h @@ -0,0 +1,4 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// Modify p_vx diff --git a/trash/blip_blep/dev/my/ci/enems_custom_respawn.h b/trash/blip_blep/dev/my/ci/enems_custom_respawn.h new file mode 100644 index 00000000..a06ef557 --- /dev/null +++ b/trash/blip_blep/dev/my/ci/enems_custom_respawn.h @@ -0,0 +1,5 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// deactivate RESPAWN_ON_ENTER and write your own routine here! + diff --git a/trash/blip_blep/dev/my/ci/on_player_killed.h b/trash/blip_blep/dev/my/ci/on_player_killed.h new file mode 100644 index 00000000..d6e076ee --- /dev/null +++ b/trash/blip_blep/dev/my/ci/on_player_killed.h @@ -0,0 +1,3 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + diff --git a/trash/blip_blep/dev/my/config.h b/trash/blip_blep/dev/my/config.h index 49f4ea89..585bbeb5 100644 --- a/trash/blip_blep/dev/my/config.h +++ b/trash/blip_blep/dev/my/config.h @@ -8,6 +8,9 @@ // ============================================================================ //#define MODE_128K // Read the docs! +//#define MIN_FAPS_PER_FRAME 2 // Limits the max # of fps to 50/N +//#define USE_ARKOS_PLAYER // Use Arkos instead of Wyz player for 128k Music +//#define ARKOS_SFX_CHANNEL 0 // SFX Channel (0-2) //#define VENG_SELECTOR // Very advanced! #define USE_MAP_CUSTOM_DECODER @@ -25,8 +28,10 @@ #define PLAYER_LIFE 5 // Max and starting life gauge. #define PLAYER_REFILL 1 // Life recharge //#define COMPRESSED_LEVELS // use levels.h instead of mapa.h and enems.h (!) +//#define PER_LEVEL_SPRITESET // use a different spriteset for each level in 48K //#define MAX_LEVELS 2 // # of compressed levels //#define REFILL_ME // If defined, refill player on each level +//#define NO_RESET_STATS // If defined, player stats are not reset per level // ============================================================================ // II. Engine type @@ -72,6 +77,7 @@ //#define ENABLE_PURSUERS // If defined, type 7 enemies are active //#define DEATH_COUNT_AND 7 //#define DEATH_COUNT_ADD 11 // Frames to wait = ADD + (rand & AND) +//#define PURSUERS_MAX_V 2 // 1, 2, 4. //#define PURSUERS_BASE_CELL 3 // If defined, type 7 enemies are always # //#define ENABLE_FANTIES // If defined, Fanties are enabled! @@ -137,6 +143,7 @@ //#define SCRIPTING_KEY_NONE // No action key. //#define ENABLE_EXTERN_CODE // Enables custom code to be run from the script using EXTERN n //#define ENABLE_FIRE_ZONE // Allows to define a zone which auto-triggers "FIRE" +//#define SCRIPT_PAGE 3 // In MODE_128K & COMPRESSED_LEVELS // Timer // ----- @@ -182,6 +189,8 @@ //#define PLAYER_MIN_KILLABLE 3 // Only kill enemies with id >= PLAYER_MIN_KILLABLE //#define PLAYER_STEP_SOUND // Sound while walking. No effect in the BOOTEE engine. +//#define PLAYER_DISABLE_DEFAULT_HENG // To disble default horizontal engine (keyrs) + // Configure keyboard // To define different keys, the first two hex digits are the COLUMN, the next the ROW @@ -260,7 +269,8 @@ //#define USE_AUTO_SHADOWS // Automatic shadows made of darker attributes //#define USE_AUTO_TILE_SHADOWS // Automatic shadows using specially defined tiles 32-47. -#define UNPACKED_MAP // Full, uncompressed maps. Shadows settings are ignored. +//#define UNPACKED_MAP // Full, uncompressed maps. Shadows settings are ignored. +#define PACKED_MAP_ALT_TILE 19 // If defined, in 16 tiles mode, alt tile (default 19) //#define NO_MASKS // Sprites are rendered using OR instead of masks. //#define MASKED_BULLETS // If needed #define PLAYER_CUSTOM_ANIMATION // Code your own animation in my/custom_animation.h diff --git a/trash/blip_blep/dev/my/custom_animation.h b/trash/blip_blep/dev/my/custom_animation.h index 238d5510..9f39c45b 100644 --- a/trash/blip_blep/dev/my/custom_animation.h +++ b/trash/blip_blep/dev/my/custom_animation.h @@ -21,4 +21,4 @@ if (fire_pressed) { } } -p_next_frame = player_cells [rda]; +p_next_frame = (unsigned char *) (player_cells [rda]); diff --git a/trash/blip_blep/dev/my/fixed_screens.h b/trash/blip_blep/dev/my/fixed_screens.h index 93e2fbe2..b5a89d98 100644 --- a/trash/blip_blep/dev/my/fixed_screens.h +++ b/trash/blip_blep/dev/my/fixed_screens.h @@ -35,9 +35,9 @@ void game_ending (void) { } void game_over (void) { - _x = 10; _y = 11; _t = 79; _gp_gen = "#''''''''''$"; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = "(GAME OVER!("; print_str (); - _x = 10; _y = 13; _t = 79; _gp_gen = "%''''''''''&"; print_str (); + _x = 10; _y = 11; _t = 79; _gp_gen = (unsigned char *)("#''''''''''$"); print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)("(GAME OVER!("); print_str (); + _x = 10; _y = 13; _t = 79; _gp_gen = (unsigned char *)("%''''''''''&"); print_str (); sp_UpdateNow (); #ifdef MODE_128K @@ -52,7 +52,7 @@ void game_over (void) { #if defined(TIMER_ENABLE) && defined(SHOW_TIMER_OVER) void time_over (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " TIME'S UP! "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" TIME'S UP! "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); @@ -69,7 +69,7 @@ void game_over (void) { #ifdef PAUSE_ABORT void pause_screen (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " PAUSED "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" PAUSED "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); } @@ -78,7 +78,7 @@ void game_over (void) { #ifdef COMPRESSED_LEVELS void zone_clear (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " ZONE CLEAR "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" ZONE CLEAR "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); espera_activa (250); diff --git a/trash/blip_blep/dev/my/level_screen.h b/trash/blip_blep/dev/my/level_screen.h index 0de8100f..5e779b2a 100644 --- a/trash/blip_blep/dev/my/level_screen.h +++ b/trash/blip_blep/dev/my/level_screen.h @@ -10,7 +10,7 @@ _x = 12; _y = 12; _t = 71; _gp_gen = level_str; print_str (); sp_UpdateNow (); #ifdef MODE_128K - wyz_play_sound (SFX_START); + PLAY_SOUND (SFX_START); #else beep_fx (1); #endif diff --git a/trash/blip_blep/dev/my/levelset.h b/trash/blip_blep/dev/my/levelset.h index 8add6ae3..578decfa 100644 --- a/trash/blip_blep/dev/my/levelset.h +++ b/trash/blip_blep/dev/my/levelset.h @@ -37,12 +37,14 @@ // In 48K mode, include here your compressed binaries: -extern unsigned char my_binary [0]; +#ifndef MODE_128K + extern unsigned char my_binary [0]; -#asm - ._my_binary - BINARY "../bin/my_binary.bin" -#endasm + #asm + ._my_binary + BINARY "../bin/my_binary.bin" + #endasm +#endif // Define your level sequence array here: // map_w, map_h, scr_ini, ini_x, ini_y, max_objs, c_map_bolts, c_tileset, c_enems_hotspots, c_behs, script diff --git a/trash/blip_blep/dev/my/title_screen.h b/trash/blip_blep/dev/my/title_screen.h index 86ae601c..d4342db9 100644 --- a/trash/blip_blep/dev/my/title_screen.h +++ b/trash/blip_blep/dev/my/title_screen.h @@ -9,7 +9,7 @@ #ifdef MODE_128K get_resource (TITLE_BIN, 16384); - wyz_play_music (0); + PLAY_MUSIC (0); #else #asm ld hl, _s_title diff --git a/trash/blip_blep/dev/pantallas.h b/trash/blip_blep/dev/pantallas.h index b1fbc674..2734d92b 100644 --- a/trash/blip_blep/dev/pantallas.h +++ b/trash/blip_blep/dev/pantallas.h @@ -12,17 +12,17 @@ #asm ._s_title - BINARY "title.bin" + BINARY "..\bin\title.bin" ._s_marco #endasm #ifndef DIRECT_TO_PLAY #asm - BINARY "marco.bin" + BINARY "..\bin\marco.bin" #endasm #endif #asm ._s_ending - BINARY "ending.bin" + BINARY "..\bin\ending.bin" #endasm #endif diff --git a/trash/blip_blep/dev/printer.h b/trash/blip_blep/dev/printer.h index 12b2b499..7e05d920 100644 --- a/trash/blip_blep/dev/printer.h +++ b/trash/blip_blep/dev/printer.h @@ -4,7 +4,7 @@ // Printing functions unsigned char attr (unsigned char x, unsigned char y) { - if (x >= 14 || y >= 10) return 0; + if (x >= 15 || y >= 10) return 0; return map_attr [x + (y << 4) - y]; } @@ -12,6 +12,48 @@ unsigned char qtile (unsigned char x, unsigned char y) { return map_buff [x + (y << 4) - y]; } +#if defined (USE_AUTO_TILE_SHADOWS) || defined (USE_AUTO_SHADOWS) + unsigned char attr_mk2 (void) { + // x + 15 * y = x + (16 - 1) * y = x + 16 * y - y = x + (y << 4) - y. + // if (cx1 < 0 || cy1 < 0 || cx1 > 14 || cy1 > 9) return 0; + // return map_attr [cx1 + (cy1 << 4) - cy1]; + #asm + ld a, (_cx1) + cp 15 + jr nc, _attr_reset + + ld a, (_cy1) + cp 10 + jr c, _attr_do + + ._attr_reset + ld hl, 0 + ret + + ._attr_do + ld a, (_cy1) + ld b, a + sla a + sla a + sla a + sla a + sub b + ld b, a + ld a, (_cx1) + add b + ld e, a + ld d, 0 + ld hl, _map_attr + add hl, de + ld a, (hl) + + ld h, 0 + ld l, a + ret + #endasm + } +#endif + #ifdef COMPRESSED_LEVELS #define ATTR_OFFSET 1536 #else @@ -53,9 +95,9 @@ void draw_coloured_tile (void) { // Fill up c1, c2, c3, c4 then use them #ifdef USE_AUTO_SHADOWS - cx1 = xx - 1; cy1 = yy - 1; rda = *gen_pt; c1 = (nocast && (attr () & 8)) ? (rda & 7) - 1 : rda; t1 = _ta; ++ gen_pt; ++ _ta; - cx1 = xx ; cy1 = yy - 1; rda = *gen_pt; c2 = (nocast && (attr () & 8)) ? (rda & 7) - 1 : rda; t2 = _ta; ++ gen_pt; ++ _ta; - cx1 = xx - 1; cy1 = yy ; rda = *gen_pt; c3 = (nocast && (attr () & 8)) ? (rda & 7) - 1 : rda; t3 = _ta; ++ gen_pt; ++ _ta; + cx1 = xx - 1; cy1 = yy - 1; rda = *gen_pt; c1 = (nocast && (attr_mk2 () & 8)) ? (rda & 7) - 1 : rda; t1 = _ta; ++ gen_pt; ++ _ta; + cx1 = xx ; cy1 = yy - 1; rda = *gen_pt; c2 = (nocast && (attr_mk2 () & 8)) ? (rda & 7) - 1 : rda; t2 = _ta; ++ gen_pt; ++ _ta; + cx1 = xx - 1; cy1 = yy ; rda = *gen_pt; c3 = (nocast && (attr_mk2 () & 8)) ? (rda & 7) - 1 : rda; t3 = _ta; ++ gen_pt; ++ _ta; #endif #ifdef USE_AUTO_TILE_SHADOWS // Precalc @@ -79,7 +121,7 @@ void draw_coloured_tile (void) { gen_pt_alt = tileset + ATTR_OFFSET + t_alt; - // cx1 = xx - 1; cy1 = yy ? yy - 1 : 0; a1 = (nocast && (attr () & 8)); + // cx1 = xx - 1; cy1 = yy ? yy - 1 : 0; a1 = (nocast && (attr_mk2 () & 8)); #asm // cx1 = xx - 1; ld a, (_xx) @@ -94,12 +136,12 @@ void draw_coloured_tile (void) { ._dct_1_set_yy ld (_cy1), a - // a1 = (nocast && (attr () & 8)); + // a1 = (nocast && (attr_mk2 () & 8)); ld a, (_nocast) or a jr z, _dct_a1_set - call _attr + call _attr_mk2 ld a, l and 8 jr z, _dct_a1_set @@ -110,7 +152,7 @@ void draw_coloured_tile (void) { ld (_a1), a #endasm - // cx1 = xx ; cy1 = yy ? yy - 1 : 0; a2 = (nocast && (attr () & 8)); + // cx1 = xx ; cy1 = yy ? yy - 1 : 0; a2 = (nocast && (attr_mk2 () & 8)); #asm // cx1 = xx; ld a, (_xx) @@ -124,12 +166,12 @@ void draw_coloured_tile (void) { ._dct_2_set_yy ld (_cy1), a - // a2 = (nocast && (attr () & 8)) + // a2 = (nocast && (attr_mk2 () & 8)) ld a, (_nocast) or a jr z, _dct_a2_set - call _attr + call _attr_mk2 ld a, l and 8 jr z, _dct_a2_set @@ -140,7 +182,7 @@ void draw_coloured_tile (void) { ld (_a2), a #endasm - // cx1 = xx - 1; cy1 = yy ; a3 = (nocast && (attr () & 8)); + // cx1 = xx - 1; cy1 = yy ; a3 = (nocast && (attr_mk2 () & 8)); #asm // cx1 = xx - 1; ld a, (_xx) @@ -151,12 +193,12 @@ void draw_coloured_tile (void) { ld a, (_yy) ld (_cy1), a - // a3 = (nocast && (attr () & 8)); + // a3 = (nocast && (attr_mk2 () & 8)); ld a, (_nocast) or a jr z, _dct_a3_set - call _attr + call _attr_mk2 ld a, l and 8 jr z, _dct_a3_set @@ -567,7 +609,8 @@ void update_tile (void) { #ifdef ENABLE_TILANIMS // Detect tilanims if (_t >= ENABLE_TILANIMS) { - add_tilanim (_x, _y, _t); + _n = (_x << 4) | _y; + tilanims_add (); } #endif diff --git a/trash/blip_blep/dev/prototypes.h b/trash/blip_blep/dev/prototypes.h index aae155dd..843aaf1a 100644 --- a/trash/blip_blep/dev/prototypes.h +++ b/trash/blip_blep/dev/prototypes.h @@ -7,6 +7,18 @@ #define ENABLE_SIMPLE_COCOS #endif +#ifdef MODE_128K + #ifdef USE_ARKOS_PLAYER + #define PLAY_MUSIC arkos_play_music + #define PLAY_SOUND arkos_play_sound + #define STOP_SOUND arkos_stop_sound + #else + #define PLAY_MUSIC wyz_play_music + #define PLAY_SOUND wyz_play_sound + #define STOP_SOUND wyz_stop_sound + #endif +#endif + // Engine // breakable.h @@ -74,6 +86,7 @@ char player_hidden (void); void run_fire_script (void); void process_tile (void); void draw_scr_background (void); +void draw_scr_hotspots_locks (void); void draw_scr (void); void select_joyfunc (void); unsigned char mons_col_sc_x (void); @@ -108,12 +121,15 @@ void tape_load (void);// TODO! void sg_submenu (void); // tilanim.h -void add_tilanim (unsigned char x, unsigned char y, unsigned char t); -void do_tilanims (void); +void tilanims_add (void); +void tilanims_do (void); +void tilanims_reset (void); -// wyzplayer.h +#ifdef MODE_128K +// wyzplayer.h / arcos_player.h void ISR (void); -void wyz_init (void); -void wyz_play_sound (unsigned char fx_number); -void wyz_play_music (unsigned char song_number); -void wyz_stop_sound (void); +void INIT_PLAYER (void); +void PLAY_SOUND (unsigned char fx_number); +void PLAY_MUSIC (unsigned char song_number); +void STOP_SOUND (void); +#endif diff --git a/trash/blip_blep/dev/sound/arkos-addresses.h b/trash/blip_blep/dev/sound/arkos-addresses.h new file mode 100644 index 00000000..fa3225d7 --- /dev/null +++ b/trash/blip_blep/dev/sound/arkos-addresses.h @@ -0,0 +1,9 @@ +#define SFXS_SONG 0xd10c +#define ATINIT 0xc68c +#define ATPLAY 0xc000 +#define ATSFXINIT 0xc6f0 +#define ATSFXPLAY 0xc704 +#define ATSFXSTOP 0xc745 +#define ATSFXSTOPALL 0xc6f7 +#define ATSTOP 0xc6e1 +#define SONG_LIST 0xd5b7 diff --git a/trash/blip_blep/dev/sound/arkosplayer.h b/trash/blip_blep/dev/sound/arkosplayer.h new file mode 100644 index 00000000..c149b1b9 --- /dev/null +++ b/trash/blip_blep/dev/sound/arkosplayer.h @@ -0,0 +1,118 @@ +// MT Engine MK2 +// Copyleft 2014 the Mojon Twins + +// arkosplayer.h +// Arkos Player hook functions + +// This code is based on the original integration by Syx & Nightwolf +// In fact, this code IS the original integration by Syx & Nightwolf. +// I just changed the way params are passed (thanks @reidrac) +// I just automated the process & reindented to meet my own personal taste. + +#include "sound\arkos-addresses.h" + +// Start. + +// isr +#asm + defw 0 +#endasm + +void ISR(void) { + #asm + ld b, 1 + call SetRAMBank + call ATPLAY + ld b, 0 + call SetRAMBank + + ld hl, _isrc + inc (hl) + #endasm +} + +void arkos_stop (void) { + #asm + ld b, 1 + call SetRAMBank + ld a, 201 + ld (ATPLAY),A + ld b, 0 + call SetRAMBank + #endasm +} + +void __FASTCALL__ arkos_play_sound (unsigned char fx_number) { + #asm + di + ld b,1 + call SetRAMBank + + ; __FASTCALL__ -> fx_number is in l! + ld a, ARKOS_SFX_CHANNEL + ld h, 15 + ld e, 50 + ld d, 0 + ld bc, 0 + call ATSFXPLAY + + ld b,0 + call SetRAMBank + ei + #endasm +} + +void __FASTCALL__ arkos_play_music (unsigned char song_number) { + #asm + di + ld b, 1 + call SetRAMBank + + ; Reactivate sound generation + ld a, 175 + ld (ATPLAY),A + + ; Initialize song + ; __FASTCALL__ -> song_number is in l! + ld a, l + add a, a + ld hl, SONG_LIST + add a,l + jr nc, salta_inc_song + inc h + salta_inc_song: + ld l,a + ld e, (hl) + inc hl + ld d, (hl) + + call ATINIT + + ld de, SFXS_SONG + call ATSFXINIT + + ld b, 0 + call SetRAMBank + ei + #endasm +} + +void arkos_stop_sound (void) +{ + #asm + di + ld b,1 + call SetRAMBank + + call ATSFXSTOPALL + call ATSTOP + + ; Turn off sound generation + ld a,201 + ld (ATPLAY),A + + ld b,0 + call SetRAMBank + ei + #endasm +} diff --git a/trash/blip_blep/dev/beeper.h b/trash/blip_blep/dev/sound/beeper.h similarity index 100% rename from trash/blip_blep/dev/beeper.h rename to trash/blip_blep/dev/sound/beeper.h diff --git a/trash/blip_blep/dev/music.h b/trash/blip_blep/dev/sound/music.h similarity index 88% rename from trash/blip_blep/dev/music.h rename to trash/blip_blep/dev/sound/music.h index 10f2f783..db6c2b4b 100644 --- a/trash/blip_blep/dev/music.h +++ b/trash/blip_blep/dev/sound/music.h @@ -2,14 +2,14 @@ ; ***************************************************************************** ; * Phaser1 Engine, with synthesised drums ; * -; * Original code by Shiru - .http//shiru.untergrund.net/ +; * Original code by Shiru - .HTTP//shiru.UNTERGRUND.NET/ ; * Modified by Chris Cowley ; * ; * Produced by Beepola v1.05.01 ; ****************************************************************************** .musicstart - LD HL,MUSICDATA ; <- Pointer to Music Data. Change + LD HL,MUSICDATA ; <- Pointer to Music Data. change ; this to play a different song LD A,(HL) ; Get the loop start pointer LD (PATTERN_LOOP_BEGIN),A @@ -31,7 +31,7 @@ LD L,A LD (NOTE_PTR),HL ; Set the note offset (within this pattern) to 0 -.player +.PLAYER ;DI PUSH IY ;LD A,BORDER_COL @@ -54,24 +54,24 @@ ; * Select the next pattern in sequence (and handle looping if weve reached PATTERN_LOOP_END ; * Execution falls through to PLAYNOTE to play the first note from our next pattern ; ******************************************************************************************************** -.next_pattern +.NEXT_PATTERN LD A,(PATTERN_PTR) INC A INC A DEFB $FE ; CP n -.pattern_loop_end DEFB 0 +.PATTERN_LOOP_END defb 0 JR NZ,NO_PATTERN_LOOP ; Handle Pattern Looping at and of song DEFB $3E ; LD A,n -.pattern_loop_begin DEFB 0 -.no_pattern_loop LD (PATTERN_PTR),A +.PATTERN_LOOP_BEGIN defb 0 +.NO_PATTERN_LOOP ld (PATTERN_PTR),a LD HL,$0000 LD (NOTE_PTR),HL ; Start of pattern (NOTE_PTR = 0) -.main_loop +.MAIN_LOOP LD IYL,0 ; Set channel = 0 -.read_loop +.READ_LOOP LD HL,(PATTERN_ADDR) LD A,(PATTERN_PTR) LD E,A @@ -82,7 +82,7 @@ LD D,(HL) ; Now DE = Start of Pattern data LD HL,(NOTE_PTR) INC HL ; Increment the note pointer and... - LD (NOTE_PTR),HL ; ..store it + LD (NOTE_PTR),HL ; ..STORE it DEC HL ADD HL,DE ; Now HL = address of note data LD A,(HL) @@ -110,16 +110,16 @@ EX DE,HL DEFB $DD,$21 ; LD IX,nn -.current_inst +.CURRENT_INST DEFW $0000 LD A,(IX+$00) OR A JR Z,L809B ; Original code jumps into byte 2 of the DJNZ (invalid opcode FD) LD B,A -.l8098 ADD HL,HL +.L8098 add hl,hl DJNZ L8098 -.l809b LD E,(IX+$01) +.L809B ld e,(ix+$01) LD D,(IX+$02) ADD HL,DE LD (DIV_1B),HL @@ -136,7 +136,7 @@ LD (CNT_1B),HL JR READ_LOOP -.set_note2 +.SET_NOTE2 LD (DIV_2),DE LD A,IYH LD HL,OUT_2 @@ -145,7 +145,7 @@ LD (CNT_2),HL JP READ_LOOP -.set_stop +.SET_STOP LD HL,$0000 LD A,IYL OR A @@ -157,14 +157,14 @@ RES 4,(HL) LD IYL,1 JP READ_LOOP -.set_stop2 +.SET_STOP2 ; Stop channel 2 note LD (DIV_2),HL LD HL,OUT_2 RES 4,(HL) JP READ_LOOP -.other CP $3C +.OTHER cp $3c JR Z,SET_STOP ; Stop note CP $3E JR Z,SKIP_CH1 ; No changes to channel 1 @@ -177,50 +177,50 @@ LD (NOTE_PTR),DE ; Increment the note pointer DEFB $01 ; LD BC,nn -.instrum_tbl +.INSTRUM_TBL DEFW $0000 ADD HL,BC LD (CURRENT_INST),HL JP READ_LOOP -.skip_ch1 +.SKIP_CH1 LD IYL,$01 JP READ_LOOP -.exit_player +.EXIT_PLAYER LD HL,$2758 EXX POP IY ;EI RET -.render +.RENDER AND $7F ; L813A CP $76 JP NC,DRUMS LD D,A EXX DEFB $21 ; LD HL,nn -.cnt_1a DEFW $0000 +.CNT_1A defw $0000 DEFB $DD,$21 ; LD IX,nn -.cnt_1b DEFW $0000 +.CNT_1B defw $0000 DEFB $01 ; LD BC,nn -.div_1a DEFW $0000 +.DIV_1A defw $0000 DEFB $11 ; LD DE,nn -.div_1b DEFW $0000 +.DIV_1B defw $0000 DEFB $3E ; LD A,n -.out_1 DEFB $0 +.OUT_1 defb $0 EXX EX AF,AF ; beware! DEFB $21 ; LD HL,nn -.cnt_2 DEFW $0000 +.CNT_2 defw $0000 DEFB $01 ; LD BC,nn -.div_2 DEFW $0000 +.DIV_2 defw $0000 DEFB $3E ; LD A,n -.out_2 DEFB $00 +.OUT_2 defb $00 -.play_note +.PLAY_NOTE ; Read keyboard LD E,A XOR A @@ -228,94 +228,94 @@ OR $E0 INC A -.player_wait_key +.PLAYER_WAIT_KEY JR NZ,EXIT_PLAYER LD A,E LD E,0 -.l8168 EXX +.L8168 exx EX AF,AF ; beware! ADD HL,BC OUT ($FE),A JR C,L8171 JR L8173 -.l8171 XOR $10 -.l8173 ADD IX,DE +.L8171 xor $10 +.L8173 add ix,de JR C,L8179 JR L817B -.l8179 XOR $10 -.l817b EX AF,AF ; beware! +.L8179 xor $10 +.L817B ex af,af ; beware! OUT ($FE),A EXX ADD HL,BC JR C,L8184 JR L8186 -.l8184 XOR $10 -.l8186 NOP +.L8184 xor $10 +.L8186 nop JP L818A -.l818a EXX +.L818A exx EX AF,AF ; beware! ADD HL,BC OUT ($FE),A JR C,L8193 JR L8195 -.l8193 XOR $10 -.l8195 ADD IX,DE +.L8193 xor $10 +.L8195 add ix,de JR C,L819B JR L819D -.l819b XOR $10 -.l819d EX AF,AF ; beware! +.L819B xor $10 +.L819D ex af,af ; beware! OUT ($FE),A EXX ADD HL,BC JR C,L81A6 JR L81A8 -.l81a6 XOR $10 -.l81a8 NOP +.L81A6 xor $10 +.L81A8 nop JP L81AC -.l81ac EXX +.L81AC exx EX AF,AF ; beware! ADD HL,BC OUT ($FE),A JR C,L81B5 JR L81B7 -.l81b5 XOR $10 -.l81b7 ADD IX,DE +.L81B5 xor $10 +.L81B7 add ix,de JR C,L81BD JR L81BF -.l81bd XOR $10 -.l81bf EX AF,AF ; beware! +.L81BD xor $10 +.L81BF ex af,af ; beware! OUT ($FE),A EXX ADD HL,BC JR C,L81C8 JR L81CA -.l81c8 XOR $10 -.l81ca NOP +.L81C8 xor $10 +.L81CA nop JP L81CE -.l81ce EXX +.L81CE exx EX AF,AF ; beware! ADD HL,BC OUT ($FE),A JR C,L81D7 JR L81D9 -.l81d7 XOR $10 -.l81d9 ADD IX,DE +.L81D7 xor $10 +.L81D9 add ix,de JR C,L81DF JR L81E1 -.l81df XOR $10 -.l81e1 EX AF,AF ; beware! +.L81DF xor $10 +.L81E1 ex af,af ; beware! OUT ($FE),A EXX ADD HL,BC JR C,L81EA JR L81EC -.l81ea XOR $10 +.L81EA xor $10 -.l81ec DEC E +.L81EC dec e JP NZ,L8168 EXX @@ -324,20 +324,20 @@ OUT ($FE),A JR C,L81F9 JR L81FB -.l81f9 XOR $10 -.l81fb ADD IX,DE +.L81F9 xor $10 +.L81FB add ix,de JR C,L8201 JR L8203 -.l8201 XOR $10 -.l8203 EX AF,AF ; beware! +.L8201 xor $10 +.L8203 ex af,af ; beware! OUT ($FE),A EXX ADD HL,BC JR C,L820C JR L820E -.l820c XOR $10 +.L820C xor $10 -.l820e DEC D +.L820E dec d JP NZ,PLAY_NOTE LD (CNT_2),HL @@ -352,8 +352,8 @@ ; ************************************************************ ; * DRUMS - Synthesised ; ************************************************************ -.drums - ADD A,A ; On entry A=$75+Drum number (i.e. $76 to $7E) +.DRUMS + ADD A,A ; On entry A=$75+Drum number (i.E. $76 to $7e) LD B,0 LD C,A LD HL,DRUM_TABLE - 236 @@ -364,23 +364,23 @@ EX DE,HL JP (HL) -.drum_tone1 LD L,16 +.DRUM_TONE1 ld l,16 JR DRUM_TONE -.drum_tone2 LD L,12 +.DRUM_TONE2 ld l,12 JR DRUM_TONE -.drum_tone3 LD L,8 +.DRUM_TONE3 ld l,8 JR DRUM_TONE -.drum_tone4 LD L,6 +.DRUM_TONE4 ld l,6 JR DRUM_TONE -.drum_tone5 LD L,4 +.DRUM_TONE5 ld l,4 JR DRUM_TONE -.drum_tone6 LD L,2 -.drum_tone +.DRUM_TONE6 ld l,2 +.DRUM_TONE LD DE,3700 LD BC,$0101 //LD A,BORDER_COL xor a -.dt_loop0 OUT ($FE),A +.DT_LOOP0 out ($fe),a DEC B JR NZ,DT_LOOP1 XOR 16 @@ -390,32 +390,32 @@ ADD A,L LD C,A EX AF,AF ; beware! -.dt_loop1 DEC E +.DT_LOOP1 dec e JR NZ,DT_LOOP0 DEC D JR NZ,DT_LOOP0 JP MAIN_LOOP -.drum_noise1 LD DE,2480 +.DRUM_NOISE1 ld de,2480 LD IXL,1 JR DRUM_NOISE -.drum_noise2 LD DE,1070 +.DRUM_NOISE2 ld de,1070 LD IXL,10 JR DRUM_NOISE -.drum_noise3 LD DE,365 +.DRUM_NOISE3 ld de,365 LD IXL,101 -.drum_noise +.DRUM_NOISE LD H,D LD L,E //LD A,BORDER_COL xor a LD C,A -.dn_loop0 LD A,(HL) +.DN_LOOP0 ld a,(hl) AND 16 OR C OUT ($FE),A LD B,IXL -.dn_loop1 DJNZ DN_LOOP1 +.DN_LOOP1 djnz DN_LOOP1 INC HL DEC E JR NZ,DN_LOOP0 @@ -423,14 +423,14 @@ JR NZ,DN_LOOP0 JP MAIN_LOOP -.pattern_addr DEFW $0000 -.pattern_ptr DEFB 0 -.note_ptr DEFW $0000 +.PATTERN_ADDR defw $0000 +.PATTERN_PTR defb 0 +.NOTE_PTR defw $0000 ; ************************************************************** ; * Frequency Table ; ************************************************************** -.freq_table +.FREQ_TABLE DEFW 178,189,200,212,225,238,252,267,283,300,318,337 DEFW 357,378,401,425,450,477,505,535,567,601,637,675 DEFW 715,757,802,850,901,954,1011,1071,1135,1202,1274,1350 @@ -440,12 +440,12 @@ ; ***************************************************************** ; * Synth Drum Lookup Table ; ***************************************************************** -.drum_table +.DRUM_TABLE DEFW DRUM_TONE1,DRUM_TONE2,DRUM_TONE3,DRUM_TONE4,DRUM_TONE5,DRUM_TONE6 DEFW DRUM_NOISE1,DRUM_NOISE2,DRUM_NOISE3 -.musicdata +.MUSICDATA DEFB 0 ; Pattern loop begin * 2 DEFB 6 ; Song length * 2 DEFW 4 ; Offset to start of song (length of instrument table) @@ -453,12 +453,12 @@ DEFW 0 ; Detune DEFB 0 ; Phase -.patterndata DEFW PAT0 +.PATTERNDATA defw PAT0 DEFW PAT1 DEFW PAT1 ; *** Pattern data - $00 marks the end of a pattern *** -.pat0 +.PAT0 DEFB $BD,0 DEFB 157 DEFB 145 @@ -581,7 +581,7 @@ DEFB 188 DEFB 9 DEFB $00 -.pat1 +.PAT1 DEFB 145 DEFB 180 DEFB 3 diff --git a/trash/blip_blep/dev/sound/wyzplayer.h b/trash/blip_blep/dev/sound/wyzplayer.h new file mode 100644 index 00000000..b06fedd7 --- /dev/null +++ b/trash/blip_blep/dev/sound/wyzplayer.h @@ -0,0 +1,91 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// WYZ player hook functions + +// WYZ player and songs are loaded into RAM 1 ($C000). +// In each interrupt, we just page in RAM 1, call the player, +// then page back RAM 0 and exit. + +// The player is, thus, compiled to $C000, and its addresses +// are: + +#define WYZPLAYERINIT 0xC018 // INIT_BUFFERS EQU 0C018H +#define WYZPLAYERISR 0xC000 // INICIO EQU 0C000H +#define INICIAEFECTO 0xC47E // INICIA_EFECTO EQU 0C46BH +#define CARGA_CANCION 0xC087 // CARGA_CANCION EQU 0C087H +#define SILENCIA_PLAYER 0xC062 // PLAYER_OFF EQU 0C062H + +// Start. + +// isr +#asm + defw 0 // 2 bytes libres +#endasm + +void ISR(void) { + #asm + ld a, (_player_on) + or a + ret z + ld b, 1 + call SetRAMBank + call WYZPLAYERISR + ld b, 0 + call SetRAMBank + + ld hl, _isrc + inc (hl) + #endasm +} + +void wyz_init (void) { + #asm + ld b,1 + call SetRAMBank + call WYZPLAYERINIT + ld b,0 + call SetRAMBank + #endasm +} + +void __FASTCALL__ wyz_play_sound (unsigned char fx_number) { + #asm + di + ld b, 1 + call SetRAMBank + ; __FASTCALL__ -> fx_number is in l! + ld b, l + call INICIAEFECTO + ld b, 0 + call SetRAMBank + ei + #endasm +} + +void __FASTCALL__ wyz_play_music (unsigned char song_number) { + #asm + di + ld b, 1 + call SetRAMBank + ; __FASTCALL__ -> song_number is in l! + ld a, l + call CARGA_CANCION + ld b, 0 + call SetRAMBank + ei + #endasm + song_playing = song_number; +} + +void wyz_stop_sound (void) { + #asm + di + ld b,1 + call SetRAMBank + call SILENCIA_PLAYER + ld b,0 + call SetRAMBank + ei + #endasm +} diff --git a/trash/blip_blep/dev/tilanim.h b/trash/blip_blep/dev/tilanim.h index 3e62c5a7..cfeaafaf 100644 --- a/trash/blip_blep/dev/tilanim.h +++ b/trash/blip_blep/dev/tilanim.h @@ -2,43 +2,102 @@ // Copyleft 2010-2014, 2020 by the Mojon Twins // tilanim.h -// Rutina para animar tiles. -#define MAX_TILANIMS 64 -#define UPDATE_FREQ 7 -unsigned char max_tilanims; -unsigned char tacount; +void tilanims_reset (void) { + #asm + ld hl, _tilanims_ft + ld de, _tilanims_ft + 1 + ld bc, MAX_TILANIMS - 1 + xor a + ld (hl), a + ldir + ld (_tacount), a + ld (_tait), a + ld (_max_tilanims), a + #endasm +} + +void tilanims_add (void) { + #asm + ld de, (_max_tilanims) + ld d, 0 -typedef struct { - unsigned char xy; - unsigned char ft; -} TILANIM; + ld a, (__n) + ld hl, _tilanims_xy + add hl, de + ld (hl), a -TILANIM tilanims [MAX_TILANIMS]; + ld a, (__t) + ld hl, _tilanims_ft + add hl, de + ld (hl), a -void add_tilanim (unsigned char x, unsigned char y, unsigned char t) { - tilanims [max_tilanims].xy = (x << 4) + y; - tilanims [max_tilanims].ft = t; - - ++ max_tilanims; + ld a, e + inc a + ld (_max_tilanims), a + #endasm } -unsigned char tait; -void do_tilanims (void) { - if (max_tilanims == 0) return; - - tacount = (tacount + 1) & UPDATE_FREQ; - if (!tacount) { - // Select tile - tait = rand () % max_tilanims; - - // Flip bit 7: - tilanims [tait].ft = tilanims [tait].ft ^ 128; +void tilanims_do (void) { + #asm + ld a, (_max_tilanims) + or a + ret z + + ld a, (_tait) + add TILANIMS_PRIME + cp MAX_TILANIMS + jr c, _tilanims_tait_0_skip + sub MAX_TILANIMS + ._tilanims_tait_0_skip + ld (_tait), a + + // Check counter for tilanim #tait + ld d, 0 + ld e, a + + // Check of active + ld hl, _tilanims_ft + add hl, de + ld a, (hl) + or a + ret z + + // Flip bit 7 + ld hl, _tilanims_ft + add hl, de + ld a, (hl) + xor 128 + ld (hl), a + + // Which tile? + bit 7, a + jr z, _tilanims_no_flick + + inc a + ._tilanims_no_flick + and 127 + ld (__t), a // Draw tile - _x = tilanims [tait].xy >> 4; - _y = tilanims [tait].xy & 15; - _t = (tilanims [tait].ft & 127) + (tilanims [tait].ft >> 7); - draw_invalidate_coloured_tile_gamearea (); - } + ld hl, _tilanims_xy + add hl, de + ld a, (hl) + ld c, a + srl a + srl a + srl a + and 0xfe + add VIEWPORT_X + ld (__x), a + + ld a, c + and 15 + sla a + add VIEWPORT_Y + ld (__y), a + + call _draw_coloured_tile + call _invalidate_tile + #endasm } diff --git a/trash/blip_blep/dev/wyzplayer.h b/trash/blip_blep/dev/wyzplayer.h deleted file mode 100644 index dea53369..00000000 --- a/trash/blip_blep/dev/wyzplayer.h +++ /dev/null @@ -1,85 +0,0 @@ -// MTE MK1 (la Churrera) v5.0 -// Copyleft 2010-2014, 2020 by the Mojon Twins - -// WYZ player hook functions - -// WYZ player and songs are loaded into RAM 1 ($C000). -// In each interrupt, we just page in RAM 1, call the player, -// then page back RAM 0 and exit. - -// The player is, thus, compiled to $C000, and its addresses -// are: - -#define WYZPLAYERINIT 0xC018 // INIT_BUFFERS EQU 0C018H -#define WYZPLAYERISR 0xC000 // INICIO EQU 0C000H -#define INICIAEFECTO 0xC47E // INICIA_EFECTO EQU 0C46BH -#define CARGA_CANCION 0xC087 // CARGA_CANCION EQU 0C087H -#define SILENCIA_PLAYER 0xC062 // PLAYER_OFF EQU 0C062H - -// Start. - -// isr -#asm - defw 0 // 2 bytes libres -#endasm - -void ISR(void) { - #asm - ld b, 1 - call SetRAMBank - call WYZPLAYERISR - ld b, 0 - call SetRAMBank - #endasm -} - -void wyz_init (void) { - #asm - ld b,1 - call SetRAMBank - call WYZPLAYERINIT - ld b,0 - call SetRAMBank - #endasm -} - -void __FASTCALL__ wyz_play_sound (unsigned char fx_number) { - #asm - di - ld b, 1 - call SetRAMBank - ; __FASTCALL__ -> fx_number is in l! - ld b, l - call INICIAEFECTO - ld b, 0 - call SetRAMBank - ei - #endasm -} - -void __FASTCALL__ wyz_play_music (unsigned char song_number) { - #asm - di - ld b, 1 - call SetRAMBank - ; __FASTCALL__ -> song_number is in l! - ld a, l - call CARGA_CANCION - ld b, 0 - call SetRAMBank - ei - #endasm - song_playing = song_number; -} - -void wyz_stop_sound (void) { - #asm - di - ld b,1 - call SetRAMBank - call SILENCIA_PLAYER - ld b,0 - call SetRAMBank - ei - #endasm -} diff --git a/trash/blip_blep/dev/zcc_opt.def b/trash/blip_blep/dev/zcc_opt.def deleted file mode 100644 index 3cbd4251..00000000 --- a/trash/blip_blep/dev/zcc_opt.def +++ /dev/null @@ -1,8 +0,0 @@ - -IF !DEFINED_STACKPTR - defc DEFINED_STACKPTR = 1 - defc STACKPTR = 61936 -ENDIF - - DEFINE DEFINED_myzorg - defc myzorg = 24000 diff --git a/trash/blip_blep/map/mapa.MAP b/trash/blip_blep/map/mapa.MAP index 4658730f..3d523ee2 100644 Binary files a/trash/blip_blep/map/mapa.MAP and b/trash/blip_blep/map/mapa.MAP differ diff --git a/trash/blip_blep/map/mapa.fmp b/trash/blip_blep/map/mapa.fmp index ca585e9c..c8750feb 100644 Binary files a/trash/blip_blep/map/mapa.fmp and b/trash/blip_blep/map/mapa.fmp differ diff --git a/trash/mlst/bin/loader.bin b/trash/mlst/bin/loader.bin index 6ce1f798..74757e94 100644 Binary files a/trash/mlst/bin/loader.bin and b/trash/mlst/bin/loader.bin differ diff --git a/trash/mlst/dev/assets/ay_fx_numbers.h b/trash/mlst/dev/assets/ay_fx_numbers.h index 411264ac..d1c0346e 100644 --- a/trash/mlst/dev/assets/ay_fx_numbers.h +++ b/trash/mlst/dev/assets/ay_fx_numbers.h @@ -1,20 +1,42 @@ // MTE MK1 (la Churrera) v5.0 // Copyleft 2010-2014, 2020 by the Mojon Twins -#define SFX_START 0 -#define SFX_BREAKABLE_HIT 1 -#define SFX_BREAKABLE_BREAK 2 -#define SFX_PUSH_BOX 3 -#define SFX_OPEN_LOCK 3 -#define SFX_SHOOT 4 -#define SFX_OBJECT_GET 5 -#define SFX_KILL_ENEMY_STEP 6 -#define SFX_KILL_ENEMY_SHOOT 6 -#define SFX_HIT_ENEMY 7 -#define SFX_ONE_OBJECT_GET 8 -#define SFX_ONE_OBJECT_WRONG 9 -#define SFX_KEY_GET 10 -#define SFX_REFILL_GET 11 -#define SFX_JUMP 12 -#define SFX_SPIKES 13 -#define SFX_ENEMY_HIT 14 +#ifdef USE_ARKOS_PLAYER + #define SFX_START 1 + #define SFX_BREAKABLE_HIT 1 + #define SFX_BREAKABLE_BREAK 2 + #define SFX_PUSH_BOX 3 + #define SFX_OPEN_LOCK 3 + #define SFX_SHOOT 4 + #define SFX_OBJECT_GET 5 + #define SFX_KILL_ENEMY_STEP 6 + #define SFX_KILL_ENEMY_SHOOT 6 + #define SFX_HIT_ENEMY 7 + #define SFX_ONE_OBJECT_GET 8 + #define SFX_ONE_OBJECT_WRONG 9 + #define SFX_KEY_GET 4 + #define SFX_REFILL_GET 11 + #define SFX_JUMP 2 + #define SFX_SPIKES 2 + #define SFX_ENEMY_HIT 8 + +#else + #define SFX_START 0 + #define SFX_BREAKABLE_HIT 1 + #define SFX_BREAKABLE_BREAK 2 + #define SFX_PUSH_BOX 3 + #define SFX_OPEN_LOCK 3 + #define SFX_SHOOT 4 + #define SFX_OBJECT_GET 5 + #define SFX_KILL_ENEMY_STEP 6 + #define SFX_KILL_ENEMY_SHOOT 6 + #define SFX_HIT_ENEMY 7 + #define SFX_ONE_OBJECT_GET 8 + #define SFX_ONE_OBJECT_WRONG 9 + #define SFX_KEY_GET 10 + #define SFX_REFILL_GET 11 + #define SFX_JUMP 12 + #define SFX_SPIKES 13 + #define SFX_ENEMY_HIT 14 + +#endif \ No newline at end of file diff --git a/trash/mlst/dev/assets/levels.h b/trash/mlst/dev/assets/levels.h index c601614a..bd29b455 100644 --- a/trash/mlst/dev/assets/levels.h +++ b/trash/mlst/dev/assets/levels.h @@ -14,7 +14,7 @@ // Map data, 75 or 150 * (MAP_W*MAP_H) bytes // Bolts, 32 * 4 = 128 bytes // Tileset, 2304 bytes -// Enemies, MAP_W * MAP_H * 3 * 10 bytes +// Enemies, MAP_W * MAP_H * MAX_ENEMS * 10 bytes // Hotspots, MAP_W * MAP_H * 3 bytes // Behs, 48 bytes // Spriteset, 2312 bytes @@ -64,7 +64,7 @@ extern unsigned char font [0]; ._font BINARY "font.bin" #endasm -extern LEVELHEADER level_data [0]; +extern LEVELHEADER level_data; #asm ._level_data defs 16 #endasm @@ -94,7 +94,7 @@ extern unsigned char tileset [0]; extern MALOTE malotes [0]; #asm - ._malotes defs MAP_W * MAP_H * 3 * 10 + ._malotes defs MAP_W * MAP_H * MAX_ENEMS * 10 #endasm extern HOTSPOT hotspots [0]; diff --git a/trash/mlst/dev/compile.bat b/trash/mlst/dev/compile.bat index b96d1905..52542aa4 100644 --- a/trash/mlst/dev/compile.bat +++ b/trash/mlst/dev/compile.bat @@ -34,7 +34,8 @@ echo Running The Librarian ..\..\..\src\utils\librarian2.exe list=..\bin\list.txt index=assets\librarian.h bins_prefix=..\bin\ rams_prefix=..\bin\ > nul echo Compilando guego -zcc +zx -vn -m mk1.c -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul +zcc +zx -vn mk1.c -O3 -crt0=crt.asm -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul +rem zcc +zx -vn mk1.c -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul ..\..\..\src\utils\printsize.exe %game%.bin ..\..\..\src\utils\printsize.exe ..\script\scripts.bin diff --git a/trash/mlst/dev/crt.asm b/trash/mlst/dev/crt.asm new file mode 100644 index 00000000..27e0d47d --- /dev/null +++ b/trash/mlst/dev/crt.asm @@ -0,0 +1,17 @@ + MODULE zx82_crt0 + INCLUDE "zcc_opt.def" + XREF _main ; main() is always external to crt0 code + + IF !STACKPTR + defc STACKPTR = $FFFF + ENDIF + + IF !CRT_ORG_CODE + defc CRT_ORG_CODE = 32768 + ENDIF + + org CRT_ORG_CODE + +start: + ld sp,STACKPTR + jp _main diff --git a/trash/mlst/dev/definitions.h b/trash/mlst/dev/definitions.h index 4c74b69d..38f3bd82 100644 --- a/trash/mlst/dev/definitions.h +++ b/trash/mlst/dev/definitions.h @@ -6,7 +6,8 @@ .fsClipStruct defb 0, 24, 0, 32 #endasm -void *joyfunc = sp_JoyKeyboard; // Puntero a la función de manejo seleccionada. +//void *joyfunc = sp_JoyKeyboard; // Puntero a la función de manejo seleccionada. +unsigned int (*joyfunc)(struct sp_UDK *) = sp_JoyKeyboard; const void *joyfuncs [] = { sp_JoyKeyboard, sp_JoyKempston, sp_JoySinclair1 @@ -56,7 +57,7 @@ unsigned char enoffs; // Aux char asm_number; -unsigned int asm_int; +unsigned int asm_int @ 23302; unsigned int asm_int_2; unsigned int seed; unsigned char half_life; @@ -118,7 +119,7 @@ unsigned char p_tx, p_ty; #endif signed int ptgmx, ptgmy; -const unsigned char *spacer = " "; +unsigned char *spacer = " "; unsigned char enit; @@ -313,3 +314,5 @@ unsigned char *_gp_gen; unsigned char song_playing = 0; unsigned char player_on = 1; #endif + +unsigned char isrc; diff --git a/trash/mlst/dev/engine.h b/trash/mlst/dev/engine.h index 53120ace..bbbbfb9f 100644 --- a/trash/mlst/dev/engine.h +++ b/trash/mlst/dev/engine.h @@ -153,7 +153,7 @@ void espera_activa (int espera) { // Sonido #ifdef MODE_128K - wyz_play_sound (SFX_PUSH_BOX); + PLAY_SOUND (SFX_PUSH_BOX); #else beep_fx (2); #endif @@ -182,7 +182,7 @@ void espera_activa (int espera) { -- p_keys; #ifdef MODE_128K - wyz_play_sound (SFX_OPEN_LOCK); + PLAY_SOUND (SFX_OPEN_LOCK); #else beep_fx (8); #endif @@ -624,7 +624,8 @@ void select_joyfunc (void) { } #ifdef MODE_128K - wyz_play_sound (SFX_START); + STOP_SOUND (); + PLAY_SOUND (SFX_START); sp_WaitForNoKey (); #endif } diff --git a/trash/mlst/dev/engine/breakable.h b/trash/mlst/dev/engine/breakable.h index cf4ab8a8..01e9423f 100644 --- a/trash/mlst/dev/engine/breakable.h +++ b/trash/mlst/dev/engine/breakable.h @@ -23,7 +23,7 @@ void break_wall (void) { #include "my/ci/on_wall_broken.h" } #ifdef MODE_128K - wyz_play_sound (gpit); + PLAY_SOUND (gpit); #else // Show what just happened before the sound interrupts the action sp_UpdateNow (); diff --git a/trash/mlst/dev/engine/bullets.h b/trash/mlst/dev/engine/bullets.h index 10be0bb8..2278b516 100644 --- a/trash/mlst/dev/engine/bullets.h +++ b/trash/mlst/dev/engine/bullets.h @@ -166,7 +166,7 @@ void bullets_fire (void) { #endif #ifdef MODE_128K - wyz_play_sound (SFX_SHOOT); + PLAY_SOUND (SFX_SHOOT); #else beep_fx (6); #endif diff --git a/trash/mlst/dev/engine/c_levels.h b/trash/mlst/dev/engine/c_levels.h index 18b118a1..cbbaf91a 100644 --- a/trash/mlst/dev/engine/c_levels.h +++ b/trash/mlst/dev/engine/c_levels.h @@ -10,8 +10,8 @@ void prepare_level (void) { #endif { n_pant = level_data.scr_ini; - gpx = level_data->ini_x << 4; p_x = gpx << 6; - gpy = level_data->ini_y << 4; p_y = gpy << 6; + gpx = level_data.ini_x << 4; p_x = gpx << 6; + gpy = level_data.ini_y << 4; p_y = gpy << 6; } #ifdef ACTIVATE_SCRIPTING @@ -27,8 +27,8 @@ void prepare_level (void) { unpack ((unsigned int) levels [level].c_sprites, (unsigned int) (sprites + 16)); #endif - level_data->map_w = levels [level].map_w; - level_data->map_h = levels [level].map_h; + level_data.map_w = levels [level].map_w; + level_data.map_h = levels [level].map_h; #ifdef ACTIVATE_SCRIPTING if (script_result != 3) diff --git a/trash/mlst/dev/engine/enengine.h b/trash/mlst/dev/engine/enengine.h index b6ca7735..4acb013d 100644 --- a/trash/mlst/dev/engine/enengine.h +++ b/trash/mlst/dev/engine/enengine.h @@ -14,7 +14,7 @@ #if defined(PLAYER_STEPS_ON_ENEMIES) || defined (PLAYER_CAN_FIRE) void enems_init (void) { enit = 0; - while (enit < MAP_W * MAP_H * 3) { + while (enit < MAP_W * MAP_H * MAX_ENEMS) { malotes [enit].t = malotes [enit].t & 0xEF; // Clear bit 4 #ifdef PLAYER_CAN_FIRE malotes [enit].life = ENEMIES_LIFE_GAUGE; @@ -121,7 +121,7 @@ void enems_draw_current (void) { void enems_load (void) { // Movemos y cambiamos a los enemigos según el tipo que tengan - enoffs = n_pant * 3; + enoffs = n_pant * MAX_ENEMS; for (enit = 0; enit < MAX_ENEMS; ++ enit) { en_an_frame [enit] = 0; @@ -450,7 +450,7 @@ void enems_move (void) { #endif { #ifdef MODE_128K - wyz_play_sound (SFX_KILL_ENEMY_STEP); + PLAY_SOUND (SFX_KILL_ENEMY_STEP); en_an_state [enit] = GENERAL_DYING; en_an_count [enit] = 12; en_an_next_frame [enit] = sprite_17_a; @@ -549,7 +549,7 @@ void enems_move (void) { #ifdef MODE_128K en_an_state [enit] = GENERAL_DYING; en_an_count [enit] = 12; - wyz_play_sound (SFX_KILL_ENEMY_SHOOT); + PLAY_SOUND (SFX_KILL_ENEMY_SHOOT); #else beep_fx (5); en_an_next_frame [enit] = sprite_18_a; @@ -563,7 +563,7 @@ void enems_move (void) { } #ifdef MODE_128K - wyz_play_sound (SFX_HIT_ENEMY); + PLAY_SOUND (SFX_HIT_ENEMY); #else beep_fx (1); #endif diff --git a/trash/mlst/dev/engine/hotspots.h b/trash/mlst/dev/engine/hotspots.h index 10f9978c..3a1b3223 100644 --- a/trash/mlst/dev/engine/hotspots.h +++ b/trash/mlst/dev/engine/hotspots.h @@ -25,13 +25,13 @@ void hotspots_do (void) { if (p_objs == 0) { p_objs ++; #ifdef MODE_128K - wyz_play_sound (SFX_ONE_OBJECT_GET); + PLAY_SOUND (SFX_ONE_OBJECT_GET); #else beep_fx (9); #endif } else { #ifdef MODE_128K - wyz_play_sound (SFX_ONE_OBJECT_WRONG); + PLAY_SOUND (SFX_ONE_OBJECT_WRONG); #else beep_fx (4); #endif @@ -45,7 +45,7 @@ void hotspots_do (void) { #endif #ifdef MODE_128K - wyz_play_sound (SFX_OBJECT_GET); + PLAY_SOUND (SFX_OBJECT_GET); #else beep_fx (9); #endif @@ -70,7 +70,7 @@ void hotspots_do (void) { case 2: p_keys ++; #ifdef MODE_128K - wyz_play_sound (SFX_KEY_GET); + PLAY_SOUND (SFX_KEY_GET); #else beep_fx (7); #endif @@ -83,7 +83,7 @@ void hotspots_do (void) { if (p_life > PLAYER_LIFE) p_life = PLAYER_LIFE; #ifdef MODE_128K - wyz_play_sound (SFX_REFILL_GET); + PLAY_SOUND (SFX_REFILL_GET); #else beep_fx (8); #endif @@ -97,7 +97,7 @@ void hotspots_do (void) { else p_ammo = MAX_AMMO; #ifdef MODE_128K - wyz_play_sound (SFX_REFILL_GET); + PLAY_SOUND (SFX_REFILL_GET); #else beep_fx (9); #endif @@ -111,7 +111,7 @@ void hotspots_do (void) { else timer_t = 99; #ifdef MODE_128K - wyz_play_sound (SFX_REFILL_GET); + PLAY_SOUND (SFX_REFILL_GET); #else beep_fx (7); #endif @@ -122,7 +122,7 @@ void hotspots_do (void) { case 6: mem_save (); #ifdef MODE_128K - wyz_play_sound (SFX_START); + PLAY_SOUND (SFX_START); #else beep_fx (7); #endif diff --git a/trash/mlst/dev/engine/isr.h b/trash/mlst/dev/engine/isr.h new file mode 100644 index 00000000..76b5bf4a --- /dev/null +++ b/trash/mlst/dev/engine/isr.h @@ -0,0 +1,15 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// Very simple ISR which counts frames. + +#asm + defw 0 // 2 bytes libres +#endasm + +void ISR (void) { + #asm + ld hl, _isrc + inc (hl) + #endasm +} diff --git a/trash/mlst/dev/engine/player.h b/trash/mlst/dev/engine/player.h index 02467651..59844d68 100644 --- a/trash/mlst/dev/engine/player.h +++ b/trash/mlst/dev/engine/player.h @@ -404,7 +404,7 @@ unsigned char player_move (void) { p_saltando = 1; p_cont_salto = 0; #ifdef MODE_128K - wyz_play_sound (SFX_JUMP); + PLAY_SOUND (SFX_JUMP); #else beep_fx (3); #endif @@ -430,7 +430,7 @@ unsigned char player_move (void) { p_saltando = 1; p_cont_salto = 0; #ifdef MODE_128K - wyz_play_sound (SFX_JUMP); + PLAY_SOUND (SFX_JUMP); #else beep_fx (3); #endif @@ -725,19 +725,19 @@ unsigned char player_move (void) { } } - p_next_frame = player_cells [p_facing + p_frame]; + p_next_frame = (unsigned char *) (player_cells [p_facing + p_frame]); #elif defined PLAYER_BOOTEE gpit = p_facing << 2; if (p_vy == 0) { - p_next_frame = player_cells [gpit]; + p_next_frame = (unsigned char *) (player_cells [gpit]); } else if (p_vy < 0) { - p_next_frame = player_cells [gpit + 1]; + p_next_frame = (unsigned char *) (player_cells [gpit + 1]); } else { - p_next_frame = player_cells [gpit + 2]; + p_next_frame = (unsigned char *) (player_cells [gpit + 2]); } #else if (!possee && !p_gotten) { - p_next_frame = player_cells [8 + p_facing]; + p_next_frame = (unsigned char *) (player_cells [8 + p_facing]); } else { gpit = p_facing << 2; if (p_vx == 0) { @@ -745,7 +745,7 @@ unsigned char player_move (void) { } else { rda = ((gpx + 4) >> 3) & 3; } - p_next_frame = player_cells [gpit + rda]; + p_next_frame = (unsigned char *) (player_cells [gpit + rda]); } #endif } @@ -760,7 +760,7 @@ void player_kill (unsigned char sound) { player_deplete (); #ifdef MODE_128K - wyz_play_sound (sound); + PLAY_SOUND (sound); #else beep_fx (sound); #endif diff --git a/trash/mlst/dev/engine/player_wip.h b/trash/mlst/dev/engine/player_wip.h index 8c746184..815761a3 100644 --- a/trash/mlst/dev/engine/player_wip.h +++ b/trash/mlst/dev/engine/player_wip.h @@ -504,7 +504,7 @@ unsigned char player_move (void) { p_saltando = 1; p_cont_salto = 0; #ifdef MODE_128K - wyz_play_sound (SFX_JUMP); + PLAY_SOUND (SFX_JUMP); #else beep_fx (3); #endif @@ -530,7 +530,7 @@ unsigned char player_move (void) { p_saltando = 1; p_cont_salto = 0; #ifdef MODE_128K - wyz_play_sound (SFX_JUMP); + PLAY_SOUND (SFX_JUMP); #else beep_fx (3); #endif @@ -860,7 +860,7 @@ void player_kill (unsigned char sound) { player_deplete (); #ifdef MODE_128K - wyz_play_sound (sound); + PLAY_SOUND (sound); #else beep_fx (sound); #endif diff --git a/trash/mlst/dev/loader/loader.asm b/trash/mlst/dev/loader/loader.asm index 641a7155..ffcd0bae 100644 --- a/trash/mlst/dev/loader/loader.asm +++ b/trash/mlst/dev/loader/loader.asm @@ -49,7 +49,7 @@ scf ld a, $ff ld ix, 24000 - ld de, 21861 + ld de, 21360 call $0556 di diff --git a/trash/mlst/dev/mainloop.h b/trash/mlst/dev/mainloop.h index c2df34b6..9875ead0 100644 --- a/trash/mlst/dev/mainloop.h +++ b/trash/mlst/dev/mainloop.h @@ -12,7 +12,7 @@ void main (void) { di #endasm - #ifdef MODE_128K + #if defined MODE_128K || defined MIN_FAPS_PER_FRAME sp_InitIM2(0xf1f1); sp_CreateGenericISR(0xf1f1); sp_RegisterHook(255, ISR); @@ -20,8 +20,15 @@ void main (void) { #asm ei #endasm + #endif + + #ifdef MODE_128K + #ifdef USE_ARKOS_PLAYER + arkos_stop(); + #else + wyz_init (); + #endif - wyz_init (); #endif cortina (); @@ -48,13 +55,13 @@ void main (void) { // Sprite creation #ifdef NO_MASKS - sp_player = sp_CreateSpr (sp_OR_SPRITE, 3, sprite_2_a); + sp_player = sp_CreateSpr (NO_MASKS, 3, sprite_2_a); sp_AddColSpr (sp_player, sprite_2_b); sp_AddColSpr (sp_player, sprite_2_c); p_current_frame = p_next_frame = sprite_2_a; - for (gpit = 0; gpit < 3; gpit ++) { - sp_moviles [gpit] = sp_CreateSpr(sp_OR_SPRITE, 3, sprite_9_a); + for (gpit = 0; gpit < MAX_ENEMS; gpit ++) { + sp_moviles [gpit] = sp_CreateSpr(NO_MASKS, 3, sprite_9_a); sp_AddColSpr (sp_moviles [gpit], sprite_9_b); sp_AddColSpr (sp_moviles [gpit], sprite_9_c); en_an_current_frame [gpit] = sprite_9_a; @@ -154,7 +161,7 @@ void main (void) { } silent_level = 0; - prepare_level (level); + prepare_level (); #endif #ifndef DIRECT_TO_PLAY @@ -179,7 +186,7 @@ void main (void) { #ifdef COMPRESSED_LEVELS if (success) { #ifdef MODE_128K - //wyz_play_music (6); + //PLAY_MUSIC (6); #endif if (silent_level == 0) zone_clear (); @@ -203,7 +210,7 @@ void main (void) { } } else { #ifdef MODE_128K - //wyz_play_music (8); + //PLAY_MUSIC (8); #endif #if defined(TIMER_ENABLE) && defined(TIMER_GAMEOVER_0) && defined(SHOW_TIMER_OVER) @@ -213,7 +220,7 @@ void main (void) { #endif #ifdef MODE_128K - wyz_stop_sound (); + STOP_SOUND (); #endif break; } @@ -221,7 +228,7 @@ void main (void) { if (success) { game_ending (); } else { - //wyz_play_music (8); + //PLAY_MUSIC (8); game_over (); } #endif diff --git a/trash/mlst/dev/mainloop/flick_screen.h b/trash/mlst/dev/mainloop/flick_screen.h index c1c039b9..97b4515c 100644 --- a/trash/mlst/dev/mainloop/flick_screen.h +++ b/trash/mlst/dev/mainloop/flick_screen.h @@ -13,7 +13,7 @@ } #if defined (COMPRESSED_LEVELS) - if (gpx == 224 && p_vx > 0 && x_pant < (level_data->map_w - 1)) + if (gpx == 224 && p_vx > 0 && x_pant < (level_data.map_w - 1)) #else if (gpx == 224 && p_vx > 0 && x_pant < (MAP_W - 1)) #endif @@ -27,7 +27,7 @@ #if MAP_H > 1 if (gpy == 0 && p_vy < 0 && y_pant > 0) { #if defined (COMPRESSED_LEVELS) - n_pant -= level_data->map_w; + n_pant -= level_data.map_w; #else n_pant -= MAP_W; #endif @@ -37,8 +37,8 @@ } #if defined (COMPRESSED_LEVELS) - if (gpy == 144 && p_vy > 0 && y_pant < (level_data->map_h - 1)) { - n_pant += level_data->map_w; + if (gpy == 144 && p_vy > 0 && y_pant < (level_data.map_h - 1)) { + n_pant += level_data.map_w; #else if (gpy == 144 && p_vy > 0 && y_pant < (MAP_H - 1)) { n_pant += MAP_W; @@ -62,8 +62,8 @@ #if MAP_H > 1 #if defined (COMPRESSED_LEVELS) - if (gpy == 0 && p_vy < 0 && n_pant >= level_data->map_w) { - n_pant -= level_data->map_w; + if (gpy == 0 && p_vy < 0 && n_pant >= level_data.map_w) { + n_pant -= level_data.map_w; #else if (gpy == 0 && p_vy < 0 && n_pant >= MAP_W) { n_pant -= MAP_W; @@ -74,8 +74,8 @@ if (gpy == 144 && p_vy > 0) { // 9216 = 144 * 64 #if defined (COMPRESSED_LEVELS) - if (n_pant < level_data->map_w * (level_data->map_h - 1)) { - n_pant += level_data->map_w; + if (n_pant < level_data.map_w * (level_data.map_h - 1)) { + n_pant += level_data.map_w; #else if (n_pant < MAP_W * MAP_H - MAP_W) { n_pant += MAP_W; diff --git a/trash/mlst/dev/mainloop/game_loop.h b/trash/mlst/dev/mainloop/game_loop.h index b58b30c2..3f59e563 100644 --- a/trash/mlst/dev/mainloop/game_loop.h +++ b/trash/mlst/dev/mainloop/game_loop.h @@ -44,9 +44,9 @@ #ifdef MODE_128K // Play music #ifdef COMPRESSED_LEVELS - wyz_play_music (levels [level].music_id); + PLAY_MUSIC (levels [level].music_id); #else - wyz_play_music (1); + PLAY_MUSIC (1); #endif #endif @@ -76,8 +76,8 @@ #ifdef PLAYER_CHECK_MAP_BOUNDARIES #ifdef COMPRESSED_LEVELS - x_pant = n_pant % level_data->map_w; - y_pant = n_pant / level_data->map_w; + x_pant = n_pant % level_data.map_w; + y_pant = n_pant / level_data.map_w; #else x_pant = n_pant % MAP_W; y_pant = n_pant / MAP_W; #endif @@ -219,6 +219,23 @@ if (o_pant == n_pant) { #include "mainloop/update_sprites.h" + // Limit frame rate + + #ifdef MIN_FAPS_PER_FRAME + #asm + .ml_min_faps_loop + ld a, (_isrc) + cp MIN_FAPS_PER_FRAME + jr nc, ml_min_faps_loop_end + halt + jr ml_min_faps_loop + + .ml_min_faps_loop_end + xor a + ld (_isrc), a + #endasm + #endif + sp_UpdateNow(); } @@ -242,7 +259,7 @@ if (sp_KeyPressed (KEY_Z)) { if (!key_z_pressed) { #ifdef MODE_128K - wyz_play_sound (0); + PLAY_SOUND (0); #else beep_fx (2); #endif @@ -344,7 +361,7 @@ sp_WaitForNoKey (); #ifdef MODE_128K - wyz_stop_sound (); + STOP_SOUND (); #endif #include "my/ci/after_game_loop.h" diff --git a/trash/mlst/dev/mk1.c b/trash/mlst/dev/mk1.c index a1ca98d7..ba5f994d 100644 --- a/trash/mlst/dev/mk1.c +++ b/trash/mlst/dev/mk1.c @@ -59,7 +59,7 @@ #endif #endif -#define NUMBLOCKS (40 + (MAX_PROJECTILES * 5)) +#define NUMBLOCKS (((1 + MAX_ENEMS) * 10) + (MAX_PROJECTILES * 5)) unsigned char AD_FREE [NUMBLOCKS * 15]; @@ -95,9 +95,16 @@ unsigned char AD_FREE [NUMBLOCKS * 15]; #include "my/ci/extra_vars.h" #ifdef MODE_128K - #include "wyzplayer.h" + #ifdef USE_ARKOS_PLAYER + #include "sound/arkosplayer.h" + #else + #include "sound/wyzplayer.h" + #endif #else - #include "beeper.h" + #include "sound/beeper.h" + #ifdef MIN_FAPS_PER_FRAME + #include "engine/isr.h" + #endif #endif #include "printer.h" @@ -136,5 +143,5 @@ unsigned char AD_FREE [NUMBLOCKS * 15]; #ifndef MODE_128K // From beepola. Phaser engine by Shiru. - #include "music.h" + #include "sound/music.h" #endif diff --git a/trash/mlst/dev/mlst.tap b/trash/mlst/dev/mlst.tap index 1b737ead..fa9fe4db 100644 Binary files a/trash/mlst/dev/mlst.tap and b/trash/mlst/dev/mlst.tap differ diff --git a/trash/mlst/dev/my/config.h b/trash/mlst/dev/my/config.h index c137fc0e..5dc98d00 100644 --- a/trash/mlst/dev/my/config.h +++ b/trash/mlst/dev/my/config.h @@ -8,6 +8,9 @@ // ============================================================================ #define MODE_128K // Read the docs! +//#define MIN_FAPS_PER_FRAME 2 // Limits the max # of fps to 50/N +//#define USE_ARKOS_PLAYER // Use Arkos instead of Wyz player for 128k Music +//#define ARKOS_SFX_CHANNEL 0 // SFX Channel (0-2) //#define VENG_SELECTOR // Very advanced! //#define USE_MAP_CUSTOM_DECODER diff --git a/trash/mlst/dev/my/fixed_screens.h b/trash/mlst/dev/my/fixed_screens.h index 36e03655..e794b96d 100644 --- a/trash/mlst/dev/my/fixed_screens.h +++ b/trash/mlst/dev/my/fixed_screens.h @@ -36,7 +36,7 @@ void game_ending (void) { void game_over (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " GAME OVER! "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" GAME OVER! "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNow (); @@ -52,7 +52,7 @@ void game_over (void) { #if defined(TIMER_ENABLE) && defined(SHOW_TIMER_OVER) void time_over (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " TIME'S UP! "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" TIME'S UP! "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); @@ -69,7 +69,7 @@ void game_over (void) { #ifdef PAUSE_ABORT void pause_screen (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " PAUSED "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" PAUSED "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); } @@ -78,7 +78,7 @@ void game_over (void) { #ifdef COMPRESSED_LEVELS void zone_clear (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " ZONE CLEAR "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" ZONE CLEAR "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); espera_activa (250); diff --git a/trash/mlst/dev/my/msc.h b/trash/mlst/dev/my/msc.h index 0f5f5fb3..b16cfeec 100644 --- a/trash/mlst/dev/my/msc.h +++ b/trash/mlst/dev/my/msc.h @@ -135,7 +135,7 @@ void run_script (unsigned char whichs) { // readxy (); // sc_terminado = (flags [sc_x] != sc_y); #asm - call _read_two_bytes_d_e + call _read_two_bytes_D_E // Set sc_terminado if flags [C] != E ld b, 0 ld c, d @@ -199,9 +199,9 @@ void run_script (unsigned char whichs) { // MUSIC n sc_n = read_vbyte (); if (sc_n == 0xff) { - wyz_stop_sound (); + STOP_SOUND (); } else { - wyz_play_music (sc_n); + PLAY_MUSIC (sc_n); } break; case 0xF3: diff --git a/trash/mlst/dev/pantallas.h b/trash/mlst/dev/pantallas.h index b1fbc674..2734d92b 100644 --- a/trash/mlst/dev/pantallas.h +++ b/trash/mlst/dev/pantallas.h @@ -12,17 +12,17 @@ #asm ._s_title - BINARY "title.bin" + BINARY "..\bin\title.bin" ._s_marco #endasm #ifndef DIRECT_TO_PLAY #asm - BINARY "marco.bin" + BINARY "..\bin\marco.bin" #endasm #endif #asm ._s_ending - BINARY "ending.bin" + BINARY "..\bin\ending.bin" #endasm #endif diff --git a/trash/mlst/dev/prototypes.h b/trash/mlst/dev/prototypes.h index 62efd2b3..843aaf1a 100644 --- a/trash/mlst/dev/prototypes.h +++ b/trash/mlst/dev/prototypes.h @@ -7,6 +7,18 @@ #define ENABLE_SIMPLE_COCOS #endif +#ifdef MODE_128K + #ifdef USE_ARKOS_PLAYER + #define PLAY_MUSIC arkos_play_music + #define PLAY_SOUND arkos_play_sound + #define STOP_SOUND arkos_stop_sound + #else + #define PLAY_MUSIC wyz_play_music + #define PLAY_SOUND wyz_play_sound + #define STOP_SOUND wyz_stop_sound + #endif +#endif + // Engine // breakable.h @@ -113,9 +125,11 @@ void tilanims_add (void); void tilanims_do (void); void tilanims_reset (void); -// wyzplayer.h +#ifdef MODE_128K +// wyzplayer.h / arcos_player.h void ISR (void); -void wyz_init (void); -void wyz_play_sound (unsigned char fx_number); -void wyz_play_music (unsigned char song_number); -void wyz_stop_sound (void); +void INIT_PLAYER (void); +void PLAY_SOUND (unsigned char fx_number); +void PLAY_MUSIC (unsigned char song_number); +void STOP_SOUND (void); +#endif diff --git a/trash/mlst/dev/sound/arkos-addresses.h b/trash/mlst/dev/sound/arkos-addresses.h new file mode 100644 index 00000000..fa3225d7 --- /dev/null +++ b/trash/mlst/dev/sound/arkos-addresses.h @@ -0,0 +1,9 @@ +#define SFXS_SONG 0xd10c +#define ATINIT 0xc68c +#define ATPLAY 0xc000 +#define ATSFXINIT 0xc6f0 +#define ATSFXPLAY 0xc704 +#define ATSFXSTOP 0xc745 +#define ATSFXSTOPALL 0xc6f7 +#define ATSTOP 0xc6e1 +#define SONG_LIST 0xd5b7 diff --git a/trash/mlst/dev/sound/arkosplayer.h b/trash/mlst/dev/sound/arkosplayer.h new file mode 100644 index 00000000..c149b1b9 --- /dev/null +++ b/trash/mlst/dev/sound/arkosplayer.h @@ -0,0 +1,118 @@ +// MT Engine MK2 +// Copyleft 2014 the Mojon Twins + +// arkosplayer.h +// Arkos Player hook functions + +// This code is based on the original integration by Syx & Nightwolf +// In fact, this code IS the original integration by Syx & Nightwolf. +// I just changed the way params are passed (thanks @reidrac) +// I just automated the process & reindented to meet my own personal taste. + +#include "sound\arkos-addresses.h" + +// Start. + +// isr +#asm + defw 0 +#endasm + +void ISR(void) { + #asm + ld b, 1 + call SetRAMBank + call ATPLAY + ld b, 0 + call SetRAMBank + + ld hl, _isrc + inc (hl) + #endasm +} + +void arkos_stop (void) { + #asm + ld b, 1 + call SetRAMBank + ld a, 201 + ld (ATPLAY),A + ld b, 0 + call SetRAMBank + #endasm +} + +void __FASTCALL__ arkos_play_sound (unsigned char fx_number) { + #asm + di + ld b,1 + call SetRAMBank + + ; __FASTCALL__ -> fx_number is in l! + ld a, ARKOS_SFX_CHANNEL + ld h, 15 + ld e, 50 + ld d, 0 + ld bc, 0 + call ATSFXPLAY + + ld b,0 + call SetRAMBank + ei + #endasm +} + +void __FASTCALL__ arkos_play_music (unsigned char song_number) { + #asm + di + ld b, 1 + call SetRAMBank + + ; Reactivate sound generation + ld a, 175 + ld (ATPLAY),A + + ; Initialize song + ; __FASTCALL__ -> song_number is in l! + ld a, l + add a, a + ld hl, SONG_LIST + add a,l + jr nc, salta_inc_song + inc h + salta_inc_song: + ld l,a + ld e, (hl) + inc hl + ld d, (hl) + + call ATINIT + + ld de, SFXS_SONG + call ATSFXINIT + + ld b, 0 + call SetRAMBank + ei + #endasm +} + +void arkos_stop_sound (void) +{ + #asm + di + ld b,1 + call SetRAMBank + + call ATSFXSTOPALL + call ATSTOP + + ; Turn off sound generation + ld a,201 + ld (ATPLAY),A + + ld b,0 + call SetRAMBank + ei + #endasm +} diff --git a/examples/goddess/dev/beeper.h b/trash/mlst/dev/sound/beeper.h similarity index 99% rename from examples/goddess/dev/beeper.h rename to trash/mlst/dev/sound/beeper.h index 69f36202..e0ac0cc0 100644 --- a/examples/goddess/dev/beeper.h +++ b/trash/mlst/dev/sound/beeper.h @@ -208,7 +208,7 @@ push bc ;.frq=$+1 ; ld bc,2*256+200 - defb #01 ;ld bc + defb 1 ;ld bc .frq defb 200 ;+200 defb 2 ;2*256 diff --git a/trash/mlst/dev/sound/music.h b/trash/mlst/dev/sound/music.h new file mode 100644 index 00000000..db6c2b4b --- /dev/null +++ b/trash/mlst/dev/sound/music.h @@ -0,0 +1,655 @@ +#asm +; ***************************************************************************** +; * Phaser1 Engine, with synthesised drums +; * +; * Original code by Shiru - .HTTP//shiru.UNTERGRUND.NET/ +; * Modified by Chris Cowley +; * +; * Produced by Beepola v1.05.01 +; ****************************************************************************** + +.musicstart + LD HL,MUSICDATA ; <- Pointer to Music Data. change + ; this to play a different song + LD A,(HL) ; Get the loop start pointer + LD (PATTERN_LOOP_BEGIN),A + INC HL + LD A,(HL) ; Get the song end pointer + LD (PATTERN_LOOP_END),A + INC HL + LD E,(HL) + INC HL + LD D,(HL) + INC HL + LD (INSTRUM_TBL),HL + LD (CURRENT_INST),HL + ADD HL,DE + LD (PATTERN_ADDR),HL + XOR A + LD (PATTERN_PTR),A ; Set the pattern pointer to zero + LD H,A + LD L,A + LD (NOTE_PTR),HL ; Set the note offset (within this pattern) to 0 + +.PLAYER + ;DI + PUSH IY + ;LD A,BORDER_COL + xor a + LD H,$00 + LD L,A + LD (CNT_1A),HL + LD (CNT_1B),HL + LD (DIV_1A),HL + LD (DIV_1B),HL + LD (CNT_2),HL + LD (DIV_2),HL + LD (OUT_1),A + LD (OUT_2),A + JR MAIN_LOOP + +; ******************************************************************************************************** +; * NEXT_PATTERN +; * +; * Select the next pattern in sequence (and handle looping if weve reached PATTERN_LOOP_END +; * Execution falls through to PLAYNOTE to play the first note from our next pattern +; ******************************************************************************************************** +.NEXT_PATTERN + LD A,(PATTERN_PTR) + INC A + INC A + DEFB $FE ; CP n +.PATTERN_LOOP_END defb 0 + JR NZ,NO_PATTERN_LOOP + ; Handle Pattern Looping at and of song + DEFB $3E ; LD A,n +.PATTERN_LOOP_BEGIN defb 0 +.NO_PATTERN_LOOP ld (PATTERN_PTR),a + LD HL,$0000 + LD (NOTE_PTR),HL ; Start of pattern (NOTE_PTR = 0) + +.MAIN_LOOP + LD IYL,0 ; Set channel = 0 + +.READ_LOOP + LD HL,(PATTERN_ADDR) + LD A,(PATTERN_PTR) + LD E,A + LD D,0 + ADD HL,DE + LD E,(HL) + INC HL + LD D,(HL) ; Now DE = Start of Pattern data + LD HL,(NOTE_PTR) + INC HL ; Increment the note pointer and... + LD (NOTE_PTR),HL ; ..STORE it + DEC HL + ADD HL,DE ; Now HL = address of note data + LD A,(HL) + OR A + JR Z,NEXT_PATTERN ; select next pattern + + BIT 7,A + JP Z,RENDER ; Play the currently defined note(S) and drum + LD IYH,A + AND $3F + CP $3C + JP NC,OTHER ; Other parameters + ADD A,A + LD B,0 + LD C,A + LD HL,FREQ_TABLE + ADD HL,BC + LD E,(HL) + INC HL + LD D,(HL) + LD A,IYL ; IYL = 0 for channel 1, or = 1 for channel 2 + OR A + JR NZ,SET_NOTE2 + LD (DIV_1A),DE + EX DE,HL + + DEFB $DD,$21 ; LD IX,nn +.CURRENT_INST + DEFW $0000 + + LD A,(IX+$00) + OR A + JR Z,L809B ; Original code jumps into byte 2 of the DJNZ (invalid opcode FD) + LD B,A +.L8098 add hl,hl + DJNZ L8098 +.L809B ld e,(ix+$01) + LD D,(IX+$02) + ADD HL,DE + LD (DIV_1B),HL + LD IYL,1 ; Set channel = 1 + LD A,IYH + AND $40 + JR Z,READ_LOOP ; No phase reset + + LD HL,OUT_1 ; Reset phaser + RES 4,(HL) + LD HL,$0000 + LD (CNT_1A),HL + LD H,(IX+$03) + LD (CNT_1B),HL + JR READ_LOOP + +.SET_NOTE2 + LD (DIV_2),DE + LD A,IYH + LD HL,OUT_2 + RES 4,(HL) + LD HL,$0000 + LD (CNT_2),HL + JP READ_LOOP + +.SET_STOP + LD HL,$0000 + LD A,IYL + OR A + JR NZ,SET_STOP2 + ; Stop channel 1 note + LD (DIV_1A),HL + LD (DIV_1B),HL + LD HL,OUT_1 + RES 4,(HL) + LD IYL,1 + JP READ_LOOP +.SET_STOP2 + ; Stop channel 2 note + LD (DIV_2),HL + LD HL,OUT_2 + RES 4,(HL) + JP READ_LOOP + +.OTHER cp $3c + JR Z,SET_STOP ; Stop note + CP $3E + JR Z,SKIP_CH1 ; No changes to channel 1 + INC HL ; Instrument change + LD L,(HL) + LD H,$00 + ADD HL,HL + LD DE,(NOTE_PTR) + INC DE + LD (NOTE_PTR),DE ; Increment the note pointer + + DEFB $01 ; LD BC,nn +.INSTRUM_TBL + DEFW $0000 + + ADD HL,BC + LD (CURRENT_INST),HL + JP READ_LOOP + +.SKIP_CH1 + LD IYL,$01 + JP READ_LOOP + +.EXIT_PLAYER + LD HL,$2758 + EXX + POP IY + ;EI + RET + +.RENDER + AND $7F ; L813A + CP $76 + JP NC,DRUMS + LD D,A + EXX + DEFB $21 ; LD HL,nn +.CNT_1A defw $0000 + DEFB $DD,$21 ; LD IX,nn +.CNT_1B defw $0000 + DEFB $01 ; LD BC,nn +.DIV_1A defw $0000 + DEFB $11 ; LD DE,nn +.DIV_1B defw $0000 + DEFB $3E ; LD A,n +.OUT_1 defb $0 + EXX + EX AF,AF ; beware! + DEFB $21 ; LD HL,nn +.CNT_2 defw $0000 + DEFB $01 ; LD BC,nn +.DIV_2 defw $0000 + DEFB $3E ; LD A,n +.OUT_2 defb $00 + +.PLAY_NOTE + ; Read keyboard + LD E,A + XOR A + IN A,($FE) + OR $E0 + INC A + +.PLAYER_WAIT_KEY + JR NZ,EXIT_PLAYER + LD A,E + LD E,0 + +.L8168 exx + EX AF,AF ; beware! + ADD HL,BC + OUT ($FE),A + JR C,L8171 + JR L8173 +.L8171 xor $10 +.L8173 add ix,de + JR C,L8179 + JR L817B +.L8179 xor $10 +.L817B ex af,af ; beware! + OUT ($FE),A + EXX + ADD HL,BC + JR C,L8184 + JR L8186 +.L8184 xor $10 +.L8186 nop + JP L818A + +.L818A exx + EX AF,AF ; beware! + ADD HL,BC + OUT ($FE),A + JR C,L8193 + JR L8195 +.L8193 xor $10 +.L8195 add ix,de + JR C,L819B + JR L819D +.L819B xor $10 +.L819D ex af,af ; beware! + OUT ($FE),A + EXX + ADD HL,BC + JR C,L81A6 + JR L81A8 +.L81A6 xor $10 +.L81A8 nop + JP L81AC + +.L81AC exx + EX AF,AF ; beware! + ADD HL,BC + OUT ($FE),A + JR C,L81B5 + JR L81B7 +.L81B5 xor $10 +.L81B7 add ix,de + JR C,L81BD + JR L81BF +.L81BD xor $10 +.L81BF ex af,af ; beware! + OUT ($FE),A + EXX + ADD HL,BC + JR C,L81C8 + JR L81CA +.L81C8 xor $10 +.L81CA nop + JP L81CE + +.L81CE exx + EX AF,AF ; beware! + ADD HL,BC + OUT ($FE),A + JR C,L81D7 + JR L81D9 +.L81D7 xor $10 +.L81D9 add ix,de + JR C,L81DF + JR L81E1 +.L81DF xor $10 +.L81E1 ex af,af ; beware! + OUT ($FE),A + EXX + ADD HL,BC + JR C,L81EA + JR L81EC +.L81EA xor $10 + +.L81EC dec e + JP NZ,L8168 + + EXX + EX AF,AF ; beware! + ADD HL,BC + OUT ($FE),A + JR C,L81F9 + JR L81FB +.L81F9 xor $10 +.L81FB add ix,de + JR C,L8201 + JR L8203 +.L8201 xor $10 +.L8203 ex af,af ; beware! + OUT ($FE),A + EXX + ADD HL,BC + JR C,L820C + JR L820E +.L820C xor $10 + +.L820E dec d + JP NZ,PLAY_NOTE + + LD (CNT_2),HL + LD (OUT_2),A + EXX + EX AF,AF ; beware! + LD (CNT_1A),HL + LD (CNT_1B),IX + LD (OUT_1),A + JP MAIN_LOOP + +; ************************************************************ +; * DRUMS - Synthesised +; ************************************************************ +.DRUMS + ADD A,A ; On entry A=$75+Drum number (i.E. $76 to $7e) + LD B,0 + LD C,A + LD HL,DRUM_TABLE - 236 + ADD HL,BC + LD E,(HL) + INC HL + LD D,(HL) + EX DE,HL + JP (HL) + +.DRUM_TONE1 ld l,16 + JR DRUM_TONE +.DRUM_TONE2 ld l,12 + JR DRUM_TONE +.DRUM_TONE3 ld l,8 + JR DRUM_TONE +.DRUM_TONE4 ld l,6 + JR DRUM_TONE +.DRUM_TONE5 ld l,4 + JR DRUM_TONE +.DRUM_TONE6 ld l,2 +.DRUM_TONE + LD DE,3700 + LD BC,$0101 + //LD A,BORDER_COL + xor a +.DT_LOOP0 out ($fe),a + DEC B + JR NZ,DT_LOOP1 + XOR 16 + LD B,C + EX AF,AF ; beware! + LD A,C + ADD A,L + LD C,A + EX AF,AF ; beware! +.DT_LOOP1 dec e + JR NZ,DT_LOOP0 + DEC D + JR NZ,DT_LOOP0 + JP MAIN_LOOP + +.DRUM_NOISE1 ld de,2480 + LD IXL,1 + JR DRUM_NOISE +.DRUM_NOISE2 ld de,1070 + LD IXL,10 + JR DRUM_NOISE +.DRUM_NOISE3 ld de,365 + LD IXL,101 +.DRUM_NOISE + LD H,D + LD L,E + //LD A,BORDER_COL + xor a + LD C,A +.DN_LOOP0 ld a,(hl) + AND 16 + OR C + OUT ($FE),A + LD B,IXL +.DN_LOOP1 djnz DN_LOOP1 + INC HL + DEC E + JR NZ,DN_LOOP0 + DEC D + JR NZ,DN_LOOP0 + JP MAIN_LOOP + +.PATTERN_ADDR defw $0000 +.PATTERN_PTR defb 0 +.NOTE_PTR defw $0000 + +; ************************************************************** +; * Frequency Table +; ************************************************************** +.FREQ_TABLE + DEFW 178,189,200,212,225,238,252,267,283,300,318,337 + DEFW 357,378,401,425,450,477,505,535,567,601,637,675 + DEFW 715,757,802,850,901,954,1011,1071,1135,1202,1274,1350 + DEFW 1430,1515,1605,1701,1802,1909,2023,2143,2270,2405,2548,2700 + DEFW 2860,3030,3211,3402,3604,3818,4046,4286,4541,4811,5097,5400 + +; ***************************************************************** +; * Synth Drum Lookup Table +; ***************************************************************** +.DRUM_TABLE + DEFW DRUM_TONE1,DRUM_TONE2,DRUM_TONE3,DRUM_TONE4,DRUM_TONE5,DRUM_TONE6 + DEFW DRUM_NOISE1,DRUM_NOISE2,DRUM_NOISE3 + + +.MUSICDATA + DEFB 0 ; Pattern loop begin * 2 + DEFB 6 ; Song length * 2 + DEFW 4 ; Offset to start of song (length of instrument table) + DEFB 1 ; Multiple + DEFW 0 ; Detune + DEFB 0 ; Phase + +.PATTERNDATA defw PAT0 + DEFW PAT1 + DEFW PAT1 + +; *** Pattern data - $00 marks the end of a pattern *** +.PAT0 + DEFB $BD,0 + DEFB 157 + DEFB 145 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 9 + DEFB 157 + DEFB 145 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 9 + DEFB 157 + DEFB 145 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 9 + DEFB 157 + DEFB 145 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 3 + DEFB 159 + DEFB 147 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 3 + DEFB 156 + DEFB 144 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 9 + DEFB 156 + DEFB 144 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 9 + DEFB 156 + DEFB 144 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 9 + DEFB 156 + DEFB 144 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 3 + DEFB 159 + DEFB 147 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 3 + DEFB 157 + DEFB 145 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 9 + DEFB 157 + DEFB 145 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 9 + DEFB 157 + DEFB 145 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 9 + DEFB 157 + DEFB 145 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 3 + DEFB 159 + DEFB 147 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 3 + DEFB 156 + DEFB 144 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 9 + DEFB 156 + DEFB 144 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 3 + DEFB 159 + DEFB 147 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 3 + DEFB 157 + DEFB 145 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 9 + DEFB 157 + DEFB 145 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 9 + DEFB $00 +.PAT1 + DEFB 145 + DEFB 180 + DEFB 3 + DEFB 188 + DEFB 180 + DEFB 3 + DEFB 190 + DEFB 188 + DEFB 6 + DEFB 145 + DEFB 180 + DEFB 3 + DEFB 188 + DEFB 180 + DEFB 3 + DEFB 190 + DEFB 188 + DEFB 6 + DEFB 145 + DEFB 180 + DEFB 3 + DEFB 147 + DEFB 181 + DEFB 3 + DEFB 144 + DEFB 178 + DEFB 3 + DEFB 190 + DEFB 178 + DEFB 3 + DEFB 188 + DEFB 3 + DEFB 190 + DEFB 188 + DEFB 6 + DEFB 144 + DEFB 178 + DEFB 3 + DEFB 188 + DEFB 178 + DEFB 3 + DEFB 190 + DEFB 188 + DEFB 6 + DEFB 144 + DEFB 178 + DEFB 3 + DEFB 188 + DEFB 178 + DEFB 3 + DEFB 190 + DEFB 188 + DEFB 6 + DEFB 144 + DEFB 178 + DEFB 3 + DEFB 145 + DEFB 180 + DEFB 3 + DEFB 147 + DEFB 181 + DEFB 3 + DEFB 145 + DEFB 180 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 9 + DEFB $00 + +#endasm \ No newline at end of file diff --git a/trash/mlst/dev/sound/wyzplayer.h b/trash/mlst/dev/sound/wyzplayer.h new file mode 100644 index 00000000..b06fedd7 --- /dev/null +++ b/trash/mlst/dev/sound/wyzplayer.h @@ -0,0 +1,91 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// WYZ player hook functions + +// WYZ player and songs are loaded into RAM 1 ($C000). +// In each interrupt, we just page in RAM 1, call the player, +// then page back RAM 0 and exit. + +// The player is, thus, compiled to $C000, and its addresses +// are: + +#define WYZPLAYERINIT 0xC018 // INIT_BUFFERS EQU 0C018H +#define WYZPLAYERISR 0xC000 // INICIO EQU 0C000H +#define INICIAEFECTO 0xC47E // INICIA_EFECTO EQU 0C46BH +#define CARGA_CANCION 0xC087 // CARGA_CANCION EQU 0C087H +#define SILENCIA_PLAYER 0xC062 // PLAYER_OFF EQU 0C062H + +// Start. + +// isr +#asm + defw 0 // 2 bytes libres +#endasm + +void ISR(void) { + #asm + ld a, (_player_on) + or a + ret z + ld b, 1 + call SetRAMBank + call WYZPLAYERISR + ld b, 0 + call SetRAMBank + + ld hl, _isrc + inc (hl) + #endasm +} + +void wyz_init (void) { + #asm + ld b,1 + call SetRAMBank + call WYZPLAYERINIT + ld b,0 + call SetRAMBank + #endasm +} + +void __FASTCALL__ wyz_play_sound (unsigned char fx_number) { + #asm + di + ld b, 1 + call SetRAMBank + ; __FASTCALL__ -> fx_number is in l! + ld b, l + call INICIAEFECTO + ld b, 0 + call SetRAMBank + ei + #endasm +} + +void __FASTCALL__ wyz_play_music (unsigned char song_number) { + #asm + di + ld b, 1 + call SetRAMBank + ; __FASTCALL__ -> song_number is in l! + ld a, l + call CARGA_CANCION + ld b, 0 + call SetRAMBank + ei + #endasm + song_playing = song_number; +} + +void wyz_stop_sound (void) { + #asm + di + ld b,1 + call SetRAMBank + call SILENCIA_PLAYER + ld b,0 + call SetRAMBank + ei + #endasm +} diff --git a/trash/mlst/dev/zcc_opt.def b/trash/mlst/dev/zcc_opt.def deleted file mode 100644 index 4e0a9518..00000000 --- a/trash/mlst/dev/zcc_opt.def +++ /dev/null @@ -1,8 +0,0 @@ - -IF !DEFINED_STACKPTR - defc DEFINED_STACKPTR = 1 - defc STACKPTR = 23999 -ENDIF - - DEFINE DEFINED_myzorg - defc myzorg = 24000 diff --git a/trash/mlst/script/msc.h b/trash/mlst/script/msc.h index 0f5f5fb3..b16cfeec 100644 --- a/trash/mlst/script/msc.h +++ b/trash/mlst/script/msc.h @@ -135,7 +135,7 @@ void run_script (unsigned char whichs) { // readxy (); // sc_terminado = (flags [sc_x] != sc_y); #asm - call _read_two_bytes_d_e + call _read_two_bytes_D_E // Set sc_terminado if flags [C] != E ld b, 0 ld c, d @@ -199,9 +199,9 @@ void run_script (unsigned char whichs) { // MUSIC n sc_n = read_vbyte (); if (sc_n == 0xff) { - wyz_stop_sound (); + STOP_SOUND (); } else { - wyz_play_music (sc_n); + PLAY_MUSIC (sc_n); } break; case 0xF3: