Jump to content
IGNORED

Beginner help with IntyBasic


dalves

Recommended Posts

Quick question. DZ has suggested using putting some of the Sprites behind the background to add depth. I've been checking the sample codes I have and couldn't find an example on how to do this. Can someone give an example of how the command is written or suggest a sample code where this is used?

Link to comment
Share on other sites

Quick question. DZ has suggested using putting some of the Sprites behind the background to add depth. I've been checking the sample codes I have and couldn't find an example on how to do this. Can someone give an example of how the command is written or suggest a sample code where this is used?

I don't recall the syntax offhand (I don't use IntyBASIC myself), but the IntyBASIC SDK comes with a tutorial video called "IntyB Demo," or something like it, that has one specific scene where it demonstrates precisely that a sprite can go in front or behind the background.

 

The SDK includes the source of this demo in the "Contributions" folder, which is very well commented. Take a look at the part of the code that implements that section for an example of how to do this.

 

dZ.

Link to comment
Share on other sites

Quick question. DZ has suggested using putting some of the Sprites behind the background to add depth. I've been checking the sample codes I have and couldn't find an example on how to do this. Can someone give an example of how the command is written or suggest a sample code where this is used?

There is a priority bit in the third sprite parameter. In Constants.bas, GroovyBee calls this the "BEHIND" bit.

 

CONST BEHIND = $2000 ' Sprite is behind the background.

 

If the bit is set, then the sprite appears to be "behind" the foreground color bits of the backtab tiles.

 

For example: this sprite would be in front of the background:

SPRITE 4,x + HIT + VISIBLE,y + ZOOMY2,SPR_DARKGREEN + SPR38

while this sprite would be behind the foreground bits of the background:

SPRITE 4,x + HIT + VISIBLE,y + ZOOMY2,SPR_DARKGREEN + SPR38 + BEHIND

 

That's all there is to it.

 

Catsfolly

Link to comment
Share on other sites

I've got a "Print" question for anyone who can help. I was working on a game that had a layout of a house. When I used "Print" to create the individual rooms, after making 3 rooms I must have exceeded some capability as the screen would only go black when running it until I deleted one of the rooms. I figured maybe what I needed to do was create one room and use variables for the wall patterns and colors to make each room look different. I figured out how to change the color of the room, but trying to change the character value hasn't worked. An example would be using the variable WP=272 instead of "\272". When I try printing "\WP" gives an error that "WP is not read". I'm sure my syntax is is wrong, but not sure the right way to write it. Any help would be greatly appreciated.

Edited by dalves
Link to comment
Share on other sites

I've got a "Print" question for anyone who can help. I was working on a game that had a layout of a house. When I used "Print" to create the individual rooms, after making 3 rooms I must have exceeded some capability as the screen would only go black when running it until I deleted one of the rooms. I figured maybe what I needed to do was create one room and use variables for the wall patterns and colors to make each room look different. I figured out how to change the color of the room, but trying to change the character value hasn't worked. An example would be using the variable WP=272 instead of "\272". When I try printing "\WP" gives an error that "WP is not read". I'm sure my syntax is is wrong, but not sure the right way to write it. Any help would be greatly appreciated.

To my way of thinking "Print" is for text. I would recommend using the "poke" command to set individual characters on the screen, or the "screen" command to set up whole areas of the screen at once.

 

The poke command can be used to write the value of a variable to a screen location. But don't forget that by default Intybasic variables are 8 bit values - so they can only hold numbers between 0 and 255. To create a 16 bit variable that can hold a larger number, you have to add a "#" character to the variable name.

 

#WP = 272

 

poke screenaddr(col, row),#WP

 

 

You could do the same thing with a print command, but it has the additional overhead of updating the current print position.

 

 

print at screenpos( col,row), #WP

 

Does this help at all?

 

Catsfolly

Link to comment
Share on other sites

A single card hold the color information, grom/gram bit, and card number information

