-
Notifications
You must be signed in to change notification settings - Fork 82
/
memrw
60 lines (60 loc) · 783 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
.PAGE 'MEM-RD,WRT
; 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
; EXECUTE
MEMEX JMP (TEMP)
.SKIP
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
.SKIP
MEMERR LDA #BADCMD ;BAD COMMAND
JMP CMDERR
.SKIP
MEMWRT ;WRITE
M10 LDA CMDBUF+6,Y
STA (TEMP),Y ;TRANSFER FROM CMDBUF
INY
CPY CMDBUF+5 ;# OF BYTES TO WRITE
BCC M10
RTS
.SKIP
.END