Hello everybody !
Some days ago I discovered millfork, a programming language designed for Z80 and 6502 computers. I saw that X16 is supported and so I started to write a prototype with this language to see what it can do.
This first prototype is a Basic syntax highlighter. it writes on the screen lines of Basic with colors for the line numbers, basic keywords and literal values (strings and numbers).
After compiling in Release mode, I was impressed by the resulting .prg file that was around 1KB ! Knowing that basic keywords can take around 400 bytes, I think that the compiler has done a pretty good work (although I still think it can be lighter if someone takes time to optimize it or even use a different approach than mine).
![x16_basic_highlight.png.767342f315a38f9891fce14d2321e71c.png](<___base_url___>/uploads/monthly_2020_07/x16_basic_highlight.png.767342f315a38f9891fce14d2321e71c.png)
For now, sadly, this program uses strings of Basic as input and outputs them directly on screen. It's useless because it's not using the Basic code stored in memory. Do you think that something like this is possible to do ?
One approach that I think can work is just calling "LIST" and then a "SYS" command to read the on-screen basic code and highlight it on the fly.
I'm attaching the millfork source file basichighlight.mfk and the released prg basichighlight.prg so you can take a look and maybe talk about it further ? ?
Note : In the millfork file, I have commented the tiny text adventure written by Robin from 8-bit show and tell as a way to test the syntax highlighter. Notice that the code is altered because of some limitations of my program that can't handle lines going beyond the right side of the screen.
Thanks you for reading ! I'll eventually post updates on this thread if I have more content to share in the future ?