diff --git a/wip-duuqnd/user-side-compiler/instruction.lisp b/wip-duuqnd/user-side-compiler/instruction.lisp index 16c9e61..c613adc 100644 --- a/wip-duuqnd/user-side-compiler/instruction.lisp +++ b/wip-duuqnd/user-side-compiler/instruction.lisp @@ -101,11 +101,17 @@ (defun fix-label-addresses-in-instruction-list (instruction-list origin) (loop :with address := origin + :with cell := instruction-list :for obj :in instruction-list :if (typep obj 'label) :do (setf (address obj) address) :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