There is an ID byte for every value.
For additional code density, I should probably add a 'same' bit to the id byte - to designate the current id byte for the next two data values.
There is an ID byte for every value.
For additional code density, I should probably add a 'same' bit to the id byte - to designate the current id byte for the next two data values.
Interested in C# and Electrical Engineering? This might interest you.
Oh that's why you put only one plus there.
I looked at your instruction set and realised that your (yet unimplemented) bitwise instructions take only two operands, not three like your arithmetic instructions. Is there a reason for this? Wouldn't be also nice if your shifts took two operands, so program hasn't to loop if (when) it has to shift more than one place? You have also only two conditional branches, are you going to leave it that way or do you have thoughts for others?
I took same paper and calulated and drew a bit to see if I could make instructions shorter with a bit squeezing. Results.
Does it count as cheating if I use a C++ plugin to handle the CPU core?
I can reach a higher speed if all data is kept byte aligned, which will definitely make a difference if I code the core in SCAR.
In your notes, where do you come up with the fifth ID bit? I have:
id byte:
[0][0][0][0] [D][R][IL16][IL32]
D: Direct Access bit.
If this bit is set, data is interpreted as a memory address. This bit is ignored if the register bit is set.
The Immediate Length bits are still processed when this bit is set.
R: Register bit.
If this bit is set, data is interpreted as a 1 byte register; if not, data is interpreted as an immediate number
IL16 & IL32: Immediate Length bits.
If either of these bits are set, data is interpreted as a corresponding multi byte number.
Else, data is interpreted as a 1 byte number. These bits are ignored if the register bit is set.
Interested in C# and Electrical Engineering? This might interest you.
That's not bad idea, you gain speed, and if you some day don't want to have this written in SCAR's language, you've already big bunch of code in C++.
That is completely true.
I didn't come up with any usage for the 5th bit, it was reserved for future if something new and funky happens.
I was ill for few of days and had to kill time. This is result.
I know it is VERY hacky. This is first time I've written a compiler in Haskell and I didn't do any kind of planning. When something didn't suit some other thing, I had to do some ugly workaround, resulting huge pile of workarounds.
I won't maintain this, I will possibly update this for later release of Smartzkid's emulator.
Optimisations are very simple peephole optimisations. It can compile small programs to fit very huge amount of memory available for program code (64 bytes). Register allocations would help a lot, this uses just registers AX and BX. 8D It causes several stores, loads and vals which could be avoided with better usage of registers. I didn't even touch register allocation with this, because this isn't meant to be anything big and glorious, just something written quickly and left hanging.
Source package (gzip'd tarball)
EDIT: Just realised that the grammar in README is horribly wrong.I will upload soon correct version.
EDIT2: Uploaded new package.
EDIT3: But that isn't still correct.
EDIT4: I think it is correct now.![]()
Last edited by fronty; 05-05-2010 at 09:34 PM.
There are currently 1 users browsing this thread. (0 members and 1 guests)