-
Notifications
You must be signed in to change notification settings - Fork 30
/
memory.mu4
46 lines (36 loc) · 1.31 KB
/
memory.mu4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
| This file is part of muforth: https://muforth.dev/
|
| Copyright 2002-2024 David Frech. (Read the LICENSE for details.)
loading 8051 memory image
decimal
( Define the basics of the target's memory.)
2 constant bytes/cell
-d big-endian
ld target/common/memory.mu4 ( generic memory image support)
| Defaults, so we can load this code without defining a specific 8051
| target device.
.ifndef #flash
64 Ki constant #flash
256 constant #ram
256 constant #xram
.then
| Three memory aspaces: flash, ram, xram.
|
| Currently every aspace only has one memory image, and every image only
| has one region. We use the default of "drop" as our choose-image: since
| there is only one image per aspace, choose-image is a no-op.
|
| Even though ram space is limited to 256 bytes - so an 8-bit address
| suffices - and xram space is generally smaller than 64 Ki, I'm going to
| leave these at 16 bits because visually that suggests "this is an
| address".
16 make-aspace #flash make-image make-region flash
16 make-aspace #ram make-image make-region ram
16 make-aspace #xram make-image make-region xram
( Initialization.)
: wipe ( origin)
region! ( reset start and end pointers)
'image #image "ff fill ( erase, like flash or eprom) ;
"20 ram wipe ( skip the banked registers)
0 xram wipe
0 flash wipe