This is a program from LELAND L beck's book on System Software (An introduction to system programming)
I am trying to understanding how MACROS work
this demonstrates the use of macro
My doubt is what does JEQ *-19 means and what does JEQ *-3 means
When i googles it says that it jumps 19 instructions back then where will it reach How can i figure 19 instructions and pin point the place where the control flow would land
Is there any way i can practise sic/xe programs ...any virtual machines or so that i can try it ..I would be much grateful to any suggestions...
COPY START 0
RDBUFF MACRO &INDEV,&BUFADR,&RECLTH
CLEAR X
CLEAR A
CLEAR S
+LDT #4096
TD =X'&INDEV'
JEQ *-3
STCH &BUFADR,X
TIXR T
JLT *-19
STX &RECLTH
MEND
WRBUFF MACRO &OUTDEV,&BUFADR,&RECLTH
CLEAR X
LDT &RECLTH
TD =X'&OUTDEV'
JEQ *-3
WD =X'&OUTDEV'
TIXR T
JLT *-14
MEND
...
MAIN PROGRAM
FIRST STL RETADR
CLOOP RDBUFF F1,BUFFER,LENGTH
LDA LENGTH
COMP #0
JEQ ENDFIL
WRBUFF 05,BUFFER,LENGTH
J CLOOP
ENDFIL WRBUFF 05,EOF,THREE
J @RETADR
EOF BYTE C`EOF`
THREE WORD 3
RETADR RESW 1
LENGTH RESW 1
BUFFER RESB 4096
END FIRST
Any help would be highly appreciated .Thanks and regards in advance
The character
*
evaluates the address of the current instruction and-3
subtracts three bytes (not instructions) from it.In this case
*
will evaluate to the value ofJEQ
's address so*-3
will evaluate toTD
's address (sinceTD
instruction takes 3 bytes in memory).Similarly,
JLT *-19
will jump toCLEAR A
(CLEAR
s andTIXR
are in format 2,+LDT
in format 4 and the others in format 3, which adds to 19).