poke 36869,(peek(36869)and240)+8
There's nothing special about this "tape buffer hack", the character generator just is set to $0000.
The VIC chip has its own address range mapping, compared to the CPU:
Code: Select all
VIC CPU
$0000 .. $1FFF <-> $8000 .. $9FFF (BLK4)
$2000 .. $3FFF <-> $0000 .. $1FFF (BLK0)
In register 36869, the bottom 4 bit point to the character generator in 1K steps, the CPU address $0000 is equivalent to VIC address $2000, hence %..10 00xx xxxx xxxx => %1000 = 8 as value to put in there.
The top 4 bits point to the text screen address, also in full 1K steps, with the same mapping. Bit 7 (value 128) of register 36866 can add other 512 bytes to this base address which is, for example, used to put the screen to $1E00 on the unexpanded VIC-20. Anyway, when the screen is at $1000 for the CPU (with +8K or more) this means $3000 for the VIC, hence %..11 00
0x xxxx xxxx. So %1100 = 12 to put in the high nibble => 16*12+8 = 200. Exactly the value I put into 36869.
As the screen base hasn't been altered under these circumstances there's already the correct value in the top bit of 36866, but you can still confirm it with PRINTPEEK(36866)AND128, which should give
0 when +8K RAM are used.
In any case you can change those values for screen base and character generator as you like, they need not reside at their original position. If you need them at another position in RAM you can put as you want within the limits of the available address range (and remember, only the internal RAM is visible to VIC).
[...]the blank spaces look garbled. I guess this is because the space character (32) is not mapped to anything in the charset.
Of course the VIC knows what he ought to address when he encounters a space with the character generator at $0000. It then uses the addresses $0000+8*32..$0000+8*32+7 = 256..263 for this. This is part of the stack area where the interpreter constructs PETSCII text strings for numbers. That data is then visible as glyph for blanks when the foreground at that place is different from the background colour.