So the format roughly in binary for colorstack card. bit 13 advance color stack, bit 12 enables upper 8 pastel colors for the card, bit 11 grom/gram switch, bit 10-3 is the card number, and bit 2-0 are the color information. BG/FG need a bit more work to - wait. I'm using http://knox.ac.free.fr/inty_workshop/site to help me set up the card tile for me. If you click the backtab. You can pick a color, card number, it'll generate a 16-bit hexadecimal number for you. This is my old reference I used to set up each cards I want for the screen, http://wiki.intellivision.us/index.php?title=STIC&oldid=15008 . You can see how the bits are set up in color stack mode and BG/FG mode. The old way requires the use of a calculator.

There are several ways to print many cards on screen.

I use a pointer and recursive programming.
Example:

x=7
y=20
for i=0 to 23
poke $200+x+y,clickbp1(i)
x=x+1
if x=11 then x=7:y=y+20
next i

clickbp1:
DATA $2600,$0807,$080F,$2600
DATA $0817,$081F,$0827,$082F
DATA $0847,$084F,$0857,$085F
DATA $2600,$0887,$088F,$2600
DATA $2600,$089F,$08A7,$2600
DATA $08AF,$08B7,$08BF,$2600

Will print the cards at position x 7, y position 1(which is 20). And make a 4 by 6 card bitmap image.

Link to comment
Share on other sites

Thanks Kiwi. I wasn't sure if your code was meant for Color Stack Mode or FG/BG mode. I tried it in both and the results look different then what I'm assuming you intend them to be. I used your code but started with...

 

cls

mode 0,0,1,2,3

define def00,16,clickbp1

wait

 

Poke and Data commands are a new world for me and I know it will require a lot of experimenting to understand it. I assume I can interchange bitmaps for data. When I referenced a bitmap of mine it drew it correctly in the first position and then I had a bunch of random characters after that. I've attached a picture of one of the angles of the rooms I used "Print" to create. I was hoping to find an easy way to change the pattern and color on the wall to make it look like a different rooms without having to "Print" a whole new room.

 

Room

Link to comment
Share on other sites

The example I provided was for a game I was working on. I was little out of my mind last night. So yea, you can redefine the cards. For example for one room have that pattern, then you decided you wanted to have heart wallpaper, you can change the orange wallpaper to hearts. You would upload the heart pattern to that cardslot. For example if you want to change card number 2, you can use DEFINE 2,2,heartwallgraphic. Changing the card color from orange to red will do extra work. You can add 2 to each cards on the screen since pink is 2 color ahead of orange.

 

Something like

 

Example

for i=0 to 239

#mcard=(peek $200+i)

#mcard=#mcard+2

poke $200+i,#mcard

next i

 

$200 is where the backtab is at on the Intellivision's memory map. You could use #backtab instead of $200, but number usually easier for me to remember. I don't the exact syntax because I'm very stubborn. What the example does is to take a card from backtab, add 2, and then write it back to the screen position. This does this task 239 times.

 

To get red you will have to subtract $1000 to set the upper color bit to 0 to enable primary colors.

 

This above is for colorstack mode.

 

I'm not sure which color is foreground or background, is it white or orange. If orange is the back color, you can poke a value to the colorstack to change orange to either red or pink.

example:

wait

POKE $28,$0b 'will upload this value, pink, to the 1st colorstack slot.

 

Or,

 

wait

POKE $28,$02 'will upload this value, red, to the 1st colorstack slot.

 

To add furniture and such, I would recommend making a subroutine to print the furniture cards on screen. The bgclick01 example of loading a group of tiles on screen.

Link to comment
Share on other sites

Thanks Kiwi. I'll give that a try. Catsfolly mentioned that I should be able to use Poke to draw the initial bitmaps. I tried what he suggested but kept getting the error that the bitmap variable couldn't be read. I was wondering if there is a basic Poke command for drawing a single bitmap image?

 

The house I'm trying to create is the one I grew up in. Not 100% sure what the game's objective will be, but I was thinking of an adventure game and maybe have it be about the Christmas when we got our first Intellivision. Still in the very early stages, but it is interesting to see my old house in Intellivision form. ;-)

