;*********************************************************************** ; Global Symbol Matcher BOOT OBJECT ; ; This function matchs the return address segment AX with the BCO or LCO ; found in the global symbol table. If found it returns the print name ; in DS:AX. If not, it returns #f. ; ;************************************************************************ ((el sym.seg #xffda) (el sym.off #xffd8) (l gsm) (push es) (push di) (push si) (push dx) (push cx) (push bx) (mov ax dx) ; DX = segment to match (ss:) (les (dw w) bx) (aw sym.off) ; ES:DI = untagged global symbol table (xor bh bh) (mov bx di) (es:) (mov (di db w) cx) 2 ; CX = table size (add ib di) 4 ; ; loop over symbol table vector ES:DI = 1st entry CX = number ; (l gsm.vloop) (push es) (es:) (les (di w) ax) (cmp ib ah) #x11 ; is hash entry a pair? (jz) (db gsm.lloop) (and ax ax) ; is hash entry #f? (jnz) (db gsm.error) (l gsm.vloop.con) (pop es) (add ib di) 4 (loop) (db gsm.vloop) (xor ax ax) ; if not found return #f (mov ax ds) (jmps) (db gsm.ret) (l gsm.error) (pop es) (mov ib dl) 255 (int #x90) (l gsm.found) (pop es) (l gsm.ret) (pop bx) (pop cx) (pop dx) (pop si) (pop di) (pop es) (retf) ; ; loop down one hash entry list ES:AX ; (l gsm.lloop) (cmp ib ah) #x01 ; if null then check next hash entry (jz) (db gsm.vloop.con) (cmp ib ah) #x11 ; if pair then check CAR (jz) (db gsm.pck) (jmps) (db gsm.error) (l gsm.pck) (xor ah ah) (mov ax si) ; ES:SI = untagged current pair (es:) (lds (si w) bx) ; DS:BX = CAR pair (cmp ib bh) #x12 (jnz) (db gsm.error) (xor bh bh) (lds (bx w) bx) ; DS:BX = symbol value (cmp ib bh) #x28 ; BCO ? (jz) (db gsm.bco.ck) (cmp ib bh) #x26 ; closure ? (jz) (db gsm.clos.ck) (l gsm.lloop.con) (es:) (les (si db w) ax) 4 ; ES:AX = CDR pair (jmps) (db gsm.lloop) ; ; check BCO for match ; (l gsm.bco.ck) (mov ds ax) (cmp dx ax) (jnz) (db gsm.lloop.con) (es:) (lds (si w) ax) ; DS:AX = CAR pair (jmp) (dw gsm.found) ; ; check closure's LCO for match ; (l gsm.clos.ck) (xor bh bh) (lds (bx db w) ax) 4 ; DS:AX = closure's LCO (mov ds ax) (cmp dx ax) (jnz) (db gsm.lloop.con) (es:) (lds (si w) ax) ; DS:AX = CAR pair (jmp) (dw gsm.found) ;************************************************************************** )