Re: A86: Re: Ports


[Prev][Next][Index][Thread]

Re: A86: Re: Ports




Read the file!  That was just the quick summary that I copied, the file has
all the details!

>> Summary (from file):
>>      port 0 - Screen Offset, WRITE ONLY
>Offset? Is this like some kind of second screen? Or is this the screen
memory
>area?

This is where video ram is located at.  It is normally at $fc00, but you can
set it to something else, like $f600.  This is how grayscale normally works.
You have two screens, say at $f600 and $fc00, then you flip back and forth.
Read the grayscale section at 86 Central for more info.

>
>>      port 1 - Keypad
>Is this where you read from the keypad directly? Could Mr. Nigel use this
to
>make Mario stop hoppin' up and down like a penguin or something? :)

The keypad is read directly in Mario.  The reason Mario keeps jumping up and
down is because he used the engine from Penguins and Penguins sucked!  To
keep this from happening, you need to set a flag (in your game) that says
that the jump was already recorded.  If the player is ready for another jump
and the flag is still set, don't jump.  When the player releases the jump
button, reset the flag.  In Sqrxz, this doesn't happen.  However, a gripe
about the Sqrxz jumping is that you always jump the full height, even if you
just tap the button.
In my side scroller engine, I decided to fix all of that.  The player jumps
depending on how long you hold down the button, just like in all the
Nintendo games you are used to.  One of the few things I did right.  I just
checked the code for the jumping/falling stuff.  If you remove all the blank
lines it is 105 lines long!  If anyone wants to see the jumping code, let me
know, it might be a little messy because it was one of the first things I
did, but it's all commented.

>
>>      port 2 - Contrast, WRITE ONLY
>Wait, if it can't be read, then how do fadein/fadeout programs know how to
set
>the contrast at the right level when it's done? I'm very interested in
using
>this in future programs...

Like the file says, you whenever you change the contrast, you must also save
it to $c008:

 ld a,($C008)     ; load contrast value
 inc a            ; increase the contrast
 ld ($C008),a     ; write it back to memory
 out (2),a        ; and to the port



Follow-Ups: