+atari2600land Posted September 16, 2018 Share Posted September 16, 2018 Is there a way to speed up my Intellivision thing I'm working on? I think it's too slow. Quote Link to comment Share on other sites More sharing options...
fsuinnc Posted September 16, 2018 Share Posted September 16, 2018 yes. program it to do what it's doing now but use less code. Quote Link to comment Share on other sites More sharing options...
intvnut Posted September 16, 2018 Share Posted September 16, 2018 Did you remember to set the --gofaster switch? ;) In all seriousness, do you have some idea what areas have performance concerns? I'm sure there's several of us here that can recommend ways to rewriting short fragments of code to improve their performance. Without some idea of where you're experiencing performance issues, it's hard to make a specific recommendation. 1 Quote Link to comment Share on other sites More sharing options...
+atari2600land Posted September 16, 2018 Author Share Posted September 16, 2018 (edited) Perhaps this can be shortened? if tonguechar=1 then print at tonguepos color 2, "\276" if tonguechar=2 then print at tonguepos color 2, "\277" if tonguechar=3 then print at tonguepos color 2, "\278" if tonguechar=4 then print at tonguepos color 2, "\279" if tonguechar=5 then print at tonguepos color 2, "\280" if tonguechar=6 then print at tonguepos color 2, "\281" if tonguechar=7 then print at tonguepos color 2, "\282" if tonguechar=8 then print at tonguepos color 2, "\283" if tonguepos=0 then tonguepos=122 if tonguepos=1 then tonguepos=124 if tonguepos=2 then tonguepos=126 if tonguepos=3 then tonguepos=128 if tonguepos=4 then tonguepos=130 if tonguepos=5 then tonguepos=132 if tonguepos=6 then tonguepos=134 if tonguepos=7 then tonguepos=136 I tried making this: print at tonguepos color 2, "\#tonguechar", but that didn't work at all. Edited September 16, 2018 by atari2600land Quote Link to comment Share on other sites More sharing options...
+nanochess Posted September 16, 2018 Share Posted September 16, 2018 Perhaps this can be shortened? if tonguechar=1 then print at tonguepos color 2, "\276" if tonguechar=2 then print at tonguepos color 2, "\277" if tonguechar=3 then print at tonguepos color 2, "\278" if tonguechar=4 then print at tonguepos color 2, "\279" if tonguechar=5 then print at tonguepos color 2, "\280" if tonguechar=6 then print at tonguepos color 2, "\281" if tonguechar=7 then print at tonguepos color 2, "\282" if tonguechar=8 then print at tonguepos color 2, "\283" if tonguepos=0 then tonguepos=122 if tonguepos=1 then tonguepos=124 if tonguepos=2 then tonguepos=126 if tonguepos=3 then tonguepos=128 if tonguepos=4 then tonguepos=130 if tonguepos=5 then tonguepos=132 if tonguepos=6 then tonguepos=134 if tonguepos=7 then tonguepos=136 I tried making this: print at tonguepos color 2, "\#tonguechar", but that didn't work at all. I suppose your code is reversed because drawing is first and position calculation is last. Here are some optimization tips: #backtab(tonguepos) = $0802 + (19 + tonguechar) * 8 tonguepos = 122 + tonguepos * 2 2 Quote Link to comment Share on other sites More sharing options...
+atari2600land Posted September 16, 2018 Author Share Posted September 16, 2018 (edited) Thanks for the tips. This is what I have for my loop: loop: speed=speed+1 if speed>speedlimit and tonguedir=1 then tonguechar=tonguechar-1 if speed>speedlimit and tonguedir=2 then tonguechar=tonguechar+1 if speed>speedlimit then speed=0 : tonguetimer=tonguetimer+1 if chooseahole=1 then gosub choosehole ' tonguedir=2 -up | tonguedir=1 - down if tonguetimer>7 and tonguedir=1 then tonguetimer=0 : tonguepos=tonguepos+20 : tonguechar=8 if tonguetimer>7 and tonguedir=2 then tonguetimer=0 : tonguepos=tonguepos-20 : tonguechar=1 : print at tonguepos+20 color 2, " " if tonguepos>219 then tonguepos=tonguepos-20 : tonguedir=2 : tonguechar=1 if tonguepos<119 then tonguepos=tonguepos+20 : tonguedir=1 : tonguechar=8 : chooseahole=1 wait #backtab(tonguepos) = $0802 + (19 + tonguechar) * 8 GOTO loop choosehole: procedure print at tonguepos color 2, " " tonguepos=random(7)+1 tonguepos = 122 + tonguepos * 2 chooseahole=0 return end That isn't very much though. This is what that outputs: Which is all well and good, but suppose I want it to go faster later on in the game. This is the fastest it can go. Speedlimit is set at 0. See what I mean? Edited September 16, 2018 by atari2600land Quote Link to comment Share on other sites More sharing options...
+5-11under Posted September 16, 2018 Share Posted September 16, 2018 Step the position by a larger amount each cycle. Quote Link to comment Share on other sites More sharing options...
+atari2600land Posted September 16, 2018 Author Share Posted September 16, 2018 What do you mean? Quote Link to comment Share on other sites More sharing options...
carlsson Posted September 16, 2018 Share Posted September 16, 2018 Make the tongue move in bigger steps, more rough movement. A very small improvement, but remember that you can do IF statements covering multiple lines: if speed>speedlimit then if tonguedir=1 then tonguechar=tonguechar-1 if tonguedir=2 then tonguechar=tonguechar+1 speed=0 : tonguetimer=tonguetimer+1 end if Also consider using signed variables. While those can be tricky sometimes, if tonguedir would hold the values -1 and 1 instead of 1 and 2, you could use tonguechar=tonguechar + tonguedir without the extra IF statements. I used a bunch of signed variables in my compo entry for which I posted the source code, if you want to have a look at one way to handle those. 1 Quote Link to comment Share on other sites More sharing options...
fsuinnc Posted September 16, 2018 Share Posted September 16, 2018 (edited) I suppose your code is reversed because drawing is first and position calculation is last. Here are some optimization tips: #backtab(tonguepos) = $0802 + (19 + tonguechar) * 8 tonguepos = 122 + tonguepos * 2 where did the 19 come from in (19 + tongue) and I still do not understand the #backtab (but I haven't finished the book just yet.) Edited September 17, 2018 by fsuinnc Quote Link to comment Share on other sites More sharing options...
+nanochess Posted September 16, 2018 Share Posted September 16, 2018 where did the 19 come from in (19 + tongue) and I still do not understand the #backtab (but I haven't finished the book just yet. When you use PRINT the \256 to \319 codes map directly to GRAM bitmaps (there are 64 of these 8x8). He is using \276 (276 - 256 = GRAM 20), so 19 + 1 is equal to 20, to map the GRAM 20-27. GRAM selection (instead of GROM) is marked by the $0800. #backtab is a direct access to screen cards. More elegant than using POKE $0200 + pos, card 1 Quote Link to comment Share on other sites More sharing options...
+atari2600land Posted September 16, 2018 Author Share Posted September 16, 2018 Okay, I did that and it still looks decent t I think. I made three speeds: slow, medium and fast, and they all look good even though it might not be showing all the GRAM bitmaps I defined. This is a little offtopic, but I've always wondered if there's a little chart that tells what GRAM bitmap is A, what represents B, etc. Quote Link to comment Share on other sites More sharing options...
carlsson Posted September 16, 2018 Share Posted September 16, 2018 Do you mean GROM? This one is in hexadecimal but I'm sure you have no trouble converting the numbers to decimal if required. http://wiki.intellivision.us/index.php?title=Graphics_ROM Quote Link to comment Share on other sites More sharing options...
intvnut Posted September 19, 2018 Share Posted September 19, 2018 Do you mean GROM? This one is in hexadecimal but I'm sure you have no trouble converting the numbers to decimal if required. http://wiki.intellivision.us/index.php?title=Graphics_ROM You can also use the "show_grom" utility that comes with jzIntv to create an ASCII or HTML version to your liking, with the actual bitmaps. I used a generic font when I made the chart on the Intelliwiki page, as I wasn't sure the copyright status for the font bitmaps, so I just steered clear. Quote Link to comment Share on other sites More sharing options...
fsuinnc Posted September 19, 2018 Share Posted September 19, 2018 Perhaps this can be shortened? if tonguechar=1 then print at tonguepos color 2, "\276" if tonguechar=2 then print at tonguepos color 2, "\277" if tonguechar=3 then print at tonguepos color 2, "\278" if tonguechar=4 then print at tonguepos color 2, "\279" if tonguechar=5 then print at tonguepos color 2, "\280" if tonguechar=6 then print at tonguepos color 2, "\281" if tonguechar=7 then print at tonguepos color 2, "\282" if tonguechar=8 then print at tonguepos color 2, "\283" if tonguepos=0 then tonguepos=122 if tonguepos=1 then tonguepos=124 if tonguepos=2 then tonguepos=126 if tonguepos=3 then tonguepos=128 if tonguepos=4 then tonguepos=130 if tonguepos=5 then tonguepos=132 if tonguepos=6 then tonguepos=134 if tonguepos=7 then tonguepos=136 I tried making this: print at tonguepos color 2, "\#tonguechar", but that didn't work at all. I haven't done anything with IntyBASIC in a while but my first thought on this would be something like this: print at tgpos(tonguepos) color 2, tgchar(tonguechar) tgpos: 122,124,126,128,130,132,134,136 tgchar: 0,"\276","\277","\278","\279","\280","\281","\282","\283" I'm not sure I set the arrays up exactly right but, generally speaking, would something like this work? Quote Link to comment Share on other sites More sharing options...
+nanochess Posted September 19, 2018 Share Posted September 19, 2018 I haven't done anything with IntyBASIC in a while but my first thought on this would be something like this: print at tgpos(tonguepos) color 2, tgchar(tonguechar) tgpos: 122,124,126,128,130,132,134,136 tgchar: 0,"\276","\277","\278","\279","\280","\281","\282","\283" I'm not sure I set the arrays up exactly right but, generally speaking, would something like this work? It should be: tgpos: DATA 122,124,126,128,130,132,134,136 tgchar: DATA 0,$0002+276*8,$0002+277*8,$0002+278*8,$0002+279*8,$0002+280*8,$0002+281*8,$0002+282*8,$0002+283*8 In my previous code I hard coded the bit to signal GRAM card: tgchar: DATA 0,$0802+20*8,$0802+21*8,$0802+22*8,$0802+23*8,$0802+24*8,$0802+25*8,$0802+26*8,$0802+27*8 I think this is more clear because the GRAM numbers are the same used in the DEFINE statement. 2 Quote Link to comment Share on other sites More sharing options...
intvnut Posted September 19, 2018 Share Posted September 19, 2018 I was going to suggest lookup tables also, but fsuinnc got to it first. :-P There's only so much I can do when hopping over here during business hours. In general, if you have a stack of "IF x = cst THEN y" statements that are closely related, a lookup table can flatten that into a single operation, increasing speed and decreasing code size. Or, if the 'y' part of the statement varies a lot, see if you can rework it into an "ON x GOTO", so you have a single dispatch to multiple outcomes. ON x GOTO turns into a lookup table under the hood, only for branch targets. ON x GOTO can be useful for stuff like movement code and keypad dispatch. You just have to make sure the value 'x' is transformed to something non-negative, so that might mean adding a small constant. 3 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.