-
Notifications
You must be signed in to change notification settings - Fork 85
/
memrw.src
64 lines (51 loc) · 800 Bytes
/
memrw.src
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
.page
.subttl memrw
; 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)
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
memerr lda #badcmd ;bad command
jmp cmderr
memwrt ; write
m10 lda cmdbuf+6,y
sta (temp),y ;transfer from cmdbuf
iny
cpy cmdbuf+5 ;# of bytes to write
bcc m10
rts
; .end