;APS00000000000000000000000000000000000000000000000000000000000000000000000000000000 ************************************************ * ECS startup * ************************************************ include "asmpro:includes/graphics_lib.i" include "asmpro:includes/exec_lib.i" include "asmpro:includes/custom.i" section startup,code_c start: movem.l d0-d7/a0-a6,-(sp) bsr.b close_system loop: btst #$06,$bfe001 ;kore rundt indtil at der bliver trykkede pa venstre mus tast bne.s loop bsr.w open_system slut: movem.l (sp)+,d0-d7/a0-a6 moveq.l #00,D0 rts ** interrupt new_irq: movem.l d0-d7/a0-a6,-(sp) nop nop nop move.w #$4020,$dff09c ;clear interrupt bits movem.l (sp)+,d0-d7/a0-a6 rte ;return from interrupt close_system: move.l $4.w,A6 moveq.l #00,D0 lea.l gfxname(pc),a1 jsr _LVOopenlibrary(a6) beq.b slut move.l d0,a1 lea.l oldregs(pc),a5 move.l $26(a1),(a5)+ ;gemmer cop1 move.l $32(a1),(a5)+ ;gemmer cop2 * sub.l a1,a1 * jsr _LVOloadview(a6) * jsr _LVOwaittof(a6) * jsr _LVOwaittof(a6) * jsr _LVOownblitter(a6) * jsr _LVOwaitblit(a6) jsr _LVOcloselibrary(a6) lea.l $dff000,a6 move.w 2(a6),(A5)+ ;gemmer dmaconR move.w $10(a6),(A5)+ ;gemmer adkconR move.w $1c(a6),(A5)+ ;gemmer intirqr move.w #$7fff,$9a(a6) ;interrupt enable bits lea.l oldirq(pc),a0 ; move.l $6c.w,(a0) ; bruger vbr offset til at fa fat i level 3 interruptet lea.l newcop(pc),a0 ; ptr til ny copper list lea.l new_irq(pc),a1 bsr.b wait_vblank move.w #$7fff,$96(a6) ;dma disable move.l a0,cop1lch(a6) ; satter den nye copper list op move.w #%1000000111000000!$8200,$96(a6) ; dma mask ** ---a---bcdefghij ** a --- blitter har prioritet ** b --- bitplane dma ** c --- copper dma ** d --- blitter dma ** e --- sprite dma ** f --- disk dma ** g-j - Audio 3-0 kanal dma move.l a1,$6c.w ; satter den nye level 3 interrupt op move.w #$7fff,$9c(a6) move.w #$c028,$9a(a6) ;interrupt enable rts open_system: lea $dff000,a6 move.w #$7fff,$9a(a6) ;interrupt disable bsr.b wait_vblank move.w #$7fff,$96(a6) ;disable dma lea.l oldregs(pc),a5 move.l (a5)+,$80(a6) ;cop1 move.l (a5)+,$84(a6) ;cop1 move.l oldirq(pc),$6c.w ;lagger den gamle interrupt pa plads or.w #$8000,(a5) move.w (a5)+,$96(a6) or.w #$8000,(a5) move.w (a5)+,$9e(a6) or.w #$c000,(a5) move.w #$7fff,$9c(a6) move.w (a5),$9a(a6) rts ** wait vertical blank wait_vblank: btst #00,$dff005 ;check beam pos beq.s wait_vblank .w: btst #00,$dff005 ;check beam pos bne.s .w rts gfxname: dc.b 'graphics.library',0 cnop 0,2 oldirq: dc.l 0 oldregs: dc.l 0,0 dc.w 0,0,0 newcop: dc.w $008e,$2c81,$0090,$2cc1 dc.w $0092,$0038,$0094,$00d0 dc.w $0180,$0003,$0100,$0200 dc.w $0102,$0000,$0104,$0000 dc.w $0108,$0000,$010a,$0000 dc.w $3c09,$fffe,$0180,$0008 dc.w $3d09,$fffe,$0180,$0004 dc.l $ffdffffe dc.w $1c09,$fffe,$0180,$0008 dc.w $1d09,$fffe,$0108,$0003 dc.l $fffffffe .