More cleanups
This commit is contained in:
parent
f2f699d2c9
commit
623e51d164
|
@ -6,10 +6,13 @@ Built for [The Obligatory Amiga Blitter Video](https://makertube.net/w/eV545ku52
|
|||
|
||||
## Running
|
||||
|
||||
Click the mouse to escape any demo.
|
||||
|
||||
* `main`: Main demo
|
||||
* `32x50`, `33x50`, `left_side`, `right_side`: Rendering Cool Bun in various
|
||||
locations on screen.
|
||||
* `any_position`: Cool Bun flies around like a DVD player pause screen.
|
||||
* `keyboard_interrupt`: Tests using `input.device` to access the keyboard.
|
||||
|
||||
This will get 50 fps on an 020, and 25 or lower on an 68EC020 and below.
|
||||
|
||||
|
|
172
basics.s
172
basics.s
|
@ -1,172 +0,0 @@
|
|||
XREF _custom
|
||||
|
||||
; write this from scratch and get it working
|
||||
; then plug it into C
|
||||
FUNC_CNT SET -30
|
||||
FUNCDEF MACRO
|
||||
_LVO\1 EQU FUNC_CNT
|
||||
FUNC_CNT SET FUNC_CNT-6
|
||||
ENDM
|
||||
|
||||
INCDIR "include_i_39:"
|
||||
INCDIR "extra_lvos_39:"
|
||||
INCLUDE "exec/exec_lib.i"
|
||||
INCLUDE "exec/types.i"
|
||||
INCLUDE "exec/execbase.i"
|
||||
INCLUDE "exec/libraries.i" # get the CALLLIB macro
|
||||
INCLUDE "graphics/gfxbase.i"
|
||||
INCLUDE "graphics_lvo.i"
|
||||
INCLUDE "hardware/custom.i"
|
||||
INCLUDE "hardware/dmabits.i"
|
||||
|
||||
START:
|
||||
BSR _takeOverSystem
|
||||
BSR _giveBackSystem
|
||||
MOVE.L #0,D0
|
||||
RTS
|
||||
|
||||
OpenGraphicsLibrary MACRO
|
||||
LEA GraphicsLibrary,A1
|
||||
MOVEQ #0,D0
|
||||
CALLLIB _LVOOpenLibrary
|
||||
MOVE.L D0,GraphicsBase
|
||||
ENDM
|
||||
|
||||
TakeOverView MACRO
|
||||
MOVE.L GraphicsBase,A6
|
||||
MOVE.L gb_ActiView(A6),OldView
|
||||
MOVEQ #0,D0
|
||||
CALLLIB _LVOLoadView
|
||||
CALLLIB _LVOWaitTOF
|
||||
CALLLIB _LVOWaitTOF
|
||||
ENDM
|
||||
|
||||
PreserveOldCopper MACRO
|
||||
MOVE.L $26(A6),OldCopper1
|
||||
MOVE.L $32(A6),OldCopper2
|
||||
ENDM
|
||||
|
||||
GetVBRPointer MACRO
|
||||
BSR getVBR
|
||||
MOVE.L D0,VBRPtr
|
||||
ENDM
|
||||
|
||||
PreserveOldRegisters MACRO
|
||||
LEA _custom,A6
|
||||
MOVE.W adkconr(A6),Oldadkcon
|
||||
MOVE.W intenar(A6),Oldintena
|
||||
MOVE.W dmaconr(A6),Olddmacon
|
||||
ENDM
|
||||
|
||||
ClearRegisters MACRO
|
||||
MOVE.W #$7FFF,D0
|
||||
BSR waitRaster
|
||||
MOVE.W D0,intena(A6)
|
||||
MOVE.W D0,dmacon(A6)
|
||||
MOVE.W D0,intreq(A6)
|
||||
ENDM
|
||||
|
||||
SetRegisters MACRO
|
||||
MOVE.W #$C000,intena(A6) ; enable master interrupt
|
||||
MOVE.W #$3FFF,intena(A6) ; disable every other interrupt
|
||||
|
||||
MOVE.W #DMAF_SETCLR|DMAF_COPPER|DMAF_RASTER|DMAF_BLITTER,dmacon(A6)
|
||||
MOVE.W #DMAF_AUDIO|DMAF_DISK|DMAF_SPRITE,dmacon(A6)
|
||||
ENDM
|
||||
|
||||
_takeOverSystem:
|
||||
MOVEM.L A6,-(SP)
|
||||
CLR.W $100
|
||||
|
||||
MOVE.L $4,A6
|
||||
CALLLIB _LVOForbid
|
||||
|
||||
OpenGraphicsLibrary
|
||||
PreserveOldCopper
|
||||
|
||||
CALLLIB _LVOOwnBlitter
|
||||
CALLLIB _LVOWaitBlit
|
||||
|
||||
PreserveOldRegisters
|
||||
|
||||
SetRegisters
|
||||
TakeOverView
|
||||
MOVEM.L (SP)+,A6
|
||||
RTS
|
||||
|
||||
waitRaster:
|
||||
MOVE.L D0,-(SP)
|
||||
.loop:
|
||||
MOVE.L $DFF004,D0
|
||||
AND.L #$1FF00,D0
|
||||
CMP.L #303<<8,D0
|
||||
BNE .loop
|
||||
MOVE.L (SP)+,D0
|
||||
RTS
|
||||
|
||||
_giveBackSystem:
|
||||
CLR.W $100
|
||||
|
||||
MOVEM.L A6,-(SP)
|
||||
LEA _custom,A6
|
||||
|
||||
MOVE.W #$8000,d0
|
||||
OR.W D0,Olddmacon
|
||||
OR.W D0,Oldintena
|
||||
OR.W D0,Oldadkcon
|
||||
SUBQ #1,D0
|
||||
|
||||
;ClearRegisters
|
||||
|
||||
MOVE.L OldCopper1,cop1lc(A6)
|
||||
MOVE.L OldCopper2,cop2lc(A6)
|
||||
MOVE.W #1,copjmp1(A6)
|
||||
|
||||
MOVE.W Olddmacon,intena(A6)
|
||||
MOVE.W Olddmacon,dmacon(A6)
|
||||
MOVE.W Oldadkcon,adkcon(A6)
|
||||
|
||||
MOVE.L OldView,A1
|
||||
|
||||
MOVE.L GraphicsBase,A6
|
||||
CALLLIB _LVOLoadView
|
||||
CALLLIB _LVOWaitTOF
|
||||
CALLLIB _LVOWaitTOF
|
||||
|
||||
MOVE.L $4,A6
|
||||
MOVE.L GraphicsBase,D0
|
||||
MOVE.L D0,A1
|
||||
CALLLIB _LVOCloseLibrary
|
||||
|
||||
CALLLIB _LVOPermit
|
||||
MOVEM.L (SP)+,A6
|
||||
RTS
|
||||
|
||||
getVBR:
|
||||
MOVE.L A5,-(SP)
|
||||
MOVEQ #0,D0
|
||||
MOVE.L $4,A6
|
||||
BTST #0,AttnFlags+1(A6)
|
||||
BEQ .is68K
|
||||
LEA .get010VBR(pc),A5
|
||||
CALLLIB _LVOSupervisor
|
||||
.is68K:
|
||||
MOVE.L (SP)+,A5
|
||||
RTS
|
||||
|
||||
.get010VBR:
|
||||
dc.l $4E7A0801 ; movec vcr,d0
|
||||
RTE
|
||||
|
||||
CNOP 0,4
|
||||
GraphicsLibrary dc.b 'graphics.library',0
|
||||
|
||||
CNOP 0,4
|
||||
GraphicsBase dc.l 1
|
||||
OldView dc.l 1
|
||||
OldCopper1 dc.l 1
|
||||
OldCopper2 dc.l 1
|
||||
VBRPtr dc.l 1
|
||||
Oldadkcon dc.w 0
|
||||
Oldintena dc.w 0
|
||||
Olddmacon dc.w 0
|
BIN
better_startup
BIN
better_startup
Binary file not shown.
|
@ -1,98 +0,0 @@
|
|||
#include <clib/exec_protos.h>
|
||||
#include <clib/intuition_protos.h>
|
||||
#include <clib/graphics_protos.h>
|
||||
#include <exec/memory.h>
|
||||
#include <graphics/gfxbase.h>
|
||||
#include <hardware/custom.h>
|
||||
#include <hardware/dmabits.h>
|
||||
#include <exec/types.h>
|
||||
|
||||
extern struct GfxBase *GfxBase;
|
||||
extern far struct Custom custom;
|
||||
|
||||
int main(void) {
|
||||
UWORD OldDMACON,OldINTENA,OldINTREQ,OldADKCON;
|
||||
struct View *OldView = ((struct GfxBase *)GfxBase)->ActiView;
|
||||
ULONG OldCopper = custom.cop1lc;
|
||||
ULONG OldCopper2 = custom.cop2lc;
|
||||
UWORD *copperlist = AllocMem(10000, MEMF_CHIP | MEMF_CLEAR);
|
||||
UWORD *currentCopperlist;
|
||||
UBYTE *bitplanes = AllocMem(320 * 256, MEMF_CHIP | MEMF_CLEAR);
|
||||
int i;
|
||||
|
||||
LoadView(0);
|
||||
WaitTOF();
|
||||
WaitTOF();
|
||||
OwnBlitter();
|
||||
WaitBlit();
|
||||
|
||||
Forbid();
|
||||
|
||||
OldDMACON = custom.dmaconr | 0x8000;
|
||||
OldINTENA = custom.intenar | 0x8000;
|
||||
//OldINTREQ = custom.intreqr | 0x8000;
|
||||
OldADKCON = custom.adkconr | 0x8000;
|
||||
|
||||
custom.intreq = 0x7fff;
|
||||
custom.cmacon = 0x7fff;
|
||||
custom.cmacon = 0x7fff;
|
||||
|
||||
|
||||
// enable
|
||||
custom.dmacon = DMAF_SETCLR | DMAF_COPPER | DMAF_RASTER | DMAF_BLITTER;
|
||||
|
||||
// disable
|
||||
custom.dmacon = DMAF_AUDIO | DMAF_DISK | DMAF_SPRITE;
|
||||
|
||||
custom.bplcon0 = (1 << 9) + (1 << 12);
|
||||
custom.bplcon1 = 0;
|
||||
custom.bplcon2 = 0;
|
||||
custom.bpl1mod = 0;
|
||||
custom.bpl2mod = 0;
|
||||
custom.diwstrt = 0x2c21;
|
||||
custom.diwstop = 0x2cc1;
|
||||
custom.ddfstrt = 0x0038;
|
||||
custom.ddfstop = 0x00d0;
|
||||
|
||||
currentCopperlist = copperlist;
|
||||
|
||||
*(currentCopperlist++) = 0x0050;
|
||||
*(currentCopperlist++) = ((ULONG)bitplanes >> 16);
|
||||
*(currentCopperlist++) = 0x0020;
|
||||
*(currentCopperlist++) = ((ULONG)bitplanes && 16);
|
||||
*(currentCopperlist++) = 0xffff;
|
||||
*(currentCopperlist++) = 0xfffe;
|
||||
|
||||
custom.cop1lc = copperlist;
|
||||
|
||||
for (i = 0; i < 200; ++i) {
|
||||
WaitTOF();
|
||||
}
|
||||
|
||||
custom.dmacon = 0x7FFF;
|
||||
custom.dmacon = OldDMACON;
|
||||
|
||||
custom.intena = 0x7FFF;
|
||||
custom.intena = OldINTENA;
|
||||
|
||||
/*
|
||||
custom.intreq = 0x7FFF;
|
||||
custom.intreq = OldINTREQ;
|
||||
*/
|
||||
|
||||
custom.adkcon = 0x7FFF;
|
||||
custom.adkcon = OldADKCON;
|
||||
|
||||
custom.cop1lc = OldCopper;
|
||||
custom.cop2lc = OldCopper1;
|
||||
|
||||
LoadView(OldView);
|
||||
WaitTOF();
|
||||
WaitTOF();
|
||||
WaitBlit();
|
||||
DisownBlitter();
|
||||
Permit();
|
||||
|
||||
FreeMem(copperlist, 10000);
|
||||
FreeMem(bitplanes, 320 * 256);
|
||||
}
|
Loading…
Reference in New Issue