Record of some of the computer tech I deal with so that it's documented at least somewhere.

Sunday, 16 May 2010

Loeliger's TIL

I first implemented Loeliger's TIL (ISBN-10: 007038360X) in AVR machine code though as with most FORTH type projects, writing the interpreter is as far as anyone goes. My interest in SIMD has given me an excuse to write it in x86 assembler. Unfortunately I'm going to have to do it on Linux, though it's like choosing which nugget to pick out of the cat litter tray. Alarmingly I read what is effectively the Linux manual. Nearly 400 syscalls. What a diabolical monster!!

Anyway Loeliger. One of my favourite readings.
Here's a template I made for the inner loop. It contains no actual mnemonics because the idea is that to port it to a new platform, one just %defines the required bits, just leaving the platform dictionary to write.
COLON:
PUSH_I_2_RS ; PSH I -> RS
WA_2_I ; WA -> I
JMP_NEXT ; jmp NEXT
SEMI :
my_ca ; Code Address of SEMI
POP_RS_2_I ; POP RS -> I
NEXT:
DEREF_I_2_WA ; @I -> WA
I_2_NEXT_I ; I = I + 2
RUN:
DEREF_WA_2_CA ; @WA -> CA
WA_2_NEXT_WA ; WA = WA + 2
CA_2_PC ; CA -> PC ; implicit JMP CA


I've done the %defines and %macros for x86 now.

work in progress

I've got some nifty macros going there, NASM seems easy to use.

No comments: