40 lines
1.0 KiB
QBasic
40 lines
1.0 KiB
QBasic
DIM global(5) AS UByte => { 47h, 4Ch, 4Fh, 42h, 41h, 4Ch }
|
|
|
|
CLS
|
|
PRINT "@global = "; @global
|
|
PRINT "@global(0) = "; @global(0)
|
|
PRINT "@global DATA PTR = "; PEEK(UInteger, @global + 2 )
|
|
PRINT
|
|
|
|
subroutine()
|
|
STOP
|
|
|
|
SUB subroutine()
|
|
DIM local(4) AS UByte => { 4Ch, 4Fh, 43h, 41h, 4Ch }
|
|
|
|
PRINT "@local = ";@local
|
|
PRINT "@local(0) = ";@local(0)
|
|
PRINT "@local DATA PTR = "; PEEK(UInteger, @local + 2 )
|
|
PRINT
|
|
|
|
refer(6, @global)
|
|
refer(5, @local)
|
|
END SUB
|
|
|
|
SUB refer(chars AS UByte, pointer AS UInteger)
|
|
DIM i AS UByte
|
|
REM Are we pointing to .array.__DATA__ ?
|
|
PRINT "If reference points to the DATA field ("; pointer;"): ";
|
|
FOR i = 0 TO chars - 1
|
|
PRINT CHR$(PEEK (pointer + i));" ";
|
|
NEXT i
|
|
PRINT
|
|
|
|
REM Are we pointing to .array, where pointer + 2 = data pointer?
|
|
pointer = PEEK(pointer + 2) + 256 * PEEK(pointer + 3)
|
|
PRINT "If reference points to pointer field ("; pointer;"): ";
|
|
FOR i = 0 TO chars - 1
|
|
PRINT CHR$(PEEK (pointer + i));" ";
|
|
NEXT i
|
|
PRINT
|
|
END SUB |