Compatible with:
DOS Maximite CMM MM150 MM170 MM+ MMX Picromite ArmiteL4
Armite F4 ArmiteH7 Picomite CMM2
Description:
Will set a series of bytes or words within the CPU’s
virtual memory space.
This is the same as POKEing a series of consecutive memory locations.
This is useful for setting portions of
an array or copying array elements quickly.
Use with caution as Poking into the
wrong location can cause problems.
MEMORY SET addr%, byte, numberofbytes
MEMORY SET will set the series of bytes (ie, 8 bits)
starting at the memory
location 'addr%' to 'byte'. 'addr%' should be an integer.
MEMORY SET BYTE addr%, byte, numberofbytes
MEMORY SET BYTE will set the series of bytes (ie, 8 bits)
starting at the memory
location 'addr%' to 'byte'. 'addr%' should be an integer.
MEMORY SET SHORT addr%, short%, numberofbytes
MEMORY SET SHORT will set the series of short integers (ie, 16 bits)
starting at the
memory location 'addr%' to 'word%'. 'addr%' and short%' should be
integers.
MEMORY SET WORD addr%, word%, numberofbytes
MEMORY SET WORD will set the series of words (ie, 32 bits)
starting at the memory
location 'addr%' to 'word%'. 'addr%' and 'word%' should be integers.
MEMORY SET INTEGER addr%, int%, numberofbytes [,increment]
MEMORY SET INTEGER will set the series of MMBasic integers (ie, 64 bits)
starting at
the memory location 'addr%' to int%'. 'addr%' and int%' should be
integers.
The increment default to one unless specified.
MEMORY SET FLOAT addr%, float!, numberofbytes [,increment]
MEMORY SET FLOAT will set the series of floats (ie, 64 bits)
starting at the memory
location 'addr%' to 'float!'. 'addr%' should be an integer and 'float!' a
floating point number.
The increment default to one unless specified.
MEMORY COPY sourceaddress%, destinationaddres%, numberofbytes%
MEMORY COPY will copy numberofbytes% starting from sourceaddress% to
destinationaddres%
MEMORY COPY INTEGER sourceaddress%, destinationaddress%, numberofintegers
[,sourceincrement][,destinationincrement]
MEMORY COPY INTEGER will copy numberofintegers% starting from sourceaddress% to
destinationaddres%
The increments default to one unless specified.
MEMORY COPY FLOAT sourceaddress%, destinationaddress%, numberoffloats [,sourceincrement][,destinationincrement]
MEMORY COPY FLOAT will copy numberoffloats% starting from sourceaddress% to
destinationaddres%
The increments default to one unless specified.
An example that fills a portion of an array.
''''''''''''''''''''''''''''''''''''''
DIM INTEGER bigarray(20)
DIM INTEGER n, x, addr, startfill
x = 99
'find the starting address of the target array
addr = PEEK(VARADDR bigarray())
' set the starting point to the 5th array element
startfill = addr + 8*5
' fill 10 array elements starting at element 5
MEMORY SET INTEGER startfill, x, 10
'show the results
FOR n = 0 TO 20
PRINT n,bigarray(n)
NEXT n
''''''''''''''''''''''''''''''''''''''
OUTPUT:
0 0
1 0
2 0
3 0
4 0
5 99
6 99
7 99
8 99
9 99
10 99
11 99
12 99
13 99
14 99
15 0
16 0
17 0
18 0
19 0
20 0
Another example:
''''''''''''''''''''''''''''''''''''''
option explicit
option default none
dim float sourcearray(3,39),destinationarray(39),d2array(39),x=99.99
dim integer n, addr, addr2, addr3
'find the starting address of the source 2 dimensional array
addr = PEEK(VARADDR sourcearray())
'find the starting address of the first desination 1 dimensional array
addr2 = PEEK(VARADDR destinationarray())
'find the starting address of the second desination 1 dimensional array
addr3 = PEEK(VARADDR d2array())
' fill 160 array elements starting at element 0,0
memory set float addr, x,160
'now make some changes to the source array to prove it all works
for n=0 to 39: sourcearray(2,n)=n:next n
'copy the sourcearray(0,all) to destinationarray
memory copy float addr,
addr2,40,BOUND(sourcearray(),1)-BOUND(sourcearray(),0)+1,1
'now point to the start of the second dimension in the source array
addr = addr + 8*2
'copy the sourcearray(2,all) to destinationarray2
memory copy float addr,
addr3,40,BOUND(sourcearray(),1)-BOUND(sourcearray(),0)+1,1
'show the results
for n = 0 to 39
print n,sourcearray(0,n),sourcearray(2,n),destinationarray(n),d2array(n)
next n
''''''''''''''''''''''''''''''''''''''
output:
0 99.99 0 99.99 0
1 99.99 1 99.99 1
2 99.99 2 99.99 2
3 99.99 3 99.99 3
4 99.99 4 99.99 4
5 99.99 5 99.99 5
6 99.99 6 99.99 6
7 99.99 7 99.99 7
8 99.99 8 99.99 8
9 99.99 9 99.99 9
10 99.99 10 99.99 10
11 99.99 11 99.99 11
12 99.99 12 99.99 12
13 99.99 13 99.99 13
14 99.99 14 99.99 14
15 99.99 15 99.99 15
16 99.99 16 99.99 16
17 99.99 17 99.99 17
18 99.99 18 99.99 18
19 99.99 19 99.99 19
20 99.99 20 99.99 20
21 99.99 21 99.99 21
22 99.99 22 99.99 22
23 99.99 23 99.99 23
24 99.99 24 99.99 24
25 99.99 25 99.99 25
26 99.99 26 99.99 26
27 99.99 27 99.99 27
28 99.99 28 99.99 28
29 99.99 29 99.99 29
30 99.99 30 99.99 30
31 99.99 31 99.99 31
32 99.99 32 99.99 32
33 99.99 33 99.99 33
34 99.99 34 99.99 34
35 99.99 35 99.99 35
36 99.99 36 99.99 36
37 99.99 37 99.99 37
38 99.99 38 99.99 38
39 99.99 39 99.99 39
Last edited: 22 November, 2020