getting started

Ask anything your want about Megadrive/Genesis programming.

Moderator: BigEvilCorporation

meshounah
Interested
Posts: 12
Joined: Wed Jul 25, 2007 10:45 pm

getting started

Post by meshounah » Wed Jul 25, 2007 10:50 pm

hello i'm need of a little help... firstly i would like to find a devkit for the genesis(i tried Stef's devkit) but i just could not get it working at all. seconds question: is there anywhere to get a flash cart for the genesis? thank you
chickens!

zinger
Very interested
Posts: 60
Joined: Thu Apr 19, 2007 12:39 am
Location: sweden
Contact:

Post by zinger » Wed Jul 25, 2007 11:42 pm

http://www.tototek.com/
They sell flash carts. Works great!

meshounah
Interested
Posts: 12
Joined: Wed Jul 25, 2007 10:45 pm

Post by meshounah » Thu Jul 26, 2007 2:28 pm

thank you
chickens!

ElBarto
Very interested
Posts: 160
Joined: Wed Dec 13, 2006 10:29 am
Contact:

Post by ElBarto » Thu Jul 26, 2007 2:28 pm

Hello
The only available devkit is Stef's one, can you explain more the error you get ?
I suggest you too take a megacart instead of a tototek one. Even if they are a little more expensive it has more functionnality.

meshounah
Interested
Posts: 12
Joined: Wed Jul 25, 2007 10:45 pm

Post by meshounah » Thu Jul 26, 2007 2:33 pm

the problems are a bunch of not found blah blah blah but i have changed the path in the files.
chickens!

TulioAdriano
Very interested
Posts: 81
Joined: Tue Jul 10, 2007 7:45 pm
Location: Brazil / USA
Contact:

Post by TulioAdriano » Thu Jul 26, 2007 4:49 pm

Here is a link for the topic where HaroldoOP helps MG to solve the problems using CodeBlocks for Stef's Devkit. Read it, it might help you.

http://www.spritesmind.net/_GenDev//for ... .php?t=205

Also, if you're familiar with Basic, the other development tool you my want to try is BasiEgaXorz from Devster.

Here's where to get it:
http://devster.monkeeh.com/sega/basiegaxorz/

I've been using that one for long time... it is not complete but thanks to it I learn how MegaDrive works.

Seeya.
Tulio
Image

ElBarto
Very interested
Posts: 160
Joined: Wed Dec 13, 2006 10:29 am
Contact:

Post by ElBarto » Fri Jul 27, 2007 10:58 am

http://www.megadrive.org/~elbarto/md/patch-gendev.zip
Use this patch for the last gendev version.
Set two environment variable (Win + Pause -> Advanced => Environment Variables) :

GENDEV with \ (Example : C:\gendev\)
GENDEV_MAKE with / (Example : C:/gendev/)

It should work correctly

meshounah
Interested
Posts: 12
Joined: Wed Jul 25, 2007 10:45 pm

Post by meshounah » Tue Jul 31, 2007 10:30 pm

ok thank you i'll try it out
chickens!

meshounah
Interested
Posts: 12
Joined: Wed Jul 25, 2007 10:45 pm

Post by meshounah » Wed Aug 01, 2007 2:16 am

basic isnt for me... but how would i go around using assembly with the genny
chickens!

8bitwizard
Very interested
Posts: 159
Joined: Sat Feb 24, 2007 11:35 pm
Location: San Antonio, TX

Post by 8bitwizard » Wed Aug 01, 2007 3:26 am

Well, you're going to need a few things.

* An assembler. I wrote my own: http://xi6.com/projects/asmx/ (you will need to know how to compile a C program from the command line to build it)

* Something to run your code on. An emulator, a game copier, a flash card, etc.

* Some sample code to start working from. I'm pasting a little Hello World program that I had lying around.

* A build script to put everything together, even if it's as simple as:

Code: Select all

asm68k -l -o -b -w -e hello.asm
hello.asm

Code: Select all

; hello.asm

        LIST    OFF
        INCLUDE gen.h
        LIST    ON

;-----------------------------------------------------------------------
;       exception vectors
;-----------------------------------------------------------------------


        DC.L    $FFFFFE00       ; startup SP
        DC.L    START           ; startup PC

        DS.L    7,RTE           ; bus,addr,illegal,divzero,CHK,TRAPV,priv
        DC.L    RTE             ; trace
        DC.L    RTE             ; line 1010 emulator
        DC.L    RTE             ; line 1111 emulator
        DS.L    4,RTE           ; unassigned/uninitialized
        DS.L    8,RTE           ; unassigned
        DC.L    RTE             ; spurious interrupt
        DC.L    RTE             ; interrupt level 1 (lowest priority)
        DC.L    ExtInt          ; interrupt level 2 = external interrupt
        DC.L    RTE             ; interrupt level 3
        DC.L    HSync           ; interrupt level 4 = H-sync interrupt
        DC.L    RTE             ; interrupt level 5
        DC.L    VSync           ; interrupt level 6 = V-sync interrupt
        DC.L    RTE             ; interrupt level 7 (highest priority)
        DS.L    16,RTE          ; TRAP instruction vectors
        DS.L    16,RTE          ; unassigned

;-----------------------------------------------------------------------
;       cartridge info header
;-----------------------------------------------------------------------

        DC.B    "SEGA GENESIS    "      ; must start with "SEGA"
        DC.B    "(C)---- "              ; copyright
        DC.B    "2006.DEC"              ; date
        DC.B    "HELLO WORLD                                     " ; cart name
        DC.B    "HELLO WORLD                                     " ; cart name (alt. language)
        DC.B    "GM MK-0000 -00"        ; program type / catalog number
        DC.W    $0000                   ; ROM checksum
        DC.B    "J               "      ; hardware used
        DC.L    $00000000               ; start of ROM
        DC.L    $003FFFFF               ; end of ROM
        DC.L    $00FF0000,$00FFFFFF     ; RAM start/end
        DC.B    "            "          ; backup RAM info
        DC.B    "            "          ; modem info
        DC.B    "                                        " ; comment
        DC.B    "JUE             "      ; regions allowed

