My first program
ORG 8000h
RST 20h
DM "Hello World"
DB 00h
All user programs must be compiled to start at 8000h.
Now you can copy code to SD card or send via terminal to Z-Berry.
Prefered file extension is ZBB, recognized by Z-Berry file manager.
Result is text Hello World shown on serial terminal.
And now very small modification:
ORG 8000h
RST 10h
DM "Hello World"
DB 00h
Do you see the difference?
If LCD is connected, text will appear on it. If not, look at terminal again.
Z-Berry firmware offers very strong feature: channel support. Any text will be sent to channel you set before.
Three channels are built-in:
- TTY (serial terminal)
- LCD 8px font
- LCD 6px font
Any of them you can see when system boots.
If you connect any new display device, such as matrix or character displays, you can add new channel.
Only things you need is three display-dependent routines, one for printing character, one for clearing screen and one for positioning.
Command RST 10h sends null-terminated strings to channel. String is right after RST 10h instruction and ends with empty byte, or NOP instruction.
RST 20h sends null-terminated string directly to serial terminal.