Jump to content
IGNORED

Basic/Ex Basic Code - Different programs - Copy and Past!


oddemann

Recommended Posts

7 minutes ago, oddemann said:

Hmmm, if I go this way...
 

DATA 32,"00"

DATA 1,2,128,"C038040000000000"

DATA 1,2,129,"0000040202020101"

DATA 2,2,130,"0101020202040000"

DATA 2,2,131,"00000000000438C0"

DATA 2,1 132,"0000000000201C03"

DATA 2,1 133,"8080404040200000"

DATA 1,1,134,"0000204040408080"

DATA 1,1,135,"031C200000000000"



Read Char nr., "pic"

Display it in a for-next loop - LINE NR CALL HCHAR(A,B,C)

Then GOSUB the time delay

Maybe even not have Char 32 in DATA as it is the same... would that make it more even?

Sounds like you know what to do.

Give it a try. 

  • Like 1
Link to comment
Share on other sites

Ver 5

BUT but but... why dos it only do one round and then fail? Also it was way slower...

 

Spoiler
50 CALL CLEAR
100 DATA 1,2,"C038040000000000"
200 DATA 1,2,"0000040202020101"
300 DATA 2,2,"0101020202040000"
400 DATA 2,2,"00000000000438C0"
500 DATA 2,1,"0000000000201C03"
600 DATA 2,1,"8080404040200000"
700 DATA 1,1,"0000204040408080"
800 DATA 1,1,"031C200000000000"

801 PRINT "Spinner Demo Ver. 5"
802 PRINT "press a key to stop"
803 PRINT

804 TIME=5
805 GOSUB 1000
806 CALL KEY(0,K,S)
807 IF S=0 THEN 805

808 PRINT "Spinner stopped"
809 END

900 Read A,B,C$

1000 FOR I=128 to 135
1025 Read A,B,C$
1050 CALL CHAR (I,C$)
1100 CALL HCHAR(A,B,I)
1200 CALL HCHAR(A,B,32)
1300 GOSUB 9010
1400 NEXT I
1500 RETURN

9000 REM delay
9010 FOR T=0 TO TIME
9020 NEXT T
9999 RETURN

 

 

Edited by oddemann
Link to comment
Share on other sites

Speed: 

Look at what you added to the main loop.

  • Reading the data statements takes a lot of extra time.
  • Changing a character pattern takes a lot of extra time.

 

This is why the original was done the way it was done. 

BASIC has no forgiveness. :) 

 

So a "rule of thumb" as we say in English is: Do all the setup code outside of the loop.  Keep the inside of the loop to a minimum for maximum speed.

 

Why it stops:

Also, after you have read the data once, you need to use RESTORE to start reading it again at the beginning.

add line 1450 and it runs forever

 

1450 RESTORE

 

Better solution: 

READ the DATA and do CALL CHAR() statements for all the characters as the setup code.  

Inside the loop, just put characters on the screen with HCHAR. This is faster. 

 

Have fun.

  • Like 2
Link to comment
Share on other sites

10 hours ago, TheBF said:

Speed: 

Look at what you added to the main loop.

  • Reading the data statements takes a lot of extra time.
  • Changing a character pattern takes a lot of extra time.

 

This is why the original was done the way it was done. 

BASIC has no forgiveness. :) 

 

So a "rule of thumb" as we say in English is: Do all the setup code outside of the loop.  Keep the inside of the loop to a minimum for maximum speed.

 

Why it stops:

Also, after you have read the data once, you need to use RESTORE to start reading it again at the beginning.

add line 1450 and it runs forever

 

1450 RESTORE

 

Better solution: 

READ the DATA and do CALL CHAR() statements for all the characters as the setup code.  

Inside the loop, just put characters on the screen with HCHAR. This is faster. 

 

Have fun.

OK... learned how to reset data...

Made a loop outside to read and assign value to different CALL CHAR. So far so good. (Intention is to make as few lines as possible.)

But I am stomped by how to add the placement of the CHAR on the screen as it is 4 different locations. 2 CHAR is in the same box at different location within that box.
- Can I make it a mathematical logical thing - NO, it has a pattern, but hard to make it "add" up.
- I could probeable read it all and make a DIM and then store every value in its own place and then a loop could call it up "logically". Here I need to read up.
- I could add all the 16 lines to make it all work. But that is adding a lot of lines
- Are there other options?

Also I got an Idea for a game... Have some circles that is moving and then you have to move your "X" into the circle between all the moving "protection" of the middle. Make some circles that are moving in opposite way to the one beside itself.
"Lucky Spacewalker in his TI fighter is trying to blow up the mega killer star that is getting ready to blow up his planet!" (I am so creative, I don't know where I get my ideas from hehehehe)

  • Like 1
Link to comment
Share on other sites

5 hours ago, oddemann said:

OK... learned how to reset data...

Made a loop outside to read and assign value to different CALL CHAR. So far so good. (Intention is to make as few lines as possible.)

But I am stomped by how to add the placement of the CHAR on the screen as it is 4 different locations. 2 CHAR is in the same box at different location within that box.
- Can I make it a mathematical logical thing - NO, it has a pattern, but hard to make it "add" up.
- I could probeable read it all and make a DIM and then store every value in its own place and then a loop could call it up "logically". Here I need to read up.
- I could add all the 16 lines to make it all work. But that is adding a lot of lines
- Are there other options?
 

Use 8 HCHAR() statements. One for each position. This is faster than computing x,y coordinates inside the loop.

  • Like 1
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...