ASSEMBLY LANGUAGE EXTENSION PREPROCESSOR This application of STAGE2 to enhance assembly language programs with a few control structures is included with this STAGE2 package mainly for example. No user documentation is provided but it should not be difficult to see how to use it by trying the examples provided. Examples: STAGE2 ALXTEST.ASM,ALXTEST.LST=ALX.MAC,ALXTEST.ALX STAGE2 BOUT.ASM,BOUT.LST=ALX.MAC,BOUT.ALX IMPLEMENTATION NOTES: > means push ^ means pop C means condition Stack Source Statements Generated Code >n >K IF ( C ) JCF n ^K ^n FIN n: ----------------------------------------------------------- >n >n+1 >W WHEN ( C ) JCF n+1 ^W >E FIN JMP n ^E ^n+1 >K ELSE n+1: ^K ^n FIN n: ----------------------------------------------------------- >B BRANCH ( V1 ) L1 CPI V1 JZ L1 ( V2 | V3 | V4 ) L2 CPI V2 JZ L2 CPI V3 JZ L2 CPI V4 JZ L2 ( OTHERWISE ) L3 JMP L3 ^B FIN ----------------------------------------------------------- >n >S SELECT >n+1 >I ( V1 ) CPI V1 JNZ n+1 ^I ^n+1 FIN JMP n n+1: >n+3 >I ( V2 | V3 | V4 ) CPI V2 JZ n+2 CPI V3 JZ n+2 CPI V4 JNZ n+3 n+2: ^I ^n+3 FIN JMP n n+3: >O ( OTHERWISE ) ^O FIN ^S ^n FIN n: ----------------------------------------------------------- >n >n+1 >L WHILE ( C ) n+1: JCF n ^L ^n+1 ^n FIN JMP n+1 n: ----------------------------------------------------------- >n >R REPEAT n: ^R ^n UNTIL ( C ) JCF n ----------------------------------------------------------- Statement is allowed if top of stack is one of the following: I,K,L,O,R,W,*. Otherwise particular control statements are expected. I,K,L,O,W statement or FIN R statement or UNTIL E ELSE only S SELECT ITEM or FIN B BRANCH ITEM or FIN