-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial public commit, PARTY VERSION SHITCODE BEWARE
- Loading branch information
Showing
138 changed files
with
24,047 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,92 @@ | ||
# hwmf | ||
Soon. | ||
PARTY VERSION! | ||
|
||
Credits where credits are due: | ||
============================== | ||
|
||
The following 3rd party resources were used: | ||
|
||
pmf_player - https://github.com/JarkkoPFC/arduino-music-player/ | ||
exomizer - https://bitbucket.org/magli143/exomizer | ||
|
||
Colors for the screen border during the C64/Amiga-ish part were sampled from | ||
"A1000" by J.O.E, see http://artcity.bitfellas.org/index.php?a=show&id=11210 | ||
|
||
3x5 by memesbruh03 - https://www.dafont.com/3x5-2.font | ||
Perfect DOS VGA by Zeh Fernando - https://www.dafont.com/perfect-dos-vga-437.font | ||
A500 Topaz font, TTF file of unknown origin | ||
|
||
|
||
How to compile the thing | ||
======================== | ||
|
||
The easiest way is to get Arduino IDE. | ||
See https://www.arduino.cc/en/Main/Software | ||
|
||
Load democode.ino in the Arduino IDE, compile it, flash it, done. | ||
Possibly read the comments in democode.ino in case the compiler is too old | ||
or does not like the code and refuses to compile it. | ||
|
||
Settings: | ||
|
||
Board: "Arduino/Genuino Mega or Mega 2560" | ||
Processor: ATmega2560 | ||
(5V 16 MHz if that's a choice) | ||
|
||
Note that the code in the source archive is the party version; | ||
it's horrible and hacky and fixed to work just before the deadline, | ||
and it's likely i'll clean it up a bit later. | ||
|
||
See https://github.com/fgenesis/hwmf for up-to-date code. | ||
|
||
|
||
Getting audio out | ||
================== | ||
|
||
Audio is output to OCR0A (Pin #13) and OCR0B (Pin #4). | ||
This demo has mono audio so either one works. | ||
Stereo is a future possibility so in case you're building an add-on board | ||
you might plan ahead for that. | ||
|
||
Connect it like this: | ||
|
||
Pin 4 o-----||-----> left audio channel | ||
Pin 13 o-----||-----> right audio channel | ||
Any GND pin directly to the audio GND. | ||
|
||
As insulating capacitors ||, 1.0 µF works fine. Something close to that probably too. | ||
Don't connect the pins directly to the audio, they are at 0-5V level | ||
(instead of approx. -1..+1V that analog audio usually has) and the receiving device | ||
might be unhappy about that (magic smoke worst case). The caps make this a lot safer, | ||
and it also sounds much better as they center the signal around GND. | ||
|
||
The on-board LED is also connected to Pin #13 so if you see it pulse a little after a | ||
few seconds after reset, that's an indication it's playing audio correctly. | ||
|
||
|
||
Changing the display controller | ||
=============================== | ||
|
||
The binaries in this release archive are compiled for the ILI9481 display controller. | ||
There is (untested) support for ILI9486 and HX8357C as well, so if you have those, | ||
go to democode/src/demolib/cfg-demo.h, look for this: | ||
|
||
typedef fglcd::preset::ILI9481_Mega_Shield LCD; | ||
|
||
and change it to | ||
|
||
typedef fglcd::preset::ILI9486_Mega_Shield LCD; | ||
-or- | ||
typedef fglcd::preset::HX8357C_Mega_Shield LCD; | ||
|
||
In case your display controller is 480x320 but none of the above, | ||
feel free to contact me and I might add support for your controller. | ||
Alternatively create a new type describing the controller and add the init code | ||
required to start up the display. In case you do this, please send me a pull request | ||
so the display library can support more controllers! | ||
|
||
Those MIPI displays are pretty compatible so it should work just fine after | ||
it's set up properly with the correct initcode. | ||
|
||
|
||
-- fgenesis, | ||
for Revision 2020 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
#include "cbm64.h" | ||
#include "src/demolib/decomp.h" | ||
#include "data.h" | ||
|
||
#ifdef __GNUC__ | ||
#pragma GCC optimize ("Os") | ||
#endif | ||
|
||
typedef LCD::PixelPos PixelPos; | ||
typedef LCD::ColorType Color; | ||
typedef LCD::DimType DimType; | ||
|
||
static void loadbuf(void *dst, fglcd::FarPtr src, unsigned pksz) | ||
{ | ||
decompressRAM<PK_EXO, CBM64Font::size_unpacked, fglcd::ProgmemFar>(dst, src, pksz); | ||
} | ||
|
||
void CBM64Font::loadCharset1() | ||
{ | ||
loadbuf(_data, fglcd_get_farptr(data_exo_cbm1), Countof(data_exo_cbm1)); | ||
} | ||
|
||
void CBM64Font::loadCharset2() | ||
{ | ||
loadbuf(_data, fglcd_get_farptr(data_exo_cbm2), Countof(data_exo_cbm2)); | ||
} | ||
|
||
void CBM64Font::drawchar(char c, const LCD::ColorType fg, const LCD::ColorType bg) const | ||
{ | ||
typename fglcd::RAM::Pointer fp = _data + uint16_t(uint8_t(c)) * 8u; | ||
for(uint8_t yy = 0; yy < 8; ++yy) | ||
{ | ||
uint8_t dat = fglcd::RAM::readIncFast(fp); | ||
|
||
FGLCD_REP_8({ | ||
LCD::sendPixel(dat & 0x80 ? fg : bg); | ||
dat <<= 1u; | ||
}); | ||
} | ||
} | ||
|
||
LCD::PixelPos CBM64Font::drawbuf(const uint8_t * s, unsigned len, LCD::DimType x, LCD::DimType y, const LCD::ColorType fg, const LCD::ColorType bg) const | ||
{ | ||
const DimType startx = x; | ||
DimType endy = y + 7; | ||
while(len--) | ||
{ | ||
const uint8_t c = fglcd::RAM::readIncFast(s); | ||
if(UNLIKELY(c == '\n' || x >= LCD::WIDTH-8)) | ||
{ | ||
y += 8; | ||
endy += 8; | ||
x = startx; | ||
if(c == '\n') | ||
continue; | ||
} | ||
|
||
LCD::setxy_inl(x, y, x+7, endy); | ||
drawchar(c, fg, bg); | ||
x += 8; | ||
} | ||
return PixelPos(x,y); | ||
} | ||
|
||
|
||
|
||
#if 0 | ||
template<typename FontMemory, typename StringMemory> | ||
static NOINLINE void drawfont_1bit_solid_8x8_columnwise(typename FontMemory::Pointer const fontdata, typename StringMemory::Pointer s, DimType x, DimType y, const ColorType fg, const ColorType bg) | ||
{ | ||
const DimType startx = x; | ||
u8 c; | ||
goto begin; | ||
while((c = StringMemory::template read<u8>(s++))) | ||
{ | ||
if(c != '\n' && (x+7) < WIDTH) | ||
{ | ||
const unsigned fontOffs = c * 8; | ||
for(u8 yy = 0; yy < 8; ++yy) | ||
{ | ||
u8 dat = FontMemory::template read<u8>(&fontdata[fontOffs + yy]); | ||
for(u8 xx = 0; xx < 8; ++xx, dat >>= 1) | ||
{ | ||
sendPixel(dat & 0x1 ? fg : bg); | ||
} | ||
} | ||
x += 8; | ||
} | ||
else | ||
{ | ||
y += 8; | ||
x = startx; | ||
begin: | ||
Chip::setxy_inl(y, x, y+7, XMAX); | ||
} | ||
} | ||
return PixelPos(x,y); | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#pragma once | ||
|
||
#include "src/demolib/demo_def.h" | ||
|
||
class CBM64Font | ||
{ | ||
public: | ||
static const unsigned size_unpacked = 0x800; | ||
void loadCharset1(); | ||
void loadCharset2(); | ||
void drawchar(char c, const LCD::ColorType fg, const LCD::ColorType bg) const; | ||
LCD::PixelPos drawbuf(const uint8_t *s, unsigned len, LCD::DimType x, LCD::DimType y, const LCD::ColorType fg, const LCD::ColorType bg) const; | ||
|
||
private: | ||
uint8_t _data[size_unpacked]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#pragma once | ||
#include "src/demolib/demo_def.h" | ||
#include "src/demolib/packdef.h" | ||
#include "src/demomath/fp8_8.h" | ||
#include "src/demomath/fp16_16.h" | ||
|
||
#ifdef MCU_IS_PC | ||
# define PGM_ALIGN(x) | ||
#else | ||
# define PGM_ALIGN(x) ALIGN(x) | ||
#endif | ||
|
Oops, something went wrong.