Can't Get Background To Turn Pink

Discussion in 'Sega Discussion' started by SegaDev, Nov 14, 2014.

  1. SegaDev

    SegaDev Member

    Joined:
    Nov 14, 2014
    Messages:
    15
    Likes Received:
    0
    I am starting to code for the Sega Genesis and am following the Big Evil Corporation Tutorials with some modifications from the friendly people at SonicRetro. Sadly i made it up to where it says the screen should turn pink, but so far i haven't been able to do that as it's still black like the last 2 tutorials. I am posting my code in hopes someone can figure out what i'm doing wrong.
    Any assistance in this matter would be greatly appreciated.

    Sincerely,

    SegaDev
     
    Last edited: Nov 15, 2014
  2. SegaDev

    SegaDev Member

    Joined:
    Nov 14, 2014
    Messages:
    15
    Likes Received:
    0
    Sorry for double posting but, it seems my original message has mysteriously vanished(Not deleted by a mod cause if it was there wouldn't a link to the thread on the Sega Discussions forums) so i'm reposting it.

    I am starting to code for the Sega Genesis and am following the Big Evil Corporation
    Tutorials
    with some modifications from the friendly people at SonicRetro. Sadly i made it up to where it says the screen should turn pink, but so far i haven't been
    able to do that as it's still black like the last 2 tutorials. I am posting a link to my code in hopes someone can figure out what i'm doing wrong.

    Any assistance in this matter would be greatly appreciated.

    Sincerely,

    SegaDev

    Source Code: Link
     
  3. Headcrab

    Headcrab (BigEvilCorporation)

    Joined:
    Dec 21, 2011
    Messages:
    246
    Likes Received:
    67
    Hello! The first couple of posts contained many (many!) mistakes which caused some spurious results, mainly the VDP register settings. It's taken around two years to find them all :p

    Here's a fully working example which runs on real hardware, it'll be a better codebase to get started with: http://www.mediafire.com/download/h4qmqf65eoki7yb/MD_PongTest.zip

    I intend to do some housekeeping on my early blog posts soon to correct the mistakes I've found and clarify any confusion.

    Let me know how you get on :)
     
  4. SegaDev

    SegaDev Member

    Joined:
    Nov 14, 2014
    Messages:
    15
    Likes Received:
    0
    Hi, i have fixed my code so it is on par with the source code you have provided me. However it still isn't working for me and i get a checksum failed error and a black screen instead of a pink one. I have double checked my code to make sure there were no typos. I am lining to the latest revision of my code in hopes you can figure out what i am doing wrong. Any assistance in this matter would be greatly appreciated.

    Sincerely,

    SegaDev

    Source Code: Link
     
  5. Headcrab

    Headcrab (BigEvilCorporation)

    Joined:
    Dec 21, 2011
    Messages:
    246
    Likes Received:
    67
    Ok, managed to find the issues. Seems to be a problem mixing old and new code from the blog, I changed quite a lot over time and a few things don't square up. I'll see if I can find some time this weekend to correct the articles.

    1. CRAM address doesn't match the VDP register value

    Set up the VDP to write to CRAM using 0xF0000000:

    move.l #0xF0000000, 0x00C00004

    2. Only writing 10 VDP registers (#11 is decimal, -1 for counter), there are 24:

    move.l #0x17, d0

    3. Writing the registers a longword at a time, I think it needs to be a word at a time (no autoincrement on control bus? I can't find anything to confirm this):

    move.w (a0)+, ($C00004)

    4. The register cleanup code is wrong, I've just commented it out for now



    Granted, some of the comments in the code don't match up to what it actually does. Maybe one day I'll write an article with no mistakes :p

    Source: http://www.mediafire.com/download/wcr5n8lnd6c2amj/md_pink.zip

    [​IMG]
     
    Last edited: Nov 26, 2014
  6. Headcrab

    Headcrab (BigEvilCorporation)

    Joined:
    Dec 21, 2011
    Messages:
    246
    Likes Received:
    67
    Oh, about the checksum fail, that's a feature of some emulators and isn't required to be correct on real hardware (I have tested the code above running on a devkit). It's up to the programmer to implement their own checksum test.

    If you'd like to fix up the checksum for completeness, have a look at the batch file in the Sonic 1 disassembly for ASM68K, on SonicRetro.
     
sonicdude10
Draft saved Draft deleted
Insert every image as a...
  1.  0%

Share This Page