Link to comment
Share on other sites

Thanks Kiwi. I'll give that a try. Catsfolly mentioned that I should be able to use Poke to draw the initial bitmaps. I tried what he suggested but kept getting the error that the bitmap variable couldn't be read. I was wondering if there is a basic Poke command for drawing a single bitmap image?

 

The house I'm trying to create is the one I grew up in. Not 100% sure what the game's objective will be, but I was thinking of an adventure game and maybe have it be about the Christmas when we got our first Intellivision. Still in the very early stages, but it is interesting to see my old house in Intellivision form. ;-)

You might be better of learning what the IntyColor tool provided with IntyBASIC is for.

The Pinned IntyBASIC master thread has a link to some tutorials, draw your rooms that way, limit yourself to 50 unique cards syou have some left over for sprite definitions. You can use POKEs but just drawing your screen (within the limitations of GRAM) and seeing how the SCREEN command works might be beneficial based on what you have in mind.

Link to comment
Share on other sites

I did redraw the tiles in Tile Studio and export as an bmp image earlier. I used IntyCOLOR to transfer the image to a IntyBASIC format. I would keep the sprites GRAM in the upper 32 or 48 GRAM depending how complicated the image is. Here's the source code it generated.

	REM IntyColor v1.1.2 Oct/14/2015
	REM Command: C:\IntyStuf\Inty11\IntyColor.exe -b room.bmp room.bas 
	REM Created: Mon Sep 19 10:54:08 2016

	REM stub for showing image
	INCLUDE "constants.bas"
	MODE 1
	WAIT
	DEFINE 0,9,screen_bitmaps_0
	WAIT
	SCREEN screen_cards
loop:
	GOTO loop

	' 9 bitmaps
screen_bitmaps_0:
	DATA $AAAA,$AAAA,$AAAA,$AAAA
	DATA $BF7F,$AF9F,$ABA7,$AAA9
	DATA $FFFF,$FFFF,$FFFF,$00FF
	DATA $FDFE,$F5F9,$D5E5,$5595
	DATA $5555,$5555,$5555,$5555
	DATA $66BD,$81C3,$C381,$BD66
	DATA $E7DB,$6666,$6666,$DBE7
	DATA $A8AA,$A0A8,$80A0,$0080
	DATA $1555,$0515,$0105,$0001

	REM 20x12 cards
screen_cards:
	DATA $1C07,$1C0F,$1C17,$1C17,$1C17,$1C17,$1C17,$1C17,$1C17,$1C17,$1C17,$1C17,$1C17,$1C17,$1C17,$1C17,$1C17,$1C17,$1C1F,$1C27
	DATA $1C07,$1C07,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C27,$1C27
	DATA $1C07,$1C07,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C27,$1C27
	DATA $1C07,$1C07,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C27,$1C27
	DATA $1C07,$1C07,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C27,$1C27
	DATA $1C07,$1C07,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C27,$1C27
	DATA $1C07,$1C07,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C27,$1C27
	DATA $1C07,$1C07,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C27,$1C27
	DATA $1C07,$1C07,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C37,$1C2F,$1C27,$1C27
	DATA $1C07,$1C3F,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1C47,$1C27
	DATA $1C3F,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1C47
	DATA $1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400,$1400

C:\IntyStuf\Inty11\IntyColor.exe -b room.bmp room.bas

 

Parameters. -b export to intybasic format.

 

You can see how the source file use the screen command, and note it is using MODE 1, BG/FG mode.

 

IntyCOLOR works best if you use the exact color pallete and have an image powered by 8.

Link to comment
Share on other sites

You know, since I've started programming for the Intellivision, I've been trying to beat the code into my head. I've used IntyColor and Paint.net as a tool for "Sketching" what I want my landscapes to look like then end up using bitmaps and "Print" commands to draw them. I will need to learn the code eventually, but you're right that IntyColor may make it a little easier for me at this point. :)

Link to comment
Share on other sites

