Jump to content
IGNORED

strange vram problem if Colecovision screen is skipped?


Recommended Posts

Hello

 

I have experienced some weird problem. If I skip the Colecovision "boot" screen, sometimes the vdp act strange compared to if I dont skip the "Boot" Screen. Its kind of weird, since the VDP is set up the same way inside the game.

 

In one of the game the screen stays black and in another game some vdp read is not right.

 

If I use the reset button at the Colecovision, it seems to running all right.

 

Ofcause everything work perfect in Bluemsx and MEKA (no madder if the "BOOT" screen is skipped or not).

 

 

Link to comment
Share on other sites

When you don't use the Colecovision screen, the VRAM isn't initialized.

 

I recommend you to fill all 16K of VRAM with zeros.

 

Emulators can hide the problem because always initialize VRAM to zeros.

 

Actually the game do full the 16k vram with zeros :) already.

 

I did try to do it one more time, same result, but it does not madder, since the game will use the Colecovision screen, when finished, just annoying when testing on real hardware...

Link to comment
Share on other sites

 

Actually the game do full the 16k vram with zeros :) already.

 

I did try to do it one more time, same result, but it does not madder, since the game will use the Colecovision screen, when finished, just annoying when testing on real hardware...

Then there is a chance you've a timing problem with interruptions, so pressing Reset reinits everything to a known state.

 

I suggest you to put a HALT instruction after doing VDP initialization (obviously with interrupts enabled) this way your program "gets-in-sync" with VDP.

 

The Z80 stops in the HALT instruction until a VDP interrupt is received.

Link to comment
Share on other sites

My bet is that a call to MODE_1 would do whatever thing you're missing would be:

 

MODE_1 EQU 1f85h

 

You must be missing something in your set up for it to give you problems. I've never needed to do a halt, FWIW.

Link to comment
Share on other sites

Well that being the situation, there is probably a problem with bottom filling some of the bottom bits in one of the registers. Can you post what values you are filling into all of the registers?

 

It should be those: db 2,$82,6,255,3,54,7,1

 

(decimal) except the $82 ;)

 

but it could be like Nanochess said, something with the interrupt, use a HALT first?

Link to comment
Share on other sites

The video chip is slow and might getting out of sync with the CPU. I would try using a HALT or NOP command to give the GPU a chance to catch up. I use the delay() command in my game if the GPU is showing graphic corruption. It usually solve that problem.

Link to comment
Share on other sites

So the good news is that your VDP register set up is perfect, as I'm sure you probably knew.

I know from other threads that you don't normally use the BIOS, which is fine. And from your video mode set up, I see that you don't request the VDP interrupt which causes the NMI (Z80 non-maskable interrupt) on the VDP.

Do you use the NMI later? If not, your difference in behaviour would make sense, since you only sync to the VDP if the title screen is on or if the reset button is hit. So then the solution really is to turn on the VDP interrupt, and use HALT, like nanochess suggested. The NMI is vectored to the jump table near the beginning of the cartridge map:


    ORG    8000h

; Tables
    DB    055h,0aah    ;Magic number
    DW    SPRITE_NAME    ;Pointer to sprite name table
    DW    SPRITE_ORDER    ;Pointer to sprite order table
    DW    SPRITE_WORKING    ;Pointer to WR_SPR_NM_TBL work area
    DW    CONTROLLER_BUFFER    ;Pointer to hand controler input area
    DW    MAIN_PROG    ;Entry point to game
; Vectors
    JP    RST08        ;Restart 8
    JP    RST10        ;Restart 10h
    JP    RST18        ;Restart 18h
    JP    RST20        ;Restart 20h
    JP    RST28        ;Restart 28h
    JP    RST30        ;Restart 30h
    JP    MASK_INT    ;Maskable interrupt (used by spinner)
    JP    VDPINT        ;NMI interrupt (used by VDP 60 times per second)
; Title screen name
    DB    'ADAMCON 11',1eh,1fh
    DB    '/PRESENTS ADAM NEWS NETWORK'S'/1999'
    ;1dh is copyright symbol
    ;1eh,1fh is trade mark symbol

If you don't want a handler for the VDP interrupt, you can always do RETN there. But the recommended minimum is to have a handler that saves the registers (probably just AF really), reads the status register (which clears the interrupt on the VDP), restores the registers (probably just AF really) and then RETN.

 

Link to comment
Share on other sites

  • 8 years later...
39 minutes ago, MrDave said:

Funny i came across the problem today... if i don't do the title screen my call rnd function does not work..hl returns zeros..

Random functions need a seed value to start with, so they need to be started with some non-zero value.  I usually use a fixed value at start-up and then use the time that has passed from when the console has started until the user starts the game, and re-seed the random numbers.  That way you get some human randomness (chaos) added (and thus better random numbers).

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