| 1 | 10 REM FILER - FILE BROWSER FOR THE P65 FLASH STORAGE |
| 2 | 20 REM LEFT/RIGHT ARROW: MOVE RETURN: RUN V: VIEW R: RENAME |
| 3 | 30 REM C: COPY D: DELETE Q: QUIT |
| 4 | 40 HIMEM: 24576 |
| 5 | 50 ST=32784:NB=832:N2=848:BU=24576:BL=8192 |
| 6 | 60 DIM NM$(255),TY(255),SZ(255),LD(255),EX(255),E$(12) |
| 7 | 70 FOR I=1 TO 12:READ E$(I):NEXT |
| 8 | 80 H$="0123456789ABCDEF" |
| 9 | 85 SP$=" " |
| 10 | 90 GOSUB 300:SL=0:TP=0 |
zdebel
Joined 2 years ago
P65 BASIC
The P65 comes with a BASIC in ROM, in the style of Applesoft: Microsoft BASIC with floating point
numbers (9 digits), strings, arrays, and a set of extra commands for the P65's graphics chip
(TMS9918), the flash storage and the machine itself. It descends from
mist64/msbasic with Applesoft-compatible commands added
(see the notes at the top of rom/fpp65.a65).
This document describes every command and function. All examples with a result below them were
run on the real ROM in the emulator, and are checked again by python tools/basic_doc.py
P65: memory map and I/O registers
The 65C02 sees 64 KB. All of it lives in one array in the Pico (cpu_memory[]);
there is no address decoder in hardware, so the map below is decided purely by
the firmware (core 1 bus loop, src/65c02.c, include/mapper.h).
Names come from include/mapper.h, emulator/memmap.py and the equates at the
top of asm_examples/testrom1.a65 - keep the three in sync.
1. Map
| 1 | ; ============================================================================ |
| 2 | ; P65 VDP demo: waving rolling rainbow, sine-bouncing sprite text, smooth |
| 3 | ; scroller. Standalone ROM ($8100..$FFFF), assemble with tools/asm2bin.sh. |
| 4 | ; |
| 5 | ; * Graphics I mode. The rainbow is 24 solid tile groups; the colour table is |
| 6 | ; rotated every few frames (rolling) and every row of the name table starts |
| 7 | ; at a different column from a sine table (waving). |
| 8 | ; * The letters are 10 magnified 8x8 sprites on a sine wave, colours cycling. |
| 9 | ; The wave is chosen so that never more than 4 sprites share a scanline. |
| 10 | ; * The scroller redefines 32 tile patterns every frame: a 256x8 bit buffer is |
P65: VSYNC and the frame interrupt
How to get a steady 60 Hz game tick on the Portable65 from 65C02 assembly. Everything here was checked on the board or in the emulator; where a number is an estimate it says so.
1. In short
- The VDP "frame flag" (bit 7 of the status register at
$8003) is set exactly 60 times a second by a hardware timer in the Pico. It does not
| 1 | ; VSYNC interrupt demo. |
| 2 | ; The VDP raises its frame flag 60 times a second. With bit 5 of VDP |
| 3 | ; register 1 set it also pulls the CPU's /IRQ low until $8003 is read. |
| 4 | ; The 3 LEDs show bits 4..6 of a frame counter (about 3.75 Hz binary count). |
| 5 | ; |
| 6 | ; The IRQ line is released a little AFTER the status read (it goes through the |
| 7 | ; I2C expander), so the handler can be entered again with bit 7 clear: always |
| 8 | ; test bit 7 of the status and ignore the interrupt when it is clear. |
| 9 | |
| 10 | .setcpu "65C02" |
Portable65
A portable 8-bit computer built around a real WDC 65C02 CPU, where a Raspberry Pi Pico (RP2040) plays “everything else”: memory, a TMS9918 video chip, keyboard and clock generator. This description is based on analysis of the code in Portable65.zip (files dated February–October 2024).
1. Idea2. Hardware3. Memory map4. Bus & PIO5. Cores6. Keyboard7. Video8. ROM & BASIC9. Tools10. Files11. Issues12. Getting back to work
1. Project idea
A real 65C02 is wired directly to the Pico’s GPIO. The Pico does not emulate the CPU. Instead it emulates everything around it, cycle by cycle, in real time:
Universal DOS Game Reconstruction Playbook
A Game-Agnostic Engineering Guide to Bit-Exact (1:1) Clean-Room Reverse Engineering, Differential CPU Harnessing, and Modern Recompilation
1. Core Philosophy: Bit-Exact Clean-Room Re-engineering
Porting a legacy DOS title to modern architectures (Python, C++, Rust, WebAssembly) typically falls into one of two paradigms:
- Approximate Recreation ("By Eye"): Recreating physics, AI, and rules by playing the game in DOSBox or reading high-level disassembly.
| 1 | ; Sprite demo for the 65C02 + TMS9918 machine. |
| 2 | ; Four 16x16 sprites bounce around the screen; positions are updated once per |
| 3 | ; frame from the VBlank IRQ. |
| 4 | ; |
| 5 | ; Build: asm/build.sh (ca65 + ld65, output roms/sprites.bin) |
| 6 | |
| 7 | .setcpu "65C02" |
| 8 | |
| 9 | VDPD = $7F00 ; VDP data port |
| 10 | VDPC = $7F01 ; VDP control/status port |