-
Notifications
You must be signed in to change notification settings - Fork 85
/
memrw
70 lines (70 loc) · 849 Bytes
/
memrw
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
.PAGE 'MEMORY READ WRITE'
;
; MEMORY ACCESS COMMANDS
; "-" MUST BE 2ND CHAR
;
MEM
LDA CMDBUF+1
CMP #'-
BNE MEMERR
LDA CMDBUF+3 ; SET ADDRESS IN TEMP
STA TEMP
LDA CMDBUF+4
STA TEMP+1
LDY #0
LDA CMDBUF+2
CMP #'R
BEQ MEMRD ; READ
JSR KILLP ; KILL PROTECT
CMP #'W
BEQ MEMWRT ; WRITE
CMP #'E
BNE MEMERR ; ERROR
;
; MEMORY EXECUTE
;
MEMEX
JMP (TEMP)
;
; MEMORY READ
;
MEMRD
LDA (TEMP),Y
STA DATA
LDA CMDSIZ
CMP #6
BCC M30
LDX CMDBUF+5
DEX
BEQ M30
TXA
CLC
ADC TEMP
INC TEMP
STA LSTCHR+ERRCHN
LDA TEMP
STA CB+2
LDA TEMP+1
STA CB+3
JMP GE20
M30
JSR FNDRCH
JMP GE15
.PAGE
;
; MEMORY COMMAND ERROR
;
MEMERR
LDA #BADCMD ; BAD COMMAND
JMP CMDERR
;
; MEMORY WRITE
;
MEMWRT
LDA CMDBUF+6,Y
STA (TEMP),Y ; TRANSFER FROM CMDBUF
INY
CPY CMDBUF+5 ; # OF BYTES TO WRITE
BCC MEMWRT
RTS
.END