RXB Posted February 22, 2023 Share Posted February 22, 2023 Screwing around with RXB 2023 I made this: 100 CALL CLEAR 110 CALL SCREEN(12) 120 CALL COLOR(9,4,13) 130 CALL CHAR(96,"FFFEFCF8F0E0C080") 140 CALL CHAR(97,"0103070F1F3F7FFF") 160 CALL CHAR(98,"80C0E0F0F8FCFEFF") 165 CALL CHAR(99,"FF7F3F1F0F070301") 170 FOR C=1 TO 24 :: RV=INT(RND*4) :: S$=S$&CHR$(RV+96) :: NEXT C 180 PRINT CHR$(96+RV); 180 CALL SCROLLRIGHT(1,S$) 190 S$="" :: GOTO 170 Why can I not edit out the duplicate line 180? Quote Link to comment Share on other sites More sharing options...
Asmusr Posted February 22, 2023 Share Posted February 22, 2023 Is B=B=0 more efficient than B=NOT B ? 1 Quote Link to comment Share on other sites More sharing options...
+OLD CS1 Posted February 22, 2023 Share Posted February 22, 2023 1 hour ago, senior_falcon said: Yes, and if you made it 28 and added the one extra B=(B=0) it would probably work. Not gonna argue against that, as it is correct. If not being redundant is not the goal, then definitely. 1 hour ago, Asmusr said: Is B=B=0 more efficient than B=NOT B ? That would work, since that would also alternate between 0 and -1. B=NOT B executes 10,000 iterations in 71 seconds, while B=B=0 executes 10,000 iterations in 83 seconds. Bit-wise operator FTW! Quote Link to comment Share on other sites More sharing options...
jrhodes Posted February 22, 2023 Share Posted February 22, 2023 1 hour ago, Asmusr said: ... B=NOT B ? The B=B=0 confused me too, to be honest. Makes sense now. Quote Link to comment Share on other sites More sharing options...
RXB Posted February 22, 2023 Share Posted February 22, 2023 2 hours ago, Asmusr said: Is B=B=0 more efficient than B=NOT B ? I ran a test loop on Classic99 to test this: 100 CALL CLEAR 110 OPEN #1:"CLOCK" 120 INPUT #1:A$,B$,C$ 130 FOR C=1 TO 10000 140 B=B=0 or 140 B=NOT B 150 NEXT C 160 INPUT #1:D$,E$,F$ 170 PRINT A$,D$:B$,E$,C$,F$ 180 END Times are: B=B=0 is 1 minute 35 seconds B=NOT B is 1 minute 23 seconds so this one is faster. I can tell you the reason why is each = sign has to evaluate the previous one's value, so the NOT only requires one evaluation not two. It does not slow down assembly in ROM that much but over a loop of 10,000 it does show up. Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted February 22, 2023 Share Posted February 22, 2023 59 minutes ago, jrhodes said: The B=B=0 confused me too, to be honest. Makes sense now. I think most of us are used to initializing multiple variables in most high-level programming languages using a construct like A=B=C=0 ; <---initialize A,B,C to 0 where the relational operator is entirely different (often ‘==’), but TI chose to do that in XB as A,B,C=0 ! <----initialize A,B,C to 0 in TI XB to insure it was different from using a second ‘=’ as a relational operator, which is, of course, the same symbol(!?). ...lee 5 Quote Link to comment Share on other sites More sharing options...
+TheBF Posted February 23, 2023 Share Posted February 23, 2023 2 hours ago, Lee Stewart said: I think most of us are used to initializing multiple variables in most high-level programming languages using a construct like A=B=C=0 ; <---initialize A,B,C to 0 where the relational operator is entirely different (often ‘==’), but TI chose to do that in XB as A,B,C=0 ! <----initialize A,B,C to 0 in TI XB to insure it was different from using a second ‘=’ as a relational operator, which is, of course, the same symbol(!?). ...lee I don't think I ever knew BASIC could do that. Thanks Lee. 2 Quote Link to comment Share on other sites More sharing options...
Retrospect Posted February 23, 2023 Share Posted February 23, 2023 5 minutes ago, TheBF said: I don't think I ever knew BASIC could do that. Thanks Lee. Neither did I. Thanks Lee! 1 Quote Link to comment Share on other sites More sharing options...
senior_falcon Posted February 23, 2023 Share Posted February 23, 2023 (edited) It is just as fast to use HCHAR as using PRINT and you can get all 32 columns. Unfortunately you have to start at row 23 because PRINT blanks the last line 10 CALL CLEAR :: RANDOMIZE :: CALL SCREEN(10):: CALL COLOR(1,7,10,2,9,10) 20 CALL CHAR(33,"FF7F3F1F0F07030180C0E0F0F8FCFEFF",40,"FFFEFCF8F0E0C0800103070F1F3F7FFF") 30 FOR I=1 TO 32 :: B=(B=0):: CALL HCHAR(23,I,34+INT(RND*2)*7+B):: NEXT I :: B=B=0 :: PRINT :: GOTO 30 The above can be compiled, but the scrolling seems too fast to me. This looks much better compiled: 10 CALL CLEAR :: RANDOMIZE :: CALL SCREEN(10):: CALL COLOR(1,7,10,2,9,10) 20 CALL CHAR(33,"FF7F3F1F0F07030180C0E0F0F8FCFEFF",40,"FFFEFCF8F0E0C0800103070F1F3F7FFF") 30 FOR R=1 TO 24 :: FOR I=1 TO 32 :: B=(B=0):: CALL HCHAR(R,I,34+INT(RND*2)*7+B):: NEXT I :: B=B=0 :: NEXT R :: GOTO 30 Edited February 23, 2023 by senior_falcon 8 Quote Link to comment Share on other sites More sharing options...
RXB Posted February 23, 2023 Share Posted February 23, 2023 RXB 2023 just messing around: Classic99.AVI Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted February 23, 2023 Author Share Posted February 23, 2023 14 hours ago, RXB said: Screwing around with RXB 2023 I made this: 100 CALL CLEAR 110 CALL SCREEN(12) 120 CALL COLOR(9,4,13) 130 CALL CHAR(96,"FFFEFCF8F0E0C080") 140 CALL CHAR(97,"0103070F1F3F7FFF") 160 CALL CHAR(98,"80C0E0F0F8FCFEFF") 165 CALL CHAR(99,"FF7F3F1F0F070301") 170 FOR C=1 TO 24 :: RV=INT(RND*4) :: S$=S$&CHR$(RV+96) :: NEXT C 180 PRINT CHR$(96+RV); 180 CALL SCROLLRIGHT(1,S$) 190 S$="" :: GOTO 170 Why can I not edit out the duplicate line 180? Very cool doing it sideways! The pattern however doesn't look quite right and I suspect that's because you're not using 2 shades of green for the characters. Unless of course you're not going for the original pattern. Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted February 23, 2023 Author Share Posted February 23, 2023 9 hours ago, senior_falcon said: 10 CALL CLEAR :: RANDOMIZE :: CALL SCREEN(10):: CALL COLOR(1,7,10,2,9,10) 20 CALL CHAR(33,"FF7F3F1F0F07030180C0E0F0F8FCFEFF",40,"FFFEFCF8F0E0C0800103070F1F3F7FFF") 30 FOR R=1 TO 24 :: FOR I=1 TO 32 :: B=(B=0):: CALL HCHAR(R,I,34+INT(RND*2)*7+B):: NEXT I :: B=B=0 :: NEXT R :: GOTO 30 I did not think HCHAR would be as fast as print... I have to say though that while compilation is impressively fast, there is definitely a certain charm to seeing the pattern slowly building on the screen. It's probably just me 😁 Why are you using the parentheses with the first B=B=0? 1 Quote Link to comment Share on other sites More sharing options...
senior_falcon Posted February 23, 2023 Share Posted February 23, 2023 1 hour ago, Vorticon said: Why are you using the parentheses with the first B=B=0? Three reasons: 1 - I used to think it was necessary. I used that a lot in TI BASIC for lines like this: 10 IF (X=7)*(Y=3) THEN 200. Here the parentheses are necessary, and I thought they always were. 2 - I'm a little hard of thinking, and this keeps me from getting confused. When I see B=(B=0) I understand what is happening. 3 - I thought the compiler needed it. Evidently not, because I forgot to put them in the second B=B=0 and that still works properly. (If I intended to compile the code, I would still use the parentheses just to be sure) 2 Quote Link to comment Share on other sites More sharing options...
RXB Posted February 23, 2023 Share Posted February 23, 2023 Just looking at Classic99 Debugger memory for these I get: B=NOT B >00 0A FF 00 0A FF E3 05 42 BE BD 42 00 B = NOT B Token B=B=0 >00 0A FF E0 08 42 BE 42 BE C8 01 30 00 B = B = Numeric Length 0 Token The B=B=0 has more tokens to be processed by the XB interpreter but does not slow down processing much. 2 Quote Link to comment Share on other sites More sharing options...
whoami999ster Posted March 11, 2023 Share Posted March 11, 2023 On 2/22/2023 at 11:27 PM, jrhodes said: The B=B=0 confused me too, to be honest. Makes sense now. just to be precide the formula is : B+NOT2B 1 3 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.