Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Suppose that we made the program in Fig. 2.1 a relocatable program. This program is written for the standard version of SIC, so all operand
Suppose that we made the program in Fig. 2.1 a relocatable program. This program is written for the standard version of SIC, so all operand addresses are actual addresses, and there is only one instruction for- mat. Nearly every instruction in the object program would need to have its operand address modified at load time. This would mean a large number of Modification records (more than doubling the size of the object program). How could we include the required relocation information without this large increase in object program size? Line Source statement COPY FIRST CLOOP 5 10 15 20 25 30 35 40 45 50 55 ENDFIL 60 START 1000 COPY FILE FROM INPOT TO OUTPUT SIL RETADR SAVE RETURN ADDRESS JSUB RDREC READ INPUT RECORD LOA LENGTH TEST FOR EOF (LENGTH = 0) COMP ZERO JEO ENDFIL EXIT IF EOF FOUND JSUB WRREC WRITE OUTPUT RECORD J CLOOP LOOP LDA EOF INSERT END OF FILE MARKER STA BUFFER LDA THREE SET LENGTH = 3 STA LENGTH JSUB WRREC PRITE BOF LDL RETADR GET RETURN ADDRESS RSUB RETURN TO CALLER BYTE C'BOF WORD 3 WORD 0 RESW 1 RESW 1 LENGTH OF RECORD RESB 4096 4096-BYTE BUFFER AREA SUBROUTINE TO READ RECORD INTO BUFFER 65 70 75 80 85 90 95 EOF THREE ZERO RETADR LENGTH BUFFER RDREC LDX LDA RI.OOP ID 100 105 110 115 120 125 130 135 140 145 150 155 160 165 170 175 180 185 190 1.95 200 205 210 215 220 225 230 235 240 245 250 255 JEQ RD COMP JEQ SICH TIX JIT STX RSUB BYTE WORD ZERO ZERO INPUT RLOOP INPUT ZERO EXIT BUFFER, X MAXLEN RLOOP LENGTH CLEAR LOOP COUNTER CLEAR A TO ZERO TEST INPUT DEVICE LOOP UNTIL READY READ CHARACTER INTO REGISTER A TEST FOR END OF RECORD (X'00') EXIT LOOP IP BOR STORE CHARACTER IN BUFFER LOOP UNLESS MAX LENGTH HAS BEEN REACHED SAVE RECORD LENGTH RETURN TO CALLER CODE FOR INPUT DEVICE EXIT INPUT MAXLEN X'F1 4096 SUBROUTINE TO WRITE RECORD FROM BUFFER WRREC WLOOP LDX TD JEQ LDCH WD TIX JLT RSUB BYTE END ZERO OUTPUT WLOOP BUFFER, X OUTPUT LENGTH WLOOP CLEAR LOOP COUNTER TEST OUTPUT DEVICE LOOP UNTIL READY GET CHARACTER FROM BUFFER WRITE CHARACTER LOOP UNTIL ALL CHARACTERS HAVE BEEN WRITTEN RETURN TO CALLER CODE FOR OUTPUT DEVICE OUTPUT X'OS FIRST
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started