add sys.sizeof_byte, _word, _float constants

because Antlr doesn't allow the grammar to contain a sizeof(typename) rule to override the sizeof(identifier) rule
This commit is contained in:
Irmen de Jong 2024-10-07 19:17:37 +02:00
parent d1ddf05e38
commit ae669af904
8 changed files with 38 additions and 14 deletions

View File

@ -23,6 +23,10 @@ sys {
const ubyte target = 8 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16, 8 = atari800XL
const ubyte sizeof_byte = 1
const ubyte sizeof_word = 2
const ubyte sizeof_float = 0 ; undefined, no float support
asmsub init_system() {
; Initializes the machine to a sane starting state.
; Called automatically by the loader program logic.

View File

@ -351,6 +351,11 @@ sys {
const ubyte target = 128 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16.
const ubyte sizeof_byte = 1
const ubyte sizeof_word = 2
const ubyte sizeof_float = 5
asmsub init_system() {
; Initializes the machine to a sane starting state.
; Called automatically by the loader program logic.

View File

@ -347,6 +347,10 @@ sys {
const ubyte target = 64 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16.
const ubyte sizeof_byte = 1
const ubyte sizeof_word = 2
const ubyte sizeof_float = 5 ; undefined, no float support
asmsub init_system() {
; Initializes the machine to a sane starting state.

View File

@ -1360,6 +1360,10 @@ sys {
const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16.
const ubyte sizeof_byte = 1
const ubyte sizeof_word = 2
const ubyte sizeof_float = 5
asmsub init_system() {
; Initializes the machine to a sane starting state.
; Called automatically by the loader program logic.

View File

@ -98,6 +98,11 @@ sys {
const ubyte target = 32 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16, 32=PET
const ubyte sizeof_byte = 1
const ubyte sizeof_word = 2
const ubyte sizeof_float = 0 ; undefined, no floats supported
asmsub init_system() {
; Initializes the machine to a sane starting state.
; Called automatically by the loader program logic.

View File

@ -7,6 +7,11 @@ sys {
const ubyte target = 255 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16, 8 = atari800XL, 255 = virtual
const ubyte sizeof_byte = 1
const ubyte sizeof_word = 2
const ubyte sizeof_float = 8
sub reset_system() {
; Soft-reset the system back to initial power-on Basic prompt.
%ir {{

View File

@ -1,6 +1,8 @@
TODO
====
see github for issues
Regenerate skeleton doc files.
Improve register load order in subroutine call args assignments:

View File

@ -1,18 +1,13 @@
; EXAMPLE external command source code
%launcher none
%option no_sysinit
%zeropage basicsafe
%encoding iso
%import textio
%address $4000
%zeropage basicsafe
main $4030 {
%option force_output
sub start() {
txt.print("external command\n")
sys.exit(0)
main {
sub start() {
txt.print_ub(sys.sizeof_byte)
txt.spc()
txt.print_ub(sys.sizeof_word)
txt.spc()
txt.print_ub(sys.sizeof_float)
txt.nl()
}
}