-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.prims
More file actions
45 lines (43 loc) · 1.15 KB
/
code.prims
File metadata and controls
45 lines (43 loc) · 1.15 KB
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
# code.prims : mapping from the Forth primitives to 6809 "binary" assembly
#
# Copyright (c) 2024 Charles Suresh <[email protected]>
# SPDX-License-Identifier: AGPL-3.0-only
# Please see the LICENSE file for the Affero GPL 3.0 license details
bye : .db 0x39
dup : .db 0x36, 6
drop : .db 0x37, 6
key : dup ; .db 0xbd ; .dw realkey
emit : .db 0xbd ; .dw realemit ; drop
inc : .db 0xC3,0,1
dec : .db 0x83,0,1
inv : .db 0x53, 0x43
neg : inv ; inc
dip : .db 0x36, 0x10
nip : .db 0x37, 0x10
+ : .db 0xE3, 0xC1
- : neg ; +
& : .db 0xA4, 0xC0, 0xE4, 0xC0
| : .db 0xAA, 0xC0, 0xEA, 0xC0
^ : .db 0xA8, 0xC0, 0xE8, 0xC0
2drop : drop ; drop
swap : nip ; .db 0x1E, 1 ; dip
@ : .db 0x1F, 1, 0xEC, 0x84
! : .db 0x1F, 1 ; drop ; .db 0xED, 0x84 ; drop
c@ : .db 0x1F, 1, 0xE6, 0x84, 0x4F
c! : .db 0x1F, 1 ; drop ; .db 0xE7, 0x84 ; drop
pick : .db 0x58, 0xEC, 0xCB
stick : nip ; .db 0x5A, 0x58, 0xAF, 0xCB ; drop
sp@! : .db 0x1E, 3
rp@! :
>r : .db 0x34, 6 ; drop
r> : dup ; .db 0x35, 6
lit :
exec : .db 0xbd ; .dw trampoline
call : .db 0xbd ; .dw trampoline
<< : .db 0xbd ; .dw shiftleft
>> : .db 0xbd ; .dw shiftright
over : dup ; .db 0xEC, 0x42
exit : .db 0x39
var state
var latest
var here