V25 Memory & String-Packing Commands

V25 extends V24 with low-level memory access, binary string packing/unpacking, and string-array manipulation.

Memory Access

POKE

Syntax: POKE address, value

Writes a single byte to a memory address.

LOCAL x AS LONG, p AS QUAD
p = VARPTR(x)
POKE p, 66    ' Write byte 66 to x

POKE$

Syntax: POKE$ address, string$

Writes a block of bytes from a string to a memory address.

LOCAL buf AS STRING * 32
POKE$ STRPTR(buf), "ABCD"

PEEK

Syntax: PEEK(address)

Reads a single byte from a memory address. Returns a numeric value.

x = PEEK(VARPTR(var))

Binary String Packing (V25)

Pack numeric values into fixed-size binary strings for random file I/O.

FunctionPacks ToBytes
MKBYT$(n)BYTE1
MKI$(n)INTEGER2
MKL$(n)LONG4
MKDWD$(n)DWORD4
MKQ$(n)QUAD8
MKS$(n)SINGLE4
MKD$(n)DOUBLE8
MKE$(n)EXT10
MKCUR$(n)CURRENCY8
MKCUX$(n)CUX8
packed = MKL$(123456) + MKS$(1.5)
PUT #1, 1, packed

Binary String Unpacking (V25)

FunctionUnpacks FromBytes
CVBYT(s$)BYTE1
CVI(s$)INTEGER2
CVL(s$)LONG4
CVDWD(s$)DWORD4
CVQ(s$)QUAD8
CVS(s$)SINGLE4
CVD(s$)DOUBLE8
CVE(s$)EXT10
CVCUR(s$)CURRENCY8
CVCUX(s$)CUX8
GET #1, 1, packed
x = CVL(LEFT$(packed, 4))

String Helpers (V25)

NUL$

Syntax: NUL$(n)

Returns a string of n zero (null) bytes.

DEC$

Syntax: DEC$(n)

Returns the decimal string representation of a number (like STR$ but without leading space).

String-Array Commands (V25)

JOIN$

Syntax: JOIN$(array$(), delimiter$)

Joins all elements of a dynamic STRING array into a single string, separated by the delimiter.

REDIM arr(1 TO 3) AS STRING
arr(1) = "a" : arr(2) = "b" : arr(3) = "c"
PRINT JOIN$(arr(), ",")    ' "a,b,c"

SPLIT

Syntax: SPLIT source$, delimiter$ INTO array$()

Splits a source string by delimiter into a dynamic STRING array. Array is automatically REDIM'd.

REDIM parts(1 TO 1) AS STRING
SPLIT "one,two,three", "," INTO parts()
' parts(1)="one", parts(2)="two", parts(3)="three"

MID$ Statement

Syntax: MID$(target$, pos [, n]) = value$

In-place substring assignment. Replaces characters in the target string without changing its length.

s = "abcdef"
MID$(s, 2, 3) = "XYZ"    ' s = "aXYZef"
Note: MID$ assignment performs in-place replacement and does not grow the target string. If value$ is shorter than the replacement range, remaining characters keep their original values.

V24 String Commands (Included in V25)

V25 includes all V24 string-completion commands: REPEAT$, STRDELETE$, STRINSERT$, STRREVERSE$, BIN$, OCT$, LTRIM$, RTRIM$, REPLACE$, SCAN$, TALLY, VERIFY, COMMAND$, ENVIRON$, CURDIR$, TAB$, PEEK$, INPUT$, INKEY$, WAITKEY$.