w1k Posted April 20, 2010 Share Posted April 20, 2010 hello, i have code which open and place text on screen: 10 OPEN #1,4,0,"D:filename.ext" 20 TRAP#ERR:CLS 30 DO 40 GET #1,BYTE:? CHR$(27);CHR$(BYTE); 50 LOOP 60 #ERR 70 CLOSE #1 how i can: 1. make menu selection, like: A....readme B....whats new etc.. if i press A, then readme.txt load.. 2. continual reading if screen is full of text, i can use GET KEY for next part, but how? Quote Link to comment Share on other sites More sharing options...
atarixle Posted April 20, 2010 Share Posted April 20, 2010 1. try this simple way of menu: 80 GET E:REM wait for key 90 IF E=ASC("A") THEN ... do something 100 IF E=ASC("B") THEN ... do something else ... ... and so on ... 2. you can watch the cursor-position by looking at memory-cell 85: IF PEEK(85)>22 THEN GET E:CLS:REM wait for key, if cursur in the line under line 22, then clear the screen this is a very easy way, it clears the screen and starts from the top of the screen again. Quote Link to comment Share on other sites More sharing options...
w1k Posted April 20, 2010 Author Share Posted April 20, 2010 (edited) ok, i have menu: how i put together with opening/reading txt files? Edited April 20, 2010 by w1k Quote Link to comment Share on other sites More sharing options...
atarixle Posted April 20, 2010 Share Posted April 20, 2010 just change the line-numbers of the text-reading-code below, and merge both to one program. e.g.: 170 IF E=ASC("B") THEN EXEC READ_TEXT 180 GOTO 70 500 PROC READ_TEXT 510 OPEN #1,4,0,"D:filename.ext" 520 TRAP 560:CLS 530 DO 540 GET #1,BYTE:? CHR$(27);CHR$(BYTE); 550 LOOP 560 REM 570 CLOSE #1 599 ENDPROC Quote Link to comment Share on other sites More sharing options...
w1k Posted April 20, 2010 Author Share Posted April 20, 2010 just change the line-numbers of the text-reading-code below, and merge both to one program. e.g.: 170 IF E=ASC("B") THEN EXEC READ_TEXT 180 GOTO 70 500 PROC READ_TEXT 510 OPEN #1,4,0,"D:filename.ext" 520 TRAP 560:CLS 530 DO 540 GET #1,BYTE:? CHR$(27);CHR$(BYTE); 550 LOOP 560 REM 570 CLOSE #1 599 ENDPROC ok, thank you, i try it.. and what can i do if i can read/view more files? A,B,C,D options? Quote Link to comment Share on other sites More sharing options...
w1k Posted April 20, 2010 Author Share Posted April 20, 2010 just change the line-numbers of the text-reading-code below, and merge both to one program. e.g.: 170 IF E=ASC("B") THEN EXEC READ_TEXT 180 GOTO 70 500 PROC READ_TEXT 510 OPEN #1,4,0,"D:filename.ext" 520 TRAP 560:CLS 530 DO 540 GET #1,BYTE:? CHR$(27);CHR$(BYTE); 550 LOOP 560 REM 570 CLOSE #1 599 ENDPROC ERROR- 129 IS OPEN AT LINE 510 The error I had previously Quote Link to comment Share on other sites More sharing options...
+bf2k+ Posted April 20, 2010 Share Posted April 20, 2010 just change the line-numbers of the text-reading-code below, and merge both to one program. e.g.: 170 IF E=ASC("B") THEN EXEC READ_TEXT 180 GOTO 70 500 PROC READ_TEXT 510 OPEN #1,4,0,"D:filename.ext" 520 TRAP 560:CLS 530 DO 540 GET #1,BYTE:? CHR$(27);CHR$(BYTE); 550 LOOP 560 REM 570 CLOSE #1 599 ENDPROC ERROR- 129 IS OPEN AT LINE 510 The error I had previously Tha's because channel #1 is opened in 2 different places - once to the K:eyboard and once to the D:filename.ext. Change one of the to channel #2 or make sure sure close the K: before opening the D:. Quote Link to comment Share on other sites More sharing options...
Roydea6 Posted April 20, 2010 Share Posted April 20, 2010 with TB the keyboard is open just use a GET K:PUT K. also OPEN #1 should usually be prefixed with CLOSE #1:OPEN #1 this prevent many of this type of ERR. Quote Link to comment Share on other sites More sharing options...
w1k Posted April 20, 2010 Author Share Posted April 20, 2010 (edited) so.. i must use GET K for keyboard? ok, i look to the literature.. ok, now its work fine, i have last questions. -what can i do with error- 136 ? end file EOF? -how work GET K? if i try i, program cycle.. -what about o long txt files? -and what about more txt files? A,B,C,D options..? thank you Edited April 20, 2010 by w1k Quote Link to comment Share on other sites More sharing options...
Roydea6 Posted April 20, 2010 Share Posted April 20, 2010 IF ERR=136:do what ever you want (i,e..) END RUN GOTO STOP :ENDIF this should be placed where your TRAP #ERR sends: 200 #ERR 210 IF ERR=136 also ERR is a reserved word with TB... Quote Link to comment Share on other sites More sharing options...
Roydea6 Posted April 20, 2010 Share Posted April 20, 2010 -how work GET K? if i try i, program cycle.. -what about o long txt files? -and what about more txt files? A,B,C,D options..? thank you 10 DIM A$(19) . . MENU . A . B . C . D . E . GET K . IF K=65:A$="D:A FILENAME.XXX":ENDIF . IF K=66:A$="D:B FILENAME.XXX":ENDIF . IF K=67:A$="D:C FILENAME.XXX":ENDIF . ETC..... GET just scans the keyboard key presses and returns the key pressed. Quote Link to comment Share on other sites More sharing options...
w1k Posted April 20, 2010 Author Share Posted April 20, 2010 (edited) ok, it's working now now i must fix that 136 error.. thank you for your patience Edited April 20, 2010 by w1k Quote Link to comment Share on other sites More sharing options...
Roydea6 Posted April 20, 2010 Share Posted April 20, 2010 what can be first? menu or loading/viewing files? i have first menu and then.. DIM $A(19) IF K=64:A$="FILE1.TXT":ENDIF IF K=65:A$="FILE1.TXT2":ENDIF OPEN #1,4,0,A$ DO GET #1,BYTE... CLOSE #1 ERROR -130 DIM $A(19) . . MENU . GET K IF K=64:A$="D:FILE1.TXT":ENDIF IF K=65:A$="D:FILE1.TXT2":ENDIF OPEN #1,4,0,A$ DO GET #1,BYTE... CLOSE #1 are you using SD 90k ATR or DD with 65535K ATR. sio2sd sio2pc Quote Link to comment Share on other sites More sharing options...
w1k Posted April 20, 2010 Author Share Posted April 20, 2010 i use 92kb atr file, sio2sd Quote Link to comment Share on other sites More sharing options...
+CharlieChaplin Posted April 20, 2010 Share Posted April 20, 2010 (edited) Well, I am always using the lamer way to write a basic menu: 10 CLR: GRAPHICS 18 (alternatively: ? CHR$(125) or ? "ESC, CTRL+CLR") 20 POSITION ...: ? #6;"(Menu name, e.g. Tetris Clones)" 30 POSITION ...: ? #6;"----------------------" 40 POSITION ...: ? #6;"A) tetris 1" 50 POSITION ...: ? #6;"B) tetris 2" 60 POSITION ...: ? #6;"C) tetris 3" 70 POSITION ...: ? #6;"D) tetris 4" 120 CLOSE #3:OPEN #3,4,0,"K:":GET #3,K 130 IF K=ASC("A") THEN RUN"D:TETRIS1.BAS" 140 IF K=ASC("B") THEN RUN"D:TETRIS2.BAS" 150 IF K=ASC("C") THEN RUN"D:TETRIS3.BAS" 160 IF K=ASC("D") THEN RUN"D:TETRIS4.BAS" This stupid menu works in TB XL as well as in Atari Basic and I can always modify it the way I wish (change menu name and/or program names). And err, I never need to remember or look-up the values for A, B, C, D,... in upper or lower case. Yes, stupid+lame menu, but works for me... -Andreas Koch. Edited April 20, 2010 by CharlieChaplin Quote Link to comment Share on other sites More sharing options...
+therealbountybob Posted April 21, 2010 Share Posted April 21, 2010 If you want a basic menu to modify you could take the one from the HSC Bonus Round's "Best of Basic" ATR (Link below) Quote Link to comment Share on other sites More sharing options...
w1k Posted April 21, 2010 Author Share Posted April 21, 2010 thank you, yesterday i finnished them.. next problem is viewing files (its working, but buggy) Quote Link to comment Share on other sites More sharing options...
pps Posted April 21, 2010 Share Posted April 21, 2010 thank you, yesterday i finnished them.. next problem is viewing files (its working, but buggy) Viewing files ... hmm First of all you need a textfile, then open it and get the bytes till you reach eof. The bytes you got, should be sent thru S: or E: (depending on the format - screen or atasci). That should be all. Quote Link to comment Share on other sites More sharing options...
w1k Posted April 21, 2010 Author Share Posted April 21, 2010 (edited) and what about a looong text? i need stop text if screen is full and if i press key, text will be continue.. loading txt files start at 5030 Edited April 21, 2010 by w1k Quote Link to comment Share on other sites More sharing options...
Roydea6 Posted April 21, 2010 Share Posted April 21, 2010 2. you can watch the cursor-position by looking at memory-cell 85: IF PEEK(85)>22 THEN GET E:CLS:REM wait for key, if cursur in the line under line 22, then clear the screen this is a very easy way, it clears the screen and starts from the top of the screen again. This is from Post #2 in this thread. Quote Link to comment Share on other sites More sharing options...
w1k Posted April 21, 2010 Author Share Posted April 21, 2010 (edited) 2. you can watch the cursor-position by looking at memory-cell 85: IF PEEK(85)>22 THEN GET E:CLS:REM wait for key, if cursur in the line under line 22, then clear the screen this is a very easy way, it clears the screen and starts from the top of the screen again. This is from Post #2 in this thread. it doesnt work.. i put it on line 5065.. ? peek(82) 0 Edited April 21, 2010 by w1k Quote Link to comment Share on other sites More sharing options...
Roydea6 Posted April 21, 2010 Share Posted April 21, 2010 Try this ATR: MdosTB2.atr This is a MyDos 90k atr. It boots to TB and opens FILE autorun.bas and then opens text files for viewing. Modify with your title and your text files, I put a few text files on the atr for TB instructions. This has full MyDOS so you can get back to the dos menu. Good Luck... Quote Link to comment Share on other sites More sharing options...
w1k Posted April 21, 2010 Author Share Posted April 21, 2010 (edited) woooww.. looks nice.. im go study it.. thank you -hmm.. maybe im stupid if i cant make something simply like this. fuuh.. it's to hard, im stupid.. so Edited April 21, 2010 by w1k Quote Link to comment Share on other sites More sharing options...
Roydea6 Posted April 21, 2010 Share Posted April 21, 2010 Hi w1k, Larger atr's are more fun for me to work with because of OPTION 'Q' make directory. You can put games in one FOLDER, basic files in another FOLDER, text files TEXT, etc.. I usually name FOLDERS with 4 characters (i.e) XXXX so they are easier to type and don't over flow the [PATH] if getting filename. The previous posts and the AUTORUN.BAS file is modified from the HSC Bonus Round's "Best of Basic" ATR and another code snippet I got here on AtariAge some time ago. Quote Link to comment Share on other sites More sharing options...
w1k Posted April 21, 2010 Author Share Posted April 21, 2010 something wrong? if pressed A- ERROR 135 RD ONLY at 5060 if pressed B- ERROR 136 EOF at 5060 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.