;-----------------------------------------------------------------------
;       generic exception handler
;-----------------------------------------------------------------------

ExtInt
HSync
VSync
RTE     RTE

;-----------------------------------------------------------------------
;       main entry point
;-----------------------------------------------------------------------

START
        LEA     Regs1(PC),A5    ; initialize registers
        MOVEM.L (A5)+,D5-D7/A0-A4

        ; initialize TMSS
        MOVE.B  (A1),D0         ; A10001 test the hardware version
        ANDI.B  #$0F,D0
        BEQ.B   .1              ; branch if no TMSS

        MOVE.L  #'SEGA',(A2)    ; A14000 disable TMSS

.1      MOVE.W  (A4),D0         ; C00004 read VDP status (interrupt acknowledge?)

        ; initialize USP and stuff
        MOVEQ   #0,D0           ; D0 = 0
        MOVEA.L D0,A6           ; A6 = 0
        MOVE    A6,USP          ; USP = 0

        MOVEQ   #24-1,D1        ; length of video initialization block
.2      MOVE.B  (A5)+,D5        ; get next video control byte
        MOVE.W  D5,(A4)         ; C00004 send write register command to VDP
        ADD.W   D7,D5           ; point to next VDP register
        DBRA    D1,.2           ; loop for rest of block

        ; DMA is now set up for 65535-byte fill of VRAM, let's do it
        MOVE.L  #$40000080,(A4) ; C00004 = VRAM write to $0000 (what is the 80 bit for?)
        MOVE.W  D0,(A3)         ; C00000 = write zero to VRAM (starts DMA fill)

.3      MOVE.W  (A4),D4         ; C00004 read VDP status
        BTST    #1,D4           ; test DMA busy flag
        BNE.B   .3              ; loop while DMA busy

        ; initialize CRAM
        MOVE.L  #$81048F02,(A4) ; C00004 reg 1 = 0x04, reg 15 = 0x02: blank, auto-increment=2
        MOVE.L  #$C0000000,(A4) ; C00004 write CRAM address $0000
        MOVEQ   #32-1,D3        ; loop for 32 CRAM registers
.4      MOVE.L  D0,(A3)         ; C00000 clear CRAM register
        DBRA    D3,.4

        ; initialize VSRAM
        MOVE.L  #$40000010,(A4) ; C00004 VSRAM write address $0000
        MOVEQ   #20-1,D4        ; loop for 20 VSRAM registers
.5      MOVE.L  D0,(A3)         ; C00000 clear VSRAM register
        DBRA    D4,.5

        ; initialize PSG
        MOVEQ   #4-1,D5         ; loop for 4 PSG registers
.6      MOVE.B  (A5)+,$0011(A3) ; C00011 copy PSG initialization commands
        DBRA    D5,.6

        LEA     Regs2(PC),A1    ; initialize registers
        MOVEM.L (A1)+,D4-D7/A2-A6

        BSR.B   InitCRAM        ; set up colors in CRAM

        MOVE.L  #$4C200000,(A4) ; C00004 VRAM write to $0C20
.7      MOVE.L  (A1)+,(A5)      ; C00000 write next longword of charset to VDP
        DBRA    D6,.7           ; loop until done

        LEA     HelloMsg(PC),A1
        BSR.B   PrintMsg        ; copy startup message to screen

        MOVE.W  #$8144,(A4)     ; C00004 reg 1 = 0x44 unblank display

        MOVE.W  #60,D0
        BSR.B   Delay           ; delay about 3 seconds

;       MOVE.W  #$8104,(A4)     ; C00004 reg 1 = 0x04 blank display

        BRA.B   *

;-----------------------------------------------------------------------

Delay   MOVE.W  #$95CE,D1       ; delay a long time (about 1/20 sec?)
.1      DBRA    D1,.1
        DBRA    D0,Delay
        RTS

;-----------------------------------------------------------------------
; set up colors in CRAM

InitCRAM
        MOVE.W  (A2)+,D0                ; get length word
        MOVE.L  #$C0020000,(A4)         ; C00004 CRAM write address = $0002
.1      MOVE.W  (A2)+,(A5)              ; C00000 write next word to video
        DBRA    D0,.1                   ; loop until done
        RTS

                ; CRAM initialization
CRAM_tab
        DC.W    (CRAM_end-CRAM_tab)/2-2 ; number of entries - 1
        DC.W    $0EEE,$0EE8
CRAM_end

;-----------------------------------------------------------------------
; copy startup message to screen

PrintMsg
        MOVE.L  D5,(A4)                 ; C00004 write next character to VDP
.1      MOVEQ   #0,D1                   ; clear high byte of word
        MOVE.B  (A1)+,D1                ; get next byte
        BMI.B   .3                      ; branch if high bit set
        BNE.B   .2                      ; store byte if not null
        RTS                             ; exit if null

.2      MOVE.W  D1,(A5)                 ; C00000 store next word of name data
        BRA.B   .1

.3      ADDI.L  #$01000000,D5           ; offset VRAM address by $0100 to skip a line
        BRA.B   PrintMsg

        ; startup message

HelloMsg
        DC.B    "hello "
        DC.B    $7C,$7D,$7E,$7F ; "SEGA" logo characters
        DC.B    " world"
        DC.B    $7B             ; "."
        DC.B    0

        EVEN

;-----------------------------------------------------------------------

