
Its been a couple of weeks since my last update, and I have been working on another project for the village museum and history society
to create a solution to browse all the records and photos (55,000 entries and 10,000 photos) - I found the best way to link the photos was via a local
host URL from a text/Web field - but thats another thread.
Have I reached the end on this project. Well, not quite. I have added a heap of new functions to the LET command and IF x GOSUB support etc. but the issue is with any interpreted runtime - the more functions you put in the slower it can get. I have sequenced the most used commands etc near the top of the
parser selector - to speed up etc - but there must be a way of making apps run quicker. Some complex math operations are quite sluggish. So the answer
was quite simple in the end. I have implemented a simple inline assembler mode. Still interpreted, but run on its own parsing thread, and with a very small
subset of commands with no realtime on the fly parsing - it at least 50% faster on execution of those functions. I have also started a Syntax checker feature.
Define variables in BASIC mode to push them on to the heap. You can then use PULL and PUSH in ASM mode to access them and enable your assembler function to interact with BASIC.
The ASM command in the BASIC program triggers handover of the runtime to the Assembler. The HLT is the last command of the assembler and returns back to the BASIC code.
The assembler has two registers X and Y - both integer group variables
I have implemented the following assembler commands -X and Y are fully interchangeable
MOV X,Y
MOV VAL,Y
INC X
DEC X
ADD X,Y
ADD val X
SUB X,Y
SUB val,Y
DIV X,Y
DIV val,Y
MUL X,Y
MUL val,Y
PULL A%,X
PUSH Y,A%
JNZ X,STEPS (or -STEP) Jump if register is not zero - for relative branching - no navigation lookup
CMP X,Y
CMP VAL,Y
JLT label based on last CMP result - Jump if less than
JGT label Jump if greater than
JEQ label Jump if equall
JNE label Jump not equal
HLT STOP and return to BASIC
BASIC now supports the following commands and functions
LABELS:
MAIN: ENTRY POINT FOR CHAINING
REM OR !
INPUT VAR%;
INPUT STRING$;
PRINT VAR%,; COMMA SURPRESSES CRLF
PRINT VAR$,
PRINT FMT('%%',VAR%), LEADING ZEROS
PRINT FMT('##',VAR%) LEADING SPACES
IF VAR {OPERATOR} VAR THEN LABEL
IF VAR {OPR} VAR GOSUB LABEL
GOTO LABEL
GOSUB LABEL
RETURN
FOR VAR=VAL TO VAL STEP LITERAL (CAN BE NEGATIVE TO COUNT DOWN)
NEXT VAR
DO, WHILE VAR%<>=!VAL
DIM VAR$='VALUE'
DIM VAR%=LITERAL
DIM VAR%=INT(VAR%); {ROUNDS UP OR DOWN FP VARIABLE}
ARRAY VAR
SET VAR(X%,Y%)=VAR
GET VAR=VAR(X%,Y%)
LET VAR=VAR+VAR; (+-*/^)
LET VAR=VAL(VAR$)
LET VAR=MID$(VAR$,START,LEN)
LET VAR%=INSTR$(VAR$,VAR$);
LET VAR$=REP$(VAR$,VAR$)
LET VAR$=HEX$(VAR%)
LET VAR$=ASC(VAR%)
LET VAR%=LEN(VAR$)
LET VAR%=CHR$(VAR$)
LET VAR%=MOD(VAR%,VAR%)
LET VAR%=ABS(-VAR%)
LET VAR$=DATE$()
LET VAR$=TIME$()
LET VAR%=INT(VAR) TRUNCATES FP VARIABLE
LET VAR$=STRING$(VAR$,LITERAL)
LET VAR$=STRING$(VAR$,VAR%)
LET VAR$=UCASE(VAR$)
LET VAR$=LCASE(VAR$)
LET VAR=VAR
HEAP GLOBAL
HEAP LOCAL
DELETE 'FILENAME'
OPEN FILENAME
WRITE FILENAME,VAR
DELREC FILENAME
READ FILENAME,VAR
CLOSE FILENAME
SEARCH FILENAME,PATTERN$, RESULTS$. NOF IS NOT FOUND
STOP RUN
CHAIN PROGRAM
DROP VAR - REMOVES ENTRY FROM HEAP
PUSH VAR% -PUSH VAL TO CALC SCREEN JOURNAL
CLS LINENO
CLS VAR%
ASM START OF ASSEMBER ROUTINE
HLT END OF ASSEMBLER ROUTINE
is this the end - we shall see what ideas come to front - may be some simple SQL - we shall see how that pans out. but I appear to be able to push SailForms a bit more yet.