-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathchat-dummy.mu4
73 lines (54 loc) · 2.19 KB
/
chat-dummy.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
| This file is part of muforth: https://muforth.dev/
|
| Copyright 2002-2025 David Frech. (Read the LICENSE for details.)
loading AVR chat (dummy implementation)
| NOTE: All the following d.foobar commands are the dummy _implementations_
| of the chat command interface.
( We need dummy images of all the memory spaces.)
16 make-aspace ( flash)
#flash make-image
make-region dummy-flash
16 make-aspace ( data: ram + i/o)
@ram #ram max 2* make-image ( ensure that [@ram #ram +] is within the ram image)
make-region dummy-ram
16 make-aspace ( eeprom)
#eeprom make-image
make-region dummy-eeprom
| -------------------------------------------------------------------------
| Chat implementation
| -------------------------------------------------------------------------
: dx.get-version "d0d0_dada ;
variable dummy-z
: dx.run ( dp) dummy-z ! ; ( do nothing other than set Z)
: dx.get-status ( - dp) dummy-z @ ;
here ] dummy-flash dummy-ram dummy-eeprom [
: dx.setup-chunk ( buf a u space - u buf dummy)
h preserve cells [ #] + @execute ( set dummy region)
-rot image+ ;
: dx.read ( buf a u space)
dx.setup-chunk swap rot cmove ;
: dx.write ( buf a u space)
dx.setup-chunk rot cmove ;
: dx.wipe
h preserve
dummy-flash erase-image
dummy-ram erase-image
dummy-eeprom erase-image ;
| -------------------------------------------------------------------------
| Chat interface
| -------------------------------------------------------------------------
: d.hello ( - #chunk)
cr ." Chat (dummy) firmware version " dx.get-version
radix preserve hex sep preserve -sep <# 4# 4# #> type
dx.wipe [ @ram #ram + 256 - #] dummy-z ! 128 ;
: d.run ( pc dp) nip dx.run ;
: d.erase ( a)
h preserve dummy-flash image+ 128 "ff fill ;
: d.program ( buf a u) 0 dx.write ;
: d.write-data ( buf a u) 1 dx.write ;
: d.write-eeprom ( buf a u) 2 dx.write ;
| NOTE: We are *provisionally* removing app-start and app-stop from the
| chat-via array, and *deprecating* their use in interact.mu4.
: chat chat-via
d.hello dx.get-status d.run dx.read d.write-data d.write-eeprom
nope nope nope nope d.erase d.program ;