Jump to content
atari2600land

GoSub for INTV

Recommended Posts

Cool as well! I can use this in my game, right? Here's what it would look like. I worked on a level 14 and made it before I saw that. When I put that in there, I saw that I can switch back and forth from using mode 0 and mode 1. Not only that, it used only 1.5 k!

Yes you can use it, but not as is, make it better. Put back your text and name, add text to say Press a Button to continue, add a Play music statement...Also, notice what happens after Game Over returns to the title screen.

 

This happens because the Title uses 43 cards, numbered 0 thru 42. You then use DEFINE for your sprites but you are using 0,1 etc thus redefining parts of the cards used by the title. What I do is start DEFINEs for sprites from 63 And work backwards towards the 43 so you won't clobber the title. Currently when you return to the Title screen it appears you are not resetting or hiding the Sprites and thus they are picking up the Gram reDEFINEing. If you DEFINE sprites like

DEFINE 63,1,Octopus

 

then you can bring back your sprites to the title screen the way you used to have. You could then make the Title Eyes "follow" the Octopus sprite chasing the Submarine sprite. Have them randomly on different y coordinates everytime they wrap.

 

 

 

 

 

 

 

.

Share this post


Link to post
Share on other sites

What is the cycle cost of those extra GOSUBs? Is it essentially insignificant?

 

By the way, what is a cycle exactly? Is it 1hz? The CPU that Inty uses is technically a good couple hundred thousand hertz slower than the 2600's 6507, yet Inty strikes me as having more processing power. Why is that, or am I just mistaken?

 

The VBLANK (vertical blanking) event of the NTSC TV signal interrupts the CPU every 1/60th of a second, or at 60Hz. The CPU itself is faster than in the Atari VCS (I think it runs at close to 1MHz, though it has been under-clocked in the NTSC Intellivision to about 900KHz).

 

Here are some useful estimates taken from the SDK-1600 documentation:

    NTSC Intellivision Timing Parameters     
 
    Parameter                                   Measurement
    NTSC STIC Clock Rate                        3579545 Hz
    STIC Scanlines per Frame                    262 scanlines
    Active Scanlines per Frame                  192 scanlines
    Actual Effective Frame Rate                 59.92 Hz
    CP-1600 Clock Rate (NTSC/4)                 894886.25 Hz
    CPU Cycles per Frame:
     -- Display disabled                        14934 cycles
     -- Display enabled, vertical delay == 0   ~13518 cycles
     -- Display enabled, vertical delay > 0    ~13572 cycles
    CPU Cycles per Scanline                     57 cycles
    CPU Cycles available in Bus Copy mode       3780 - 3790 cycles
 
 
    PAL Intellivision Timing Parameters (ESTIMATES)
 
    Parameter                                   Measurement
    PAL STIC Clock Rate                         4000000 Hz
    STIC Scanlines per Frame                 ?? 312 scanlines
    Active Scanlines per Frame                  192 scanlines
    Actual Effective Frame Rate                ~50.00 Hz
    CP-1600 Clock Rate (PAL/4)                  1000000 Hz
    CPU Cycles per Frame:
     -- Display disabled                       ~20000 cycles
     -- Display enabled, vertical delay == 0 ??~18584 cycles
     -- Display enabled, vertical delay > 0  ??~18638 cycles
    CPU Cycles per Scanline                  ?? 57 cycles
    CPU Cycles available in Bus Copy mode    ?? 8840 - 8850 cycles

This is why every time you have a WAIT statement in your code, it makes the program wait until the next VBLANK interrupt request, essentially "losing" one frame (or the time in between).

 

Cool as well! I can use this in my game, right? Here's what it would look like. I worked on a level 14 and made it before I saw that. When I put that in there, I saw that I can switch back and forth from using mode 0 and mode 1. Not only that, it used only 1.5 k!

 

I like the new title screen! Fantastic! Although I would like to still see the sub moving around it to give it a more dynamic feel. :)

 

I did find a bug: the MOBs or BACKTAB cards are not properly reset when going from the "Game Over" screen to the "Title" screen.

 

