Ranger03 #1 Posted September 5, 2018 If then is not working correctly, usually, a simple if then loop works perfectly but here, then is highlighted. example: dim a$(5):if a$="a" then goto 20 the other issue is the lack of an inkey$ command, what can other commands can i use (my memory is not that great so poking 24/7 is out of the question) Quote Share this post Link to post Share on other sites
Frankie #2 Posted September 5, 2018 In your example you can remove goto; 10 if x=5 then 30 20 goto 100 Quote Share this post Link to post Share on other sites
Frankie #3 Posted September 5, 2018 As for inkey$ - A quick google search As mentioned earlier, the version of BASIC for Atari's eight-bit computers has no built-in statement designed specifically to retrieve a single keypress. However, you can achieve the same effect by first opening a channel to the keyboard device with the statement OPEN #1, 4, 0, "K:", then using GET#1 to retrieve character values. (Any unused file number in the range 17 can be substituted for the 1 in these statements). The main difference between the Atari's GET#, and the INPUT$ and GET commands described above, is that GET# returns character code values rather than string characters, so GET# must always be followed by a numeric variable. If characters are desired, the CHR$ function can be used. Also, note that GET# waits for a key to be pressed. To modify the first example program segment in this article for eight-bit Ataris, you must first add lines to open the channel for input and set up the testing variable: 100 OPEN #1, 4, 0, "K" 110 DIM K$(1) This needs to be done only once in the program, but it must be done before the first GET# command. Then replace line 210 with: 210 GET #1, K : K$ = CHR$(K) You may find it easier to simply check for character code values rather than characters. Refer to your BASIC manual for a complete list of Atari ASCII codes. For example, you could test for a RETURN keypress with 300 PRINT "PRESS RETURN TO CONTINUE." 310 GET#1, R:IF R< >155 THEN 310 Quote Share this post Link to post Share on other sites
russg #4 Posted September 5, 2018 (edited) As for inkey$ - A quick google search As mentioned earlier, the version of BASIC for Atari's eight-bit computers has no built-in statement designed specifically to retrieve a single keypress. However, you can achieve the same effect by first opening a channel to the keyboard device with the statement OPEN #1, 4, 0, "K:", then using GET#1 to retrieve character values. (Any unused file number in the range 17 can be substituted for the 1 in these statements). The main difference between the Atari's GET#, and the INPUT$ and GET commands described above, is that GET# returns character code values rather than string characters, so GET# must always be followed by a numeric variable. If characters are desired, the CHR$ function can be used. Also, note that GET# waits for a key to be pressed. To modify the first example program segment in this article for eight-bit Ataris, you must first add lines to open the channel for input and set up the testing variable: 100 OPEN #1, 4, 0, "K" 110 DIM K$(1) This needs to be done only once in the program, but it must be done before the first GET# command. Then replace line 210 with: 210 GET #1, K : K$ = CHR$(K) You may find it easier to simply check for character code values rather than characters. Refer to your BASIC manual for a complete list of Atari ASCII codes. For example, you could test for a RETURN keypress with 300 PRINT "PRESS RETURN TO CONTINUE." 310 GET#1, R:IF R< >155 THEN 310 line 100 needs a colon in the quotes OPEN #1,4,0,"K:" devices for OPEN are: C: recorder D(n): disk drive E: screen editor K: key press P: printer R(n): serial port S: screen (how?) you can only output to the screen I think E: and K: do the same thing. no E: can only 8, output, 12 keyboard input & screen output 13 screen input & output (from Poole and McNiff 'Your Atari Computer" You had it in the paragraph correct. I think, don't use "E:" Edited September 5, 2018 by russg 1 Quote Share this post Link to post Share on other sites
Keneg #5 Posted September 5, 2018 If then is not working correctly, usually, a simple if then loop works perfectly but here, then is highlighted. example: dim a$(5):if a$="a" then goto 20 the other issue is the lack of an inkey$ command, what can other commands can i use (my memory is not that great so poking 24/7 is out of the question) You need a line number. You cannot go to a line number in immediate mode. I tested on my 130XE and it works fine in a program. 2 Quote Share this post Link to post Share on other sites
Kyle22 #6 Posted September 5, 2018 If you just want to read a keypress, do poke 764,255, c=peek(764): if c=(desired key code) then goto whatever.:poke 764,255 to reset it again easiest way. Poke it with 255 first to clear it, read it, then poke it back to $FF to clear it again after you're done with it. 2 Quote Share this post Link to post Share on other sites
Ranger03 #7 Posted September 5, 2018 If you just want to read a keypress, do poke 764,255, c=peek(764): if c=(desired key code) then goto whatever.:poke 764,255 to reset it again easiest way. Poke it with 255 first to clear it, read it, then poke it back to $FF to clear it again after you're done with it. so if i was to make a text adventure, i would need to poke the same address everytime i wanted input? Quote Share this post Link to post Share on other sites
+Nezgar #8 Posted September 5, 2018 so if i was to make a text adventure, i would need to poke the same address everytime i wanted input? If you wanted to input lines of text for a text adventure, followed by a carriage return, you can skip the OPEN E:/K: etc, and just simply use INPUT command, DIM'd appropriately of course (intentionally small here for demonstration...) 10 DIM INPUT$(10) 20 INPUT INPUT$ 30 PRINT INPUT$ RUN ?THE QUICK BROWN FOX THE QUICK Another neat trick to ditch the "?" at each input is to use IOCB #16, which BASIC treats as #0, described here: http://www.page6.org/archive/issue_32/page_12.htm 10 DIM INPUT$(10) 20 INPUT #16,INPUT$ 30 PRINT INPUT$ RUN THIS IS A TEST THIS IS A ... and make your own prompt: 10 DIM INPUT$(10) 20 ? "COMMAND-->";:INPUT #16,INPUT$ 30 PRINT INPUT$ READY RUN COMMAND-->THE QUICK BROWN FOX THE QUICK 1 Quote Share this post Link to post Share on other sites
Ranger03 #9 Posted September 5, 2018 flipping through compute's first book of Atari Graphics. just...wow really good stuff 1 Quote Share this post Link to post Share on other sites
+Larry #10 Posted September 5, 2018 You need a line number. You cannot go to a line number in immediate mode. I tested on my 130XE and it works fine in a program. Rats! Your beat me to it. I spotted that right off, but still fired up my XL to make sure. -Larry Quote Share this post Link to post Share on other sites