Shop OBEX P1 Docs P2 Docs Learn Events
Understanding P2 PASM — Parallax Forums

Understanding P2 PASM

cbmeekscbmeeks Posts: 634
edited 2022-10-26 20:13 in Propeller 2

Hello, everyone.

I'm looking at various code examples for the P2 on GitHub and I'm trying to study things like basic VGA drivers.

As I come across commands like "setcmod", I look that up in the PASM2 (Draft) document but it doesn't really tell me what that's all about.

So my question is, is there some beginner friendly documentation on PASM2? Especially learning towards things like video. I realize video isn't beginner friendly. But I cannot seem to find the "hows and whys" many of these PASM2 commands do.

Thanks for any suggestions.

Comments

  • evanhevanh Posts: 15,192
    edited 2022-10-26 20:48

    Certainly the source code won't teach anything for that instruction. The hardware manual isn't finished. It's in the silicon document after the streamer section. Two sections: It is primarily for the numerical COLORSPACE CONVERTER but also has the Digital Video Output TMDS encoding feature attached.

    Silicon doc - https://docs.google.com/document/d/1gn6oaT5Ib7CytvlZHacmrSbVBJsD9t_-kmvjd7nUR6o/edit?usp=sharing

  • Wuerfel_21Wuerfel_21 Posts: 4,506
    edited 2022-10-26 21:06

    Yea, good pointer to the silicon doc, that's where the real info is.

    Also gonna mention the ever helpful spreadsheet of all instructions: https://docs.google.com/spreadsheets/d/1_vJk-Ad569UMwgXTKTdfJkHYHpc1rZwxB-DcIiAZNdk

    For VGA, the point of the cmod/cy/ci/cq register settings is to transform the full-range (0..255) RGB values given to 0..179 range (which equates 0 to 0.7 volts on the 75 ohm DAC mode)

    Different values make YPbPr,S-Video,composite,DVI and whatever else happen. The (mildy convoluted) video driver I use in my emulators has many different modes and it's easy to glean from the data section how they're set up: https://github.com/IRQsome/NeoYume/blob/master/NeoVGA.spin2

  • I've looked over those documents but they may as well be in Chinese for me. I understand a lot of it. But what I'm missing is a "how to" guide. Something that says, "here is how you create video with P2".

    I'm not against learning from technical documents (I enjoy it), but when you compare the docs in the RPi and Arduino world, it's much different.

    Anyway, I'll keep at it. :-)

  • RaymanRayman Posts: 13,897

    I tried to create a simple VGA example with notes here:
    https://forums.parallax.com/discussion/172624/simple-vga-wvga-spin2-examples

    Maybe that would help a bit?
    Think I have a cleaner way of adjusting the basepin now, but this isn't too bad...

  • Thanks for that. I have bookmarked it and will check out that code.

  • pik33pik33 Posts: 2,350
    edited 2022-10-28 06:29

    For VGA output you don't even need cmod. The only problem is the DAC output is too high for a VGA and you will get burned out/all white colors. Cmod allows to correct this without any software computing (and you don't have 256 levels anymore :( ) (but this is not a problem for 8 bpp color depth where there are much less than 256 levels for a color component) ). For a true color 24 bpp the better solution is to use an external hardware attenuator (voltage divider) at the VGA output.

    For HDMI there are bits in cmod that switch on the TMDS encoder so your pixel data go to the encoder instead of DACs.

  • For me, I want to design a video chip for an 8-bit system. Something that would have been period accurate. Like 320x240 with 16 to 256 colors and sprites.

    The P1 could honestly pull it off for the most part. But I like having the large amount of RAM in the P2 for a framebuffer. Plus, it would be cool to send it commands so that the P2 could do certain things like a basic blitter.

  • pik33pik33 Posts: 2,350
    edited 2022-10-28 13:24

    I wrote a family of video drivers for a P2 which have sprites and a display list. The most advanced of them does things like a retro 8/16 bit computers: it has text and graphic modes and several horizontal resolutions to select using a display list. The basic resolution for the driver is 1024x576@50 Hz on HDMI. I didn't manage to add sprites to this one, no place in cog for more code, so I have also a driver which lacks character modes but has sprites instead.

    PSRAM based systems, like P2-EC32MB or even an Eval board with one PSRAM chip attached (8 MB) can use the PSRAM for a frame buffer. P2-EC32 can display 1024x576 in 24-bit color while having 16 "hardware" sprites (you set the pointer and position of the sprite, the cog does the rest). If using VGA, 1920x1080x8bpp can be done with this board.

    So there is of course possible to do a 320x240 driver (at this resolution even without a PSRAM) and a system bus driver to connect this to an external CPU. This will eat 2 cogs, so you can still have 6 free cogs to do things like blitting. Or a sound chip. There is a SID emulation available. Or Amiga Paula style audio driver (this one is also my own creation)

  • @pik33 said:

    So there is of course possible to do a 320x240 driver (at this resolution even without a PSRAM) and a system bus driver to connect this to an external CPU. This will eat 2 cogs, so you can still have 6 free cogs to do things like blitting. Or a sound chip. There is a SID emulation available. Or Amiga Paula style audio driver (this one is also my own creation)

    This is exactly what I am looking to do. :-)

    And, I just got word from USPS that my P2 Eval board is out for delivery! Nothing like getting a new toy on Friday.
    I've got a lot to learn. I once built a pretty good NTSC circuit using only 74 logic and an SX52. Remember those? :-)

    So I hope I can get back into this like I was before and learn the P2 idiosyncrasies.

  • @cbmeeks said:
    So I hope I can get back into this like I was before and learn the P2 idiosyncrasies.

    You'll have plenty of fun! It takes time to learn everything the P2 can do but nothing beats using real hardware.

  • evanhevanh Posts: 15,192

    One thing that can be done with modern displays, both monitors and TVs, is with HDMI input they have become far more flexible timing wise. Much more like the pre-LCD multisync CRTs.

    It's easy to craft a 320x240 mode without pixel-doubling or scan-doubling. Although older displays won't like it. There is various limits that differ across products.

    That said, there is also plenty of very fussy displays too. My old plasma TV only accepts about 10 very exact modes in total. Most extended VGA type modes don't work with it even though it is full 1920x1080 resolution. The HDMI input on it makes no difference.

Sign In or Register to comment.