Porting code from Flex Prop to IDE Tools and vice versa
Hi everyone,
I would like to porting this demo (see the attached zip at the bottom):
https://www.parallax.com/video-hardware-character-map/

from FlexProp to Spin Tools IDE by Marco Maccaferri's
As suggested by Marco, I made the following changes :
• Replaced "ASM / END ASM" with "ORG / END"
• Changed video# to video.
• Changed color# to color.
During compilation, I encountered an error on line 100:
video.DrawBox(0,0,video.XSIZE,video.YSIZE,borderColor, 3) **
**Error: undefined symbol video.XSIZE
Marco then advised me to add the following method in p2simplevideo.spin2:
PUB get_xsize() : r
return XSIZE
After making these changes, Spin Tools IDE compiles correctly RAM and EEPROM,
but nothing is displayed on the VGA monitor.

I must add that note: blue TX LED on the Prop Plug lights up for much longer when I compile
with Flex Prop respect when I compile with IDE Tools
The Debug terminal IDE Tools shows the following logs:
Cog0 INIT $0000_0000 $0000_0000 load
Cog0 INIT $0000_0F64 $0002_4404 jump
Cog1 INIT $0002_1D50 $0002_18C0 load
Cog0 active_pixels = 1_024
Cog0 scanline_clks = 6_720
Cog0 burst = 2_464
Cog0 video_bytes = 4_096
Cog0 video_fragments = 2
Cog0 video_clks = 4_428
On the other hand, FlexProp compiles and executes the code correctly, even after applying these same modifications.
Prop Flex Debug terminal shows the following logs:

Suggestions ?
SPAXIO
P.S. To all environment developers, a prayer: Try to unify the syntax.

Comments
I have examined the code a bit more and found a number of problems, some of which are due to the Spin Tools compiler itself.
The most important is an error compiling the code for the rdlut instructions used by the psram driver, this causes fill function to hang.
If you comment the line 183 in p2simplevideo.spin2 (mem.fillBytes) the video output works but display a blank screen.
The other problems are related to the inline asm code in the gfxText* methods, the variables used by the inline code, for example lcl_fontWidth, is out of the allowed local variables range (must be the first 16 long variables). The compiler fails to report the error for some reasons (need to look at it better).
flexprop compiles directly to pasm so doesn't have this limitation.
In the end I think that this demo can't be ported successfully to a standard spin compiler, even fixing the rdlut issue so the psram driver works, the gfxText methods can't work unless rewritten to satisfy the inline pasm requirements.
Sorry for that.
One can use the FlexProp compiler inside spin tools by setting up some external tools…
When someone says it's impossible, I just had to try it. The result is attached here. To avoid exceeding the 16 local parameters, I use global variables to pass the parameters, and the PR0..PR7 registers as pix1..pix8.
The driver also includes my previous changes (see here) and is configured for a single PSRAM chip. This can be easily changed in the OBJ section of the p2simplevideo1 driver.
To try it out, unzip the attached ZIP file into the ‘P2 Character Map Demo’ directory and run P2_Character_Map_Demo1.spin2.
It works for me with FlexProp, PropTool, and PNUT, and probably also with PNUT_TS (not tested). SpinTool compiles it, but does not generate an image. Probably due to the RDLUT issue, which Marco will surely fix soon...
Have fun
Andy