Category : Forth Source Code
Archive   : STREAMIO.ZIP
Filename : LINKS.TXT
ONLY FORTH ALSO DEFINITIONS
POSTFIX \ Declare assembler syntax.
\ The following words are used to link and unlink elements in a linked list
CODE link- ( adr1,n--adr2) \ result is adr2 = (adr1) and (adr1) = (adr2+n)
DX POP AX POP AX BX MOV
0 [BX] BX MOV BX CX MOV \ a=*rec b=c=rec d=.next
DX BX ADD 0 [BX] DX MOV AX BX XCHG
DX 0 [BX] MOV CX PUSH NEXT END-CODE \ rec:=[rec.next]
CODE link+ ( adr1,adr2,n--) \ result is (adr2) = adr1 and (adr1+n) = (adr2)
DX POP BX POP AX POP 0 [BX] CX MOV AX 0 [BX] MOV
AX BX XCHG DX BX ADD CX 0 [BX] MOV NEXT END-CODE
CODE xlink- ( seg,adr1,n--adr2) \ 880827z
DX POP AX POP DS POP
AX BX MOV 0 [BX] BX MOV BX CX MOV \ a=adr1 b=c=adr2 d=n
DX BX ADD 0 [BX] DX MOV AX BX XCHG
DX 0 [BX] MOV CX PUSH \ (adr1) = (adr2+n)
CS AX MOV AX DS MOV NEXT END-CODE \ (adr1) = (adr2+n)
CODE xlink+ ( seg,adr1,adr2,n--) \ 880827z
DX POP BX POP AX POP CX POP CX DS MOV
0 [BX] CX MOV AX 0 [BX] MOV
AX BX XCHG DX BX ADD CX 0 [BX] MOV
CS AX MOV AX DS MOV NEXT END-CODE
LABEL (bit) ( ptr,bit,adr--)
AX POP BX POP DX POP \ d=ptr b=bit a=return address
BL CL MOV 7 # CL AND
BX SHR BX SHR BX SHR
DX BX ADD AX JMP END-CODE
CODE bit@ ( ptr,bit -- 0/1)
(bit) #) CALL 0 [BX] BL MOV BL CL SHR 1 # BX AND BX PUSH NEXT END-CODE
HEX
CODE bit0! ( ptr,bit --)
(bit) #) CALL 0FE # AL MOV AL CL ROL AL 0 [BX] AND NEXT END-CODE
CODE bit1! ( ptr,bit --)
(bit) #) CALL 01 # AL MOV AL CL ROL AL 0 [BX] OR NEXT END-CODE
DECIMAL
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/