Contents |
Effect
Reads the value from 2 bytes of the memory (RAM or VRAM) and displays it or stores it in a variable.
CALL PEEKW means CALL DOUBLE PEEK. It's equivalent to CALL PEEK([@]<Address>) + 256*CALL PEEK([@]<Address + 1>). Note that the least significant byte is assumed to come first, which is the usual practice for system variables and machine code.
Syntax
CALL PEEKW ([@]<Address>,<Variable>)
The last parameter is optional. Parameters can not end with a comma alone.
Parameters
@ needs to be put before <address> to specify VRAM instead of RAM. Without this parameter, the value will be read from main RAM if the address is lower than 8000h.
<Address> is the address to read. To avoid error messages, decimal numbers need to be used for addresses higher than FFFFh (65535).
If <Address> is negative the binary complement is used. This means CALL PEEKW(-1)=CALL PEEKW(65536-1)=CALL PEEKW(65535).
If you specify a RAM address higher than 65534, specifications of the mapped RAM are used.
65535 + (number of available segments) × 16384 is the upper limit. If you specify a value exceeding this value, you get an "Out of memory" error.
<Variable> is the variable in which you want to put the value read at this address. When not specified, the computer will display the hexadecimal value instead of store it in a variable. Otherwise, if the value has been stored in a variable, you can ask to display this value and it will be made in decimal mode.
Examples
CALL PEEKW (&HC000)
&HCDC0
CALL PEEKW (&HC000,A):PRINT A
-12864
CALL PEEKW (@&H2000)
&HF4F4
10 _POKEW(60000,42321) 20 _PEEKW(60000):PRINT 30 _PEEKW(60000,A):PRINT A 40 PRINT PEEK(60000),PEEK(60001) 50 PRINT HEX$(42321) 60 PRINT (42321-65536) RUN
&HA551 -23215 81 165 A551 -23215
Related to
CALL BLOCK, CALL PEEK, CALL PEEKS, CALL POKE, CALL POKES, CALL POKEW