X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=lugburz;a=blobdiff_plain;f=src%2Famiga%2Fstartup.s;fp=src%2Famiga%2Fstartup.s;h=bd617749cfb3ab49680986d96a00f8eaa031078f;hp=e008e47b0af454086b32d4876660330dce0adafb;hb=bbb16764040d04e38a51e8228fce53cda51694b2;hpb=de1ab83aa725f7ae16d1708612744787e6ee9e6c diff --git a/src/amiga/startup.s b/src/amiga/startup.s index e008e47..bd61774 100644 --- a/src/amiga/startup.s +++ b/src/amiga/startup.s @@ -1,5 +1,9 @@ | vi:filetype=gas68k: + .include "hwregs.inc" + + .global move_init_stack .global halt_cpu + .global panic .extern main .section .startup,"a" @@ -8,7 +12,7 @@ move.l #super, 0x80 trap #0 super: - ori.w #0x0300, %sr | disable interrupts + or.w #0x0700, %sr | disable interrupts | zero the .bss section move.l #_bss_start, %a0 @@ -19,9 +23,9 @@ super: cmp.l %a0, %a1 bne.s 0b 1: - | setup the stack at the top of (traditional) chipmem for now - move.l #0x80000, %sp - andi.w #0xf8ff, %sr | enable interrupts + | setup a temporary stack + move.l #0x40000, %sp + and.w #0xf8ff, %sr | enable interrupts | initialize early exception handlers jsr exc_init @@ -29,5 +33,30 @@ super: jsr main 0: bra.b 0b +move_init_stack: + move.l #0x40000, %a1 | a1 <- old stack + move.l 4(%sp), %a0 | a0 <- new stack +0: move.l -(%a1), %d0 + move.l %d0, -(%a0) + cmp.l %sp, %a1 + bhi.s 0b + move.l %a0, %sp + rts + halt_cpu: stop #0x2700 + +panic: + or.w #0x0700, %sr + move.l #0xdff000, %a0 + move.w #0x7fff, DMACON(%a0) | clear all DMACON bits + move.w #0xf00, COLOR0(%a0) + + pea str_panic + jsr printf + add.l #8, %sp | also get rid of the reutrn address + + jsr printf + bra halt_cpu + +str_panic: .asciz "Kernel panic!\n~~~~~~~~~~~~~\n"