You are making improper use of the term 'source code'. The executable read-only part of 1k zx chess that is in RAM was most likely Z80 machine code. That is called 'object code', similar to what is in a Windows .exe file, not source code. If 1k zx chess was written in assembler, the assembly source code would be human-readable text, encoded as 1 character per byte ascii codes. A single instruction like " MOVB AL,BH", which would fit into a single byte in x86 machine code, would thus be 12 bytes of source code (counting the obligatory newline as 1).maksimKorzh wrote: ↑Wed Jul 21, 2021 5:42 pmSo say for 1k zx chess both source code and chess data structures (like board array) were fitting only 1k of RAM!
If 1k zx chess would have been a BASIC program, the program code would have been some intermediate 'basic code' (e.g. where the BASIC keywords and the variable names were each represented by a single byte), which would be executed by the interpreter in ROM. It would still not be 'source code'.
After writing the 6800 program, (which was done on the computer of a friend), I obtained a 6502-based computer (the AIM-65) with 4KB, which I expanded to 12KB. There the ROM really contained a text editor, which could edit assembly source code in RAM, and an assembler to translate the text in the edit buffer to machine code. I used that to develop a chess program that used the lowest 5K of memory when executing (code from 0x200 to 0x1400, data from 0 to 0x200), and used the remainder of the memory as edit buffer for the source code. Later I put the machine code for that program into a home-built computer that fitted in a small matchbox. (This used an 8KB CMOS RAM with a watch battery for data retention, and no ROM.)