-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathchat-dummy.mu4
43 lines (31 loc) · 1.24 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
| This file is part of muforth: https://muforth.dev/
|
| Copyright 2002-2025 David Frech. (Read the LICENSE for details.)
loading MSP430 chat (dummy implementation)
| NOTE: All the following d.Foobar commands are the dummy _implementations_
| of the chat command interface.
variable dummy-pc
variable dummy-flash-status
#image buffer dummy-image
: dummy-image+ ( target - host) wrap dummy-image + ;
: dummy-image- ( host - target) dummy-image - wrap ;
: d.Hello
cr ." Connecting to dummy chat target."
dummy-image #image "ff fill ( erase)
@ram dummy-pc ! dummy-flash-status off ;
: d.ReadChunk ( buf a u)
| cr ." Dummy read chunk " 2 nth u. over u. dup u.
push dummy-image+ swap pop cmove ;
: d.WriteChunk ( buf a u)
| cr ." Dummy write chunk " 2 nth u. over u. dup u.
push dummy-image+ pop cmove ;
: d.ErasePage ( a - fail?)
dummy-image+ /page "ff fill
dummy-flash-status @ ;
: d.FlashChunk ( buf a u - fail?)
d.WriteChunk dummy-flash-status @ ;
: d.GetStatus ( - sp pc sr cp) "dead dummy-pc @ 0 "dead ;
: d.Run ( pc sr cp) 2drop dummy-pc ! ;
: chat
chat-via d.Hello d.GetStatus d.Run
d.ReadChunk d.WriteChunk d.ErasePage d.FlashChunk ;