Jump to content
IGNORED

how to reset custom VBI to normal operation?


Recommended Posts

Hi.

 

I'm writing a program in which I have my own VBI routine.

 

At the beginning of the program I have thise code:

 

LDY #<VBI
LDX #>VBI
LDA #$06
JSR $E45C

<the main routines of the program; not needed for this post to type that all over>

VBI  some code
      JMP $E45F

 

This works perfect.

 

But... the program itselfs has a normal EXIT (at some point there is a RTS, and the program exits to DOS)

But then the VBI keeps running.

 

How do I re-initialise the VBI so it is just the way it WAS before I had my program?

 

Thanks

Marius

Link to comment
Share on other sites

Do the same as before, but with E4/5F in X/Y.

 

Or if you're real fussy,

 

LDY $E460

LDX $E461

 

But the save/restore method might be more desirable given that something before you might have already been using the vector, e.g. a Time display routine.

 

You could even get real tricky and create a VBI chain, e.g. save the old vector and test the high byte, if it's less than $C0 then it means something is already using it.

Link to comment
Share on other sites

Here's how I did it (actually may have nicked this from someone else :) ) It doesn't take into account anything else that may have hooked the VBI before my program.

 

SETVBV = $E45C ;vector to set VBLANK parameters

XITVBV = $E462 ;vector to process deferred VBLANK

 

_reset_vbi: lda #7 ; deferred vblank

ldx #>XITVBV ; hi address of vbi routine

ldy #<XITVBV ; lo address of vbi routine

jsr SETVBV ; jump to os set vblank routine

rts

Edited by Shawn Jefferson
Link to comment
Share on other sites

Is this also a good way? (EDIT: oh now I read that is just what Bryan advised...)

 

The first thing in the program is:

storing $222 and $223 in a 'safe place' (labels stored222 and stored223) ... and right before the end of the program (the RTS) I restore the info this way:

 

LDY stored222
LDX stored223
LDA #$06
JSR e45c

 

This worked too. I guess this is the 'safest' way... so that everyting was just the way it was before lauching the program.

 

Am I right or this a wrong method?

 

Thanks

Marius

 

p.s. Mapping the Atari writes that Stage1 VBI address is in VVBLKI ($222 and $223).

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