40 BUILDS MATILDA ================= VibeDroneSwagman / Matilda Emulator Journey to Build 0.40 Compiled 21 September 2026 PURPOSE ------- This file continues 30BUILDSMATILDA.TXT. Builds 0.01-0.30 are summarised there. This document records 0.31 through 0.40: the keyboard-path close, FreeDOS boot, the 640TC Z80 sidecar, the v1.31 monitor menu, and the 40 MB SCSI disk on the V40 INT 13h path. PROJECT TARGET -------------- Two sides of the same Matilda / 640TC machine: V40 / PC side NEC V40, 64K Matilda BIOS V1.05 at F0000h, INT 13h floppy + SCSI HDD, FreeDOS 1.4 floppy boot. Z80 / 640TC side 16K Matilda 640TC monitor ROM v1.31 (MicroCorp) at 8000h with boot overlay at 0000h. This ROM is the Z80-emulation firmware used inside Matilda, not a stock 256TC boot ROM (MAME / MSPP). Menu: Boot disk, Self Test, Set Time. ROMs and disks are never embedded. The user supplies: matilda_bios_1.05.rom 65536 bytes, V40 matilda_640tc_1.31.rom 16384 bytes, Z80 FreeDOS 1.4 floppy image V40 boot matilda_boot_disk_bios9_ds80.dsk 640TC CP/M BIOS 9 (not wired yet) matilda.dsk same family, different MD5 BUILD 0.31 ---------- Keyboard close after the 0.28/0.30 dual-queue race (INT 09h seeing 00). Single 8042 output-buffer latch shared by controller replies and user scan codes. INTP1 only while OBF is full, interface enabled, and command-byte bit 0 set. Port 60h consumes the latch. IRQ1 refused if the latch is empty. Dump 10:01:48 proved the path: HOST keys, LAST60=9F, IRQ1=INT09=32, real scan codes on IN 60h, BIOS buffer filled with scan+ASCII then consumed. Screen: POST errors + "Press to resume, to setup options". F1 was accepted. Floppy boot started. BUILD 0.32 ---------- FreeDOS 1.4 language menu appeared. Enter selected English. FreeCom 0.86 launched VINFO.COM, which executed 66 9C (PUSHFD) at 22C8:075A. The 8086-class V40 core treated 66h as a fatal opcode and halted. 0.32: 66/67 prefixes ignored. Unknown opcodes logged as UD! and skipped instead of HLT. Dump 10:12:17 / screen at A:\>: install aborted with N (correct for the lab) A:\>dir listed FD14-BOOT: FREEDOS, FDAUTO.BAT, FDCONFIG.SYS, KERNEL.SYS, SETUP.BAT. BUILD 0.33 ---------- Z80 sidecar. Side selector V40 / Z80. 16K ROM at 8000-BFFF boot overlay 0000-3FFF until OUT (50) screen RAM F000 drawn 80x24 when Side=Z80 6545 ports 0C/0D stub bank port 50 V40 path unchanged. BUILD 0.34 ---------- v1.31 talks to Matilda host FDC ports 44h-48h, not a WD2793. Dump 10:21:54 sat at 84E7: LD A,0Bh / OUT (44h),A / IN A,(44h) / BIT 0,A / JR NZ,84E7 0.34: reads of 44-48 return 80h (bit7 set, bit0 clear). BUILD 0.35 ---------- Port 08 toggling 00/40 during key scan wiped the single F000 plane. Separate screen / attr / PCG planes selected by port 08/0B. BUILD 0.36 ---------- PC 80C0 is the menu key loop (CP 81h/82h/83h = F1/F2/F3). F000-F7FF always screen, F800-FFFF always PCG. F1/F2/F3 emit 81/82/83. State report adds SCREEN: preview. BUILD 0.37 ---------- FD 77 n = LD (IY+n),A is the character plot. The IX/IY decoder missed 70-77h, so the clear ran (spaces) and letters never landed. Fix: LD (IY+d),r implemented. Dump 10:53:31 F000 contains the v1.31 menu: Version 1.31 PRESS FUNCTION KEY TO SELECT OPTION F1 F2 F3 Boot disk Self Test Set Time (c)1987-1990 MicroCorp Pty Ltd, Australia PCG box-draw bytes display as odd ASCII if bit7 is stripped. Labels under the boxes are real text. BUILD 0.38 ---------- F-keys were not seen by the matrix. IN A,(02)/BIT 1/RET Z treats bit1 clear as no-key. Returning 00 on press aborted the scan. Buffered key lives at 047E. 0.38: port 02 echoes the PIO latch (BF/FF toggle preserved) port 18 idle FFh F1/F2/F3 write 81/82/83 into 047E/047F BUILD 0.39 ---------- Matilda promo and Borrett spec: integrated SCSI controller, optional 20/40/80 MB SCSI fixed disks, flyer says SCSI 3.5 inch up to 130 MB. 0.39 adds the 40 MB option on the V40 INT 13h path only: geometry 640 cylinders x 8 heads x 16 sectors x 512 size 41,943,040 bytes (81,920 sectors) DOS drive 80h ports 330h-333h ready stub (40h); command bytes logged, not decoded UI: CREATE 40MB SCSI LOAD SCSI HDD (.img / .bin / .hdd) SAVE SCSI HDD -> MATILDA_SCSI_40MB.IMG SAVE DISK floppy .IMG (enabled after LOAD FREEDOS DISKS) Image is blank (no MBR). FreeDOS must FDISK / FORMAT C:. Z80 640TC floppy / E039h host services still not wired. BIOS-9 .dsk files are CPC DSK wrappers and must not be fed to the V40 raw path. SAVE BUTTONS ------------ SAVE DISK current floppy, name *_SWAGMAN20.IMG SAVE SCSI HDD 40 MB raw image MATILDA_SCSI_40MB.IMG bee click 1 MiB V40 RAM, or 64K Z80 RAM when Side=Z80 bee Ctrl-click text machine-state report CURRENT STATE AT BUILD 0.39 --------------------------- Proved: V40 BIOS POST, F1 resume, FreeDOS 1.4 boot, A:\> dir keyboard path INT 09h / port 60h / BIOS buffer Z80 1.31 monitor menu drawn dual-side HTML, neither ROM embedded 40 MB SCSI image created in RAM and saved as .IMG Not yet: real Matilda SCSI chip / command set (ports unknown from promo) complete Z80 BIOS-9 boot through host FDC 44-48 / 90-92 complete CALL E039h / E000h 640TC CP/M loader execution CMOS checksum so POST stops "options not set" aux / fuse / serial POST stubs EGA planar video 6545 light-pen keyboard matrix (F-keys use 047E poke) BUILD 0.40 ---------- First real BIOS-9 / 640TC disk integration build, based directly on the disassembled Microbee 640TC BIOS 9 low-level disk routines. New UI control: LOAD 640TC BIOS9 DSK 0.40 parses the CPCEMU .DSK wrapper and builds a sector map for use by the Z80 / 640TC side. The BIOS-9 disk is kept separate from the V40 raw floppy path. The low-level host disk register contract is now modelled from BIOS 9: port 46h sector port 47h track port 48h side / flags port 91h DMA address low byte port 92h DMA address high byte port 90h transfer command Implemented transfer commands: OUT (90h),88h read disk sector -> Z80 memory OUT (90h),A8h write Z80 memory -> disk sector Ports 44h-48h remain the status/control side of the 640TC host floppy interface. This replaces the earlier placeholder behaviour with a path tied to the actual BIOS-9 routines rather than a generic WD2793 assumption. New diagnostics report: BIOS9 DSK mounted/not mounted parsed sector count read count write count last host transfer request/result This is the first build where these three pieces are connected in one emulator: Matilda 640TC monitor v1.31 -> 640TC host disk interface ports 44h-48h / 90h-92h -> matilda_boot_disk_bios9_ds80.dsk The earlier BIOS-9 reverse engineering remains the reference for the CP/M loader path: CALL E039h relocation of the loaded system image JP E400h The standard BIOS 9 disk entry points remain: E418 HOME E41B SELDSK E41E SETTRK E421 SETSEC E424 SETDMA E427 READ E42A WRITE E430 SECTRAN 0.40 does not yet prove a complete CP/M boot. The next test is to mount the BIOS9 DSK on the Z80 side, select F1 Boot disk, and capture a Z80 state report showing the actual sequence of 44h-48h / 90h-92h operations. NEXT PRIORITIES --------------- 1. From V40 A:\> run FDISK against the 40 MB image; confirm HDDR/HDDW in the I/O log; SAVE SCSI HDD. 2. Test 0.40 Z80 "Boot disk" with matilda_boot_disk_bios9_ds80.dsk; capture the 44-48 / 90-92 transfer sequence and follow it into E039h. 3. CMOS 0Eh checksum and equipment byte so POST F1 is not required. 4. Keep one consistent build identity on title, tag, footer, state report. CONVENTION ---------- Every new build: increment the build number update header, tag, footer, state-report banner preserve diagnostics output immediately as a downloadable HTML file Current build: VibeDroneSwagman 0.40 END