Draw palette and port 0x31 changes from the scan line they land on - #16
Merged
Merged
Conversation
vraminfo: 「PC88 のパレットの反映は hblank 毎(?)に行われる」, and switching to 400 lines or turning graphics off halfway down the display splits the screen (「可能なようです」 for both). We drew each frame with the registers as they stood at the frame boundary, so VRAMTEST T showed one flat color where the page shows bands, and U took whichever mode came last for the whole screen. The bus now logs the palette, the background registers and port 0x31's display bits with the CRTC scan line each change lands on, one frame at a time, handed over when the scan line counter wraps. The compositor turns the finished frame's log into bands of output rows and draws each with the values it had; the four renderers take the rows to write. Changes made in the retrace are moved ahead of those made during the display, register by register, so a program that sets the top in the retrace and changes it partway down gets the picture the hardware draws every frame. A frame whose display shows one state all the way down takes the same path as before with the same values, so nothing that does not change these registers mid-display draws any differently: the regression screenshots are untouched. T now shows 8 digital / 32 analog bands at 24kHz and 15kHz, U-1 the R plane in 400-line form below the switch and U-2 no graphics below it. Port 0x30 and 0x32 stay per frame (the page found the one garbles the screen and the other does nothing). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtarYVwQy1YVfWGChE5eg4
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #15.
vraminfo found the palette latched per scan line — 「PC88 のパレットの反映は hblank 毎(?)に行われる」 — and tried switching settings halfway down the display: 200 → 400 lines and graphics on → off both work (「可能なようです」). Port 0x32 digital → analog has no effect, and port 0x30's 80/40 columns and colour/mono garble the screen. We drew every frame with the registers as they stood at the frame boundary, so VRAMTEST T showed one flat colour where the page shows bands, and U used one mode for the whole screen. This is VRAMTEST #13.
Change
RasterVideo.swift). The log is kept per frame and handed over when the scan line counter wraps to 0 (CRTC.onFrameStart), so it does not depend onrunFrame. Reset and state load clear it.RasterFrame.bands()turns the finished frame into bands of output rows. A display change takes effect from the next line, and CRTC lines are scaled to the 400-row picture (×2 at 15kHz). Retrace changes are moved ahead of the display changes, register by register. A program that sets the top in the retrace and changes it partway down (T, U, and any raster effect written the usual way) then gets the frame the hardware draws every time.FrameCompositordraws each band with its values; the four renderers take the rows to write (default0..<400). A frame with one state all the way down takes the old path with the old values.Results
VRAMTEST T: 8 digital / 32 analog bands at 24kHz and 15kHz. U-1: the R plane in 400-line form below the switch. U-2: no graphics below it. U-0/3/4 unchanged.
Tests: 917 pass (8 new in
RasterVideoTests; the end-to-end one fails if bands are switched off). Release builds pass.Regression: identical to Let the V1S text DMA take CPU time while the display runs #15 (the TheHospital difference is the same 1297 px, everything else identical).
1,102 disks booted for 60 s in V2, Let the V1S text DMA take CPU time while the display runs #15 vs this branch: 1,092 identical and 10 different. All 10 are palette writes that land during the display and now split the frame:
That is what the page describes. Whether the hardware also splits these frames can't be checked without one. If any of these titles is meant to write only in the retrace, this is where to look.
🤖 Generated with Claude Code
https://claude.ai/code/session_01EtarYVwQy1YVfWGChE5eg4