How to fill a DAT block conditionally - thanks, problem solved.
Cluso99
Posts: 18,069
I have a screen buffer which varies in size. If it is greater than the cog space I need to fill past the end of the cog.
How do I do this only if the size > 496*4. The PropTool compiler fails if the amount to fill is negative (which is when I do not need to fill anything).
Here is the piece of code which fails.
The last line fails if (ocols*orows) < (496*4) however I want it to just ignore the command in this case.
If (ocols*orows) > (496*4) I want to reserve the extra bytes/longs.
Any ideas??
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
· Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
Post Edited (Cluso99) : 5/5/2010 9:05:50 AM GMT
How do I do this only if the size > 496*4. The PropTool compiler fails if the amount to fill is negative (which is when I do not need to fill anything).
Here is the piece of code which fails.
'' ┌──────────────────────────────────────────────────────────────────────────┐ '' │ The following fills cog space in hub + 16 bytes for screen[noparse][[/noparse]2000] space. │ '' └──────────────────────────────────────────────────────────────────────────┘ long 0[noparse][[/noparse]$1F0-$] 'pad to fill cog space (because the screen lives here in hub) ends FIT $1F0 org 0 long 0[noparse][[/noparse]((ocols*orows) -(496*4))/4] 'reserve extra space for screen > cog-size (1984)
The last line fails if (ocols*orows) < (496*4) however I want it to just ignore the command in this case.
If (ocols*orows) > (496*4) I want to reserve the extra bytes/longs.
Any ideas??
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
· Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
Post Edited (Cluso99) : 5/5/2010 9:05:50 AM GMT
Comments
Maybe use a multiply in combination with the result of a comparison?
(((ocols*orows) > (496*4)) & %01) * ((ocols*orows) - (496*4)) + 1
What I'm thinking is that the comparison will either equal -1 or 0. And that to get just a binary 1 or 0. Multiply the difference between the needed screen memory fill value, and add one, just to keep the whole works positive.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness!
8x8 color 80 Column NTSC Text Object
Safety Tip: Life is as good as YOU think it is!
Post Edited (potatohead) : 5/5/2010 5:34:54 AM GMT
-Phil
@Phil: The buffer begins at the hub address where the cog is loaded from, so I am re-using the hub space after it is loaded into the cog. This works fine, but now I am making the screen buffer size variable so I need to allocate the extra little bit (if screen > 80*25) and I only want to allocate if it is required.
This is in my Debug 1pin TV * 1pin KBD code and I have almost all calculations now being done by constants so there is minimal overheads. I have also freed quite a bit of cog space for extra VT100 commands.
I have tried PAL 64*32 (2048) and it works nicely, as does NTSC 64*28, both at 5MHz. There is a little shimmering. 60* is a little better.
File attached: To archive I had to comment out the offending line in "Debug_1pinTV_rr051g.spin"
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
· Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness!
8x8 color 80 Column NTSC Text Object
Safety Tip: Life is as good as YOU think it is!
Vary the size of BUF_LONGS, and use F8 to view the allocation.
-Phil
Post Edited (Phil Pilgrim (PhiPi)) : 5/5/2010 6:56:01 AM GMT
Here is what I did, and I do not have to fill the cog space either if the screen is smaller. A winner all-round.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
· Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
The conditional math also helps in CAD. Not all systems offer comparisons and or are limited in syntax. Most will evaluate a comparison though. That's part of the convoluted expression I posted here.
Using the '&' like you did, eliminates the multiply needed to act on the compare, and makes more general logical sense than a simple value of "1" does to me now. Cool.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness!
8x8 color 80 Column NTSC Text Object
Safety Tip: Life is as good as YOU think it is!
Post Edited (potatohead) : 5/5/2010 3:26:15 PM GMT