static UWORD s_uwOsIntEna; static UWORD s_uwOsDmaCon; static tInterrupt *pOsInterrupts[15] = {0}; static tInterrupt *pAceInterrupts[15] = {0}; void systemCreate(void) { // save the system copperlists and flush the view // get VBR location if you detect a 68010+ machine // save the state of the hardware registers (INTENA, DMA, ADKCON etc.) s_uwOsIntEna = g_pCustom->intenar; s_uwOsDmaCon = g_pCustom->dmaconr; // Disable interrupts (this is the actual "kill system/OS" part) g_pCustom->intena = 0x7FFF; g_pCustom->intreq = 0x7FFF; // Wait for vbl before disabling sprite DMA while (!(g_pCustom->intreqr & INTF_VERTB)) { continue; } // TODO disable DMA here // Save OS interrupt vectors g_pCustom->intreq = 0x7FFF; for(UBYTE i = 0; i < 15; ++i) { pOsInterrupts[i] = SetIntVector(i, 0); } // Enable needed DMA (and interrupt) channels // Reset active system uses counter s_wSystemUses = 0; } void systemDestroy(void) { // disable app interrupts/dma g_pCustom->intreq = 0x7FFF; g_pCustom->intena = 0x7FFF; g_pCustom->dmacon = 0x7FFF; // restore system copperlists // restore old DMA/INTENA/ADKCON etc. settings for(UBYTE i = 0; i < 15; ++i) { SetIntVector(i, pOsInterrupts[i]); } g_pCustom->dmacon = DMAF_SETCLR | s_uwOsDmaCon; g_pCustom->intena = INTF_SETCLR | s_uwOsIntEna; //<---- guru tu // restore old view }
@teh_KaiN, post #1
@Hexmage960, post #4
The dreaded 80000003-Guru is one of the most common on the Amiga: on the 68010- it signifies a word or longword access to an uneven address; on the 68020+ (which is capable of recognising the situation and performing two memory accesses in order to get the information they need) it is put up when the stack is pointing at an odd address. That should never happen, so either your RAM is faulty, or your program is screwing up bigtime. The stack being messed up is truly worthy of a CPU exception, the other reason is not. It's just to circumvent a design desicion.
@teh_KaiN, post #5
@Hexmage960, post #7
_systemCreate: movem.l a3/a2/d2,-(sp) |, move.l _g_pCustom,a0 | g_pCustom, g_pCustom.0_4 move.w 28(a0),d0 | g_pCustom.0_4->intenar, _5 move.w d0,_s_uwOsIntEna | _5, s_uwOsIntEna move.w 2(a0),d0 | g_pCustom.0_4->dmaconr, _7 move.w d0,_s_uwOsDmaCon | _7, s_uwOsDmaCon move.w #32767,154(a0) |, g_pCustom.0_4->intena move.w #32767,156(a0) |, g_pCustom.0_4->intreq .L2: move.w 30(a0),d0 | g_pCustom.0_4->intreqr, _11 and.w #32,d0 |, tmp57 jeq .L2 | move.w #32767,156(a0) |, g_pCustom.0_4->intreq lea _pOsInterrupts,a2 |, ivtmp.26 moveq #0,d2 | ivtmp.19 lea _SetIntVector,a3 |, tmp59 .L3: clr.l -(sp) | move.l d2,-(sp) | ivtmp.19, jsr (a3) | tmp59 move.l d0,(a2)+ |, MEM[base: _27, offset: 0B] addq.l #1,d2 |, ivtmp.19 addq.l #8,sp |, moveq #15,d0 |, cmp.l d2,d0 | ivtmp.19, jne .L3 | clr.w _s_wSystemUses | s_wSystemUses movem.l (sp)+,d2/a2/a3 |, rts .align 2 .globl _systemDestroy _systemDestroy: movem.l a4/a3/a2/d2,-(sp) |, move.l _g_pCustom,a4 | g_pCustom, g_pCustom.1_4 move.w #32767,156(a4) |, g_pCustom.1_4->intreq move.w #32767,154(a4) |, g_pCustom.1_4->intena move.w #32767,150(a4) |, g_pCustom.1_4->dmacon lea _pOsInterrupts,a2 |, ivtmp.38 moveq #0,d2 | ivtmp.31 lea _SetIntVector,a3 |, tmp43 .L10: move.l (a2)+,-(sp) | MEM[base: _25, offset: 0B], move.l d2,-(sp) | ivtmp.31, jsr (a3) | tmp43 addq.l #1,d2 |, ivtmp.31 addq.l #8,sp |, moveq #15,d0 |, cmp.l d2,d0 | ivtmp.31, jne .L10 | move.w _s_uwOsDmaCon,d0 | s_uwOsDmaCon, _13 or.w #-32768,d0 |, _13 move.w d0,150(a4) | _13, g_pCustom.1_4->dmacon move.w _s_uwOsIntEna,d0 | s_uwOsIntEna, _16 or.w #-32768,d0 |, _16 move.w d0,154(a4) | _16, g_pCustom.1_4->intena movem.l (sp)+,d2/a2/a3/a4 |, rts
@teh_KaiN, post #8
Na moje jest niby git, ale nie mam wprawy w czytaniu asemblera więc mogłem coś przeoczyć.
@Hexmage960, post #9
@Hexmage960, post #11
@teh_KaiN, post #12
@Hexmage960, post #13
@teh_KaiN, post #14
Obrona za 3 dni a ja guglam o 30-letnim komputerze. Kiedyś się to obróci przeciwko mnie. ;)
@teh_KaiN, post #1
@asman, post #16
for(UBYTE i = 0; i != 200; ++i) { g_pCustom->intreq = 0x7FFF; while (!(g_pCustom->intreqr & INTF_VERTB)) {} }
@teh_KaiN, post #17
oczywiście robiąc wszystko na FDD OS jest zbędny, ale przy HDD i generalnie systemowym systemie plików już tak (chyba że o czymś nie wiem).
@teh_KaiN, post #19
@asman, post #22
static volatile tHwIntVector * s_pHwVectors = 0;
static volatile tHwIntVector * const s_pHwVectors = 0;
@teh_KaiN, post #23
@teh_KaiN, post #24
@teh_KaiN, post #25