I started up this thread to see about getting things set in stone for having some libraries for BASIC programmers on the CSE, namely sprite assistance from asm.

Today, I figured that since our ASM gurus are busy pursuing other things right now, I'd make one in BASIC just for fun, to expand upon the Hex2Sprite found here.



I haven't gotten instructions on use done yet, and I've only added that one sprite so far. I want/need to play around with it a bit more before I fully release it, to make sure it's all happy.

What are your all thoughts? Smile
Looks great, tifreak8x! Care to throw down the code for the core of it? I would assume it's something like:

Code:
"<64 hex chars>"->Str0
For(A,1,<height>
For(B,1,<width>
Pxl-On(Y+A,X+B,10+sub(Str0,B+(A-1)<width>,1
End:End

Or thereabouts?

Code:
"000000000000333G0000000000333993G00000000038883993G000000003888883333G0000000038888839983G0000033398888883383G00033993988ABBB88B3G0038399398ABB33A3B3G0388839938ABB33A3B30333G3888839938AABBBABA338883G38883039938A3333A3038883G38883039993AAAAA39338883G03330038999333339998883G0003303888999993998883G003883388888893039883G03888833889993000333G388888933899993G3883889993399983G0333389930388883G00000333003888333G0000000003888888883G0000000003333333333"->Str9
{25,10,10->|LSPR
ClrDraw
If length(Str9)<1:Return
|LSPR(1->A
|LSPR(2->B
|LSPR(3->C
1->D
While D<length(Str9
inString("123456789ABCDEFG",sub(Str9,D,1->E
If E>0 and E<16:Pxl-On(B,C,9+E
If C-|LSPR(3)>A or E=16:Then
|LSPR(3->C:B+1->B:End
D+1->D:C+1->C
End


First bit is the hex sprite, then the list is {width,row start, column start. The ClrDraw would be removed for the release out into the world. The rest is the displayer Smile

I'd like to note that I continue to use 'G' as an optimizer for the hex, so I don't have a lot of trailing 0's. This is what the sprite looks like, broken down:


Code:
000000000000333G
0000000000333993G
00000000038883993G
000000003888883333G
0000000038888839983G
0000033398888883383G
00033993988ABBB88B3G
0038399398ABB33A3B3G
0388839938ABB33A3B30333G
3888839938AABBBABA338883G
38883039938A3333A3038883G
38883039993AAAAA39338883G
03330038999333339998883G
0003303888999993998883G
003883388888893039883G
03888833889993000333G
388888933899993G
3883889993399983G
0333389930388883G
00000333003888333G
0000000003888888883G
0000000003333333333
Because it is significant enough:



I added in a 2x mode, to increase the size of the pixels to a 4:1 ratio. Smile

The code can be combined, and I know that, but I'm tired and will mess with it tomorrow:


Code:
"000000000000333G0000000000333993G00000000038883993G000000003888883333G0000000038888839983G0000033398888883383G00033993988ABBB88B3G0038399398ABB33A3B3G0388839938ABB33A3B30333G3888839938AABBBABA338883G38883039938A3333A3038883G38883039993AAAAA39338883G03330038999333339998883G0003303888999993998883G003883388888893039883G03888833889993000333G388888933899993G3883889993399983G0333389930388883G00000333003888333G0000000003888888883G0000000003333333333"->Str9
{25,10,15,2->|LSPR
ClrDraw
If length(Str9)<1:Return
|LSPR(1->A
|LSPR(2->B
|LSPR(3->C
1->D
If |LSPR(4)=1:Then
While D<length(Str9
inString("123456789ABCDEFG",sub(Str9,D,1->E
If E>0 and E<16:Pxl-On(B,C,9+E
If C-|LSPR(3)>A or E=16:Then
|LSPR(3->C:B+1->B:End
D+1->D:C+1->C
End:End
If |LSPR(4)=2:Then
While D<length(Str9
inString("123456789ABCDEFG",sub(Str9,D,1->E
If E>0 and E<16:Then
Pxl-On(B,C,9+E
Pxl-On(B+1,C,9+E
Pxl-On(B,C+1,9+E
Pxl-On(B+1,C+1,9+E
End
If C-(|LSPR(3)2)>A2 or E=16:Then
|LSPR(3->C:B+2->B:End
D+1->D:C+2->C
End:End


I just wanted to see if it would work, and it does! Very Happy
Great addition! As you say, you can combine those two chunks of code, but that's best left for tomorrow, I think. Smile Perhaps over the weekend or some other time soon we can keep pursuing the ASM option.
Although it's slow, the result is very pleasing to my eyes. Smile
DJ_O wrote:
Although it's slow, the result is very pleasing to my eyes. Smile


Thanks DJ Smile I knew it would be slower, but I figured it'd still be good to get this out there, at the very least.

KermMartian wrote:
Great addition! As you say, you can combine those two chunks of code, but that's best left for tomorrow, I think. Perhaps over the weekend or some other time soon we can keep pursuing the ASM option.


That will be fun to play around with Very Happy I'm (and I'm sure others) will be looking forward to a working version. Smile
Whelp, I'd say hammering out a complete spec would be a good idea to help that project move forward (plus of course cloning me a few times Wink ). What form do you intend to release this program/routine in, and do you have any specific demo program in mind?
I plan on cleaning up the code by combining the Mode 1 & 2 code into one engine, and I'd like to add a check at the beginning to ensure that the list is set up properly and defaults to mode 1 if the user doesn't define that.

I'll also probably get a few more sprites made, show them off in their different sizes as a separate program that calls the sprite routine. Hoping to have time to do that later this evening.

Are you wanting to use my hex data for your version? The list setup would be good for yours I think, just not sure how well what hex stuff I have would be good for other programmers.

Edit:

http://tifreakware.net/tifreak8x/hex2sprite/Hex2SpriteCSE.zip

I'd be grateful if someone with a CSE would test it, maybe create their own sprite and run it through the program?
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement