the NEC it can be implemented through a routine like this:
40000 H=0:L=0:TY=0
40010 POKE64448,205:POKE64449,175:POKE64450,73:POKE64451,235
40020 POKE64452,58:POKE64453,139:POKE64454,250:POKE64456,201
40030 IFVY$=""THENPRINT"VY$ not defined!":STOP
40040 FORH=64457TO64463:POKEH,ASC(MID$(VY$,H,1)+CHR$(0)):NEXT:POKE64464,0
40050 POKE63912,201:POKE63913,251:EXEC64448
40060 L=PEEK(63912!):H=PEEK(63913!):TY=PEEK(63911!)
40070 RETURN
40080 ' VARPTR by Gary Weber
40090 ' Entry: VY$ must contain the name of variable of interest
40100 ' Exit: H & L contain variable's address, TY contains type
40110 ' Example:
40120 ' 100 A$="This is a sample string."
40130 ' 110 VY$="A$":GOSUB 40000
40140 ' 120 PRINT "VARPTR of ";VY$;" is ";L+(H*256)
5. POKEs and PEEKs: Use memory maps (nec.map, m100.map) and the NEC/100 cross
reference (NEC100.DAT), all available in the Technical Documents area of this
web site. Since these addresses are machine specific, just detect the machine
type using the PEEK(1) statement (148=NEC, 51=M100), and use the appropriate
addresses for the RAM & ROM locations.
6. CALLs and EXECs: This is a little more tricky. Model 100 BASIC uses the
"CALL" statement and NEC uses "EXEC". Based on your detected machine type
with PEEK(1), use the appropriate statement along with the specific
address for your machine as referenced from the NEC & M100 memory maps
& cross reference. Also, the M100's CALL syntax allows passing of values
to place in the A and HL registers. The NEC's EXEC statement only takes
one parameter, which is the entry address. However, there are special
locations in NEC's upper memory "bookkeeping" area which are used to pass
the A, L, and H register values to EXEC. Before you issue the EXEC
statement on the NEC, first POKE your register values to these locations
as needed: A: 63911, L: 63912, H: 63913.
7. Embedded machine language would need to be assembled for each platform and the M100
and NEC specific routines would be called based on the PEEK(1) machine type.
8. MID$ as an assignment is not supported in N82 basic. You can only use
the MID$ statement to extract characters from a string. However, on
the NEC you can simulate the function of a MID$ assignment with a
routine like this:
30000 ZO=LEN(OX$):TX$=OX$:OX$=LEFT$(TX$,NX-1)+NX$
30010 IFZO-LEN(OX$)>0THENOX$=OX$+RIGHT$(TX$,ZO-LEN(OX$))
30020 OX$=LEFT$(OX$,ZO):RETURN
30030 ' MID$ by Gary Weber
30040 ' Entry: OX$=String to modify, NX=Target position, NX$=Target text
30050 ' Exit: OX$ contains modified string