From adc1e73777d93cb097a5c2f30dbe7e2bf9a69ddf Mon Sep 17 00:00:00 2001 From: John Bintz Date: Thu, 14 Dec 2023 20:21:54 -0500 Subject: [PATCH] starting on horizontal copper stuff --- .gitignore | 6 +++++ build_horizontal_copper.sh | 3 +++ horizontal_copper.c | 27 ++++++++++++++++++++++ old_hardware_setup.c | 46 ++++++++++++++++++++++++++++++++++++++ old_hardware_setup.h | 25 +++++++++++++++++++++ 5 files changed, 107 insertions(+) create mode 100644 .gitignore create mode 100755 build_horizontal_copper.sh create mode 100644 horizontal_copper.c create mode 100644 old_hardware_setup.c create mode 100644 old_hardware_setup.h diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7f5c30a --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +.vamosrc +*.o +*.uaem +*.lnk +*.info +bin/ diff --git a/build_horizontal_copper.sh b/build_horizontal_copper.sh new file mode 100755 index 0000000..26af229 --- /dev/null +++ b/build_horizontal_copper.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +vamos sc horizontal_copper.c old_hardware_setup.c link to bin/horizontal_copper diff --git a/horizontal_copper.c b/horizontal_copper.c new file mode 100644 index 0000000..921fc26 --- /dev/null +++ b/horizontal_copper.c @@ -0,0 +1,27 @@ +#include +#include +#include +#include +#include +#include + +#include "old_hardware_setup.h" + +extern struct GfxBase *GfxBase; +extern far struct Custom custom; + +int main(void) { + struct OldHardwareSetup oldHardwareSetup; + + oldHardware_takeOver(&oldHardwareSetup); + + custom.dmacon = DMAF_SETCLR | DMAF_COPPER | DMAF_RASTER; + custom.dmacon = DMAF_AUDIO | DMAF_DISK | DMAF_SPRITE | DMAF_BLITTER; + + // set up a two bitplane display + // create a copperlist + // how do you write fonts to a bitpane? + + + oldHardware_giveBack(&oldHardwareSetup); +} diff --git a/old_hardware_setup.c b/old_hardware_setup.c new file mode 100644 index 0000000..adf3be1 --- /dev/null +++ b/old_hardware_setup.c @@ -0,0 +1,46 @@ +#include "old_hardware_setup.h" + +void oldHardware_takeOver(struct OldHardwareSetup *oldHardwareSetup) { + oldHardwareSetup->OldView = ((struct GfxBase *)GfxBase)->ActiView; + oldHardwareSetup->OldCopper = (ULONG)((struct GfxBase *)GfxBase)->copinit; + + oldHardwareSetup->OldDMACON = custom.dmaconr | 0x8000; + oldHardwareSetup->OldINTENA = custom.intenar | 0x8000; + oldHardwareSetup->OldINTREQ = custom.intreqr | 0x8000; + oldHardwareSetup->OldADKCON = custom.adkconr | 0x8000; + + // disable interrupts + custom.intena = 0xc000; + custom.intena = 0x3fff; + + LoadView(NULL); + WaitTOF(); + WaitTOF(); + OwnBlitter(); + WaitBlit(); + + Forbid(); +} + +void oldHardware_giveBack(struct OldHardwareSetup *oldHardwareSetup) { + custom.cop1lc = oldHardwareSetup->OldCopper; + LoadView(oldHardwareSetup->OldView); + + custom.dmacon = 0x7FFF; + custom.dmacon = oldHardwareSetup->OldDMACON; + + custom.intena = 0x7FFF; + custom.intena = oldHardwareSetup->OldINTENA; + + custom.intreq = 0x7FFF; + custom.intreq = oldHardwareSetup->OldINTREQ; + + custom.adkcon = 0x7FFF; + custom.adkcon = oldHardwareSetup->OldADKCON; + + WaitTOF(); + WaitTOF(); + WaitBlit(); + DisownBlitter(); + Permit(); +} diff --git a/old_hardware_setup.h b/old_hardware_setup.h new file mode 100644 index 0000000..8cc6067 --- /dev/null +++ b/old_hardware_setup.h @@ -0,0 +1,25 @@ +#include +#include +#include +#include +#include + +#ifndef OLD_HARDWARE_SETUP_H +#define OLD_HARDWARE_SETUP_H + +extern struct GfxBase *GfxBase; +extern far struct Custom custom; + +struct OldHardwareSetup { + struct View *OldView; + ULONG OldCopper; + UWORD OldDMACON; + UWORD OldINTENA; + UWORD OldINTREQ; + UWORD OldADKCON; +}; + +void oldHardware_takeOver(struct OldHardwareSetup *oldHardwareSetup); +void oldHardware_giveBack(struct OldHardwareSetup *oldHardwareSetup); + +#endif /* OLD_HARDWARE_SETUP_H */