Make FIX-LABEL-ADDRESSES-IN-INSTRUCTION-LIST add PROGRAM_END label
This commit is contained in:
parent
9d2d0dea6b
commit
010cc5dd87
1 changed files with 7 additions and 1 deletions
|
@ -101,11 +101,17 @@
|
||||||
|
|
||||||
(defun fix-label-addresses-in-instruction-list (instruction-list origin)
|
(defun fix-label-addresses-in-instruction-list (instruction-list origin)
|
||||||
(loop :with address := origin
|
(loop :with address := origin
|
||||||
|
:with cell := instruction-list
|
||||||
:for obj :in instruction-list
|
:for obj :in instruction-list
|
||||||
:if (typep obj 'label)
|
:if (typep obj 'label)
|
||||||
:do (setf (address obj) address)
|
:do (setf (address obj) address)
|
||||||
:else
|
:else
|
||||||
:do (incf address (instruction-length obj))))
|
:do (when (typep obj 'instruction)
|
||||||
|
(incf address (instruction-length obj)))
|
||||||
|
:unless (null (rest cell))
|
||||||
|
:do (setf cell (rest cell))
|
||||||
|
:finally (setf (cdr cell)
|
||||||
|
(list (make-label :name "PROGRAM_END" :address address)))))
|
||||||
|
|
||||||
;;; Testing
|
;;; Testing
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue