Sega Master System / Mark III / Game Gear|
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew
ldsat is being an idiotPosted: Mon Jul 19, 2021 11:41 am
So I have this message, "pause", I want to put on my Game Gear screen. I mapped out the letters like so. There are three tiles (consisting of the five letters).
.equ pausedlettersvp $c031
.equ pausedlettershp $c0e2
.equ pausedletterscc $c0e3
Apparently, the only way to put them onto the screen is to call "ldsat", which is this:
ldsat ld hl,$3f00 ; point to start of SAT in vram.
call vrampr ; prepare vram to recieve data.
ld b,255 ; amount of bytes to output.
ld c,$be ; destination is vdp data port.
ld hl,satbuf ; source is start of sat buffer.
otir ; output buffer to vdp.
But in doing so, all the other sprites on screen move one pixel before stopping completely. I want to stop them from doing so. This is how I'm putting the letters on screen:
ld hl,pausedlayout ; point to pause init data.
ld de,pausedlettersvp ; target the pause sat buffer.
ld bc,8 ; write 8 vpos bytes.
ldir ; do it.
ld hl,pausedlayout+8 ; point to pause init data #2.
ld de,pausedlettershp ; target buffer again.
ld bc,12 ; write 12 hpos and cc bytes.
...followed, of course, by the notorious "call ldsat."
Right now I have a work around involving tons more code, but I figure if there was a way to not have it in there, that would be really nice.
||Posted: Fri Jul 23, 2021 4:27 pm|
Routine "ldsat" looks correct. The error you're describing sounds like one of two errors so far... Either you're writing into VRAM outside of the VBlanking period and getting odd writes, or you are not writing to your SAT Buffer correctly. It does looks like you are writing to a SAT Buffer just fine so that just leads to timing of the VRAM write.
This is just speculation though...
I have no clue what the location of your SAT Buffer is. I also have no clue how you initialized the VDP so its not quite easy to see your issue with what you've provided.
Lastly just for ease... personally I think separating and using a call for preparing VRAM in a SAT Update routine is not needed. Its a bit unnecessary as its not a large function as it is. It can just be added to your Update SAT routine for a very slight speed boost and ease of readability.
This is how I perform my "ldsat" via a macro
;requires pointer to SAT Buffer (by default use $c000)
;prep the vdp
ld a,$3f | $40
;write 256 bytes to the vdps SAT
ld hl, \1 ;insert SAT location here
||Posted: Sun Jul 25, 2021 2:35 pm|
You were correct, I was getting odd writes for writing into the VRAM outisde of the blanking period. I think. I also think I fixed it using your advice and moved the position of "call ldsat" and "wait" so it comes before where I write the letters on screen and that seems to have worked a lot better.
The game pauses when the start button is beginning to be held, then the word "pause" comes on before it's released. Then when it's released, the game is still paused. Another press of the release button and it's still paused until the player depresses the start button and the game continues. I can do this since this is a Game Gear game I'm working on.
||Posted: Mon Jul 26, 2021 3:24 am|
It sounds so backwards how Sega handled Pause and Reset buttons.
The Pause button forces the console to respond to it, whereas Reset is treated like a gameplay button that can be ignored?
I would guess that touching the Pause button keeps the interrupt active during the time it is pressed in to the console? (and thus would only leave the interrupt after the user has lifted their finger?)
Like any other game controller button would it register as "pressed" multiple times in the time it takes a human to physically press and then lift their finger even for "one" press?
I would assume the response then is that you would want the Pause interrupt to merely set a flag indicating the pause button has been pressed. Then have some code later on execute the actual pause routine, and clear the flag.
(of course you would want the Pause function to handle switching between a "pause on" and "off" state as appropriate)
Oh, it's a Game Gear game. Well, then the same thing for the Start button. After activating pause mode when the user touches the Start button, you would want to wait until the user has let go of the start button, before trying to detect a second Start press to stop pause mode.
||Posted: Mon Jul 26, 2021 8:11 am|
|I believe the pause button is routed through a chip that debounces it and also makes it edge-triggered, so holding pause gets you only one NMI. But yes indeed, having pause go to NMI was a strange choice.|