I can only guess at this, but as the rest of the BCPL system does not use load and exec addresses, because CINTCODE was designed to be relocatable and is therefore loaded into memory anywhere convenient. There is already a library function called VECTOFILE so my guess is whoever wrote FIXCIN decided to use that to write the actual data, then set the addresses afterwards. Also, I think this CINTCODE-based BCPL was available for CP/M too, so it may have been a case of isolating system dependencies.Which, as JGH says, makes you wonder why FIXCIN didn't just SAVE everything in one go with the correct load / exec addresses? If you were saving to tape, you have no way of going back and amending such details.
It would be interesting. Looking at how far those CINTCODE instructions are reaching into the stack, it looks like the code I found is not a small, well-contained function like the one I posted as an example, but part of a much bigger one. But I also think we can patch it without the source code. That CINTCODE divides into three sections:Dear Mr Richards, do you still have a copy of the BCPL source code?
Code:
; Set up the EXEC address...0498: 50 10 L0498: LG1 272 ; Load global 272, the required LOAD/EXEC address.049A: 80 5A LP 90 ; Word address of control block into A.049C: 97 ST3 ; Store three words into the control block, i.e. low word of EXEC address.049D: 80 5A LP 90 ; Word address of control block into A (again).049F: D4 A4 ; Add four gets to the high word of the EXEC address.04A0: 10 L0 ; Load A with zero.04A1: B5 XCH ; Exchange A and B so now B=0 and A=address.04A2: 94 ST ; Store zero in the high word.; The OSFILE call with A=204A3: 80 5A LP 90 ; Word address of control block into A (again).04A5: 11 L1 ; Load A with 1.04A6: 56 LSH ; A := B << A (so A is now byte address of control block).04A7: A0 6B SP 10704A9: 12 L2 ; The OSFILE code for "Write LOAD address"04AA: A0 6A SP 106 ; Store at offset 106 on the CINTCODE stack.04AC: 0E 23 LM 35 ; -35, as unsigned = &FFDD (OSFILE)04AE: 30 79 LG CALLBYTE ; This calls OSFILE.04B0: 20 66 K 102; The OSFILE call with A=304B2: 80 5A LP 90 ; Word address of control block into A (again).04B4: 11 L1 ; Load A with 1.04B5: 56 LSH ; A := B << A (so A is now byte address of control block).04B6: A0 6B SP 10704B8: 13 L3 ; The OSFILE code for "Write EXEC address"04B9: A0 6A SP 106 ; Store at offset 106 on the CINTCODE stack.04BB: 0E 23 LM 35 ; -35, as unsigned = &FFDD (OSFILE)04BD: 30 79 LG CALLBYTE ; This calls OSFILE.04BF: 20 66 K 102; The tail, whatever that does.04C1: 0F LM104C2: 5B FD LLL$ D06BE04C4: 20 5A K 9004C6: 10 L004C7: 30 02 LG STOP04C9: 20 5A K 9004CB: 7B RTN
Code:
; The OSFILE call with A=204A3: 80 5A LP 90 ; Word address of control block into A (again).04A5: 11 L1 ; Load A with 1.04A6: 56 LSH ; A := B << A (so A is now byte address of control block).04A7: A0 6B SP 10704A9: 12 L2 ; The OSFILE code for "Write LOAD address"04AA: A0 6A SP 106 ; Store at offset 106 on the CINTCODE stack.04AC: 0E 23 LM 35 ; -35, as unsigned = &FFDD (OSFILE)04AE: 30 79 LG CALLBYTE ; This calls OSFILE.04B0: 20 66 K 102; Set up the EXEC address...0498: 50 10 L0498: LG1 272 ; Load global 272, the required LOAD/EXEC address.049A: 80 5A LP 90 ; Word address of control block into A.049C: 97 ST3 ; Store three words into the control block, i.e. low word of EXEC address.049D: 80 5A LP 90 ; Word address of control block into A (again).049F: D4 A4 ; Add four gets to the high word of the EXEC address.04A0: 10 L0 ; Load A with zero.04A1: B5 XCH ; Exchange A and B so now B=0 and A=address.04A2: 94 ST ; Store zero in the high word.; The OSFILE call with A=304B2: 80 5A LP 90 ; Word address of control block into A (again).04B4: 11 L1 ; Load A with 1.04B5: 56 LSH ; A := B << A (so A is now byte address of control block).04B6: A0 6B SP 10704B8: 13 L3 ; The OSFILE code for "Write EXEC address"04B9: A0 6A SP 106 ; Store at offset 106 on the CINTCODE stack.04BB: 0E 23 LM 35 ; -35, as unsigned = &FFDD (OSFILE)04BD: 30 79 LG CALLBYTE ; This calls OSFILE.04BF: 20 66 K 102; The tail, whatever that does.04C1: 0F LM104C2: 5B FD LLL$ D06BE04C4: 20 5A K 9004C6: 10 L004C7: 30 02 LG STOP04C9: 20 5A K 9004CB: 7B RTN
Statistics: Posted by Coeus — Fri Sep 06, 2024 8:18 pm