seanlanefuller Posted June 17, 2015 Share Posted June 17, 2015 I have a simple setup with a TI-99/4a and regular basic, no disk, no expanded memory, and save programs out the cassette port to another computer running sound recorder. I was trying to print a string at a location on the screen. A lot of BASIC interpreters have a print at command. I couldn't find one on the TI, so what I did was load a string variable, and an x and y, then call a subroutine that chops up the string and writes to the screen using a call hchar. Is there an easier way to do this? Quote Link to comment Share on other sites More sharing options...
seanlanefuller Posted June 17, 2015 Author Share Posted June 17, 2015 BTW, it is something like: 10 a$="Hello, World!" 20 l=14 30 x=10 40 y=10 50 gosub 1000 100 goto 100 1000 for i=1 to l 1010 call hchar(y,x,asc(seg$(a$,i,1))) 1020 next i 1030 return Quote Link to comment Share on other sites More sharing options...
Omega-TI Posted June 17, 2015 Share Posted June 17, 2015 BTW, it is something like: 10 a$="Hello, World!" 20 l=14 30 x=10 40 y=10 50 gosub 1000 100 goto 100 1000 for i=1 to l 1010 call hchar(y,x,asc(seg$(a$,i,1))) 1020 next i 1030 return I'd add... 05 CALL CLEAR 1011 X=X+1 1012 IF X=23 THEN 1040 ELSE 1020 1040 END As for doing it any better... beats me! Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted June 17, 2015 Share Posted June 17, 2015 (edited) I was trying to print a string at a location on the screen. A lot of BASIC interpreters have a print at command. I couldn't find one on the TI, so what I did was load a string variable, and an x and y, then call a subroutine that chops up the string and writes to the screen using a call hchar. Is there an easier way to do this?[/size] There's a few tricks in certain situations, but otherwise I think, no. That's the way it's been done in many TI Basic programs. One trick when setting a score to it's initial value of 00000 is of course to use HCHAR and have the character 0 repeat within that one statement. Saving perhaps one second. Another trick. If you have a screen full of info you want to print instantly instead of rolling up, you could set the background color to black, having all characters with the default color of black on transparent, PRINT what you want, and let it scroll up. Then turn on a background color (anything but black (or transparent)) - a screen full of text in a flash. Also noting that the length of your message is 13 and not 14. One way to get the length of the string is like, 20 l=len(a$) One funny thing I ran into just now ... I took your program with the changes suggested by Omega. However, try this 20 L=56 1001 PRINT I I've capitalized, not to confuse with any other characters. Now if I run it, it seems to break out with no warning or nothing ?!??! Edited June 17, 2015 by sometimes99er Quote Link to comment Share on other sites More sharing options...
Willsy Posted June 17, 2015 Share Posted June 17, 2015 Er, yes... WTF??! Quote Link to comment Share on other sites More sharing options...
+OLD CS1 Posted June 17, 2015 Share Posted June 17, 2015 The answer to "WTF?" lies in line 1012. 1 Quote Link to comment Share on other sites More sharing options...
Tursi Posted June 17, 2015 Share Posted June 17, 2015 The screen is 32 characters wide Quote Link to comment Share on other sites More sharing options...
Omega-TI Posted June 17, 2015 Share Posted June 17, 2015 Interesting... sometimes99er's change to line 20 eliminates the need for 1012. At this point I would change line 100 to read 100 END then get rid of 1040 as it now seems to act as originally intended. Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted June 17, 2015 Share Posted June 17, 2015 The answer to "WTF?" lies in line 1012. Oh yeah, that's probably it. Bummer. Quote Link to comment Share on other sites More sharing options...
seanlanefuller Posted June 18, 2015 Author Share Posted June 18, 2015 Thanks everybody! It is weird to me just how slow and limited TI basic seems. That is one of the things that is cool about it I think. That was a cool animated screen capture River Patroller. How did you do that? I did use the L=LEN(A$) in the real program and it works great. I love the feeling of the program model in my head that working on the TI forces. I get a stronger feeling of this when I try to write code for the Tandy PC-1, PC-3, and PC-8 I have. It reminds me of my early days in college writing code using a DECWriter printing terminal. The pocket computers only show 1 line at a time. I feel like it makes me think harder. Like when I take a Google it break and make myself remember something rather than Googling it. Also, River, the idea of printing black on black and then switching the color map sounds pretty cool. I'm going to try that one out. I love learning cool tricks like that. Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted June 18, 2015 Share Posted June 18, 2015 It is weird to me just how slow and limited TI basic seems. Yep, many benchmarks back then (1983) puts the TI-99/4A Basic in the very slow end. Graphics and sounds (1979) seems a bit more accessible or nicely wrapped for the beginner. One have to remember that the TI is actually a 1979 machine, but often people compare it with the C64 (1982), Spectrum (1982), MSX (1983) etc. However the TI caught on in 1983, when it became cheaper (and unprofitable) and then soon abandoned (by TI). I guess the competition was real. Was it head-to-head with Vic-20 in the states, and more Spectrum (the cheaper solution) and C64 in Europe ? The bare console (TI), compared to most computers of the day (1983), did not have ability to peek, poke and run machine code. Sure you could fork out and spend money, but only relatively few bought the Mini Memory Module, or the E/A (Editor/Assembler cartridge) and started populating the Sherman tank (Peripheral Expansion Box). I guess quite a few would-be geeks saved money for something else. I had a few other machines and others I dreamt about. In the end, the TI-99/4A was kind of cool, different and in some ways first love, - to me Mini Memory saved it for a while. That was a cool animated screen capture River Patroller. How did you do that? "River Patroller" is a AtariAge generated "member title" that seems to be randomly attached when signing up. Your title is Space Invader. I used the Classic99 emulator. Code copied and pasted. Camtasia Studio for screen capture/recording and producing animation in the GIF format. It reminds me of my early days in college writing code using a DECWriter printing terminal. Isn't that also machine from the seventies ? Quote Link to comment Share on other sites More sharing options...
+OLD CS1 Posted June 18, 2015 Share Posted June 18, 2015 Those are our ranks based upon number of posts. The ranking pips under our names used to have definitions, but those stopped working about the time the custom message indicators disappeared from next to threads in the list. Quote Link to comment Share on other sites More sharing options...
Willsy Posted June 18, 2015 Share Posted June 18, 2015 (edited) I'd add... 05 CALL CLEAR 1011 X=X+1 1012 IF X=23 THEN 1040 ELSE 1020 1040 END As for doing it any better... beats me! Slightly shorter (doesn't need the X=X+1): 1000 FOR I=1 TO LEN(A$) 1010 CALL HCHAR(Y,X+I-1,ASC(SEG$(A$,I,1))) 1020 NEXT I 1030 RETURN Call like this: 10 A$="Hello world!" 20 Y=10 30 X=10 40 GOSUB 1000 50 END Edited June 18, 2015 by Willsy Quote Link to comment Share on other sites More sharing options...
unhuman Posted June 18, 2015 Share Posted June 18, 2015 (edited) Crap that won't work. Deleted. Hopefully nobody saw my mistake. Stupid BASE 1. Slightly shorter (doesn't need the X=X+1): 1000 FOR I=1 TO LEN(A$) 1010 CALL HCHAR(Y,X+I-1,ASC(SEG$(A$,I,1))) 1020 NEXT I 1030 RETURN Call like this: 10 A$="Hello world!" 20 Y=10 30 X=10 40 GOSUB 1000 50 END Edited June 18, 2015 by unhuman 1 Quote Link to comment Share on other sites More sharing options...
Omega-TI Posted June 18, 2015 Share Posted June 18, 2015 I like it! Nice and tight. 1 Quote Link to comment Share on other sites More sharing options...
+OLD CS1 Posted June 18, 2015 Share Posted June 18, 2015 I usually use FOR I=0 TO LEN(A$)-1 then CALL HCHAR(X+I,Y,blah blah 1 Quote Link to comment Share on other sites More sharing options...
Willsy Posted June 19, 2015 Share Posted June 19, 2015 I usually use FOR I=0 TO LEN(A$)-1 then CALL HCHAR(X+I,Y,blah blah Six and two threes... You'd need to add 1 to x in the SEG$ statement Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted June 19, 2015 Share Posted June 19, 2015 I usually use FOR I=0 TO LEN(A$)-1 then CALL HCHAR(X+I,Y,blah blah Six and two threes... You'd need to add 1 to X in the SEG$ statement ... to I in the SEG$ statement. ...lee Quote Link to comment Share on other sites More sharing options...
+OLD CS1 Posted June 19, 2015 Share Posted June 19, 2015 Six and two threes... You'd need to add 1 to x in the SEG$ statement It is true -- somewhere there is a calculation which happens every iteration. I have to pull up one of my later programs. I think I finally settled on just requiring X to be base-0 before GOSUBing. But in any case, some variation of the tried-and-true method for TI BASIC. Until I got my MiniMemory and TI so graciously supplied a routine for that. 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.