Yes, you can use colorstack. Here's the image I made, has to be .bmp.

 

room.bmp

 

You can use -sAAAA to generate a colorstack image, the letter A is in hexidecimal and represent color 10, which is orange.

 

C:\IntyStuf\Inty11\IntyColor.exe -b -saaaa room.bmp room.bas

 

will generate the above image to be use in colorstack mode.

 

The color white is foreground color, while the color orange is the back color which is from the colorstack value.

Edited by Kiwi
Link to comment
Share on other sites

Thanks, that helped a lot... Maybe somewhere down the road, I'll understand all the information that is generated as data and be able to tweak certain things if needed.

 

Interesting side note. I took that same room .bmp file. Drew cyan a window and tan curtains. When I ran it through Intycolor using the color stack formula you gave, the tan curtains turned yellow.

 

I was able to fool around with the data info and manually change them to tan. One step closer to understanding the code.

Edited by dalves
Link to comment
Share on other sites

I was happy using print, but with trying to create a bunch of different looking rooms in a house, the size of the file got big very fast. Once the file reached 24K, the ROM wouldn't run in the emulators anymore. I would just get a black screen. I figured that what I may have to do is print separate room size screens, and then change wall patterns and colors to make it look like different rooms. The problem is I wasn't able to find a way to use a variable inside of print so I could reference different bitmaps depending on the room you were in. I was hoping this would be an alternate way and would keep the file size low.

Link to comment
Share on other sites

Variables inside print? PRINT AT cardposition, cardvalue*8+color. You can very easily use variables inside of a PRINT statement :) And you can use either to index into a DATA statement if you want to store your values that way. POKE won't save you much there, if you're just issuing 200 POKEs to fill one screen.

 

If you're using it to print an entire room - then the IntyColor/SCREEN method is absolutely the way to go. It's once you get into wanting to change only a small bit of that room that PRINT/POKE come into play. And all I was trying to point out is, PRINT is equally as useful as POKE here (for most cases). But just a bit nicer to look at.

Link to comment
Share on other sites

I was happy using print, but with trying to create a bunch of different looking rooms in a house, the size of the file got big very fast. Once the file reached 24K, the ROM wouldn't run in the emulators anymore. I would just get a black screen. I figured that what I may have to do is print separate room size screens, and then change wall patterns and colors to make it look like different rooms. The problem is I wasn't able to find a way to use a variable inside of print so I could reference different bitmaps depending on the room you were in. I was hoping this would be an alternate way and would keep the file size low.

Search for the 42k.bas file that comes with IntyBASIC, then search this forum for "ASM ORG" to understand why you were getting lock ups at 24k

Link to comment
Share on other sites

Thanks Freewheel!!! I couldn't find an example of using variables with Print, so I tried a few my own way and it never worked. I tried what you suggested and it worked great.

 

Tarzilla, I will check out what you suggested as well. I was thinking perhaps the size of my program was exceeding Intellivision's capability, but I'll check that to see what is actually going on.

Link to comment
Share on other sites

Thanks Freewheel!!! I couldn't find an example of using variables with Print, so I tried a few my own way and it never worked. I tried what you suggested and it worked great.

 

:) I'm only hoping that I used the correct syntax. I have a few shortcut methods of plopping down data like that and sometimes I forget what you "need" to actually do. The *8 is key, if you want to use GRAM cards.

 

The other trick is to use the cardposition value as row, column (depending on what you're doing). You can generally write a couple of nested FOR loops that handle an entire screen in about 5 lines of code. Takes up very little space on the cart itself - but be warned, it's not always the fastest in terms of CPU time. I wouldn't re-draw an entire screen this way with every frame of game action, for example. But for static rooms, titlescreens, etc? It's a quick, easy-to-read, dead simple way of blasting cards to the screen. I like it. It's really the same thing as using SCREEN but you have a bit more control, depending on exactly what you're doing.

 

I whip out POKE when I REALLY want to get my hands dirty and have some fun.

Link to comment
Share on other sites

  • 2 weeks later...

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