Regs1   DC.L    $00008000       ; D5 = VDP register 0 write command
        DC.L    0               ; D6 = unused
        DC.L    $00000100       ; D7 = video register offset
        DC.L    0               ; A0 = unused
        DC.L    HW_Version      ; A1 = hardware version register
        DC.L    TMSS_reg        ; A2 = TMSS register
        DC.L    VDP_data        ; A3 = VDP data
        DC.L    VDP_ctrl        ; A4 = VDP control / status
                                ; A5 = pointer to the following data:

        ; VDP register initialization (24 bytes)
        DC.B    $04     ; reg  0 = mode register 1: no H interrupt
        DC.B    $14     ; reg  1 = mode register 2: blanked, no V interrupt, DMA enable
        DC.B    $30     ; reg  2 = name table base for scroll A: $C000
        DC.B    $3C     ; reg  3 = name table base for window:   $F000
        DC.B    $07     ; reg  4 = name table base for scroll B: $E000
        DC.B    $6C     ; reg  5 = sprite attribute table base: $D800
        DC.B    $00     ; reg  6 = unused register: $00
        DC.B    $00     ; reg  7 = background color: $00
        DC.B    $00     ; reg  8 = unused register: $00
        DC.B    $00     ; reg  9 = unused register: $00
        DC.B    $FF     ; reg 10 = H interrupt register: $FF (esentially off)
        DC.B    $00     ; reg 11 = mode register 3: disable ext int, full H/V scroll
        DC.B    $81     ; reg 12 = mode register 4: 40 cell horizontal mode, no interlace
        DC.B    $37     ; reg 13 = H scroll table base: $FC00
        DC.B    $00     ; reg 14 = unused register: $00
        DC.B    $01     ; reg 15 = auto increment: $01
        DC.B    $01     ; reg 16 = scroll size: V=32 cell, H=64 cell
        DC.B    $00     ; reg 17 = window H position: $00
        DC.B    $00     ; reg 18 = window V position: $00
        DC.B    $FF     ; reg 19 = DMA length count low:   $00FF
        DC.B    $FF     ; reg 20 = DMA length count high:  $FFxx
        DC.B    $00     ; reg 21 = DMA source address low: $xxxx00
        DC.B    $00     ; reg 22 = DMA source address mid: $xx00xx
        DC.B    $80     ; reg 23 = DMA source address high: VRAM fill, addr = $00xxxx

        ; PSG initialization: set all channels to minimum volume
        DC.B    $9F,$BF,$DF,$FF

;-----------------------------------------------------------------------

Regs2   DC.L    0               ; D4 = unused
        DC.L    $45940003       ; D5 = VRAM write to middle of screen, addr = $C594
        DC.L    FontSize/4-1    ; D6 = size of charset data
        DC.L    0               ; D7 = unused
        DC.L    CRAM_tab        ; A2 = CRAM table
        DC.L    0               ; A3 = unused
        DC.L    VDP_ctrl        ; A4 = VDP control / status
        DC.L    VDP_data        ; A5 = VDP data
        DC.L    0               ; A6 = unused
                                ; A1 = pointer to the following data:

        ; pattern table initialization
Font    HEX     01111100 11000110 11000110 11000110 ; A
        HEX     11111110 11000110 11000110 00000000
        HEX     11111100 11000110 11000110 11111100 ; B
        HEX     11000110 11000110 11111100 00000000
        HEX     11111110 11000110 11000110 11000000 ; C
        HEX     11000110 11000110 11111110 00000000
        HEX     11111100 11000110 11000110 11000110 ; D
        HEX     11000110 11000110 11111100 00000000
        HEX     11111110 11000000 11000000 11111100 ; E
        HEX     11000000 11000000 11111110 00000000
        HEX     11111110 11000000 11000000 11111100 ; F
        HEX     11000000 11000000 11000000 00000000
        HEX     11111110 11000110 11000000 11001110 ; G
        HEX     11000110 11000110 11111110 00000000
        HEX     11000110 11000110 11000110 11111110 ; H
        HEX     11000110 11000110 11000110 00000000
        HEX     00111000 00111000 00111000 00111000 ; I
        HEX     00111000 00111000 00111000 00000000
        HEX     00000110 00000110 00000110 00000110 ; J
        HEX     00000110 01100110 01111110 00000000
        HEX     11000110 11001100 11111000 11111000 ; K
        HEX     11001100 11000110 11000110 00000000
        HEX     01100000 01100000 01100000 01100000 ; L
        HEX     01100000 01100000 01111110 00000000
        HEX     11000110 11101110 11111110 11010110 ; M
        HEX     11000110 11000110 11000110 00000000
        HEX     11000110 11100110 11110110 11011110 ; N
        HEX     11001110 11000110 11000110 00000000
        HEX     11111110 11000110 11000110 11000110 ; O
        HEX     11000110 11000110 11111110 00000000
        HEX     11111110 11000110 11000110 11111110 ; P
        HEX     11000000 11000000 11000000 00000000
        HEX     11111110 11000110 11000110 11000110 ; Q
        HEX     11001110 11001110 11111110 00000000
        HEX     11111110 11000110 11000110 11111100 ; R
        HEX     11000110 11000110 11000110 00000000
        HEX     11111110 11000110 11000000 11111110 ; S
        HEX     00000110 11000110 11111110 00000000
        HEX     11111110 00111000 00111000 00111000 ; T
        HEX     00111000 00111000 00111000 00000000
        HEX     11000110 11000110 11000110 11000110 ; U
        HEX     11000110 11000110 11111110 00000000
        HEX     11000110 11000110 11000110 11000110 ; V
        HEX     01101100 00111000 00010000 00000000
        HEX     11000110 11000110 11000110 11010110 ; W
        HEX     11111110 11101110 11000110 00000000
        HEX     11000110 11000110 11101110 01111100 ; X
        HEX     11101110 11000110 11000110 00000000
        HEX     11000110 11000110 11000110 01101100 ; Y
        HEX     00111000 00111000 00111000 00000000
        HEX     11111110 00001110 00011100 00111000 ; Z
        HEX     01110000 11100000 11111110 00000000
        HEX     00000000 00000000 00000000 00000000 ; 7B = .
        HEX     00000000 01100000 01100000 00000000
        HEX     02222200 22000220 22000000 02222200 ; 7C = S
        HEX     00000220 22000220 02222200 00000000
        HEX     02222220 22000000 22000000 22222200 ; 7D = E
        HEX     22000000 22000000 02222220 00000000
        HEX     02222200 22000220 22000000 22002220 ; 7E = G
        HEX     22000220 22000220 02222220 00000000
        HEX     00022000 00222200 00222200 02200220 ; 7F = A
        HEX     02200220 22000022 22022222 00000000
