From 875a7b3247246fe96cc8b08bb93020d015b18e92 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Sat, 18 Mar 2023 21:45:55 +0100 Subject: [PATCH 01/60] Fixed Typo in copper.h --- compiler/include/graphics/copper.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/include/graphics/copper.h b/compiler/include/graphics/copper.h index 8a73d3ea8b0..5d0f23cd0ed 100644 --- a/compiler/include/graphics/copper.h +++ b/compiler/include/graphics/copper.h @@ -2,7 +2,7 @@ #define GRAPHICS_COPPER_H /* - Copyright © 1995-2007, The AROS Development Team. All rights reserved. + Copyright © 1995-2007, The AROS Development Team. All rights reserved. $Id$ Desc: Copper definitions and structures. @@ -38,7 +38,7 @@ struct CopIns #define NXTLIST u3.nxtlist #define VWAITPOS u3.u4.u1.VWaitPos #define DESTADDR u3.u4.u1.DestAddr -#define HWAITPOS u3.u4.u2.HWAitPos +#define HWAITPOS u3.u4.u2.HWaitPos #define DESTDATA u3.u4.u2.DestData struct CopList From 583b83f82c5bbfe3eb9ed0de947411c723a47c55 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Sun, 27 Aug 2023 23:07:38 +0200 Subject: [PATCH 02/60] Add Interlace modes, prepare SuperHires --- arch/m68k-amiga/hidd/amigavideo/amigavideo_hiddclass.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/m68k-amiga/hidd/amigavideo/amigavideo_hiddclass.c b/arch/m68k-amiga/hidd/amigavideo/amigavideo_hiddclass.c index 21fdfd0a468..f6f7010697f 100644 --- a/arch/m68k-amiga/hidd/amigavideo/amigavideo_hiddclass.c +++ b/arch/m68k-amiga/hidd/amigavideo/amigavideo_hiddclass.c @@ -34,11 +34,14 @@ static const UWORD widthtable[] = { REZ_X_MIN, (REZ_X_MIN << 1), + // (REZ_X_MIN << 2), /* uncomment this to have SuperHires modes */ 0 }; static const UWORD heighttable[] = { REZ_Y_MIN, + ((REZ_Y_MIN) << 1), (REZ_Y_MIN + REZ_PAL_LINES), + ((REZ_Y_MIN + REZ_PAL_LINES) << 1), 0 }; static const ULONG specialmask_aga[] = { @@ -351,7 +354,7 @@ OOP_Object *AmigaVideoCl__Root__New(OOP_Class *cl, OOP_Object *o, struct pRoot_N res = 0; d = csd->aga ? 8 : 5; } - if (h >= (REZ_Y_MIN << 1)) + if ((h == (REZ_Y_MIN << 1)) || (h == ((REZ_Y_MIN + REZ_PAL_LINES) << 1))) modeid |= LORESLACE_KEY; if (h == REZ_Y_MIN || h == (REZ_Y_MIN << 1)) modeid |= NTSC_MONITOR_ID; From 39b5f945611ac3810bfe7cac52a95737eb2b2796 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Sun, 10 Sep 2023 21:49:07 +0200 Subject: [PATCH 03/60] Implement setwritemask --- rom/graphics/setwritemask.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rom/graphics/setwritemask.c b/rom/graphics/setwritemask.c index 4b38d046b38..d22bd8a945b 100644 --- a/rom/graphics/setwritemask.c +++ b/rom/graphics/setwritemask.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2007, The AROS Development Team. All rights reserved. + Copyright © 1995-2007, The AROS Development Team. All rights reserved. $Id$ $Log Desc: Graphics function SetWriteMask() @@ -46,8 +46,8 @@ { AROS_LIBFUNC_INIT - /* TODO: Write graphics/SetWriteMask() */ - return FALSE; + rp->Mask = (UBYTE)mask; + return -1; AROS_LIBFUNC_EXIT From e11c99cbaba7300e342dc50ca4b6f450145b262d Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Sun, 10 Sep 2023 21:54:30 +0200 Subject: [PATCH 04/60] Implement minterms --- rom/graphics/gfxfuncsupport.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/rom/graphics/gfxfuncsupport.c b/rom/graphics/gfxfuncsupport.c index 71590250840..4a65ede9515 100644 --- a/rom/graphics/gfxfuncsupport.c +++ b/rom/graphics/gfxfuncsupport.c @@ -1213,3 +1213,32 @@ BOOL GetRPClipRectangleForBitMap(struct RastPort *rp, struct BitMap *bm, return res; } + +/****************************************************************************************/ + +void GenMinterms(struct RastPort *rp) +{ + int i; + UBYTE minA=0, minB=0; + + // COMPLEMENT + if(rp->DrawMode & COMPLEMENT) + { + minA = (rp->DrawMode & INVERSVID) ? 0x6a : 0x9a; + for(i=0;i<8;i++) + rp->minterms[i] = minA; + } + else + { + for(i=0 ; i<8 ; i++) + { + minA = ((rp->FgPen >> i) & 1) * 3; + minB = (rp->DrawMode & JAM2) ? ((rp->BgPen >> i) & 1) * 3 : 2; + if(rp->DrawMode & INVERSVID) + minA = (minB << 2) | minA; + else minA = (minA << 2) | minB; + + rp->minterms[i] = (minA << 4) | 0x0a; + } + } +} From c4b352716f835034092cbf316b38cca61c8f917d Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Sun, 10 Sep 2023 21:55:22 +0200 Subject: [PATCH 05/60] Implement minterms --- rom/graphics/gfxfuncsupport.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rom/graphics/gfxfuncsupport.h b/rom/graphics/gfxfuncsupport.h index 3b16e59a9c7..f12603a1101 100644 --- a/rom/graphics/gfxfuncsupport.h +++ b/rom/graphics/gfxfuncsupport.h @@ -219,6 +219,8 @@ void BltRastPortBitMap(struct RastPort *srcRastPort, WORD xSrc, WORD ySrc, WORD xSize, WORD ySize, ULONG minterm, struct GfxBase *GfxBase); +void GenMinterms(struct RastPort *rp); + /****************************************************************************************/ static inline BOOL GetRPClipRectangleForLayer(struct RastPort *rp, struct Layer *lay, struct Rectangle *r, struct GfxBase *GfxBase) From 788d507c1b216a6a20b9e4bff45523d53eea34e4 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Sun, 10 Sep 2023 21:57:20 +0200 Subject: [PATCH 06/60] Implement minterms --- rom/graphics/setapen.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rom/graphics/setapen.c b/rom/graphics/setapen.c index eb3905253e2..479d8b5855e 100644 --- a/rom/graphics/setapen.c +++ b/rom/graphics/setapen.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2011, The AROS Development Team. All rights reserved. + Copyright © 1995-2011, The AROS Development Team. All rights reserved. $Id$ Desc: Graphics function SetAPen() @@ -56,5 +56,7 @@ rp->linpatcnt = 15; rp->Flags &= ~RPF_NO_PENS; + GenMinterms(rp); + AROS_LIBFUNC_EXIT } /* SetAPen */ From 7637c1f02567458dc9087150ec691e44913b7c37 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Sun, 10 Sep 2023 21:57:42 +0200 Subject: [PATCH 07/60] Implement minterms --- rom/graphics/setbpen.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rom/graphics/setbpen.c b/rom/graphics/setbpen.c index 587774f0dc1..fcaa5488b06 100644 --- a/rom/graphics/setbpen.c +++ b/rom/graphics/setbpen.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2011, The AROS Development Team. All rights reserved. + Copyright © 1995-2011, The AROS Development Team. All rights reserved. $Id$ $Log Desc: Graphics function SetBPen() @@ -56,5 +56,7 @@ rp->linpatcnt = 15; rp->Flags &= ~RPF_NO_PENS; + GenMinterms(rp); + AROS_LIBFUNC_EXIT } /* SetBPen */ From 46c6c76f779e3654d82348fb11103ef3abcf96f5 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Sun, 10 Sep 2023 21:58:02 +0200 Subject: [PATCH 08/60] Implement minterms --- rom/graphics/setdrmd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rom/graphics/setdrmd.c b/rom/graphics/setdrmd.c index 9180a411055..5cd27adb008 100644 --- a/rom/graphics/setdrmd.c +++ b/rom/graphics/setdrmd.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2011, The AROS Development Team. All rights reserved. + Copyright © 1995-2011, The AROS Development Team. All rights reserved. $Id$ $Log Desc: Graphics function SetDrMd() @@ -54,5 +54,7 @@ rp->DrawMode = drawMode; rp->linpatcnt = 15; + GenMinterms(rp); + AROS_LIBFUNC_EXIT } /* SetDrMd */ From 484e2cbe52909ce0e0c1afb0cc160a5b57547d70 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Sun, 10 Sep 2023 21:58:27 +0200 Subject: [PATCH 09/60] Implement minterms --- rom/graphics/setabpendrmd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rom/graphics/setabpendrmd.c b/rom/graphics/setabpendrmd.c index e7a69e600b2..5decdbb7a31 100644 --- a/rom/graphics/setabpendrmd.c +++ b/rom/graphics/setabpendrmd.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2011, The AROS Development Team. All rights reserved. + Copyright © 1995-2011, The AROS Development Team. All rights reserved. $Id$ $Log Desc: Graphics function SetABPenDrMd() @@ -67,5 +67,7 @@ rp->linpatcnt = 15; rp->Flags &= ~RPF_NO_PENS; + GenMinterms(rp); + AROS_LIBFUNC_EXIT } /* SetABPenDrMd */ From b3d3ca828efc392c460e257d5fd8d5414d414d0c Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Sun, 10 Sep 2023 21:59:18 +0200 Subject: [PATCH 10/60] Implement minterms --- rom/graphics/initrastport.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rom/graphics/initrastport.c b/rom/graphics/initrastport.c index ab6e66021d5..0077024f9c1 100644 --- a/rom/graphics/initrastport.c +++ b/rom/graphics/initrastport.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2020, The AROS Development Team. All rights reserved. + Copyright © 1995-2020, The AROS Development Team. All rights reserved. $Id$ $Log Desc: Graphics function InitRastPort() @@ -67,6 +67,8 @@ rp->DrawMode = JAM2; rp->LinePtrn = 0xFFFF; + GenMinterms(rp); + SetFont (rp, GfxBase->DefaultFont); AROS_LIBFUNC_EXIT From 454007be3cfb8ad628cd5e93069a4609e6ab9a46 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Tue, 12 Sep 2023 17:17:30 +0200 Subject: [PATCH 11/60] WritePixel rewrite --- rom/graphics/writepixel.c | 117 +++++++++++++++++++++++++++++++++++--- 1 file changed, 109 insertions(+), 8 deletions(-) diff --git a/rom/graphics/writepixel.c b/rom/graphics/writepixel.c index 29b829f6ccb..a03909306b4 100644 --- a/rom/graphics/writepixel.c +++ b/rom/graphics/writepixel.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2013, The AROS Development Team. All rights reserved. + Copyright © 1995-2013, The AROS Development Team. All rights reserved. $Id$ Desc: Graphics function WritePixel() @@ -59,21 +59,122 @@ static LONG pix_write(APTR pr_data, OOP_Object *bm, OOP_Object *gc, { AROS_LIBFUNC_INIT + #define MODUS_XOR 0x1 + #define MODUS_SET 0x3 + #define MODUS_CLR 0x0 + #define MODUS_NON 0x2 + IPTR pix; FIX_GFXCOORD(x); FIX_GFXCOORD(y); - if ((rp->Flags & RPF_NO_PENS) != 0) + // Find something else later. It seems this works but is ugly... + if(rp->BitMap->Planes[0] == 0x00000000) { - HIDDT_GC_Intern *_gc = GCINT(&((rp)->longreserved[1])); - pix = _gc->fg; + if ((rp->Flags & RPF_NO_PENS) != 0) + { + HIDDT_GC_Intern *_gc = GCINT(&((rp)->longreserved[1])); + pix = _gc->fg; + } + else + pix = BM_PIXEL(rp->BitMap, (UBYTE)rp->FgPen); + + return do_pixel_func(rp, x, y, pix_write, (APTR)pix, TRUE, GfxBase); } else - pix = BM_PIXEL(rp->BitMap, (UBYTE)rp->FgPen); - - return do_pixel_func(rp, x, y, pix_write, (APTR)pix, TRUE, GfxBase); - + { + // New method, without hidd + UBYTE *minterms = rp->minterms; + UBYTE planeIndex; + UBYTE WriteMode = MODUS_NON; + UBYTE *planePtr; + UBYTE thisbyte; + UBYTE pixel; + UBYTE planeMask = rp->Mask; + struct Layer* layer; + struct BitMap *bm = rp->BitMap; + struct ClipRect *clipRect; + struct BitMap *superBitMap; + ULONG offset; + + layer = rp->Layer; + + if (layer) { + ObtainSemaphore((struct SignalSemaphore *)&layer->Lock); + + x = (WORD)x + layer->bounds.MinX - layer->Scroll_X; + y = (WORD)y + layer->bounds.MinY - layer->Scroll_Y; + + clipRect = layer->ClipRect; + while (clipRect) + { + if (x >= clipRect->bounds.MinX && x <= clipRect->bounds.MaxX) { + if (y >= clipRect->bounds.MinY && y <= clipRect->bounds.MaxY) { + if (!(clipRect->lobs)) { + break; // we can draw directly to the screen + } + x -= (clipRect->bounds.MinX & 0xfff0); + y -= clipRect->bounds.MinY; + + if (clipRect->BitMap) { + bm = (struct BitMap *)clipRect->BitMap; + break; + } + ReleaseSemaphore((struct SignalSemaphore *)&layer->Lock); + return -1; // no Bitmap + } + } + clipRect = clipRect->Next; + } + if (!clipRect) { + // Try super bitmap + superBitMap = layer->SuperBitMap; + if (superBitMap) { + x = x + layer->Scroll_X - layer->bounds.MinX; + y = y + layer->Scroll_Y - layer->bounds.MinY; + clipRect = layer->SuperClipRect; + while (clipRect) { + if (x >= clipRect->bounds.MinX && x <= clipRect->bounds.MaxX) { + if (y >= clipRect->bounds.MinY && y <= clipRect->bounds.MaxY) { + bm = superBitMap; + break; + } + } + clipRect = clipRect->Next; + } + } + } + ReleaseSemaphore((struct SignalSemaphore *)&layer->Lock); + + if (!clipRect) { + return -1; // No Clip Rects found + } + } + + UBYTE **plane = bm->Planes; + offset = (x >>3) + y * bm->BytesPerRow; + pixel = 128 >> (x & 0x7); + + for (planeIndex = 0 ;planeIndex < bm->Depth; planeIndex++) + { + if (planeMask & (1 << planeIndex)) { + WriteMode = minterms[planeIndex] >> 6; + planePtr = (UBYTE *)(*(plane + planeIndex) + offset); + thisbyte = *planePtr; + if (WriteMode == MODUS_SET) { + thisbyte |= pixel; + } else if (WriteMode == MODUS_CLR) { + thisbyte &= ~pixel; + } else if (WriteMode == MODUS_XOR) { + thisbyte ^= pixel; + } + *planePtr = thisbyte; + } + } + return 0L; + } + AROS_LIBFUNC_EXIT } /* WritePixel */ From ea2d00f64efa19aeb3b0f52be9e05f2c76519ece Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Tue, 31 Oct 2023 20:58:19 +0100 Subject: [PATCH 12/60] dragging and swapping screens --- rom/intuition/rethinkdisplay.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/rom/intuition/rethinkdisplay.c b/rom/intuition/rethinkdisplay.c index 97d1e93f10a..53dc6fd69f9 100644 --- a/rom/intuition/rethinkdisplay.c +++ b/rom/intuition/rethinkdisplay.c @@ -1,6 +1,6 @@ /* - Copyright © 1995-2020, The AROS Development Team. All rights reserved. - Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved. + Copyright © 1995-2020, The AROS Development Team. All rights reserved. + Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved. $Id$ */ @@ -96,6 +96,23 @@ void int_RethinkDisplay(struct RethinkDisplayActionMsg *msg,struct IntuitionBase screen->ViewPort.Modes |= VP_HIDE; } */ + /* Thore: It is needed, but the correct way of examination which screen is really hidden */ + UWORD topmost = screen->TopEdge + screen->Height; + for (screen = IntuitionBase->FirstScreen; screen; screen = screen->NextScreen) + { + viewport = &screen->ViewPort; + if(!(screen->Flags & 0x2000)) // SCREENHIDDEN + { + if((screen->TopEdge < topmost) && (topmost > 0)) + { + viewport->Modes &= ~VP_HIDE; + } + else viewport->Modes |= VP_HIDE; + } + else viewport->Modes |= VP_HIDE; + topmost = screen->TopEdge; + } + /* Build the list of viewports in the view */ DEBUG_RETHINKDISPLAY(dprintf("RethinkDisplay: Building viewports list\n")); viewportptr = &IntuitionBase->ViewLord.ViewPort; @@ -120,8 +137,9 @@ void int_RethinkDisplay(struct RethinkDisplayActionMsg *msg,struct IntuitionBase } /* Reinitialize the view */ - IntuitionBase->ViewLord.DxOffset = 0; /***/ - IntuitionBase->ViewLord.DyOffset = 0; /***/ + /* Thore: Following lines make no sense for dragged screens... */ + //IntuitionBase->ViewLord.DxOffset = 0; /***/ + //IntuitionBase->ViewLord.DyOffset = 0; /***/ IntuitionBase->ViewLord.Modes = modes; screen = IntuitionBase->FirstScreen; #ifdef __MORPHOS__ @@ -195,13 +213,14 @@ void int_RethinkDisplay(struct RethinkDisplayActionMsg *msg,struct IntuitionBase if (!failure) { /* validate screen positions, scrolling limits are not necessarily same anymore. */ - for (screen = IntuitionBase->FirstScreen; screen; screen = screen->NextScreen) + /* Thore: We do not set ScreenPosition because ScreenPosition will call RethinkDisplay */ + /*for (screen = IntuitionBase->FirstScreen; screen; screen = screen->NextScreen) { if ((screen->ViewPort.Modes & VP_HIDE) == 0) { ScreenPosition( screen, SPOS_RELATIVE, 0,0,0,0 ); } - } + }*/ /* Ensure that empty displays get normal pointer */ ResetPointer(IntuitionBase); } From 7bcc2b08d6ad49ed7133e0f7448b30b55aeca05f Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Tue, 31 Oct 2023 21:00:42 +0100 Subject: [PATCH 13/60] Show screens while dragging needs an "anti flicker" in future. --- rom/intuition/screenposition.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rom/intuition/screenposition.c b/rom/intuition/screenposition.c index 6692fa9481f..9f7aa0fe476 100644 --- a/rom/intuition/screenposition.c +++ b/rom/intuition/screenposition.c @@ -1,6 +1,6 @@ /* - Copyright © 1995-2013, The AROS Development Team. All rights reserved. - Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved. + Copyright © 1995-2013, The AROS Development Team. All rights reserved. + Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved. $Id$ */ @@ -94,6 +94,7 @@ D(bug("[ScreenPosition] Scroll result: (%d, %d)\n",screen->ViewPort.DxOffset, screen->ViewPort.DyOffset)); screen->LeftEdge = screen->ViewPort.DxOffset; screen->TopEdge = screen->ViewPort.DyOffset; + RethinkDisplay(); } AROS_LIBFUNC_EXIT From 6fd140247e9f700ea1859c9d6c28488d68d42664 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Tue, 21 Nov 2023 23:01:42 +0100 Subject: [PATCH 14/60] Repair requesters Show requesters with raster background correctly --- rom/intuition/refreshglist.c | 93 +++++++++++++++++++++++++----------- 1 file changed, 65 insertions(+), 28 deletions(-) diff --git a/rom/intuition/refreshglist.c b/rom/intuition/refreshglist.c index 2e8d0090c0d..2c3f2df367d 100644 --- a/rom/intuition/refreshglist.c +++ b/rom/intuition/refreshglist.c @@ -1,6 +1,6 @@ /* - Copyright © 1995-2013, The AROS Development Team. All rights reserved. - Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved. + Copyright © 1995-2013, The AROS Development Team. All rights reserved. + Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved. $Id$ */ @@ -121,10 +121,11 @@ void int_refreshglist(struct Gadget *gadgets, struct Window *window, struct IntuitionBase *IntuitionBase) { #ifdef GADTOOLSCOMPATIBLE - struct Gadget *gadtoolsgadget = 0; - LONG num = numGad; #endif + LONG num = numGad; + struct Gadget *firstgad; + firstgad = gadgets; DEBUG_INTREFRESHGLIST(dprintf("IntRefreshGList: Gadgets 0x%lx Window 0x%lx Req 0x%lx Num %ld Must 0x%lx MustNot 0x%lx\n", gadgets, window, requester, numGad, mustbe, mustnotbe)); @@ -138,31 +139,67 @@ void int_refreshglist(struct Gadget *gadgets, struct Window *window, for ( ; gadgets && numGad; gadgets=gadgets->NextGadget, numGad --) { - #ifdef GADTOOLSCOMPATIBLE - if (gadgets->GadgetType & 0x100) + if (gadgets->GadgetType == 0) { - gadtoolsgadget = gadgets; - continue; - } - #endif - - if (!(qualifygadget(gadgets,mustbe,mustnotbe,IntuitionBase))) continue; - //DEBUG_REFRESHGLIST(dprintf("IntRefreshGList: Gadget %p Type 0x%04lx\n", - // gadgets, gadgets->GadgetType)); - - D(bug("RefreshGList: gadget=%p type 0x%x [%d %d %d %d]\n", - gadgets,gadgets->GadgetType, - gadgets->LeftEdge,gadgets->TopEdge, - gadgets->Width,gadgets->Height)); - - /*SetAPen(window->RPort, 4); - Move(window->RPort, gadgets->LeftEdge-1, gadgets->TopEdge-1); - Draw(window->RPort, gadgets->LeftEdge+gadgets->Width, gadgets->TopEdge-1); - Draw(window->RPort, gadgets->LeftEdge+gadgets->Width, gadgets->TopEdge+gadgets->Height); - Draw(window->RPort, gadgets->LeftEdge-1, gadgets->TopEdge+gadgets->Height); - Draw(window->RPort, gadgets->LeftEdge-1, gadgets->TopEdge-1);*/ - - rendergadget(gadgets,window,requester,IntuitionBase); + #ifdef GADTOOLSCOMPATIBLE + if (gadgets->GadgetType & 0x100) + { + gadtoolsgadget = gadgets; + continue; + } + #endif + + if (!(qualifygadget(gadgets,mustbe,mustnotbe,IntuitionBase))) continue; + //DEBUG_REFRESHGLIST(dprintf("IntRefreshGList: Gadget %p Type 0x%04lx\n", + // gadgets, gadgets->GadgetType)); + + D(bug("RefreshGList: gadget=%p type 0x%x [%d %d %d %d]\n", + gadgets,gadgets->GadgetType, + gadgets->LeftEdge,gadgets->TopEdge, + gadgets->Width,gadgets->Height)); + + /*SetAPen(window->RPort, 4); + Move(window->RPort, gadgets->LeftEdge-1, gadgets->TopEdge-1); + Draw(window->RPort, gadgets->LeftEdge+gadgets->Width, gadgets->TopEdge-1); + Draw(window->RPort, gadgets->LeftEdge+gadgets->Width, gadgets->TopEdge+gadgets->Height); + Draw(window->RPort, gadgets->LeftEdge-1, gadgets->TopEdge+gadgets->Height); + Draw(window->RPort, gadgets->LeftEdge-1, gadgets->TopEdge-1);*/ + + rendergadget(gadgets,window,requester,IntuitionBase); + } + } /* for ( ; gadgets && numGad; gadgets=gadgets->NextGadget, numGad --) */ + numGad = num; + gadgets = firstgad; + for ( ; gadgets && numGad; gadgets=gadgets->NextGadget, numGad --) + { + if (gadgets->GadgetType > 0) + { + #ifdef GADTOOLSCOMPATIBLE + if (gadgets->GadgetType & 0x100) + { + gadtoolsgadget = gadgets; + continue; + } + #endif + + if (!(qualifygadget(gadgets,mustbe,mustnotbe,IntuitionBase))) continue; + //DEBUG_REFRESHGLIST(dprintf("IntRefreshGList: Gadget %p Type 0x%04lx\n", + // gadgets, gadgets->GadgetType)); + + D(bug("RefreshGList: gadget=%p type 0x%x [%d %d %d %d]\n", + gadgets,gadgets->GadgetType, + gadgets->LeftEdge,gadgets->TopEdge, + gadgets->Width,gadgets->Height)); + + /*SetAPen(window->RPort, 4); + Move(window->RPort, gadgets->LeftEdge-1, gadgets->TopEdge-1); + Draw(window->RPort, gadgets->LeftEdge+gadgets->Width, gadgets->TopEdge-1); + Draw(window->RPort, gadgets->LeftEdge+gadgets->Width, gadgets->TopEdge+gadgets->Height); + Draw(window->RPort, gadgets->LeftEdge-1, gadgets->TopEdge+gadgets->Height); + Draw(window->RPort, gadgets->LeftEdge-1, gadgets->TopEdge-1);*/ + + rendergadget(gadgets,window,requester,IntuitionBase); + } } /* for ( ; gadgets && numGad; gadgets=gadgets->NextGadget, numGad --) */ #ifdef GADTOOLSCOMPATIBLE From 5004528c6bbf2254a1ee6f15bc05cf4326a0d019 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Fri, 24 Nov 2023 10:31:32 +0100 Subject: [PATCH 15/60] Temp workaround for SysInfo --- rom/graphics/setapen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rom/graphics/setapen.c b/rom/graphics/setapen.c index 479d8b5855e..9fc64a70952 100644 --- a/rom/graphics/setapen.c +++ b/rom/graphics/setapen.c @@ -56,7 +56,8 @@ rp->linpatcnt = 15; rp->Flags &= ~RPF_NO_PENS; - GenMinterms(rp); + // Temporarily disabled due to endless loop in SysInfo + // GenMinterms(rp); AROS_LIBFUNC_EXIT } /* SetAPen */ From 3a7623b95ec4d09c4c3741d5edab697a0e70f8a7 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Fri, 24 Nov 2023 10:32:21 +0100 Subject: [PATCH 16/60] Temp workaround for SysInfo --- rom/graphics/writepixel.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rom/graphics/writepixel.c b/rom/graphics/writepixel.c index a03909306b4..7b3491c6ada 100644 --- a/rom/graphics/writepixel.c +++ b/rom/graphics/writepixel.c @@ -97,6 +97,8 @@ static LONG pix_write(APTR pr_data, OOP_Object *bm, OOP_Object *gc, struct ClipRect *clipRect; struct BitMap *superBitMap; ULONG offset; + + GenMinterms(rp); // Temp fix for SysInfo, usually this belongs to SetAPen layer = rp->Layer; From 7f92f2a0a223d8714adcad80d744aef00cec151e Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Thu, 8 Feb 2024 20:06:19 +0100 Subject: [PATCH 17/60] Better detection of matching screenmode --- rom/graphics/bestmodeida.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/rom/graphics/bestmodeida.c b/rom/graphics/bestmodeida.c index fe5df0015c8..8b16d33f5bf 100644 --- a/rom/graphics/bestmodeida.c +++ b/rom/graphics/bestmodeida.c @@ -46,6 +46,7 @@ struct MatchData UWORD found_width; UWORD found_height; BOOL usecgx; + ULONG matching_id; }; static void BestModeIDForMonitor(struct monitor_driverdata *mdd, struct MatchData *args, ULONG modemask, struct GfxBase *GfxBase) @@ -137,6 +138,10 @@ static void BestModeIDForMonitor(struct monitor_driverdata *mdd, struct MatchDat args->found_width = gm_width; args->found_height = gm_height; + if(gm_width == args->desired_width && gm_height == args->desired_height) + { + args->matching_id = modeid; + } D(bug(" Match!\n")); } } @@ -369,6 +374,8 @@ static BOOL FindBestModeIDForMonitor(struct monitor_driverdata *monitor, struct FindBestModeIDForMonitor(monitor, &args, ~(PAL_MONITOR_ID|NTSC_MONITOR_ID), GfxBase); else FindBestModeIDForMonitor(monitor, &args, ~0, GfxBase); + if(args.matching_id != INVALID_ID) + args.found_id = args.matching_id; #ifdef __mc68000 /* Handle situation where program only asks for specific monitor * (for example only PAL_MONITOR_ID or NTSC_MONITOR_ID bits set) @@ -379,6 +386,8 @@ static BOOL FindBestModeIDForMonitor(struct monitor_driverdata *monitor, struct if (args.found_id == INVALID_ID && args.monitorid != INVALID_ID) { FindBestModeIDForMonitor(monitor, &args, MONITOR_ID_MASK, GfxBase); } + if(args.matching_id != INVALID_ID) + args.found_id = args.matching_id; #endif /* Still not found, AROS_MONITOR_ID_MASK. * Mask out bit 12 in monitorid because the user may (and will) pass in IDs defined in include/graphics/modeid.h @@ -387,14 +396,15 @@ static BOOL FindBestModeIDForMonitor(struct monitor_driverdata *monitor, struct if (args.found_id == INVALID_ID && args.monitorid != INVALID_ID) { FindBestModeIDForMonitor(monitor, &args, AROS_MONITOR_ID_MASK, GfxBase); } - + if(args.matching_id != INVALID_ID) + args.found_id = args.matching_id; // If CGX didn't find any mode, look again in all possibilities. Just to be sure - if(args.usecgx) - { + //if(args.usecgx) + //{ if (args.found_id == INVALID_ID && args.monitorid != INVALID_ID) { FindBestModeIDForMonitor(monitor, &args, ~0, GfxBase); - } - } + // } + //} ReleaseSemaphore(&CDD(GfxBase)->displaydb_sem); From 731b4a11d4ef95f065f49ee889fabba3b27ec33c Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Thu, 8 Feb 2024 20:07:26 +0100 Subject: [PATCH 18/60] Better detection of matching screenmode --- rom/graphics/bestmodeida.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/rom/graphics/bestmodeida.c b/rom/graphics/bestmodeida.c index 8b16d33f5bf..8aa2cc021eb 100644 --- a/rom/graphics/bestmodeida.c +++ b/rom/graphics/bestmodeida.c @@ -301,6 +301,16 @@ static BOOL FindBestModeIDForMonitor(struct monitor_driverdata *monitor, struct break; /* Offer some help to cybergraphics.library */ + case CYBRBIDTG_NominalWidth: + args.usecgx = TRUE; + args.dipf_mustnothave |= (PAL_MONITOR_ID|NTSC_MONITOR_ID); + monitor = NULL; + break; + case CYBRBIDTG_NominalHeight: + args.usecgx = TRUE; + args.dipf_mustnothave |= (PAL_MONITOR_ID|NTSC_MONITOR_ID); + monitor = NULL; + break; case CYBRBIDTG_BoardName: args.boardname = (STRPTR)tag->ti_Data; // We need to remark, we are using CGX to prevent PAL/NTSC in the first look From 7a3d293ef27a2401c110f191396735f9940534f6 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Thu, 8 Feb 2024 20:09:55 +0100 Subject: [PATCH 19/60] Mouse Pointer visible in flipped screen --- rom/intuition/screendepth.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rom/intuition/screendepth.c b/rom/intuition/screendepth.c index 622cdf0ba59..297ededd825 100644 --- a/rom/intuition/screendepth.c +++ b/rom/intuition/screendepth.c @@ -1,6 +1,6 @@ /* - Copyright © 1995-2013, The AROS Development Team. All rights reserved. - Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved. + Copyright © 1995-2013, The AROS Development Team. All rights reserved. + Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved. $Id$ Change order of screens. @@ -367,6 +367,8 @@ static VOID int_screendepth(struct ScreenDepthActionMsg *msg, } /* if SDEPTH_TO_BACK */ } /* if (current) */ + IntuitionBase->ActiveScreen = IntuitionBase->FirstScreen; + ActivateMonitor(GetPrivScreen(IntuitionBase->ActiveScreen)->IMonitorNode, -1, -1, IntuitionBase); RethinkDisplay(); #if 0 /* FIXME: backport, disabled */ From a428f5f76a2dd377e845feba6f14618fa87e6e0e Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Thu, 8 Feb 2024 20:14:09 +0100 Subject: [PATCH 20/60] Better detection for CGX screens --- workbench/libs/cgfx/bestcmodeidtaglist.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/workbench/libs/cgfx/bestcmodeidtaglist.c b/workbench/libs/cgfx/bestcmodeidtaglist.c index cbec44ec988..ead5c1c342b 100644 --- a/workbench/libs/cgfx/bestcmodeidtaglist.c +++ b/workbench/libs/cgfx/bestcmodeidtaglist.c @@ -110,6 +110,8 @@ static STRPTR ids[] = { { BIDTAG_NominalHeight , 600 }, { BIDTAG_Depth , 8 }, { CYBRBIDTG_BoardName , NULL }, + { CYBRBIDTG_NominalWidth , 800 }, + { CYBRBIDTG_NominalHeight , 600 }, { TAG_DONE , 0 } }; @@ -121,10 +123,12 @@ static STRPTR ids[] = { case CYBRBIDTG_NominalWidth: modetags[0].ti_Data = tag->ti_Data; + modetags[4].ti_Data = tag->ti_Data; break; case CYBRBIDTG_NominalHeight: modetags[1].ti_Data = tag->ti_Data; + modetags[5].ti_Data = tag->ti_Data; break; case CYBRBIDTG_MonitorID: From ea3725eea13c3016ae9adc645806ba54f671a17a Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Thu, 8 Feb 2024 20:32:58 +0100 Subject: [PATCH 21/60] Aktualisieren von bestmodeida.c --- rom/graphics/bestmodeida.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rom/graphics/bestmodeida.c b/rom/graphics/bestmodeida.c index 8aa2cc021eb..0839320b92f 100644 --- a/rom/graphics/bestmodeida.c +++ b/rom/graphics/bestmodeida.c @@ -1,4 +1,4 @@ -/* + /* Copyright © 1995-2017, The AROS Development Team. All rights reserved. $Id$ @@ -257,7 +257,8 @@ static BOOL FindBestModeIDForMonitor(struct monitor_driverdata *monitor, struct INVALID_ID, /* Found ID */ -1, /* Found depth */ -1, -1, /* Found size */ - FALSE /* Use CGX */ + FALSE, /* Use CGX */ + INVALID_ID }; D(bug("[Gfx] %s()\n", __PRETTY_FUNCTION__)); @@ -419,6 +420,9 @@ static BOOL FindBestModeIDForMonitor(struct monitor_driverdata *monitor, struct ReleaseSemaphore(&CDD(GfxBase)->displaydb_sem); D(bug("[Gfx] %s: Returning mode ID 0x%08lX\n", __PRETTY_FUNCTION__, args.found_id)); + + if(args.matching_id != INVALID_ID) + args.found_id = args.matching_id; return args.found_id; AROS_LIBFUNC_EXIT From 1b34a07fd794388d70e747fa8f1d035ec8c9c1f9 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Thu, 8 Feb 2024 20:39:43 +0100 Subject: [PATCH 22/60] Aktualisieren von bestmodeida.c --- rom/graphics/bestmodeida.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rom/graphics/bestmodeida.c b/rom/graphics/bestmodeida.c index 0839320b92f..568df536b59 100644 --- a/rom/graphics/bestmodeida.c +++ b/rom/graphics/bestmodeida.c @@ -1,4 +1,4 @@ - /* +4 /* Copyright © 1995-2017, The AROS Development Team. All rights reserved. $Id$ @@ -414,7 +414,7 @@ static BOOL FindBestModeIDForMonitor(struct monitor_driverdata *monitor, struct //{ if (args.found_id == INVALID_ID && args.monitorid != INVALID_ID) { FindBestModeIDForMonitor(monitor, &args, ~0, GfxBase); - // } + } //} ReleaseSemaphore(&CDD(GfxBase)->displaydb_sem); From ec8d57678509364e55ee10d0662d394c62a4f283 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Thu, 8 Feb 2024 20:58:11 +0100 Subject: [PATCH 23/60] Aktualisieren von bestmodeida.c --- rom/graphics/bestmodeida.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rom/graphics/bestmodeida.c b/rom/graphics/bestmodeida.c index 568df536b59..b5be69cc4a1 100644 --- a/rom/graphics/bestmodeida.c +++ b/rom/graphics/bestmodeida.c @@ -1,4 +1,4 @@ -4 /* +/* Copyright © 1995-2017, The AROS Development Team. All rights reserved. $Id$ From 078571238b446a1e9d85647d5c9db18df0000568 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Fri, 9 Feb 2024 07:00:49 +0100 Subject: [PATCH 24/60] Update bestmodeida.c --- rom/graphics/bestmodeida.c | 43 +++++++++++--------------------------- 1 file changed, 12 insertions(+), 31 deletions(-) diff --git a/rom/graphics/bestmodeida.c b/rom/graphics/bestmodeida.c index b5be69cc4a1..0d869dd175f 100644 --- a/rom/graphics/bestmodeida.c +++ b/rom/graphics/bestmodeida.c @@ -383,46 +383,27 @@ static BOOL FindBestModeIDForMonitor(struct monitor_driverdata *monitor, struct /* First try to find exact match. If we use CGX, skip PAL/NTSC for now */ if(args.usecgx) FindBestModeIDForMonitor(monitor, &args, ~(PAL_MONITOR_ID|NTSC_MONITOR_ID), GfxBase); - else - FindBestModeIDForMonitor(monitor, &args, ~0, GfxBase); + else + { + FindBestModeIDForMonitor(monitor, &args, MONITOR_ID_MASK, GfxBase); + if(args.matching_id != INVALID_ID) + args.found_id = args.matching_id; + + if (args.found_id == INVALID_ID && args.monitorid != INVALID_ID) + FindBestModeIDForMonitor(monitor, &args, AROS_MONITOR_ID_MASK, GfxBase); if(args.matching_id != INVALID_ID) args.found_id = args.matching_id; -#ifdef __mc68000 - /* Handle situation where program only asks for specific monitor - * (for example only PAL_MONITOR_ID or NTSC_MONITOR_ID bits set) - * but it also requests hires or larger resolution. - * We must always return chipset mode if PAL or NTSC bits are set. - * Mask out screen mode bits (MONITOR_ID_MASK) - */ - if (args.found_id == INVALID_ID && args.monitorid != INVALID_ID) { - FindBestModeIDForMonitor(monitor, &args, MONITOR_ID_MASK, GfxBase); + + if (args.found_id == INVALID_ID && args.monitorid != INVALID_ID) + FindBestModeIDForMonitor(monitor, &args, ~0, GfxBase); } if(args.matching_id != INVALID_ID) args.found_id = args.matching_id; -#endif - /* Still not found, AROS_MONITOR_ID_MASK. - * Mask out bit 12 in monitorid because the user may (and will) pass in IDs defined in include/graphics/modeid.h - * (like PAL_MONITOR_ID, VGA_MONITOR_ID, etc) which have bit 12 set) - */ - if (args.found_id == INVALID_ID && args.monitorid != INVALID_ID) { - FindBestModeIDForMonitor(monitor, &args, AROS_MONITOR_ID_MASK, GfxBase); - } - if(args.matching_id != INVALID_ID) - args.found_id = args.matching_id; - // If CGX didn't find any mode, look again in all possibilities. Just to be sure - //if(args.usecgx) - //{ - if (args.found_id == INVALID_ID && args.monitorid != INVALID_ID) { - FindBestModeIDForMonitor(monitor, &args, ~0, GfxBase); - } - //} - + ReleaseSemaphore(&CDD(GfxBase)->displaydb_sem); D(bug("[Gfx] %s: Returning mode ID 0x%08lX\n", __PRETTY_FUNCTION__, args.found_id)); - if(args.matching_id != INVALID_ID) - args.found_id = args.matching_id; return args.found_id; AROS_LIBFUNC_EXIT From 9063b880eabd570803fc7517892a6b75a23802ba Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Thu, 14 Mar 2024 08:18:16 +0100 Subject: [PATCH 25/60] Correcting parameter order --- rom/graphics/allocdbufinfo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rom/graphics/allocdbufinfo.c b/rom/graphics/allocdbufinfo.c index 0b281540565..9c78c980353 100644 --- a/rom/graphics/allocdbufinfo.c +++ b/rom/graphics/allocdbufinfo.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2007, The AROS Development Team. All rights reserved. + Copyright © 1995-2007, The AROS Development Team. All rights reserved. $Id$ Desc: @@ -58,8 +58,8 @@ { AROS_LIBFUNC_INIT - return (struct DBufInfo *)AllocMem(MEMF_ANY | MEMF_CLEAR, - sizeof(struct DBufInfo)); + return (struct DBufInfo *)AllocMem(sizeof(struct DBufInfo), + MEMF_ANY | MEMF_CLEAR); AROS_LIBFUNC_EXIT } /* AllocDBufInfo */ From 6b91bca6a5e744ecfed40a7f500e945aa6d8cd37 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Mon, 29 Jul 2024 20:04:34 +0200 Subject: [PATCH 26/60] Update amigavideo_hiddclass.c Activate prepared SuperHires --- arch/m68k-amiga/hidd/amigavideo/amigavideo_hiddclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/m68k-amiga/hidd/amigavideo/amigavideo_hiddclass.c b/arch/m68k-amiga/hidd/amigavideo/amigavideo_hiddclass.c index f6f7010697f..b2e0bbb83df 100644 --- a/arch/m68k-amiga/hidd/amigavideo/amigavideo_hiddclass.c +++ b/arch/m68k-amiga/hidd/amigavideo/amigavideo_hiddclass.c @@ -34,7 +34,7 @@ static const UWORD widthtable[] = { REZ_X_MIN, (REZ_X_MIN << 1), - // (REZ_X_MIN << 2), /* uncomment this to have SuperHires modes */ + (REZ_X_MIN << 2), 0 }; static const UWORD heighttable[] = { From 72ff6cb8d3ea9cf6d7ec28afbfd97a10c1975578 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Mon, 29 Jul 2024 20:40:28 +0200 Subject: [PATCH 27/60] Update videocontrol.c Correct some, added missing ones. --- rom/graphics/videocontrol.c | 61 +++++++++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 3 deletions(-) diff --git a/rom/graphics/videocontrol.c b/rom/graphics/videocontrol.c index fe5dfc2d4eb..8a7fbbc38ad 100644 --- a/rom/graphics/videocontrol.c +++ b/rom/graphics/videocontrol.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2010, The AROS Development Team. All rights reserved. + Copyright © 1995-2010, The AROS Development Team. All rights reserved. $Id$ Desc: Graphics function VideoControl() @@ -165,19 +165,36 @@ /* TODO: Implement these */ case VTAG_PF1_TO_SPRITEPRI_SET: + if(cm->cm_vp) + { + cm->cm_vp->SpritePriorities = ((cm->cm_vp->SpritePriorities & 0x38) | MIN(tag->ti_Data, 7)); + // needs immediate bplcon2 + } break; case VTAG_PF1_TO_SPRITEPRI_GET: tag->ti_Tag = VTAG_PF1_TO_SPRITEPRI_SET; - tag->ti_Data = 0; + tag->ti_Data = 4; + if(cm->cm_vp) + { + tag->ti_Data = (cm->cm_vp->SpritePriorities & 0x7); + } break; case VTAG_PF2_TO_SPRITEPRI_SET: + if(cm->cm_vp) + { + cm->cm_vp->SpritePriorities = ((cm->cm_vp->SpritePriorities & 0x7) | (MIN(tag->ti_Data, 7) << 3)); + } break; case VTAG_PF2_TO_SPRITEPRI_GET: tag->ti_Tag = VTAG_PF2_TO_SPRITEPRI_SET; - tag->ti_Data = 0; + tag->ti_Data = 4; + if(cm->cm_vp) + { + tag->ti_Data = ((cm->cm_vp->SpritePriorities & 0x38) >> 3); + } break; case VTAG_BORDERBLANK_SET: @@ -218,9 +235,11 @@ /* TODO: implement these */ case VTAG_CHROMAKEY_SET: + cm->Flags |= COLORMAP_TRANSPARENCY; break; case VTAG_CHROMAKEY_CLR: + cm->Flags &= ~COLORMAP_TRANSPARENCY; break; case VTAG_CHROMAKEY_GET: @@ -229,9 +248,11 @@ break; case VTAG_BITPLANEKEY_SET: + cm->Flags |= COLORPLANE_TRANSPARENCY; break; case VTAG_BITPLANEKEY_CLR: + cm->Flags &= ~COLORPLANE_TRANSPARENCY; break; case VTAG_BITPLANEKEY_GET: @@ -240,9 +261,14 @@ break; case VTAG_CHROMA_PEN_SET: + if(tag->ti_Data < cm->Count) ((UWORD *)(cm->ColorTable))[tag->ti_Data] |= 0x8000; break; case VTAG_CHROMA_PEN_CLR: + if(tag->ti_Data < cm->Count) + { + ((UWORD *)(cm->ColorTable))[tag->ti_Data] &= 0x7fff; + } break; case VTAG_CHROMA_PEN_GET: @@ -359,6 +385,22 @@ /* TODO: implement this */ case VTAG_BATCH_ITEMS_ADD: + Forbid(); + struct TagItem *bi = cm->cm_batch_items; + struct TagItem *ti = (struct TagItem *)tag->ti_Data; + while(ti && ti->ti_Tag != VTAG_END_CM) + { + if(ti->ti_Tag == VTAG_NEXTBUF_CM) ti = (struct TagItem *)ti->ti_Data; + else ti++; + if(ti != (struct TagItem *)ti->ti_Data) + { + ti->ti_Tag = VTAG_NEXTBUF_CM; + ti->ti_Data = (ULONG)bi; + ti = (struct TagItem *)tag->ti_Data; + }else ti = bi; + cm->cm_batch_items = ti; + } + Permit(); break; case VTAG_BATCH_ITEMS_GET: @@ -379,6 +421,17 @@ tag->ti_Data = cm->VPModeID; break; + /* add missing ones */ + + case VTAG_DEFSPRITERESN_SET: + cm->SpriteResDefault = tag->ti_Data; + break; + + case VTAG_DEFSPRITERESN_GET: + tag->ti_Tag = VTAG_DEFSPRITERESN_SET; + tag->ti_Data = cm->SpriteResDefault; + break; + default: res = 1; } @@ -388,6 +441,8 @@ /* TODO: update SpriteBase in the graphics driver here */ + /* Also missing immediates for bplcon and color */ + *immediate = 0; } From aa56e4c55a6995a66cd5154371231bc1414ab158 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Tue, 30 Jul 2024 12:33:00 +0200 Subject: [PATCH 28/60] Update videocontrol.c added missing define --- rom/graphics/videocontrol.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rom/graphics/videocontrol.c b/rom/graphics/videocontrol.c index 8a7fbbc38ad..c40eb7219ba 100644 --- a/rom/graphics/videocontrol.c +++ b/rom/graphics/videocontrol.c @@ -13,6 +13,8 @@ #include "graphics_intern.h" +#define MIN(a,b) ((a)<(b)?(a):(b)) + /***************************************************************************** NAME */ From 9669f3f9ba9110ee107c903d0fb53e73b191a422 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Thu, 7 Nov 2024 16:20:43 +0100 Subject: [PATCH 29/60] Remove RT from AllocMem --- rom/exec/allocmem.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/rom/exec/allocmem.c b/rom/exec/allocmem.c index e5b6fc26674..89813944226 100644 --- a/rom/exec/allocmem.c +++ b/rom/exec/allocmem.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2015, The AROS Development Team. All rights reserved. + Copyright © 1995-2015, The AROS Development Team. All rights reserved. $Id$ Desc: Allocate some memory @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -118,10 +117,6 @@ res = nommu_AllocMem(byteSize, requirements, &loc, SysBase); } while (res == NULL && checkMemHandlers(&cmhs, SysBase) == MEM_TRY_AGAIN); -#if ENABLE_RT - RT_Add (RTT_MEMORY, res, origSize); -#endif - res = MungWall_Build(res, NULL, origSize, requirements, &loc, SysBase); /* Set DOS error if called from a process */ From 833e84005b81b1c4315599ecb34ea4e2c1d12a19 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Thu, 7 Nov 2024 16:21:25 +0100 Subject: [PATCH 30/60] Remove RT from AllocMem --- rom/exec/freemem.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/rom/exec/freemem.c b/rom/exec/freemem.c index 638dec126e4..c5b8f935921 100644 --- a/rom/exec/freemem.c +++ b/rom/exec/freemem.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2012, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ Desc: Free memory allocated by AllocMem() @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -68,8 +67,6 @@ if(!byteSize || !memoryBlock) ReturnVoid ("FreeMem"); - RT_Free (RTT_MEMORY, memoryBlock, byteSize); - memoryBlock = MungWall_Check(memoryBlock, byteSize, &tp, SysBase); if (PrivExecBase(SysBase)->IntFlags & EXECF_MungWall) From 9dd6e6d8ce49a52ca1385679ebed4d94efda2955 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Thu, 7 Nov 2024 17:01:05 +0100 Subject: [PATCH 31/60] Enhance GELS with HWSprites --- rom/graphics/drawglist.c | 193 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 190 insertions(+), 3 deletions(-) diff --git a/rom/graphics/drawglist.c b/rom/graphics/drawglist.c index dee05c24c40..20bbab6d983 100644 --- a/rom/graphics/drawglist.c +++ b/rom/graphics/drawglist.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2011, The AROS Development Team. All rights reserved. + Copyright © 1995-2011, The AROS Development Team. All rights reserved. $Id$ Desc: Draw the list of gels @@ -13,6 +13,11 @@ #include "gfxfuncsupport.h" #include "gels_internal.h" +#define CMOVE(c,a,b) {(c)->OpCode=COPPER_MOVE;(c)->DESTADDR=(int)(&a)&0xFFF;(c)->DESTDATA=b;} +#define CWAIT(c,a,b) {(c)->OpCode=COPPER_WAIT;(c)->VWAITPOS=a;(c)->HWAITPOS=b;} +#define CBUMP(acl) {++ci; ++((*acl)->Count);} +#define CEND(c) {CWAIT(c,10000,255);} + /***************************************************************************** NAME */ @@ -56,7 +61,13 @@ struct VSprite * AfterPathVSprite = NULL; int followdrawpath; struct VSprite * PrevVSprite = NULL; + struct VSprite * OldVSprite = NULL; + struct CopIns *ci = NULL; + struct CopList *cl = NULL; + struct CopIns *cic = NULL; + struct CopList *clc = NULL; + /* * CurVSprite is not a valid VSprite but the "boundary vsprite" * Should I follow the DrawPath? @@ -70,6 +81,80 @@ followdrawpath = FALSE; CurVSprite = CurVSprite->NextVSprite; } + OldVSprite = CurVSprite; + + // if we have real sprites, prepare the CL + //------------------------------------------- + while (CurVSprite) { + if(CurVSprite->Flags & VSPRITE) + { + // Do we have old entries? Delete them + if(vp->SprIns){ + if(vp->SprIns->CopIns) + { + FreeMem(vp->SprIns->CopIns, sizeof(struct CopIns)*32); + } + FreeMem(vp->SprIns, sizeof(struct CopList)); + vp->SprIns = NULL; + } + if(vp->ClrIns){ + if(vp->ClrIns->CopIns) + { + FreeMem(vp->ClrIns->CopIns, sizeof(struct CopIns)*32); + } + FreeMem(vp->ClrIns, sizeof(struct CopList)); + vp->ClrIns = NULL; + } + // New entry + if(vp->SprIns == NULL) + { + vp->SprIns = (struct CopList *)AllocMem(sizeof(struct CopList), MEMF_ANY|MEMF_CLEAR); + vp->SprIns->MaxCount = 64; + vp->SprIns->CopIns = (struct CopIns*)AllocMem(sizeof(struct CopIns)*64, MEMF_ANY|MEMF_CLEAR); + vp->SprIns->CopPtr = vp->SprIns->CopIns; + vp->SprIns->_ViewPort = vp; + vp->SprIns->Count = 0; + vp->SprIns->Flags = 0; + vp->SprIns->Next = 0; + vp->SprIns->SLRepeat = 1; + } + + if(vp->ClrIns == NULL) + { + vp->ClrIns = (struct CopList *)AllocMem(sizeof(struct CopList), MEMF_ANY|MEMF_CLEAR); + vp->ClrIns->MaxCount = 32; + vp->ClrIns->CopIns = (struct CopIns*)AllocMem(sizeof(struct CopIns)*32, MEMF_ANY|MEMF_CLEAR); + vp->ClrIns->CopPtr = vp->ClrIns->CopIns; + vp->ClrIns->_ViewPort = vp; + vp->ClrIns->Count = 0; + vp->ClrIns->Flags = 0; + vp->ClrIns->Next = 0; + vp->ClrIns->SLRepeat = 1; + } + vp->SprIns->Count = 0; + vp->ClrIns->Count = 0; + break; + } + CurVSprite = CurVSprite->NextVSprite; + } + CurVSprite = OldVSprite; + + cl = vp->SprIns; + if(cl) ci = cl->CopPtr; + + clc = vp->ClrIns; + if(clc) cic = clc->CopPtr; + + int picklist = 0; + WORD *nl; + + // Set all nextlines to -1 + if(rp->GelsInfo->nextLine) + { + nl = rp->GelsInfo->nextLine; + for(int i=0; i<8; i++) + *(nl + i) = -1; + } /* * As long as I don't step on the last boundary vsprite @@ -148,6 +233,7 @@ #define VS_MINTERM 0x0c0 #endif if ((CurVSprite->VSBob) && (CurVSprite->VSBob->ImageShadow)) + { BltMaskBitMapRastPort(CurVSprite->IntVSprite->ImageData, 0, 0, @@ -158,7 +244,9 @@ CurVSprite->Height, VS_MINTERM, (PLANEPTR)CurVSprite->VSBob->ImageShadow); - else + } + if (CurVSprite->VSBob) + { BltBitMapRastPort(CurVSprite->IntVSprite->ImageData, 0, 0, @@ -168,6 +256,7 @@ CurVSprite->Width << 4, CurVSprite->Height, VS_MINTERM ); + } #undef VS_MINTERM /* @@ -187,7 +276,99 @@ } } } - + // Real Sprite! No BOB + if(CurVSprite->Flags == VSPRITE) + { + struct Spr + { + UWORD sprpt[16]; + }; + + int pickmask = 1; + int pick = -1; + for(int i=0; i<8; i++) + { + if((GfxBase->SpriteReserved & (pickmask<GelsInfo->sprRsrvd & (pickmask << i)) != 0) + { + if((picklist & (pickmask << i)) ==0) + { + picklist |= (pickmask << i); + pick = i; + break; + } + } + } + } + + if(pick > -1) + { + // 1. SPR (Sprite) + volatile struct Custom *custom = (struct Custom *)0xdff000; + + struct Spr *spr = (struct Spr *)0xdff120; + + WORD tx, ty, t, dy, dx, h; + UWORD pos, ctl, offset; + WORD *nextline, *image; + + nextline = rp->GelsInfo->nextLine + pick; + tx = GfxBase->ActiView->DxOffset; + ty = GfxBase->ActiView->DyOffset; + + if(CurVSprite->X < 0)dx = 0; else dx = CurVSprite->X; + tx = tx + dx; // Should we do Hires >>1, SHIRES >> 2 ?? + + if(CurVSprite->Y < 0) dy = 0; else dy = CurVSprite->Y; + ty = ty + dy; + h = CurVSprite->Height - (dy-CurVSprite->Y); + if((h+dy) > rp->BitMap->Rows) + h = rp->BitMap->Rows - dy; + t = ty + h; + if((CurVSprite->X-(CurVSprite->Width<<4)>0) && (h > 0)) + { + // PosCtl + pos = (ty<<8) | ((tx >> 1) & 0xff); //(y<<15) | (x >> 1); + ctl = (t << 8) | ((ty>>6)&0x4) | ((t>>7)&0x2) | (tx&0x1); + + // image clipping + image = CurVSprite->ImageData + ((UWORD)CurVSprite->Depth * (UWORD)(dy-CurVSprite->Y)); + CWAIT(ci, *nextline, 0); + CBUMP(&cl); + CMOVE(ci, spr->sprpt[(pick<<1)],(WORD)(((LONG)image & 0xFFFF0000) >> 16)); + CBUMP(&cl); + CMOVE(ci, spr->sprpt[(pick<<1)],(WORD)((LONG)image & 0xFFFF)); + ci->u3.u4.u1.DestAddr += 2; + CBUMP(&cl); + CMOVE(ci, custom->spr[pick].pos,pos); + CBUMP(&cl); + CMOVE(ci, custom->spr[pick].ctl,ctl); + CBUMP(&cl); + *nextline = CurVSprite->Y + (CurVSprite->Height - (dy-CurVSprite->Y)) + 2; + + // 2. CLR (Color) + if(clc) + { + if(CurVSprite->SprColors) + { + *(rp->GelsInfo->lastColor + pick) = CurVSprite->SprColors; + CWAIT(ci, dy-1, 0); + CBUMP(&cl); + t = ((pick&0x6)<<1)+17; + CMOVE(ci, custom->color[t],CurVSprite->SprColors[0]); + CBUMP(&cl); + CMOVE(ci, custom->color[++t],CurVSprite->SprColors[1]); + CBUMP(&cl); + MOVE(ci, custom->color[++t],CurVSprite->SprColors[2]); + CBUMP(&cl); + } + } + } + } + } + /* * Am I supposed to follow the drawpath. * If yes then follow it to its end. @@ -221,6 +402,12 @@ } } /* while not all bobs/vsprites are drawn */ + // Finish Copperlists + if(ci) + CEND(ci); + if(cic) + CEND(cic); + AROS_LIBFUNC_EXIT } /* DrawGList */ From 966b9cad13767ad0d448862136ab166bc6baf880 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Thu, 7 Nov 2024 17:50:34 +0100 Subject: [PATCH 32/60] Update drawglist.c --- rom/graphics/drawglist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rom/graphics/drawglist.c b/rom/graphics/drawglist.c index 20bbab6d983..6cb22b1e2bf 100644 --- a/rom/graphics/drawglist.c +++ b/rom/graphics/drawglist.c @@ -361,7 +361,7 @@ CBUMP(&cl); CMOVE(ci, custom->color[++t],CurVSprite->SprColors[1]); CBUMP(&cl); - MOVE(ci, custom->color[++t],CurVSprite->SprColors[2]); + CMOVE(ci, custom->color[++t],CurVSprite->SprColors[2]); CBUMP(&cl); } } From b594bae1c8ab4b8306a817966fd08766fff377eb Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Wed, 25 Dec 2024 20:26:39 +0100 Subject: [PATCH 33/60] Update start.c for new core --- arch/m68k-amiga/boot/start.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/m68k-amiga/boot/start.c b/arch/m68k-amiga/boot/start.c index 42073a42f32..890e7772088 100644 --- a/arch/m68k-amiga/boot/start.c +++ b/arch/m68k-amiga/boot/start.c @@ -804,7 +804,7 @@ void exec_boot(ULONG *membanks, ULONG *cpupcr) */ kickrom[0] = (UWORD*)&_rom_start; kickrom[1] = (UWORD*)&_rom_end; - kickrom[2] = (UWORD*)0x00f00000; + kickrom[2] = (UWORD*)0x00f80000; kickrom[3] = (UWORD*)0x00f80000; kickrom[4] = (UWORD*)~0; kickrom[5] = (UWORD*)~0; @@ -812,7 +812,7 @@ void exec_boot(ULONG *membanks, ULONG *cpupcr) } else { kickrom[0] = (UWORD*)&_rom_start; kickrom[1] = (UWORD*)&_rom_end; - kickrom[2] = (UWORD*)0x00f00000; + kickrom[2] = (UWORD*)0x00f80000; kickrom[3] = (UWORD*)0x00f80000; kickrom[4] = (UWORD*)&_ext_start; kickrom[5] = (UWORD*)&_ext_end; From 91a6e282a4167d47aa7ac9139809dd5b9da38aaa Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Wed, 25 Dec 2024 21:06:20 +0100 Subject: [PATCH 34/60] added missing pointer added missing pointer and BORDER collision preset --- rom/graphics/initgels.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rom/graphics/initgels.c b/rom/graphics/initgels.c index b6125eba932..bcc681dcd70 100644 --- a/rom/graphics/initgels.c +++ b/rom/graphics/initgels.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2007, The AROS Development Team. All rights reserved. + Copyright © 1995-2007, The AROS Development Team. All rights reserved. $Id$ Desc: Graphics function InitGels() @@ -80,6 +80,10 @@ head -> IntVSprite = NULL; tail -> IntVSprite = NULL; + head -> PrevVSprite = NULL; + tail -> NextVSprite = NULL; + + if(GInfo->collHandler) GInfo->collHandler->collPtrs[0] = 0; AROS_LIBFUNC_EXIT } /* InitGels */ From bc9b4fcf39839d0aed5ebae86729e07228702e85 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Thu, 26 Dec 2024 20:16:22 +0100 Subject: [PATCH 35/60] DA/DD bus --- rom/devs/ata/ata.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rom/devs/ata/ata.h b/rom/devs/ata/ata.h index bd7094e775f..37c15e97d87 100755 --- a/rom/devs/ata/ata.h +++ b/rom/devs/ata/ata.h @@ -188,6 +188,8 @@ struct ata_Bus APTR ab_BounceBufferPool; + BOOL use_da; + /** functions go here **/ void (*ab_HandleIRQ)(struct ata_Unit* unit, UBYTE status); }; From de4422ecef1cf173cb0408abe79b526a6905c64e Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Thu, 26 Dec 2024 20:31:20 +0100 Subject: [PATCH 36/60] DA/DD IDE Bus --- rom/devs/ata/lowlevel.c | 61 +++++++++++++++++++++++++++++++++++------ 1 file changed, 52 insertions(+), 9 deletions(-) diff --git a/rom/devs/ata/lowlevel.c b/rom/devs/ata/lowlevel.c index 17b31ddad45..37f9386377c 100644 --- a/rom/devs/ata/lowlevel.c +++ b/rom/devs/ata/lowlevel.c @@ -177,7 +177,10 @@ static void ata_IRQSetHandler(struct ata_Unit *unit, static void ata_IRQNoData(struct ata_Unit *unit, UBYTE status) { - volatile UBYTE *port=0xDD201C; + volatile UBYTE *port; + if(unit->au_Bus->use_da) + port = 0xDA201C; + else port = 0xDD201C; status = *port; if (status & ATAF_BUSY) @@ -200,8 +203,11 @@ static void ata_IRQPIORead(struct ata_Unit *unit, UBYTE status) { ULONG count; APTR address; - volatile UBYTE *port=0xDD201C; - long retrycount; + volatile UBYTE *port; + long retrycount; + if(unit->au_Bus->use_da) + port = 0xDA201C; + else port = 0xDD201C; AGAIN: retrycount=100000000; @@ -222,13 +228,25 @@ static void ata_IRQPIORead(struct ata_Unit *unit, UBYTE status) count = (unit->au_cmd_length>>5); address = unit->au_cmd_data; - + + if (unit->au_Bus->use_da) + { + asm volatile( + " bra 2f \n" + "1: move16 (0xDA6000),(%[address])+ \n" + " move16 (0xDA6000),(%[address])+ \n" + "2: dbra %[count],1b \n" + :[count]"+d"(count),[address]"+a"(address)::"cc"); + } + else + { asm volatile( " bra 2f \n" "1: move16 (0xDD6000),(%[address])+ \n" " move16 (0xDD6000),(%[address])+ \n" "2: dbra %[count],1b \n" :[count]"+d"(count),[address]"+a"(address)::"cc"); + } // /* @@ -274,10 +292,13 @@ static void ata_PIOWriteBlk(struct ata_Unit *unit) static void ata_IRQPIOWrite(struct ata_Unit *unit, UBYTE status) { - volatile UBYTE *port=0xDD201C; + volatile UBYTE *port; ULONG count; APTR address; - long retrycount; + long retrycount; + if(unit->au_Bus->use_da) + port = 0xDA201C; + else port = 0xDD201C; /* * If there's more data left for this transfer, write it, keep same * handler and wait for next interrupt @@ -302,13 +323,24 @@ static void ata_IRQPIOWrite(struct ata_Unit *unit, UBYTE status) count = unit->au_cmd_length>>3; address = unit->au_cmd_data; + if(unit->au_Bus->use_da) + { + asm volatile( + " bra 2f \n" + "1: move.l (%[address])+,(0xDA2000) \n" + " move.l (%[address])+,(0xDA2000) \n" + "2: dbra %[count],1b \n" + :[count]"+d"(count),[address]"+a"(address)::"cc"); + } + else + { asm volatile( " bra 2f \n" "1: move.l (%[address])+,(0xDD2000) \n" " move.l (%[address])+,(0xDD2000) \n" "2: dbra %[count],1b \n" :[count]"+d"(count),[address]"+a"(address)::"cc"); - + } unit->au_cmd_data += unit->au_cmd_length; unit->au_cmd_total -= unit->au_cmd_length; @@ -554,8 +586,19 @@ static BYTE ata_exec_cmd(struct ata_Unit* unit, ata_CommandBlock *block) BYTE err = 0; APTR mem = block->buffer; UBYTE status; - volatile WORD *irqreg=0xDD9000; - volatile WORD *irqen=0xDDA000; + volatile WORD *irqreg; + volatile WORD *irqen; + + if(unit->au_Bus->use_da) + { + irqreg = 0xDA9000; + irqen = 0xDAA000; + } + else + { + irqreg = 0xDD9000; + irqen = 0xDDA000; + } /* * Use a short timeout for Identify commands. This is because some bad From b52b3f743ad1d3061b6880b9cb8fd8cb78c75d58 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Thu, 26 Dec 2024 20:37:15 +0100 Subject: [PATCH 37/60] DA/DD IDE Bus --- rom/devs/ata/ata_busclass.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/rom/devs/ata/ata_busclass.c b/rom/devs/ata/ata_busclass.c index 813b95e66fc..1d119a9e039 100644 --- a/rom/devs/ata/ata_busclass.c +++ b/rom/devs/ata/ata_busclass.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2019, The AROS Development Team. All rights reserved. + Copyright © 1995-2019, The AROS Development Team. All rights reserved. $Id$ */ @@ -948,7 +948,22 @@ BOOL Hidd_ATABus_Start(OOP_Object *o, struct ataBase *ATABase) OOP_SetAttrsTags(o, aHidd_Bus_IRQHandler, Hidd_ATABus_HandleIRQ, aHidd_Bus_IRQData , ab, TAG_DONE); - + + // is this check correct? Please find more accurate way if possible + if(ATABase->ata__buscount == 0) + { + if((d & 0xFF) != 0xFF) + ab->use_da = FALSE; + else ab->use_da = TRUE; + } + else + { + if((a & 0xFF) != 0xFF) + ab->use_da = TRUE; + else ab->use_da = FALSE; + TaskName = "ATA[PI] Subsystem 2"; + } + /* scan bus - try to locate all devices (disables irq) */ ata_InitBus(ab); @@ -995,14 +1010,26 @@ BOOL Hidd_ATABus_Start(OOP_Object *o, struct ataBase *ATABase) * then, if successful, insert units. This allows to keep things parallel. */ D(bug("[ATA>>] Start: Bus %u: Unit 0 - %d, Unit 1 - %d\n", ab->ab_BusNum, ab->ab_Dev[0], ab->ab_Dev[1])); - return NewCreateTask(TASKTAG_PC , BusTaskCode, - TASKTAG_NAME , "ATA[PI] Subsystem", + if(ATABase->ata__buscount == 0) + { + return NewCreateTask(TASKTAG_PC , BusTaskCode, + TASKTAG_NAME , TaskName, TASKTAG_STACKSIZE , STACK_SIZE, TASKTAG_PRI , TASK_PRI, TASKTAG_TASKMSGPORT, &ab->ab_MsgPort, TASKTAG_ARG1 , ab, TASKTAG_ARG2 , ATABase, TAG_DONE) ? TRUE : FALSE; + }else{ + return NewCreateTask(TASKTAG_PC , BusTaskCode2, + TASKTAG_NAME , TaskName, + TASKTAG_STACKSIZE , STACK_SIZE, + TASKTAG_PRI , TASK_PRI, + TASKTAG_TASKMSGPORT, &ab->ab_MsgPort, + TASKTAG_ARG1 , ab, + TASKTAG_ARG2 , ATABase, + TAG_DONE) ? TRUE : FALSE; + } } AROS_UFH3(BOOL, Hidd_ATABus_Open, From ed93f512b5529908f789dd8622299a935e93e834 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Thu, 26 Dec 2024 20:49:14 +0100 Subject: [PATCH 38/60] DA/DD IDE Bus --- rom/devs/ata/ata.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) diff --git a/rom/devs/ata/ata.c b/rom/devs/ata/ata.c index a809f2c25d1..7df4f5718d5 100755 --- a/rom/devs/ata/ata.c +++ b/rom/devs/ata/ata.c @@ -1093,3 +1093,97 @@ void BusTaskCode(struct ata_Bus *bus, struct ataBase *ATABase) } } } +void BusTaskCode2(struct ata_Bus *bus, struct ataBase *ATABase) +{ + ULONG sig; + int iter; + struct IORequest *msg; + OOP_Object *unitObj; + struct ata_Unit *unit; + + DINIT(bug("[ATA**] Task started (bus: %u)\n", bus->ab_BusNum)); + + bus->ab_Timer = ata_OpenTimer(ATABase); +// bus->ab_BounceBufferPool = CreatePool(MEMF_CLEAR | MEMF_31BIT, 131072, 65536); + + /* Get the signal used for sleeping */ + bus->ab_Task = FindTask(0); + bus->ab_SleepySignal = AllocSignal(-1); + /* Failed to get it? Use SIGBREAKB_CTRL_E instead */ + if (bus->ab_SleepySignal < 0) + bus->ab_SleepySignal = SIGBREAKB_CTRL_E; + + sig = 1L << bus->ab_MsgPort->mp_SigBit; + + for (iter = 0; iter < MAX_BUSUNITS; ++iter) + { + DINIT(bug("[ATA**] Device %u type %d\n", iter, bus->ab_Dev[iter])); + + if (bus->ab_Dev[iter] > DEV_UNKNOWN) + { + unitObj = OOP_NewObject(ATABase->unitClass, NULL, NULL); + if (unitObj) + { + unit = OOP_INST_DATA(ATABase->unitClass, unitObj); + ata_init_unit(bus, unit, iter); + if (ata_setup_unit(bus, unit)) + { + /* + * Add unit to the bus. + * At this point it becomes visible to OpenDevice(). + */ + bus->ab_Units[iter] = unitObj; + + if (unit->au_XferModes & AF_XFER_PACKET) + { + struct ata_Controller *ataNode = NULL; + + ata_RegisterVolume(0, 0, unit); + + OOP_GetAttr(bus->ab_Object, aHidd_ATABus_Controller, (IPTR *)&ataNode); + } + else + { + ata_RegisterVolume(0, unit->au_Cylinders - 1, unit); + } + } + else + { + /* Destroy unit that couldn't be initialised */ + OOP_DisposeObject((OOP_Object *)unit); + bus->ab_Dev[iter] = DEV_NONE; + } + } + } + } + + D(bug("[ATA--] Bus %u scan finished\n", bus->ab_BusNum)); + ReleaseSemaphore(&ATABase->DetectionSem); + + /* Wait forever and process messages */ + for (;;) + { + Wait(sig); + + /* Even if you get new signal, do not process it until Unit is not active */ + if (!(bus->ab_Flags & UNITF_ACTIVE)) + { + bus->ab_Flags |= UNITF_ACTIVE; + + /* Empty the request queue */ + while ((msg = (struct IORequest *)GetMsg(bus->ab_MsgPort))) + { + /* And do IO's */ + HandleIO(msg, ATABase); + + /* TD_ADDCHANGEINT doesn't require reply */ + if (msg->io_Command != TD_ADDCHANGEINT) + { + ReplyMsg((struct Message *)msg); + } + } + + bus->ab_Flags &= ~(UNITF_INTASK | UNITF_ACTIVE); + } + } +} From 4a6463410f0a47c7a1efa5fef4815f6f3bb921b6 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Thu, 26 Dec 2024 20:50:27 +0100 Subject: [PATCH 39/60] DD/DA IDE Bus --- rom/devs/ata/ata.h | 1 + 1 file changed, 1 insertion(+) diff --git a/rom/devs/ata/ata.h b/rom/devs/ata/ata.h index 37c15e97d87..18943316eb8 100755 --- a/rom/devs/ata/ata.h +++ b/rom/devs/ata/ata.h @@ -409,6 +409,7 @@ void ata_init_unit(struct ata_Bus *bus, struct ata_Unit *unit, UBYTE u); BOOL ata_RegisterVolume(ULONG StartCyl, ULONG EndCyl, struct ata_Unit *unit); void BusTaskCode(struct ata_Bus *bus, struct ataBase *ATABase); +void BusTaskCode2(struct ata_Bus *bus, struct ataBase *ATABase); void DaemonCode(struct ataBase *LIBBASE, struct ata_Controller *ataNode); BYTE SCSIEmu(struct ata_Unit*, struct SCSICmd*); From 31cc282e56bb63f04add1e9f55210482b98da54e Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Thu, 26 Dec 2024 21:15:16 +0100 Subject: [PATCH 40/60] DA/DD IDE Bus --- rom/devs/ata/ata_busclass.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rom/devs/ata/ata_busclass.c b/rom/devs/ata/ata_busclass.c index 1d119a9e039..fa6c7ee3f85 100644 --- a/rom/devs/ata/ata_busclass.c +++ b/rom/devs/ata/ata_busclass.c @@ -948,6 +948,11 @@ BOOL Hidd_ATABus_Start(OOP_Object *o, struct ataBase *ATABase) OOP_SetAttrsTags(o, aHidd_Bus_IRQHandler, Hidd_ATABus_HandleIRQ, aHidd_Bus_IRQData , ab, TAG_DONE); + unsigned short *pd = (unsigned char *)0xdd0018; + unsigned short *pa = (unsigned char *)0xda0018; + unsigned short d, a; + d = *pd; + a = *pa; // is this check correct? Please find more accurate way if possible if(ATABase->ata__buscount == 0) From f5f04d52967a6a0851708a07067725b9db1e4c0c Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Thu, 26 Dec 2024 21:41:27 +0100 Subject: [PATCH 41/60] DA/DD IDE Bus --- rom/devs/ata/ata_busclass.c | 1 + 1 file changed, 1 insertion(+) diff --git a/rom/devs/ata/ata_busclass.c b/rom/devs/ata/ata_busclass.c index fa6c7ee3f85..8ed6beed63d 100644 --- a/rom/devs/ata/ata_busclass.c +++ b/rom/devs/ata/ata_busclass.c @@ -941,6 +941,7 @@ void ATABus__Hidd_ATABus__Shutdown(OOP_Class *cl, OOP_Object *o, OOP_Msg *msg) BOOL Hidd_ATABus_Start(OOP_Object *o, struct ataBase *ATABase) { struct ata_Bus *ab = OOP_INST_DATA(ATABase->busClass, o); + STRPTR TaskName = "ATA[PI] Subsystem"; D(bug("[ATA:Bus] %s()\n", __func__)); From 7d4c339ef39d365ecaaf8e85d27cf464ea91e360 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Sat, 28 Dec 2024 20:38:44 +0100 Subject: [PATCH 42/60] DA/DD Gayle --- arch/m68k-amiga/hidd/gayle_ata/interface_pio.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/m68k-amiga/hidd/gayle_ata/interface_pio.h b/arch/m68k-amiga/hidd/gayle_ata/interface_pio.h index 9ac3a3c0ab0..7049ccbf2a3 100644 --- a/arch/m68k-amiga/hidd/gayle_ata/interface_pio.h +++ b/arch/m68k-amiga/hidd/gayle_ata/interface_pio.h @@ -7,13 +7,23 @@ /* * Standard Amiga Gayle Definitions */ -#define GAYLE_BASE_1200 0xdd0000 /* 0xda0000.W, 0xda0004.B, 0xda0008.B ... */ +#if VAMPIRECARDSERIES==2 +#define GAYLE_BASE_1200 0xda0000 /* 0xda0000.W, 0xda0004.B, 0xda0008.B ... */ +#define GAYLE_IRQ_1200 0xda9000 +#define GAYLE_INT_1200 0xdaa000 +#else +#define GAYLE_BASE_1200 0xdd0000 /* 0xdd0000.W, 0xdd0004.B, 0xdd0008.B ... */ #define GAYLE_IRQ_1200 0xdd9000 #define GAYLE_INT_1200 0xdda000 +#endif #define GAYLE_BASE_4000 0xdd2022 /* 0xdd2020.W, 0xdd2026.B, 0xdd202a.B ... (argh!) */ #define GAYLE_IRQ_4000 0xdd3020 +#define GAYLE_BASE_500 0xda0000 /* Let's call it A500 even if it's used in others as well */ +#define GAYLE_IRQ_500 0xda9000 +#define GAYLE_INT_500 0xdaa000 + #define GAYLE_IRQ_IDE 0x80 #define GAYLE_INT_IDE 0x80 @@ -22,6 +32,7 @@ struct pio_data UBYTE *dataport; UBYTE *port; UBYTE *altport; + BOOL a500; }; extern const APTR bus_FuncTable[]; From 5540857fe61575209aa20c25ebc15d0af0e4f9a5 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Sat, 28 Dec 2024 20:52:40 +0100 Subject: [PATCH 43/60] DA/DD Gayle --- arch/m68k-amiga/hidd/gayle_ata/probe.c | 193 +++++++++++++++++-------- 1 file changed, 132 insertions(+), 61 deletions(-) diff --git a/arch/m68k-amiga/hidd/gayle_ata/probe.c b/arch/m68k-amiga/hidd/gayle_ata/probe.c index 3674f6af9b1..c2b1dc3101a 100644 --- a/arch/m68k-amiga/hidd/gayle_ata/probe.c +++ b/arch/m68k-amiga/hidd/gayle_ata/probe.c @@ -1,5 +1,5 @@ /* - Copyright © 2013-2020, The AROS Development Team. All rights reserved. + Copyright © 2013-2020, The AROS Development Team. All rights reserved. $Id$ Desc: A600/A1200/A4000 ATA HIDD hardware detection routine @@ -33,18 +33,63 @@ -static UBYTE *getport(struct ata_ProbedBus *ddata) +static UBYTE *getport(struct ata_ProbedBus *ddata, int a500) { volatile struct Custom *custom = (struct Custom*)0xdff000; UBYTE id, status1, status2; volatile UBYTE *port, *altport; struct GfxBase *gfx; - + int retrynum = 0; + + struct GayleAdr {unsigned short a;}; + struct GayleAdr *ga = (struct GayleAdr *)0xda0018; + struct GayleAdr *gd = (struct GayleAdr *)0xdd0018; + struct GayleAdr *ca = (struct GayleAdr *)0xda1010; + struct GayleAdr *cd = (struct GayleAdr *)0xdd1010; + struct GayleAdr *cmda = (struct GayleAdr *)0xda101C; + struct GayleAdr *cmdd = (struct GayleAdr *)0xdd101C; + struct Board {UWORD type;}; + struct Board *MyBoard = (struct Board *)0xDFF3FC; + /* Is the following correct or can we do it more intelligent? */ + if(a500 > 0) + { + // A500 only has one controller + if((MyBoard->type == 0x02)||(MyBoard->type == 0x03)) + return 0; + ga->a = 0x0; + cmda->a = 0x10; + ca->a = 0x10; + if(ca->a != 0x10) return 0; // no hardware? + ca->a = 0x34; + if(ca->a != 0x34) return 0; // no hardware? + if((ga->a & 0xFF) == 0xFF) return 0; + } + else + { + gd->a = 0x0; + cd->a = 0x10; + cmdd->a = 0x10; + if(cd->a != 0x10) return 0; // no hardware? + cd->a = 0x34; + if(cd->a != 0x34) return 0; // no hardware? + if((gd->a & 0xFF ) == 0xFF) return 0; + } + port = NULL; gfx = (struct GfxBase*)TaggedOpenLibrary(TAGGEDOPEN_GRAPHICS); Disable(); - port = (UBYTE*)GAYLE_BASE_1200; - ddata->gayleirqbase = (UBYTE*)GAYLE_IRQ_1200; + if(a500 > 0) + { + port = (UBYTE*)GAYLE_BASE_500; + ddata->gayleirqbase = (UBYTE*)GAYLE_IRQ_500; + ddata->a500 = TRUE; + } + else + { + port = (UBYTE*)GAYLE_BASE_1200; + ddata->gayleirqbase = (UBYTE*)GAYLE_IRQ_1200; + ddata->a500 = FALSE; + } Enable(); CloseLibrary((struct Library*)gfx); @@ -73,7 +118,9 @@ static UBYTE *getport(struct ata_ProbedBus *ddata) if ( (((status1 | status2) & (ATAF_BUSY | ATAF_DRDY)) == (ATAF_BUSY | ATAF_DRDY)) || ((status1 | status2) & (ATAF_ERROR | ATAF_DATAREQ))) { -// goto RETRY; + retrynum++; + if(retrynum == 10) return NULL; + goto RETRY; //D(bug("[ATA:Gayle] No Devices detected\n");) //return NULL; @@ -87,70 +134,94 @@ static int gayle_bus_Scan(struct ataBase *base) { struct ata_ProbedBus *probedbus; OOP_Class *busClass = base->GayleBusClass; - struct TagItem ata_tags[] = + + for(int i=0; i<2; i++) { - {aHidd_Name , (IPTR)"ata_gayle.hidd" }, - {aHidd_HardwareName , 0 }, + + struct TagItem ata_tags[] = + { + {aHidd_Name , (IPTR)"ata_gayle.hidd" }, + {aHidd_HardwareName , 0 }, #define ATA_TAG_HARDWARENAME 1 - {TAG_DONE , 0 } - }; - - probedbus = AllocVec(sizeof(struct ata_ProbedBus), MEMF_ANY | MEMF_CLEAR); - if (probedbus && getport(probedbus)) { - OOP_Object *ata; - if (probedbus->doubler == 0) - ata_tags[ATA_TAG_HARDWARENAME].ti_Data = (IPTR)"Amiga(tm) Gayle IDE Controller"; + {TAG_DONE , 0 } + }; + + probedbus = AllocVec(sizeof(struct ata_ProbedBus), MEMF_ANY | MEMF_CLEAR); + if (probedbus && getport(probedbus, i)) { + OOP_Object *ata; + if(i == 0) + { + if (probedbus->doubler == 0) + ata_tags[ATA_TAG_HARDWARENAME].ti_Data = (IPTR)"Amiga(tm) Gayle IDE Controller"; + else + ata_tags[ATA_TAG_HARDWARENAME].ti_Data = (IPTR)"Amiga(tm) Gayle IDE Controller + Port Doubler"; + } else - ata_tags[ATA_TAG_HARDWARENAME].ti_Data = (IPTR)"Amiga(tm) Gayle IDE Controller + Port Doubler"; - - ata = HW_AddDriver(base->storageRoot, base->ataClass, ata_tags); - if (ata) { - struct TagItem attrs[] = { - {aHidd_Name , (IPTR)"ata_gayle.hidd" }, - {aHidd_HardwareName , 0 }, + if (probedbus->doubler == 0) + ata_tags[ATA_TAG_HARDWARENAME].ti_Data = (IPTR)"Amiga(tm) Gayle IDE Controller 2"; + else + ata_tags[ATA_TAG_HARDWARENAME].ti_Data = (IPTR)"Amiga(tm) Gayle IDE Controller 2 + Port Doubler"; + } + + ata = HW_AddDriver(base->storageRoot, base->ataClass, ata_tags); + if (ata) { + struct TagItem attrs[] = + { + {aHidd_Name , (IPTR)"ata_gayle.hidd" }, + {aHidd_HardwareName , 0 }, #define BUS_TAG_HARDWARENAME 1 - {aHidd_DriverData , (IPTR)probedbus }, - {aHidd_ATABus_PIODataSize , sizeof(struct pio_data) }, - {aHidd_ATABus_BusVectors , (IPTR)bus_FuncTable }, - {aHidd_ATABus_PIOVectors , (IPTR)pio_FuncTable }, - {aHidd_Bus_KeepEmpty , FALSE }, - {TAG_DONE , 0 } - }; - OOP_Object *bus; - - /* - * We use this field as ownership indicator. - * The trick is that HW_AddDriver() fails if either object creation fails - * or subsystem-side setup fails. In the latter case our object will be - * disposed. - * We need to know whether OOP_DisposeObject() or we should deallocate - * this structure on failure. - */ - probedbus->atapb_Node.ln_Succ = NULL; - - /* - * Check if we have a FastATA adaptor - */ - attrs[BUS_TAG_HARDWARENAME].ti_Data = (IPTR)"Gayle IDE Channel"; + {aHidd_DriverData , (IPTR)probedbus }, + {aHidd_ATABus_PIODataSize , sizeof(struct pio_data) }, + {aHidd_ATABus_BusVectors , (IPTR)bus_FuncTable }, + {aHidd_ATABus_PIOVectors , (IPTR)pio_FuncTable }, + {aHidd_Bus_KeepEmpty , FALSE }, + {TAG_DONE , 0 } + }; + if(i == 1) + attrs[0].ti_Data = (IPTR)"ata_gayle2.hidd"; + + OOP_Object *bus; + + /* + * We use this field as ownership indicator. + * The trick is that HW_AddDriver() fails if either object creation fails + * or subsystem-side setup fails. In the latter case our object will be + * disposed. + * We need to know whether OOP_DisposeObject() or we should deallocate + * this structure on failure. + */ + probedbus->atapb_Node.ln_Succ = NULL; + + /* + * Check if we have a FastATA adaptor + */ + if(i == 0) + attrs[BUS_TAG_HARDWARENAME].ti_Data = (IPTR)"Gayle IDE Channel"; + else attrs[BUS_TAG_HARDWARENAME].ti_Data = (IPTR)"Gayle IDE Channel 2"; - bus = HIDD_StorageController_AddBus(ata, busClass, attrs); - if (bus) - return TRUE; - D(bug("[ATA:Gayle] Failed to create object for device IO: %x:%x IRQ: %x\n", - probedbus->port, probedbus->altport, probedbus->gayleirqbase);) - - /* - * Free the structure only upon object creation failure! - * In case of success it becomes owned by the driver object! - */ - if (!probedbus->atapb_Node.ln_Succ) - FreeVec(probedbus); - return TRUE; + bus = HIDD_StorageController_AddBus(ata, busClass, attrs); + + // Do not exit, we could have more controllers + // if (bus) + // return TRUE; + + D(bug("[ATA:Gayle] Failed to create object for device IO: %x:%x IRQ: %x\n", + probedbus->port, probedbus->altport, probedbus->gayleirqbase);) + + /* + * Free the structure only upon object creation failure! + * In case of success it becomes owned by the driver object! + * Edit: Can we really free it yet? We are collecting controllers. Please enable the two lines if sure. + */ + // if (!probedbus->atapb_Node.ln_Succ) + // FreeVec(probedbus); + // return TRUE; + } } + FreeVec(probedbus); } - FreeVec(probedbus); return TRUE; } From 4e2a0cfd993aebdcf45b5d3e9f16c2de6cacc513 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Sat, 28 Dec 2024 20:55:25 +0100 Subject: [PATCH 44/60] DA/DD Gayle --- .../m68k-amiga/hidd/gayle_ata/interface_pio.c | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/arch/m68k-amiga/hidd/gayle_ata/interface_pio.c b/arch/m68k-amiga/hidd/gayle_ata/interface_pio.c index 5d83d3c6d77..194b602a001 100644 --- a/arch/m68k-amiga/hidd/gayle_ata/interface_pio.c +++ b/arch/m68k-amiga/hidd/gayle_ata/interface_pio.c @@ -34,13 +34,25 @@ static void ata_outsl(struct pio_data *data, APTR address, ULONG count) { volatile ULONG *addr = (ULONG*)data->dataport; - + if(data->a500) + { + asm volatile( +"1: move.l (%[address])+,(0xda2000) \n" +" move.l (%[address])+,(0xda2000) \n" +" subq.l #1,%[count] \n" +" bnes 1b \n" + ::[count]"d"(count >> 3),[address]"a"(address),[port]"a"(addr)); + } + else + { asm volatile( "1: move.l (%[address])+,(0xdd2000) \n" " move.l (%[address])+,(0xdd2000) \n" " subq.l #1,%[count] \n" " bnes 1b \n" ::[count]"d"(count >> 3),[address]"a"(address),[port]"a"(addr)); + } + } @@ -48,7 +60,18 @@ static void ata_insl(struct pio_data *data, APTR address, ULONG count) { volatile ULONG *addr = (ULONG*)data->dataport; - + if(data->a500) + { + asm volatile( +" bra 2f \n" +"1: \n" +" move16 0x00da6000,(%[address])+ \n" +" move16 0x00da6000,(%[address])+ \n" +"2: dbra %[count],1b \n" + ::[count]"d"(count >> 5),[address]"a"(address)); + } + else + { asm volatile( " bra 2f \n" "1: \n" @@ -56,6 +79,7 @@ static void ata_insl(struct pio_data *data, APTR address, ULONG count) " move16 0x00dd6000,(%[address])+ \n" "2: dbra %[count],1b \n" ::[count]"d"(count >> 5),[address]"a"(address)); + } } const APTR bus_FuncTable[] = From 75dea245b8fc2697b73c748d58e47d9b1cb5204b Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Sat, 28 Dec 2024 20:56:33 +0100 Subject: [PATCH 45/60] DA/DD Gayle --- arch/m68k-amiga/hidd/gayle_ata/bus_class.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/m68k-amiga/hidd/gayle_ata/bus_class.h b/arch/m68k-amiga/hidd/gayle_ata/bus_class.h index e2e1def4e6d..62eed1b9d87 100644 --- a/arch/m68k-amiga/hidd/gayle_ata/bus_class.h +++ b/arch/m68k-amiga/hidd/gayle_ata/bus_class.h @@ -9,6 +9,7 @@ struct ata_ProbedBus UBYTE *altport; UBYTE *gayleirqbase; BOOL a4000; + BOOL a500; UBYTE doubler; }; @@ -22,6 +23,7 @@ struct ATA_BusData UBYTE *gayleirqbase; UBYTE *gayleintbase; BOOL ideintadded; + BOOL a500; }; struct ataBase From 951b997927267fd4ba2ebe20f88a2c3bbc55e912 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Sat, 28 Dec 2024 21:00:42 +0100 Subject: [PATCH 46/60] DA/DD Gayle --- .../hidd/gayle_ata/gayleata_busclass.c | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/arch/m68k-amiga/hidd/gayle_ata/gayleata_busclass.c b/arch/m68k-amiga/hidd/gayle_ata/gayleata_busclass.c index 71bc4d2cd71..9a16029c7db 100644 --- a/arch/m68k-amiga/hidd/gayle_ata/gayleata_busclass.c +++ b/arch/m68k-amiga/hidd/gayle_ata/gayleata_busclass.c @@ -1,5 +1,5 @@ /* - Copyright © 2013-2020, The AROS Development Team. All rights reserved. + Copyright © 2013-2020, The AROS Development Team. All rights reserved. $Id$ Desc: A600/A1200/A4000 ATA HIDD @@ -57,12 +57,21 @@ static BOOL ata_CreateGayleInterrupt(struct ATA_BusData *bus, UBYTE num) { struct Interrupt *irq = &bus->ideint; - bus->gayleintbase = (UBYTE*)GAYLE_INT_1200; - irq->is_Code = (APTR)IDE_Handler_A1200; - + if(bus->a500) + { + bus->gayleintbase = (UBYTE*)GAYLE_INT_500; + } + else + { + bus->gayleintbase = (UBYTE*)GAYLE_INT_1200; + } + irq->is_Code = (APTR)IDE_Handler_A1200; + irq->is_Node.ln_Pri = 20; irq->is_Node.ln_Type = NT_INTERRUPT; - irq->is_Node.ln_Name = "AT-IDE"; + if(bus->a500) + irq->is_Node.ln_Name = "AT-IDE2"; + else irq->is_Node.ln_Name = "AT-IDE"; irq->is_Data = bus; AddIntServer(INTB_PORTS, irq); @@ -112,6 +121,7 @@ OOP_Object *GAYLEATA__Root__New(OOP_Class *cl, OOP_Object *o, struct pRoot_New * data->bus->atapb_Node.ln_Succ = (struct Node *)-1; data->gaylebase = data->bus->port; data->gayleirqbase = data->bus->gayleirqbase; + data->a500 = data->bus->a500; //ata_CreateGayleInterrupt(data, 0); //mDispose = msg->mID - moRoot_New + moRoot_Dispose; @@ -201,6 +211,7 @@ APTR GAYLEATA__Hidd_ATABus__GetPIOInterface(OOP_Class *cl, OOP_Object *o, OOP_Ms pio->port = data->bus->port; pio->altport = data->bus->altport; pio->dataport = (UBYTE*)(((ULONG)pio->port) & ~3); + pio->a500 = data->bus->a500; /* * (A600/A1200) Data port is in a shadow bank of gayle (offset of 0x2000). * This shadow bank is for 16/32-bit data transfers, while the From f9c17a97fc1ea70e055eadf0d5bdd35be551906a Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Mon, 30 Dec 2024 20:31:22 +0100 Subject: [PATCH 47/60] Add GadGImage --- rom/intuition/refreshglist.c | 41 ++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/rom/intuition/refreshglist.c b/rom/intuition/refreshglist.c index 2c3f2df367d..c659b23472e 100644 --- a/rom/intuition/refreshglist.c +++ b/rom/intuition/refreshglist.c @@ -91,11 +91,12 @@ struct Gadget *findprevgadget(struct Gadget *gadget,struct Window *window,struct gadgets = requester->ReqGadget; } -#ifdef USEGADGETLOCK +// Lock both in any way. If not correct, revert, but it seems fine +//#ifdef USEGADGETLOCK LOCKGADGET(IntuitionBase) -#else +//#else LOCKWINDOWLAYERS(window); -#endif +//#endif int_refreshglist(gadgets, window, @@ -105,11 +106,11 @@ struct Gadget *findprevgadget(struct Gadget *gadget,struct Window *window,struct 0, IntuitionBase); -#ifdef USEGADGETLOCK +//#ifdef USEGADGETLOCK UNLOCKGADGET(IntuitionBase) -#else +//#else UNLOCKWINDOWLAYERS(window); -#endif +//#endif ReturnVoid("RefreshGList"); @@ -120,6 +121,10 @@ void int_refreshglist(struct Gadget *gadgets, struct Window *window, struct Requester *requester, LONG numGad, LONG mustbe, LONG mustnotbe, struct IntuitionBase *IntuitionBase) { + +// Might help to undef this +#undef GADTOOLSCOMPATIBLE + #ifdef GADTOOLSCOMPATIBLE struct Gadget *gadtoolsgadget = 0; #endif @@ -131,15 +136,15 @@ void int_refreshglist(struct Gadget *gadgets, struct Window *window, gadgets, window, requester, numGad, mustbe, mustnotbe)); // in case we're not called from RefreshGList... -#ifdef USEGADGETLOCK +//#ifdef USEGADGETLOCK LOCKGADGET(IntuitionBase) -#else +//#else LOCKWINDOWLAYERS(window); -#endif +//#endif for ( ; gadgets && numGad; gadgets=gadgets->NextGadget, numGad --) { - if (gadgets->GadgetType == 0) + if ((gadgets->GadgetType == 0) || (gadgets->GadgetType == 0x100) || (gadgets->GadgetType == 0x105) || (gadgets->Flags == 0x8007)) { #ifdef GADTOOLSCOMPATIBLE if (gadgets->GadgetType & 0x100) @@ -172,7 +177,7 @@ void int_refreshglist(struct Gadget *gadgets, struct Window *window, gadgets = firstgad; for ( ; gadgets && numGad; gadgets=gadgets->NextGadget, numGad --) { - if (gadgets->GadgetType > 0) + if ((gadgets->GadgetType > 0) && (gadgets->GadgetType != 0x100) && (gadgets->GadgetType != 0x105) && (gadgets->Flags != 0x8007)) { #ifdef GADTOOLSCOMPATIBLE if (gadgets->GadgetType & 0x100) @@ -213,11 +218,11 @@ void int_refreshglist(struct Gadget *gadgets, struct Window *window, } #endif -#ifdef USEGADGETLOCK +//#ifdef USEGADGETLOCK UNLOCKGADGET(IntuitionBase) -#else +//#else UNLOCKWINDOWLAYERS(window); -#endif +//#endif } BOOL qualifygadget(struct Gadget *gadgets,LONG mustbe, LONG mustnotbe,struct IntuitionBase *IntuitionBase) @@ -271,6 +276,14 @@ BOOL qualifygadget(struct Gadget *gadgets,LONG mustbe, LONG mustnotbe,struct Int { if (mustbe & REFRESHGAD_BOOPSI) return FALSE; /* don't refresh if not boopsi gadget */ } + if (gadgets->Flags & (GFLG_GADGIMAGE|GFLG_GADGHNONE) == GFLG_GADGIMAGE|GFLG_GADGHNONE) + { + if (mustnotbe & REFRESHGAD_BOOPSI) return FALSE; /* don't refresh if boopsi gadget */ + } + else + { + if (mustbe & REFRESHGAD_BOOPSI) return FALSE; /* don't refresh if not boopsi gadget */ + } } /* if ((mustbe != 0) || (mustnotbe != 0)) */ return TRUE; From 92d44c7c2d85d5d8b77d8c8f1a5cef90b21ce46b Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Mon, 30 Dec 2024 22:38:17 +0100 Subject: [PATCH 48/60] Make LoadRGB4 more 1.3 and 3.1 compatible --- rom/graphics/loadrgb4.c | 126 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 125 insertions(+), 1 deletion(-) diff --git a/rom/graphics/loadrgb4.c b/rom/graphics/loadrgb4.c index ee5cc84614c..42311f44e69 100644 --- a/rom/graphics/loadrgb4.c +++ b/rom/graphics/loadrgb4.c @@ -8,6 +8,92 @@ #include #include "graphics_intern.h" +static void pokeCL(UWORD *ci, UWORD target, UWORD table) +{ + ULONG targ = (ULONG)target; + if(!ci) return; + targ &= 0x1fe; + for(;ci;ci+=2) + { + if( ((*ci)==0xffff) && ((*(ci+1) == 0xfffe))) return; + if(*ci == targ) break; + } + if (((*ci) == 0xffff) && ((*(ci+1)==0xfffe))) return; + if(*ci == targ) + { + ci++; + *ci++ = table; + } +} + +static struct CopIns *pokeCI(struct CopIns *ci, UWORD *field1, short field2) +{ + struct CopIns *c; + c = ci; + if(c) + { + short out = FALSE; + while(!out) + { + switch(c->OpCode & 3) + { + case COPPER_MOVE: + { + if(c->DESTADDR == (((UWORD)field1) & 0x1fe)) + { + short mask; + if((mask = op&0xC000)) + { + if(c->OpCode & mask) + { + c->DESTDATA = field2; + return c; + } + } + else + { + c->DESTDATA = field2; + return c; + } + } + c++; + break; + } + case COPPER_WAIT: + { + if(c->HWAITPOS == 255) + { + return 0; + } + else c++; + break; + } + case CPRNXTBUF: + { + if(c->NXTLIST == NULL) + { + out = TRUE; + } + else + { + if((c = c->NXTLIST->CopIns) == NULL) + { + out = TRUE; + } + } + break; + } + default: + { + out=TRUE; + break; + } + } + } + } + return 0; +} + /***************************************************************************** NAME */ @@ -55,14 +141,35 @@ AROS_LIBFUNC_INIT WORD t; + int i; + volatile struct Custom *custom = (struct Custom *)0xdff000; if (!vp) + { + // No ViewPort? Then alter the colors directly + for (i = 0; i < count ; i++) + custom->color[i] = *colors++; return; - + } ASSERT_VALID_PTR(vp); ASSERT_VALID_PTR(colors); /* TODO: Optimization */ + struct ColorMap *cm; + UWORD *ct; + + // Why do we need this? Answer: For non hidd screens SetRGB32 might fail to fill the color table. This is a good place, I think + if(vp->ColorMap) + { + cm = vp->ColorMap; + ct = cm->ColorTable; + if(count > cm->Count) count = cm->Count; + for(i = 0; iActiViewCprSemaphore); + for (t = 0; t < count; t ++ ) + { + // Remaining question: Do we need to check VP_HIDE? + if(vp->DspIns) + { + // we need to store it into the intermediate CopperList too + pokeCL(vp->DspIns->CopLStart, &custom->color[t], colors[t]); + pokeCL(vp->DspIns->CopSStart, &custom->color[t], colors[t]); + pokeCI(vp->DspIns->CopIns, &custom->color[t], colors[t]); + } + } + ReleaseSemaphore(GfxBase->ActiViewCprSemaphore); + + // To make it visible immediately we need to update the view. To simplify it, we call MrgCop + MrgCop(GfxBase->ActiView); AROS_LIBFUNC_EXIT From 0bed0165cfc2fde74975d2d88fefb8919e47591d Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Mon, 30 Dec 2024 23:02:41 +0100 Subject: [PATCH 49/60] Aktualisieren von loadrgb4.c --- rom/graphics/loadrgb4.c | 1 + 1 file changed, 1 insertion(+) diff --git a/rom/graphics/loadrgb4.c b/rom/graphics/loadrgb4.c index 42311f44e69..5950eabe658 100644 --- a/rom/graphics/loadrgb4.c +++ b/rom/graphics/loadrgb4.c @@ -29,6 +29,7 @@ static void pokeCL(UWORD *ci, UWORD target, UWORD table) static struct CopIns *pokeCI(struct CopIns *ci, UWORD *field1, short field2) { struct CopIns *c; + UWORD op=COPPER_MOVE; c = ci; if(c) { From 01550e7e192424a2253fcd24e108fd951f24c6e9 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Sat, 4 Jan 2025 20:16:11 +0100 Subject: [PATCH 50/60] Add CL Poke Funcs --- rom/graphics/gfxfuncsupport.c | 91 +++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/rom/graphics/gfxfuncsupport.c b/rom/graphics/gfxfuncsupport.c index 4a65ede9515..e29d9a6ac3c 100644 --- a/rom/graphics/gfxfuncsupport.c +++ b/rom/graphics/gfxfuncsupport.c @@ -1242,3 +1242,94 @@ void GenMinterms(struct RastPort *rp) } } } + +/****************************************************************************************/ + +void pokeCL(UWORD *ci, UWORD target, UWORD table) +{ + ULONG targ = (ULONG)target; + if(!ci) return; + targ &= 0x1fe; + for(;ci;ci+=2) + { + if( ((*ci)==0xffff) && ((*(ci+1) == 0xfffe))) return; + if(*ci == targ) break; + } + if (((*ci) == 0xffff) && ((*(ci+1)==0xfffe))) return; + if(*ci == targ) + { + ci++; + *ci++ = table; + } +} + +/****************************************************************************************/ + +struct CopIns *pokeCI(struct CopIns *ci, UWORD *field1, short field2) +{ + struct CopIns *c; + UWORD op = COPPER_MOVE; + c = ci; + if(c) + { + short out = FALSE; + while(!out) + { + switch(c->OpCode & 3) + { + case COPPER_MOVE: + { + if(c->DESTADDR == (((UWORD)field1) & 0x1fe)) + { + short mask; + if((mask = op&0xC000)) + { + if(c->OpCode & mask) + { + c->DESTDATA = field2; + return c; + } + } + else + { + c->DESTDATA = field2; + return c; + } + } + c++; + break; + } + case COPPER_WAIT: + { + if(c->HWAITPOS == 255) + { + return 0; + } + else c++; + break; + } + case CPRNXTBUF: + { + if(c->NXTLIST == NULL) + { + out = TRUE; + } + else + { + if((c = c->NXTLIST->CopIns) == NULL) + { + out = TRUE; + } + } + break; + } + default: + { + out=TRUE; + break; + } + } + } + } + return 0; +} From c15337a431f93211609d262f3e0e461814f13e54 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Sat, 4 Jan 2025 20:16:51 +0100 Subject: [PATCH 51/60] Add CL Poke Funcs --- rom/graphics/gfxfuncsupport.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rom/graphics/gfxfuncsupport.h b/rom/graphics/gfxfuncsupport.h index f12603a1101..788539a3e27 100644 --- a/rom/graphics/gfxfuncsupport.h +++ b/rom/graphics/gfxfuncsupport.h @@ -220,6 +220,8 @@ void BltRastPortBitMap(struct RastPort *srcRastPort, WORD xSrc, WORD ySrc, struct GfxBase *GfxBase); void GenMinterms(struct RastPort *rp); +void pokeCL(UWORD *ci, UWORD target, UWORD table); +struct CopIns *pokeCI(struct CopIns *ci, UWORD *field1, short field2); /****************************************************************************************/ From b7674597f3915b20d7661d3fa50a662e88147d1d Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Sat, 4 Jan 2025 20:20:10 +0100 Subject: [PATCH 52/60] Update setrgb4.c --- rom/graphics/setrgb4.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/rom/graphics/setrgb4.c b/rom/graphics/setrgb4.c index 0fcf155a109..e6948867861 100644 --- a/rom/graphics/setrgb4.c +++ b/rom/graphics/setrgb4.c @@ -63,8 +63,32 @@ { AROS_LIBFUNC_INIT + UWORD col; + volatile struct Custom *custom = (struct Custom *)0xdff000; + + col = ((r & 0xF) << 8) | ((g & 0xF) << 4) | (b & 0xF); + if (!vp) + { + custom->color[n] = col; return; + } + + if(vp->ColorMap) + SetRGB4CM(vp->ColorMap, n, r, g, b); + + if(vp->ColorMap == NULL) + { + if(vp->DspIns) + { + ObtainSemaphore(GfxBase->ActiViewCprSemaphore); + pokeCL(vp->DspIns->CopLStart, &custom->color[n], col); + pokeCL(vp->DspIns->CopSStart, &custom->color[n], col); + + pokeCI(vp->DspIns->CopIns,&custom->color[n],col); + ReleaseSemaphore(GfxBase->ActiViewCprSemaphore); + } + } r = (( r & 0xF) << 4) | (r & 0xFF ); r = r | (r << 8) | ( r << 16 ) | (r << 24 ); @@ -75,6 +99,8 @@ SetRGB32( vp, n, r, g, b ); + MrcCop(GfxBase->ActiView); + /************************************************************ / This is the code that works correctly on the real thing struct ColorMap * CM = vp->ColorMap; From c8d0e1d5316111e1a277c3524161e6e3dd8e1795 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Sat, 4 Jan 2025 20:48:08 +0100 Subject: [PATCH 53/60] Aktualisieren von setrgb4.c --- rom/graphics/setrgb4.c | 1 + 1 file changed, 1 insertion(+) diff --git a/rom/graphics/setrgb4.c b/rom/graphics/setrgb4.c index e6948867861..4e2ee1ef28a 100644 --- a/rom/graphics/setrgb4.c +++ b/rom/graphics/setrgb4.c @@ -12,6 +12,7 @@ NAME */ #include #include +#include "gfxfuncsupport.h" AROS_LH5(void, SetRGB4, From c88979216bd289bfc907df99e21511e4feda715b Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Sat, 4 Jan 2025 21:12:40 +0100 Subject: [PATCH 54/60] Aktualisieren von setrgb4.c --- rom/graphics/setrgb4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rom/graphics/setrgb4.c b/rom/graphics/setrgb4.c index 4e2ee1ef28a..cbf89330d90 100644 --- a/rom/graphics/setrgb4.c +++ b/rom/graphics/setrgb4.c @@ -100,7 +100,7 @@ SetRGB32( vp, n, r, g, b ); - MrcCop(GfxBase->ActiView); + MrgCop(GfxBase->ActiView); /************************************************************ / This is the code that works correctly on the real thing From 01a85762318702206f3a9a99da49a8b878ad1ed8 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Mon, 6 Jan 2025 20:47:15 +0100 Subject: [PATCH 55/60] Update setrgb4.c --- rom/graphics/setrgb4.c | 1 + 1 file changed, 1 insertion(+) diff --git a/rom/graphics/setrgb4.c b/rom/graphics/setrgb4.c index cbf89330d90..0890bb77c3f 100644 --- a/rom/graphics/setrgb4.c +++ b/rom/graphics/setrgb4.c @@ -101,6 +101,7 @@ SetRGB32( vp, n, r, g, b ); MrgCop(GfxBase->ActiView); + GfxBase->LOFlist = GfxBase->ActiView->LOFCprList->start; /************************************************************ / This is the code that works correctly on the real thing From 7dd9fae43b71f2b6d3e5c5159d911b3a8cdb041f Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Mon, 6 Jan 2025 20:47:44 +0100 Subject: [PATCH 56/60] Update loadrgb4.c --- rom/graphics/loadrgb4.c | 1 + 1 file changed, 1 insertion(+) diff --git a/rom/graphics/loadrgb4.c b/rom/graphics/loadrgb4.c index 5950eabe658..90ea5f0705b 100644 --- a/rom/graphics/loadrgb4.c +++ b/rom/graphics/loadrgb4.c @@ -204,6 +204,7 @@ static struct CopIns *pokeCI(struct CopIns *ci, UWORD *field1, short field2) // To make it visible immediately we need to update the view. To simplify it, we call MrgCop MrgCop(GfxBase->ActiView); + GfxBase->LOFlist = GfxBase->ActiView->LOFCprList->start; AROS_LIBFUNC_EXIT From 2b814919739c00c7d3fd628ef732781dd4927803 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Thu, 9 Jan 2025 10:09:50 +0100 Subject: [PATCH 57/60] change CL in any case --- rom/graphics/setrgb4.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/rom/graphics/setrgb4.c b/rom/graphics/setrgb4.c index 0890bb77c3f..a5aef269963 100644 --- a/rom/graphics/setrgb4.c +++ b/rom/graphics/setrgb4.c @@ -78,17 +78,14 @@ if(vp->ColorMap) SetRGB4CM(vp->ColorMap, n, r, g, b); - if(vp->ColorMap == NULL) - { - if(vp->DspIns) - { - ObtainSemaphore(GfxBase->ActiViewCprSemaphore); - pokeCL(vp->DspIns->CopLStart, &custom->color[n], col); - pokeCL(vp->DspIns->CopSStart, &custom->color[n], col); + if(vp->DspIns) + { + ObtainSemaphore(GfxBase->ActiViewCprSemaphore); + pokeCL(vp->DspIns->CopLStart, &custom->color[n], col); + pokeCL(vp->DspIns->CopSStart, &custom->color[n], col); - pokeCI(vp->DspIns->CopIns,&custom->color[n],col); - ReleaseSemaphore(GfxBase->ActiViewCprSemaphore); - } + pokeCI(vp->DspIns->CopIns,&custom->color[n],col); + ReleaseSemaphore(GfxBase->ActiViewCprSemaphore); } r = (( r & 0xF) << 4) | (r & 0xFF ); From eee988f2e0d79e92a877624f98e20496947318bb Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Thu, 9 Jan 2025 10:47:41 +0100 Subject: [PATCH 58/60] Implement Changesprite --- rom/graphics/changesprite.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/rom/graphics/changesprite.c b/rom/graphics/changesprite.c index 15d9fa2e152..edc3a48ad23 100644 --- a/rom/graphics/changesprite.c +++ b/rom/graphics/changesprite.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2007, The AROS Development Team. All rights reserved. + Copyright © 1995-2007, The AROS Development Team. All rights reserved. $Id$ Desc: Graphics function ChangeSprite() @@ -50,8 +50,13 @@ { AROS_LIBFUNC_INIT - /* TODO: Write graphics/ChangeSprite() */ - aros_print_not_implemented ("ChangeSprite"); + WORD x,y; + + s->posctldata = newdata; + x = s->x; + y = s->y; + + MoveSprite(vp, s, x, y); AROS_LIBFUNC_EXIT } /* ChangeSprite */ From 9cc16d2ff2d52987cbc19a969caab367c952d210 Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Fri, 10 Jan 2025 08:34:02 +0100 Subject: [PATCH 59/60] Update loadrgb4.c --- rom/graphics/loadrgb4.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rom/graphics/loadrgb4.c b/rom/graphics/loadrgb4.c index 90ea5f0705b..2730dce4e14 100644 --- a/rom/graphics/loadrgb4.c +++ b/rom/graphics/loadrgb4.c @@ -204,7 +204,8 @@ static struct CopIns *pokeCI(struct CopIns *ci, UWORD *field1, short field2) // To make it visible immediately we need to update the view. To simplify it, we call MrgCop MrgCop(GfxBase->ActiView); - GfxBase->LOFlist = GfxBase->ActiView->LOFCprList->start; + if(TypeOfMem(GfxBase->ActiView->LOFCprList->start) == MEMF_CHIP) + GfxBase->LOFlist = GfxBase->ActiView->LOFCprList->start; AROS_LIBFUNC_EXIT From d9a835b8dad208b5ae2a622f2c3c50114acdd55c Mon Sep 17 00:00:00 2001 From: DerThore <101505694+DerThore@users.noreply.github.com> Date: Fri, 10 Jan 2025 08:34:34 +0100 Subject: [PATCH 60/60] Update setrgb4.c --- rom/graphics/setrgb4.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rom/graphics/setrgb4.c b/rom/graphics/setrgb4.c index a5aef269963..7e3f3cb0376 100644 --- a/rom/graphics/setrgb4.c +++ b/rom/graphics/setrgb4.c @@ -98,7 +98,8 @@ SetRGB32( vp, n, r, g, b ); MrgCop(GfxBase->ActiView); - GfxBase->LOFlist = GfxBase->ActiView->LOFCprList->start; + if(TypeOfMem(GfxBase->ActiView->LOFCprList->start) == MEMF_CHIP) + GfxBase->LOFlist = GfxBase->ActiView->LOFCprList->start; /************************************************************ / This is the code that works correctly on the real thing