Remove ASM glue in driver table ; replace asm funciton MyaAddDrive by C version

This commit is contained in:
Romain Dolbeau 2022-10-05 23:46:28 +02:00
parent 6943a54854
commit c3c96cf119
9 changed files with 43 additions and 106 deletions

View File

@ -3,56 +3,24 @@ NuBusFPGADrvr:
.word 0
.word 0
.word 0
/* Entry point offset table */
.word _NuBusFPGAOpen-NuBusFPGADrvr /* open routine */
/* Entry point offset table */
/* we can directly call the C version if it has the right calling convention */
.word cNuBusFPGAOpen-NuBusFPGADrvr /* open routine */
.word NuBusFPGADrvr-NuBusFPGADrvr /* no prime */
.word _NuBusFPGACtl-NuBusFPGADrvr /* control */
.word _NuBusFPGAStatus-NuBusFPGADrvr /* status */
.word _NuBusFPGAClose-NuBusFPGADrvr /* close */
.word cNuBusFPGACtl-NuBusFPGADrvr /* control */
.word cNuBusFPGAStatus-NuBusFPGADrvr /* status */
.word cNuBusFPGAClose-NuBusFPGADrvr /* close */
_NuBusFPGATitle:
.byte _NuBusFPGATitle_StringEnd-.-1 /* pascal string length */
.ascii ".NuBusFPGA_Drvr"
_NuBusFPGATitle_StringEnd:
.word 0 /* version number */
/* A0 pointer to driver parameter block */
/* for entry points: */
/* A0 pointer to driver parameter block */
/* A1 pointer to driver device control entry */
ALIGN 2
_NuBusFPGAOpen:
MOVE.L %A1, -(%A7)
MOVE.L %A0, -(%A7)
JSR cNuBusFPGAOpen
MOVE.L (%A7)+, %a0
MOVE.L (%A7)+, %a1
rts
_NuBusFPGAOpenError:
moveq #-23,%d0 /* error flag */
rts
_NuBusFPGACtl:
MOVE.L %A1, -(%A7)
MOVE.L %A0, -(%A7)
jsr cNuBusFPGACtl
MOVE.L (%A7)+, %a0
MOVE.L (%A7)+, %a1
rts
_NuBusFPGAStatus:
MOVE.L %A1, -(%A7)
MOVE.L %A0, -(%A7)
jsr cNuBusFPGAStatus
MOVE.L (%A7)+, %a0
MOVE.L (%A7)+, %a1
rts
_NuBusFPGAClose:
MOVE.L %A1, -(%A7)
MOVE.L %A0, -(%A7)
jsr cNuBusFPGAClose
MOVE.L (%A7)+, %a0
MOVE.L (%A7)+, %a1
rts
.include "NuBusFPGADrvr_OpenClose.s"
.text

View File

