starting on horizontal copper stuff

This commit is contained in:
John Bintz 2023-12-14 20:21:54 -05:00
commit adc1e73777
5 changed files with 107 additions and 0 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
.vamosrc
*.o
*.uaem
*.lnk
*.info
bin/

3
build_horizontal_copper.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
vamos sc horizontal_copper.c old_hardware_setup.c link to bin/horizontal_copper

27
horizontal_copper.c Normal file
View File

@ -0,0 +1,27 @@
#include <clib/exec_protos.h>
#include <clib/intuition_protos.h>
#include <clib/graphics_protos.h>
#include <graphics/gfxbase.h>
#include <hardware/custom.h>
#include <hardware/dmabits.h>
#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);
}

46
old_hardware_setup.c Normal file
View File

@ -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();
}

25
old_hardware_setup.h Normal file
View File

@ -0,0 +1,25 @@
#include <clib/exec_protos.h>
#include <clib/intuition_protos.h>
#include <clib/graphics_protos.h>
#include <graphics/gfxbase.h>
#include <hardware/custom.h>
#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 */