V3Emu
The Tamagotchi Connection V3 on the Tamagotchi Paradise. No ROM here: bring your own (512 KB).
src/core/v3cpu.c,v3cpu.h: Sunplus SPLB32 (6502 with banked ROM, timers, 1 kHz time base, STOP, buzzer) and the HT24LC08 EEPROM, ported from BrickEmuPy by azya52 (CC0),cores/SPLB32.pyandperipherals/HT24LC08.py. Time in ticks of 1/128 cycle, so the 32768 Hz clock is a whole number of ticks.src/core/v3ops.inc: the 256 instructions, generated bygen/py2c.pyfromSPLB32.py.src/core/v3lcd.inc: which bit of the LCD RAM lights which of the 32 x 30 dots, taken from the faceassets/Tamagotchi_v3.svgof BrickEmuPy (only the positions).src/app/main.c: the Paradise program. Settings block of V1Emu ("PMX1"), the Studio tells the two apart by the ROM size. Save: session (4 KB), then settings and the toy's EEPROM (4 KB).host/v3run.c: runs a ROM on the computer, writes the screen as PGM (TRACE,SHOTS).test/devv3.py: the Paradise program in Unicorn (screen, keys, flash);test/mkimg.pymakes a test image;test/profv3.pycounts instructions per function.POKE=ms:symbol+off:bytein devv3 writes a byte once,PMB=secondsputs the Paradise's time in the mailbox,DUMP=symbol+off:lenprints memory at the end.host/v3runtakesRX=t:hex(bytes into the receiver) and prints sent bytes.
Build: sh src/app/build.sh (clang, lld) gives v3.bin.
Clock (V3_CLK_RETRY, test37): a standing clock (the toy started from its own save and asks for the time) is looked at again every 5 s for 10 minutes and set as soon as it runs; the settings line "Clock" shows AUTO OK, AUTO ! (stands), AUTO - (no time from the Paradise) or AUTO ? (written but off).
Switches in the program: V3_CLOCK (the Paradise's time at the start), V3_LINK (infrared over the contacts), V3_ICONS (the ten icons, segments 0_7, 1_0..1_3 above and 6_3..6_0, 5_7 below; pictures in
src/app/icons_v3.h, made by gen/icons.py from mameise's PNGs; a missing one is taken from T7Emu).
The core's infrared (v3_ir_rx, v3_ir_tx) was checked against CON_V3_IR.py with the same script of port writes
and clock steps (sent bytes and receiver level the same).
Switches in the core: V3_FREESTANDING (no libc), V3_BATCH (0: no skipping while stopped, for comparing),
V3_TMFAST (1.6.13 test12: the timers in closed form and 32-bit arithmetic; an event whose flags are masked is left
to the next sync, the flag registers sync when read or written; checked equal to the plain core on the host, step by
step and in 1 ms runs, V3_SAVESYNC makes the plain core sync before a save for that comparison).
Power (V3_PW, test12, as TamaEmu EMU_PW): screen dark, no key, tone, menu or link traffic: 12 MHz from the
internal RC, deep sleep until the next RTC second or a key, then the toy's time runs in one go (up to 5 s behind,
never dropped). A tone while dark: from there in real time. BAT_SMOOTH: steadier battery reading.
Author: mameise
No session (SESS_FLAG, 1.7.3 test7): flags bit 12 (0x1000): the run state is never written and an old one is dropped at the start; the toy's EEPROM and the settings are stored as before, so it starts from its own save like the real toy.