FontSize = * - Font

        END     0
gen.h

Code: Select all

; Sega Genesis/Megadrive I/O addresses

;-----------------------------------------------------------------------
;               68K memory map:
;-----------------------------------------------------------------------
;       000000 - 3FFFFF = ROM cartridge
;       400000 - 7FFFFF = alternate ROM space
;       800000 - 9FFFFF = reserved (used by 32X?)
;       A00000          = Z-80 access
;       A10000          = I/O
;       A11000          = control
;       A12000          = sega CD gate array
;       A13000          = address space for /TIME cartridge pin
;       C00000 - DFFFFF = VDP
;       FF0000 - FFFFFF = work RAM

;-----------------------------------------------------------------------
;               $A000xx = Z80 area
;               NOTE: no I/O ports are mapped in Z80 slave mode
;-----------------------------------------------------------------------

Z_base          EQU     $A00000 ; Z80 address window base, add to the values below from 68K
Z_sndRAM        EQU     $0000   ; Z80 sound RAM at 0000-1FFF
Z_audio         EQU     $4000   ; YM2612 chip at 4000-4003
Z_audio_A0      EQU     $4000   ; YM2612 A0
Z_audio_D0      EQU     $4001   ; YM2612 D0
Z_audio_A1      EQU     $4002   ; YM2612 A1
Z_audio_D1      EQU     $4003   ; YM2612 D1
Z_bank          EQU     $6000   ; bank select register
Z_VDP           EQU     $7F00   ; 7F00/7F04/7F08, but useless in VDP mode 5
Z_PSG           EQU     $7F11   ; 76489 PSG sound chip
Z_68K           EQU     $8000   ; 8000-FFFF = window to 68000 memory bank

;-----------------------------------------------------------------------
;               $A100xx = I/O area (all are byte registers)
;-----------------------------------------------------------------------

HW_version      EQU     $A10001 ; hardware version in low nibble
                                ; bit 6 is PAL (50Hz) if set, NTSC (60Hz) if clear
                                ; region flags in bits 7 and 6:
                                ;         USA NTSC = $80
                                ;         Asia PAL = $C0
                                ;         Japan NTSC = $00
                                ;         Europe PAL = $C0
P_data_1        EQU     $A10003 ; data (left controller)
P_data_2        EQU     $A10005 ; data (right controller)
P_data_3        EQU     $A10007 ; data (expansion port)
P_control_1     EQU     $A10009 ; control (L)
P_control_2     EQU     $A1000B ; control (R)
P_control_3     EQU     $A1000D ; control (exp)
P_TxData_1      EQU     $A1000F ; TxData (L)
P_RxData_1      EQU     $A10011 ; RxData (L)
P_SCtrl_1       EQU     $A10013 ; S-Ctrl (L)
P_TxData_2      EQU     $A10015 ; TxData (R)
P_RxData_2      EQU     $A10017 ; RxData (R)
P_SCtrl_2       EQU     $A10019 ; S-Ctrl (R)
P_TxData_3      EQU     $A1001B ; TxData (exp)
P_RxData_3      EQU     $A1001D ; RxData (exp)
P_SCtrl_3       EQU     $A1001F ; S-Ctrl (exp)

;-----------------------------------------------------------------------
;               $A110xx = Control area
;-----------------------------------------------------------------------

;               EQU     $A11000 ; memory mode (enables DRAM mode)
Z_busreq        EQU     $A11100 ; Z80 busreq (R/W)
Z_reset         EQU     $A11200 ; Z80 reset
TMSS_reg        EQU     $A14000 ; (long) must store 'SEGA' if not version 0 hardware
;               EQU     $A14101 ; cartridge control register (byte) - used by boot ROM only
                                ; bit 0 = 0 disables cartridge ROM, = 1 enables cartridge ROM

;-----------------------------------------------------------------------
;               $C000xx = VDP area
;-----------------------------------------------------------------------

VDP_data        EQU     $C00000 ; VDP data, R/W word or longword access only
VDP_ctrl        EQU     $C00004 ; VDP control, word or longword writes only
VDP_stat        EQU     $C00004 ; VDP status
;  0xxx000x = VRAM  read (video RAM)
;  0xxx001x = VSRAM read (vertical scroll RAM)
;  0xxx002x = CRAM  read (color RAM)
;  4xxx000x = VRAM  write
;  4xxx001x = VSRAM write
;  8xyy     = register write
;  8xyy8xyy = double register write (high word first)
;  Cxxx     = CRAM write (this form may not work)
;  Cxxx000x = CRAM write with A14, A15
VDP_HVctr       EQU     $C00008 ; VDP HV counter (even/high is Vert, odd/low is Horiz)
PSG             EQU     $C00011 ; 76489 PSG sound chip, byte access only
Last edited by 8bitwizard on Wed Aug 01, 2007 4:40 am, edited 1 time in total.

meshounah
Interested
Posts: 12
Joined: Wed Jul 25, 2007 10:45 pm

Post by meshounah » Wed Aug 01, 2007 4:25 am

ok thanks for the info would *any* 68k assembler work with the genny?
chickens!

Mask of Destiny
Very interested
Posts: 615
Joined: Thu Nov 30, 2006 6:30 am

Post by Mask of Destiny » Wed Aug 01, 2007 12:42 pm

Any 68K assembler that can produce a raw binary output can be used.

