Jump to content
IGNORED

How to display a 16x8 MOB?


Vincehood

Recommended Posts

Hello,

I am a complete beginner at the (really great) IntyBasic SDK.

By reading the documentation and looking at examples, I managed to display a 8x8 MOB that I can control.

I would like however to display a 16x8 MOB but my program is crashing.("CPU off in the weeds")

 

I am using the following bitmap definition

 

runmanleft1:
REM Running man left 1 bitmaps
BITMAP "11110011"
BITMAP "11110111"
BITMAP "11000011"
BITMAP "10000111"
BITMAP "10100111"
BITMAP "10100000"
BITMAP "11111111"
BITMAP "11100111"

BITMAP "11100111"
BITMAP "11000000"
BITMAP "11011110"
BITMAP "10011101"
BITMAP "10111101"
BITMAP "00111111"
BITMAP "01111111"
BITMAP "01111111"

 

The BITMAP stuff was generated with IntyColor. Is this the right way to define a bitmap for a 16x8 MOB?

 

Is there an example somwhere showing how to use DEFINE and SPRITE for such kind of MOB?

 

Thanks in advance

/Vincent

 

 

Link to comment
Share on other sites

Hello,

I am a complete beginner at the (really great) IntyBasic SDK.

By reading the documentation and looking at examples, I managed to display a 8x8 MOB that I can control.

I would like however to display a 16x8 MOB but my program is crashing.("CPU off in the weeds")

 

I am using the following bitmap definition

 

runmanleft1:

REM Running man left 1 bitmaps

BITMAP "11110011"

BITMAP "11110111"

BITMAP "11000011"

BITMAP "10000111"

BITMAP "10100111"

BITMAP "10100000"

BITMAP "11111111"

BITMAP "11100111"

BITMAP "11100111"

BITMAP "11000000"

BITMAP "11011110"

BITMAP "10011101"

BITMAP "10111101"

BITMAP "00111111"

BITMAP "01111111"

BITMAP "01111111"

 

The BITMAP stuff was generated with IntyColor. Is this the right way to define a bitmap for a 16x8 MOB?

 

Is there an example somwhere showing how to use DEFINE and SPRITE for such kind of MOB?

 

Thanks in advance

/Vincent

 

 

 

To answer your last question, check out the sample program called "Sprites" in the "Examples" folder. It doesn't use the "DOUBLEY" constant to double the vertical size, but it uses "ZOOMY2" to double the sprite's width. Just add "+ DOUBLEY" to the "Y" part, like this:

 

Before:

	SPRITE 0, ( 40+X) + VISIBLE + ZOOMX2,     20 + ZOOMY2, SPR00 + SPR_WHITE

After:

	SPRITE 0, ( 40+X) + VISIBLE + ZOOMX2,     20 + ZOOMY2 + DOUBLEY, SPR00 + SPR_WHITE

Also, check out the source code of the tutorial "Inty-B Intro." You can find the source code in the "Documents/Tutorials/Inty-B Intro" folder. This introductory demo showcases the sprite capabilities of the Intellivision and one of them is a double-resolution vertical sprite. The code is very well commented, so you should be able to find the part where it talks about the sprite size and see how it does it.

 

And of course, if all else fails, ask again here. :)

 

-dZ.

  • Like 1
Link to comment
Share on other sites

Hello,

thanks for the great support! :)

 

I did look at the examples, I am using an even sprite index and include the constant.bas code. I have tried to use the DOUBLEY as follows but I am stil getting the same error. I am obviously doing something bad somewhere but I can't figure out what. See below my code sample (I have beern re-using stuff from the sprites.bat example)

Thanks!

/Vincent

 

WAIT
DEFINE DEF00,2,runmanleft1
WAIT

X1=80
Y1=56

