include "include/macros.gs" SECTION code,code InitSys bsr.b OSout bsr.w Start bsr.w OSin rts dc.b "$VER: copyright 2006 by winden of network ^ batman group",0 ALIGN OSout move.l 4,a6 lea GfxLib,a1 moveq.l #0,d0 jsr -552(a6) move.l d0,GfxBase move.l d0,a6 move.l 38(a6),OldCopper move.l 34(a6),OldView jsr -456(a6) lea 0.w,a1 jsr -222(a6) jsr -270(a6) jsr -270(a6) move.l 4,a6 jsr -132(a6) jsr -150(a6) move.l d0,SysStack btst.b #0,$129(a6) beq.b .68000 movec.l vbr,d0 move.l d0,VectorBase ; Get Real VBR move.l #10,processor btst.b #1,$129(a6) beq.b .68000 move.b #20,processor btst.b #2,$129(a6) beq.b .68000 move.b #30,processor btst.b #3,$129(a6) beq.b .68000 move.b #40,processor .68000 move.w $dff01c,IntEnaR move.w $dff01e,IntReqR move.w $dff002,DmaConR move.w $dff010,AdkConR move.w #%0111111111111111,$dff09a move.w #%1100000000100000,$dff09a .Spr move.l $dff004,D0 and.l #$0001FF00,D0 bne.b .Spr move #%0111111111111111,$dff096 move #%1000001111000000,$dff096 move $dff07c,d0 cmp.b #$f8,d0 bne.b .NotAGA move #0,$dff1fc .NotAGA move.l VectorBase,a0 move.l $6c(a0),Int3Save move.l $70(a0),Int4Save move.l #Level_3,$6c(a0) move.l #Level_4,$70(a0) rts OSin move.l VectorBase,a0 move.l Int3Save,$6c(a0) move.l Int4Save,$70(a0) move IntEnaR,d7 bset #$f,d7 move d7,$dff09a move IntReqR,d7 bset #$f,d7 move d7,$dff09c move DmaConR,d7 bset #$f,d7 move d7,$dff096 move AdkConR,d7 bset #$f,d7 move d7,$dff09e move.l GfxBase,a6 move.l OldView,a1 jsr -222(a6) move.l OldCopper,$dff080 jsr -462(a6) move.l 4,a6 move.l GfxBase,a1 jsr -414(a6) jsr -138(a6) move.l SysStack,d0 jsr -156(a6) moveq.l #0,D0 rts ***************** INTERRUPCION ALIGN Level_3 PUSH moveq.l #0,d0 move.w $1e(a6),d0 ; IntReqR btst #4,d0 ; Copper bne.b LV3_Copper btst #5,d0 ; VBlank bne.b LV3_VBlank btst #6,d0 ; Blitter bne.b LV3_Blitter bra.b LV3_End LV3_Copper move.w #$70,$9c(a6) ; apaga interrupcion move.w #$70,$9c(a6) bra.b LV3_End LV3_VBlank move.w #$70,$9c(a6) ; apaga interrupcion move.w #$70,$9c(a6) bsr.b mouse LV3_sig addq.w #1,timer st.b frame_on bra.b LV3_End LV3_Blitter move.w #$70,$9c(a6) ; apaga interrupcion move.w #$70,$9c(a6) ; bra.b LV3_End ALIGN LV3_End POP nop nop rte ALIGN mouse move.b #0,mouse_left btst.b #6,$bfe001 bne.b mouse_0 move.b #1,mouse_left mouse_0 move.b #0,mouse_right btst.b #2,$dff017 bne.b mouse_1 move.b #1,mouse_right mouse_1 rts ***************** COMIENZO Level_4 movem.l d0-d7/a0-a6,-(sp) lea $dff000,a0 ;move.w #$f00,$180(a0) move.w #$0780,$9c(a0) move.w #$0780,$9c(a0) lea samplep,a1 movem.l (a1),d0/d1 exg.l d0,d1 movem.l d0/d1,(a1) move.l d0,a1 move.l d0,$a0(a0) move.l d0,$b0(a0) move.w #500,$a4(a0) move.w #500,$b4(a0) ;jsr play_wav16 jsr play_wav8 ;jsr play_adpcm ;move.w #$000,$dff180 movem.l (sp)+,d0-d7/a0-a6 nop nop rte play_wav16 move.l smpaddr,a2 moveq.l #0,d0 move.w #1000/4-1,d7 .loop m1 macro move.w \1(a2),d1 ; read sample ror.w #8,d1 ; bigendianize add.w d2,d1 ; add previous value add.w #$80,d1 ; round to nearest move.w d1,d2 ; save and.w #$ff00,d1 ; quantize sub.w d1,d2 ; calc diff ror.w #8,d1 ; repoint tst.l (16+\1)(a2) ; prefetch move.b d1,d0 endm m1 0 lsl.l #8,d0 m1 4 lsl.l #8,d0 m1 8 lsl.l #8,d0 m1 12 move.l d0,(a1)+ lea 16(a2),a2 dbra d7,.loop move.l a2,smpaddr rts play_wav8 move.l smpaddr,a2 move.l #0,d0 move.l #128,d5 move.w #1000/4-1,d7 .loop move.b (a2)+,d0 move.b (a2)+,d1 move.b (a2)+,d2 move.b (a2)+,d3 sub.b d5,d0 sub.b d5,d1 sub.b d5,d2 sub.b d5,d3 move.b d0,d6 lsl.l #8,d6 move.b d1,d6 lsl.l #8,d6 move.b d2,d6 lsl.l #8,d6 move.b d3,d6 tst.l 12(a2) move.l d6,(a1)+ dbra d7,.loop move.l a2,smpaddr rts wid equ 320 hei equ 256 Start move.l sp,old_sp move.l #$dff000,a6 bsr.w rut2 BWAIT FRAME FRAME move.l old_sp,sp rts ALIGN rut2 lea $dff000,a6 FRAME move.l #cop,$80(a6) ; activamos la copper FRAME move.l #cop,$80(a6) ; activamos la copper move.l smpaddr,a0 .l1 cmp.l #'data',(a0)+ bne.b .l1 move.l (a0)+,d0 move.l a0,smpaddr add.l d0,a0 move.l a0,smpend ;move.l adpaddr,a0 .l2 ;cmp.l #'data',(a0)+ ;bne.b .l2 ;move.l (a0)+,d0 ;lea (a0,d0.l),a1 ;move.l a0,adpaddr ;add.l d0,a0 ;move.l a0,adpend move.l #sample1,$a0(a6) move.w #500,$a4(a6) move.w #124,$a6(a6) move.w #$40,$a8(a6) move.l #sample1,$b0(a6) move.w #500,$b4(a6) move.w #124,$b6(a6) move.w #$40,$b8(a6) move.w #$c180,$9a(a6) move.w #$8202,$96(a6) lea planos,a0 lea copbpl,a1 move.l a0,d0 move.w d0,6(a1) swap d0 move.w d0,2(a1) rut2_main FRAME move.l smpaddr,d0 move.l smpend,d1 cmp.l d0,d1 blt.b .exit ;move.l adpaddr,d0 ;move.l adpend,d1 ;cmp.l d0,d1 ;blt.b .exit tst.b mouse_left ; raton beq.b rut2_main .exit FRAME move.w #$000f,$9a(a6) move.w #$700f,$96(a6) FRAME FRAME FRAME FRAME rts ; wav: $3c == start of sound ; hw: ; ; a0 = addr ; a4 = size = 500 words ; a6 = period = 124 ; a8 = volume = $40 ; 96 = dmaena = $820f start, $000f stop ; 9a = intena = $c080 start, $7800 stop ; 9c = intreq = $0780 accept ***************** COPPER LIST SECTION data_c,data_c cnop 0,8 cop dc.w $08e,$2881 dc.w $090,$28C1 ; DIWindow Size YX dc.w $092,$0038 dc.w $094,$0030+wid/2 dc.w $100,$1200 dc.w $102,$0000 dc.w $104,$0000 dc.w $106,$0000 dc.w $108,$0000 dc.w $10a,$0000 dc.w $180,$0000 dc.w $182,$0fff copbpl dc.w $0e0,$0000,$0e2,$0000 dc.w $ffff,$fffe,$ffff,$fffe ***************** DATAS CHIP SECTION data_c,data_c SECTION bss_c,bss_c ALIGN planos sample1 ds.b 40*64 sample2 ds.b 40*64 ************** DATAS SECTION data,data ALIGN GfxLib dc.b "graphics.library",0 GfxBase dc.l 0 ALIGN IntEnaR dc.l 0 IntReqR dc.l 0 DmaConR dc.l 0 AdkConR dc.l 0 SysStack dc.l 0 Int3Save dc.l 0 Int4Save dc.l 0 OldCopper dc.l 0 OldView dc.l 0 VectorBase dc.l 0 old_sp dc.l 0 processor dc.l 0 timer dc.w 0 mouse_left dc.b 0 mouse_right dc.b 0 frame_on dc.w 0 music_on dc.l 0 smpaddr dc.l wav8 smpend dc.l 0 adpaddr dc.l adpcm adpend dc.l 0 samplep dc.l sample1 dc.l sample2 sinus INCBIN "data/sinustable.raw" ALIGN wav8 incbin "osx:wish8.wav" ALIGN adpcm incbin "osx:wish8.adpcm"