meshounah
Interested
Posts: 12
Joined: Wed Jul 25, 2007 10:45 pm

Post by meshounah » Wed Aug 01, 2007 3:23 pm

ok i am using asm68k but that example won't compile?

Code: Select all

                       ; hello.asm
                        
                                LIST    OFF
F: Undefined opcode.
                                INCLUDE gen.h
F: Undefined opcode.
                                LIST    ON
F: Undefined opcode.
                        
                        ;-----------------------------------------------------------------------
                        ;       exception vectors
                        ;-----------------------------------------------------------------------
                        
                        
000000  FFFF FE00               DC.L    $FFFFFE00       ; startup SP
000004  0000 011F               DC.L    START           ; startup PC
                        
000008                          DS.L    7,RTE           ; bus,addr,illegal,divzero,CHK,TRAPV,priv
F: Unexpected text encountered.
000024  0000 011D               DC.L    RTE             ; trace
000028  0000 011D               DC.L    RTE             ; line 1010 emulator
00002C  0000 011D               DC.L    RTE             ; line 1111 emulator
000030                          DS.L    4,RTE           ; unassigned/uninitialized
F: Unexpected text encountered.
000040                          DS.L    8,RTE           ; unassigned
F: Unexpected text encountered.
000060  0000 011D               DC.L    RTE             ; spurious interrupt
000064  0000 011D               DC.L    RTE             ; interrupt level 1 (lowest priority)
000068  0000 011D               DC.L    ExtInt          ; interrupt level 2 = external interrupt
00006C  0000 011D               DC.L    RTE             ; interrupt level 3
000070  0000 011D               DC.L    HSync           ; interrupt level 4 = H-sync interrupt
000074  0000 011D               DC.L    RTE             ; interrupt level 5
000078  0000 011D               DC.L    VSync           ; interrupt level 6 = V-sync interrupt
00007C  0000 011D               DC.L    RTE             ; interrupt level 7 (highest priority)
000080                          DS.L    16,RTE          ; TRAP instruction vectors
F: Unexpected text encountered.
0000C0                          DS.L    16,RTE          ; unassigned
F: Unexpected text encountered.
                        
                        ;-----------------------------------------------------------------------
                        ;       cartridge info header
                        ;-----------------------------------------------------------------------
                        
