aboutsummaryrefslogtreecommitdiff
path: root/tester/core
diff options
context:
space:
mode:
authorJavier Degirolmo2012-08-14 22:49:32 -0300
committerJavier Degirolmo2012-08-14 22:49:32 -0300
commit6ab75ecb612fbbe2ec939bd758bbbe620e6d5040 (patch)
tree8122e6eeeacf4912b439dc77e48ea30181b48c01 /tester/core
parent416f24632deee748d4789982262063bda598a1ef (diff)
Renamed Echo Tester directory from src-68k to tester
Diffstat (limited to 'tester/core')
-rw-r--r--tester/core/entry.68k170
-rw-r--r--tester/core/header.68k37
-rw-r--r--tester/core/menu.68k141
-rw-r--r--tester/core/songlist.68k73
-rw-r--r--tester/core/vars.68k12
5 files changed, 433 insertions, 0 deletions
diff --git a/tester/core/entry.68k b/tester/core/entry.68k
new file mode 100644
index 0000000..5da6abc
--- /dev/null
+++ b/tester/core/entry.68k
@@ -0,0 +1,170 @@
+;****************************************************************************
+; EntryPoint
+; Where the program starts
+;****************************************************************************
+
+EntryPoint:
+ move.w #$2700, sr ; Disable interrupts
+
+ move.b ($A10001), d0 ; Disable TMSS if needed
+ and.b #$0F, d0
+ beq.s @NoTMSS
+ move.l #"SEGA", ($A14000)
+@NoTMSS:
+
+ bsr InitJoypad ; Init joypad
+
+ lea ($C00004), a0 ; Init VDP
+ move.w #$8004, (a0) ; No IRQ4, no HV latch
+ move.w #$8114, (a0) ; Disable display
+ move.w #$8230, (a0) ; Scroll A: $C000
+ move.w #$8407, (a0) ; Scroll B: $E000
+ move.w #$8578, (a0) ; Sprites: $F000
+ move.w #$8700, (a0) ; Background: pal 0, color 0
+ move.w #$8B00, (a0) ; No IRQ2, full scroll
+ move.w #$8C81, (a0) ; H40, no S/H, no interlace
+ move.w #$8D3E, (a0) ; HScroll: $F800
+ move.w #$8F02, (a0) ; Autoincrement: 2 bytes
+ move.w #$9001, (a0) ; Scroll size: 64x32
+ move.w #$9100, (a0) ; Hide window plane
+ move.w #$9200, (a0) ; " " "
+
+ moveq #0, d0 ; Clear VRAM
+ move.l #$40000000, (a0)
+ lea ($C00000), a1
+ move.w #$800-1, d1
+@ClearVRAM:
+ move.l d0, (a1)
+ move.l d0, (a1)
+ move.l d0, (a1)
+ move.l d0, (a1)
+ move.l d0, (a1)
+ move.l d0, (a1)
+ move.l d0, (a1)
+ move.l d0, (a1)
+ dbf d1, @ClearVRAM
+
+ move.l #$C0000000, (a0) ; Clear CRAM
+ moveq #8-1, d1
+@ClearCRAM:
+ move.l d0, (a1)
+ move.l d0, (a1)
+ move.l d0, (a1)
+ move.l d0, (a1)
+ dbf d1, @ClearCRAM
+
+ move.l #$40000010, (a0) ; Clear VSRAM
+ move.l d0, (a1)
+
+ lea (PointerList), a0 ; Initialize Echo
+ bsr Echo_Init
+
+ bsr LoadFont ; Load font
+
+ lea ($C00004), a0 ; Load palette
+ lea ($C00000), a1
+ move.l #$C0020000, (a0)
+ move.l #$066600CE, (a1)
+ move.l #$000E000E, (a1)
+ move.l #$C0220000, (a0)
+ move.l #$06660EEE, (a1)
+ move.l #$000E000E, (a1)
+ move.l #$C0420000, (a0)
+ move.l #$04440E88, (a1)
+ move.l #$C0620000, (a0)
+ move.l #$04440888, (a1)
+
+ move.l #$C00A0000, (a0)
+ move.l #$02220444, (a1)
+ move.l #$02240024, (a1)
+ move.l #$02440020, (a1)
+ move.w #$0040, (a1)
+
+ move.l #$58000000, (a0) ; Load graphics
+ lea (@Gfx_Arrows), a2
+ moveq #12-1, d7
+@LoadGfx:
+ move.l (a2)+, (a1)
+ move.l (a2)+, (a1)
+ move.l (a2)+, (a1)
+ move.l (a2)+, (a1)
+ move.l (a2)+, (a1)
+ move.l (a2)+, (a1)
+ move.l (a2)+, (a1)
+ move.l (a2)+, (a1)
+ dbf d7, @LoadGfx
+
+ move.l #$44880003, (a0) ; Write left arrow
+ move.l #$00C000C1, (a1)
+ move.l #$45080003, (a0)
+ move.l #$00C200C3, (a1)
+
+ move.l #$44C40003, (a0) ; Write right arrow
+ move.l #$28C128C0, (a1)
+ move.l #$45440003, (a0)
+ move.l #$28C328C2, (a1)
+
+ moveq #2, d0 ; Write title
+ moveq #1, d1
+ move.w #$8000, d2
+ lea (@Str_Title1), a0
+ bsr WriteString
+ addq.w #2, d1
+ move.w #$E000, d2
+ lea (@Str_Title2), a0
+ bsr WriteString
+
+ moveq #20-(24/2), d0 ; Write instructions
+ moveq #23, d1
+ lea (@Str_Instr1), a0
+ bsr WriteString
+ moveq #20-(18/2), d0
+ addq.w #2, d1
+ lea (@Str_Instr2), a0
+ bsr WriteString
+
+ bsr DrawBG ; Draw background
+
+ move.w #$8154, ($C00004) ; Enable display
+ bra MainMenu ; Go into the main menu
+
+;****************************************************************************
+
+@Gfx_Arrows:
+ dc.l $00000000, $00000000, $00000000, $00000000
+ dc.l $00000034, $00004343, $00343434, $43434343
+ dc.l $00000034, $00004343, $00343434, $43434343
+ dc.l $34343434, $43434343, $34343434, $43434343
+ dc.l $34343434, $00434343, $00003434, $00000043
+ dc.l $00000000, $00000000, $00000000, $00000000
+ dc.l $34343434, $43434343, $34343434, $43434343
+ dc.l $34343434, $00434343, $00003434, $00000043
+
+@Gfx_BG:
+ dc.l $55555555, $55555555, $55555555, $55555555
+ dc.l $55555555, $55555555, $55555555, $55555555
+ dc.l $00000000, $00000000, $00000000, $00000000
+ dc.l $00000000, $00000000, $00000000, $00000000
+ dc.l $66666666, $66666666, $66666666, $66666666
+ dc.l $66666666, $66666666, $66666666, $66666666
+
+ dc.l $78787878, $87878787, $78787878, $87878787
+ dc.l $78787878, $87878787, $78787878, $87878787
+ dc.l $79797979, $97979797, $79797979, $97979797
+ dc.l $79797979, $97979797, $79797979, $97979797
+
+ dc.l $AAAAAAAA, $AAAAAAAA, $AAAAAAAA, $AAAAAAAA
+ dc.l $AAAAAAAA, $AAAAAAAA, $AAAAAAAA, $AAAAAAAA
+ dc.l $BABABABA, $ABABABAB, $BABABABA, $ABABABAB
+ dc.l $BABABABA, $ABABABAB, $BABABABA, $ABABABAB
+
+ dc.l $56565656, $65656565, $56565656, $65656565
+ dc.l $56565656, $65656565, $56565656, $65656565
+
+ ; 123456789012345678901234567890123456
+
+@Str_Title1: dc.b "Echo sound engine", 0
+@Str_Title2: dc.b "Version 0.9 by Sik", 0
+@Str_Instr1: dc.b "Use D-pad to select song", 0
+@Str_Instr2: dc.b "A/C: play, B: stop", 0
+ even
diff --git a/tester/core/header.68k b/tester/core/header.68k
new file mode 100644
index 0000000..fde18ee
--- /dev/null
+++ b/tester/core/header.68k
@@ -0,0 +1,37 @@
+;****************************************************************************
+; 68000 vectors
+;****************************************************************************
+
+ dc.l $1000000
+ dc.l EntryPoint
+ dcb.l 62, ErrorInt
+
+;****************************************************************************
+; Mega Drive header
+;****************************************************************************
+
+ dc.b "SEGA MEGA DRIVE "
+ dc.b "(C) SIK 2010.NOV"
+ dc.b "ECHO TESTER PROGRAM"
+ dcb.b $150-*, $20
+ dc.b "ECHO TESTER PROGRAM"
+ dcb.b $180-*, $20
+ dc.b "XX XXXXXXXX-00"
+ dc.w $0000
+ dc.b "J"
+ dcb.b $1A0-*, $20
+ dc.l $000000, $3FFFFF
+ dc.l $FF0000, $FFFFFF
+ dcb.b 12, $20
+ dcb.b 12, $20
+ dcb.b 40, $20
+ dc.b "JUE"
+ dcb.b $200-*, $20
+
+;****************************************************************************
+; ErrorInt
+; Generic error handler routine (hangs up)
+;****************************************************************************
+
+ErrorInt:
+ bra.s *
diff --git a/tester/core/menu.68k b/tester/core/menu.68k
new file mode 100644
index 0000000..d5f7914
--- /dev/null
+++ b/tester/core/menu.68k
@@ -0,0 +1,141 @@
+;****************************************************************************
+; MainMenu
+; Menu where you get to select the song and such
+; The main screen, bah...
+;****************************************************************************
+
+MainMenu:
+ move.w #0, (RAM_CurrSong) ; Selected song
+ bsr UpdateMenu ; Show description of first song
+
+ move.l #0, (RAM_LArrowAnim) ; Reset arrows anim
+ move.w #$8407, (RAM_BGAnim) ; Reset background anim
+
+@MainLoop:
+ move.b (RAM_JoyPress), d0 ; Get joypad input
+
+ btst.l #2, d0 ; Previous song?
+ beq.s @NoLeft
+
+ move.w (RAM_CurrSong), d7 ; Select previous song
+ bne.s @NotTooLeft
+ move.w #NumSongs, d7
+@NotTooLeft:
+ subq.w #1, d7
+ move.w d7, (RAM_CurrSong)
+
+ bsr UpdateMenu ; Update current song
+ move.w #28, (RAM_LArrowAnim) ; Animate left arrow
+ lea (SFX_Beep), a0 ; Beep!
+ bsr Echo_PlaySFX
+@NoLeft:
+
+ btst.l #3, d0 ; Next song?
+ beq.s @NoRight
+
+ move.w (RAM_CurrSong), d7 ; Select next song
+ addq.w #1, d7
+ cmp.w #NumSongs, d7
+ blt.s @NotTooRight
+ moveq #0, d7
+@NotTooRight:
+ move.w d7, (RAM_CurrSong)
+ bsr UpdateMenu ; Update current song
+
+ move.w #28, (RAM_RArrowAnim) ; Animate right arrow
+ lea (SFX_Beep), a0 ; Beep!
+ bsr Echo_PlaySFX
+@NoRight:
+
+ btst.l #5, d0 ; Play song?
+ bne.s @DoPlay
+ btst.l #6, d0
+ beq.s @NoPlay
+@DoPlay:
+ lea (SongList), a1 ; Get song address
+ move.w (RAM_CurrSong), d7
+ lsl.w #4, d7
+ lea (a1,d7.w), a1
+ move.l (a1), a0
+ bsr Echo_PlayBGM ; Play song
+@NoPlay:
+
+ btst.l #4, d0 ; Stop song?
+ beq.s @NoStop
+ bsr Echo_StopBGM
+@NoStop:
+
+ btst.l #7, d0 ; Debug key
+ beq.s @NoDebug
+ lea (BGM_Test), a0 ; Play test BGM
+ ;bsr Echo_PlayBGM
+ lea (SFX_Test), a0 ; Play test SFX
+ bsr Echo_PlaySFX
+@NoDebug:
+
+ lea (@ArrowPal), a0
+
+ move.w (RAM_LArrowAnim), d0 ; Animate left arrow
+ move.l (a0,d0.w), d1
+ move.l #$C0060000, ($C00004)
+ move.l d1, ($C00000)
+ subq.w #2, d0
+ bge.s @NoLArrowOver
+ moveq #0, d0
+@NoLArrowOver:
+ move.w d0, (RAM_LArrowAnim)
+
+ move.w (RAM_RArrowAnim), d0 ; Animate right arrow
+ move.l (a0,d0.w), d1
+ move.l #$C0260000, ($C00004)
+ move.l d1, ($C00000)
+ subq.w #2, d0
+ bge.s @NoRArrowOver
+ moveq #0, d0
+@NoRArrowOver:
+ move.w d0, (RAM_RArrowAnim)
+
+ move.w (RAM_BGAnim), d0 ; Animate background
+ bchg.l #1, d0
+ move.w d0, (RAM_BGAnim)
+ move.w d0, ($C00004)
+
+ bsr VSync ; Next frame
+ bsr ReadJoypad
+ bra @MainLoop
+
+;****************************************************************************
+
+@ArrowPal:
+ dc.w $00E, $00E, $02E, $02E, $04E, $04E, $06E, $06E
+ dc.w $28E, $28E, $4AE, $4AE, $6CE, $6CE, $8EE, $8EE
+
+;****************************************************************************
+; UpdateMenu
+; Shows the current option on screen
+;****************************************************************************
+
+UpdateMenu:
+ bsr ClearLines ; Clear lines
+
+ lea (SongList), a1 ; Get address of song data
+ move.w (RAM_CurrSong), d0
+ lsl.w #4, d0
+ lea (a1,d0.w), a1
+ addq.l #4, a1
+
+ moveq #7, d0 ; Write song title
+ moveq #9, d1
+ move.w #$A000, d2
+ move.l (a1)+, a0
+ bsr WriteString
+
+ addq.w #2, d1 ; Write song description
+ move.w #$C000, d2
+ move.l (a1)+, a0
+ bsr WriteString
+ addq.w #2, d1
+ move.l (a1)+, a0
+ bsr WriteString
+
+ rts ; End of subroutine
diff --git a/tester/core/songlist.68k b/tester/core/songlist.68k
new file mode 100644
index 0000000..527ea6d
--- /dev/null
+++ b/tester/core/songlist.68k
@@ -0,0 +1,73 @@
+;****************************************************************************
+; SongList
+; List of songs that appear on the menu
+;****************************************************************************
+
+SongList:
+ dc.l BGM_Midnas, @Str_Midnas_1, @Str_Midnas_2, @Str_Midnas_3
+ dc.l BGM_Nelpel, @Str_Nelpel_1, @Str_Nelpel_2, @Str_Nelpel_3
+ dc.l BGM_Megajysays, @Str_Megajysays_1, @Str_Megajysays_2, @Str_Megajysays_3
+ dc.l BGM_Doomsday, @Str_Doomsday_1, @Str_Doomsday_2, @Str_Doomsday_3
+ dc.l BGM_PianoTest, @Str_PianoTest_1, @Str_PianoTest_2, @Str_Null
+ dc.l BGM_SquSawTest2, @Str_SquSawTest_1a, @Str_SquSawTest_2, @Str_SquSawTest_3a
+ dc.l BGM_SquSawTest1, @Str_SquSawTest_1b, @Str_SquSawTest_2, @Str_SquSawTest_3b
+ dc.l BGM_PSGTest, @Str_PSGTest_1, @Str_PSGTest_2, @Str_Null
+ dc.l BGM_DrumTest, @Str_DrumTest_1, @Str_DrumTest_2, @Str_Null
+ dc.l BGM_FluteTest, @Str_FluteTest_1, @Str_FluteTest_2, @Str_FluteTest_3
+
+ ; 012345678901234567890123456
+@Str_Null: dc.b 0
+@Str_Untitled: dc.b "[untitled]", 0
+
+ ; 012345678901234567890123456
+@Str_Midnas_1: dc.b "Midna's Desperate Hour", 0
+@Str_Midnas_2: dc.b "Composed by Koji Kondo", 0
+@Str_Midnas_3: dc.b "Transcribed by Aivi Tran", 0
+
+ ; 012345678901234567890123456
+@Str_Nelpel_1: dc.b "Nelpel Four (crappy ver.)", 0
+@Str_Nelpel_2: dc.b "XM > MIDI > ESF conversion", 0
+@Str_Nelpel_3: dc.b "and really bad instruments", 0
+
+ ; 012345678901234567890123456
+@Str_Megajysays_1: dc.b "Megajysays", 0
+@Str_Megajysays_2: dc.b "That second A should have", 0
+@Str_Megajysays_3: dc.b "two dots on top of it.", 0
+
+ ; 012345678901234567890123456
+@Str_Doomsday_1: dc.b "The Doomsday Project", 0
+@Str_Doomsday_2: dc.b "Another module conversion.", 0
+@Str_Doomsday_3: dc.b "Like I give a crap :P", 0
+
+ ; 012345678901234567890123456
+@Str_PianoTest_1: dc.b "test-piano.mid", 0
+@Str_PianoTest_2: dc.b "Some generic piano...", 0
+
+ ; 012345678901234567890123456
+@Str_SquSawTest_1a: dc.b "test-squsaw-2ch.mid", 0
+@Str_SquSawTest_1b: dc.b "test-squsaw-1ch.mid", 0
+@Str_SquSawTest_2: dc.b "FM square and sawtooth", 0
+@Str_SquSawTest_3a: dc.b "2 channels version", 0
+@Str_SquSawTest_3b: dc.b "1 channel version", 0
+
+ ; 012345678901234567890123456
+@Str_PSGTest_1: dc.b "test-psg.mid", 0
+@Str_PSGTest_2: dc.b "Two square PSG channels.", 0
+
+ ; 012345678901234567890123456
+@Str_DrumTest_1: dc.b "test-drums.mid", 0
+@Str_DrumTest_2: dc.b "Snare and kicks!", 0
+
+ ; 012345678901234567890123456
+@Str_FluteTest_1: dc.b "test-flute.mid", 0
+@Str_FluteTest_2: dc.b "Flute and a seashore.", 0
+@Str_FluteTest_3: dc.b "Feels so calm...", 0
+
+ even
+
+;****************************************************************************
+; NumSongs
+; Number of songs in song list
+;****************************************************************************
+
+NumSongs equ 10
diff --git a/tester/core/vars.68k b/tester/core/vars.68k
new file mode 100644
index 0000000..8097c73
--- /dev/null
+++ b/tester/core/vars.68k
@@ -0,0 +1,12 @@
+;****************************************************************************
+; Where program variables are defined
+;****************************************************************************
+
+ rsset $FF0000
+
+RAM_JoyHold rs.b 1 ; Current "held" joypad status
+RAM_JoyPress rs.b 1 ; Current "pressed" joypad status
+RAM_LArrowAnim rs.w 1 ; Animation for left arrow
+RAM_RArrowAnim rs.w 1 ; Animation for right arrow
+RAM_BGAnim rs.w 1 ; Animation for background
+RAM_CurrSong rs.w 1 ; Selected song