Jump to content
IGNORED

A fun little (not too laborious to type) CC-40 "screensaver" demo


Recommended Posts

Here's a CC-40 demo I put together today, which isn't too much trouble to type in if you have to (only 19 lines, now), but has a pleasant result.  Could be something to leave running on a display or demonstration unit. 

 

Note: If you should ever wish this demo (or any other) to run persistently for an arbitrarily long period (i.e., until manually interrupted) execute the command CALL POKE(2096,1) before running (or add it to the program), as this will disable auto-power-off until system restart. 

 

Demonstration Clip:

 

 

30 S$=RPT$(CHR$(32),11)
40 FOR X=1 TO 7
50 T$=T$&CHR$(VAL(SEG$("4001234",X,1)))
60 NEXT X
70 CALL CHAR(0,"0E1F1B181B1F0E") !C
80 CALL CHAR(1,"00000E1F0E")     !DASH
90 CALL CHAR(2,"1B1B1B1F1F0303") !4
100 CALL CHAR(3,"0E1F1B1B1B1F0E") !0
120 CALL CHAR(5,"03060E1B0E0603") !LEFT
130 CALL CHAR(6,"180C0E1B0E0C18") !RIGHT
150 FOR D=1 TO 2
160 FOR P=1 TO 12
170 L=ABS(P-13*(D-1))
175 CALL CHAR(4,SEG$("040A1B0A15000A15040A1B0A15",(D-1)*16+1,16))
180 DISPLAY AT(1),SEG$(S$&CHR$(D+4)&S$,L,12)&T$&SEG$(S$&CHR$(7-D)&S$,13-L,12)
190 NEXT P
200 NEXT D
210 GOTO 150

 

Edit: Version 5, I think?  I keep on tweaking this. Yeesh.

 

  • Like 10
Link to comment
Share on other sites

Finally, I couldn't help but look at this and see it as a "Ten Liner Competition" sort of program, so I crammed it into nine lines in this version, instead:

 

