Advertisement
Guest User

Untitled

a guest
Dec 20th, 2010
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;//------------------------------------------------------------------------
  2. ;
  3. ;   Shinobi System16 arcade ROM hack for Genesis/Megadrive.
  4. ;
  5. ;   Bootleg romset used. B3/B1 and epr11263.43/epr11261.25 sets for code.
  6. ;
  7. ;   History:
  8. ;
  9. ;   11/19/10 - Ver: 0.0.1 - Initial setup. (Tomaitheous)
  10. ;
  11. ;   Assemble with ASL (http://john.ccac.rwth-aachen.de:8000/as/)
  12. ;
  13. ;     asw shinobi.s
  14. ;     plist shinobi.p
  15. ;     p2bin shinobi.p shinobi.bin -r $-$3ffff
  16. ;
  17. ;   Text editor: TAB = 2 spaces.
  18. ;
  19.  
  20.  
  21. ;//........................................................................
  22. ;
  23. ;   Quick hardware notes:
  24. ;
  25. ;   $1c000-$1ffff appears to be free/unused space
  26. ;   $39600-$3fbff appears to be free/unused space.
  27. ;
  28. ;   More indepth notes section in the end part of the source file.
  29. ;
  30.  
  31.   CPU     68000
  32.   SUPMODE ON
  33.  
  34. ;//........................................................................
  35. ;
  36. ;   Include the original (assembled) 68k code rom from the arcade set.
  37.  
  38.   ORG $00000000
  39. shinobi_rom:
  40.   BINCLUDE "68k.bin"
  41.  
  42.  
  43. ;//........................................................................
  44. ;
  45. ;   New/replacement code/data.
  46.  
  47.  
  48.  
  49.   ORG $00000000
  50.  
  51.     dc.l $FFFFFF00, STARTUP
  52.    
  53.                   ; STARTUP is the hook to initialize the Genesis first, before
  54.                   ; continuing onto the game init code.
  55.  
  56.  
  57.   ORG $00000070
  58.    
  59.     dc.l HINT     ; Not sure this will be needed yet. Original hardware doesn't have
  60.                   ; Hblank interrupts.
  61.  
  62.  
  63.   ORG $00000078
  64.    
  65.     dc.l VINT     ; This should be correct. The system16 doesn't do HBL interrupts, but
  66.                   ; the VBL is in the HBL vector in the arcade setup. Changed to match.
  67.  
  68.  
  69.   ORG $00000100
  70.  
  71.                   ; A little bit of header info to get it to run on emulators/etc.
  72.                   ; Honestly, note sure where this template originally came from.
  73.  
  74. sega:
  75.     dc.b "SEGA GENESIS                    "
  76.     dc.b "SHINOBI                                         "
  77.     dc.b "VER 0.0.1                                       "
  78.     dc.b "GM 00000000-00",$a5,$fb
  79.     dc.b "JD              ",$00,$00,$00,$00,$00,$02,$00,$00
  80.     dc.b $00,$ff,$00,$00,$ff,$ff,$ff,$ff,"               "
  81.     dc.b "                        "
  82.     dc.b "                         "
  83.     dc.b "JUE             "
  84.  
  85.  
  86.  
  87.   org $0001c000
  88.  
  89.                   ; Start of the free space area, for Genesis specific code.
  90.  
  91.  
  92. ;//........................................................................
  93. STARTUP:          ;Genesis Init code should go here
  94.  
  95.  
  96.     move.w #$2700, SR                   ;disable interrupts
  97.  
  98.     MOVE.B $A10001, D0
  99.     ANDI.B #$0F, D0
  100.     CMP.B  #0, D0
  101.     BEQ    SkipSegaSecurity
  102.     MOVE.L sega, $A14000
  103. SkipSegaSecurity:
  104.  
  105.     move.l #$00003fff,d0                ;clear ram
  106.     move.l #$00ff0000,a0
  107. .clear_ram
  108.     move.l #$00000000,(a0)+
  109.     dbra d0, .clear_ram
  110.  
  111.     move.w  #$100,$a11100               ; z80 perma halt
  112.     move.w  #$100,$a11200    
  113.  
  114.   jsr INIT_VDP
  115.  
  116.     move.w #$8164,VDP_CTRL              ; Reg. 01, enable display, enable Vint
  117.  
  118.   jmp ROM_MAIN                          ; Jump to the original power-on vector address.
  119.  
  120.  
  121.  
  122.  
  123.  
  124. ;//........................................................................
  125. INIT_VDP:
  126.  
  127.     move.w #$8104,VDP_CTRL              ;disble the display
  128.    
  129.     lea Init_VDP_REGS, a0               ;initialize regs
  130. .lp01
  131.     move.w (a0)+,d0
  132.     cmp.w #$ffff,d0
  133.     beq .out00
  134.     move.w d0,VDP_CTRL
  135.     bra .lp01
  136. .out00
  137.  
  138.     move.l #$40000000, VDP_CTRL        ;clear vram
  139.     move.l #$00003fff,d0
  140. .lp02
  141.     move.l #$00000000,VDP_DATA
  142.    dbra d0, .lp02
  143.    
  144.     move.l #$C0000000, VDP_CTRL        ;clear CRAM
  145.     move.l #$20,d0
  146. .lp03
  147.     move.w #$0000, VDP_DATA
  148.     dbra d0,.lp03
  149.  
  150.     move.l #$40000010, VDP_CTRL        ;clear VSRAM
  151.     move.l #$40,d0
  152. .lp04
  153.     move.w #$0000, VDP_DATA
  154.     dbra d0,.lp04
  155.   rts
  156.  
  157.  
  158. ;data
  159.   align 2
  160. Init_VDP_REGS:  
  161.    dc.w $8004                           ; Plane A @ $e000
  162.    dc.w $8238                           ; Plane A @ $e000
  163.    dc.w $8300                           ; Window @ $0000
  164.    dc.w $8406                           ; Plane B @ $c000
  165.    dc.w $855f                           ; Sprite table @ $be00    
  166.    dc.w $8700                           ; Set BG color  
  167.    dc.w $8a00                           ; Hint raster
  168.    dc.w $8b00                           ; Set scroll mode: full scroll  
  169.    dc.w $8c00                           ; Set res H32, non interlaced, hilight disabled
  170.    dc.w $8d2f                           ; Hscroll block @ $bc00  
  171.    dc.w $8f02                           ; Auto-increment to 2
  172.    dc.w $9011                           ; Map set to 64x32
  173.    dc.w $9100                           ; window disable
  174.    dc.w $92ff                           ; window disable
  175.    dc.w $ffff
  176.  
  177.  
  178.  
  179. ;//........................................................................
  180. VINT:
  181.  
  182.     ; Additional vblank layer code here.
  183.     ; Jump to original vblank interrupt routine
  184.  
  185.   jmp VBL
  186.    
  187.    
  188. ;//........................................................................
  189. HINT:
  190.   RTE
  191.  
  192.  
  193. ;//........................................................................
  194. INT:
  195.   RTE
  196.  
  197.  
  198.  
  199. ;//........................................................................
  200.   align 2
  201.  
  202.   include "gamepad.asm"
  203.  
  204.  
  205.  
  206.  
  207. ;//........................................................................
  208. ;
  209. ;   EQUATES:
  210.  
  211.   ;arcade equates
  212. ROM_MAIN = $00000400
  213. VBL = $00000404
  214.  
  215.   ;Genesis equates
  216. VDP_CTRL = $00C00004
  217. VDP_DATA = $00C00000
  218.  
  219.  
  220.  
  221.  
  222. ;/////////////////////////////////////////////////////////////////////////////////////////////
  223. ;/////////////////////////////////////////////////////////////////////////////////////////////
  224. ;/////////////////////////////////////////////////////////////////////////////////////////////
  225. ;/////////////////////////////////////////////////////////////////////////////////////////////
  226. ;
  227. ; BSS
  228. ;
  229.  
  230.  
  231.   org $ff0000           ; <- Arcade doesn't use $FFFF0000-$FFFFBFFF work ram (hopefully it
  232.                         ;    doesn't use the mirrored ram addresses)
  233.  
  234.   VDP_STAT: ds.w 1  
  235.   vblank_num: ds.w 1
  236.   vblank: ds.w 1
  237.   BG0_VS: ds.l 1
  238.   BG1_VS: ds.l 1
  239.   BG0_HS: ds.l 1
  240.   BG1_HS: ds.l 1
  241.   SATB: ds.w (80*4)                   ;local sprite table
  242.    
  243. ;// some external defined variables
  244.  
  245.   include "gamepad.inc"
  246.  
  247.  
  248. ;//........................................................................
  249. ;
  250. ;   General notes:
  251. ;
  252. ;
  253.  
  254.  
  255.  
  256. ;End of File
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement