Intro startup assembly code
When starting an intro on the amiga you want that all processes belonging to the OS are frozen and stored away.
This is my startup code that holds and stores the system, inits a copper and starts the vertical blank interupt that is called 50 times per second to run your code for the demo
start:
movem.l d0-a6,-(sp)
move.l 4.w,a6
jsr -132(a6)
lea $dff000,a6
move.w $02(a6),d0
or.w #$8000,d0
move.w d0,DMACon
move.w $1c(a6),d0
or.w #$c000,d0
move.w d0,IntEna
move.w #$7fff,$96(a6)
move.w #$7fff,$9a(a6)
move.l $6c.w,OldIRQ
move.l #NewIRQ,$6c.w
move.b #$87,$bfd100
move.l #tr_coplist_view, $080(a6)
clr.w $088(a6)
move.w #$87c0,$96(a6) ; Enable DMA
move.w #$c020,$9a(a6) ; Enable IRQ
move.l #$00000000,$144(a6)
.1 btst #6, $bfe001
bne.b .1
lea $dff000,a6
move.w #$7fff,$96(a6)
move.w #$7fff,$9a(a6)
move.l OldIRQ(pc),$6c.w
move.w IntEna(pc),$9a(a6)
move.l 4.w,a5
move.l $9c(a5),a1
move.w #$7fff,$96(a6)
move.l 38(a1),$80(a6)
move.w #$0000,$88(a6)
move.w DMACon(pc),$96(a6)
bsr.b WaitBlitter
jsr -138(a5)
movem.l (sp)+, d0-a6
moveq #0,d0
rts
** ------------------------------- **
DMACon: dc.w 0
IntEna: dc.w 0
OldIRQ: dc.l 0
OldView: dc.l 0
GfxBase: dc.b 'graphics.library',0,0
** ------------------------------- **
**
** ------------------------------- **
WaitVb:
move.l $dff004,d0
and.l #$1ff00,d0
cmp.l #300<<8,d0
bne.b WaitVb
rts
** ------------------------------- **
**
** ------------------------------- **
WaitBlitter: ; Wait until blitter is finished
tst.w $dff000 ; for compatibility with A1000
.1: btst #6,$dff002
bne.s .1
rts
** ------------------------------- **
**
** ------------------------------- **
NewIRQ:
movem.l d0-a6, -(a7)
lea $dff000,a6
.showRasterTime:
; btst #2,$016(a6)
; bne.s .exitIRQ
; bsr.b WaitBlitter
; move.w #$0840, $180(a6)
.exitIRQ:
move.w #$0020,$09c(a6)
move.w #$0020,$09c(a6)
movem.l (a7)+, d0-a6
rte
I know it can be much better but this works for me
0 Comments