68K source

Discussion in 'Sega Discussion' started by NexusEnix, Nov 20, 2010.

  1. NexusEnix

    NexusEnix Member

    Joined:
    Nov 16, 2010
    Messages:
    14
    Likes Received:
    0
    Hi,

    I am using a 68k assembly program (Easy 68K) so I can start learning and exploring the language and hopefully begin to understand more about coding for the M68k, maybe making some basic demo's for the Megadrive. My question is this. How would I convert the source code into sometime that could be read by an emulator. Also is there a specific syntax for the Motorola 68000 or is it generic among the range of processors.

    Thanks for your time.:)
     
    Last edited: Nov 20, 2010
  2. Piratero

    Piratero Peppy Member

    Joined:
    Feb 28, 2009
    Messages:
    367
    Likes Received:
    8
    You need an assembler. That the Megadrive might have a special header. You'll need to either find a program to inject that header or write one yourself.
     
  3. TmEE

    TmEE Peppy Member

    Joined:
    Aug 13, 2008
    Messages:
    362
    Likes Received:
    1
    Write your code, assemble... that's how easy it it.

    There is a header, but its not mandatory, except for the vector table.

    DC.x is your friend when it comes to the header :p

    (is here a code tag...? standard formatting ruins everything here... especially spaces)
     
    Last edited: Nov 22, 2010
  4. NexusEnix

    NexusEnix Member

    Joined:
    Nov 16, 2010
    Messages:
    14
    Likes Received:
    0
    @Piratero: Oh, okay, I think I know what you mean thank you for your help.

    @TmEE: Awesome! That's just what I needed to know. Thank you very much.
     
    Last edited: Nov 22, 2010
  5. segaloco

    segaloco Enthusiastic Member

    Joined:
    Jun 25, 2009
    Messages:
    531
    Likes Received:
    3
    Oh TmEE~

    Anyway, for a bit more than he put there

    (doesn't display all spaces :dammit:)

    Okay, that first one I said, the dc.b 'J ' are supported devices (in any order):

    J = Joystick (Standard controllers)
    0 = Joystick for MS
    K = Keyboard
    R = SERIAL (RS232C)
    P = Printer
    T = Tablet
    B = Control Ball
    V = Paddle Controller
    F = FDD (Floppy Disks)
    C = CD (Sega CD :p)
    M = Mouse
    6 = 6 Button Pad
    4 = Multi-tap


    Okay, the line dc.b ' ', %0010000, %00100000:

    In the ' ' put RA to enable external RAM
    First bit in the format %1x1yz000
    x = 1 if Backup (SRAM) and 0 if Not backup (EXTERNAL RAM)
    yz = 10 for even addr, 11 for odd adr, 00 for both

    Now for the region codes:
    J = Asia, NTSC (Japan)
    E = Overseas, PAL (Europe)
    U = Overseas, NTSC (USA)
    0 = No region (As in none supported...why this exists..no clue)
    1 = Asia, NTSC (Japan)
    2 = Asia, PAL (China???)
    3 = Asia, NTSC and Asia, PAL (Japan and (China???))
    4 = Overseas, NTSC (USA)
    5 = Asia, NTSC and Overseas, NTSC (Japan and USA)
    6 = Asia, PAL and Overseas, NTSC ((China???) and USA)
    7 = Asia, NTSC, Asia, PAL, and Overseas, NTSC (Japan, (China???), and USA)
    8 = Overseas, PAL (Europe)
    9 = Asia, NTSC and Overseas, PAL (Japan and Europe)
    A = Asia, PAL and Overseas, PAL ((China???) and Europe)
    B = Asia, NTSC, Asia, PAL, and Overseas PAL (Japan, (China???), and Europe)
    C = Overseas, NTSC and Overseas, PAL (USA and Europe)
    D = Asia, NTSC, Overseas, NTSC, and Overseas, PAL (Japan, USA, and Europe)
    E = Asia, PAL, Overseas, NTSC, and Overseas, PAL ((China???), USA, and Europe)
    F = All of them (really didn't feel like typing all that out :p)

    Edit: Oh, and to suggest an assembler, either SNASM68K or ASM68K are usually suggested for newbies. (asmx, if you can compile it, is pretty good too. If you read the docs you can see that it supports embedding different architectures of code in stuff, so you can embed your z80 code in your 68000 code if you plan on using the z80, and then assemble it in one sweep instead of incbin crap :p)

    Edit2: Oh, and if you go with asmx, ABSOLUTELY DON'T FORGET TO ALWAYS PASS -b 0 as an option. If you don't it generates S-Records in 68k mode, which is annoying :v

    Edit3: Added one more identifier to serial code. BR is used internally for bootroms like the Sega CD bios and the 68k 32X bios.
     
    Last edited: Dec 29, 2010
  6. NexusEnix

    NexusEnix Member

    Joined:
    Nov 16, 2010
    Messages:
    14
    Likes Received:
    0
    @segaloco Awesome stuff thanks, very helpful. I will try and implement that code and I will give those assemblers a try to.:dance:
     
  7. segaloco

    segaloco Enthusiastic Member

    Joined:
    Jun 25, 2009
    Messages:
    531
    Likes Received:
    3
    http://gilgalad.arc-nova.org/nes-source/Barry Leitch/Genesis/SOURCE/ICD_BLK4.S

    This also might help you. I don't necessarily mean for you to use that specifically, but there are a couple of things in there you should do, namely the security check (sending 'SEGA' to $A14000)

     
  8. NexusEnix

    NexusEnix Member

    Joined:
    Nov 16, 2010
    Messages:
    14
    Likes Received:
    0
    Great stuff thanks again!

    I'm currently reading through the M68k Programmer Reference Manual and I have an essay to write, so it will be a few days till I start coding again. But this is very helpfull and I will give it a go after I'm done.:)
     
    Last edited: Nov 26, 2010
sonicdude10
Draft saved Draft deleted
Insert every image as a...
  1.  0%

Share This Page