10 S$=RPT$(CHR$(32),11)
20 FOR X=1 TO 7:T$=T$&CHR$(VAL(SEG$("4001234",X,1))):NEXT X
30 CALL CHAR(0,"0E1F1B181B1F0E0000000E1F0E")
40 CALL CHAR(2,"1B1B1B1F1F0303000E1F1B1B1B1F0E")
50 CALL CHAR(5,"03060E1B0E060300180C0E1B0E0C18")
60 FOR D=1 TO 2:FOR L=1-(D=2)*11 TO 1-(D=1)*11 STEP (D=2)*2+1
70 CALL CHAR(4,SEG$("040A1B0A15000A15040A1B0A15",(D-1)*16+1,16)
80 DISPLAY AT(1),SEG$(S$&CHR$(D+4)&S$,L,12)&T$&SEG$(S$&CHR$(7-D)&S$,13-L,12)
90 NEXT P:NEXT D:GOTO 60

 

Seems like the CC-40 is the perfect "10 liner" type platform.  Since typing long programs is pretty rough.  But at the same time, as sold, entering and running BASIC programs is what the machine is for. 

 

  • Like 2
Link to comment
Share on other sites

And here is another completely different one I just cooked up, but one I think I like a bit better, as it is a "natural" 10-liner.  That is to say, no multi-statement lines.  Just some very space-economic string/pattern manipulation.

 

Stare directly into the CC-40 screen with this one, and you eventually start to see the Matrix.  Or just the dot matrix.  Possibly both?

 

10 FOR C=0 TO 6
20 CALL CHAR(C,RPT$("1F",C)&"0E04")
30 NEXT C
40 FOR C=6 TO -5 STEP -1
50 F$=F$&CHR$(ABS(C))
60 NEXT C
70 FOR P=1 TO 12
80 DISPLAY AT(1),SEG$(RPT$(F$,4),P,31)
90 NEXT P
100 GOTO 70

 

  • Like 7
Link to comment
Share on other sites

One thing I find compelling about the CC-40's performance characteristics, vis-a-vis those of TI-99 BASIC, is that its much faster string operations mean that manipulating/generating/selecting character patterns in their hexadecimal string format is a more credible possibility.  So for example, in the second program, all the 7 character patterns are generated via the value RPT$("1F",C)&"0E04".  And in the first program, character 4 is animated using the value SEG$("040A1B0A15000A15040A1B0A15",(D-1)*16+1,16)

 

Given you only have those 7 custom patterns, manipulating/generating character patterns on the fly makes a good deal of sense.  Since you can't just write a big pile of patterns all at once and be done with it.  And a lot of graphical updates or animations are going to have to be done with CALL CHAR, during program execution.  But happily, the machine performs well enough in these regards to accommodate this. 

  • Like 3
Link to comment
Share on other sites

Certainly, the presence of CALL CHAR and custom character patterns makes all the difference in the world, as far as allowing developing for the device to be interesting in its own right (rather than just functional as a destination for ports of traditional text-based games). 

 

Plus, on top of the 31 character screen, you've got the six indicator arrows along the bottom of the display which can be toggled on and off.  And as well, the various status indicators (like "Rad") to do with as you will. 

 

Finally, you've got the beeper, if you want to use that. 

 

So there's a fair amount to work with there that isn't just an alphanumeric display. 

  • Like 8
Link to comment
Share on other sites

  • 1 month later...

For some reason I decided this week I felt like doing another strict "10 Liner" demo for CC-40 which does something visually interesting.  With a technical constraint inherently imposed by the device being 80 character line length (or it would not be possible to type it, on original hardware).  And a further constraint imposed by the strict 10 liner format being that the program must contain only 10 discrete statements (with no statement separators). 

 

Anyway, here's something I came up with, which runs an indefinite back and forth animation of sorts.

 

The speed of the animation can be moderated in either direction by adding or removing -TAN(0) expressions on Line 8 (which exist only to impose a delay there). 

 

 

1 DIM S$(2)
2 C$="EE4E4E0EAAE0EEE4E4EE4EEE0EAAE0EEE4EE0E0E0E0EAAE0E0E0E0"
3 FOR C=0 TO 5
4 CALL CHAR(C,"15000"&SEG$(C$,C*9+1,9)&"15")
5 NEXT C
6 S$(0)=RPT$(CHR$(4)&CHR$(5),14)&CHR$(0)&CHR$(2)&RPT$(CHR$(4)&CHR$(5),14)
7 S$(1)=RPT$(CHR$(5)&CHR$(4),14)&CHR$(1)&CHR$(3)&RPT$(CHR$(5)&CHR$(4),14)
8 Q=-(Q<=0)-Q-(Q=56)*54-TAN(0)-TAN(0)-TAN(0)-TAN(0)-TAN(0)
9 PRINT CHR$(127)&SEG$(S$(-(Q<0)),ABS(Q)+(ABS(Q)>29)*(ABS(Q)-29)*2,29)&CHR$(126)
10 GOTO 8

 

 

  • Like 3
Link to comment
Share on other sites

And another 10 line variation on this one.  The arithmetic underlying this loop structure is so deeply tortured.  I'm quite fond of it.

 

 

 

 

 

1 C$="0E040404000E04040E001F111B1B1F1F111B111F1B150E151B041104110404061F0604"
2 FOR C=0 TO 28
3 IF C<7 THEN CALL CHAR(C,"1500"&SEG$(C$,C*10+1,10)&"15")
4 NEXT C
5 Q=-(Q<=0)-Q-(Q=56)*54
6 CALL CHAR(6,SEG$("1500040C1F0C0415150004061F060415",1-(ABS(Q)>C)*16,16))
7 S$=CHR$(5)&CHR$(5)&CHR$((Q<0)*-2)&CHR$((Q<0)*-2+1)&CHR$(5)
8 S$=RPT$(CHR$(5)&CHR$(4),13)&S$&RPT$(CHR$(5)&CHR$(4),13)
9 PRINT CHR$(6)&SEG$(S$,ABS(Q)+(ABS(Q)>C)*(ABS(Q)-C)*2,C)&CHR$(6)
10 GOTO 5

 

  • Like 4
Link to comment
Share on other sites

1 minute ago, Vorticon said:

@pixelpedant Are you using MAME to simulate the CC40?

 

Yup, as can be seen by the pictures in this thread, I'd just been using my CC-40 for the first couple mini-programs here, but I switched to MAME this weekend, after writing up a macro to facilitate automated code entry made that more practical. 

  • Like 4
Link to comment
Share on other sites

It's definitely great to have the MAME implementation, especially for the folks out there without a fully functioning CC-40.  But even with a full functioning CC-40 and HexTIr on my desk, it's proving very handy for quick tests. 

 

The only issue I have with that option at present is a relatively minor graphical one which can probably be resolved by tweaking MAME's screen filtering on my end.  Which is that the dot matrix is much more defined for me on the real CC-40, with dots having relatively well-defined edges, and there being space intervening between dots, so visually, the effect is quite different.  I'll probably have to look into MAME's screen filtering settings, accordingly, to see if something a bit more representative can be achieved.

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...