Hey so I am making a vertical sprite generator that allows me to draw and convert the image into a displayable vertical text sprite, mostly for my personal use. It is 93 by 55 which is the size of the image I want to display on the graph screen (I am using it to display maps).

btw |L is the small L for lists

I am 85% sure that the scanning code works, but not 100% sure. This is the code:


Code:

" ->Str1
62->A
0->Z
0->Y
0->X
0->V
56->dim(|LPDG
While A!=6
A-1->A
V+1->V
For(B,1,93
If pxl-Test(A,B
Then
If pxl-Test(A,B+1
Then
If pxl-Test(A,B+2
Then
Str1+"|L"->Str1
Else
Str1+"["->Str1
End
B+2->B
Pxl-On(A,B
Z+3->Z
Else
Str1+"."->Str1
B+1->B
Pxl-On(A,B
Z+2->Z
End
Else
Str1+" "->Str1
Pxl-On(A,B
Z+1->Z
End
(Z/V)->Y
If Y=93:Then
X+1->X
Z->|LPDG(X)
End
End
End


A and B are the coordinates for pxl-Test and it goes from left to right, bottom to top.
Z shows how many pixels have been checked (so I can calculate when a row ends)
(Z/V) basically checks if the amount of pixels tested is a multiple of 93 so I know when the row ends. I then store the coordinate of where a new row ends into List PDG.

If there is anything wrong with the scanning code let me know! thanks


The main problem that I have is the displaying part. I'm not sure why but eventually it throws me a dimension error.

Displaying code:

Code:

sub(Str1,2,length(Str1)-1->Str1
0->C
For(A,56,1,~1
For(B,1,dim(|LPDG
If B=1
Text(A,1,sub(Str1,1,|LPDG(1)
If B!=1
Text(A,1,sub(Str1,|LPDG(B-1)+1,|LPDG(B)
End
End
Pause


sub(Str1 just removes a space I added at the beginning of str1.

the length of str1 is 5208

The code does sub(Str1 and it goes from character 1 to character # (stored in List PDG)

I don't know why I'm getting a dimension error or why it doesn't completely work

I probably might have left some things out so if you need more information on code or clarification then just ask

Thanks!
Hello, and welcome to Cemetech. Could you introduce yourself?
When I'm looking at your code, I see some stuff.
1) You set A to 62, which is right, but you decrement it BEFORE the pxl-Test, so A becomes 61 on the first trial
2) You actually check for horizontal sprites (pxl-Test(A,B), pxl-Test(A,B+1) and pxl-Test(A,B+2)). For more information, see this.
3) You are 3 times checking for a pxl-Test( and based on that, you add a character to the string. Maybe you could use this instead:

Code:
sub("[|L.",1+sum(seq(pxl-Test(A,B+X),X,0,2)),1

This code checks the 3 pixels, and returns the sum of the black pixels + 1. The sub-argument takes a character, based on the amount of black pixels.

If you could fix these ^, and it still doesn't work, would you please post again? Thanks Smile
OOOO cool! I've been wanting to make a vertical text sprite generator to go with my horizontal one for a while but I've always run into issues because some characters are longer than others, and to get the best speed out of it, the length of the string displayed would have to change from one row to another (although the rest could easily be filled with spaces or something of the sort) I'd love to see how you intend to get over the character length issue, will you just stick with 1-3 pixel wide characters? Also, the code seems alright to me, could use some slight optimizations though because I feel this code would take ages to check a screen or even some portion of it. (to be fair, mine isn't particularly fast Razz)
Welcome to Cemetech Pudding3201! Very Happy
PT_ wrote:
1) You set A to 62, which is right, but you decrement it BEFORE the pxl-Test, so A becomes 61 on the first trial

The reason for 61 instead of 62 is because of the screen size that I am using to display pictures. I can later change the code to better fit for general use once I figure out all the bugs.


Code:
sub("[|L.",1+sum(seq(pxl-Test(A,B+X),X,0,2)),1

The code doesn't seem to work for me. I don't know if it's because there's no space in the string or what but variable X always returns as zero.

I'm just curious, but how does the code work exactly? How does it check if the string is "0", "10", "110, or "111"? I understand most of how seq( works but I'm not sure what the seq(pxl-Test returns.

Thanks Smile
mr womp womp wrote:
I'd love to see how you intend to get over the character length issue, will you just stick with 1-3 pixel wide characters?

Yea since it's too much work to check for multiple pixels in a row, I've decided to just use period, space, bracket, and list.

mr womp womp wrote:
Also, the code seems alright to me, could use some slight optimizations though because I feel this code would take ages to check a screen or even some portion of it.

Speed wise, the only optimization I can do would be to do something like your horizontal text sprite generator by checking for empty/unused graph space. Since the program is very slow, I use the Wabbitemu emulator and select max speed to speed up processes by 1600%.

Does anyone have any idea of how I can display the characters? If you look at my display code you can see I use lists as coordinates but it keeps throwing me an error that I can't figure out why. Is there a better way to display vertical text sprites? I have to work around the fact that the characters I use are different pixel lengths (some are 1 or 2 or 3) so I have to take that into account for displaying to display the correct amount (93 pixels per row) and then jumping to the next row to display.

Thanks Smile
Pudding3201 wrote:
mr womp womp wrote:
I'd love to see how you intend to get over the character length issue, will you just stick with 1-3 pixel wide characters?

Yea since it's too much work to check for multiple pixels in a row, I've decided to just use period, space, bracket, and list.

mr womp womp wrote:
Also, the code seems alright to me, could use some slight optimizations though because I feel this code would take ages to check a screen or even some portion of it.

Speed wise, the only optimization I can do would be to do something like your horizontal text sprite generator by checking for empty/unused graph space. Since the program is very slow, I use the Wabbitemu emulator and select max speed to speed up processes by 1600%.

Does anyone have any idea of how I can display the characters? If you look at my display code you can see I use lists as coordinates but it keeps throwing me an error that I can't figure out why. Is there a better way to display vertical text sprites? I have to work around the fact that the characters I use are different pixel lengths (some are 1 or 2 or 3) so I have to take that into account for displaying to display the correct amount (93 pixels per row) and then jumping to the next row to display.

Thanks Smile

Although I've never made a program to create vertical text sprites, I've displayed some before (for learning purposes) the way I did it was in a for( loop, the x coordinate for the left side of the strings would be the same all the way up, the right side would be either the same for all strings (the empty space was filled with spaces) or arbitrary depending on the length of the string displayed and the pixel width of the characters in the string. To keep your program a little simpler, I would suggest going with the same width all the way up, filling extra space with spaces. This would prevent you from having a list with coordinates in it, sacrificing a little of the size of the program that displays it. Also, If you want to make your program use larger characters, since many of the combinations are missing as you move up in pixel width, I would suggest just checking for some (not necessairely all of them) with an instring( command after your part of the program is done, for example,

Code:
)(
could be
m
L)
could be
$
and so on...

Because if your program is going to be very slow, then might as well put in the extra few seconds to make the output better Wink
mr womp womp wrote:
Because if your program is going to be very slow, then might as well put in the extra few seconds to make the output better Wink

Although that would be better, I would have to turn each line into binary and then check for specific sequences of binary, so it will increase the program size and slow down the speed by quite a bit unless there's another way of doing so.

But I've finally finished the displaying code! The scanning just adds spaces to the end of each line like you suggested. Thanks for the help Smile. It works 100% now, here is the displaying code:

Code:
sub(Str1,2,length(Str1)-1->Str1
1->B
For(A,56,2,~1
Asm(prgmSPRTFIX
Text(A,1,sub(Str1,B,93
B+93->B
End

The assembly program is just to fix the erasing of pixels one underneath (a common error on 84s).

Should I make another version of the vertical text sprite program for other people to use? If people want to use it, I can make it so that it checks for empty space and like your horizontal text sprite program, create a string that has all the code needed to display (although I probably won't put in the actual text string, it can be up to 5115 characters long).
  
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