41CL User Manual
© 2019, Systemyde International Corporation
32
YPEEK
(address and data in ALPHA register)
Executing
YPEEK
(
Read Word From Memory or I/O
) reads directly from either memory
(Flash or RAM) or an internal NEWT I/O port. The data field in the ALPHA register
when the function is called is ignored, but is replaced with the actual data read from either
the memory or the internal I/O port.
The figure below shows the formatting required for the address and data in the ALPHA
register for the
YPEEK
function. The placeholder data characters will be replaced by the
data read by the function.
ALPHA register
11
10
9
8
7
6
5
4
3
2
1
physical address
P5 P4 P3 P2 P1 P0
-
D3 D2 D1 D0
logical address
L3 L2 L1 L0
-
B
-
D3 D2 D1 D0
port address
R
-
-
-
D3 D2 D1 D0
Memory Buffer Functions
The 41CL reserves one 4K block (one page) of System memory to be used as a buffer for
assembling module images. The
Extra Functions Buffer Area
is located at physical
addresses 0x805000 - 0x805FFF, and has an associated
Extra Functions Buffer Pointer
stored at address 0x804010. The memory buffer functions provide a convenient way to
move data to the buffer to assemble a module image without having to continuously spec-
ify the destination address. Instead, the lower twelve bits of the destination address are
held in the Buffer Pointer, which is automatically incremented by the
YBUILD
function
after use.
Thus, to assemble blocks of code the user merely initializes the buffer pointer to the start
of the block, with either 0x000 if assembling a FAT, or 0x084 if assembling functions,
and then copies blocks of memory, one after the other, to the buffer. The buffer pointer is
updated to point at the next buffer location after each copy. Once an image is assembled,
the FAT can be built using the regular
YPOKE
function and the entire image moved to
another location in memory using the
YMCPY
function for use.
Of course all of the normal memory functions may be used with the buffer area, and
indeed the region can also be used as normal memory when not being used as the buffer.