8bitwidgets.com Posted August 29, 2021 Share Posted August 29, 2021 Hi everyone, so i have this code example from the intybasic book.. I'm hopping @nanochess doesn't mind me quoting examples from the book.. this is all stuff I have typed out myself. so the original main_loop has one approach to how the smiling face moves.. it uses something called #backtab.. and some other values.. ' Example 1 CLS ' Clears the screen DEFINE 5,1,smiling_face ' Define card 5 as a smiling face C = 0 main_loop: #backtab(c) = $807 + 5 * 8 ' Place it on the screen wait ' wait for a frame wait ' wait for a frame wait ' wait for a frame wait ' wait for a frame wait ' wait for a frame #backtab(c) = 0 ' remove it from the screen c = c + 1 ' Increase value of the C by 1 IF c = 240 THEN c = 0 ' If c equals 240 then make it zero GOTO main_loop smiling_face: BITMAP "..XXXX.." BITMAP ".X....X." BITMAP "x.x..x.x" BITMAP "x......x" BITMAP "x.x..x.x" BITMAP "x..xx..x" BITMAP ".x....x." BITMAP "..xxxx.." but then in sample too it calls on sprite 0 and some other values but in this new example (which does work) i'm not clear i get how SPTIE 0 is associated with smiling_face ' Example 2 CLS ' Clears the screen DEFINE 5,1,smiling_face ' Define card 5 as a smiling face C = 0 main_loop: SPRITE 0, $0300 + c, $100 + 8, $0807 + 5 * 8 wait ' wait for a frame c = c + 1 ' Increase value of the C by 1 IF c = 240 THEN c = 0 ' If c equals 240 then make it zero GOTO main_loop Quote Link to comment Share on other sites More sharing options...
artrag Posted August 29, 2021 Share Posted August 29, 2021 The 5*8 part of the 3rd parameter tells tos use gram position number 5 as sprite Quote Link to comment Share on other sites More sharing options...
8bitwidgets.com Posted August 29, 2021 Author Share Posted August 29, 2021 ok interesting.. so if i change: DEFINE 5,1,smiling_face ' Define card 5 as a smiling face to DEFINE 4,1,smiling_face ' Define card 4 as a smiling face i did test it and it appeared to work.. doing: main_loop: SPRITE 0, $0300 + c, $100 + 8, $0807 + 4 * 8 i'm just wondering now why the example would have chosen 5 and not say.. 0 or 1.. or 4.. or any other number? is it a best practice thing or something else? Quote Link to comment Share on other sites More sharing options...
carlsson Posted August 29, 2021 Share Posted August 29, 2021 I suppose 5 makes up for a better example than 0, since 0*8 = 0 and it wouldn't be as clear. 1 would work too but a bigger number probably makes it more obvious. Btw, the X coordinate goes up to 168 but I suppose values up to 240 won't make any bad impact since the interaction bit is #8 = 256 (hex $0100 which is part of the $0300 constant). Quote Link to comment Share on other sites More sharing options...
artrag Posted August 29, 2021 Share Posted August 29, 2021 No idea why, but if you read the book probably you will find Oscar is explaining how sprite parameters work and how gram positions are used by sprites Quote Link to comment Share on other sites More sharing options...
+DZ-Jay Posted August 29, 2021 Share Posted August 29, 2021 (edited) Why multiplied by 8, you may ask? It's because the card index field in a BACKTAB word, or in a Sprite's Attrubute register, is offset by three bits from the right. For instance, the BACKTAB word is a 16-bit record where various groups of bits, or fields, represent the background card attributes, as illustrated below (highlighted in green): Color Stack Mode (Mode #0): Foreground/Background Mode (Mode #1): This means that you must shift the card index by three bits to the left. This is the same as multiplying the index by 23, or 8. The Attributes register of a MOB is laid out in a similar way. In fact, the all arguments to the SPRITE statement are expression to assign values to the three main MOB registers: X (position), Y (position), and A (attributes), respectively. I'm sure the book describes all this, and you can find additional details in the Intellivision Wiki, which is whence I took those images. dZ. Edited August 29, 2021 by DZ-Jay Quote Link to comment Share on other sites More sharing options...
+nanochess Posted August 29, 2021 Share Posted August 29, 2021 (edited) I tend to write thinking in different people. Some people likes to find nitpicks and learns through it. So the 5 was choosen to differ from all other constants in the program. Other people learns by reading the text of the book, and put little to none attention to source code. And other people will refer to it because the DEFINE statement, but one way or other the people learns Edited August 29, 2021 by nanochess Quote Link to comment Share on other sites More sharing options...
8bitwidgets.com Posted August 29, 2021 Author Share Posted August 29, 2021 7 hours ago, carlsson said: 168 but I suppose values up to 240 well in the prior version it was 240 because of the cards.. when they had us switch to a sprite but didn't change that value.. I later changed the value to "IF c = 167 THEN c = 0" to create a nice seamless sprite roll over.. this allows the sprite to leave the screen and smoothly come back on the screen. 7 hours ago, artrag said: No idea why, but if you read the book probably you will find Oscar is explaining how sprite parameters work and how gram positions are used by sprites it's true the book explains things, but not every aspect of everything. i'm taking my time and picking each part apart to make sure i don't just do it, i want to understand things more thoroughly. the book would probably be 3x larger if it was written for me.. lol 5 hours ago, DZ-Jay said: is means that you must shift the c I appreciate the breakdown! I know at some point i'll be coming back to this, so it's not information i can avoid for long. 4 hours ago, nanochess said: I tend to write thinking in different people. yea believe me i'm dense.. i have to beat concepts into my head over and over for them to stick.. i've struggled for years learning to program and i think most people "just get it" the first time.. and concepts just soak in, but for me i have to just really don't do well when i "skip ahead".. but then i have to be sure not to overwhelm either (like DZ-Jay's fantastic breakdown). So yea i'm loving this book and I'm grateful for this form (and that you're on it @nanochess !) i'm loving the book and i can't wait to comprehend it and get the second book and forge ahead! I'm typing this with the book in my lap and i'm working on the controller example next. my next challenge is seeing how to get my ultimate pc interface to work with jzintv.. i have openemu which configures easy and i tested one of my roms with it so it ran fine. just not sure how it's done yet. have to look up some info on it. 1 Quote Link to comment Share on other sites More sharing options...
+DZ-Jay Posted August 30, 2021 Share Posted August 30, 2021 For what it's worth, I am also slow to grasp complex subjects. I just have been doing Intellivision programming for over 10 years now, so I get a sizable bit of it now. In my explanations, I aim to break down concepts into smaller bits and explain them in greater detail, little by little, and going down to first principles -- mostly because that is how I learn things myself. I also try to include why things are like they are, also because that is what would help me. As long as it is useful to someone, I don't mind doing so. dZ. Quote Link to comment Share on other sites More sharing options...
8bitwidgets.com Posted August 30, 2021 Author Share Posted August 30, 2021 (edited) actually i'm happy to report the ultimate game controller "just works" thank god! i was able to move my happy face around successfully. 11 minutes ago, DZ-Jay said: break down concepts absolutely, i'm sure i'm going to be back at these threads soon about this stuff because i know it's a core concept to how pretty much everything works with the graphics in intellivision! 11 minutes ago, DZ-Jay said: As long as it is useful to someone absolutely! you all have been incredibly supportive! Edited August 30, 2021 by Caleb Garner 2 Quote Link to comment Share on other sites More sharing options...
8bitwidgets.com Posted August 30, 2021 Author Share Posted August 30, 2021 @DZ-Jay you also have me using the quote stuff like a boss now thanks to you. 1 Quote Link to comment Share on other sites More sharing options...
artrag Posted August 30, 2021 Share Posted August 30, 2021 Look for stic.txt in the jzintv files (docs/programming IIRC) It explains the meaning of each bit in the parameters used by the sprite command because they match with the stic registers Quote Link to comment Share on other sites More sharing options...
8bitwidgets.com Posted August 30, 2021 Author Share Posted August 30, 2021 1 hour ago, artrag said: Look for stic.txt awesome thanks for that. i was poking around and was looking for "config" type file of some kind but nothing obvious was jumping out at at me. Quote Link to comment Share on other sites More sharing options...
8bitwidgets.com Posted August 30, 2021 Author Share Posted August 30, 2021 is there a controller tester rom someone has made? so i could just do a health check of my controllers? I made one for the Ouya years ago called "controller quest". i'd love to make one for the intellivision but i'm sure someone (or multiple people) have already done this. Quote Link to comment Share on other sites More sharing options...
8bitwidgets.com Posted August 30, 2021 Author Share Posted August 30, 2021 10 hours ago, Caleb Garner said: game controller "just works" thank god! well i spoke too soon.. the disk works, but the keypad / side buttons are not responding. I'll have to dig deeper to figure out how it works. i mean for quick testing i can see how the keyboard is configured. Just be nice to test with a real controller.. i'm using my second sears game controller. Quote Link to comment Share on other sites More sharing options...
carlsson Posted August 30, 2021 Share Posted August 30, 2021 Actually if you look into the IntyBASIC folder "samples" there is a demo program to read the controllers that might work for you. 1 Quote Link to comment Share on other sites More sharing options...
+DZ-Jay Posted August 30, 2021 Share Posted August 30, 2021 (edited) Also, as long as you are doing things by hand, you can explore the SDK-1600 (the distribution that includes the jzIntv emulator and as1600 assembler) for sample programs in the “examples” folder. I believe there is one program in there for testing the hand-controllers. It is an Assembly Language program (as is everything in that distribution), so you will have to assemble it into a binary first. And, like @artrag mentioned, you should review the documents in the “docs” folder in that distribution, which provide extensive technical details about the hardware components. Specifically, you should check out the files for “stict.txt” and “psg.txt” for insight into the video and sound devices, respectively. Those documents are also available in the IntyBASIC SDK installation, within the “Documents” folder; and in the Intellivision Wiki referenced earlier. dZ. Edited August 30, 2021 by DZ-Jay Quote Link to comment Share on other sites More sharing options...
+cmadruga Posted August 30, 2021 Share Posted August 30, 2021 (edited) On 8/29/2021 at 9:48 AM, Caleb Garner said: i'm just wondering now why the example would have chosen 5 and not say.. 0 or 1.. or 4.. or any other number? is it a best practice thing or something else? Actually, the topic of any best practices that might exist when it comes to choosing where to load things on GRAM is an interesting one. At least for more complex programs. But I'd say that is not something you need to worry too much about for now. Edited August 30, 2021 by cmadruga Quote Link to comment Share on other sites More sharing options...
8bitwidgets.com Posted August 30, 2021 Author Share Posted August 30, 2021 5 hours ago, cmadruga said: worry too much about for now. Yea that's good to know. Still want to just be flexible as i get deeper into doing things right vs easy.. I could see myself developing bad habits i regret later. Quote Link to comment Share on other sites More sharing options...
Mik's Arcade Posted September 2, 2021 Share Posted September 2, 2021 On 8/29/2021 at 2:30 PM, nanochess said: I tend to write thinking in different people. Some people likes to find nitpicks and learns through it. So the 5 was choosen to differ from all other constants in the program. Other people learns by reading the text of the book, and put little to none attention to source code. And other people will refer to it because the DEFINE statement, but one way or other the people learns and then some of us are just really SLOW learners..... your code for PUMPKINS is really helping me at the moment, but man the code to do enemy patterns is daunting stuff. 1 Quote Link to comment Share on other sites More sharing options...
8bitwidgets.com Posted September 2, 2021 Author Share Posted September 2, 2021 9 minutes ago, Mik's Arcade said: some of us are just really SLOW learners I'm definitely not a sponge.. i have to beat this stuff into my head and probably ask things more than once sometimes.. I don't envy what you must be figuring out with enemy movement.. i know i'm going to have my work cut out for me for I, Killbot and Road Defender. Quote Link to comment Share on other sites More sharing options...
Mik's Arcade Posted September 3, 2021 Share Posted September 3, 2021 23 hours ago, Caleb Garner said: I'm definitely not a sponge.. i have to beat this stuff into my head and probably ask things more than once sometimes.. I don't envy what you must be figuring out with enemy movement.. i know i'm going to have my work cut out for me for I, Killbot and Road Defender. yeah, the problem is we have all the ideas, but lack the programming chops to back it up. Plus, we are working with limitations as well. My first game was way too complicated for me to try. I need to keep it simple and make a few basic games before i get into the more creative projects. baby steps...haha. I go through ebbs and flows. I need to do consistent work. I'll go a over a week without doing anything and then carve out only a couple of hours on a weekend. I can't do those marathon coding sessions like I did back in my high school days. good luck! Quote Link to comment Share on other sites More sharing options...
8bitwidgets.com Posted September 3, 2021 Author Share Posted September 3, 2021 16 minutes ago, Mik's Arcade said: lack the programming chops to back it up. indeed.. i'm chewing on this pong game.. discouraging when you can't even figure out why something is orange (9?) when there's only 3 9's in the whole body of code and none of them effect the paddle color.. lol.. but not discouraged, just humbled and staying at it till i figure it out. Quote Link to comment Share on other sites More sharing options...
+DZ-Jay Posted September 3, 2021 Share Posted September 3, 2021 14 minutes ago, Caleb Garner said: indeed.. i'm chewing on this pong game.. discouraging when you can't even figure out why something is orange (9?) when there's only 3 9's in the whole body of code and none of them effect the paddle color.. lol.. but not discouraged, just humbled and staying at it till i figure it out. Show some code, and perhaps someone may be able to answer the question. Quote Link to comment Share on other sites More sharing options...
8bitwidgets.com Posted September 3, 2021 Author Share Posted September 3, 2021 7 minutes ago, DZ-Jay said: Show some code, ok here goes! I figured out the color thing.. so it's in the sprite (which makes sense) but i don't really understand this well.. but i know more in the book will explain it so i'll be patient.. i haven't explored the sprite stuff but i understand somehow you can add parameters together and the total will give the desired result.. that will take some rote practice to feel that one out. SPRITE 0, $0708 + x1, $0208 + y1, $0800 + 5 * 8 + 2 ' the 2 is (bad) red and 3 is the light green. SPRITE 1, $0708 + x2, $0208 + y2, $0800 + 5 * 8 + 3 PRINT AT 27 COLOR 2,<>score1 ' left score PRINT AT 31 COLOR 3,<>score2 ' right score 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.