Sega Genesis >> Assembly

Hello world!


Ref. http://mode5.net/tutorials/tutorial3.html

main.asm

  dc.l $fffffe, start,  err,      err
  dc.l err,     err,    err,      err
  dc.l err,     err,    err,      err
  dc.l err,     err,    err,      err
  dc.l err,     err,    err,      err
  dc.l err,     err,    err,      err
  dc.l err,     err,    err,      err
  dc.l hblank,  err,    vblank,   err
  dc.l err,     err,    err,      err
  dc.l err,     err,    err,      err
  dc.l err,     err,    err,      err
  dc.l err,     err,    err,      err
  dc.l err,     err,    err,      err
  dc.l err,     err,    err,      err
  dc.l err,     err,    err,      err
  dc.l err,     err,    err,      err
  dc.b "SEGA GENESIS    "
  dc.b "(C)0000 2019.060"
  dc.b "SEGA Genesis Programming                        "
  dc.b "SEGA Genesis Programming                        "
  dc.b "gm 01234567-89"
  dc.w $dead
  dc.b "j               "
  dc.l 0
  dc.l rom_end
  dc.l $ff0000
  dc.l $ffffff

  org $1000
start:
  bsr clear_regs
  bsr clear_ram    
  bsr setup_vdp
  bsr clear_vram  
  move.l #$c0000000,(a3)
  move.w #$00ee,(a4)

loop:
  bra loop  

setup_vdp:
  lea $c00004.l,a3
  lea $c00000.l,a4
  lea vdpsetuparray,a5
  move.w #0018,d4
vdp_loop:
  move.w (a5)+,(a3)
  nop
  dbf d4,vdp_loop
  rts

clear_vram:
  move.l #$40000000,(a3)
  move.w #$7fff,d4
vram_clear_loop:
  move.w #$0000,(a4)
  dbf d4,vram_clear_loop
  rts

clear_regs:
  moveq #$00000000,d0
  move.l d0,d1
  move.l d0,d2
  move.l d0,d3
  move.l d0,d4
  move.l d0,d5
  move.l d0,d6
  move.l d0,d7
  move.l d0,a0
  move.l d0,a1
  move.l d0,a2
  move.l d0,a3
  move.l d0,a4
  move.l d0,a5
  move.l d0,a6
  rts

clear_ram:
  move.w #$7ff0,d0
  move.l #$ff0000,a0
clear_ram_loop:
  move.w #$0000,(a0)+
  dbf d0,clear_ram_loop
  rts

err:            
  bra err

hblank:
  rte

vblank:
  rte

vdpsetuparray:
  dc.w $8014
  dc.w $8174
  dc.w $8208
  dc.w $8300
  dc.w $8401
  dc.w $8518
  dc.w $8600
  dc.w $8700
  dc.w $8800
  dc.w $8900
  dc.w $8aff
  dc.w $8b00
  dc.w $8c81
  dc.w $8d34
  dc.w $8e00
  dc.w $8f02
  dc.w $9001
  dc.w $9100
  dc.w $9200
rom_end:


Makefile

all:
	vasmm68k_mot -o main.bin -Fbin -no-opt -nosym main.asm

clean:
	rm -rf main.bin

編譯

$ make
  vasmm68k_mot -o main.bin -Fbin -no-opt -nosym main.asm
  vasm 1.4d (c) in 2002-2009 Volker Barthelmann
  vasm M68k/CPU32/ColdFire cpu backend 1.1f (c) 2002-2009 Frank Wille
  vasm motorola syntax module 3.1 (c) 2002-2009 Frank Wille
  vasm binary output module 1.6 (c) 2002-2009 Volker Barthelmann

完成



返回上一頁