Give the screen a bitmap mode
V4. Mode 2 is 320 by 200 with a byte a pixel: no tile to look up and no attribute to add, the byte IS the palette index. Programs/Examples/picture.asm fills a whole one in 127 bytes of program and 47,498 cycles. IT IS THE SAME MEMORY AS THE TILES AND THE MAP, which is what shared video memory has always been, and there is nowhere else it could be - 64,000 bytes of picture in a 65,536 byte bank leaves room for nothing beside it. Going to bitmap mode does not clear the text screen, it stops calling it one, and coming back finds the tiles holding whatever the picture put there. Taking the screen means taking it. The palette moves to 0xFC00, the top of video memory, because it is the one thing that has to mean the same in every mode and 64,000 bytes of picture leaves nowhere in the middle for it to hide. That is a documented address, so the example, the tests and the manual move with it. A BITMAP HAS NO COLUMNS AND NO ROWS, and both registers read zero rather than a leftover from the last mode. The console asks: told there is no character screen, it has nowhere to put a glyph and draws nothing, while still saying everything down the serial line. The honest alternative is what a machine with shared video memory really does, which is scribble marks nobody can read across somebody's picture - honest and useless, since a program that has taken the screen has not stopped wanting to print. Six checks in Tests/video.sh, to 55: that the mode is 320 by 200, that a byte is one pixel's colour and only that pixel, that printing leaves a picture alone while the letter still goes out, and that the columns register says nought and then forty again. The example is worth reading for one thing beyond the mode: Fill leaves its destination past what it touched, so two hundred rows are drawn from one address set once. Working out where row n begins would be n times 320, and this machine has no multiply. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW
This commit is contained in:
co-authored by
Claude Opus 5
parent
1174bd9af5
commit
13b20c8834
@@ -49,6 +49,9 @@ colours | Examples/colours.asm | run | -
|
||||
# here because the count is exact: a frame is counted in the machine's own cycles, so the
|
||||
# same program sees the same sixty however fast the host really went.
|
||||
frames | Examples/frames.asm | run | - | -
|
||||
# picture draws a whole 320 by 200 bitmap and prints nothing, so what is recorded is only
|
||||
# that it ran and what it cost. Tests/video.sh is where the pixels are checked.
|
||||
picture | Examples/picture.asm | run | - | -
|
||||
8bitSieve | Examples/primeSieve/8bitSieve.asm | run | - | -
|
||||
16bitSegmentedSieve | Examples/primeSieve/16bitSieve.asm | run | - | -
|
||||
# The four pointer rewrite. It emits exactly the same primes as the line above, which
|
||||
|
||||
Reference in New Issue
Block a user