-dZ.

Share this post


Link to post
Share on other sites

But the sprites won't display properly if I change the first number to 63.

Show the define statements for the sub and the matching sprite statements, I suspect what the problem is but I'm not near a real computer to check your last bas file

Share this post


Link to post
Share on other sites

Adding music data screws up the title screen.

 

Yep, I've forgot to add that to IntyBASIC manual. Once you activate music, the number of GRAM definable per frame are reduced from 18 to 16.

Share this post


Link to post
Share on other sites

Yep, I've forgot to add that to IntyBASIC manual. Once you activate music, the number of GRAM definable per frame are reduced from 18 to 16.

I would think that the Defines and Screen command would be done before starting music, or are you saying that once we add a reference to Play that the included code affects ALL define statements in the project?

Share this post


Link to post
Share on other sites

Yep, I've forgot to add that to IntyBASIC manual. Once you activate music, the number of GRAM definable per frame are reduced from 18 to 16.

Looking at the latest epilogue code I'd just move the music player to after the GRAM cards are reprogrammed on the fly. There are also a few places where cycles can be clawed back in your ISR.

  • Like 1

Share this post


Link to post
Share on other sites

I would think that the Defines and Screen command would be done before starting music, or are you saying that once we add a reference to Play that the included code affects ALL define statements in the project?

 

Right. Once you use PLAY, all DEFINE statements are affected.

 

Looking at the latest epilogue code I'd just move the music player to after the GRAM cards are reprogrammed on the fly. There are also a few places where cycles can be clawed back in your ISR.

 

Because the GRAM cards redefinition is kind of "lenghty" I made it that way so the music timing keeps the same while the IntyBASIC program is updating the GRAM.

 

It's a good trick to keep crystal clear timing for ear :)

 

I'm open to your suggestions for intybasic_epilogue.asm because I don't expect big changes in the future and I know the importance of cycles for doing more complex games.

 

Also I liked your idea for fixed-point arithmetic, the processing of number in lexical analysis, the addition and substraction are kind of things not so complicated that could be useful for users.

  • Like 1

Share this post


Link to post
Share on other sites

Because the GRAM cards redefinition is kind of "lenghty" I made it that way so the music timing keeps the same while the IntyBASIC program is updating the GRAM.

 

It's a good trick to keep crystal clear timing for ear :)

In my experience most people can't detect anything wrong with 50Hz PAL music played at 60Hz (by skipping a sound register update 1 in every 6 frames like you are doing already) so a little jitter in the music player should be acceptable.

 

I'm open to your suggestions for intybasic_epilogue.asm because I don't expect big changes in the future and I know the importance of cycles for doing more complex games.

OK. When I get some free time I'll PM you a breakdown.

 

Also I liked your idea for fixed-point arithmetic, the processing of number in lexical analysis, the addition and substraction are kind of things not so complicated that could be useful for users.

:cool: It'll certainly make RAM go much further with IntyBASIC's more advanced users.

  • Like 1

Share this post


Link to post
Share on other sites

Right. Once you use PLAY, all DEFINE statements are affected.

 

 

 

Time to add a new parameter to IntyColor, maybe -P, or make 16 the new default in the generated .bas. You can add it when you add that other feature we talked about...;-)

  • Like 1

Share this post


Link to post
Share on other sites

But the sprites won't display properly if I change the first number to 63.

I looked at your last posted .bas

 

Rem You define the first 8 GRAM cards of 64

DEFINE 0,7,sprites

 

Rem You then refer to the Sprites using this notation:

SPRITE 4,X1+$300,Y1+$100,$1820

SPRITE 0,X1+$300,Y1+$100,$1800

 

The last parameter is sent to the STIC as is, but Nanochess showed me a trick to reference it in a way more understandable, and more importantly, in line with the 0-63 card definition format.

 

 

Instead, I'd do this

Rem define the first 8 sprites using upper GRAM cards instead of the first 7,

Rem if using an IntyColor generated screen, start somewhere above the number referenced in the generated file --> ' 43 bitmaps

