changeset 49:f5966048a796

Modify defcmd and deffunc to allow specifying explicit entry point
author William Astle <lost@l-w.ca>
date Sat, 10 Dec 2022 00:22:05 -0700
parents 39275fdc7c0b
children aecea4c62324
files src/lwbasic.s
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lwbasic.s	Sat Dec 10 00:21:02 2022 -0700
+++ b/src/lwbasic.s	Sat Dec 10 00:22:05 2022 -0700
@@ -1522,13 +1522,21 @@
 __funcnum       set 0x80
 defcmd          macro noexpand
                 setstr __cmdtab="%(__cmdtab)\tfcs {1}\n"
+                ifstr ne,"{3}",""
+                setstr __cmdjump="%(__cmdjump)\tfdb {3}\n"
+                else
                 setstr __cmdjump="%(__cmdjump)\tfdb cmd_{2}\n"
+                endc
 tok_{2}         equ __cmdnum
 __cmdnum        set __cmdnum+1
                 endm
 deffunc         macro noexpand
                 setstr __functab="%(__functab)\tfcs {1}\n"
+                ifstr ne,"{4}",""
+                setstr __funcjump="%(__funcjump)\tfcb {3}\n\tfdb {4}\n"
+                else
                 setstr __funcjump="%(__funcjump)\tfcb {3}\n\tfdb func_{2}\n"
+                endc
 tok_{2}         equ __funcnum
 __funcnum       set __funcnum+1
                 endm