TITLE 'Module BUILD'›SUBTTL 'File BUILD.AMA'›;›; This module›;›; (a) Flags all system locations ›; referenced in the object program so›; they can be transferred to the sys-›; tem equate section of the output›; file›;›; (b) Builds a table of labels for ›; all non-system address references›;›;›;›;›;›;›PROC›BUILDLDA #1›STA PASS›JSR GETBYT ;Get a byte from object code.›BCS :EXIT ;Bail out if nobyte.›STA INSBUF;Save it.›TAX›LDA MODES,X;Get mode ID.›CMP #NOP;Is it an opcode?›BEQ BUILD;No, try another one.›AND #$60;Look at operand size field.›BEQ BUILD;If none, forget it.›JSR GETBYT;Get another›BCS :EXIT›STA ADRBUF;Put in address lo byte›LDX INSBUF;Look at opcode again.›LDA MODES,X›CMP #REL;Branch?›BNE :NTRL›JSR RELADR;Yes, get the abs addr›JMP BLLAB;and pass to BLLAB›:NTRLCMP #IMM;Immediate mode?›BEQ BUILD;Yes, try next instruction›;›; If we get here the instruction is either absolute in›; which case we need to move two operand bytes into›; INSBUF, or 0-page in which case we want one address›; byte and a zero.›;›AND #$40;2 operand bytes?›BNE :TWOBT;Yes, read another.›LDA #0;No, it's a 0P address›STA ADRBUF+1›JMP BLLAB›:TWOBTJSR GETBYT;Get address hi byte›BCS :EXIT›STA ADRBUF+1›;›; Here we examine the address at›; ADRBUF(2). If it's a system loca-›; tion we flag it for equate use; if›; it's a previously referenced internal›; address we ignore it; if it's a new internal›; reference we insert the address in the ›; label table.›;›BLLABJSR GETSYS;System location?›BCS :BLL1;No, try internal›JSR FLGSYS;Yes, flag it›JMP BUILD;and loop back.›:BLL1JSR GETLAB;Does a label already exist?›BCC BUILD;Yes, get out›JSR ENTERL;No, enter it;›JSR LABMSG;Pacify the operator›JMP BUILD;and loop back.›:EXITRTS;Back to MAIN.›EPROC›;›