Log In  

I am trying to get this to work, and reading the P8SCII codes, it should work.

Unfortunately it does not.

cls(1)
print("\^!6000\*8192\0")
print("")

This should clear the screen to blank. Instead it misinterprets and only displays a few pixels at the top.

This method would be useful for instance to poke directly to memory while having the ability of repeating numbers in succession without having to type them all manually.

P#118453 2022-10-03 18:57 ( Edited 2022-10-04 13:29)

Try ~

print("\*9a") -- vs --
print("\*10b")

... The repeat control code can only accept one digit. So maximum in theory is 255 repeats: print("\*◝c")... but it seems the extra characters just overflow the line (the cursor isn't moved down).

P#118469 2022-10-03 22:47 ( Edited 2022-10-04 04:49)

Ah ! I had forgotten about that, @aced. That was a good observation.

And I posted my discovery you could have more than 9 by using characters past that only a week ago. Short term memory of mine. :)

Soo ... Let me try again.

cls(1)
print("\^!6000\*9\0")
print("")

Nope. Even with that single character of 9 it's still not getting the correct results.

P#118471 2022-10-03 23:09

I think the correct syntax is not object-repeat, it should be repeat-object: i.e. print("\*9\^!6000\0"). The P8 'print command' escape codes need to be at the start, otherwise it will break parsing of string literals; there is no way to know if \*9 is just data (as normal) or something special, unless the context (placed at start) marks it as special.
So then you are repeating writing to the same memory address x9.

I think you are requesting a new feature. I understand what you want to achieve but I'm not sure how it would work without breaking things, or at least being inconsistent with existing functions.

P#118500 2022-10-04 05:07 ( Edited 2022-10-04 11:51)
2

Morning, @aced:

I don't think it's going to break anything, unless someone is already using both \^! and \* in the same programming line - which currently does not work.

So, yep, @zep, I am requesting a new feature. To be able to use the repeat inside binary.

And no, the \* command would never be mistaken for any of the 256-bytes available to repeat. They are either a single character or a \ followed by a number. And it takes \\ to get a single \ It's a safe command.

I'll update the title to reflect this.

P#118514 2022-10-04 13:28

@dw817 note: you may replace \* with 1 char P8SCII equivalent ¹. This might have ambiguity in this context(?)...

Personally, I'd love the line overflow to wrap when repeating characters... but I can accept that's not consistent behaviour.

P#118522 2022-10-04 13:59

Oh no ... @aced is that right ? @zep actually allowed single 8-bit shortcut characters for P8SCII commands ?

Wow. Umm ... Not the first idea I would come up with ! Those should be independent of all 256-characters. :p

Sooo ... yeah maybe it can't be done since he did that. Of course he could say, you know what, that's not a great idea, and remove the shortcuts in favor of allowing any P8SCII codes anywhere at any time in a definition with unique handles for them ...

I guess I better reread P8SCII information and see that.

. . .

I'm not seeing it. I don't doubt you, just where is it printed the single-character equivalents ?

Here is my source:

https://www.lexaloffle.com/dl/docs/pico-8_manual.html#Appendix_A

P#118527 2022-10-04 15:21 ( Edited 2022-10-04 15:22)
1

@aced You can achieve the wrap effect by setting the RHS value to 32 (P8SCII "w")

print("\^rw\*らa")
P#118557 2022-10-04 22:46 ( Edited 2022-10-05 05:12)

Hi @ChristopherD:

Thanks for your interest !

What I specifically want though is it to work for print("\^!6000\*8192\0") is that. Which would clear the screen to black if I'm doing it right.

https://www.lexaloffle.com/dl/docs/pico-8_manual.html#Raw_memory_writes

So I can write a nice good image compressor and still release a single and small PRINT statement to doodle it all.

I'm understanding though that even if it worked (which it doesn't) the maximum # of characters I can repeat will be 255 as it looks at only 1 character for the length.

I don't know how many people are making use of \^! yet so ... I was hoping I could request some features for it before it becomes mainstream.

P#118565 2022-10-05 00:41 ( Edited 2022-10-05 00:43)
1

Yes, I understood what you want. I was specifically addressing aced's comment, but forgot to @ them.
Still, there is a print command for clearing the screen
print("\^c0")
and since you're trying to put those empty chars directly into video memory, maybe the net effect works out the same for your purposes? Or maybe not.

P#118583 2022-10-05 05:19

@ChristopherD - thanks! Will explore that :-)

P#118607 2022-10-05 11:47 ( Edited 2022-10-05 11:47)

Hi @ChristopherD.

No, it's not so much that I wanted to clear the screen as the potential to do so. Ulitimately I would make use of \* to repeat areas of redrawing a screen for logos and other.

To be able to have a compressed image in a single print statement.

Now I know I have written a picture compressor already.

https://www.lexaloffle.com/bbs/?tid=45335

Yet I haven't done one that generates a single PRINT statement.

P#118618 2022-10-05 15:15

Have you considered memset? far more simple and performant... string manipulation is particularly cumbersome in LUA (and print particularly is extremely slow, imagine printing enough to cover the full screen) Not seeing any practical usage at least as a partial screen cls

P#118629 2022-10-05 18:11

Actually, @slainte, print is extremely FAST to fill the screen with a custom picture. Check out this example:

https://www.lexaloffle.com/bbs/?pid=118178

P#118631 2022-10-05 18:28

Hey @dw817, What i mean is the following.

From the wiki:

print: cycle cost is 4+n*16
memset: cycle cost is 2(n+1)

It's slow if used along many other things, can be okish if your goal is serving a static image and just using it once... (no redraw). Your example... if you redraw every frame you eat up 12% CPU just on that and I'd consider that excessive in many scenarios...

It all depends on how you want to use the feature I guess

P#118632 2022-10-05 18:40 ( Edited 2022-10-05 18:41)

I will give something though @dw817, once encoded there is no token usage for decoding and it just damages compressed-size and char-limit.

P#118633 2022-10-05 18:45

Hi @slainte:

Mostly I wanted to create a compressor for yep, a single shot, show the picture. Now can you use characters such as a and b when poking with memset() ?

P#118637 2022-10-05 19:57

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2022-12-07 00:29:11 | 0.052s | Q:29