-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathASMES.INC
More file actions
85 lines (66 loc) · 1.99 KB
/
ASMES.INC
File metadata and controls
85 lines (66 loc) · 1.99 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
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
74
75
76
77
78
79
80
81
82
83
84
85
ExecInt: pusha
cli
mov emSP, sp
mov sp, offset Registers
popa
mov sp, emSP
sti
IntCode: int 0
cli
mov Tmp$, sp
mov sp, offset Registers+8*2+2
pushf
pusha
mov sp, Tmp$
mov emSP, sp
sti
popa
next
osDP$: push sp
next
osRP$: push RP$
next
; Adc ( a b -> c isCarry )
; if a+b>FFFF isCarry = FFFF else isCarry=0
osAdc$: pop ax dx ; -> a b
add ax, dx
sbb dx, dx
push ax dx ; c isCarry ->
next
; osSwap ( a b -> b a ) Crash AX, BX
osSwap$: pop ax bx
push ax bx
NEXT
; osRot ( a b c -> b c a ) Crash AX, BX, CX
osRot$: pop ax bx cx
push bx ax cx
NEXT
osInt$: pop ax
mov byte ptr IntCode+1, al
jmp short ExecInt
osPut$: add RP$, 2
mov bp, RP$
pop word ptr [bp]
NEXT
osGet$: mov bp, RP$
push word ptr [bp]
sub RP$, 2
NEXT
osDrop$: add sp, 2
NEXT
; osNor ( a b -> a NOR b ) Crash AX, BX
osNor$: pop ax bx
or ax, bx
not ax
push ax
NEXT
osTrap$: int 3
NEXT
; osPeek ( addr -> value ) Crash BX
osPeek$: pop bx
push word ptr [bx]
NEXT
; osPoke ( Value Addr -> ) Crash BX
osPoke$: pop bx ; -> Value Addr
pop word ptr [bx] ; ->
NEXT