Skip to content

Commit 1838cc6

Browse files
committed
Simplify alloc.asm, only keep actually used entry points.
1 parent 252f5f7 commit 1838cc6

File tree

1 file changed

+33
-37
lines changed

1 file changed

+33
-37
lines changed

src/alloc.asm

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -68,52 +68,25 @@ alloc_size= tmp1
6868
.endproc ; Fall through
6969

7070
; Increase program memory area X by A (size in bytes)
71-
alloc_area_8:
72-
ldy #0
73-
; Increase program memory area X by AY (size in bytes)
74-
.proc alloc_area
75-
sty alloc_size+1
76-
skip_y: sta alloc_size
77-
71+
.proc alloc_area_8
72+
sta alloc_size
7873
clc
7974
adc mem_end
8075
tay
81-
lda alloc_size+1
76+
77+
lda #0
78+
sta alloc_size+1
8279
adc mem_end+1
80+
8381
cpy MEMTOP
8482
sbc MEMTOP+1
8583
bcs rts_1
8684

87-
; Move memory up by "alloc_size"
88-
stx save_x+1
89-
jsr move_mem_up
90-
; Adjust pointers
91-
save_x: ldx #0
92-
.endproc ; Fall through
93-
94-
; Increase all pointers from "Y" to the last by AX
95-
.proc add_pointers
96-
loop: clc
97-
lda mem_start, x
98-
adc alloc_size
99-
sta mem_start, x
100-
inx
101-
lda mem_start, x
102-
adc alloc_size+1
103-
sta mem_start, x
104-
inx
105-
cpx #mem_end - mem_start + 2
106-
bne loop
107-
clc
108-
::rts_1:
109-
rts
110-
.endproc
111-
11285
; Move memory up.
113-
; Y : index to pointer to move from
86+
; X : index to pointer to move from
11487
; alloc_size : amount to move up
115-
;
116-
.proc move_mem_up
88+
stx save_x+1
89+
11790
; Setup pointers
11891
lda mem_start, x
11992
sta move_dwn_src
@@ -134,9 +107,32 @@ loop: clc
134107
sbc mem_start+1, x
135108
tax
136109
pla
137-
jmp move_dwn
110+
jsr move_dwn
111+
112+
; Adjust pointers
113+
save_x: ldx #0
114+
115+
.endproc ; Fall through
116+
117+
; Increase all pointers from "Y" to the last by AX
118+
.proc add_pointers
119+
loop: clc
120+
lda mem_start, x
121+
adc alloc_size
122+
sta mem_start, x
123+
inx
124+
lda mem_start, x
125+
adc alloc_size+1
126+
sta mem_start, x
127+
inx
128+
cpx #mem_end - mem_start + 2
129+
bne loop
130+
clc
131+
::rts_1:
132+
rts
138133
.endproc
139134

135+
140136
;----------------------------------------------------------
141137
; Parser initialization here:
142138
.proc parser_alloc_init

0 commit comments

Comments
 (0)