Shop OBEX P1 Docs P2 Docs Learn Events
Potatotext being revised & Bean Embedded Basic WIP — Parallax Forums

Potatotext being revised & Bean Embedded Basic WIP

potatoheadpotatohead Posts: 10,261
edited 2011-02-28 08:24 in Propeller 1
I've got the first working copy up on my blog, here: http://forums.parallax.com/entry.php?129-16-Color-Potatotext-8x8-NTSC-TV-Driver

The big feature changes on this one are:

Smaller HUB memory foot print, byte color instead of word color. 16 color operation. Much simpler configuration, though I still need to code up the counter number needed to get the colorburst.

There are some plans in the TO DO part of the file. I'll post as I go along. Mainly this one was to get color text for TV to a much smaller foot print, and allow for old school 8x8 definable characters for Bean's basic, which I can't wait to try!

It's pretty easy to kick out a render COG that does not do text, but just does a bitmap. Two colors per 8 pixels, 16 color screen total with the same format. One byte colors, one byte pixels. Anyone interested in that?

Comments

  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2011-02-13 18:43
    Very Nice!!

    You've got my attention.. :)

    OBC
  • potatoheadpotatohead Posts: 10,261
    edited 2011-02-13 18:49
    Yeah, basically C64 text. Well, the 2 color text. Otherwise, it's IBM style, with redefinable characters.
  • potatoheadpotatohead Posts: 10,261
    edited 2011-02-13 22:57
    Whoops! Wrong version posted. Here's the correct working version. Other one has inverted character addressing. Got trigger happy. Sorry all. Blog updated too.
  • HumanoidoHumanoido Posts: 5,770
    edited 2011-02-14 04:36
    Potatohead, congratulations on this very cool code! Can you tell me what it will take up in terms of propeller resources (HUB RAM, COGs, etc.). Is this the smallest color code for the prop?
  • potatoheadpotatohead Posts: 10,261
    edited 2011-02-14 07:21
    I don't know if it's the smallest, but it's a lot smaller than the first time around.

    It takes two cogs. They are currently somewhere under 2.5K RAM in the HUB, if included the usual way in a SPIN program. Binary versions will be produced that can be loaded from SD card, into the screen buffer. If that is done, or the COG HUB memory footprint is used as the screen after the driver is started, there is no HUB memory cost

    A 128 character font takes 1K HUB RAM.

    Screens are one word per character, and they range from 20x25 to 80x25, which equals 1000bytes to 4000 bytes. There is a small HUB buffer area needed, which varies from 80 bytes to 320 bytes, depending on the screen chosen.

    40x25 screen, which many people will likely prefer on TV would then be 160 bytes+2000+1024 = ~3.5K
  • trodosstrodoss Posts: 577
    edited 2011-02-14 07:48
    Very nice indeed!
    Have you thought about handling flashing or character, so that VT100 could be emulated?

    --trodoss
  • potatoheadpotatohead Posts: 10,261
    edited 2011-02-14 08:45
    I didn't think of flashing. IMHO, the current video pixel / color path is tight. Needs to be just a notch tighter for 80 @ 80. Had a coupla people ask me for it on the original potatotext code.

    Flashing would have to give up some color attribute bits, and would take a counter, branch and test in the render cog loop. It's possible, though that would probably keep it at 64 chars at 80Mhz. For composite, no big deal. Few displays will render 80 well. But, with S-video, that changes, so I'm really torn on giving up the 80@80.

    The options I am seriously considering are:

    - 50 line display, interlaced. Would work sweet on a older composite monitor, or a s-video running monochrome, or some color. Not sure how practical that is, but I kind of want it, and who knows? Maybe a few folks out there have older composite displays, or will run on a PC capture, both of which would display that very nicely.

    - s-video output. I'm gonna wire up my PPDB to explore this. There are a coupla S-video capable boards out there, Propcade is one. S-video mono rocks. 80 reads easily on my displays running that way.

    - put first 128 chars into the render COG. There is room for them. That too would probably cost the 80@80, but freeing up 1K of RAM in the HUB is probably worth it. That's the one real downside to 8x8 displays. Gotta pack a font into the HUB. I think we heard a 8x8 will be in the Prop II though. :)

    - Other render cogs that do bitmaps and such. That might need to just be another driver entirely, depending on how far the TV COG can be pushed.

    - VGA port of the TV COG.

    - Documentation, easy config, one, two, three kind of thing. If that code base gets done, future works, or bringing older driver code forward will be easier to do and easier for people to use. Currently, it uses the Coley autoconfig, which probably could be expanded for some new boards. I've a couple now that I didn't have before. That probably deserves a look.

    The immediate plan is to make sure what's here is as clean and small as possible. Add S-video and internal font, easy configure options, and document. That will be the OBEX release to support Bean's BASIC, which I'm eager to take for a spin! It will supersede the old potatotext thats in there, though I won't delete the one that is in there right now. Always add code, never remove is my mantra on those things. Because of that, and time overall, I'm gonna keep the focus pretty tight on just completing a well executed text driver.

    I think a lot of people will want to jam on the BASIC, so the configure options and documentation is very high priority right now. Maybe go "Gold", heh :)

    From there, maybe do some of that other stuff.
  • trodosstrodoss Posts: 577
    edited 2011-02-14 09:21
    potatohead wrote: »
    Flashing would have to give up some color attribute bits, and would take a counter, branch and test in the render cog loop. It's possible, though that would probably keep it at 64 chars at 80Mhz.

    The old ZX Spectrum TV driver used indexed colors and handled this. I haven't looked at that driver in a long time though so I don't know if they contained the fore/back in a single byte, or if there was a separate byte for fore, back, attribute, char. Maybe that would be something worth looking at?
  • BeanBean Posts: 8,129
    edited 2011-02-14 09:31
    Potatohead,
    I will work on getting this incorporated into Embedded BASIC tonight.
    I'll add a command to select the screen width, and enable/disable the colorburst.

    Should have it working in a couple days.

    Memory is a concern, every K used for the display is a K lost to program space.

    Do you think 80 @ 80MHz is going to happen ? It might not look too good for text, but might be cool for games (same with 50 row display).

    Bean
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2011-02-14 09:49
    This is going to make an AWESOME addition to Bean's BASIC!

    Are you going to do a .redefine command so that folks can pass character changes on the fly like this? http://forums.parallax.com/showthread.php?98984-FemtoBASIC_COLOR-Updated-with-cursor-string-support

    With the speed of Bean's basic compared to my old Femto mod, games should actually be possible.

    OBC
  • BeanBean Posts: 8,129
    edited 2011-02-14 10:11
    Right now I have a function CHARS that returns the address of the character bitmap table.
    From that you can POKEB the values, but a REDEFINE command might be nice to make it easy.

    The one hang-up now is there is no way to get code in or out. It only saves and loads to the EEPROM.
    Not enought space for SD card routines... maybe a custom PC program to communicate via serial for save/load...

    Bean
  • potatoheadpotatohead Posts: 10,261
    edited 2011-02-14 10:25
    80 at 80 is really close. I feel good about it. 50 line mode should not be any trouble. Those two have my attention right now. Please add a switch for interlace too. Some people prefer it despite the lower color detail. It is good at 40 chars and below.

    Seems to me a secondary program can fetch code from eeprom. Do whatever needs to be done in BASIC, then load the EEPROM management program to fetch code for storage on SD card, and do the reverse later on.

    Also seems to me a smaller font definition could be used at the higher screen densities.

    I have not seriously explored stuffing the lower 128 chars into the render cog. Could free up ram but will require another config option or two. I'm pretty sure the renderer won't be quick enough to do 80 chars that way though. Could be wrong. Won't know until that gets looked at.
  • potatoheadpotatohead Posts: 10,261
    edited 2011-02-14 11:55
    @trodoss

    The old speccy driver was at a lower resolution. That's probably enough time to do those things. I think VT100 is a interesting project, though it's not one I can do right now.

    Coupla thoughts: One is to manage the blinking at the terminal emulation layer. A few longs could represent the flashing status of the display characters, and could be scrolled with the screen. Done that way, it's just a loop every VBLANK, that toggles the attributes every so many frames, maybe 20 or so. That could be done with no changes to this code.

    Another one is Cluso stuffed a nice chunk of a VT100 into one of his mono TV drivers. I think that's a one COG solution, and if so, there is a TON of room in the render COG. Could copy paste that and get a nice emulation with this driver, no blinking though, without some tricks!

    It seems to me, a really solid VT100 would be a application that occupies the Propeller more fully, along with SD card, serial, keyboard, etc...
  • BeanBean Posts: 8,129
    edited 2011-02-14 17:10
    Potatohead, I hope you don't mind me posting Embedded BASIC in here...

    The color are in the wrong order, but I wanted to get it out so people could try it.

    Comments welcome.

    Bean

    P.S. Read the EmbeddedBasic.TXT file

    NOTE: Please get the updated version further down in this thread...Bean
  • potatoheadpotatohead Posts: 10,261
    edited 2011-02-14 17:14
    Not at all! I'm among the people wanting to give it a go. Went ahead and made a title edit so it all hangs together.

    @all: In my blog, comment #4, there is a easy fix for the color that will get folded into the next driver release.

    @Bean: That was quick! (thumbs up!)

    @All: Please post video issues to either this thread, or the blog posting. I've got another version in progress, and will fold those in where possible. Thanks!
  • BeanBean Posts: 8,129
    edited 2011-02-15 04:55
    ' Version 0.12
    ' Fixed colors
    ' Fixed SAVE and LOAD going beyond program area
    ' Enhanced DISPLAY command (multi parameters, value 10 moves to next line)

    P.S. You need to use BST with this code...
    The binary is for the Demo Board

    Bean
  • SapiehaSapieha Posts: 2,964
    edited 2011-02-15 07:40
    Hi Bean. It is possible to You add "MEM" command that give free Memory that can be used bu Main Basic program?
    Bean wrote: »
    ' Version 0.12
    ' Fixed colors
    ' Fixed SAVE and LOAD going beyond program area
    ' Enhanced DISPLAY command (multi parameters, value 10 moves to next line)

    Bean
  • HollyMinkowskiHollyMinkowski Posts: 1,398
    edited 2011-02-15 10:35
    potatohead wrote: »

    The options I am seriously considering are:
    -
    -
    -
    - VGA port of the TV COG.

    YAY! :smile:

    You are a very creative coder potatohead.
  • BeanBean Posts: 8,129
    edited 2011-02-15 15:10
    Just wanted to say I upload a binary version for the Propeller Demo Board. It is in post #17.
    You'll need a PS/2 keyboard and NTSC (TV) display to use it.

    Also you can use CNT to time things in embedded BASIC.
    10 start=CNT
    20 FOR a=1 TO 1000:NEXT a
    30 PRINT (CNT-start)/80000;" milliseconds."
    

    This program takes 28 milliseconds for 1000 for...next loops. Or 28 microseconds per loop.

    Bean
  • HumanoidoHumanoido Posts: 5,770
    edited 2011-02-15 22:42
    Bean, that's just implemented perfect.
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-02-16 01:01
    nice work potatohead :)

    I have just done the basic screen control characters. You are welcome to the code :)

    BTW, did you reverse the font to speedup the code? IIRC I also have the font in the cog ram.
  • potatoheadpotatohead Posts: 10,261
    edited 2011-02-16 02:08
    Oh man! This thing is really fast! Nice work Bean! I like FCOLOR 15 best. Reminds me of a old computer, only it goes way faster.

    I didn't get anywhere near the time I wanted to play, but I will soon. Good grief, screen output speed alone is insane. It's in my demoboard eeprom now, so I can play a little. Need to find some old basic games with keyboard, or something. OBC will probably love this thing. It blasts through little programs like the one in the capture in seconds.

    Fat fingered my way to a bug though. Typed "for ==" on a new line with no number, and got "Not implemented", and it hangs. Guess we just don't do that right now. Everything else worked a treat. Again, nicely done. I was not expecting the speed at all. You did this thing in PBASIC? Nice! I'm looking at the LONG PASM listing just kind of checking it all out. Cool beans!

    Did anyone determine program code size yet?

    @Cluso: Thanks! The HUB font is not reversed. Actually, if it was, I think getting 80 columns would work right now. It's not though. The render cog reverses it on the way to the TV cog. Coupla things improved on this pass. (one of these days I'll quit mashing together video drivers)

    Color can be table driven in the TV COG. That means just fetching the color, and self-modifying a waitvid directly. Works great, and could be done with 4 color mode, limited palettes though. Anyway, the other big boost was Eric coming up with a great loop that does two characters worth of scan line data in one HUB fetch. That one rocks, and the TV cog can actually do well over 640 pixels at 80Mhz. Speedy.

    A double buffer helps with the render (text) cog considerably. I need to apply some of what you guys have shown me and squeeze a little more out of it to get 80 columns. I think it will do it without having to reverse the font. Haven't tested, but I suspect it's fine right now at 96 and above. The basic is awesome at 64 though. Perfect and I just want to play a little.

    Wouldn't mind looking at the "font in COG" code, because that would allow for a color text display, 20 chars by 25 lines to fit in just over 1K of HUB RAM, assuming somebody either binary loads the drivers, or reclaims their HUB footprint for the screen.
    720 x 576 - 20K
    720 x 576 - 37K
  • BeanBean Posts: 8,129
    edited 2011-02-16 04:14
    Thanks for finding that bug, I'll try to fix that in the next version.

    There is 4K of code space, but I would like to offer 8K.

    The code needs a MAJOR clean-up. It was an on-going project so things have just been bolted-on as I went.

    After a cleanup there should be more code space and maybe even a little more speed.

    If reversing the font makes life easier for you...Go ahead and do it...It's not a big deal.

    Bean
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-02-16 12:25
    my driver has the font reversed (IIRC it is hippy's AiGeneric font but I reversed it manually). Otherwise, reverse the font on initialisation. Then you code is both smaller and faster!
  • RoadsterRoadster Posts: 209
    edited 2011-02-24 11:57
    Bean,
    It seems that this version embeddedBasic_0_12.zip only complies with the ntsc option, version 11 compiles fine with all 3 options terminal, telnet and ntsc
  • Martin HodgeMartin Hodge Posts: 1,246
    edited 2011-02-27 19:26
    I'm just diving into this and I wanted to test it out on one of my ASC's, but I can't get the video to work. I need to send video to pins 16-18 so I changed the config, in "embeddedBasic.pbas", to this:
    ivcfg := %0_10_1_0_1_000_00000000000_010_0_00000111
    idira := $0007_0000
    

    But whenever I change it to anything but pins 12-14 I don't get the same signal out. What am I missing?
  • kuronekokuroneko Posts: 3,623
    edited 2011-02-27 22:34
    But whenever I change it to anything but pins 12-14 I don't get the same signal out. What am I missing?
    From the looks of it 18_potatotext2_TV.spin uses its own 2 colour mode for the visible area (ivcfg2). This is based on a private copy of ivcfg before the parameters are copied over. Maybe that sequence should be re-ordered. But that's not up to me to decide.
  • potatoheadpotatohead Posts: 10,261
    edited 2011-02-28 08:22
    Whoops!!

    Thanks. Nice catch. I am just about finished with the next revision. I will add this fix. For now, I guess the right thing to do is edit the private ivcfg, found in the DAT section of the TV driver. Let me know, if that does not work, and I'll squeeze in some time to deal with it ASAP.

    And what I was trying to do was save passing another parameter, just for the 2 color region.
  • Martin HodgeMartin Hodge Posts: 1,246
    edited 2011-02-28 08:24
    Ah thank you Kuroneko. That lead me to the solution

    In 18_potatotext2_TV.spin
    '-------------------------------------------------------------
    ' Board Specific Parameters
    '-------------------------------------------------------------
    ivcfg                   LONG    %0_10_1_0_1_000_00000000000_010_0_00000111      'par +4 ' ASC
                                        |
    (this needed to be changed to a 0)--+
    
Sign In or Register to comment.