DEFINE 50,7,sprites 'Define 7 sprites, store them at GRAM cards 50 thru 56
'
'
SPRITE 4,X1+$300,Y1+$100,((256+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)*8+1
SPRITE 0,X1+$300,Y1+$100,((256+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)*8+1

Where xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx is the card number above, starting at 50 to match the card you Defined. The +1 at the end is the color (in Hexidecimal)

 

I also use the Constants provided earlier to just refer to the color.

SPRITE 4,X1+$300,Y1+$100,((256+51)*8+X_GRN
SPRITE 0,X1+$300,Y1+$100,((256+50)*8+X_RED

REM colors for color stack, border, etc

 

CONST C_BLK = $0 ' Black

CONST C_BLU = $1 ' Blue

CONST C_RED = $2 ' Red

CONST C_TAN = $3 ' Tan

CONST C_DGR = $4 ' Dark Green

CONST C_GRN = $5 ' Green

CONST C_YEL = $6 ' Yellow

CONST C_WHT = $7 ' White

CONST C_GRY = $8 ' Grey

CONST C_CYN = $9 ' Cyan

CONST C_ORG = $A ' Orange

CONST C_BRN = $B ' Brown

CONST C_PNK = $C ' Pink

CONST C_LBL = $D ' Light Blue

CONST C_YGR = $E ' Yellow-Green

CONST C_PUR = $F ' Purple

 

rem colors for backtab or mob a

CONST X_BLK = $0 ' Black

CONST X_BLU = $1 ' Blue

CONST X_RED = $2 ' Red

CONST X_TAN = $3 ' Tan

CONST X_DGR = $4 ' Dark Green

CONST X_GRN = $5 ' Green

CONST X_YEL = $6 ' Yellow

CONST X_WHT = $7 ' White

CONST X_GRY = $1000 ' Grey

CONST X_CYN = $1001 ' Cyan

CONST X_ORG = $1002 ' Orange

CONST X_BRN = $1003 ' Brown

CONST X_PNK = $1004 ' Pink

CONST X_LBL = $1005 ' Light Blue

CONST X_YGR = $1006 ' Yellow-Green

CONST X_PUR = $1007 ' Purple

 

Edited by Tarzilla

Share this post


Link to post
Share on other sites

OK, so music isn't possible with this setup apparently, so I tried to put some text in there and while lowercase just gets a bunch of symbols, uppercase works just fine, but it switches to a black background. How would I change it to blue?

post-9475-0-14440400-1411858360_thumb.gif

Share this post


Link to post
Share on other sites

OK, so music isn't possible with this setup apparently, so I tried to put some text in there and while lowercase just gets a bunch of symbols, uppercase works just fine, but it switches to a black background. How would I change it to blue?

 

The COLOR parameter for PRINT AT it's OR'ed with the letter code, put the STIC value you would write directly in screen memory

Share this post


Link to post
Share on other sites
Yep, I've forgot to add that to IntyBASIC manual. Once you activate music, the number of GRAM definable per frame are reduced from 18 to 16.

 

 

OK, so music isn't possible with this setup apparently, so I tried to put some text in there and while lowercase just gets a bunch of symbols, uppercase works just fine, but it switches to a black background. How would I change it to blue?

Sure music is possible, Nanochess said if Play is used anywhere in your code the DEFINE statement gets capped to 16 card definitions at a time instead of 18.

Find this

MODE 1

WAIT

DEFINE 0,18,titlescreen_bitmaps_0

WAIT

DEFINE 18,18,titlescreen_bitmaps_1

WAIT

DEFINE 36,7,titlescreen_bitmaps_2

WAIT

 

 

Update the Defines to this:

DEFINE 0,16,titlescreen_bitmaps_0

WAIT

DEFINE 18,16,titlescreen_bitmaps_1

WAIT

DEFINE 36,11,titlescreen_bitmaps_2

WAIT

 

 

Then modifiy the bitmaps definition to be no more than 16 per chunk, pushing the last two of _0 into _1, then pushing the last 4 of _1 into _2

titlescreen_bitmaps_0:

DATA $FFFF,$FFFF,$FFFF,$80C0

DATA $FFFF,$FFFF,$FFFF,$0103

DATA $F3FD,$E7E7,$E3E7,$F0E0

DATA $FCFF,$E0F0,$80C0,$0F03

DATA $3FFF,$0307,$0101,$E0C0

DATA $0000,$0000,$0C3C,$3C0C

DATA $FCFF,$C0E0,$8080,$0703

DATA $3FFF,$070F,$0103,$F0C0

DATA $FFFF,$FCFE,$C1F1,$0F03

DATA $E0F8,$80C0,$0080,$0000

DATA $E080,$F0F0,$F8F0,$F8F8

DATA $FEFF,$F8FC,$F8F8,$F0F8

DATA $0000,$0101,$1F1F,$3E3E

DATA $8080,$0000,$FFE0,$0000

DATA $7E7F,$787C,$F878,$F0F8

DATA $0000,$0101,$1F1F,$3F3F

DATA $8080,$0000,$E0E0,$C0E0

DATA $7C7E,$7078,$7070,$F070

titlescreen_bitmaps_1:

DATA $8080,$0000,$E0E0,$C0E0

DATA $7C7E,$7078,$7070,$F070

DATA $0101,$0202,$3F3F,$0000

DATA $0000,$0000,$FFC0,$031F

DATA $F0F0,$E0F0,$E0E0,$C0E0

DATA $3F3F,$7F3F,$7F7F,$FFFF

DATA $C0C0,$81C0,$8181,$0381

DATA $F8F8,$F0F8,$F0F0,$E0F0

DATA $1010,$2020,$3F3F,$0000

DATA $0001,$0000,$81C1,$0703

DATA $F8F8,$F8F8,$F8F8,$F8F8

DATA $F0F0,$E0F0,$E0E0,$F0E0

DATA $3E3E,$3F3F,$0808,$1010

DATA $0000,$81C1,$0101,$0303

DATA $3F3F,$3F7F,$0808,$1010

DATA $C0C0,$81C1,$0301,$0F03

titlescreen_bitmaps_2:

DATA $FFF8,$C0FF,$C0C0,$E0C0

DATA $F000,$7FFF,$1010,$2020

DATA $0103,$0383,$0703,$1F07

DATA $C0C0,$80C1,$8080,$C080

DATA $FFFF,$FEFF,$1010,$2020

DATA $0303,$0707,$0F07,$3F0F

DATA $E0E0,$C0C0,$C0C0,$8181

DATA $0000,$FFFF,$8080,$0000

DATA $0103,$0381,$0703,$1F07

DATA $FFFF,$FFFF,$FFFF,$3F7F

DATA $F8F8,$F8F8,$F8F8,$E0F0

Share this post


Link to post
Share on other sites
so I tried to put some text in there and while lowercase just gets a bunch of symbols, uppercase works just fine

That's because the title screen is using Foreground/Background mode, the manual says you lose the lower case characters when using it.

Share this post


Link to post
Share on other sites

I changed the bitmaps definition to what you said above and this is the result. Do I have to change the titlescreen_cards as well?

 

post-9475-0-91184700-1411868607_thumb.gif

Share this post


Link to post
Share on other sites

Never mind, I did it myself! Please note two things:

1. The music on the title screen is just temporary test music. I don't really know how to compose chiptunes, but I'll take a stab at composing a little song. You can help me, too, if you want.

2. Once you complete level 14, the game goes wacko only because I haven't programmed anything beyond level 14. Just hit F12 in jzintv to reset the game.

Edited by atari2600land

Share this post


Link to post
Share on other sites

OK, I added some more to the song. Tell me what you think.

 

 

I like it, it's cute. It reminds me of old video games like Pooyan or Mr. Do. But then, that's just it. When I play a game with a submarine hunting treasures and being stalked by an octopus, I don't think of cute music like that. It needs something that says more "adventure" and less "fairy tale."

 

-dZ.

Share this post


Link to post
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...