Jump to content
IGNORED

Reading INPT3


vdub_bobby

Recommended Posts

Can I reliably count on the value in INPT3 if I never write a 1 to bit 7 of VBLANK?

 

EDIT: To be specific, I want to replace this:

   sta HMCLR
  sec

with this:

   asl HMCLR

Which should strobe HMCLR and shift INPT3 into the carry.

 

ANOTHER EDIT:

I just realized that this will work as well:

   lsr HMCLR

Which will strobe HMCLR and shift bit 0 of HMCLR ($2B) into the carry - which should always be the lowest bit of %x0101011. Right? That seems to work in z26 and Stella, and checking a trace log of z26 seems to confirm that the value is consistent.

Edited by vdub_bobby
Link to comment
Share on other sites

Can I reliably count on the value in INPT3 if I never write a 1 to bit 7 of VBLANK?

I wouldn't.

   lsr HMCLR

Which will strobe HMCLR and shift bit 0 of HMCLR ($2B) into the carry - which should always be the lowest bit of %x0101011.  Right?  That seems to work in z26 and Stella, and checking a trace log of z26 seems to confirm that the value is consistent.

 

I wouldn't recommend that either. Although a floating data bus will usually read the last thing that appeared on it, relying upon such behavior is IMHO begging for trouble. I know there have been some carts in the past that have relied upon such things, but things like bus capacitance, crosstalk, cartridge-selector boxes, ribbon cables (think Flashback II), etc. can all throw such expected behaviors out the window.

Link to comment
Share on other sites

   lsr HMCLR

Which will strobe HMCLR and shift bit 0 of HMCLR ($2B) into the carry - which should always be the lowest bit of %x0101011.  Right?  That seems to work in z26 and Stella, and checking a trace log of z26 seems to confirm that the value is consistent.

 

I wouldn't recommend that either. Although a floating data bus will usually read the last thing that appeared on it, relying upon such behavior is IMHO begging for trouble. I know there have been some carts in the past that have relied upon such things, but things like bus capacitance, crosstalk, cartridge-selector boxes, ribbon cables (think Flashback II), etc. can all throw such expected behaviors out the window.

905274[/snapback]

Will it be consistent in the emulators?

Link to comment
Share on other sites

Will it be consistent in the emulators?

905276[/snapback]

 

I believe older emulators would return the 'undefined' bits as zero, even though when using real hardware they will usually hold the last thing that was on the bus. I believe newer emulators will return the last thing that was on the bus, though I don't know if they all monitor such things carefully. For example:

  ldx #$80
 lda $FF80,x

The last thing on the bus prior to the load would be the contents of ROM address $1F00. On the other hand:

  ldx #$80
 lda $0480,x

here the last thing on the bus should be the $04 of the instruction although it will have had an extra cycle to 'fade away'.

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