InfiniteLoop:
WAIT
SPRITE 0, X1 + VISIBLE + ZOOMX2,Y1 + ZOOMY2 + DOUBLEY, SPR00 + SPR_WHITE
IF CONT1.UP THEN IF Y1>0 THEN Y1=Y1-1
IF CONT1.DOWN THEN IF Y1<104 THEN Y1=Y1+1
IF CONT1.LEFT THEN IF X1>0 THEN X1=X1-1
IF CONT1.RIGHT THEN IF X1<168 THEN X1=X1+1
IF CONT1.BUTTON THEN SOUND 0,100,15 ELSE SOUND 0,,0 ' beeper
GOTO InfiniteLoop

Link to comment
Share on other sites

without seeing your complete code, this works without crashing:

It assumes constants.bas is in the same folder

include constants.bas
WAIT
 DEFINE DEF00,2,runmanleft1
 WAIT
 
 X1=80
 Y1=56
 
InfiniteLoop:
 WAIT
 SPRITE 0, X1 + VISIBLE + ZOOMX2,Y1 + ZOOMY2 + DOUBLEY, SPR00 + SPR_WHITE
 IF CONT1.UP THEN IF Y1>0 THEN Y1=Y1-1
 IF CONT1.DOWN THEN IF Y1<104 THEN Y1=Y1+1
 IF CONT1.LEFT THEN IF X1>0 THEN X1=X1-1
 IF CONT1.RIGHT THEN IF X1<168 THEN X1=X1+1
 IF CONT1.BUTTON THEN SOUND 0,100,15 ELSE SOUND 0,,0 ' beeper
 GOTO InfiniteLoop

runmanleft1:
 REM Running man left 1 bitmaps
 BITMAP "11110011"
 BITMAP "11110111"
 BITMAP "11000011"
 BITMAP "10000111"
 BITMAP "10100111"
 BITMAP "10100000"
 BITMAP "11111111"
 BITMAP "11100111"

 BITMAP "11100111"
 BITMAP "11000000"
 BITMAP "11011110"
 BITMAP "10011101"
 BITMAP "10111101"
 BITMAP "00111111"
 BITMAP "01111111"
 BITMAP "01111111"
Link to comment
Share on other sites

Hello!

constants.bas is not in my project folder.

It looked like the INCLUDE was working fine when I was testing with a 8X8 MOB. I will make a copy in my project folder and try again tonight.

I am also using a default Inty title screen. Not sure if special care is needed to free resources from the title screen.

Thanks

Vincent

Link to comment
Share on other sites

thanks for the great support! :)

Its a pleasure! New developers are always welcome to the Inty platform.

 

I have tried to use the DOUBLEY as follows but I am stil getting the same error.

Can you clarify what you mean by "error"? Is it an IntyBASIC compiler warning/error or a problem when you run the game? If its a compilation one, then attach a copy of your dos box screen capture or type the error out, exactly as you see it on screen.

Link to comment
Share on other sites

without seeing your complete code, this works without crashing:

It assumes constants.bas is in the same folder

That is not quite true. The SDK puts the "lib" folder in the library path of IntyBASIC, so you do not need to specify the location.

 

 

Hello!

constants.bas is not in my project folder.

It looked like the INCLUDE was working fine when I was testing with a 8X8 MOB. I will make a copy in my project folder and try again tonight.

I am also using a default Inty title screen. Not sure if special care is needed to free resources from the title screen.

Thanks

Vincent

Constant.bas is in the "lib" folder. Check out the document "IntyBASIC SDK README.txt," it has a list of every single file included in the SDK and where it is.

 

No special care is needed to free resources from the title screen. Nothing is committed in any special way, it just draws on the background.

 

 

Hello, this is not a compilation error. The rom crashes when I press a key in the title screen.

I will test again and come back with more speicific info if the problem remains.

Thanks

Ah! Just to be sure, you should add your code in the main project file, not in the "Title.bas" file. The default title screen code waits for a key press and returns control to the main program. Your code should go in the part that says "Your code goes here...," for example:

' =========================================================================
' IntyBASIC SDK Project: foo
' -------------------------------------------------------------------------
'     Programmer: [YOUR NAME]
'     Created:    01/17/2017
'     Updated:    01/17/2017
'
'     Project automatically generated by INTYNEW.
' -------------------------------------------------------------------------
' History:
' 01/17/2017 - foo project created.
' =========================================================================

	' Include useful predefined constants
	INCLUDE "constants.bas"

	' Remove the line below if you want to include your own custom title page.
	INCLUDE "title.bas"

	'
	' <Your code goes here...>
	'

InfiniteLoop:
	GOTO InfiniteLoop

The "InfiniteLoop" loop is there to prevent the machine from "falling through" into the graphics data. Consider it as the end of the "program segment." Alternatively, you could use that as your "game engine" loop (which it appears to be what you are doing right now).

 

It would certainly help if you could post your full code, or at least the relevant parts without any special or proprietary pieces you do not wish to share. Also, you could use the debugger to provide a "CPU Trace" of the final instructions that led to the crash. To do this, follow these steps:

  • Run the INTYDBUG command with the "/s" option (to halt CPU on start).
  • From the Command Console of the debugger, type "h" to enable CPU history recording. (If you do not see the Console, move the game window around. It should be behind it.)
  • Type "r" to run the emulation normally and wait for it to crash. The debugger will kick in again with the error message and a prompt.
  • Type "d" to dump the CPU history log.
  • Type "q" to quit the debugger.

Now, if everything went as expected, you should have somewhere in your project folder a file named "<PROJECT NAME>.hst". Just post that file here and we'll take a look at what happened.

 

Cheers!

-dZ.

Link to comment
Share on other sites

I meant the sample I posted cobbled from the code he posted assumes constants.bas was in the same folder because I was making no assumptions about his development environment. ;)

 

The off in the weeds error he mentions above can really only be dealt with if he posts his complete code since the error isn't with the code he did post.

Link to comment
Share on other sites

I meant the sample I posted cobbled from the code he posted assumes constants.bas was in the same folder because I was making no assumptions about his development environment. ;)

 

The off in the weeds error he mentions above can really only be dealt with if he posts his complete code since the error isn't with the code he did post.

He mentioned he was using the SDK. ;)

 

Anyway, I agree: full source code will help. The CPU trace can also help, but it is a lot more work and less clear to follow.

 

dZ.

Link to comment
Share on other sites

Hello,

what a great community, thanks everybody! :)

I got it working.

I have attached the code.

test1.bas is the version working. In this one I included the BITMAP definitions inside.

test1.bas.old is the version that is crashing at execution. In this one, the BITMAP definition are made in a separate file and imported through an INCLUDE statement. I re member it was working with a 8x8 MOB but I got in trouble with the 16x8 one.

 

Best Regards

/Vincent

  • Like 1
Link to comment
Share on other sites

Hello,

what a great community, thanks everybody! :)

I got it working.

I have attached the code.

test1.bas is the version working. In this one I included the BITMAP definitions inside.

test1.bas.old is the version that is crashing at execution. In this one, the BITMAP definition are made in a separate file and imported through an INCLUDE statement. I re member it was working with a 8x8 MOB but I got in trouble with the 16x8 one.

 

Best Regards

/Vincent

 

Hmmm... I do not see any attachment. Can you re-post?

 

-dZ.

Link to comment
Share on other sites

Just took a quick look and the reason it crashes is because you placed data before executable code. If you move the INCLUDE "my_obs.bas" to the end of test1.bas.old it should work fine.

 

I'd like to add that I implied it in my previous post, but I guess I should have been explicit: You should put all your graphics and procedures below the "InfiniteLoop" at the end.

 

If you take a look at the code generated in the "Title.bas," you'll notice that it has graphics data as well, but it has a "GOTO Main" statement to jump over them. Remember, the computer will process every statement as it goes from top to bottom, so if it encounters data or any other code that should not be part of that flow, you either need to route around it, or put it outside the main flow. :)

 

Since the file "my_mobs.bas" contains only graphics data, then I would do as GroovyBee suggests and just include it at the very bottom.

 

-dZ.

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