*bump* I emailed you a new version, tifreak8x. I added a new bit to the flags to indicate when an EOF was hit at the start of the desired line, so that the Insert operation will work but the Replace operation will fail. I believe that insertion in the middle and at the end of files both work correctly. I also found what I think is an odd bug that should have shown up earlier (bytes disappearing off the end of programs when lines were inserted), but you told me you usually used Celtic 2 to read files.

I'll try to get a chance to add a sprite routine soon, if I can spare the cycles.
Alright, now it inserts a new line, however, the creation of the special string is broken. :<
tifreak8x wrote:
Alright, now it inserts a new line, however, the creation of the special string is broken. :<
It seems OK to me.

Celtic 2 Readme wrote:
Theta = 3 : Output "special" string containing STO and doublequote chars

Inputs: None

Outputs: Str9 = Sto and doublequote characters, in that order. Use substrings
to extract them. If using the standard version of Celtic, the
string will be 9 characters long, the other 7 being junk. This
should not affect the integrity of string just as long as you
extract only the first two characters.

It gives me a P:IS:FN error when run from my test program. But yes, it works just fine from the homescreen. Let me mess around with my program, see if I'm doing something wrong..


Code:

ClrDraw
4->theta:" ->Str9
"ATEST"->Str0
Asm(prgmCELTIC2
Text(1,1,"Create program ",Str0,"   ",Str9
2->theta:" "->Str9
2
Asm(prgmCELTIC2
Text(14,1,"Add line ",Str9
0->theta:0
Asm(prgmCELTIC2
Text(27,1,"# of lines ",theta,"   ",Str9
3->theta:Asm(prgmCELTIC2
Text(40,1,"Special string created ",Str9
"Pause "+sub(Str9,2,1)+"Hello!"+sub(Str9,2,1)->Str9
1->theta:1
Asm(prgmCELTIC2
prgmATEST
0->theta:1
Asm(prgmCELTIC2
Text(53,1,Str9
7->theta:2
Asm(prgmCELTIC2
Text(66,1,Str9
0->theta:0
Asm(prgmCELTIC2
Text(79,1,"# of lines ",theta,Str9
8->theta
Asm(prgmCELTIC2
Text(92,1,Str9
6->theta
Asm(prgmCELTIC2


Is my testing program. I'm not seeing anything there to make it not work. :< Is it possible the repeated calling of celtic2 is leaving something in there that is messing with it?
When I run that program, I get this (see screenshot). I get a Syntax error inside prgmATEST, but I'm not overly worried about that.



Edit:
Quote:
[17:11] <@tifreak> hrm..
[17:13] <@tifreak> Alright, I inserted a Pause after the creation of the string it is supposed to drop into the test program
[17:13] <@tifreak> It does create the proper string
[17:13] <@tifreak> It kicks back NULLLINE as an error when trying to post it to the program to run
[17:14] <@tifreak> Which, according to the error list, means it was trying to read an empty line
[17:14] <@tifreak> Not write to it
From reading the code, NULLLINE means that the line it is going to replace in the file is empty (or nonexistent), not Str9 (the new content to insert). I suspect the documentation and the code are not in sync. Does that help?
Not really, because you are supposed to put the data you want to insert into a line into Str9, which it gets the proper data. It's not getting dumped into the line in the test program, and is instead, returning with the NULLINE, like I'm trying to read instead of write.
tifreak8x wrote:
Not really, because you are supposed to put the data you want to insert into a line into Str9, which it gets the proper data. It's not getting dumped into the line in the test program, and is instead, returning with the NULLINE, like I'm trying to read instead of write.
I'm saying that according to tracing the code, the line in the file that it's trying to erase is what's null. It has to first read the line before it can erase it, so it knows how much it can erase, if that makes sense. It just doesn't give you back what it read in any way. Hopefully I'm not misunderstanding what you mean. I take the error (and my reading and tracing of the code) to indicate that it can't replace blank lines.

Edit: tl;dr: replace has more caveats than insert.
Okay, so I've determined the following issues for the moment:

1) using theta=1 doesn't overwrite null lines.
2) Using theta=2 will insert a new line with and without data. However, it also seems to put a space at the end as well. It seems unable to put just a new line, it inserts a new line with a space.

Edit

Found the following:

Str9 had a space in it, removed that bit and ran that section of code, no new line is created. So Str9 has to be populated with some form of data for that to work.

Edit:


Code:
ClrDraw
4->theta:" ->Str9
"ATEST"->Str0
Asm(prgmCELTIC2
Text(1,1,"Create program ",Str0,"   ",Str9
0->theta:0
Asm(prgmCELTIC2
Text(14,1,"# of lines ",theta,"   ",Str9
3->theta:Asm(prgmCELTIC2
Text(27,1,"Special string created ",Str9
Pause
"Pause "+sub(Str9,2,1)+"Hello!"+sub(Str9,2,1)->Str9
2->theta:1
Asm(prgmCELTIC2
prgmATEST
0->theta:1
Asm(prgmCELTIC2
Text(40,1,Str9
7->theta:2
Asm(prgmCELTIC2
Text(53,1,Str9
0->theta:0
Asm(prgmCELTIC2
Text(66,1,"# of lines ",theta,Str9
8->theta
Asm(prgmCELTIC2
Text(79,1,Str9
6->theta
Asm(prgmCELTIC2


Last remaining problem I see is it cannot delete empty lines via theta=7. Otherwise, the above test program seems to work flawlessly. It even deletes the program correctly.
I have emailed you a new file. I believe this version has the ability to:
- Delete blank lines
- Replace blank lines
- Delete/replace blank lines that are the first lines of files
- Delete/replace blank lines that are the last lines of files

Please check all 4 (6?) modes if you get time. I do not believe that this code changes whether it can insert blank lines (can it?).
Alright, sorry it took so long.

When it does theta=2, it doesn't shift the lines down below the one you select.


Code:
ClrDraw
"ATEST"->Str0
0->theta:0
Asm(prgmCELTIC2
Text(1,1,"# of lines ",theta,"   ",Str9
7->theta
5:Asm(prgmCELTIC2
0->theta:0
Asm(prgmCELTIC2
Text(14,1,"# of lines ",theta,"   ",Str9
"Pause "->Str9
1->theta:1:Asm(prgmCELTIC2
prgmATEST
"Pause 1"->Str9
2->theta:2:Asm(prgmCELTIC2
prgmATEST
0->theta:0
Asm(prgmCELTIC2
Text(27,1,"# of lines ",theta,"   ",Str9


This goes with the assumption that ATEST exists on the calculator already, and has (in my case) 10 empty lines starting out.

I paste Pause to line 1 and run the program, does so. I insert Pause 1 to line 2, and it just overwrites. The amount of lines for the program does not increase.
Thanks for the bug report. I will send you a new version before I go to bed tonight, as I think I solved that issue. I also want to get the sprite routine, theta=9, functioning properly.

Here it is! Everything except 'G' works.
---------------------------------------------------------------------------------

Code:
Theta = 9 : Draw palletized sprite

 Inputs: Str9 = Sprite data as ASCII hex, one nibble per byte. The
        digits 1-F are valid colors (1=blue, 2=red, 3=black, etc), while
        G will cause the routine to skip to the next line.
        X,Y = Coordinates of top-left corner of sprite
        A = Sprite width (height gets computed)
 Output: Sprite written to both gbuf and LCD
        Previous contents of gbuf returned in Str9. Can be passed right back to this
        function to erase the sprite and restore the previous screen contents


Well, you've gotten the issue I mentioned fixed with no problem.

As to the sprite routine, it's not quite correct, and I'm not sure where the problem lays with that one. :/



And just for curiousity's sake, why not using a list like I did to store sprite size and coordinates? Harder to access user defined lists in asm?


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


Is the code with 'G' for the line dropping bit.


Code:
000000000000333000000000
000000000033399300000000
000000000388839930000000
000000003888883333000000
000000003888883998300000
000003339888888338300000
00033993988ABBB88B300000
0038399398ABB33A3B300000
0388839938ABB33A3B303330
3888839938AABBBABA338883
38883039938A3333A3038883
38883039993AAAAA39338883
033300389993333399988830
000330388899999399888300
003883388888893039883000
038888338899930003330000
388888933899993000000000
388388999339998300000000
033338993038888300000000
000003330038883330000000
000000000388888888300000
000000000333333333300000


Is with the 0's in place of the G's.


Code:
"00000000000033300000000000000000003339930000000000000000038883993000000000000000388888333300000000000000388888399830000000000333988888833830000000033993988ABBB88B3000000038399398ABB33A3B3000000388839938ABB33A3B3033303888839938AABBBABA33888338883039938A3333A303888338883039993AAAAA39338883033300389993333399988830000330388899999399888300003883388888893039883000038888338899930003330000388888933899993000000000388388999339998300000000033338993038888300000000000003330038883330000000000000000388888888300000000000000333333333300000"->Str9
9->theta
24->A:25->X:45->Y
Asm(prgmCELTIC2


Is the program that I have for it.

Thoughts?

Also, for 0, are you having it just skip that pixel, or are you having it turn off?
I actually was unable to replicate your issues. The final program you posted worked fine; the G version of course looks a mess. Was it with that final program that you got the glitches you mentioned?
No, I cleared out the G's to test with, since you said it didn't use those yet. :/ I'll try deleting the old, ram clear, etc and reinstall the thing, see if that fixes it.
tifreak8x wrote:
No, I cleared out the G's to test with, since you said it didn't use those yet. :/ I'll try deleting the old, ram clear, etc and reinstall the thing, see if that fixes it.
Thanks, I appreciate it. Smile In the meantime, I'll try to figure out the problems with the G-handling.

Edit: I think you might have been using too narrow of a sprite. Lines with G should never be your longest lines; otherwise the G is a waste. I tried it with width 26, and it worked fine.



Also, if other people want to join tifreak8x in testing, that would be awesome.
*bump* tifreak8x, I decided to compromise and give it an on-calculator name of "ZCLT2" for now. I have also given it a proper readme, so if you (tifreak8x) wouldn't mind doing some final testing and generating a final complete version of your demo/test program, I think this might be about ready to go out the door. I'll try to create a demo program for the sprite routine.
I can handle it all, hopefully over the course of the next few evenings. Smile I even have a few ideas for the sprite bit.

And the name sounds good. Just nice to have it at the end of the list, instead of near the top.
Awesome, that is greatly appreciated, as I'm devoting significant seconds and brain cycles to preparing for California. Smile Yeah, I agree that it works much better near the bottom, although it would work even better as a set of hooks from Doors CS. Wink
I created a test program (it needs tweaks, but for the moment, it should cover things) and it doesn't seem to be working properly? I sent it to you with my copy of ZCLT2, and I ask that you run it and see if it works for you, or if you get the same problem expressed in the email. Thanks!
When I run the program, it shows 1, 0, 0 lines, and it pauses HI. What is it supposed to do instead?
  
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 2 of 4
» 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