mirror of
https://gitlab.com/drummyfish/anarch.git
synced 2024-12-21 23:08:49 -05:00
Add nibble port
This commit is contained in:
parent
13bd114c24
commit
407ccbed25
@ -34,6 +34,7 @@ This game got some attention on 4chan: [1](https://archive.li/Yzcwt), [2](https:
|
|||||||
- Gamebino Meta (80 x 64, 48 MHz ARM, 32 KB RAM, 256 KB flash)
|
- Gamebino Meta (80 x 64, 48 MHz ARM, 32 KB RAM, 256 KB flash)
|
||||||
- Ringo/MAKERphone (160 x 128, 160 MHz ARM, 520 KB RAM, 4 MB flash)
|
- Ringo/MAKERphone (160 x 128, 160 MHz ARM, 520 KB RAM, 4 MB flash)
|
||||||
- ESPboy (128 x 128, 160 MHz)
|
- ESPboy (128 x 128, 160 MHz)
|
||||||
|
- Nibble (128 x 128, 160 MHz)
|
||||||
- unofficial [bare metal Raspberry Pi port](https://github.com/msx80/anarch-baremetalpi) by msx80
|
- unofficial [bare metal Raspberry Pi port](https://github.com/msx80/anarch-baremetalpi) by msx80
|
||||||
- Has **completely NO external dependencies**, not even rendering or IO, that is left to each platform's frontend, but each frontend is very simple. Uses **no dynamic heap allocation** (no malloc).
|
- Has **completely NO external dependencies**, not even rendering or IO, that is left to each platform's frontend, but each frontend is very simple. Uses **no dynamic heap allocation** (no malloc).
|
||||||
- Can fit into **less than 256 kb** (including all content, textures etc.).
|
- Can fit into **less than 256 kb** (including all content, textures etc.).
|
||||||
@ -74,6 +75,7 @@ compiled:
|
|||||||
| Gamebuino Meta | 215 KB | 18 | 80 * 64 | < 32 KB |
|
| Gamebuino Meta | 215 KB | 18 | 80 * 64 | < 32 KB |
|
||||||
| Ringo (MAKERphone) | 1.3 MB | 35 | 160 * 128 | |
|
| Ringo (MAKERphone) | 1.3 MB | 35 | 160 * 128 | |
|
||||||
| ESPboy | 376 KB | 22 | 128 * 128 | |
|
| ESPboy | 376 KB | 22 | 128 * 128 | |
|
||||||
|
| Nibble | 416 KB | 35 | 128 * 128 | |
|
||||||
| browser | 884 KB (whole output) | 35 | 512 * 320 | ~20 MB |
|
| browser | 884 KB (whole output) | 35 | 512 * 320 | ~20 MB |
|
||||||
|
|
||||||
system requirements:
|
system requirements:
|
||||||
|
BIN
bin/Anarch_nibble_1-02.bin
Normal file
BIN
bin/Anarch_nibble_1-02.bin
Normal file
Binary file not shown.
@ -303,6 +303,7 @@
|
|||||||
<li><a href="https://gitlab.com/drummyfish/anarch/-/raw/master/bin/Anarch_gbmeta_1-01.zip?inline=false">GB Meta</a></li>
|
<li><a href="https://gitlab.com/drummyfish/anarch/-/raw/master/bin/Anarch_gbmeta_1-01.zip?inline=false">GB Meta</a></li>
|
||||||
<li><a href="https://gitlab.com/drummyfish/anarch/-/raw/master/bin/Anarch_ringo_1-01d.zip?inline=false">Ringo</a></li>
|
<li><a href="https://gitlab.com/drummyfish/anarch/-/raw/master/bin/Anarch_ringo_1-01d.zip?inline=false">Ringo</a></li>
|
||||||
<li><a href="https://gitlab.com/drummyfish/anarch/-/raw/master/bin/Anarch_espboy_save_1-01d.bin?inline=false">ESPboy</a></li>
|
<li><a href="https://gitlab.com/drummyfish/anarch/-/raw/master/bin/Anarch_espboy_save_1-01d.bin?inline=false">ESPboy</a></li>
|
||||||
|
<li><a href="https://gitlab.com/drummyfish/anarch/-/raw/master/bin/Anarch_nibble_1-02d.bin?inline=false">Nibble</a></li>
|
||||||
<li><a href="https://gitlab.com/drummyfish/anarch/-/raw/master/bin/Anarch_winshitxp_sdl_1-01.zip?inline=false">M$ Win$hit XP SDL</a></li>
|
<li><a href="https://gitlab.com/drummyfish/anarch/-/raw/master/bin/Anarch_winshitxp_sdl_1-01.zip?inline=false">M$ Win$hit XP SDL</a></li>
|
||||||
<li><a href="https://gitlab.com/drummyfish/anarch/-/archive/master/anarch-master.zip">source code</a></li>
|
<li><a href="https://gitlab.com/drummyfish/anarch/-/archive/master/anarch-master.zip">source code</a></li>
|
||||||
<li><a href="https://gitlab.com/drummyfish/anarch/-/tree/master/bin">more downloads</a></li>
|
<li><a href="https://gitlab.com/drummyfish/anarch/-/tree/master/bin">more downloads</a></li>
|
||||||
|
149
main_nibble.ino
Normal file
149
main_nibble.ino
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
/**
|
||||||
|
@file main_nibble.ino
|
||||||
|
|
||||||
|
This is Nibble (CircuitMess) implementation of the game front end.
|
||||||
|
|
||||||
|
by Miloslav Ciz (drummyfish), 2021
|
||||||
|
|
||||||
|
Released under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/)
|
||||||
|
plus a waiver of all other intellectual property. The goal of this work is to
|
||||||
|
be and remain completely in the public domain forever, available for any use
|
||||||
|
whatsoever.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include <EEPROM.h>
|
||||||
|
#include <CircuitOS.h>
|
||||||
|
#include <Nibble.h>
|
||||||
|
|
||||||
|
#define PLUS_BRIGHTNESS 2 // this can be changed (max: 8)
|
||||||
|
|
||||||
|
#define SFG_AVR 1
|
||||||
|
|
||||||
|
#define SFG_SCREEN_RESOLUTION_X 128
|
||||||
|
#define SFG_SCREEN_RESOLUTION_Y 128
|
||||||
|
#define SFG_FPS 35
|
||||||
|
|
||||||
|
#define SFG_RAYCASTING_MAX_STEPS 20
|
||||||
|
#define SFG_RAYCASTING_SUBSAMPLE 2
|
||||||
|
#define SFG_DIMINISH_SPRITES 1
|
||||||
|
#define SFG_DITHERED_SHADOW 1
|
||||||
|
|
||||||
|
#define SFG_CAN_EXIT 0 /* If the game is compiled into loeader, this can be set
|
||||||
|
to 1 which will show the "exit" option in the menu. */
|
||||||
|
#include "game.h"
|
||||||
|
|
||||||
|
Display* display;
|
||||||
|
Sprite* sprite;
|
||||||
|
uint8_t buttons[7];
|
||||||
|
uint16_t paletteRAM[256];
|
||||||
|
|
||||||
|
void SFG_setPixel(uint16_t x, uint16_t y, uint8_t colorIndex)
|
||||||
|
{
|
||||||
|
sprite->drawPixel(x,y,paletteRAM[colorIndex]);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t SFG_getTimeMs()
|
||||||
|
{
|
||||||
|
return millis();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SFG_sleepMs(uint16_t timeMs)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int8_t SFG_keyPressed(uint8_t key)
|
||||||
|
{
|
||||||
|
return key < 7 ? buttons[key] : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SFG_getMouseOffset(int16_t *x, int16_t *y)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void SFG_setMusic(uint8_t value)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void SFG_save(uint8_t data[SFG_SAVE_SIZE])
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void SFG_processEvent(uint8_t event, uint8_t data)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t SFG_load(uint8_t data[SFG_SAVE_SIZE])
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SFG_playSound(uint8_t soundIndex, uint8_t volume)
|
||||||
|
{
|
||||||
|
switch (soundIndex)
|
||||||
|
{
|
||||||
|
case 0: Piezo.tone(120, 45); break; // shot
|
||||||
|
case 1: Piezo.tone(200, 30); break; // door
|
||||||
|
case 2: Piezo.tone(80, 60); break; // explosion
|
||||||
|
case 3: Piezo.tone(220, 50); break; // click
|
||||||
|
case 4: Piezo.tone(180, 60); break; // plasma
|
||||||
|
case 5: Piezo.tone(300, 10); break; // monster
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// create button callbacks:
|
||||||
|
|
||||||
|
#define cbf(b,n) void b ## _down() { buttons[n] = 255; } void b ## _up() { buttons[n] = 0; }
|
||||||
|
cbf(BTN_UP,0)
|
||||||
|
cbf(BTN_RIGHT,1)
|
||||||
|
cbf(BTN_DOWN,2)
|
||||||
|
cbf(BTN_LEFT,3)
|
||||||
|
cbf(BTN_A,4)
|
||||||
|
cbf(BTN_B,5)
|
||||||
|
cbf(BTN_C,6)
|
||||||
|
#undef cbf
|
||||||
|
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
Nibble.begin();
|
||||||
|
display = Nibble.getDisplay();
|
||||||
|
sprite = display->getBaseSprite();
|
||||||
|
|
||||||
|
SFG_init();
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < 7; ++i)
|
||||||
|
buttons[i] = 0;
|
||||||
|
|
||||||
|
// move palette to RAM plus increase brightness of the colors:
|
||||||
|
|
||||||
|
for (int i = 0; i < 256; ++i)
|
||||||
|
{
|
||||||
|
int helper = i % 8;
|
||||||
|
helper = (helper < 8 - PLUS_BRIGHTNESS) ? PLUS_BRIGHTNESS : (7 - helper);
|
||||||
|
paletteRAM[i] = pgm_read_word(paletteRGB565 + i + helper);
|
||||||
|
}
|
||||||
|
|
||||||
|
// register button callbacks:
|
||||||
|
|
||||||
|
#define cb(b) \
|
||||||
|
Input::getInstance()->setBtnPressCallback(b,b ## _down); \
|
||||||
|
Input::getInstance()->setBtnReleaseCallback(b,b ## _up);
|
||||||
|
|
||||||
|
cb(BTN_UP)
|
||||||
|
cb(BTN_DOWN)
|
||||||
|
cb(BTN_LEFT)
|
||||||
|
cb(BTN_RIGHT)
|
||||||
|
cb(BTN_A)
|
||||||
|
cb(BTN_B)
|
||||||
|
cb(BTN_C)
|
||||||
|
|
||||||
|
#undef cb
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
Input::getInstance()->loop(0);
|
||||||
|
SFG_mainLoopBody();
|
||||||
|
display->commit();
|
||||||
|
}
|
BIN
media/nibble.gif
Normal file
BIN
media/nibble.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 MiB |
Loading…
Reference in New Issue
Block a user