Plov : Some thoughts
At this point, we have a fairly complete programming language. In many aspects it is bigger than any commercial BASIC (targetted at the same group of processors). In other, it still isn't. And as a seasoned assembly and Modula-2 programmer I still miss some little gems. And they are related to bit manipulations. In microcprocessors, bit manipulations are of a second importance. In microcontrollers, bit manipulations are the highest importance. So we need to spend some time on this.
In Modula-2 we have the 'set' concept. A machine word is considered as a set of bits. And each bit can be manipulated. Like so:
IF 23 IN BITSET (flagword) THEN Signal (SigSegv) END;
IF TL IN TestsToDo THEN Goto (20, 63); Print ("ħħ") END;
INCL (set, element);
EXCL (PortB, bit7);
The first line checks if bit 23 is SET in 'flagword' and if so, a SigSegv id generated.
In the ideal case, this is how Plov could handle things. But it won't. Plov is a simple language with just one type (Cardinal), as opposed to a real Modula-2 implementation. So some other means must be chosen.
Plov : IO port manipulations
I have thought about this issue elaborately. The following ideas crossed my mind:
Plov : How does the compiler know the port names?
Luckily I am not doing such a thing for the first time. Two years ago I wrote a disassembler for the AVR. There are many AVR processors and most of them differ to a certain degree so I needed a way to make the disaasembler symbolic. So I made a lot of configuration files in which (among other things) I listed all portnames and portnumbers. These files now come in handy.
Yet, there is one thing that pops up: How does Plov know which processor it is compiling for? Ideally this would not be necessary. For a mmicroprocessor it wouldn't be needed. But a microcontroller is littered with special purpose registers and ports, each with a different name. Plov is for microcontrollers so it needs a new keyword. The most logical is to name it 'CPU' and that's what it will be called.
When the compiler is invoked, it will read the CPU specific definitons file to find out which portnames and registernames exist. These will be stored in the symbol table. The backend will later reread the right CFG file to map the portnames in the registerspace.
For an example look here: ../AVR/disman.html, made for the ATmega8515 processor.
Page created on 24 September 2008 and
Page equipped with GoogleBuster technology