Plov022 : some tuning and fixes
It's been some while since I worked on Plov. Lately I have been trying to install a cross compiler for AVR on
Linux. And that's not easy. It's also ridiculous. You need to install 30 megabytes of libraries and
executables to program a micro controller with 30 kilobytes of code space. It doesn't make sense and it is
very much dependent on the Linux distribution in use. So I stopped the senseless quest for a C compiler that
does all for all processors. And shifted attention back to my own compiler that targets ALL processors without
getting bulky or clunky.
Changes in Plov022:
IF space on the heap > required space THEN Z := Z + required space ELSE Call ErrorRoutine ENDWe don't want the heap to fall through its bottom (thereby ruining the stack or some other area of memory), so we need to check for that bottom. In most cases, the bottom will never be reached. But if it does, an ErrorRoutine is called. In this procedure, either the problem is solved by some means, or the attention of the human operator is drawn with flashing lights and sirens. Or the controller is simply reset.
Some tests
Each run of the compiler generates three extra files:
testIRQ
PROGRAM testIRQ
PROCESSOR ATmega8515
VARIABLES a x y z END
PROCEDURE OpenGate
BEGIN
a := x + y
END OpenGate
PROCEDURE CloseGate
BEGIN
x := y - a
END CloseGate
IRQ 0 = RESET
IRQ 1 = OpenGate
IRQ 2 = CloseGate
BEGIN
OpenGate
END testIRQ
|
# PROGRAM testIRQ
PROCESSOR ATmega8515
CODESTART 34
# VARIABLE a at 96
# VARIABLE x at 98
# VARIABLE y at 100
# VARIABLE z at 102
# PROCEDURE DECLARATION OF OpenGate
LABEL OpenGate
MEMORY 96
FETCH 98
FETCH 100
ADD
SAVE
RETURN
# END OF PROCEDURE OpenGate
# PROCEDURE DECLARATION OF CloseGate
LABEL CloseGate
MEMORY 98
FETCH 100
FETCH 96
SUBTRACT
SAVE
RETURN
# END OF PROCEDURE CloseGate
VECTOR 0 MAINLOOP
VECTOR 1 OpenGate
VECTOR 2 CloseGate
LABEL MAINLOOP
CLAIM 0
CALL OpenGate
RELEASE 0
LABEL EXITMAINLOOP
STOP
# Done #
|
Page created on 10 May 2010 and
Page equipped with FroogleBuster technology