--This DEFINITIONS module provides a uniform interface for
--AltoIIXMs and DMachines to dereference long pointers and
--Long BitBLT tables. On AltoIIXMs, the RAM must be loaded appropriately:
--Microcode.BCD will load the RAM when STARTed: the procedure
--AltoMicrocodeDefs.LoadRam[] is a NOP, and only loads the ram on the first
--call. AltoHalftoneStuff.BCD contains an appropriate Alto microcode image.
--DMachine, InitMachineType, and SoftBITBLT are exported by
--Long.Mesa: be sure to START it before any calls to
--Read or Write routines, by calling LongDefs.InitMachineType[].
DIRECTORY
BitBltDefs: FROM "BitBltDefs",
Mopcodes: FROM "Mopcodes";
LongDefs: DEFINITIONS =
BEGIN
DMachine: BOOLEAN;
InitMachineType: PROCEDURE;
--long BITBLT compatability
BITBLT: PROCEDURE [ptr: POINTER TO BitBltDefs.BBTable] = INLINE
BEGIN
IF DMachine THEN HardBITBLT[ptr] ELSE SoftBITBLT[ptr];
END;
--long pointer compatability
Read: PROCEDURE [lp: LONG POINTER] RETURNS [UNSPECIFIED] = INLINE
BEGIN
RETURN[IF DMachine THEN DRead[lp] ELSE AltoRead[lp]];
END;
ReadBank: PROCEDURE[addr: POINTER TO UNSPECIFIED,bank: UNSPECIFIED] RETURNS[UNSPECIFIED] = INLINE
BEGIN
RETURN[IF DMachine THEN DReadBank[addr,bank] ELSE AltoReadBank[addr,bank]];
END;
ReadLongPointer: PROCEDURE [lp: LONG POINTER] RETURNS [LONG POINTER] =INLINE
BEGIN
RETURN[IF DMachine THEN DReadLongPointer[lp] ELSE AltoReadLongPointer[lp]];
END;
Write: PROCEDURE[val: UNSPECIFIED,addr: LONG POINTER] =INLINE
BEGIN
IF DMachine THEN DWrite[val,addr] ELSE AltoWrite[addr,val];
END;
WriteBank: PROCEDURE[val: UNSPECIFIED,addr: POINTER TO UNSPECIFIED,bank: UNSPECIFIED] = INLINE
BEGIN
IF DMachine THEN DWriteBank[val,addr,bank]
ELSE AltoWriteBank[addr,bank,val];
END;
WriteLongPointer: PROCEDURE [data,addr: LONG POINTER] =INLINE
BEGIN
IF DMachine THEN DWriteLongPointer[data,addr]
ELSE AltoWriteLongPointer[addr,data];
END;
--D0 implementations
DRead: PROCEDURE [LONG POINTER] RETURNS [UNSPECIFIED] =
MACHINE CODE BEGIN
Mopcodes.zRBL,0;
END;
DReadBank: PROCEDURE[addr: POINTER TO UNSPECIFIED,bank: UNSPECIFIED] RETURNS[UNSPECIFIED] =
MACHINE CODE BEGIN
Mopcodes.zRBL,0;
END;
DReadLongPointer: PROCEDURE [LONG POINTER] RETURNS [LONG POINTER] =
MACHINE CODE BEGIN
Mopcodes.zRDBL,0;
END;
DWrite: PROCEDURE[val: UNSPECIFIED,addr: LONG POINTER] =
MACHINE CODE BEGIN
Mopcodes.zWBL,0;
END;
DWriteBank: PROCEDURE[val: UNSPECIFIED,addr: POINTER TO UNSPECIFIED,bank: UNSPECIFIED] =
MACHINE CODE BEGIN
Mopcodes.zWBL,0;
END;
DWriteLongPointer: PROCEDURE [data,addr: LONG POINTER] =
MACHINE CODE BEGIN
Mopcodes.zWDBL,0;
END;
--Alto implementations
AltoRead: PROCEDURE [LONG POINTER] RETURNS [UNSPECIFIED] =
MACHINE CODE BEGIN
Mopcodes.zLIW,440B/256,440B MOD 256;Mopcodes.zJRAM;
END;
AltoReadBank: PROCEDURE[addr: POINTER TO UNSPECIFIED,bank: UNSPECIFIED] RETURNS[UNSPECIFIED] =
MACHINE CODE BEGIN
Mopcodes.zLIW,440B/256,440B MOD 256;Mopcodes.zJRAM;
END;
AltoReadLongPointer: PROCEDURE [LONG POINTER] RETURNS [LONG POINTER] =
MACHINE CODE BEGIN
Mopcodes.zLIW,445B/256,445B MOD 256;Mopcodes.zJRAM;
END;
AltoWrite: PROCEDURE[addr: LONG POINTER,val: UNSPECIFIED] =
MACHINE CODE BEGIN
Mopcodes.zLIW,441B/256,441B MOD 256;Mopcodes.zJRAM;
END;
AltoWriteBank: PROCEDURE[addr: POINTER TO UNSPECIFIED,bank: UNSPECIFIED,val: UNSPECIFIED] =
MACHINE CODE BEGIN
Mopcodes.zLIW,441B/256,441B MOD 256;Mopcodes.zJRAM;
END;
AltoWriteLongPointer: PROCEDURE [addr,data: LONG POINTER] =
MACHINE CODE BEGIN
Mopcodes.zLIW,446B/256,446B MOD 256;Mopcodes.zJRAM;
END;
--BitBLT implementations
SoftBITBLT: PROCEDURE [ptr: POINTER TO BitBltDefs.BBTable];
HardBITBLT: PROCEDURE [ptr: POINTER TO BitBltDefs.BBTable] =
MACHINE CODE BEGIN Mopcodes.zLI0; Mopcodes.zBITBLT END;
END.