Shop OBEX P1 Docs P2 Docs Learn Events
Yet another spiral demo :) — Parallax Forums

Yet another spiral demo :)

pik33pik33 Posts: 2,366
edited 2021-04-26 12:18 in Propeller 2

Yet another spiral demo. This time in Spin, using my HDMI driver :)

A demo code is now simple :smile: but compiles only with Flexprop. Propeller Tool doesn't like accessing another object's variables.

 CON
 _clkfreq        = 200000000
 hdmipin         = 8

 obj               v: "hng023"

 pub demo() |x,y,px,py,d

 v.start(512+256+192+48,hdmipin)

 repeat y from -248 to 247
   repeat x from -448 to 447
     px,py:=xypol(x,y)            
     v.putpixel(x+448,y+248,(py+px<<20)>>24)

 repeat
   d:=long[v.palette_ptr+4*255]
   longmove(v.palette_ptr+4,v.palette_ptr,255)
   long[v.palette_ptr]:=d
   v.waitvbl(1)

Comments

  • evanhevanh Posts: 15,915

    Palette cheat! :P

  • pik33pik33 Posts: 2,366
    edited 2021-04-26 12:37

    Yes, good, old, vblank synchronized palette trick :) Setq2 allows reading all 256 color palette every frame in every vblank

    Now, how to do this using a Propeller Tool? It also doesn't like to call putpixel, which is a variable (a method pointer) in the driver.

  • evanhevanh Posts: 15,915

    Huh, TV is telling me 896x496 resolution.

    Can't help with anything Spin, sorry. I'm enjoying Pasm too much.

  • pik33pik33 Posts: 2,366
    edited 2021-04-26 14:03

    Yes, it is 896x496x60Hz, the maximum resolution at which the driver (or rather P2 memory) allows 8 bpp - 446400 bytes used by fb and display list, less than 100 kB left
    A lot of pasm is used in the driver :)


    You can also rotate a display list :)

    _clkfreq        = 200000000
    hdmipin         = 8
    
    obj               v: "hng023"
    
    pub demo() |x,y,px,py,d
    
    v.start(512+256+192+48,hdmipin)
    
    repeat y from -248 to 247
      repeat x from -448 to 447
        px,py:=xypol(x,y)            
        v.putpixel(x+448,y+248,(py+px<<21)>>24)
    
    repeat
      d:=long[v.palette_ptr+4*255]
      longmove(v.palette_ptr+4,v.palette_ptr,255)
      long[v.palette_ptr]:=d
      d:=long[v.dl_ptr]
      longmove(v.dl_ptr,v.dl_ptr+4,495)
      long[v.dl_ptr+4*495]:=d
      v.waitvbl(1)
    

  • cgraceycgracey Posts: 14,152

    Good idea to use the palette.

Sign In or Register to comment.