24. Host Environment The host system can be identified in several ways: A%=0:X%=1:os%=((USR&FFF4)AND&FF00)DIV256 returns 8 to indicate UNIX and UNIX style pathnames director/filename.ext. If OSBYTE 0 returns 8, then INKEY-256 returns: &FE: NetBSD &F6: OpenBSD &FB: BeOS &F5: Amiga &F9: Linux &F4: GNU FreeBSD &F8: MacOS &F3: GNU &F7: FreeBSD &Bx: PDP11 Unix, &B5=Unix v5, &B6=Unix v6, &B7=Unix v7, &B8=Unix v8 &B9=BSD2.9, &BB=BSD2.11 (interim: &B0=RT11/RSX/RSTS) A%=0:Y%=0:fs%=(USR&FFDA)AND&FF returns 24 to indicate a UNIX filing system. [OPT 0:NOP:] assembles &A0 to identify the CPU as a PDP-11. 25. Technical notes ARM BASIC V double-tokens are recognised internally, but are listed as the single-token components. Internal memory: ^@%-512 : String buffer, string can be fetched with $(^@%-512) or $(PAGE-&300) ^@%-256 : Input buffer, string can be fetched with $(^@%-256) or $(PAGE-&200) ^@% : Integer variables ^@%+108 : Pointers to dynamic variables ^@%+242 : Memory structure pointers ^@%+256 : Default PAGE A%=EVAL("0:"+text$):token$=$(^@%-510) will tokenise text$ and put it in token$ Variables in the heap, always word aligned: ^variable (word aligned) ---v link, name, &00, (pad), b0-b7, b8-b15, b16-b23, b24-b31, b32-b39, &00 link, name, '%', &00, (pad), b0-b7, b8-b15, b16-b23, b24-b31 link, name, '$', &00, (pad), b0-b7, b8-b15, length, space link, name, '(', &00, (pad) link, name, '%', '(', &00, (pad) link, name, '$', '(', &00, (pad) ^variable() ---^ name, ['%', '$'], '(', &00, num of dims, dim, {dim...}, data, {data...} ^variable() ---^ ^variable(dims{, dims...}) ---^ Stack layout: Top of stack: cmdret, &0000 - empty cmdret, &00nn - token cmdret, &nnxx - data Stack contents: cmdret, {looping and saved structures}, {saved PROC/FN}, {local variables}, &0000 On exit from subroutine, all these are popped off tknFOR, step[6], limit[5], vartype[1], ^variable, saved r5 tknREPEAT, saved r5 tkkGOSUB, saved r5 tknERROR, saved SV_STACK, saved SV_ONERR tknDATA, saved SV_DATA could use table instead of compares: equb tknREPEAT,tknGOSUB,tknDATA,tknERROR,tknFOR equw 1, 1,SV_DATA,SV_STACK, 16 \ pop off 1, 1, 1, 2, 16 or: equb tknREPEAT,tknGOSUB,tknDATA,tknERROR,tknFOR calculate 1, 1, 1, 2, 16 pop to -, -,SV_DATA,SV_STACK, - Subroutine structures are after any looping/etc structures tknPROC/tknFN, {any local variables}, &0000, saved SVSTACK, saved LPTR Local variables {type, addr, data} stacked local data &0000 - end of stacked data &00nn <&80 &00nn >&7F - token &0xxx - number &8xxx - string &0100, address, b0-b7 - byte (could squash into &01xx?) &0200, address, b0-b15 - 16-bit integer &0400, address, b0-b15, b16-b31 - 32-bit integer &05ee, address, mantis, mantis - real with exponent in {type} word (could optimise to &0n00 and loop 1,2,3,4,5... allowing 3 and 6+) &80nn, address, string, align - string &81nn, address, string, align - $address &82nn, address, string, align - $$address &2xxx, address, - reserved for RETURN variable