DW Memory allocation and initialize END End of program and Start Address EQU Load Symbol Table ORG Set Loc Ctr * Reference Location Counter
loc op address ORG 100 DELTA EQU 3 BEGIN LOAD X ADDI 5 ADD Y SUBI DELTA ADD Z STORE ANS HALT ORG 200 Z DW 24 Y DW -4 ANS ORG * + 1 X DW 7 END BEGIN
Header name macro p1, p2, ... Model statements lll ooo aaa End endm
macro &l add3 &r,&t,t&a,&b,&c prototype &l l &r,&a a &r,&b a &r,&c st &r,&t mend
macro &l add3w &r,&t,t&a,&b,&c,&w w = h, e, d, '' &l l&w &r,&a a&w &r,&b a&w &r,&c st&w &r,&t mend
IFxx arg ... [ELSE] ... ENDIF
IF expr ; true if expr is not 0 IFE expr ; true if expr is 0 IF1 IF2 IFDEF sym ; true if sym declared external IFNDEF sym ; true if sym not declared external IFB; true if arg is blank IFNB ; true if arg is not blank IFIDN , ; true if string arg1 and 2 are ident IFDIF , ; true if string arg1 and 2 are dif
add3 macro t, s1, s2, s3, r IFDIF, push r ENDIF mov r, s1 add r, s2 add r, s3 mov t, r IFDIF , pop r ENDIF endm
ASSEMBLER OUTPUT LOADER OUTPUT
ASSEMBLER INPUT LOADER INPUT
---------------- ------------------- ----------------
Main program
MAIN=11R *511*
DSUB 17
ORG 11
GO LOAD X 11 LOAD 21R 511 LOAD 521
STORE B 12 STORE 22R 512 STORE 522
ADD X 13 ADD 21R 513 ADD 521
STORE B+1 14 STORE 23R 514 STORE 523
STORE B+2 15 STORE 24R 515 STORE 524
LOAD Y 16 LOAD 25R 516 LOAD 525
CALL DSUB 17 CALL 0 517 CALL 723
STORE Y 18 STORE 25R 518 STORE 525
... ... ...
X DEC 5 21 5 521 5
B BSS 3 -
Y DEC 4 25 4 525 4
END GO
---------------- ------------------- ----------------
Subroutine
ENTRY DSUB DSUB=0R
EXTRN X,B 0 X 2,...
1 B 1,...
DSUB STORE Z 0 STORE 13R 723 STORE 736
D1 ADD B+2 1 ADD 2 724 ADD 524
MPY X 2 MPY 0 725 MPY 521
... ... ...
BRANCH D1 12 BRANCH 1R 735 BRANCH 724
Z BSS 1 -
END