Add function to compute addresses of labels in instruction list
This commit is contained in:
parent
501da2341e
commit
37b2864a7d
1 changed files with 8 additions and 0 deletions
|
@ -96,6 +96,14 @@
|
||||||
'(branching-mixin)))
|
'(branching-mixin)))
|
||||||
((%opcode :allocation :class :initform ,code)))))))
|
((%opcode :allocation :class :initform ,code)))))))
|
||||||
|
|
||||||
|
(defun fix-label-addresses-in-instruction-list (instruction-list origin)
|
||||||
|
(loop :with address := origin
|
||||||
|
:for obj :in instruction-list
|
||||||
|
:if (typep obj 'label)
|
||||||
|
:do (setf (address obj) address)
|
||||||
|
:else
|
||||||
|
:do (incf address (instruction-length obj))))
|
||||||
|
|
||||||
;;; Testing
|
;;; Testing
|
||||||
|
|
||||||
(define-instruction "TXA" nil (:implied 0))
|
(define-instruction "TXA" nil (:implied 0))
|
||||||
|
|
Loading…
Add table
Reference in a new issue