다마고치 연구소 한국어판 소스 공개
This commit is contained in:
commit
db23855630
661 files changed
+503597
No files matched your search
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
# Build the Paramix field switch (feld.bin, runs from PRAM 0)
|
||||
set -e
|
||||
cd "$(dirname "$0")"
|
||||
CF="--target=thumbv7m-none-eabi -mcpu=cortex-m3 -mthumb -flto -ffreestanding -nostdlib -Oz -fno-common -Wall -Wno-initializer-overrides -Wno-unused-const-variable -fno-builtin-memset -DTONE_FIX -DBL_BLACK -DBL_OFFFIX -DBL_SLEEP -DFAST_LCD -DLCD_FASTCLK -DCLEAN -DPARA_BACK -DPARA_MB_KEEP -DPARA_FLASH -DPARA_FLASH_LATE -DFELD_AUTO -DFELD_BFALL -DFELD_BFALL_NOA -DCLEAN_AUTO -DBAT_SHOW -DBAG_DEL -DFELD_PW -DFELD_TAMA_ANY -DFELD_NOCLK -DFELD_BSETTLE -DFELD_SEEN $XCF"
|
||||
O=""
|
||||
for f in main-ko.c hw.c libc.c flash.c; do n=$(basename $f .c); OPT=; [ "$n" = main-ko ] && OPT=-Oz; clang $CF $OPT -c $f -o $n.o; O="$O $n.o"; done # 1.6.8: main with -Oz (menu code, size before speed)
|
||||
N=${OUT:-feld-ko}
|
||||
ld.lld -T link.ld --no-rosegment $O -o $N.elf
|
||||
llvm-objcopy -O binary -j .text $N.elf $N.bin
|
||||
python3 -c 'import pathlib,sys; p=pathlib.Path(sys.argv[1]); p.write_bytes(p.read_bytes()+b"ITOSM_KO_MENU_V1\x00")' "$N.bin"
|
||||
llvm-size $N.elf; ls -l $N.bin
|
||||
# 1.7.2 CLEAN_ROM: a second build for ROMs without the Paradise (own clock); the start device keeps the build above
|
||||
if [ -z "$XCF" ]; then XCF=-DFELD_CLEAN OUT=feldc-ko sh ./build-ko.sh --inner; fi
|
||||
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
# Build the Paramix field switch (feld.bin, runs from PRAM 0)
|
||||
set -e
|
||||
cd "$(dirname "$0")"
|
||||
CF="--target=thumbv7m-none-eabi -mcpu=cortex-m3 -mthumb -ffreestanding -nostdlib -Os -fno-common -Wall -Wno-initializer-overrides -Wno-unused-const-variable -fno-builtin-memset -DTONE_FIX -DBL_BLACK -DBL_OFFFIX -DBL_SLEEP -DFAST_LCD -DLCD_FASTCLK -DCLEAN -DPARA_BACK -DPARA_MB_KEEP -DPARA_FLASH -DPARA_FLASH_LATE -DFELD_AUTO -DFELD_BFALL -DFELD_BFALL_NOA -DCLEAN_AUTO -DBAT_SHOW -DBAG_DEL -DFELD_PW -DFELD_TAMA_ANY -DFELD_NOCLK -DFELD_BSETTLE -DFELD_SEEN $XCF"
|
||||
O=""
|
||||
for f in main.c hw.c libc.c flash.c; do n=$(basename $f .c); OPT=; [ "$n" = main ] && OPT=-Oz; clang $CF $OPT -c $f -o $n.o; O="$O $n.o"; done # 1.6.8: main with -Oz (menu code, size before speed)
|
||||
N=${OUT:-feld}
|
||||
ld.lld -T link.ld --no-rosegment $O -o $N.elf
|
||||
llvm-objcopy -O binary -j .text $N.elf $N.bin
|
||||
llvm-size $N.elf; ls -l $N.bin
|
||||
# 1.7.2 CLEAN_ROM: a second build for ROMs without the Paradise (own clock); the start device keeps the build above
|
||||
if [ -z "$XCF" ]; then XCF=-DFELD_CLEAN OUT=feldc sh "$0" --inner; fi
|
||||
@@ -0,0 +1,5 @@
|
||||
// Captured from the REAL Flash Utility (same PRAM/post-reset context as
|
||||
// our app). Order kept word for word. clk tail (reset release) first,
|
||||
// then display/GPIO/backlight registers.
|
||||
__attribute__((section(".initdata"))) static const unsigned int disp_power_seq[][2]={{0x45000020,0x40},{0x45000210,0x0},{0x45000214,0x0},{0x45000218,0x0},{0x45000204,0x0},{0x45000200,0xe0},{0x45000204,0x0},{0x45000200,0xe0},{0x45000020,0x42},{0x4003a000,0x8000},{0x4003a004,0x8000},{0x4003a004,0x8001},{0x40038000,0x0},{0x40038014,0xf0},{0x40038018,0xa001},{0x40038014,0xf0},{0x40038004,0x18005da0},{0x40038008,0xffc},{0x4003800c,0x1},{0x40038010,0x1},{0x40038000,0x10},{0x40038000,0x0},{0x40038014,0xf0},{0x40038018,0xa001},{0x40038014,0xf0},{0x40038004,0x18005da0},{0x40038008,0xffc},{0x4003800c,0x1},{0x40038010,0x1},{0x40038000,0x10},{0x40038000,0x0},{0x40038014,0xf0},{0x40038018,0xa001},{0x40038014,0xf0},{0x40038004,0x18000ba0},{0x40038008,0xffc},{0x4003800c,0x1},{0x40038010,0x1},{0x40038000,0x10},{0x40038000,0x0},{0x40007034,0x0},{0x40038000,0x0},{0x40038014,0xf0},{0x40038018,0xa001},{0x40038014,0xf0},{0x40038004,0x18000ba0},{0x40038008,0xffc},{0x4003800c,0x1},{0x40038010,0x1},{0x40038000,0x10},{0x40038000,0x0},{0x40038014,0xf0},{0x40038018,0xa001},{0x40038014,0xf0},{0x40038004,0x18005da0},{0x40038008,0xffc},{0x4003800c,0x1},{0x40038010,0x1},{0x40038000,0x10},{0x40038000,0x0},{0x40038014,0xf0},{0x40038018,0xa001},{0x40038014,0xf0},{0x40038004,0x18005da0},{0x40038008,0xffc},{0x4003800c,0x1},{0x40038010,0x1},{0x40038000,0x10},{0x40038000,0x0},{0x4001803c,0xffffffff},{0x4001903c,0xfffff5df},{0x4001a03c,0xffffffff},{0x40018004,0x30},{0x40018000,0xfffffffe},{0x40018008,0x15008a56},{0x40018004,0x30},{0x40018000,0xfffffffe},{0x40018008,0x15008a55},{0x40018004,0x30},{0x40018000,0xfffffffd},{0x40018008,0x15008a59},{0x40018004,0x30},{0x40018000,0xfffffffd},{0x40018008,0x15008a55},{0x40018004,0x30},{0x40018000,0xfffffffb},{0x40018008,0x15008a65},{0x40018004,0x30},{0x40018000,0xfffffffb},{0x40018008,0x15008a55},{0x40018004,0x30},{0x40018000,0xfffffff7},{0x40018008,0x15008a95},{0x40018004,0x30},{0x40018000,0xfffffff7},{0x40018008,0x15008a55},{0x40018004,0x20},{0x40018000,0xffffffef},{0x40018008,0x15008a55},{0x40018004,0x30},{0x40018000,0xffffffef},{0x40018008,0x15008855},{0x40018004,0x10},{0x40018000,0xffffffcf},{0x40018008,0x15008855},{0x40018004,0x30},{0x40018000,0xffffffcf},{0x40018008,0x15008055},{0x40018004,0x30},{0x40018000,0xffffff4f},{0x40018008,0x15008055},{0x40018004,0x30},{0x40018000,0xffffff4f},{0x40018008,0x15008055},{0x40018004,0x30},{0x40018000,0xfffffecf},{0x40018008,0x15028055},{0x40018004,0x30},{0x40018000,0xfffffecf},{0x40018008,0x15008055},{0x40018004,0x30},{0x40018000,0xfffffdcf},{0x40018008,0x15088055},{0x40018004,0x30},{0x40018000,0xfffffdcf},{0x40018008,0x15008055},{0x40018004,0x30},{0x40018000,0xfffffbcf},{0x40018008,0x15208055},{0x40018004,0x30},{0x40018000,0xfffffbcf},{0x40018008,0x15008055},{0x40018004,0x30},{0x40018000,0xfffff7cf},{0x40018008,0x15808055},{0x40018004,0x30},{0x40018000,0xfffff7cf},{0x40018008,0x15008055},{0x40018004,0x30},{0x40018000,0xffffefcf},{0x40018008,0x16008055},{0x40018004,0x30},{0x40018000,0xffffefcf},{0x40018008,0x15008055},{0x40018004,0x30},{0x40018000,0xffffdfcf},{0x40018008,0x19008055},{0x40018004,0x30},{0x40018000,0xffffdfcf},{0x40018008,0x15008055},{0x40018004,0x30},{0x40018000,0xffffbfcf},{0x40018008,0x25008055},{0x40018004,0x30},{0x40018000,0xffffbfcf},{0x40018008,0x15008055},{0x40019004,0xa00},{0x40019000,0xfffff5df},{0x40019008,0x55995800},{0x40019004,0xa20},{0x40019000,0xfffff5df},{0x40019008,0x55995800},{0x40019004,0xa20},{0x40019000,0xfffff59f},{0x40019008,0x55996800},{0x40019004,0xa20},{0x40019000,0xfffff59f},{0x40019008,0x55995800},{0x40019004,0xa20},{0x40019000,0xfffff55f},{0x40019008,0x55999800},{0x40019004,0xa20},{0x40019000,0xfffff55f},{0x40019008,0x55995800},{0x40019004,0xa20},{0x40019000,0xfffff4df},{0x40019008,0x559a5800},{0x40019004,0xa20},{0x40019000,0xfffff4df},{0x40019008,0x55995800},{0x40019004,0x820},{0x40019000,0xfffff5df},{0x40019008,0x55995800},{0x40019004,0xa20},{0x40019000,0xfffff5df},{0x40019008,0x55995800},{0x40019004,0xa20},{0x40019000,0xfffff1df},{0x40019008,0x55a95800},{0x40019004,0xa20},{0x40019000,0xfffff1df},{0x40019008,0x55995800},{0x40019004,0x220},{0x40019000,0xfffff5df},{0x40019008,0x55995800},{0x40019004,0xa20},{0x40019000,0xfffff5df},{0x40019008,0x55995800},{0x40019004,0xa20},{0x40019000,0xffffe5df},{0x40019008,0x56995800},{0x40019004,0xa20},{0x40019000,0xffffe5df},{0x40019008,0x55995800},{0x40019004,0xa20},{0x40019000,0xffffd5df},{0x40019008,0x59995800},{0x40019004,0xa20},{0x40019000,0xffffd5df},{0x40019008,0x55995800},{0x40019004,0xa20},{0x40019000,0xffffb5df},{0x40019008,0x65995800},{0x40019004,0xa20},{0x40019000,0xffffb5df},{0x40019008,0x55995800},{0x40019004,0xa20},{0x40019000,0xffff75df},{0x40019008,0x95995800},{0x40019004,0xa20},{0x40019000,0xffff75df},{0x40019008,0x55995800},{0x4001a004,0x0},{0x4001a000,0xfffffffe},{0x4001a008,0x52},{0x4001a004,0x0},{0x4001a000,0xfffffffe},{0x4001a008,0x50},{0x4001a004,0x0},{0x4001a000,0xfffffffd},{0x4001a008,0x58},{0x4001a004,0x0},{0x4001a000,0xfffffffd},{0x4001a008,0x50},{0x4001aLine truncated
|
||||
#define DISP_POWER_N 262
|
||||
@@ -0,0 +1,90 @@
|
||||
/* Write the Paradise flash: erase and program a sector, exactly like the
|
||||
* mameise flash app (confirmed on the device). Runs from PRAM; nothing may be
|
||||
* read from the XIP window while writing. */
|
||||
#include "io.h"
|
||||
#include "flash.h"
|
||||
#define F_DMEM REG(FCTL+0x100)
|
||||
#define F_DLEN REG(FCTL+0x104)
|
||||
#define F_DCTL REG(FCTL+0x108)
|
||||
#define F_DFLA REG(FCTL+0x10C)
|
||||
|
||||
static void feed(void){ REG(0x4000800Cu)=0x5AFA55AAu; REG(0x4000900Cu)=0x5AFA55AAu; }
|
||||
static void wait_loop(u32 n){ for(volatile u32 i=0;i<n;i++){ if((i & 0xFFFFu)==0) feed(); } }
|
||||
|
||||
/* Read the flash status register, exactly like the Paradise firmware (PRAM 0x5808
|
||||
* with -1): set read command bit 14, wait until it clears, byte from 0x14. */
|
||||
static u32 flash_status(void)
|
||||
{
|
||||
REG(FCTL+0x004) |= 0x4000u;
|
||||
for(u32 g=0; (REG(FCTL+0x004)&0x4000u) && g<1000000u; g++){}
|
||||
return REG(FCTL+0x014) & 0xFFu;
|
||||
}
|
||||
/* Wait until the flash is ready (WIP = bit 0), like the firmware after
|
||||
* erasing (0x38B0) and programming (0x3D28). Same upper limit as before. */
|
||||
static void wait_ready(void)
|
||||
{
|
||||
wait_loop(2000u);
|
||||
for(u32 i=0;i<400000u;i++){
|
||||
if(!(flash_status() & 1u)) return;
|
||||
if((i & 0xFFu)==0) feed();
|
||||
}
|
||||
}
|
||||
|
||||
void flash_erase4k(u32 addr)
|
||||
{
|
||||
u32 a1=addr>>1;
|
||||
u32 hi=(a1>>16)&0xFFFFu;
|
||||
u32 lo=a1 & 0xFFFFu;
|
||||
REG(FCTL+0x008)=hi;
|
||||
REG(FCTL+0x00C)=lo;
|
||||
REG(FCTL+0x004)=0x00000400u;
|
||||
for(u32 g=0; (REG(FCTL+0x004)&0x400u) && g<60000000u; g++){ if((g & 0xFFFFu)==0) feed(); }
|
||||
for(u32 g=0; (REG(FCTL+0x004)&0x2u) && g<60000000u; g++){ if((g & 0xFFFFu)==0) feed(); }
|
||||
wait_ready();
|
||||
}
|
||||
|
||||
void flash_prog4k(u32 addr, const void *src)
|
||||
{
|
||||
u32 a1=addr>>1;
|
||||
u32 hi=(a1>>16)&0xFFFFu;
|
||||
u32 lo=a1 & 0xFFFFu;
|
||||
flash_erase4k(addr);
|
||||
/* program */
|
||||
REG(FCTL+0x008)=0x3000u | hi;
|
||||
REG(FCTL+0x00C)=lo;
|
||||
REG(FCTL+0x004)=0x00000400u;
|
||||
REG(FCTL+0x004)=0x00004000u;
|
||||
REG(FCTL+0x000)=0x0000d080u;
|
||||
REG(FCTL+0x020)=0;
|
||||
REG(FCTL+0x010)=0;
|
||||
REG(FCTL+0x000)=0x0000d082u;
|
||||
F_DFLA=0x60000000u | (addr & 0x00FFFFFFu);
|
||||
F_DLEN=0x1000u; F_DMEM=(u32)src;
|
||||
F_DCTL=0u;
|
||||
F_DCTL=1u;
|
||||
for(u32 g=0; (F_DCTL & 1u) && g<20000000u; g++){ if((g & 0xFFFFu)==0) feed(); }
|
||||
wait_ready();
|
||||
}
|
||||
|
||||
void flash_read(u32 addr, void *dst, u32 len)
|
||||
{
|
||||
const volatile u8 *s=(const volatile u8*)(0x60000000u + (addr & 0x00FFFFFFu));
|
||||
u8 *d=(u8*)dst;
|
||||
for(u32 i=0;i<len;i++) d[i]=s[i];
|
||||
}
|
||||
|
||||
int flash_same(u32 addr, const void *src, u32 len)
|
||||
{
|
||||
const volatile u8 *s=(const volatile u8*)(0x60000000u + (addr & 0x00FFFFFFu));
|
||||
const u8 *p=(const u8*)src;
|
||||
for(u32 i=0;i<len;i++) if(s[i]!=p[i]) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Write the sector only if it differs. Returns 1 if it was written. */
|
||||
int flash_update4k(u32 addr, const void *src)
|
||||
{
|
||||
if(flash_same(addr, src, 0x1000u)) return 0;
|
||||
flash_prog4k(addr, src);
|
||||
return 1;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef FLASH_H
|
||||
#define FLASH_H
|
||||
#include "io.h"
|
||||
void flash_erase4k(u32 addr);
|
||||
void flash_prog4k(u32 addr, const void *src);
|
||||
void flash_read(u32 addr, void *dst, u32 len);
|
||||
int flash_same(u32 addr, const void *src, u32 len);
|
||||
int flash_update4k(u32 addr, const void *src);
|
||||
#endif
|
||||
@@ -0,0 +1,99 @@
|
||||
/* generated by gen/font.py: custom 5x7 font */
|
||||
static const unsigned char g_font[96][7]={
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x04,0x04,0x04,0x04,0x04,0x00,0x04},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x19,0x19,0x02,0x04,0x08,0x13,0x13},
|
||||
{0x0c,0x12,0x14,0x08,0x15,0x12,0x0d},
|
||||
{0x04,0x04,0x08,0x00,0x00,0x00,0x00},
|
||||
{0x02,0x04,0x08,0x08,0x08,0x04,0x02},
|
||||
{0x08,0x04,0x02,0x02,0x02,0x04,0x08},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x04,0x04,0x1f,0x04,0x04,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x0c,0x04,0x08},
|
||||
{0x00,0x00,0x00,0x1f,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x0c,0x0c},
|
||||
{0x01,0x01,0x02,0x04,0x08,0x10,0x10},
|
||||
{0x0e,0x11,0x13,0x15,0x19,0x11,0x0e},
|
||||
{0x04,0x0c,0x04,0x04,0x04,0x04,0x0e},
|
||||
{0x0e,0x11,0x01,0x02,0x04,0x08,0x1f},
|
||||
{0x1e,0x01,0x01,0x0e,0x01,0x01,0x1e},
|
||||
{0x02,0x06,0x0a,0x12,0x1f,0x02,0x02},
|
||||
{0x1f,0x10,0x1e,0x01,0x01,0x11,0x0e},
|
||||
{0x0e,0x10,0x10,0x1e,0x11,0x11,0x0e},
|
||||
{0x1f,0x01,0x02,0x04,0x08,0x08,0x08},
|
||||
{0x0e,0x11,0x11,0x0e,0x11,0x11,0x0e},
|
||||
{0x0e,0x11,0x11,0x0f,0x01,0x01,0x0e},
|
||||
{0x00,0x04,0x04,0x00,0x04,0x04,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x02,0x04,0x08,0x10,0x08,0x04,0x02},
|
||||
{0x00,0x00,0x1f,0x00,0x1f,0x00,0x00},
|
||||
{0x08,0x04,0x02,0x01,0x02,0x04,0x08},
|
||||
{0x0e,0x11,0x01,0x02,0x04,0x00,0x04},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x0e,0x11,0x11,0x1f,0x11,0x11,0x11},
|
||||
{0x1e,0x11,0x11,0x1e,0x11,0x11,0x1e},
|
||||
{0x0e,0x11,0x10,0x10,0x10,0x11,0x0e},
|
||||
{0x1e,0x11,0x11,0x11,0x11,0x11,0x1e},
|
||||
{0x1f,0x10,0x10,0x1e,0x10,0x10,0x1f},
|
||||
{0x1f,0x10,0x10,0x1e,0x10,0x10,0x10},
|
||||
{0x0e,0x11,0x10,0x17,0x11,0x11,0x0f},
|
||||
{0x11,0x11,0x11,0x1f,0x11,0x11,0x11},
|
||||
{0x0e,0x04,0x04,0x04,0x04,0x04,0x0e},
|
||||
{0x07,0x02,0x02,0x02,0x02,0x12,0x0c},
|
||||
{0x11,0x12,0x14,0x18,0x14,0x12,0x11},
|
||||
{0x10,0x10,0x10,0x10,0x10,0x10,0x1f},
|
||||
{0x11,0x1b,0x15,0x15,0x11,0x11,0x11},
|
||||
{0x11,0x19,0x15,0x13,0x11,0x11,0x11},
|
||||
{0x0e,0x11,0x11,0x11,0x11,0x11,0x0e},
|
||||
{0x1e,0x11,0x11,0x1e,0x10,0x10,0x10},
|
||||
{0x0e,0x11,0x11,0x11,0x15,0x12,0x0d},
|
||||
{0x1e,0x11,0x11,0x1e,0x14,0x12,0x11},
|
||||
{0x0f,0x10,0x10,0x0e,0x01,0x01,0x1e},
|
||||
{0x1f,0x04,0x04,0x04,0x04,0x04,0x04},
|
||||
{0x11,0x11,0x11,0x11,0x11,0x11,0x0e},
|
||||
{0x11,0x11,0x11,0x11,0x11,0x0a,0x04},
|
||||
{0x11,0x11,0x11,0x15,0x15,0x15,0x0a},
|
||||
{0x11,0x11,0x0a,0x04,0x0a,0x11,0x11},
|
||||
{0x11,0x11,0x0a,0x04,0x04,0x04,0x04},
|
||||
{0x1f,0x01,0x02,0x04,0x08,0x10,0x1f},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x11,0x0a,0x04,0x0a,0x11},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x11,0x0e,0x11,0x1f,0x11,0x11,0x11},
|
||||
{0x11,0x0e,0x11,0x11,0x11,0x11,0x0e},
|
||||
{0x11,0x00,0x11,0x11,0x11,0x11,0x0e},
|
||||
};
|
||||
@@ -0,0 +1,182 @@
|
||||
/* ITOSM Korean menu subset of Galmuri9, quiple, SIL OFL 1.1.
|
||||
* See third-party/Galmuri-OFL.txt. Generated by scripts/build-menu-ko.cjs. */
|
||||
#define KO_GLYPHS 177
|
||||
static const unsigned char ko_font[KO_GLYPHS][13]={
|
||||
{0,0,0,0,0,64,0,0,0,0,0,0,0}, /* · */
|
||||
{249,2,64,144,36,17,132,66,19,4,1,0,0}, /* 가 */
|
||||
{249,2,64,152,68,225,0,68,1,0,127,0,0}, /* 간 */
|
||||
{249,2,64,152,68,225,0,7,241,4,127,0,0}, /* 감 */
|
||||
{249,2,97,19,132,0,20,135,33,84,120,128,0}, /* 값 */
|
||||
{249,2,64,152,68,225,0,3,225,4,62,0,0}, /* 강 */
|
||||
{250,130,160,168,42,19,132,162,43,10,2,128,0}, /* 개 */
|
||||
{249,2,64,144,60,17,4,66,19,4,1,0,0}, /* 거 */
|
||||
{249,2,64,240,68,225,0,68,1,0,127,0,0}, /* 건 */
|
||||
{242,132,161,40,122,18,136,162,43,10,2,128,0}, /* 게 */
|
||||
{249,3,192,144,92,225,0,3,225,4,62,0,0}, /* 경 */
|
||||
{242,132,161,232,74,18,139,162,43,10,2,128,0}, /* 계 */
|
||||
{127,0,64,16,4,9,2,64,131,254,0,0,0}, /* 고 */
|
||||
{249,2,64,144,36,41,136,66,19,244,1,0,0}, /* 과 */
|
||||
{249,2,66,152,132,253,0,68,1,0,127,0,0}, /* 관 */
|
||||
{127,0,64,16,4,1,0,64,3,254,0,0,0}, /* 그 */
|
||||
{127,0,64,19,254,0,31,193,241,128,127,0,0}, /* 글 */
|
||||
{127,0,64,16,4,255,128,7,241,4,127,0,0}, /* 금 */
|
||||
{249,2,64,144,36,17,4,66,19,4,1,0,0}, /* 기 */
|
||||
{249,18,68,145,36,73,146,68,146,68,1,0,0}, /* 까 */
|
||||
{249,18,68,145,60,73,18,68,146,68,1,0,0}, /* 꺼 */
|
||||
{119,4,65,16,68,17,4,64,3,254,0,0,0}, /* 끄 */
|
||||
{119,4,65,16,0,255,128,7,241,4,127,0,0}, /* 끔 */
|
||||
{129,32,72,26,4,253,0,68,1,0,127,0,0}, /* 난 */
|
||||
{129,32,72,26,4,253,0,7,241,4,127,0,0}, /* 남 */
|
||||
{64,16,4,1,252,0,63,226,32,136,34,0,0}, /* 뉴 */
|
||||
{64,16,7,240,0,255,128,4,1,0,127,0,0}, /* 는 */
|
||||
{129,32,72,18,4,129,32,72,19,228,1,0,0}, /* 니 */
|
||||
{249,32,72,18,4,129,160,72,19,228,1,0,0}, /* 다 */
|
||||
{249,32,72,26,4,249,0,68,1,0,127,0,0}, /* 단 */
|
||||
{250,160,168,42,10,131,160,168,43,234,2,128,0}, /* 대 */
|
||||
{250,160,168,42,58,130,160,168,43,234,2,128,0}, /* 데 */
|
||||
{127,16,4,1,0,127,2,0,131,254,0,0,0}, /* 도 */
|
||||
{127,16,7,240,32,255,159,193,241,128,127,0,0}, /* 돌 */
|
||||
{127,16,7,240,32,255,128,3,225,4,62,0,0}, /* 동 */
|
||||
{249,32,72,18,4,249,8,66,19,244,1,0,0}, /* 되 */
|
||||
{249,32,79,144,132,253,0,7,241,4,127,0,0}, /* 됨 */
|
||||
{249,32,79,144,132,253,16,71,241,4,127,0,0}, /* 됩 */
|
||||
{249,32,72,19,228,1,63,66,16,132,33,0,0}, /* 뒤 */
|
||||
{127,16,4,1,0,127,0,0,3,254,0,0,0}, /* 드 */
|
||||
{127,16,7,240,0,255,128,7,240,4,1,0,0}, /* 득 */
|
||||
{250,168,170,42,138,163,168,170,43,234,2,128,0}, /* 때 */
|
||||
{250,130,175,186,10,250,128,164,1,0,127,128,0}, /* 랜 */
|
||||
{250,130,175,186,10,250,128,7,249,2,127,128,0}, /* 램 */
|
||||
{249,2,111,146,6,249,0,3,225,4,62,0,0}, /* 량 */
|
||||
{249,2,64,147,228,135,32,72,19,228,1,0,0}, /* 러 */
|
||||
{242,132,161,43,202,142,160,168,43,202,2,128,0}, /* 레 */
|
||||
{249,3,207,146,28,249,0,7,240,4,1,0,0}, /* 력 */
|
||||
{127,0,71,241,0,127,2,0,131,254,0,0,0}, /* 로 */
|
||||
{127,7,198,1,252,8,63,224,1,252,1,0,0}, /* 록 */
|
||||
{127,0,71,241,0,127,8,130,35,254,0,0,0}, /* 료 */
|
||||
{127,0,71,241,0,127,0,15,248,136,34,0,0}, /* 류 */
|
||||
{127,7,198,1,252,255,128,7,241,4,127,0,0}, /* 름 */
|
||||
{249,2,64,147,228,129,32,72,19,228,1,0,0}, /* 리 */
|
||||
{249,2,79,146,4,249,0,7,240,4,1,0,0}, /* 릭 */
|
||||
{249,34,72,146,36,137,162,72,147,228,1,0,0}, /* 마 */
|
||||
{250,162,168,170,58,138,162,168,171,234,2,128,0}, /* 메 */
|
||||
{249,35,200,146,60,249,0,68,1,0,127,0,0}, /* 면 */
|
||||
{127,16,71,240,32,255,128,7,240,4,1,0,0}, /* 목 */
|
||||
{249,34,72,146,36,137,34,72,147,228,1,0,0}, /* 미 */
|
||||
{137,62,72,154,36,249,0,3,225,4,62,0,0}, /* 방 */
|
||||
{138,162,168,171,234,139,162,168,171,234,2,128,0}, /* 배 */
|
||||
{138,191,168,171,234,0,31,225,249,128,127,128,0}, /* 벨 */
|
||||
{137,63,200,146,60,249,0,68,1,0,127,0,0}, /* 변 */
|
||||
{65,31,196,17,4,127,2,0,131,254,0,0,0}, /* 보 */
|
||||
{65,31,196,17,252,8,63,224,1,252,1,0,0}, /* 복 */
|
||||
{65,31,196,17,252,8,63,224,1,0,127,0,0}, /* 본 */
|
||||
{65,31,196,17,252,8,63,231,241,4,127,0,0}, /* 봄 */
|
||||
{65,31,196,17,252,0,63,224,128,32,8,0,0}, /* 부 */
|
||||
{65,31,196,17,252,0,63,224,129,0,127,0,0}, /* 분 */
|
||||
{65,31,196,19,254,8,31,193,241,128,127,0,0}, /* 불 */
|
||||
{137,34,72,147,228,137,34,72,147,228,1,0,0}, /* 비 */
|
||||
{33,8,66,16,132,81,148,72,146,36,1,0,0}, /* 사 */
|
||||
{33,8,66,25,68,137,0,7,240,4,1,0,0}, /* 삭 */
|
||||
{33,8,66,25,68,137,0,3,225,4,62,0,0}, /* 상 */
|
||||
{34,136,162,40,138,83,148,168,170,42,2,128,0}, /* 새 */
|
||||
{33,8,66,16,156,81,20,72,146,36,1,0,0}, /* 서 */
|
||||
{33,8,66,113,68,137,0,68,1,0,127,0,0}, /* 선 */
|
||||
{33,9,197,18,36,0,31,193,241,128,127,0,0}, /* 설 */
|
||||
{33,8,66,113,68,137,0,3,225,4,62,0,0}, /* 성 */
|
||||
{34,136,162,40,186,82,148,168,170,42,2,128,0}, /* 세 */
|
||||
{33,8,66,112,132,81,21,200,146,36,1,0,0}, /* 셔 */
|
||||
{8,2,1,64,136,65,2,0,131,254,0,0,0}, /* 소 */
|
||||
{8,5,6,48,32,255,128,4,1,0,127,0,0}, /* 손 */
|
||||
{8,5,2,33,4,0,63,224,128,32,8,0,0}, /* 수 */
|
||||
{8,5,6,48,0,255,130,0,128,80,99,0,0}, /* 숫 */
|
||||
{8,2,1,64,136,65,0,0,3,254,0,0,0}, /* 스 */
|
||||
{8,5,6,48,0,255,144,71,241,4,127,0,0}, /* 습 */
|
||||
{33,8,66,16,132,81,20,72,146,36,1,0,0}, /* 시 */
|
||||
{33,8,66,17,68,137,0,7,240,4,1,0,0}, /* 식 */
|
||||
{33,8,69,18,36,0,31,193,241,128,127,0,0}, /* 실 */
|
||||
{113,34,72,146,36,137,162,72,145,196,1,0,0}, /* 아 */
|
||||
{113,34,72,154,36,113,0,132,249,20,114,0,0}, /* 않 */
|
||||
{113,34,104,145,196,0,31,193,241,128,127,0,0}, /* 알 */
|
||||
{113,34,72,154,36,113,0,2,33,84,136,128,0}, /* 았 */
|
||||
{113,34,72,146,60,137,34,72,145,196,1,0,0}, /* 어 */
|
||||
{113,35,200,145,196,0,16,71,241,4,127,0,0}, /* 업 */
|
||||
{113,35,200,145,196,0,20,135,33,84,120,128,0}, /* 없 */
|
||||
{113,34,72,242,36,113,0,2,33,84,136,128,0}, /* 었 */
|
||||
{114,162,168,170,58,138,162,168,169,202,2,128,0}, /* 에 */
|
||||
{113,35,200,146,60,113,0,7,240,4,1,0,0}, /* 역 */
|
||||
{113,35,200,145,220,1,31,193,241,128,127,0,0}, /* 열 */
|
||||
{114,162,168,234,42,138,163,168,169,202,2,128,0}, /* 예 */
|
||||
{62,16,68,17,4,62,2,0,131,254,0,0,0}, /* 오 */
|
||||
{62,16,67,224,32,255,144,71,241,4,127,0,0}, /* 옵 */
|
||||
{113,34,71,24,132,253,0,68,1,0,127,0,0}, /* 완 */
|
||||
{62,16,68,17,4,62,8,130,35,254,0,0,0}, /* 요 */
|
||||
{62,16,67,224,136,255,128,3,225,4,62,0,0}, /* 용 */
|
||||
{62,16,67,224,0,255,130,4,129,0,127,0,0}, /* 운 */
|
||||
{113,34,72,145,196,1,63,66,16,156,33,0,0}, /* 워 */
|
||||
{113,34,71,19,244,39,8,68,1,0,127,0,0}, /* 원 */
|
||||
{62,16,68,16,248,0,63,226,32,136,34,0,0}, /* 유 */
|
||||
{62,16,68,17,4,62,0,0,3,254,0,0,0}, /* 으 */
|
||||
{62,16,67,227,254,0,31,193,241,128,127,0,0}, /* 을 */
|
||||
{62,16,67,224,0,255,128,7,241,4,127,0,0}, /* 음 */
|
||||
{113,34,72,146,36,113,0,64,19,244,1,0,0}, /* 의 */
|
||||
{113,34,72,146,36,137,34,72,145,196,1,0,0}, /* 이 */
|
||||
{113,34,72,146,36,113,0,68,1,0,127,0,0}, /* 인 */
|
||||
{113,34,72,145,196,0,29,195,17,4,113,0,0}, /* 읽 */
|
||||
{113,34,72,146,36,113,0,7,241,4,127,0,0}, /* 임 */
|
||||
{113,34,72,145,196,0,16,71,241,4,127,0,0}, /* 입 */
|
||||
{113,34,72,146,36,113,0,2,33,84,136,128,0}, /* 있 */
|
||||
{249,8,66,16,132,81,148,72,146,36,1,0,0}, /* 자 */
|
||||
{249,8,66,25,68,137,0,7,240,4,1,0,0}, /* 작 */
|
||||
{249,8,66,25,68,137,0,7,241,4,127,0,0}, /* 잠 */
|
||||
{249,8,66,25,68,137,0,3,225,4,62,0,0}, /* 장 */
|
||||
{250,136,162,40,138,83,148,168,170,42,2,128,0}, /* 재 */
|
||||
{249,8,66,16,156,81,20,72,146,36,1,0,0}, /* 저 */
|
||||
{249,8,66,113,68,137,0,7,240,4,1,0,0}, /* 적 */
|
||||
{249,8,66,113,68,137,0,68,1,0,127,0,0}, /* 전 */
|
||||
{249,8,66,113,68,137,0,3,225,4,62,0,0}, /* 정 */
|
||||
{250,136,162,40,186,82,148,168,170,42,2,128,0}, /* 제 */
|
||||
{127,2,1,64,136,65,2,0,131,254,0,0,0}, /* 조 */
|
||||
{127,5,6,48,32,255,128,4,1,0,127,0,0}, /* 존 */
|
||||
{127,5,6,48,0,255,130,3,225,4,62,0,0}, /* 중 */
|
||||
{249,8,66,16,132,81,20,72,146,36,1,0,0}, /* 지 */
|
||||
{249,8,66,17,68,137,0,7,241,4,127,0,0}, /* 짐 */
|
||||
{249,8,69,18,36,0,16,71,241,4,127,0,0}, /* 집 */
|
||||
{33,62,66,25,68,137,0,7,241,4,127,0,0}, /* 참 */
|
||||
{114,128,175,168,138,46,148,165,42,42,2,128,0}, /* 체 */
|
||||
{28,0,7,240,32,20,26,192,131,254,0,0,0}, /* 초 */
|
||||
{8,31,192,128,80,99,0,15,248,32,8,0,0}, /* 추 */
|
||||
{33,62,69,18,36,1,63,66,16,132,33,0,0}, /* 취 */
|
||||
{113,0,79,144,132,33,20,69,18,36,1,0,0}, /* 치 */
|
||||
{249,2,64,147,228,17,132,66,19,4,1,0,0}, /* 카 */
|
||||
{250,130,160,171,234,19,132,162,43,10,2,128,0}, /* 캐 */
|
||||
{249,2,79,240,68,225,31,193,241,128,127,0,0}, /* 컬 */
|
||||
{127,0,64,17,252,1,2,64,131,254,0,0,0}, /* 코 */
|
||||
{127,0,64,17,252,1,0,64,3,254,0,0,0}, /* 크 */
|
||||
{249,32,72,19,228,129,160,72,19,228,1,0,0}, /* 타 */
|
||||
{250,160,175,186,10,250,128,7,248,2,0,128,0}, /* 택 */
|
||||
{249,32,72,19,220,129,32,72,19,228,1,0,0}, /* 터 */
|
||||
{242,160,175,106,10,242,128,7,249,2,127,128,0}, /* 템 */
|
||||
{127,31,132,1,252,8,63,227,225,4,62,0,0}, /* 통 */
|
||||
{127,16,7,241,0,127,0,0,3,254,0,0,0}, /* 트 */
|
||||
{250,148,165,41,74,83,148,165,43,234,2,128,0}, /* 패 */
|
||||
{249,21,197,17,92,249,0,68,1,0,127,0,0}, /* 편 */
|
||||
{127,8,130,32,136,127,2,0,131,254,0,0,0}, /* 포 */
|
||||
{127,8,135,240,0,255,130,7,241,4,127,0,0}, /* 품 */
|
||||
{127,8,130,32,136,127,0,0,3,254,0,0,0}, /* 프 */
|
||||
{127,8,135,243,254,0,31,193,241,128,127,0,0}, /* 플 */
|
||||
{127,8,135,240,0,255,128,7,241,4,127,0,0}, /* 픔 */
|
||||
{253,18,68,145,36,73,18,68,147,244,1,0,0}, /* 피 */
|
||||
{113,0,79,208,4,113,162,72,145,196,1,0,0}, /* 하 */
|
||||
{33,63,71,26,36,113,0,68,1,0,127,0,0}, /* 한 */
|
||||
{33,63,71,26,36,113,31,193,241,128,127,0,0}, /* 할 */
|
||||
{33,63,71,26,36,113,0,7,241,4,127,0,0}, /* 함 */
|
||||
{33,63,71,26,36,113,16,71,241,4,127,0,0}, /* 합 */
|
||||
{34,190,167,58,42,114,128,3,241,2,63,0,0}, /* 행 */
|
||||
{33,62,199,18,44,113,0,68,1,0,127,0,0}, /* 현 */
|
||||
{33,62,199,18,44,113,0,3,225,4,62,0,0}, /* 형 */
|
||||
{33,63,64,17,196,137,156,66,19,244,1,0,0}, /* 화 */
|
||||
{33,63,68,152,196,33,63,64,1,252,1,0,0}, /* 확 */
|
||||
{33,63,68,152,196,33,63,64,1,0,127,0,0}, /* 환 */
|
||||
{33,63,64,17,196,137,28,66,19,244,1,0,0}, /* 회 */
|
||||
{8,63,227,225,4,62,0,15,248,32,8,0,0}, /* 후 */
|
||||
{33,63,68,147,244,32,31,193,241,128,127,0,0}, /* 휠 */
|
||||
};
|
||||
@@ -0,0 +1,73 @@
|
||||
# Custom 5x7 font for the field switch helper program. Generates font.h
|
||||
G = {
|
||||
'A':[".###.","#...#","#...#","#####","#...#","#...#","#...#"],
|
||||
'B':["####.","#...#","#...#","####.","#...#","#...#","####."],
|
||||
'C':[".###.","#...#","#....","#....","#....","#...#",".###."],
|
||||
'D':["####.","#...#","#...#","#...#","#...#","#...#","####."],
|
||||
'E':["#####","#....","#....","####.","#....","#....","#####"],
|
||||
'F':["#####","#....","#....","####.","#....","#....","#...."],
|
||||
'G':[".###.","#...#","#....","#.###","#...#","#...#",".####"],
|
||||
'H':["#...#","#...#","#...#","#####","#...#","#...#","#...#"],
|
||||
'I':[".###.","..#..","..#..","..#..","..#..","..#..",".###."],
|
||||
'J':["..###","...#.","...#.","...#.","...#.","#..#.",".##.."],
|
||||
'K':["#...#","#..#.","#.#..","##...","#.#..","#..#.","#...#"],
|
||||
'L':["#....","#....","#....","#....","#....","#....","#####"],
|
||||
'M':["#...#","##.##","#.#.#","#.#.#","#...#","#...#","#...#"],
|
||||
'N':["#...#","##..#","#.#.#","#..##","#...#","#...#","#...#"],
|
||||
'O':[".###.","#...#","#...#","#...#","#...#","#...#",".###."],
|
||||
'P':["####.","#...#","#...#","####.","#....","#....","#...."],
|
||||
'Q':[".###.","#...#","#...#","#...#","#.#.#","#..#.",".##.#"],
|
||||
'R':["####.","#...#","#...#","####.","#.#..","#..#.","#...#"],
|
||||
'S':[".####","#....","#....",".###.","....#","....#","####."],
|
||||
'T':["#####","..#..","..#..","..#..","..#..","..#..","..#.."],
|
||||
'U':["#...#","#...#","#...#","#...#","#...#","#...#",".###."],
|
||||
'V':["#...#","#...#","#...#","#...#","#...#",".#.#.","..#.."],
|
||||
'W':["#...#","#...#","#...#","#.#.#","#.#.#","#.#.#",".#.#."],
|
||||
'X':["#...#","#...#",".#.#.","..#..",".#.#.","#...#","#...#"],
|
||||
'Y':["#...#","#...#",".#.#.","..#..","..#..","..#..","..#.."],
|
||||
'Z':["#####","....#","...#.","..#..",".#...","#....","#####"],
|
||||
'0':[".###.","#...#","#..##","#.#.#","##..#","#...#",".###."],
|
||||
'1':["..#..",".##..","..#..","..#..","..#..","..#..",".###."],
|
||||
'2':[".###.","#...#","....#","...#.","..#..",".#...","#####"],
|
||||
'3':["####.","....#","....#",".###.","....#","....#","####."],
|
||||
'4':["...#.","..##.",".#.#.","#..#.","#####","...#.","...#."],
|
||||
'5':["#####","#....","####.","....#","....#","#...#",".###."],
|
||||
'6':[".###.","#....","#....","####.","#...#","#...#",".###."],
|
||||
'7':["#####","....#","...#.","..#..",".#...",".#...",".#..."],
|
||||
'8':[".###.","#...#","#...#",".###.","#...#","#...#",".###."],
|
||||
'9':[".###.","#...#","#...#",".####","....#","....#",".###."],
|
||||
' ':["....."]*7,
|
||||
':':[".....","..#..","..#..",".....","..#..","..#..","....."],
|
||||
'.':[".....",".....",".....",".....",".....",".##..",".##.."],
|
||||
'!':["..#..","..#..","..#..","..#..","..#..",".....","..#.."],
|
||||
'?':[".###.","#...#","....#","...#.","..#..",".....","..#.."],
|
||||
'=':[".....",".....","#####",".....","#####",".....","....."],
|
||||
'-':[".....",".....",".....","#####",".....",".....","....."],
|
||||
'/':["....#","....#","...#.","..#..",".#...","#....","#...."],
|
||||
'%':["##..#","##..#","...#.","..#..",".#...","#..##","#..##"],
|
||||
'>':[".#...","..#..","...#.","....#","...#.","..#..",".#..."],
|
||||
'<':["...#.","..#..",".#...","#....",".#...","..#..","...#."],
|
||||
'+':[".....","..#..","..#..","#####","..#..","..#..","....."],
|
||||
'&':[".##..","#..#.","#.#..",".#...","#.#.#","#..#.",".##.#"],
|
||||
"'":["..#..","..#..",".#...",".....",".....",".....","....."],
|
||||
'x':[".....",".....","#...#",".#.#.","..#..",".#.#.","#...#"],
|
||||
',':[".....",".....",".....",".....",".##..","..#..",".#..."],
|
||||
'(':["...#.","..#..",".#...",".#...",".#...","..#..","...#."],
|
||||
')':[".#...","..#..","...#.","...#.","...#.","..#..",".#..."],
|
||||
'\x01':["#...#",".###.","#...#","#####","#...#","#...#","#...#"], # A umlaut
|
||||
'\x02':["#...#",".###.","#...#","#...#","#...#","#...#",".###."], # O umlaut
|
||||
'\x03':["#...#",".....","#...#","#...#","#...#","#...#",".###."], # U umlaut
|
||||
}
|
||||
lo=0;hi=127
|
||||
out=['/* generated by gen/font.py: custom 5x7 font */','static const unsigned char g_font[96][7]={']
|
||||
codes={}
|
||||
for c,rows in G.items():
|
||||
k=ord(c)
|
||||
codes[k]=[sum((1<<(4-i)) for i,ch in enumerate(r) if ch=='#') for r in rows]
|
||||
def idx(k):
|
||||
return k-32 if k>=32 else 92+k # \x01..\x03 -> 93..95
|
||||
tab=[[0]*7 for _ in range(96)]
|
||||
for k,v in codes.items(): tab[idx(k)]=v
|
||||
for i,v in enumerate(tab): out.append(' {%s},'%(','.join('0x%02x'%x for x in v)))
|
||||
out.append('};')
|
||||
open('font.h','w').write('\n'.join(out)+'\n')
|
||||
@@ -0,0 +1,45 @@
|
||||
/* PC test of the Paramix menu: cc -DHOST host.c main.c -o menu_host
|
||||
* menu_host <flash_in.bin> <flash_out.bin> <image_folder> "<sequence>"
|
||||
* Sequence: n (wheel forward), p (wheel back), a, b, c. One PPM image after each screen update. */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <setjmp.h>
|
||||
typedef unsigned int u32; typedef unsigned short u16; typedef unsigned char u8;
|
||||
unsigned char *host_flash;
|
||||
static const char *g_seq; static int g_pos; static const char *g_dir; static int g_frame; static const char *g_out;
|
||||
static jmp_buf g_jb;
|
||||
void hw_init(void){}
|
||||
void hw_wdt_feed(void){}
|
||||
u32 hw_buttons(void){ return 0; }
|
||||
void hw_push(const u16* fb, u32 stride, u32 x0, u32 y0, u32 x1, u32 y1){
|
||||
(void)stride;(void)x0;(void)y0;(void)x1;(void)y1;
|
||||
char p[512]; snprintf(p,sizeof p,"%s/%03d.ppm",g_dir,g_frame++);
|
||||
FILE *f=fopen(p,"wb"); fprintf(f,"P6 128 128 255\n");
|
||||
for(int i=0;i<128*128;i++){ u16 c=fb[i]; u8 r=(u8)((c>>11)<<3), g=(u8)(((c>>5)&63)<<2), b=(u8)((c&31)<<3); fputc(r,f); fputc(g,f); fputc(b,f); }
|
||||
fclose(f);
|
||||
}
|
||||
void hw_back_to_paradise(void){ printf("BACK TO PARADISE\n"); longjmp(g_jb,1); }
|
||||
void host_exit(const char *why){ printf("ENDE %s\n",why); longjmp(g_jb,1); }
|
||||
void hw_tone(u32 hz){(void)hz;} void hw_backlight(int on){(void)on;} void hw_bl_pwm_off(void){}
|
||||
void flash_prog4k(u32 addr, const void *src){ memcpy(host_flash+(addr&0xFFFFFF),src,0x1000); }
|
||||
void flash_erase4k(u32 addr){ memset(host_flash+(addr&0xFFFFFF),0xFF,0x1000); }
|
||||
void flash_read(u32 addr, void *dst, u32 len){ memcpy(dst,host_flash+(addr&0xFFFFFF),len); }
|
||||
int flash_same(u32 addr, const void *src, u32 len){ return !memcmp(host_flash+(addr&0xFFFFFF),src,len); }
|
||||
int flash_update4k(u32 addr, const void *src){ if(flash_same(addr,src,0x1000)) return 0; flash_prog4k(addr,src); return 1; }
|
||||
int host_input(int *step){
|
||||
for(;;){
|
||||
char c=g_seq[g_pos]; if(!c){ printf("FOLGE ZU ENDE\n"); longjmp(g_jb,1); }
|
||||
g_pos++;
|
||||
switch(c){ case 'n': *step=1; return 1; case 'p': *step=-1; return 1; case 'a': return 10; case 'b': return 2; case 'c': return 3; default: break; }
|
||||
}
|
||||
}
|
||||
void host_main(void);
|
||||
int main(int argc,char**argv){
|
||||
if(argc<5){ fprintf(stderr,"menu_host in out dir folge\n"); return 1; }
|
||||
host_flash=malloc(0x1000000); FILE *f=fopen(argv[1],"rb"); fread(host_flash,1,0x1000000,f); fclose(f);
|
||||
g_out=argv[2]; g_dir=argv[3]; g_seq=argv[4];
|
||||
if(!setjmp(g_jb)) host_main();
|
||||
f=fopen(g_out,"wb"); fwrite(host_flash,1,0x1000000,f); fclose(f);
|
||||
printf("%d Bilder\n",g_frame); return 0;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
/* Only for the PC test (host.c): flash as a memory array, input from a sequence. */
|
||||
extern unsigned char *host_flash;
|
||||
#define FLASH_BASE ((volatile u8*)host_flash)
|
||||
int host_input(int *step);
|
||||
void host_exit(const char *why);
|
||||
@@ -0,0 +1,303 @@
|
||||
/* Paradise hardware (SNC73410), taken from the mameise flash app
|
||||
* (display confirmed on the device). Runs from PRAM 0 after SYSRESETREQ. */
|
||||
#include "io.h"
|
||||
#include "hw.h"
|
||||
#include "disp_power.h"
|
||||
#define PANEL 0x4000E000u
|
||||
#define FCTL_ 0x40022000u
|
||||
#define F_STAT REG(FCTL_+0x000)
|
||||
static void udelay(volatile u32 n){ while(n--) __asm__ volatile("nop"); }
|
||||
#define MS(x) udelay((u32)(x)*16000u)
|
||||
#define BB(reg,bit) (*(volatile u32*)(0x42000000u + (((u32)(reg)-0x40000000u)<<5) + ((u32)(bit)<<2)))
|
||||
#define GPIO0 0x40018000u
|
||||
#define GPIO1 0x40019000u
|
||||
#define GPIO2 0x4001A000u
|
||||
#define LCD_RST(v) (BB(GPIO0+0x00,4)=(v))
|
||||
#define LCD_DC(v) (BB(GPIO0+0x00,5)=(v))
|
||||
#define SPI_CTRL REG(PANEL+0x00)
|
||||
#define SPI_STAT REG(PANEL+0x0C)
|
||||
#define SPI_DATA REG(PANEL+0x1C)
|
||||
#define SPIWAIT 200000u
|
||||
#define CT2 0x40002000u
|
||||
TC_INIT static void clock_init(void){
|
||||
REG(CLK+0x00) |= 1u;
|
||||
REG(CLK+0x0C) = 0;
|
||||
REG(CLK+0x00) = 0x41u;
|
||||
{ u32 r = (REG(CLK+0x34) & 0xF00u) | 0xA55A0000u; REG(CLK+0x04) = r; }
|
||||
REG(CLK+0x18) = 0x21u;
|
||||
REG(CLK+0x50) = 0;
|
||||
REG(CLK+0x10C) = 0x001FFFFDu;
|
||||
REG(CLK+0x110) = 0;
|
||||
REG(CLK+0x108) = 0;
|
||||
REG(CLK+0x10) = 0;
|
||||
REG(CLK+0x00) |= 0x10u;
|
||||
for(u32 g=0; !((REG(CLK+0x08) >> 4) & 1u) && g<4000000u; g++){}
|
||||
REG(CLK+0x00) |= 0x4000u;
|
||||
REG(CLK+0x04) &= ~1u;
|
||||
REG(CLK+0x00) |= 0x8000u;
|
||||
for(u32 g=0; !((REG(CLK+0x08) >> 6) & 1u) && g<4000000u; g++){}
|
||||
{ u32 r = (REG(CLK+0x0C) & ~7u) | 4u; REG(CLK+0x0C) = r; }
|
||||
for(u32 g=0; ((REG(CLK+0x0C) >> 4) & 7u) != (REG(CLK+0x0C) & 7u) && g<4000000u; g++){} /* bounded: never hang forever */
|
||||
REG(CLK+0x100) = 0x00157EB7u;
|
||||
}
|
||||
TC_INIT static void flashctl_init(void){
|
||||
/* 1.4.2: enable XIP. We read through the 0x60000000 window that the XIP block
|
||||
* maps in. Without XIP that window only shows the config register (0x40), not
|
||||
* the flash data. The real Flash Utility does this at startup, our app did not
|
||||
* do it after reset until now. That is exactly what was missing. */
|
||||
REG(0x4002F004u)=0x60011000u;
|
||||
REG(0x4002F000u)=0x00000003u;
|
||||
/* 1.4.1: controller init word for word like the real Flash Utility (0x40022000).
|
||||
* This includes setting the read command/mode in 0x008 and 0x00c (0x3077 / 0xf000),
|
||||
* otherwise the chip only returns its config register (0x40) instead of flash data. */
|
||||
F_STAT=0x0000d018u;
|
||||
F_STAT=0x0000d000u;
|
||||
F_STAT=0x0000d080u;
|
||||
F_STAT=0x0000d088u;
|
||||
REG(FCTL+0x008)=0x00003077u; /* read command/mode */
|
||||
REG(FCTL+0x00C)=0x0000f000u;
|
||||
REG(FCTL+0x004)=0x00000400u;
|
||||
REG(FCTL+0x004)=0x00004000u;
|
||||
}
|
||||
TC_INIT static void wdt_off(void){
|
||||
/* Set up the system/power block EXACTLY like the real Flash Utility. The only
|
||||
point where we deliberately differed before (bit0 of 0x40008000) might be the
|
||||
master enable for the display domain. The FU runs with bit0=1 without a
|
||||
reset, so we copy it 1:1 and feed the watchdog in the loop. */
|
||||
REG(0x4000900Cu)=0x5AFA55AAu; REG(0x40009000u)=0x5AFA0000u; /* WDT1 */
|
||||
REG(0x40008000u)=0x5AFA0000u; /* unlock */
|
||||
REG(0x40008004u)=0x5AFA0002u;
|
||||
REG(0x40008008u)=0x5AFA00FFu; /* power/clock domains on (incl. display) */
|
||||
REG(0x4000800Cu)=0x5AFA55AAu; /* feed the watchdog */
|
||||
/* Do NOT set bit0 (watchdog enable): otherwise it resets the Tama during
|
||||
display init (back to the planet). */
|
||||
}
|
||||
TC_INIT static void mailbox_clear(void){
|
||||
REG(0x20000000u)=0; REG(0x20000004u)=0; REG(0x20000008u)=0; REG(0x2000000Cu)=0;
|
||||
}
|
||||
TC_INIT static void periph_enable(void){ REG(CLK+0x20)=0x40u; }
|
||||
TC_INIT static void pin_set(u8 id, u8 mode){ *(volatile u8*)(0xE000E400u + id) = (u8)(mode<<4); }
|
||||
TC_INIT static void pin_mux(void){
|
||||
static const u8 m12[]={6,7,8,9,0xf,0x10,0x11,0x12,0x13,0x14,0x19,0x1f,0x20,0x22,
|
||||
0x24,0x25,0x2e,0x2f,0x35,0x36,0x1a,0x1b,0x1c,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x3a,0x3f};
|
||||
static const u8 m8[]={0,1,2,3};
|
||||
static const u8 m4[]={0x15,0x17};
|
||||
for(unsigned i=0;i<sizeof m12;i++) pin_set(m12[i],0xC);
|
||||
for(unsigned i=0;i<sizeof m8;i++) pin_set(m8[i],0x8);
|
||||
for(unsigned i=0;i<sizeof m4;i++) pin_set(m4[i],0x4);
|
||||
}
|
||||
TC_INIT static void display_power(void){
|
||||
/* Sequence from the real FU (clock enable, pin setup, timer CT32B3, GPIO1).
|
||||
As in the FU, 0x45000210..218 get the current contents of the GPIO
|
||||
data registers (the emulator had returned 0 there). */
|
||||
for(unsigned i=0;i<DISP_POWER_N;i++){
|
||||
u32 a=disp_power_seq[i][0], v=disp_power_seq[i][1];
|
||||
if(a>=0x45000210u && a<=0x45000218u) v=REG(0x4001803Cu + ((a-0x45000210u)>>2)*0x1000u);
|
||||
REG(a)=v;
|
||||
}
|
||||
/* Make sure the panel pins are outputs: reset, D/C, CS (P1.5 low), supply (P1.9 low) */
|
||||
LCD_RST(1); BB(GPIO0+0x04,4)=1;
|
||||
LCD_DC(0); BB(GPIO0+0x04,5)=1;
|
||||
BB(GPIO1+0x00,5)=0; BB(GPIO1+0x04,5)=1;
|
||||
BB(GPIO1+0x00,9)=0; BB(GPIO1+0x04,9)=1;
|
||||
MS(20);
|
||||
}
|
||||
TC_INIT static void spi_init(void){
|
||||
/* like FU 0x3f44, as read-modify-write */
|
||||
#ifdef LCD_FASTCLK
|
||||
REG(PANEL+0x08)=0; /* clock divider: test in v0.8.18, twice as fast? */
|
||||
#else
|
||||
REG(PANEL+0x08)=1; /* clock divider */
|
||||
#endif
|
||||
SPI_CTRL &= ~(1u<<18);
|
||||
REG(PANEL+0x04) &= ~6u; REG(PANEL+0x04) &= ~1u;
|
||||
SPI_CTRL &= ~0x10u; SPI_CTRL &= ~0x08u;
|
||||
REG(PANEL+0x20)=0;
|
||||
SPI_CTRL = (SPI_CTRL & ~0xF00u) | 0x700u; /* 8 bit */
|
||||
REG(PANEL+0x24) |= 0x80000000u;
|
||||
REG(PANEL+0x24) &= ~0xFF0000u;
|
||||
REG(PANEL+0x24) |= 0x80000000u;
|
||||
REG(PANEL+0x24) &= ~0xFFu;
|
||||
SPI_CTRL |= 1u; /* SPI on */
|
||||
SPI_CTRL |= 0xC0u; /* flush FIFOs */
|
||||
}
|
||||
static void spi_tx(const u8* p, u32 n){
|
||||
for(u32 i=0;i<n;i++){
|
||||
for(u32 g=0; (SPI_STAT & 2u) && g<SPIWAIT; g++){}
|
||||
SPI_DATA=p[i];
|
||||
}
|
||||
udelay(8);
|
||||
for(u32 g=0; (SPI_STAT & 0x10u) && g<SPIWAIT; g++){}
|
||||
SPI_CTRL |= 0xC0u;
|
||||
}
|
||||
static void lcd_cmd(u8 c, const u8* par, u32 n){
|
||||
LCD_DC(0); spi_tx(&c,1);
|
||||
if(n){ LCD_DC(1); spi_tx(par,n); LCD_DC(0); }
|
||||
}
|
||||
static const u8 p36[]={0x08}, p3a[]={0x05}, p26[]={0x01},
|
||||
pb1[]={0x08,0x3b,0x3b}, pb2[]={0x08,0x3b,0x3b}, pb3[]={0x08,0x3b,0x3b,0x08,0x3b,0x3b},
|
||||
pb4[]={0x03}, pc0[]={0xe0,0x00,0x84}, pc1[]={0xc4}, pc2[]={0x0d,0x00}, pc3[]={0x8d,0x2a},
|
||||
pc4[]={0x8d,0xee}, pc5[]={0x06},
|
||||
pe0[]={0x0d,0x17,0x16,0x28,0x3f,0x39,0x30,0x31,0x2c,0x28,0x2f,0x39,0x00,0x04,0x01,0x10},
|
||||
pe1[]={0x0a,0x15,0x18,0x25,0x3f,0x37,0x2e,0x30,0x2f,0x2c,0x33,0x3f,0x00,0x03,0x04,0x10},
|
||||
p35[]={0x00}, pcas0[]={0x00,0x02,0x00,0x83}, pras0[]={0x00,0x01,0x00,0x81},
|
||||
pcas[]={0x00,0x02,0x00,0x81}, pras[]={0x00,0x01,0x00,0x80};
|
||||
TC_INIT static void display_init(void){
|
||||
spi_init();
|
||||
LCD_RST(1); MS(10); LCD_RST(0); MS(20); LCD_RST(1); MS(150); /* panel reset */
|
||||
lcd_cmd(0x11,0,0); MS(150); /* SLPOUT */
|
||||
lcd_cmd(0x36,p36,1); lcd_cmd(0x3a,p3a,1); lcd_cmd(0x26,p26,1); lcd_cmd(0x20,0,0);
|
||||
lcd_cmd(0xb1,pb1,3); lcd_cmd(0xb2,pb2,3); lcd_cmd(0xb3,pb3,6); lcd_cmd(0xb4,pb4,1);
|
||||
lcd_cmd(0xc0,pc0,3); lcd_cmd(0xc1,pc1,1); lcd_cmd(0xc2,pc2,2); lcd_cmd(0xc3,pc3,2);
|
||||
lcd_cmd(0xc4,pc4,2); lcd_cmd(0xc5,pc5,1);
|
||||
lcd_cmd(0xe0,pe0,16); lcd_cmd(0xe1,pe1,16);
|
||||
lcd_cmd(0x35,p35,1);
|
||||
lcd_cmd(0x29,0,0); MS(20); /* DISPON */
|
||||
lcd_cmd(0x2a,pcas0,4); lcd_cmd(0x2b,pras0,4);
|
||||
lcd_cmd(0x11,0,0); MS(150);
|
||||
}
|
||||
static void pwm2(u32 mr1, int first){
|
||||
if(first) REG(CT2+0x34)=0;
|
||||
REG(CT2+0x00)=0;
|
||||
REG(CT2+0x18)=0; REG(CT2+0x1C)=0; REG(CT2+0x20)=0; REG(CT2+0x24)=0;
|
||||
REG(CT2+0x14)=0;
|
||||
REG(CT2+0x00)=2; REG(CT2+0x08)=0; REG(CT2+0x00)=0;
|
||||
REG(CT2+0x14)=0x400u;
|
||||
REG(CT2+0x24)=0x17700u;
|
||||
REG(CT2+0x1C)=mr1;
|
||||
REG(CT2+0x14)=0;
|
||||
REG(CT2+0x34)=0x00200002u;
|
||||
REG(CT2+0x00)=2;
|
||||
REG(CT2+0x3C)=0x1Fu;
|
||||
REG(CT2+0x00)=1;
|
||||
}
|
||||
TC_INIT static void backlight_on(void){
|
||||
REG(0x40007034u)=0;
|
||||
pwm2(0x17700u,1);
|
||||
REG(0x40009000u)=0x5AFA0000u; REG(0x40008000u)=0x5AFA0000u; /* like FU */
|
||||
REG(0x40018034u)=0x15555155u; REG(0x40019034u)=0x55540140u;
|
||||
pwm2(0,0);
|
||||
REG(CLK+0x20)=0x42u;
|
||||
}
|
||||
|
||||
/* ---------------- our own additions ---------------- */
|
||||
/* Buzzer on timer 7, started and stopped exactly like the firmware does:
|
||||
* period in 72 MHz clock ticks, short pulse (quiet, like on the Paradise). */
|
||||
#define CT7 0x40007000u
|
||||
#ifdef TONE_FIX
|
||||
/* v0.8.15: the counter runs periodically (MCTRL bit 10 = restart at MR3, like the backlight with 0x400).
|
||||
* Before, MCTRL ended up at 0: only a single pulse per call, so a click instead of a tone.
|
||||
* If only the pitch changes, only MR0/MR3 are set again (no restart, no click). */
|
||||
void hw_tone(u32 hz){
|
||||
static u32 on;
|
||||
if(!hz){ REG(CT7+0x34)=0; REG(CT7+0x00)=0; on=0; return; }
|
||||
u32 per = 72000000u / hz, mr0 = per - per/32u;
|
||||
if(on){ REG(CT7+0x24)=per; REG(CT7+0x18)=mr0; return; }
|
||||
REG(CT7+0x34)=0;
|
||||
REG(CT7+0x00)=2; REG(CT7+0x08)=0; REG(CT7+0x00)=0;
|
||||
REG(CT7+0x18)=mr0; REG(CT7+0x1C)=0; REG(CT7+0x20)=0;
|
||||
REG(CT7+0x24)=per;
|
||||
REG(CT7+0x14)=0x400u;
|
||||
REG(CT7+0x34)=0x00100001u;
|
||||
REG(CT7+0x3C)=0x1Fu;
|
||||
REG(CT7+0x00)=1;
|
||||
on=1;
|
||||
}
|
||||
#else
|
||||
void hw_tone(u32 hz){
|
||||
if(!hz){ REG(CT7+0x34)=0; return; }
|
||||
u32 per = 72000000u / hz, mr0 = per - per/32u;
|
||||
REG(CT7+0x34)=0;
|
||||
REG(CT7+0x00)=0;
|
||||
REG(CT7+0x18)=0; REG(CT7+0x1C)=0; REG(CT7+0x20)=0; REG(CT7+0x24)=0;
|
||||
REG(CT7+0x14)=0;
|
||||
REG(CT7+0x00)=2; REG(CT7+0x08)=0; REG(CT7+0x00)=0;
|
||||
REG(CT7+0x14)=0x600u;
|
||||
REG(CT7+0x24)=per;
|
||||
REG(CT7+0x18)=mr0;
|
||||
REG(CT7+0x14)=0;
|
||||
REG(CT7+0x34)=0x00100001u;
|
||||
REG(CT7+0x00)=2;
|
||||
REG(CT7+0x3C)=0x1Fu;
|
||||
REG(CT7+0x00)=1;
|
||||
}
|
||||
#endif
|
||||
void hw_bl_pwm_off(void){ REG(CT2+0x00)=0; REG(CT2+0x34)=0; } /* backlight off only (when leaving) */
|
||||
#ifdef BL_SLEEP
|
||||
/* v0.8.18: off = put the display to sleep (DISPOFF, SLPIN) and stop the backlight timer,
|
||||
* PWM output off (like panel_down in the Flash Tool). On = SLPOUT, short wait, DISPON, restart backlight.
|
||||
* MR1 values alone (v0.8.17) had no effect on the device. */
|
||||
void hw_backlight(int on){
|
||||
static int is_on=1;
|
||||
if(on){ if(is_on) return; lcd_cmd(0x11,0,0); MS(10); lcd_cmd(0x29,0,0); pwm2(0u,1); is_on=1; }
|
||||
else { if(!is_on) return; REG(CT2+0x00)=0; REG(CT2+0x34)=0; lcd_cmd(0x28,0,0); lcd_cmd(0x10,0,0); is_on=0; }
|
||||
}
|
||||
#elif defined(BL_OFFFIX)
|
||||
/* v0.8.17: duty cycle 0 = full brightness. MR1 equal to the period (0x17700) never matches, so it stayed bright.
|
||||
* One tick before the end of the period is practically dark. */
|
||||
void hw_backlight(int on){ pwm2(on ? 0u : 0x176FFu, 0); }
|
||||
#else
|
||||
void hw_backlight(int on){ pwm2(on ? 0u : 0x17700u, 0); }
|
||||
#endif
|
||||
void hw_wdt_feed(void){ REG(0x4000800Cu)=0x5AFA55AAu; REG(0x4000900Cu)=0x5AFA55AAu; }
|
||||
|
||||
TC_INIT void hw_init(void){
|
||||
wdt_off(); mailbox_clear(); clock_init(); periph_enable(); flashctl_init(); pin_mux();
|
||||
display_power(); display_init(); backlight_on();
|
||||
/* Buttons: P0.8 wheel, P0.9 A, P0.10 C, P0.11 B as inputs (active low) */
|
||||
REG(GPIO0+0x04) &= ~((1u<<8)|(1u<<9)|(1u<<10)|(1u<<11));
|
||||
flashctl_init();
|
||||
}
|
||||
|
||||
u32 hw_buttons(void){
|
||||
u32 d = REG(GPIO0+0x00);
|
||||
u32 b = 0;
|
||||
if(!(d & (1u<<9))) b |= BTN_A;
|
||||
if(!(d & (1u<<11))) b |= BTN_B;
|
||||
if(!(d & (1u<<10))) b |= BTN_C;
|
||||
if(!(d & (1u<<8))) b |= BTN_WHEEL;
|
||||
return b;
|
||||
}
|
||||
|
||||
/* Send rectangle x0..x1-1, y0..y1-1 from a 128 wide framebuffer (RGB565) to the panel. */
|
||||
void hw_push(const u16* fb, u32 stride, u32 x0, u32 y0, u32 x1, u32 y1){
|
||||
u8 ca[4]={0x00,(u8)(x0+2),0x00,(u8)(x1+1)};
|
||||
u8 ra[4]={0x00,(u8)(y0+1),0x00,(u8)(y1)};
|
||||
lcd_cmd(0x2a,ca,4); lcd_cmd(0x2b,ra,4);
|
||||
LCD_DC(0); { u8 c=0x2c; spi_tx(&c,1); }
|
||||
LCD_DC(1);
|
||||
for(u32 y=y0;y<y1;y++){
|
||||
const u16* r=fb+y*stride;
|
||||
for(u32 x=x0;x<x1;x++){
|
||||
u8 two[2]={(u8)(r[x]>>8),(u8)r[x]};
|
||||
spi_tx(&two[0],1); spi_tx(&two[1],1); /* byte by byte like the FU (1.3.8) */
|
||||
}
|
||||
}
|
||||
LCD_DC(0);
|
||||
}
|
||||
|
||||
#ifdef FAST_LCD
|
||||
/* v0.8.17: pixel output in one go per rectangle, 16 bytes per SPI pass (like the gamma tables
|
||||
* in display init, which work this way on the device). Before, per byte: wait, pause of 8, wait. */
|
||||
void hw_px_begin(u32 x0, u32 y0, u32 x1, u32 y1){
|
||||
u8 ca[4]={0x00,(u8)(x0+2),0x00,(u8)(x1+1)};
|
||||
u8 ra[4]={0x00,(u8)(y0+1),0x00,(u8)(y1)};
|
||||
lcd_cmd(0x2a,ca,4); lcd_cmd(0x2b,ra,4);
|
||||
LCD_DC(0); { u8 c=0x2c; spi_tx(&c,1); }
|
||||
LCD_DC(1);
|
||||
}
|
||||
void hw_px_row(const u16* r, u32 n){
|
||||
u8 b[16]; u32 k=0;
|
||||
for(u32 i=0;i<n;i++){ b[k++]=(u8)(r[i]>>8); b[k++]=(u8)r[i]; if(k==16u){ spi_tx(b,16); k=0; } }
|
||||
if(k) spi_tx(b,k);
|
||||
}
|
||||
void hw_px_end(void){ LCD_DC(0); }
|
||||
#endif
|
||||
|
||||
/* Back to the Paradise: firmware routine that reloads the encrypted PRAM image
|
||||
and restarts (flash 0x110568, XIP 0x100FF569). */
|
||||
void hw_back_to_paradise(void){
|
||||
__asm__ volatile("cpsid i");
|
||||
((void(*)(void))(PARADISE_REBOOT|1u))();
|
||||
for(;;){}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef HW_H
|
||||
#define HW_H
|
||||
#include "io.h"
|
||||
#define BTN_A 1u
|
||||
#define BTN_B 2u
|
||||
#define BTN_C 4u
|
||||
#define BTN_WHEEL 8u
|
||||
#ifndef PARADISE_REBOOT
|
||||
#define PARADISE_REBOOT 0x100FF568u
|
||||
#endif
|
||||
void hw_init(void);
|
||||
void hw_wdt_feed(void);
|
||||
u32 hw_buttons(void);
|
||||
void hw_push(const u16* fb, u32 stride, u32 x0, u32 y0, u32 x1, u32 y1);
|
||||
void hw_back_to_paradise(void);
|
||||
void hw_backlight(int on);
|
||||
void hw_bl_pwm_off(void);
|
||||
void hw_tone(u32 hz); /* 0 = off */
|
||||
#ifdef FAST_LCD
|
||||
void hw_px_begin(u32 x0, u32 y0, u32 x1, u32 y1);
|
||||
void hw_px_row(const u16* r, u32 n);
|
||||
void hw_px_end(void);
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef IO_H
|
||||
#define IO_H
|
||||
typedef unsigned int u32; typedef unsigned short u16; typedef unsigned char u8;
|
||||
#define REG(a) (*(volatile u32*)(a))
|
||||
#define UART 0x4000B000u
|
||||
#define FCTL 0x40022000u
|
||||
#define CLK 0x45000000u
|
||||
static inline void dsb(void){ __asm__ volatile("dsb":::"memory"); }
|
||||
|
||||
#ifndef TC_INIT
|
||||
#define TC_INIT __attribute__((section(".initcode"), noinline))
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,326 @@
|
||||
{
|
||||
"chars": [
|
||||
"·",
|
||||
"가",
|
||||
"간",
|
||||
"감",
|
||||
"값",
|
||||
"강",
|
||||
"개",
|
||||
"거",
|
||||
"건",
|
||||
"게",
|
||||
"경",
|
||||
"계",
|
||||
"고",
|
||||
"과",
|
||||
"관",
|
||||
"그",
|
||||
"글",
|
||||
"금",
|
||||
"기",
|
||||
"까",
|
||||
"꺼",
|
||||
"끄",
|
||||
"끔",
|
||||
"난",
|
||||
"남",
|
||||
"뉴",
|
||||
"는",
|
||||
"니",
|
||||
"다",
|
||||
"단",
|
||||
"대",
|
||||
"데",
|
||||
"도",
|
||||
"돌",
|
||||
"동",
|
||||
"되",
|
||||
"됨",
|
||||
"됩",
|
||||
"뒤",
|
||||
"드",
|
||||
"득",
|
||||
"때",
|
||||
"랜",
|
||||
"램",
|
||||
"량",
|
||||
"러",
|
||||
"레",
|
||||
"력",
|
||||
"로",
|
||||
"록",
|
||||
"료",
|
||||
"류",
|
||||
"름",
|
||||
"리",
|
||||
"릭",
|
||||
"마",
|
||||
"메",
|
||||
"면",
|
||||
"목",
|
||||
"미",
|
||||
"방",
|
||||
"배",
|
||||
"벨",
|
||||
"변",
|
||||
"보",
|
||||
"복",
|
||||
"본",
|
||||
"봄",
|
||||
"부",
|
||||
"분",
|
||||
"불",
|
||||
"비",
|
||||
"사",
|
||||
"삭",
|
||||
"상",
|
||||
"새",
|
||||
"서",
|
||||
"선",
|
||||
"설",
|
||||
"성",
|
||||
"세",
|
||||
"셔",
|
||||
"소",
|
||||
"손",
|
||||
"수",
|
||||
"숫",
|
||||
"스",
|
||||
"습",
|
||||
"시",
|
||||
"식",
|
||||
"실",
|
||||
"아",
|
||||
"않",
|
||||
"알",
|
||||
"았",
|
||||
"어",
|
||||
"업",
|
||||
"없",
|
||||
"었",
|
||||
"에",
|
||||
"역",
|
||||
"열",
|
||||
"예",
|
||||
"오",
|
||||
"옵",
|
||||
"완",
|
||||
"요",
|
||||
"용",
|
||||
"운",
|
||||
"워",
|
||||
"원",
|
||||
"유",
|
||||
"으",
|
||||
"을",
|
||||
"음",
|
||||
"의",
|
||||
"이",
|
||||
"인",
|
||||
"읽",
|
||||
"임",
|
||||
"입",
|
||||
"있",
|
||||
"자",
|
||||
"작",
|
||||
"잠",
|
||||
"장",
|
||||
"재",
|
||||
"저",
|
||||
"적",
|
||||
"전",
|
||||
"정",
|
||||
"제",
|
||||
"조",
|
||||
"존",
|
||||
"중",
|
||||
"지",
|
||||
"짐",
|
||||
"집",
|
||||
"참",
|
||||
"체",
|
||||
"초",
|
||||
"추",
|
||||
"취",
|
||||
"치",
|
||||
"카",
|
||||
"캐",
|
||||
"컬",
|
||||
"코",
|
||||
"크",
|
||||
"타",
|
||||
"택",
|
||||
"터",
|
||||
"템",
|
||||
"통",
|
||||
"트",
|
||||
"패",
|
||||
"편",
|
||||
"포",
|
||||
"품",
|
||||
"프",
|
||||
"플",
|
||||
"픔",
|
||||
"피",
|
||||
"하",
|
||||
"한",
|
||||
"할",
|
||||
"함",
|
||||
"합",
|
||||
"행",
|
||||
"현",
|
||||
"형",
|
||||
"화",
|
||||
"확",
|
||||
"환",
|
||||
"회",
|
||||
"후",
|
||||
"휠"
|
||||
],
|
||||
"translations": {
|
||||
"SAVING": "저장 중",
|
||||
"CHECKING": "확인 중",
|
||||
"LOADING": "불러오는 중",
|
||||
"ERROR": "오류",
|
||||
"CODE 00": "코드 00",
|
||||
"SAVE TOO BIG": "저장 용량 초과",
|
||||
"B OR C: BACK": "B/C 돌아가기",
|
||||
"C BACK": "C 뒤로",
|
||||
"DONE": "완료",
|
||||
"PROGRAM": "프로그램",
|
||||
"SETTINGS": "설정",
|
||||
"DOWNLOAD": "다운로드",
|
||||
"PLEASE WAIT": "잠시 기다리세요",
|
||||
"DO NOT SWITCH OFF": "전원을 유지하세요",
|
||||
"SWITCH TO": "전환 대상",
|
||||
"SAVED GAME": "보관한 저장을",
|
||||
"FIELD STARTS": "이 지역에서",
|
||||
"WILL BE LOADED": "불러옵니다",
|
||||
"FROM SCRATCH": "새로 시작합니다",
|
||||
"B = YES": "B 예",
|
||||
"C = NO": "C 아니요",
|
||||
"1 MIN": "1분",
|
||||
"2 MIN": "2분",
|
||||
"5 MIN": "5분",
|
||||
"NEVER": "끄지 않음",
|
||||
"CLOCK, DISPLAY": "시계·화면",
|
||||
"SOUND, DISPLAY": "소리·화면",
|
||||
"PROGRAMS": "프로그램",
|
||||
"OPEN": "열기",
|
||||
"START": "시작",
|
||||
"PC FLASH": "PC 기록",
|
||||
"B START": "B 시작",
|
||||
"B OK C BACK": "B 확인 C 뒤로",
|
||||
"FIELD": "지역",
|
||||
"CHOOSE": "선택",
|
||||
"ACTIVE": "사용 중",
|
||||
"SAVED": "저장됨",
|
||||
"NEW": "새로",
|
||||
"SAVE DATA": "저장 데이터가",
|
||||
"IS DAMAGED": "손상되었습니다",
|
||||
"NOTHING CHANGED": "변경하지 않았습니다",
|
||||
"NO SAVE YET": "저장 데이터 없음",
|
||||
"PLAY A LITTLE": "조금 플레이한 뒤",
|
||||
"AND TRY AGAIN": "다시 시도하세요",
|
||||
"SAVE FORMAT": "저장 형식을",
|
||||
"UNKNOWN": "알 수 없습니다",
|
||||
"SET THE CLOCK": "시계 설정",
|
||||
"WHEEL: CHANGE": "휠 변경",
|
||||
"A: NEXT B: SAVE": "A 다음 B 저장",
|
||||
"C: BACK": "C 뒤로",
|
||||
"NOT SET": "미설정",
|
||||
"CLOCK": "시계",
|
||||
"DISPLAY": "화면",
|
||||
"DISPLAY: DARK": "화면 꺼짐",
|
||||
"WITHOUT A KEY": "입력이 없을 때",
|
||||
"B CHANGE": "B 변경",
|
||||
"C SAVE AND BACK": "C 저장 후 뒤로",
|
||||
"OFF": "끔",
|
||||
"LOW": "작게",
|
||||
"MEDIUM": "보통",
|
||||
"LOUD": "크게",
|
||||
"SOUND": "소리",
|
||||
"SOUND: THE PARADISE": "소리: 본편 적용",
|
||||
"DISPLAY: THIS MENU,": "화면: 이 메뉴에서",
|
||||
"DARK WITHOUT A KEY": "입력 없으면 꺼짐",
|
||||
"NO PICS": "이미지 없음",
|
||||
"FOOD": "식사",
|
||||
"SNACKS": "간식",
|
||||
"TOYS": "장난감",
|
||||
"GOODS": "용품",
|
||||
"OTHER": "기타",
|
||||
"+ ADD ITEM": "+ 아이템 추가",
|
||||
"REMOVE": "제거",
|
||||
"WHEEL: COUNT": "휠 수량",
|
||||
"NO ITEM LIST": "아이템 목록 없음",
|
||||
"IN THIS ROM": "현재 ROM에",
|
||||
"ADD: ": "추가: ",
|
||||
"A NEXT GROUP C BACK": "A 분류 C 뒤로",
|
||||
"BAG IS FULL": "가방이 가득 참",
|
||||
"ITEMS": "아이템",
|
||||
"B EDIT C BACK": "B 편집 C 뒤로",
|
||||
"SAVE CHANGES?": "변경을 저장할까요?",
|
||||
"THE TAMA RESTARTS": "본체가 재시작됩니다",
|
||||
"ITEMS SAVED": "아이템 저장 완료",
|
||||
"TAMAPOINTS": "다마포인트",
|
||||
"WHEEL: DIGIT": "휠 숫자 변경",
|
||||
"B NEXT A BACK": "B 다음 A 이전",
|
||||
"C CANCEL": "C 취소",
|
||||
"SET TAMAPOINTS TO": "포인트 설정값",
|
||||
"TAMAPOINTS SAVED": "포인트 저장 완료",
|
||||
"EGG": "알",
|
||||
"BABY": "아기",
|
||||
"KID": "유아기",
|
||||
"YOUNG": "성장기",
|
||||
"ADULT": "성체",
|
||||
"NO CHARACTERS": "캐릭터 없음",
|
||||
"TAMA: ": "다마: ",
|
||||
"A STAGE B OK C BACK": "A 단계 B 확인 C 뒤로",
|
||||
"YOUR TAMA BECOMES": "변경할 다마고치",
|
||||
"TAMA NOT FOUND": "다마고치 없음",
|
||||
"TAMA CHANGED": "다마고치 변경됨",
|
||||
"PLANET LEVEL": "행성 레벨",
|
||||
"WHEEL: LEVEL": "휠 레벨 변경",
|
||||
"LEVEL SAVED": "레벨 저장 완료",
|
||||
"FULL CARE:": "돌봄 회복",
|
||||
"FED, HAPPY, HEALTHY": "배부름·행복·건강",
|
||||
"TAMA CARED FOR": "돌봄 회복 완료",
|
||||
"TAMA": "다마고치",
|
||||
"LEVEL": "레벨",
|
||||
"CHANGE": "변경",
|
||||
"FOOD ": "배부름 ",
|
||||
" JOY ": " 행복 ",
|
||||
" SICK": " 아픔",
|
||||
"CARE": "돌봄",
|
||||
"START ON FIELD": "시작할 지역",
|
||||
"SAVES": "저장 목록",
|
||||
"SAVE ": "저장 ",
|
||||
"EMPTY": "비어 있음",
|
||||
"SAVE": "저장",
|
||||
"UNREADABLE": "읽기 실패",
|
||||
"LOAD": "불러오기",
|
||||
"NEW GAME IN": "새 게임 지역",
|
||||
"YOUR GAME IS KEPT": "기존 저장 유지",
|
||||
" IN BAG": "개 보유",
|
||||
"POINTS": "포인트",
|
||||
"THE TAMA MOVED TO": "다마고치 이동 지역",
|
||||
"IN THE GAME": "게임에서 이동함",
|
||||
"AN OLDER SAVE OF": "이전 지역의",
|
||||
"IS STILL STORED": "저장이 남아 있음",
|
||||
"B = DELETE IT": "B 삭제",
|
||||
"C = KEEP IT": "C 유지",
|
||||
"SWITCH WAS": "전환 작업이",
|
||||
"INTERRUPTED": "중단되었습니다",
|
||||
"RESTORE SAVE OF": "저장을 복원할까요",
|
||||
"NO PROGRAMS": "프로그램 없음"
|
||||
},
|
||||
"fields": {
|
||||
"LAND": "랜드",
|
||||
"WATER": "워터",
|
||||
"SKY": "스카이",
|
||||
"FOREST": "포레스트",
|
||||
"TROPICAL": "트로피컬",
|
||||
"GLACIER": "글레이셔"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
SAVING 저장 중
|
||||
CHECKING 확인 중
|
||||
LOADING 불러오는 중
|
||||
ERROR 오류
|
||||
CODE 00 코드 00
|
||||
SAVE TOO BIG 저장 용량 초과
|
||||
B OR C: BACK B/C 돌아가기
|
||||
C BACK C 뒤로
|
||||
DONE 완료
|
||||
PROGRAM 프로그램
|
||||
SETTINGS 설정
|
||||
DOWNLOAD 다운로드
|
||||
PLEASE WAIT 잠시 기다리세요
|
||||
DO NOT SWITCH OFF 전원을 유지하세요
|
||||
SWITCH TO 전환 대상
|
||||
SAVED GAME 보관한 저장을
|
||||
FIELD STARTS 이 지역에서
|
||||
WILL BE LOADED 불러옵니다
|
||||
FROM SCRATCH 새로 시작합니다
|
||||
B = YES B 예
|
||||
C = NO C 아니요
|
||||
1 MIN 1분
|
||||
2 MIN 2분
|
||||
5 MIN 5분
|
||||
NEVER 끄지 않음
|
||||
CLOCK, DISPLAY 시계·화면
|
||||
SOUND, DISPLAY 소리·화면
|
||||
PROGRAMS 프로그램
|
||||
OPEN 열기
|
||||
START 시작
|
||||
PC FLASH PC 기록
|
||||
B START B 시작
|
||||
B OK C BACK B 확인 C 뒤로
|
||||
FIELD 지역
|
||||
CHOOSE 선택
|
||||
ACTIVE 사용 중
|
||||
SAVED 저장됨
|
||||
NEW 새로
|
||||
SAVE DATA 저장 데이터가
|
||||
IS DAMAGED 손상되었습니다
|
||||
NOTHING CHANGED 변경하지 않았습니다
|
||||
NO SAVE YET 저장 데이터 없음
|
||||
PLAY A LITTLE 조금 플레이한 뒤
|
||||
AND TRY AGAIN 다시 시도하세요
|
||||
SAVE FORMAT 저장 형식을
|
||||
UNKNOWN 알 수 없습니다
|
||||
SET THE CLOCK 시계 설정
|
||||
WHEEL: CHANGE 휠 변경
|
||||
A: NEXT B: SAVE A 다음 B 저장
|
||||
C: BACK C 뒤로
|
||||
NOT SET 미설정
|
||||
CLOCK 시계
|
||||
DISPLAY 화면
|
||||
DISPLAY: DARK 화면 꺼짐
|
||||
WITHOUT A KEY 입력이 없을 때
|
||||
B CHANGE B 변경
|
||||
C SAVE AND BACK C 저장 후 뒤로
|
||||
OFF 끔
|
||||
LOW 작게
|
||||
MEDIUM 보통
|
||||
LOUD 크게
|
||||
SOUND 소리
|
||||
SOUND: THE PARADISE 소리: 본편 적용
|
||||
DISPLAY: THIS MENU, 화면: 이 메뉴에서
|
||||
DARK WITHOUT A KEY 입력 없으면 꺼짐
|
||||
NO PICS 이미지 없음
|
||||
FOOD 식사
|
||||
SNACKS 간식
|
||||
TOYS 장난감
|
||||
GOODS 용품
|
||||
OTHER 기타
|
||||
+ ADD ITEM + 아이템 추가
|
||||
REMOVE 제거
|
||||
WHEEL: COUNT 휠 수량
|
||||
NO ITEM LIST 아이템 목록 없음
|
||||
IN THIS ROM 현재 ROM에
|
||||
ADD: 추가:
|
||||
A NEXT GROUP C BACK A 분류 C 뒤로
|
||||
BAG IS FULL 가방이 가득 참
|
||||
ITEMS 아이템
|
||||
B EDIT C BACK B 편집 C 뒤로
|
||||
SAVE CHANGES? 변경을 저장할까요?
|
||||
THE TAMA RESTARTS 본체가 재시작됩니다
|
||||
ITEMS SAVED 아이템 저장 완료
|
||||
TAMAPOINTS 다마포인트
|
||||
WHEEL: DIGIT 휠 숫자 변경
|
||||
B NEXT A BACK B 다음 A 이전
|
||||
C CANCEL C 취소
|
||||
SET TAMAPOINTS TO 포인트 설정값
|
||||
TAMAPOINTS SAVED 포인트 저장 완료
|
||||
EGG 알
|
||||
BABY 아기
|
||||
KID 유아기
|
||||
YOUNG 성장기
|
||||
ADULT 성체
|
||||
NO CHARACTERS 캐릭터 없음
|
||||
TAMA: 다마:
|
||||
A STAGE B OK C BACK A 단계 B 확인 C 뒤로
|
||||
YOUR TAMA BECOMES 변경할 다마고치
|
||||
TAMA NOT FOUND 다마고치 없음
|
||||
TAMA CHANGED 다마고치 변경됨
|
||||
PLANET LEVEL 행성 레벨
|
||||
WHEEL: LEVEL 휠 레벨 변경
|
||||
LEVEL SAVED 레벨 저장 완료
|
||||
FULL CARE: 돌봄 회복
|
||||
FED, HAPPY, HEALTHY 배부름·행복·건강
|
||||
TAMA CARED FOR 돌봄 회복 완료
|
||||
TAMA 다마고치
|
||||
LEVEL 레벨
|
||||
CHANGE 변경
|
||||
FOOD 배부름
|
||||
JOY 행복
|
||||
SICK 아픔
|
||||
CARE 돌봄
|
||||
START ON FIELD 시작할 지역
|
||||
SAVES 저장 목록
|
||||
SAVE 저장
|
||||
EMPTY 비어 있음
|
||||
SAVE 저장
|
||||
UNREADABLE 읽기 실패
|
||||
LOAD 불러오기
|
||||
NEW GAME IN 새 게임 지역
|
||||
YOUR GAME IS KEPT 기존 저장 유지
|
||||
IN BAG 개 보유
|
||||
POINTS 포인트
|
||||
THE TAMA MOVED TO 다마고치 이동 지역
|
||||
IN THE GAME 게임에서 이동함
|
||||
AN OLDER SAVE OF 이전 지역의
|
||||
IS STILL STORED 저장이 남아 있음
|
||||
B = DELETE IT B 삭제
|
||||
C = KEEP IT C 유지
|
||||
SWITCH WAS 전환 작업이
|
||||
INTERRUPTED 중단되었습니다
|
||||
RESTORE SAVE OF 저장을 복원할까요
|
||||
NO PROGRAMS 프로그램 없음
|
||||
|
@@ -0,0 +1,14 @@
|
||||
#include <stddef.h>
|
||||
void *memset(void *d, int c, size_t n){ unsigned char *p=d; while(n--) *p++=(unsigned char)c; return d; }
|
||||
void *memcpy(void *d, const void *s, size_t n){ unsigned char *p=d; const unsigned char *q=s; while(n--) *p++=*q++; return d; }
|
||||
void *memmove(void *d, const void *s, size_t n){ unsigned char *p=d; const unsigned char *q=s;
|
||||
if(p<q){ while(n--) *p++=*q++; } else { p+=n; q+=n; while(n--) *--p=*--q; } return d; }
|
||||
int memcmp(const void *a, const void *b, size_t n){ const unsigned char *p=a,*q=b; for(;n;n--,p++,q++) if(*p!=*q) return *p-*q; return 0; }
|
||||
void __aeabi_memcpy(void *d, const void *s, size_t n){ memcpy(d,s,n); }
|
||||
void __aeabi_memcpy4(void *d, const void *s, size_t n){ memcpy(d,s,n); }
|
||||
void __aeabi_memcpy8(void *d, const void *s, size_t n){ memcpy(d,s,n); }
|
||||
void __aeabi_memset(void *d, size_t n, int c){ memset(d,c,n); }
|
||||
void __aeabi_memset4(void *d, size_t n, int c){ memset(d,c,n); }
|
||||
void __aeabi_memclr(void *d, size_t n){ memset(d,0,n); }
|
||||
void __aeabi_memclr4(void *d, size_t n){ memset(d,0,n); }
|
||||
void __aeabi_memclr8(void *d, size_t n){ memset(d,0,n); }
|
||||
@@ -0,0 +1,20 @@
|
||||
ENTRY(Reset_Handler)
|
||||
MEMORY {
|
||||
PRAM (rwx) : ORIGIN = 0x00000000, LENGTH = 0x10000
|
||||
SRAM (rw) : ORIGIN = 0x18000000, LENGTH = 0x1E000
|
||||
}
|
||||
SECTIONS {
|
||||
.text : {
|
||||
KEEP(*(.vectors))
|
||||
KEEP(*(.pmxcfg))
|
||||
*(.text*)
|
||||
*(.rodata*)
|
||||
KEEP(*(.initcode))
|
||||
KEEP(*(.initdata*))
|
||||
. = ALIGN(4);
|
||||
} > PRAM
|
||||
.bss (NOLOAD) : { __bss_start = .; *(.bss*) *(COMMON) . = ALIGN(4); __bss_end = .; } > SRAM
|
||||
ASSERT(SIZEOF(.data) == 0, "no initialised data allowed")
|
||||
.data : { *(.data*) } > SRAM
|
||||
/DISCARD/ : { *(.comment) *(.ARM.*) *(.note*) }
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,31 @@
|
||||
/* Synthetic PC-only fixture: contains no vendor ROM or device data. */
|
||||
#define HOST
|
||||
#include "main-ko.c"
|
||||
#define main upstream_host_main
|
||||
#define g_out host_output_path
|
||||
#include "host.c"
|
||||
#undef g_out
|
||||
#undef main
|
||||
static void scenario(void (*fn)(void), const char *keys){
|
||||
g_seq=keys;g_pos=0;if(!setjmp(g_jb))fn();
|
||||
}
|
||||
static void show_fields(void){field_menu(0,0);}
|
||||
static void sample_message(void){message("\200\200","","");}
|
||||
int main(int argc,char **argv){
|
||||
if(argc!=2)return 2;
|
||||
g_dir=argv[1];g_frame=0;host_flash=malloc(0x1000000);memset(host_flash,0xFF,0x1000000);
|
||||
for(u32 i=0;i<PAGE;i++)g_ff[i]=255;
|
||||
g_cfg.flags=F_FIELDS|F_BAG|F_TAMA|F_SAVES;
|
||||
g_cfg.version=9;g_cfg.nfields=3;g_cfg.nslots=3;g_cfg.slot_off=0x800000;g_cfg.slot_size=0x10000;
|
||||
g_cfg.cat_n=0;g_cfg.tama_off=0x200;g_cfg.level_off=0x240;
|
||||
g_cfg.money_off=0x250;g_cfg.list_off=0x300;g_cfg.count_off=0x900;g_cfg.field_byte=443;
|
||||
g_cur=0;g_act=0;g_napp=2;strcpy(g_appnm[0],"TAMA-GO");strcpy(g_appnm[1],"V3");
|
||||
memset(g_set,0,PAGE);g_set[0x1c]=2026&255;g_set[0x1d]=2026>>8;g_set[0x1e]=11;g_set[0x20]=10;
|
||||
g_set[g_cfg.tama_off+0x1c]=6;g_set[g_cfg.tama_off+0x1d]=20;g_set[g_cfg.level_off]=5;
|
||||
g_set[g_cfg.money_off]=0x39;g_set[g_cfg.money_off+1]=0x30;
|
||||
stamp(g_set);memcpy(host_flash+SET_A,g_set,PAGE);memcpy(host_flash+SET_B,g_set,PAGE);
|
||||
scenario(main_menu,"nnnnc");scenario(tama_menu,"nnc");scenario(show_fields,"nc");
|
||||
scenario(points_menu,"c");scenario(level_edit,"c");scenario(care_full,"c");
|
||||
printf("Synthetic menu frames: %d\n",g_frame);
|
||||
free(host_flash);return 0;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/* Offline renderer. Supply your own private ROM; never distribute that image. */
|
||||
#define HOST
|
||||
#include "main-ko.c"
|
||||
#define main upstream_host_main
|
||||
#define g_out host_output_path
|
||||
#include "host.c"
|
||||
#undef main
|
||||
#undef g_out
|
||||
static void scenario(void (*fn)(void),const char *keys){g_seq=keys;g_pos=0;if(!setjmp(g_jb))fn();}
|
||||
static void fields(void){field_menu(0,0);}
|
||||
int main(int argc,char **argv){
|
||||
if(argc!=4)return 2;
|
||||
host_flash=malloc(0x1000000);FILE *f=fopen(argv[1],"rb");if(!f)return 3;
|
||||
if(fread(host_flash,1,0x1000000,f)!=0x1000000)return 4;fclose(f);
|
||||
u32 offset=(u32)strtoul(argv[2],0,0);memcpy((void*)&g_cfg,host_flash+offset+0x140,sizeof g_cfg);
|
||||
g_dir=argv[3];for(u32 i=0;i<PAGE;i++)g_ff[i]=255;set_load();g_cur=0;g_act=0;g_napp=0;
|
||||
scenario(main_menu,"nnnc");scenario(tama_menu,"nnc");scenario(chr_pick,"nnnaannc");scenario(cat_pick,"nnac");scenario(points_menu,"c");scenario(fields,"nc");
|
||||
printf("Rendered %d native-style menu frames\n",g_frame);free(host_flash);return 0;
|
||||
}
|
||||
@@ -0,0 +1,346 @@
|
||||
@ Stub in XIP flash: copies the app image to PRAM 0 and restarts.
|
||||
@ APP_SRC (XIP address of the image) is set at build time.
|
||||
@ With HOOKS: four entry points for the home screen handlers. They count how
|
||||
@ long A and C are held together, start the emulator after LIMIT calls and
|
||||
@ otherwise call the original handler.
|
||||
.syntax unified
|
||||
.thumb
|
||||
|
||||
@ Autostart (v1.2.8): with AUTO set, the stub decides once per boot (first home screen call)
|
||||
@ whether to start the emulator right away. Mailbox word 0x20000FFC (kept over a restart and
|
||||
@ the reset button, lost in the Paradise's deep sleep):
|
||||
@ "PMXL" written by the emulator when going back: stay in the Paradise
|
||||
@ "PMXR" written here: any later restart with it (reset button) starts the emulator
|
||||
@ other power-on or waking from deep sleep: the Paradise's seconds counter tells them
|
||||
@ apart (it starts at 0 after power-on and when the clock is set)
|
||||
@ Holding B skips the emulator. "Decided this boot" is kept in the UsageFault priority
|
||||
@ (SHPR1 byte 2): it is cleared by every reset and the firmware does not use it.
|
||||
@ AUTO is a placeholder the Studio sets to 0 or 1.
|
||||
#ifndef AUTO
|
||||
#define AUTO 0
|
||||
#endif
|
||||
.macro AUTOSTART
|
||||
#if defined(HOOKS)
|
||||
ldr r2, =AUTO
|
||||
cbz r2, 7f
|
||||
ldr r2, =0xE000ED18
|
||||
ldrb r3, [r2, #2]
|
||||
cbnz r3, 7f @ already decided in this boot
|
||||
movs r3, #0xFF
|
||||
strb r3, [r2, #2]
|
||||
ldrb r3, [r2, #2]
|
||||
cbz r3, 7f @ cannot keep the flag: never autostart
|
||||
ldr r2, =0x20000FFC
|
||||
ldr r3, [r2]
|
||||
ldr r0, =0x4C584D50 @ "PMXL": back from the emulator
|
||||
cmp r3, r0
|
||||
beq 8f
|
||||
ldr r0, =0x52584D50 @ "PMXR": restart while running
|
||||
cmp r3, r0
|
||||
beq 9f
|
||||
ldr r0, =0x45000304 @ mailbox lost: deep sleep (clock ran) or power-on (clock new)
|
||||
ldr r0, [r0]
|
||||
cmp r0, #30
|
||||
bhs 8f
|
||||
9:
|
||||
ldr r0, =0x52584D50
|
||||
str r0, [r2]
|
||||
tst r1, #0x800 @ B (P0.11) held: stay in the Paradise
|
||||
beq 7f
|
||||
b start
|
||||
8:
|
||||
ldr r0, =0x52584D50
|
||||
str r0, [r2]
|
||||
7:
|
||||
ldr r0, =0x40018000
|
||||
#endif
|
||||
.endm
|
||||
@ 1.7.2 test19 (BFALL): C held when the Paradise comes up after switching on (or after the reset button) starts
|
||||
@ the flash app of the write protection (0xFF0000, its load table at 0xFFE000), a way back when a program or a
|
||||
@ save leaves the screen black. Once per boot (BusFault priority byte as the flag, the firmware does not use it);
|
||||
@ not when back from a program on purpose ("PMXL") and not after waking from deep sleep (mailbox lost, clock ran).
|
||||
#ifndef NO_BFALL
|
||||
.macro BFALL
|
||||
ldr r2, =0xE000ED19
|
||||
ldrb r3, [r2]
|
||||
cbnz r3, 7f
|
||||
movs r3, #0xFF
|
||||
strb r3, [r2]
|
||||
ldrb r3, [r2]
|
||||
cbz r3, 7f
|
||||
tst r1, #0x400 @ C (P0.10); B at switching on already skips the autostart
|
||||
bne 7f
|
||||
#ifndef BFALL_WITH_A
|
||||
@ 1.7.3 test29 (BFALL_NOA): not with A held too. A and C is the program key on the home screen; the first home
|
||||
@ handler call of a boot with A+C held (within 30 s of switching on, or after a reset) started the flash app instead.
|
||||
tst r1, #0x200 @ A (P0.9) held: the menu key, no way back
|
||||
beq 7f
|
||||
#endif
|
||||
ldr r2, =0x20000FFC
|
||||
ldr r2, [r2]
|
||||
ldr r0, =0x4C584D50
|
||||
cmp r2, r0
|
||||
beq 7f
|
||||
ldr r0, =0x45000304
|
||||
ldr r0, [r0]
|
||||
cmp r0, #30
|
||||
blo 6f
|
||||
ldr r0, =0x52584D50 @ "PMXR" / "PMXM": a reset, the mailbox was kept
|
||||
cmp r2, r0
|
||||
beq 6f
|
||||
ldr r0, =0x4D584D50
|
||||
cmp r2, r0
|
||||
bne 7f
|
||||
6:ldr r0, =0x60FFE000 @ load table of the flash app, uncached flash
|
||||
ldr r2, [r0]
|
||||
ldr r3, =0x494E4F53 @ "SONI"
|
||||
cmp r2, r3
|
||||
bne 7f
|
||||
ldr r2, [r0, #0x10]
|
||||
ldr r3, =0x60FF0000
|
||||
cmp r2, r3
|
||||
bne 7f
|
||||
cpsid i
|
||||
mov r4, r3
|
||||
b realstart
|
||||
7:
|
||||
ldr r0, =0x40018000
|
||||
ldr r1, [r0]
|
||||
.endm
|
||||
#else
|
||||
.macro BFALL
|
||||
.endm
|
||||
#endif
|
||||
.global start
|
||||
.thumb_func
|
||||
start:
|
||||
cpsid i
|
||||
#ifdef FELD
|
||||
ldr r4, app_src
|
||||
b.w realstart
|
||||
.align 2
|
||||
app_src: .word APP_SRC
|
||||
@ 1.6.0: start the program image at r0 (XIP address), fixed at +0x0C. The menu starts its
|
||||
@ other programs (more emulators) through here.
|
||||
.global start_src
|
||||
.thumb_func
|
||||
start_src:
|
||||
cpsid i
|
||||
mov r4, r0
|
||||
@ 1.6.6: the cached window (0x10000000) shows only 1 MB from 0x11000; programs further up (more emulators
|
||||
@ from 0xD40000 down) came out as garbage. Copy from the uncached flash (0x60000000 + offset) instead.
|
||||
add r4, r4, #0x50000000
|
||||
add r4, r4, #0x11000
|
||||
b.w realstart
|
||||
@ 1.6.8: launcher ROM ("only a start device for programs"): the Studio points the handlers of every
|
||||
@ scene after the setup (home, events, care ...) here, so the menu starts instead of the Paradise game.
|
||||
.org 0x20
|
||||
.global launch
|
||||
.thumb_func
|
||||
launch:
|
||||
cpsid i
|
||||
ldr r4, feld_src
|
||||
b.w realstart
|
||||
.align 2
|
||||
feld_src: .word FELD_SRC
|
||||
@ 1.6.8: entry for the start device's trampolines (r12 = the scene's original handler): the menu starts
|
||||
@ only once the Paradise has a save (settings block 0xEFE000 stamped, date set), otherwise the original
|
||||
@ handler runs, so a setup after "reset" can finish in the Paradise itself.
|
||||
.org 0x2C
|
||||
.global lcheck_e
|
||||
.thumb_func
|
||||
lcheck_e:
|
||||
b.w lcheck
|
||||
#else
|
||||
ldr r4, =APP_SRC
|
||||
b.w realstart
|
||||
.ltorg
|
||||
#endif
|
||||
|
||||
#if defined(HOOKS) && !defined(FELD)
|
||||
.org 0x40 @ hooks fixed at 0x40 (Studio: HOOK_OFF), original handlers at 0x94
|
||||
.global hook0, hook1, hook2, hook3
|
||||
.thumb_func
|
||||
hook0: ldr.w r12, orig0
|
||||
b check
|
||||
.thumb_func
|
||||
hook1: ldr.w r12, orig1
|
||||
b check
|
||||
.thumb_func
|
||||
hook2: ldr.w r12, orig2
|
||||
b check
|
||||
.thumb_func
|
||||
hook3: ldr.w r12, orig3
|
||||
b check
|
||||
.org 0x94
|
||||
orig0: .word ORIG0
|
||||
orig1: .word ORIG1
|
||||
orig2: .word ORIG2
|
||||
orig3: .word ORIG3
|
||||
.thumb_func
|
||||
check:
|
||||
push {r0-r3, r12, lr}
|
||||
ldr r0, =0x40018000 @ GPIO0: A = P0.9, C = P0.10, pressed = 0
|
||||
ldr r1, [r0]
|
||||
BFALL
|
||||
AUTOSTART
|
||||
ldr r2, =0x20000FF8 @ counter at the end of the mailbox
|
||||
ldr r3, [r2]
|
||||
tst r1, #0x600
|
||||
bne 5f
|
||||
lsrs r0, r3, #16
|
||||
movw r1, #0xE7A1
|
||||
cmp r0, r1
|
||||
beq 4f
|
||||
movw r3, #0
|
||||
movt r3, #0xE7A1
|
||||
4:
|
||||
adds r3, #1
|
||||
str r3, [r2]
|
||||
uxth r0, r3
|
||||
cmp r0, #LIMIT
|
||||
bhs start
|
||||
b 6f
|
||||
5:
|
||||
movs r3, #0
|
||||
str r3, [r2]
|
||||
6:
|
||||
pop {r0-r3, r12, lr}
|
||||
bx r12
|
||||
.ltorg
|
||||
#endif
|
||||
#if defined(HOOKS) && defined(FELD)
|
||||
@ With field switch: A+C starts the field switch (FELD_SRC), which in turn also
|
||||
@ offers the program (APP_SRC). Return targets fixed at 0x94 as before.
|
||||
.org 0x40
|
||||
.global hook0, hook1, hook2, hook3
|
||||
.thumb_func
|
||||
hook0: ldr.w r12, orig0
|
||||
b check
|
||||
.thumb_func
|
||||
hook1: ldr.w r12, orig1
|
||||
b check
|
||||
.thumb_func
|
||||
hook2: ldr.w r12, orig2
|
||||
b check
|
||||
.thumb_func
|
||||
hook3: ldr.w r12, orig3
|
||||
b check
|
||||
.org 0x94
|
||||
orig0: .word ORIG0
|
||||
orig1: .word ORIG1
|
||||
orig2: .word ORIG2
|
||||
orig3: .word ORIG3
|
||||
.thumb_func
|
||||
check:
|
||||
push {r0-r3, r12, lr}
|
||||
ldr r0, =0x40018000 @ GPIO0: A = P0.9, C = P0.10, pressed = 0
|
||||
ldr r1, [r0]
|
||||
BFALL
|
||||
AUTOSTART
|
||||
ldr r2, =0x20000FF8 @ counter at the end of the mailbox
|
||||
ldr r3, [r2]
|
||||
#ifndef HOOK_TEST
|
||||
tst r1, #0x600
|
||||
bne 5f
|
||||
#endif
|
||||
lsrs r0, r3, #16
|
||||
movw r1, #0xE7A1
|
||||
cmp r0, r1
|
||||
beq 4f
|
||||
movw r3, #0
|
||||
movt r3, #0xE7A1
|
||||
4:
|
||||
adds r3, #1
|
||||
str r3, [r2]
|
||||
uxth r0, r3
|
||||
cmp r0, #LIMIT
|
||||
blo 6f
|
||||
ldr.w r4, feld_src
|
||||
cmp r4, #0
|
||||
beq start
|
||||
cpsid i
|
||||
b realstart
|
||||
5:
|
||||
movs r3, #0
|
||||
str r3, [r2]
|
||||
6:
|
||||
pop {r0-r3, r12, lr}
|
||||
bx r12
|
||||
.ltorg
|
||||
#endif
|
||||
|
||||
#if defined(HOOKS) && defined(FELD)
|
||||
.thumb_func
|
||||
lcheck:
|
||||
push {r0-r3, r12, lr}
|
||||
ldr r0, =0x60EFE000 @ settings block, uncached flash
|
||||
ldrh r1, [r0, #0]
|
||||
ldrh r2, [r0, #2]
|
||||
mvns r2, r2
|
||||
uxth r2, r2
|
||||
cmp r1, r2 @ stamp: CRC and its inverse
|
||||
bne 1f
|
||||
ldrh r1, [r0, #0x1C] @ year 2020..2099
|
||||
movw r2, #2020
|
||||
cmp r1, r2
|
||||
blo 1f
|
||||
movw r2, #2099
|
||||
cmp r1, r2
|
||||
bhi 1f
|
||||
ldrh r1, [r0, #0x1E] @ month 1..12
|
||||
subs r1, #1
|
||||
cmp r1, #12
|
||||
bhs 1f
|
||||
cpsid i
|
||||
ldr.w r4, feld_src
|
||||
b realstart
|
||||
1:
|
||||
pop {r0-r3, r12, lr}
|
||||
bx r12
|
||||
.ltorg
|
||||
#endif
|
||||
|
||||
@ Restart like the firmware itself (routine at flash 0x110568): first switch the
|
||||
@ clock to source 4 (0x45000000 = 0x8041, 0x4500000C = 4, wait for 0x44), then
|
||||
@ copy the image to PRAM 0, then SYSRESETREQ. v0.8 without this sequence froze
|
||||
@ the real device after A+C (suspected: clock), the emulator did not show it.
|
||||
.thumb_func
|
||||
realstart:
|
||||
cpsid i
|
||||
ldr r3, =0x45000000
|
||||
movw r2, #0x8041
|
||||
str r2, [r3]
|
||||
movs r2, #4
|
||||
str r2, [r3, #0xC]
|
||||
ldr r1, =0x400000
|
||||
3:
|
||||
ldr r2, [r3, #0xC]
|
||||
cmp r2, #0x44
|
||||
beq 4f
|
||||
subs r1, #1
|
||||
bne 3b
|
||||
4:
|
||||
mov r0, r4
|
||||
movs r1, #0
|
||||
ldr r2, =0x10000
|
||||
1:
|
||||
ldr r3, [r0], #4
|
||||
str r3, [r1], #4
|
||||
subs r2, #4
|
||||
bne 1b
|
||||
dsb
|
||||
isb
|
||||
ldr r0, =0xE000ED08 @ VTOR = 0, as after a real reset
|
||||
movs r1, #0
|
||||
str r1, [r0]
|
||||
ldr r0, =0xE000ED0C @ AIRCR: keep priority grouping, SYSRESETREQ
|
||||
ldr r1, [r0]
|
||||
and r1, r1, #0x700
|
||||
ldr r2, =0x05FA0004
|
||||
orrs r1, r2
|
||||
str r1, [r0]
|
||||
dsb
|
||||
2:
|
||||
b 2b
|
||||
.ltorg
|
||||
Reference in new issue
Block a user