==================================== Project #02 - Relocation and Linking ===================================== - Ian! D. Allen - idallen@idallen.ca - www.idallen.com Link the four modules together into memory in this order: START, PAUSE, MAIN, DBLE. ANSWER: The source files for the three modules contain some local (non-public) labels with the same name, i.e. Count and One. An LMC linker would not see these private duplicate labels because they don't appear in the object code files, but if you combine all the source code into one big source file and try to assemble it, an LMC assembler program would find that the duplicate labels conflict. (You can't have two different memory locations with the same label name.) I've renamed some of the labels in the module source below to make them all unique in the combined source file. Your submitted source may or may not do this, but you must ensure that the LMC machine code for each module references its *own* local label, not the label in another module. (When MAIN references the local label "Count", it must be the "Count" in the MAIN module, not the "Count" in the PAUSE module, and vice-versa.) I've also replaced the operands that use label mathematics (e.g. "Pause-1") with plain lables (e.g. "PRet") below, since the LMC assembler that I use to test code doesn't understand label math yet. Your code can do it either way. * Label Table (optional) * PRET at 06 PAUSE at 07 PCOUNT at 13 PONE at 14 MRET at 15 MAIN at 16 COUNT at 31 ONE at 32 MAX at 33 DRET at 34 DBLE at 35 ARG at 38 Loc Code: Label Opcode Operand Comments : ; start (new MAIN program) 00 500 : IN 01 231 : STO Count 02 500 : IN 03 233 : STO Max 04 016 : CALL Main 05 700 : HLT : : ; Pause subroutine (no input; no output) 06 000 : PRet DAT 07 113 : Pause LDA PCount 08 414 : SUB POne 09 213 : STO PCount 10 801 : SKZ 11 907 : JMP Pause 12 906 : JMP PRet 13 000 : PCount DAT 000 14 001 : POne DAT 001 : : ; Main subroutine (inputs: Count and Max) 15 000 : MRet DAT 16 131 : Main LDA Count 17 600 : OUT 18 007 : CALL Pause 19 131 : LDA Count 20 238 : STO Arg 21 035 : CALL Dble 22 600 : OUT 23 007 : CALL Pause 24 131 : LDA Count 25 332 : ADD One 26 231 : STO Count 27 433 : SUB Max 28 802 : SKP 29 916 : JMP Main 30 915 : JMP MRet ; this must *not* be HALT (700) 31 000 : Count DAT 000 32 001 : One DAT 001 33 010 : Max DAT 010 : : ; Dble subroutine (no output; returns result in calculator) 34 000 : DRet DAT 35 138 : Dble LDA Arg 36 338 : ADD Arg 37 934 : JMP DRet 38 000 : Arg DAT