-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathlibMemoryCommand.asm
More file actions
130 lines (109 loc) · 3.81 KB
/
libMemoryCommand.asm
File metadata and controls
130 lines (109 loc) · 3.81 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
;*******************************************************************************
;* Memory Operation *
;*******************************************************************************
;* Syntax : M (addr) (addr) <RETURN>
;*******************************************************************************
;** memory -- syntax :- m (addr) (addr) **
COM_MEMORY
jsr IBYTE2 ; Get start Address
sta ADDVEC + 1
stx ADDVEC
jsr IBYTE2 ; Get End Address
sta DIS_END + 1
stx DIS_END
MEMNEXTLINE
jsr DISPLAYMEMNEXTLINE ; Display Next Line
ifdef TGT_C64
lda #10 ; Show 10 bytes per line
endif
ifdef TGT_VIC20_8K
lda #04 ; Show 4 bytes per line
endif
sta COM_NB ; Store Screen Row Byte Value
lda $c5
cmp #63 ; Check for runstop key
bne MEM1 ; No, carry on
jmp READY ; Yes, Jump back to Command Line
MEM1
jsr ADDNB ; Add Screen Row Byte Value to Master Location
lda ADDVEC + 1
cmp DIS_END + 1 ; Check if reached End location
bne MEMNEXTLINE ; No, then start new line
lda ADDVEC
cmp DIS_END ; Deffo Check End location
bcs MEM4 ; Yes, Then exit back to command line
jmp MEMNEXTLINE ; No, then start new line
MEM4
jmp READY ; Jump back to Command Line
; Display Memory Line on the screen
DISPLAYMEMNEXTLINE
jsr BUILDMEMLINECOMMANDSTRUCTURE
ldy #0
DISPLAYMEMNEXTBYTE
lda (ADDVEC),y ; Load Byte
pha ; Temp store on stack
jsr SPACE ; Display Space
pla ; bring back from stack
jsr PBYTE1 ; Display Byte as 00 Hex value
iny ; increase row byte number
ifdef TGT_C64
cpy #10 ; Check 10 bytes per line
endif
ifdef TGT_VIC20_8K
cpy #04 ; Check 4 bytes per line
endif
bne DISPLAYMEMNEXTBYTE
rts
; This Builds the command line Memory structure (>: 0000)
BUILDMEMLINECOMMANDSTRUCTURE
jsr PrintCarrageReturnAndLineFeed
lda #">"
jsr krljmp_CHROUT$
lda #CHR_Colon
jsr krljmp_CHROUT$
jsr SPACE
lda ADDVEC
ldx ADDVEC + 1
jsr PBYTE2
rts
;*******************************************************************************
;* Memory Put ation *
;*******************************************************************************
;* Syntax 64 : : (addr) (byte)(byte)(byte)(byte)(byte)(byte)(byte)(byte)(byte)(byte) <RETURN>
;* Syntax VIC20 : : (addr) (byte)(byte)(byte)(byte) <RETURN>
;*******************************************************************************
COM_MEMORYPUT
jsr IBYTE2 ; Get Memory Address
sta ADDVEC + 1 ; Store Memory Address
stx ADDVEC
MEMP2
ldy #0
sty COM_L ; Begin Byte Counter at 0
MEMP1
jsr INPUT_COMMAND ; Get First Character
cmp #CHR_Return ; Do we have a Return Key?
bne MEMP3 ; No, then Continue
jmp READY ; Yes, Go back to Command Line
MEMP3
jsr IBYTE1 + 3 ; Get Current Byte Value
ldy COM_L ; Load Row Byte Value
sta (ADDVEC),y ; Store byte Value in Address + offset
iny ; Increase Row Byte Value
sty COM_L
ifdef TGT_C64
cpy #10 ; Check 10 bytes per line
endif
ifdef TGT_VIC20_8K
cpy #04 ; Check 4 bytes per line
endif
bne MEMP1 ; No, Carry On Then
ifdef TGT_C64
lda #10 ; Show 10 bytes per line
endif
ifdef TGT_VIC20_8K
lda #04 ; Show 4 bytes per line
endif
sta COM_NB ; Store Bytes Per Line Allowed
jsr ADDNB ; Work Out New Address Location based on byte per line
jsr BUILDMEMLINECOMMANDSTRUCTURE
jmp ASSLINE