B) Renumbering procedure in machine code
This procedure is very short and simple.
It cannot renumber arguments after GO TO, GO SUB, and RESTORE commands.
The procedure is relocatable: it can be loaded anywhere in the computer’s memory.
First, the procedure is given in decimal form, then in assembly language. You can use a simple loader or assembler for input.
DECIMAL VIEW ASSEMBLY VIEW
65000 LD HL,(23635)
65004 LD BC,10
65007 LD DE,10
65010 PUSH DE
65011 PUSH HL
65012 LD DE,(23627)
65016 XOR A
65017 SBC HL,DE
65019 POP HL
65020 POP DE
65021 RET Z
65022 PUSH BC
65023 LD (HL),D
65024 INC HL
65025 LD (HL),E
65026 INC HL
65027 LD C,(HL)
65028 INC HL
65029 LD B,(HL)
65030 INC HL
65031 ADD HL,BC
65032 EX DE,HL
65033 POP BC
65034 ADD HL,BC
65035 EX DE,HL
65036 JR ADDR+10
Before starting the program, you need to set the step at address 65005/6, and the starting renumbering number at address 65008/9.
In the program, both arguments are set to 10. Run the procedure with the command:
RANDOMIZE USR 65000
B.J.
Share your thoughts about the article