Jump to content
IGNORED

Programming Turbo Basic


paladina

Recommended Posts

Question about uploading parts in Turbo Basic.

Ok If I have body of program

 

File1

10 REM WORLD

20 ?"HELLO WORLD"

30 ENTER"D:File2"

40 GOOTO 20

 

File2

20 ?"HELLO ATARI"

25 ?"I GOT IT"

 

I need to upload others file, but after command Enter its over my program... how it do to auto continue?

 

thx.

Link to comment
Share on other sites

Question about uploading parts in Turbo Basic.

Ok If I have body of program

 

File1

10 REM WORLD

20 ?"HELLO WORLD"

30 ENTER"D:File2"

40 GOOTO 20

 

File2

20 ?"HELLO ATARI"

25 ?"I GOT IT"

 

I need to upload others file, but after command Enter its over my program... how it do to auto continue?

 

thx.

 

For File2 use this:

 

SAVE"D:FILE2.TBA"

 

Within File1:

 

30 RUN "D:FILE2.TBA"

 

You even could load and start COM files with BRUN "D:File.COM"

Edited by pps
Link to comment
Share on other sites

Probably easiest to define some data storage (srings?) and read the data in to the string, with the same language part in the same order in each data set, with some sort of index.

 

So, for example, if there are four lines of text you need to read in:

 

10 DIM TXT$(160): REM ASSUME FOUR LINES OF 40 CHARS EACH, MAXIMUM

20 DIM LNST(4): REM LINE START OF EACH OF THE FOUR LINES

30 OPEN #1,4,0,"D:TEXTFILE.LNG": REM CHANGE FOR EACH LANGUAGE; TO GET FANCY, USE A STRING AND CHANGE IT DEPENDING ON THE LANGAUGE

40 INPUT #1,TXT$: REM ASSUMES NO CR (ASCII 155) IN THE STRING

50 FOR I=0 TO 4

60 GET #1,OFFSET

70 LNST(I)=OFFSET

80 NEXT I

 

Then, to print each line, assuming the line you want to print is LINENO

 

? TXT$(LNST(LINENO),LNST(LINENO+1)-1)

Link to comment
Share on other sites

Hm,some mist beacuse its dont work :(

 

program D.DAT

50 DATA SECOND

54 GOTO 45

 

save as LIST"D:D.DAT"

 

body program

10 DIM A$(12)

20 RESTORE 50:READ A$

30 ?"HELLO ";A$

40 ENTER"D:D.DAT"

45 RESTORE 50:READ A$

48 ?"THATS ALL"

49 END

50 DATA FIRST

55 GOTO 45

 

------------

Ok, I need to upload and change parts of my program during Running it and continuing in running... but after the command ENTER"D:D.DAT" its load my news dat and STOP... only READY... no continue!!!!... and I must so load about 60 new lines... then the solution please :D thx.

 

Ps.: I have got many and long lines... the easy way ist via command ENTER...but how it do to continue mz running program?

Link to comment
Share on other sites

Hmmm... the ENTER command actually returns you to the Ready prompt if you execute it within a program.

 

There's a way around that. You need to put an extra line into your second bit of program.

 

In the case of your last one there, you'd want a "GOTO 45".

 

So, to get what you need, try this - you can just enter it from immediate mode:

 

OPEN #1,9,0,"D:D.DAT"
? #1;"GOTO 45"
CLOSE #1

 

That works in normal Atari Basic, no guarantee it'll work in TB, but worth a try.

Link to comment
Share on other sites

The usual trick to get around this problem is to use "forced keyboard" mode. Here's how it works:

 

LIST this short program to disk as "D:FOO":

 

50 ? "NEW LINE ADDED"

 

Then NEW, type in and run the following code:

 

10 ? CHR$(125):POSITION 2,2:? "ENTER";CHR$(34);"D:FOO";CHR$(34)
20 POSITION 2,5:? "POKE842,12:CONT"
30 POSITION 0,0
40 POKE 842,13:STOP

 

The code should run, append line 50 from D:FOO to your program, then continue and print the "NEW LINE ADDED" message. Go ahead and delete line 50 and run it again to make sure.

 

POKE 842,13 puts the screen editor in a mode where it behaves as if the RETURN key is continually being pressed, passing all lines it encounters to the BASIC interpreter. POKE 842,12 restores the editor to normal mode, and CONT obviously continues the program. You're not limited to just ENTERing programs this way, of course: I've seen line renumberers that use forced keyboard mode. Just remember to POSITION the statements to be entered to avoid the "STOPPED AT LINE" message and any prompts from BASIC. Press RESET to recover if a prompt makes the editor miss the CONT line.

 

The downside to this technique is that you have to mess up the screen. Changing the text colour to equal the background colour hides the text, but you need to be in gr. 0 for it to work.

 

This is an old Atari BASIC technique, but I tested that it works in Turbo BASIC too.

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...