@ -72,7 +72,7 @@ OSErr changeIRQ(AuxDCEPtr dce, char en, OSErr err) {
1 <EFBFBD>Debug: 0x00000002
*/
#pragma parameter __D0 cNuBusFPGACtl(__A0, __A1)
OSErr cNuBusFPGACtl(CntrlParamPtr pb, /* DCtlPtr */ AuxDCEPtr dce)
{
NuBusFPGADriverGlobalsHdl dStoreHdl = (NuBusFPGADriverGlobalsHdl)dce->dCtlStorage;

View File

@ -12,10 +12,12 @@ short fbIrq(const long sqParameter){
vblproto myVbl = *(vblproto**)0x0d28;
/* write_reg(dce, GOBOFB_INTR_CLEAR, 0); */
*((volatile unsigned int*)(sqParameter+GOBOFB_BASE+GOBOFB_INTR_CLEAR)) = 0;
myVbl((sqParameter>>24)&0xf);
myVbl((sqParameter>>24)&0xf); // cleaner to use dStore->slot ? but require more code...
return 1;
}
#pragma parameter __D0 cNuBusFPGAOpen(__A0, __A1)
OSErr cNuBusFPGAOpen(IOParamPtr pb, /* DCtlPtr */ AuxDCEPtr dce)
{
OSErr ret = noErr;
@ -169,6 +171,7 @@ OSErr cNuBusFPGAOpen(IOParamPtr pb, /* DCtlPtr */ AuxDCEPtr dce)
return noErr;
}
#pragma parameter __D0 cNuBusFPGAClose(__A0, __A1)
OSErr cNuBusFPGAClose(IOParamPtr pb, /* DCtlPtr */ AuxDCEPtr dce)
{
OSErr ret = noErr;

View File

@ -32,7 +32,7 @@
1 <EFBFBD>Debug: 0x0000000c
*/
#pragma parameter __D0 cNuBusFPGAStatus(__A0, __A1)
OSErr cNuBusFPGAStatus(CntrlParamPtr pb, /* DCtlPtr */ AuxDCEPtr dce)
{
NuBusFPGADriverGlobalsHdl dStoreHdl = (NuBusFPGADriverGlobalsHdl)dce->dCtlStorage;

View File

@ -4,11 +4,12 @@ NuBusFPGARAMDskDrvr:
.word 0
.word 0
/* Entry point offset table */
.word _NuBusFPGARAMDskOpen - NuBusFPGARAMDskDrvr /* open routine */
.word _NuBusFPGARAMDskPrime - NuBusFPGARAMDskDrvr /* prime */
.word _NuBusFPGARAMDskCtl - NuBusFPGARAMDskDrvr /* control */
.word _NuBusFPGARAMDskStatus- NuBusFPGARAMDskDrvr /* status */
.word _NuBusFPGARAMDskClose - NuBusFPGARAMDskDrvr /* close */
/* we can directly call the C version if it has the right calling convention */
.word cNuBusFPGARAMDskOpen - NuBusFPGARAMDskDrvr /* open routine */
.word cNuBusFPGARAMDskPrime - NuBusFPGARAMDskDrvr /* prime */
.word cNuBusFPGARAMDskCtl - NuBusFPGARAMDskDrvr /* control */
.word cNuBusFPGARAMDskStatus- NuBusFPGARAMDskDrvr /* status */
.word cNuBusFPGARAMDskClose - NuBusFPGARAMDskDrvr /* close */
_NuBusFPGARAMDskTitle:
.byte _NuBusFPGARAMDskTitle_StringEnd-.-1 /* pascal string length */
@ -16,62 +17,10 @@ _NuBusFPGARAMDskTitle:
_NuBusFPGARAMDskTitle_StringEnd:
.word 0 /* version number */
/* A0 pointer to driver parameter block */
/* for entry points: */
/* A0 pointer to driver parameter block */
/* A1 pointer to driver device control entry */
ALIGN 2
_NuBusFPGARAMDskOpen:
MOVE.L %A1, -(%A7)
MOVE.L %A0, -(%A7)
JSR cNuBusFPGARAMDskOpen
MOVE.L (%A7)+, %a0
MOVE.L (%A7)+, %a1
rts
_NuBusFPGARAMDskOpenError:
moveq #-23,%d0 /* error flag */
rts
_NuBusFPGARAMDskPrime:
MOVE.L %A1, -(%A7)
MOVE.L %A0, -(%A7)
jsr cNuBusFPGARAMDskPrime
MOVE.L (%A7)+, %a0
MOVE.L (%A7)+, %a1
rts
_NuBusFPGARAMDskCtl:
MOVE.L %A1, -(%A7)
MOVE.L %A0, -(%A7)
jsr cNuBusFPGARAMDskCtl
MOVE.L (%A7)+, %a0
MOVE.L (%A7)+, %a1
rts
_NuBusFPGARAMDskStatus:
MOVE.L %A1, -(%A7)
MOVE.L %A0, -(%A7)
jsr cNuBusFPGARAMDskStatus
MOVE.L (%A7)+, %a0
MOVE.L (%A7)+, %a1
rts
_NuBusFPGARAMDskClose:
MOVE.L %A1, -(%A7)
MOVE.L %A0, -(%A7)
jsr cNuBusFPGARAMDskClose
MOVE.L (%A7)+, %a0
MOVE.L (%A7)+, %a1
rts
MyAddDrive:
LINK %A6,#0
CLR.L %D0
MOVE.W 10(%A6),%D0
SWAP %D0
MOVE.W 8(%A6),%D0
MOVEA.L 12(%A6),%A0
DC.W 0xA04E /* _AddDrive */
UNLK %A6
RTS
.include "NuBusFPGARAMDskDrvr_OpenClose.s"
.text

View File

@ -1,5 +1,6 @@
#include "NuBusFPGARAMDskDrvr.h"
#pragma parameter __D0 cNuBusFPGARAMDskCtl(__A0, __A1)
OSErr cNuBusFPGARAMDskCtl(CntrlParamPtr pb, /* DCtlPtr */ AuxDCEPtr dce)
{
OSErr ret = noErr;

View File

@ -1,10 +1,22 @@
#include "NuBusFPGARAMDskDrvr.h"
/* duplicated */
void MyAddDrive(short drvrRefNum, short drvNum, DrvQElPtr qEl);
#include <Disks.h>
/* FYI, missing in library with Retro68 */
/* void AddDrive(short drvrRefNum, short drvNum, DrvQElPtr qEl); */
/* re-implement with Retro68 features */
/* drVNum to high-order bits of num, drvrRefNum in low-order */
/* not sure how to do "parameter" without output ? */
#pragma parameter __D0 AddDrive(__D0, __A0)
static inline int dupAddDrive(unsigned long num, DrvQElPtr qEl) {
asm volatile(".word 0xA04E" : : "d" (num), "a" (qEl));
return num; // should cost nothing, num is already in D0
}
#include <ROMDefs.h>
#pragma parameter __D0 cNuBusFPGARAMDskOpen(__A0, __A1)
OSErr cNuBusFPGARAMDskOpen(IOParamPtr pb, /* DCtlPtr */ AuxDCEPtr dce)
{
DrvSts2 *dsptr; // pointer to the DrvSts2 in our context
@ -94,7 +106,8 @@ OSErr cNuBusFPGARAMDskOpen(IOParamPtr pb, /* DCtlPtr */ AuxDCEPtr dce)
}
// add the drive
MyAddDrive(dsptr->dQRefNum, drvnum, (DrvQElPtr)&dsptr->qLink);
//MyAddDrive(dsptr->dQRefNum, drvnum, (DrvQElPtr)&dsptr->qLink);
dupAddDrive((dsptr->dQRefNum & 0xFFFF) | (drvnum << 16), (DrvQElPtr)&dsptr->qLink);
#ifdef ENABLE_DMA
ctx->dma_blk_size = revb( read_reg(dce, DMA_BLK_SIZE) );
@ -128,6 +141,7 @@ OSErr cNuBusFPGARAMDskOpen(IOParamPtr pb, /* DCtlPtr */ AuxDCEPtr dce)
return ret;
}
#pragma parameter __D0 cNuBusFPGARAMDskClose(__A0, __A1)
OSErr cNuBusFPGARAMDskClose(IOParamPtr pb, /* DCtlPtr */ AuxDCEPtr dce)
{
OSErr ret = noErr;

View File

@ -10,6 +10,7 @@ static inline void waitSome(unsigned long bound) {
}
/* Devices 1-34 (p54) */
#pragma parameter __D0 cNuBusFPGARAMDskPrime(__A0, __A1)
OSErr cNuBusFPGARAMDskPrime(IOParamPtr pb, /* DCtlPtr */ AuxDCEPtr dce)
{
OSErr ret = noErr;

View File

@ -1,5 +1,6 @@
#include "NuBusFPGARAMDskDrvr.h"
#pragma parameter __D0 cNuBusFPGARAMDskStatus(__A0, __A1)
OSErr cNuBusFPGARAMDskStatus(CntrlParamPtr pb, /* DCtlPtr */ AuxDCEPtr dce)
{
OSErr ret = noErr;