AdvSys2 Development - RIP
David Betz
Posts: 14,516
I've decided to move the discussion of AdvSys2 for the WordFire platform to a new thread to avoid cluttering up Jim's thread with my implementation issues. I'm still having trouble getting text to display on all four screens. I've verified that I haven't changed anything in vga.driver.spin and I've only added functions to vga.spin to support my scrolling text based game. I would attach my code but I'm not sure I'm allowed to given the licensing of the code for WordFire but I'll include a small piece since it is pretty much the same code that Jim already posted in the other thread. Here is what I'm doing to try to display text on all four screens:
'configure video pins lock := ((cnt >> 16 + 2) | 1) << 16 repeat s from 0 to 3 vga[s].init(lock|vconfig[s]) 'initialize vid drv with vgrp/vpins waitf(4) 'let voltage to screens stablize? ' write something on each screen repeat s from 0 to 3 write(s, 10, 3, WB, string("Hello, world!"))The text appears fine on screen 0 but it is shifted on screens 1-3. Also, I don't understand the purpose of the reference to cnt.
Comments
Okay, I took a look, and for that repeat loop for locking the screens together in sync, you don't want that waitf(4) line in that loop. It almost for sure is preventing kuroneko's driver from establishing sync lock of the instances properly. You only want the vga[ s ].init() line in that loop, nothing more. That is, it should be a tight/fast loop, so don't consolidate those two repeat loops from my example just because it appears that they could work as one loop (and be more compact). Make them back-to-back. Although I sometimes use separate repeat loops just to make the code clearer to read (even though it's less compact/efficient), in this case, the loops must be separate, as the first one has to be fast.
Meanwhile, in the second repeat loop that I've suggested for the waitf() line, I'd probably put the following two lines before it. Again, the second repeat loop gets the waitf(4) line, if it's even necessary (I think I put it in just to be safe, and it only delays things by a second in total). I'm assuming that you don't want to redefine any font characters at this time.
All of the code is checked into GitHub except the video and keyboard drivers which are not open source but you get the source if you purchase the WordFire console.
Game code:
Game runtime code:
This is about as far as I can go until I resolve a major omission in my new adventure writing system. The two main components of an adventure game are the game map and the command parser. I've implemented the game map but I only allow single character commands. To go any further I have to write a parser. The parser for my old system was written in C and I had to remove it when I implemented the interpreter in PASM on the Propeller. My plan is to write a new parser in the adventure language itself. That's my next project and it will likely take a while to complete.
However, pinOn, pinOff, and waitcnt are not native to AdvSys2. They are defined as follows. The "asm" statement probably requires a bit of explanation. What appears in the "asm" statement are AdvSys2 byte code opcodes. The "LADDR 0" instruction loads the address of the first local variable onto the stack. The first local variable happens to be the first function parameter, in this case, "n". The "LOAD" instruction just loads a long from the address on the top of the stack. Then the "NATIVE" instructions execute native Propeller instructions. This is how AdvSys2 code gets at the Propeller hardware. The "RETURN" instruction simply returns from the function.
I don't pretend that AdvSys2 will become a popular programming language for the Propeller but it is another entry in the long list of languages you have to choose from.
Here is some sample code:
And here is the output that it generates when you run it: It's not very exciting but it proves that nested arrays work. The compiler puts the size of the array at offset -1. That is the reason for the references to myArray[-1].
The binary file format is really simple (as I'm sure you know). I guess your problem is that you need to include your interpreter code (written in Spin/PASM) with the bytecode binary? For my Risc-V interpreter I solved this by pre-compiling the interpreter and padding it out to a fixed boundary (say 4K, I can't remember now what it was exactly). The interpreter always assumed the code started after the boundary. Then producing the binary was just a matter of concatenating the interpreter binary and bytecode binary, then fixing up the checksum.
but it would restrict youi byte-arrays to start at a long address and be 4 byte boundary long.
wasting space for each string used.
having every var being 32 bit might not be useful on a MC, so maybe add types for byte and word?
Mike
could work with any Array using the start address of the array, but getting to the index number needed one has to skip your size field on nested Arrays, seems complicated.
would allow access to each byte per index but just for one long. How about
that would take the size of the one dimensional array stored at index-1 as bound check.
But then byteArrays aka strings start at a long address and are long so wasting up to 3 bytes.
a optimizing compiler could use those spare bytes for something
just some thoughts
Mike
is possible and useful
Mike