000100  10                      DC.B    "SEGA GENESIS    "      ; must start with "SEGA"
F: Unexpected text encountered.
000101  10                      DC.B    "(C)---- "              ; copyright
F: Unexpected text encountered.
000102  10                      DC.B    "2006.DEC"              ; date
F: Unexpected text encountered.
000103  10                      DC.B    "HELLO WORLD                                     " ; cart name
F: Unexpected text encountered.
000104  10                      DC.B    "HELLO WORLD                                     " ; cart name (DCF: Unexpected text encountered.
000105  10                      DC.B    "GM MK-0000 -00"        ; program type / catalog number
F: Unexpected text encountered.
000106  0000                    DC.W    $0000                   ; ROM checksum
000108  00                      DC.B    "J               "      ; hardware used
F: Unexpected text encountered.
000109  0000 0000               DC.L    $00000000               ; start of ROM
00010D  003F FFFF               DC.L    $003FFFFF               ; end of ROM
000111  00FF 0000 00FF          DC.L    $00FF0000,$00FFFFFF     ; RAM start/end
000117  FFFF          
000119  00                      DC.B    "            "          ; backup RAM info
F: Data constant exceeds BYTE range.
00011A  00                      DC.B    "            "          ; modem info
F: Data constant exceeds BYTE range.
00011B  00                      DC.B    "                                        " ; comment
F: Data constant exceeds BYTE range.
00011C  00                      DC.B    "JUE             "      ; regions allowed
F: Data constant exceeds BYTE range.
                        
                        ;-----------------------------------------------------------------------
                        ;       generic exception handler
                        ;-----------------------------------------------------------------------
                        
00011D                  ExtInt
00011D                  HSync
00011D                  VSync
00011D  4E73            RTE     RTE
                        
                        ;-----------------------------------------------------------------------
                        ;       main entry point
                        ;-----------------------------------------------------------------------
                        
00011F                  START
00011F  4BFA 00B0               LEA     Regs1(PC),A5    ; initialize registers
000123  4CDD 1FE0               MOVEM.L (A5)+,D5-D7/A0-A4
                        
                                ; initialize TMSS
000127  1011                    MOVE.B  (A1),D0         ; A10001 test the hardware version
000129  0200 000F               ANDI.B  #$0F,D0
00012D  67FE                    BEQ.B   .1              ; branch if no TMSS
F: Target address out of range.
                        
00012F  24BC 5345 4741          MOVE.L  #'SEGA',(A2)    ; A14000 disable TMSS
                        
                        .1      MOVE.W  (A4),D0         ; C00004 read VDP status (interrupt acknowledge?F: Illegal label.
                        
                                ; initialize USP and stuff
000135  7000                    MOVEQ   #0,D0           ; D0 = 0
000137  2C40                    MOVEA.L D0,A6           ; A6 = 0
000139  4E66                    MOVE    A6,USP          ; USP = 0
W: Size extension must be BYTE, WORD, or LONG.
                        
00013B  7217                    MOVEQ   #24-1,D1        ; length of video initialization block
                        .2      MOVE.B  (A5)+,D5        ; get next video control byte
F: Illegal label.
00013D  3885                    MOVE.W  D5,(A4)         ; C00004 send write register command to VDP
00013F  DA47                    ADD.W   D7,D5           ; point to next VDP register
000141  51C9 FEBE               DBRA    D1,.2           ; loop for rest of block
F: Unexpected text encountered.
                        
                                ; DMA is now set up for 65535-byte fill of VRAM, let's do it
000145  28BC 4000 0080          MOVE.L  #$40000080,(A4) ; C00004 = VRAM write to $0000 (what is the 80 bMOVE00014B  3680                    MOVE.W  D0,(A3)         ; C00000 = write zero to VRAM (starts DMA fill)
MOVE                        
                        .3      MOVE.W  (A4),D4         ; C00004 read VDP status
F: Illegal label.
00014D  0804 0001               BTST    #1,D4           ; test DMA busy flag
000151  66FE                    BNE.B   .3              ; loop while DMA busy
F: Target address out of range.
                        
                                ; initialize CRAM
000153  28BC 8104 8F02          MOVE.L  #$81048F02,(A4) ; C00004 reg 1 = 0x04, reg 15 = 0x02: blank, autMOVE000159  28BC C000 0000          MOVE.L  #$C0000000,(A4) ; C00004 write CRAM address $0000
00015F  761F                    MOVEQ   #32-1,D3        ; loop for 32 CRAM registers
                        .4      MOVE.L  D0,(A3)         ; C00000 clear CRAM register
F: Illegal label.
000161  51CB FE9E               DBRA    D3,.4
F: Unexpected text encountered.
                        
                                ; initialize VSRAM
000165  28BC 4000 0010          MOVE.L  #$40000010,(A4) ; C00004 VSRAM write address $0000
00016B  7813                    MOVEQ   #20-1,D4        ; loop for 20 VSRAM registers
                        .5      MOVE.L  D0,(A3)         ; C00000 clear VSRAM register
F: Illegal label.
00016D  51CC FE92               DBRA    D4,.5
F: Unexpected text encountered.
                        
                                ; initialize PSG
000171  7A03                    MOVEQ   #4-1,D5         ; loop for 4 PSG registers
                        .6      MOVE.B  (A5)+,$0011(A3) ; C00011 copy PSG initialization commands
F: Illegal label.
000173  51CD FE8C               DBRA    D5,.6
F: Unexpected text encountered.
                        
000177  43FA 0094               LEA     Regs2(PC),A1    ; initialize registers
00017B  4CD9 7CF0               MOVEM.L (A1)+,D4-D7/A2-A6
                        
00017F  6126                    BSR.B   InitCRAM        ; set up colors in CRAM
                        
000181  28BC 4C20 0000          MOVE.L  #$4C200000,(A4) ; C00004 VRAM write to $0C20
                        .7      MOVE.L  (A1)+,(A5)      ; C00000 write next longword of charset to VDP
F: Illegal label.
000187  51CE 0000               DBRA    D6,.7           ; loop until done
F: Target address out of range.
                        
00018B  43FA 003C               LEA     HelloMsg(PC),A1
00018F  612A                    BSR.B   PrintMsg        ; copy startup message to screen
                        
000191  38BC 8144               MOVE.W  #$8144,(A4)     ; C00004 reg 1 = 0x44 unblank display
                        
000195  303C 003C               MOVE.W  #60,D0
000199  6102                    BSR.B   Delay           ; delay about 3 seconds
                        
                        ;       MOVE.W  #$8104,(A4)     ; C00004 reg 1 = 0x04 blank display
                        
00019B  60FE                    BRA.B   *
F: Target address out of range.
                        
                        ;-----------------------------------------------------------------------
                        
00019D  323C 95CE       Delay   MOVE.W  #$95CE,D1       ; delay a long time (about 1/20 sec?)
                        .1      DBRA    D1,.1
F: Illegal label.
0001A1  51C8 FFFA               DBRA    D0,Delay
0001A5  4E75                    RTS
                        
                        ;-----------------------------------------------------------------------
                        ; set up colors in CRAM
                        
0001A7                  InitCRAM
0001A7  301A                    MOVE.W  (A2)+,D0                ; get length word
0001A9  28BC C002 0000          MOVE.L  #$C0020000,(A4)         ; C00004 CRAM write address = $0002
                        .1      MOVE.W  (A2)+,(A5)              ; C00000 write next word to video
F: Illegal label.
0001AF  51C8 0000               DBRA    D0,.1                   ; loop until done
F: Target address out of range.
0001B3  4E75                    RTS
                        
                                        ; CRAM initialization
0001B5                  CRAM_tab
0001B5  0001                    DC.W    (CRAM_end-CRAM_tab)/2-2 ; number of entries - 1
0001B7  0EEE 0EE8               DC.W    $0EEE,$0EE8
0001BB                  CRAM_end
                        
                        ;-----------------------------------------------------------------------
                        ; copy startup message to screen
                        
0001BB                  PrintMsg
0001BB  2885                    MOVE.L  D5,(A4)                 ; C00004 write next character to VDP
                        .1      MOVEQ   #0,D1                   ; clear high byte of word
F: Illegal label.
0001BD  1219                    MOVE.B  (A1)+,D1                ; get next byte
0001BF  6BFE                    BMI.B   .3                      ; branch if high bit set
F: Target address out of range.
0001C1  66FE                    BNE.B   .2                      ; store byte if not null
F: Target address out of range.
0001C3  4E75                    RTS                             ; exit if null
                        
                        .2      MOVE.W  D1,(A5)                 ; C00000 store next word of name data
F: Illegal label.
0001C5  60FE                    BRA.B   .1
F: Target address out of range.
                        
                        .3      ADDI.L  #$01000000,D5           ; offset VRAM address by $0100 to skip aF: Illegal label.
0001C7  60F2                    BRA.B   PrintMsg
                        
                                ; startup message
                        
0001C9                  HelloMsg
0001C9  00                      DC.B    "hello "
F: Data constant exceeds BYTE range.
0001CA  7C7D 7E7F               DC.B    $7C,$7D,$7E,$7F ; "SEGA" logo characters
0001CE  7F                      DC.B    " world"
F: Unexpected text encountered.
0001CF  7B                      DC.B    $7B             ; "."
0001D0  00                      DC.B    0
                        
                                        EVEN
F: Undefined opcode.
                        
                        ;-----------------------------------------------------------------------
                        
0001D1  0000 8000       Regs1   DC.L    $00008000       ; D5 = VDP register 0 write command
0001D5  0000 0000               DC.L    0               ; D6 = unused
0001D9  0000 0100               DC.L    $00000100       ; D7 = video register offset
0001DD  0000 0000               DC.L    0               ; A0 = unused
0001E1  0000 0000               DC.L    HW_Version      ; A1 = hardware version register
F: Undefined symbol.
0001E5  0000 0000               DC.L    TMSS_reg        ; A2 = TMSS register
F: Undefined symbol.
0001E9  0000 0000               DC.L    VDP_data        ; A3 = VDP data
F: Undefined symbol.
0001ED  0000 0000               DC.L    VDP_ctrl        ; A4 = VDP control / status
F: Undefined symbol.
                                                        ; A5 = pointer to the following data:
                        
                                ; VDP register initialization (24 bytes)
0001F1  04                      DC.B    $04     ; reg  0 = mode register 1: no H interrupt
0001F2  14                      DC.B    $14     ; reg  1 = mode register 2: blanked, no V interrupt, DMADC0001F3  30                      DC.B    $30     ; reg  2 = name table base for scroll A: $C000
0001F4  3C                      DC.B    $3C     ; reg  3 = name table base for window:   $F000
0001F5  07                      DC.B    $07     ; reg  4 = name table base for scroll B: $E000
0001F6  6C                      DC.B    $6C     ; reg  5 = sprite attribute table base: $D800
0001F7  00                      DC.B    $00     ; reg  6 = unused register: $00
0001F8  00                      DC.B    $00     ; reg  7 = background color: $00
0001F9  00                      DC.B    $00     ; reg  8 = unused register: $00
0001FA  00                      DC.B    $00     ; reg  9 = unused register: $00
0001FB  FF                      DC.B    $FF     ; reg 10 = H interrupt register: $FF (esentially off)
0001FC  00                      DC.B    $00     ; reg 11 = mode register 3: disable ext int, full H/V scDC0001FD  81                      DC.B    $81     ; reg 12 = mode register 4: 40 cell horizontal mode, no DC0001FE  37                      DC.B    $37     ; reg 13 = H scroll table base: $FC00
0001FF  00                      DC.B    $00     ; reg 14 = unused register: $00
000200  01                      DC.B    $01     ; reg 15 = auto increment: $01
000201  01                      DC.B    $01     ; reg 16 = scroll size: V=32 cell, H=64 cell
000202  00                      DC.B    $00     ; reg 17 = window H position: $00
000203  00                      DC.B    $00     ; reg 18 = window V position: $00
000204  FF                      DC.B    $FF     ; reg 19 = DMA length count low:   $00FF
000205  FF                      DC.B    $FF     ; reg 20 = DMA length count high:  $FFxx
000206  00                      DC.B    $00     ; reg 21 = DMA source address low: $xxxx00
000207  00                      DC.B    $00     ; reg 22 = DMA source address mid: $xx00xx
000208  80                      DC.B    $80     ; reg 23 = DMA source address high: VRAM fill, addr = $0DC                        
                                ; PSG initialization: set all channels to minimum volume
000209  9FBF DFFF               DC.B    $9F,$BF,$DF,$FF
                        
                        ;-----------------------------------------------------------------------
                        
00020D  0000 0000       Regs2   DC.L    0               ; D4 = unused
000211  4594 0003               DC.L    $45940003       ; D5 = VRAM write to middle of screen, addr = $CDC000215  0000 008B               DC.L    FontSize/4-1    ; D6 = size of charset data
000219  0000 0000               DC.L    0               ; D7 = unused
00021D  0000 01B5               DC.L    CRAM_tab        ; A2 = CRAM table
000221  0000 0000               DC.L    0               ; A3 = unused
000225  0000 0000               DC.L    VDP_ctrl        ; A4 = VDP control / status
F: Undefined symbol.
000229  0000 0000               DC.L    VDP_data        ; A5 = VDP data
F: Undefined symbol.
00022D  0000 0000               DC.L    0               ; A6 = unused
                                                        ; A1 = pointer to the following data:
                        
                                ; pattern table initialization
                        Font    HEX     01111100 11000110 11000110 11000110 ; A
F: Undefined opcode.
                                HEX     11111110 11000110 11000110 00000000
F: Undefined opcode.
                                HEX     11111100 11000110 11000110 11111100 ; B
F: Undefined opcode.
                                HEX     11000110 11000110 11111100 00000000
F: Undefined opcode.
                                HEX     11111110 11000110 11000110 11000000 ; C
F: Undefined opcode.
                                HEX     11000110 11000110 11111110 00000000
F: Undefined opcode.
                                HEX     11111100 11000110 11000110 11000110 ; D
F: Undefined opcode.
                                HEX     11000110 11000110 11111100 00000000
F: Undefined opcode.
                                HEX     11111110 11000000 11000000 11111100 ; E
F: Undefined opcode.
                                HEX     11000000 11000000 11111110 00000000
F: Undefined opcode.
                                HEX     11111110 11000000 11000000 11111100 ; F
F: Undefined opcode.
                                HEX     11000000 11000000 11000000 00000000
F: Undefined opcode.
                                HEX     11111110 11000110 11000000 11001110 ; G
F: Undefined opcode.
                                HEX     11000110 11000110 11111110 00000000
F: Undefined opcode.
                                HEX     11000110 11000110 11000110 11111110 ; H
F: Undefined opcode.
                                HEX     11000110 11000110 11000110 00000000
F: Undefined opcode.
                                HEX     00111000 00111000 00111000 00111000 ; I
F: Undefined opcode.
                                HEX     00111000 00111000 00111000 00000000
F: Undefined opcode.
                                HEX     00000110 00000110 00000110 00000110 ; J
F: Undefined opcode.
                                HEX     00000110 01100110 01111110 00000000
F: Undefined opcode.
                                HEX     11000110 11001100 11111000 11111000 ; K
F: Undefined opcode.
                                HEX     11001100 11000110 11000110 00000000
F: Undefined opcode.
                                HEX     01100000 01100000 01100000 01100000 ; L
F: Undefined opcode.
                                HEX     01100000 01100000 01111110 00000000
F: Undefined opcode.
                                HEX     11000110 11101110 11111110 11010110 ; M
F: Undefined opcode.
                                HEX     11000110 11000110 11000110 00000000
F: Undefined opcode.
                                HEX     11000110 11100110 11110110 11011110 ; N
F: Undefined opcode.
                                HEX     11001110 11000110 11000110 00000000
F: Undefined opcode.
                                HEX     11111110 11000110 11000110 11000110 ; O
F: Undefined opcode.
                                HEX     11000110 11000110 11111110 00000000
F: Undefined opcode.
                                HEX     11111110 11000110 11000110 11111110 ; P
F: Undefined opcode.
                                HEX     11000000 11000000 11000000 00000000
F: Undefined opcode.
                                HEX     11111110 11000110 11000110 11000110 ; Q
F: Undefined opcode.
                                HEX     11001110 11001110 11111110 00000000
F: Undefined opcode.
                                HEX     11111110 11000110 11000110 11111100 ; R
F: Undefined opcode.
                                HEX     11000110 11000110 11000110 00000000
F: Undefined opcode.
                                HEX     11111110 11000110 11000000 11111110 ; S
F: Undefined opcode.
                                HEX     00000110 11000110 11111110 00000000
F: Undefined opcode.
                                HEX     11111110 00111000 00111000 00111000 ; T
F: Undefined opcode.
                                HEX     00111000 00111000 00111000 00000000
F: Undefined opcode.
                                HEX     11000110 11000110 11000110 11000110 ; U
F: Undefined opcode.
                                HEX     11000110 11000110 11111110 00000000
F: Undefined opcode.
                                HEX     11000110 11000110 11000110 11000110 ; V
F: Undefined opcode.
                                HEX     01101100 00111000 00010000 00000000
F: Undefined opcode.
                                HEX     11000110 11000110 11000110 11010110 ; W
F: Undefined opcode.
                                HEX     11111110 11101110 11000110 00000000
F: Undefined opcode.
                                HEX     11000110 11000110 11101110 01111100 ; X
F: Undefined opcode.
                                HEX     11101110 11000110 11000110 00000000
F: Undefined opcode.
                                HEX     11000110 11000110 11000110 01101100 ; Y
F: Undefined opcode.
                                HEX     00111000 00111000 00111000 00000000
F: Undefined opcode.
                                HEX     11111110 00001110 00011100 00111000 ; Z
F: Undefined opcode.
                                HEX     01110000 11100000 11111110 00000000
F: Undefined opcode.
                                HEX     00000000 00000000 00000000 00000000 ; 7B = .
F: Undefined opcode.
                                HEX     00000000 01100000 01100000 00000000
F: Undefined opcode.
                                HEX     02222200 22000220 22000000 02222200 ; 7C = S
F: Undefined opcode.
                                HEX     00000220 22000220 02222200 00000000
F: Undefined opcode.
                                HEX     02222220 22000000 22000000 22222200 ; 7D = E
F: Undefined opcode.
                                HEX     22000000 22000000 02222220 00000000
F: Undefined opcode.
                                HEX     02222200 22000220 22000000 22002220 ; 7E = G
F: Undefined opcode.
                                HEX     22000220 22000220 02222220 00000000
F: Undefined opcode.
                                HEX     00022000 00222200 00222200 02200220 ; 7F = A
F: Undefined opcode.
                                HEX     02200220 22000022 22022222 00000000
F: Undefined opcode.
000231                  FontSize = * - Font
F: Unexpected text encountered.
                        

Symbol Table, 22 reserved symbols, 15 user symbols

                     ----- Reserved Symbols -----
             CCR  R  00000F                 SR  R  008000   
             USP  R  000000                SSP  R  000000   
              SP  R  00FFFE                 PC  R  000231   
              D0  D  000000                 D1  D  000001   
              D2  D  000002                 D3  D  000003   
              D4  D  000004                 D5  D  000005   
              D6  D  000006                 D7  D  000007   
              A0  A  000000                 A1  A  000001   
              A2  A  000002                 A3  A  000003   
              A4  A  000004                 A5  A  000005   
              A6  A  000006                 A7  A  000007   
                       ----- User Symbols -----
        CRAM_END  L  0001BB           CRAM_TAB  L  0001B5   
           DELAY  L  00019D             EXTINT  L  00011D   
            FONT  L  000231           FONTSIZE  L  000231   
        HELLOMSG  L  0001C9              HSYNC  L  00011D   
        INITCRAM  L  0001A7           PRINTMSG  L  0001BB   
           REGS1  L  0001D1              REGS2  L  00020D   
             RTE  L  00011D              START  L  00011F   
           VSYNC  L  00011D   

305 lines processed.
1 warnings.
115 fatals.
chickens!

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Wed Aug 01, 2007 4:13 pm

SNASM68K has its directives different than in the code you tried to assemble... I myself use SNASM68K, I have few sources on my site http://www.hot.ee/tmeeco
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

8bitwizard
Very interested
Posts: 159
Joined: Sat Feb 24, 2007 11:35 pm
Location: San Antonio, TX

Post by 8bitwizard » Wed Aug 01, 2007 6:48 pm

meshounah wrote:ok thanks for the info would *any* 68k assembler work with the genny?
Any can be used, but as you can see, they differ in what options and directives they take.

Looks like the one you used is a bit more picky than mine.

And for what it's worth, now that I've merged all the different CPUs together in one assembler, this is really the preferred way to invoke it:

Code: Select all

asmx -C 68K -l -o -b -w -e hello.asm
(or put "CPU 68K" in the source and there is no need for the "-C 68K")

Post Reply