TITLE[uibDEFS];
*last edit by rej
January 14, 1980 1:24 PM Dolang vers 5
*last edit by rej
October 1, 1979 11:09 AM input decodes/ control register changes
*last edit by rej
August 24, 1979 9:22 AMboth alto and d0 modes
*alto/uib developmental
SET[uibTASKL, LSHIFT[uibTASK,4]]; *FOR DEVICE ADDRESSES


SET[uibClearAddr,0]; *OUTPUT DEVICE ADDRESSES
SET[uibDATABUFaddr,ADD[uibTASKL,1]];
SET[uibControlRegAddr,2];
SET[uibMESAregAddr,3];
SET[uibCursorPointerAddr,4];
SET[uibHTABaddr,5];
SET[uibBPREG,6];
SET[AuibCursMemAddr,7];
SET[uibCursMemAddr,ADD[uibTASKL,7]];
SET[uibOutChannelBuffAddr,ADD[uibTASKL,10]];

SET[uibDeviceIDregAddr, 0]; *INPUT DEVICE ADDRESSES
*new INPUT decodes
SET[uibInChannelBuffAddr,ADD[uibTASKL,1]];
SET[uibStatusReg1Addr, 2];
SET[uibUIBdataAddr, 3];

SET[uibFifoCommandsDispLoc, OR[LSHIFT[uibPage,10],100]];
SET[uibFifoDataTypesDispLoc, OR[LSHIFT[uibPage,10],120]];

MC[uibAllowWU,220];
*control register for init (old was 222)

MC[uiblhLinesPerField,400]; *617B this is 2 less than actual count (R<0 adds 2 more)
MC[uibrhLinesPerField,217];
MC[uibNonDisplayCount,36];
MC[uibFifoEntriesPerScanLine,2];

MC[uibTurnOffCursor,2000];
*cursor control
MC[uibLargePositiveNumber,10000];
MC[uibCursLinesPerFrame,22];
MC[AuibrhCursXYbase,26];
MC[AuibrhCursBase,31];
MC[uibCursXeven,100000];
MC[AuibLoadHiOrderNibble,0];
MC[uibCursBitmapFieldOffset,200];*uibmode - 128d nibbles/field

MC[AuibMemPage1,400];
*alto addresses
MC[AuibrhDCBheadAddr,20];
MC[AuibAltoInterruptOffset,21];
MC[AuibrhMouseXYBase,24];
MC[AuibrhTouchBase,360];
MC[AuiblhMouseButtonBase,177000];
MC[AuibrhMouseButtonBase,30];
MC[AuiblhKeyBoardBase,177000];
MC[AuibrhKeyBoardBase,34];

SET[uibDoIntPage, 0];

SET[uibDisplayCSB, uibTask];
SET[uibSCBcsb, 17];
SET[uibCSBpage, 377];
SET[uibCSBbank, 0];
MC[uiblhCSBbase,LSHIFT[uibCSBpage,10]];
*uib CSB base addresses
MC[uibrhCSBbase,LSHIFT[uibDisplayCSB,4]];
MC[uiblhCSBbase1,LSHIFT[uibCSBbank,10]];
MC[uibrhCSBbase1,ADD[uibCSBbank,1]];

SET[uibD0vsInterruptMaskOffset,0];
SET[uibCSBdisplayStatusOffset,1];
SET[uibLineInterruptMaskOffset,2];
SET[uibMouseXcoordOffset,4];
*uib display CSB constants
SET[uibTouchOffset,6];
SET[uibKeyWord0Offset,10];
SET[uibIOCBheadOffset,14];
SET[uibCursorIOCBptrOffset,15];
SET[uibBitmapBaseOffset,16];

SET[uibSCBcsbOffset, LSHIFT[SUB[uibSCBcsb,uibDisplayCSB], 4]];
MC[uibSCBcsbQuad0offset,ADD[uibSCBcsbOffset,0]];
*SCB CSB constants
MC[uibSCBcsbQuad1offset,ADD[uibSCBcsbOffset,4]];
MC[uibChannelIOCBbaseOffset,ADD[uibSCBcsbOffset,10]];
MC[uibSCBinterruptMaskOffset,ADD[uibSCBcsbOffset,12]];
MC[uibChannelTransferFlagsOffset,ADD[uibSCBcsbOffset,13]];
MC[uibSCBsavedQuadOffset,ADD[uibSCBcsbOffset,14]];

MC[uibInputChannelFlag,1];*flag indicates transfer type: INPUT(1), OUTPUT(0)
MC[uibExecuteChannelTransfer,100000];*flag causes transfer rather than FIFO read

MC[uibDisplayStatusKeyMask,
100000];*Display status masks (bits in lh byte)
MC[uibDisplayStatusTouchMask,
40000];*who changed
MC[uibDisplayStatusMouseXYMask,
20000];
MC[uibDisplayStatusButtonMask,
10000];

MC[uibBufferSize,377];
*buffer parameters
MC[uibBuffLessOneBlk,357];

SETTASK[uibTASK];
*REGISTER PARAMETERS
SET[uibRbase, AND[60, uibTASKL]];
*TEMPORARY REGISTERS

RV[uibTempReg1,ADD[uibRbase,0]];
RV[uibTempReg2,ADD[uibRbase,1]];
RV[uibTempReg3,ADD[uibRbase,2]];
RV[uibTempReg4,ADD[uibRbase,3]];

*REGISTERS AND CONSTANTS USED BY UIB TASK DURING DISPLAY PERIOD

********************************************
*ALTO MODE
********************************************
RV[uibHTAB,ADD[uibRbase,0]];
RV[uibDWA,ADD[uibRbase,1]];

RV[uibLINK,ADD[uibRbase,4]]; *DISPLAY CONTROL BLOCK WORD 0
RV[uibNWRDS,ADD[uibRbase,5]]; *DISPLAY CONTROL BLOCK WORD 1
RV[uibDBA,ADD[uibRbase,6]]; *DISPLAY CONTROL BLOCK WORD 2
RV[uibSLC,ADD[uibRbase,7]]; *DISPLAY CONTROL BLOCK WORD 3

RV[uibCursX,ADD[uibRbase,10]];
RV[uibCursY,ADD[uibRbase,11]];
RV[uibVideoLoadPtr,ADD[uibRbase,12]];
RV[uibVideoUnloadPtr,ADD[uibRbase,13]];
RV[uibVideoPtrs,ADD[uibRbase,13]];

RV[uibBASE,ADD[uibRbase,14]]; *BASE REGISTER PAIR
RV[uibBASE1,ADD[uibRbase,15]];
RV[uibScanLineCount,ADD[uibRbase,16]];
RV[uibStatusReg1,ADD[uibRbase,17]];

********************************************
*UIB MODE
********************************************
RV[uibHTAB,ADD[uibRbase,0]];
RV[uibVideoLoopControl,ADD[uibRbase,0]];
RV[uibWordsPerLine,ADD[uibRbase,1]];
RV[uibBitmapBase,ADD[uibRbase,2]];
RV[uibBitmapBase1,ADD[uibRbase,3]];

RV[uibIOCBlink,ADD[uibRbase,4]]; *IOCB WORD 0
RV[uibIOCBparms,ADD[uibRbase,5]]; *IOCB WORD 1
RV[uibVideoBitmapPtr,ADD[uibRbase,6]]; *IOCB WORD 2
RV[uibIOCBscanlines,ADD[uibRbase,7]]; *IOCB WORD 3

RV[uibCursX,ADD[uibRbase,10]];
RV[uibCursY,ADD[uibRbase,11]];
RV[uibVideoUnloadPtr,ADD[uibRbase,13]];
RV[uibVideoPtrs,ADD[uibRbase,13]];

RV[uibBASE,ADD[uibRbase,14]]; *BASE REGISTER PAIR
RV[uibBASE1,ADD[uibRbase,15]];
RV[uibScanLineCount,ADD[uibRbase,16]];
RV[uibStatusReg1,ADD[uibRbase,17]];


*REGISTERS USED BY UIB TASK DURING FIFO PERIOD
RV[uibFifoEntryCount,ADD[uibRbase,0]];
RV[uibChannelTransferFlags,ADD[uibRbase,1]];
RV[uibUIBdata,ADD[uibRbase,2]];
RV[uibControlReg,ADD[uibRbase,3]];
RV[uibTempReg4,ADD[uibRbase,3]];

RV[uibLINK,ADD[uibRbase,4]];
RV[uibALTOvsInterruptMask,ADD[uibRbase,5]];
RV[uibAltoModeSwitch,ADD[uibRbase,4]]; *LINK is also a switch; odd value means DO mode
RV[uibDisplayStatus,ADD[uibRbase,5]];
RV[uibCSBbase,ADD[uibRbase,6]];
RV[uibCSBbase1,ADD[uibRbase,7]];

RV[uibMouseDelXY,ADD[uibRbase,10]];

RV[uibMouseXcoord,ADD[uibRbase,10]];
RV[uibMouseYcoord,ADD[uibRbase,11]];

RV[uibMouseButtonWord,ADD[uibRbase,10]];

RV[uibTouchX,ADD[uibRbase,10]];
RV[uibTouchY,ADD[uibRbase,11]];

RV[uibQuadWord0,ADD[uibRbase,10]];
RV[uibQuadWord1,ADD[uibRbase,11]];
RV[uibQuadWord2,ADD[uibRbase,12]];
RV[uibQuadWord3,ADD[uibRbase,13]];

RV[uibD0vsInterruptMask,ADD[uibRbase,10]];
RV[uibCSBdisplayStatus,ADD[uibRbase,11]];
RV[uibLineInterruptMask,ADD[uibRbase,12]];
RV[uibInterruptLine,ADD[uibRbase,13]];

RV[uibSCBinterruptMask,ADD[uibRbase,10]];

RV[uibChannelIOCBbase,ADD[uibRbase,10]];

RV[uibChannelBuffBase,ADD[uibRbase,10]];
RV[uibChannelBuffBase1,ADD[uibRbase,11]];
RV[uibChannelBlockCnt,ADD[uibRbase,12]];
RV[uibChannelBuffPtr,ADD[uibRbase,13]];

RV[uibBASE,ADD[uibRbase,14]]; *BASE REGISTER PAIR
RV[uibBASE1,ADD[uibRbase,15]];
RV[uibScanLineCount,ADD[uibRbase,16]];
RV[uibStatusReg1,ADD[uibRbase,17]];

*REGISTERS USED DURING CURSOR LOADING

********************************************
*ALTO MODE
********************************************
RV[uibCursWord,ADD[uibRbase,0]];
RV[uibCursLineCount,ADD[uibRbase,1]];
RV[uibCursNibbleCount,ADD[uibRbase,3]];

RV[uibAltoModeSwitch,ADD[uibRbase,4]]; *this quad needs to live past cursor loading
RV[uibALTOvsInterruptMask,ADD[uibRbase,5]];
RV[uibCSBbase,ADD[uibRbase,6]];
RV[uibCSBbase1,ADD[uibRbase,7]];

RV[uibCursX,ADD[uibRbase,10]];
RV[uibCursY,ADD[uibRbase,11]];
RV[uibCursNibble,ADD[uibRbase,12]];
RV[uibCursBitmapPtr,ADD[uibRbase,13]];

RV[uibBASE,ADD[uibRbase,14]]; *BASE REGISTER PAIR
RV[uibBASE1,ADD[uibRbase,15]];
RV[uibScanLineCount,ADD[uibRbase,16]];
RV[uibStatusReg1,ADD[uibRbase,17]];
********************************************
*UIB MODE
********************************************
RV[uibCursLineCount,ADD[uibRbase,1]];
RV[uibBitmapBase,ADD[uibRbase,2]];
RV[uibBitmapBase1,ADD[uibRbase,3]];

RV[uibAltoModeSwitch,ADD[uibRbase,4]]; *this quad needs to live past cursor loading
RV[uibCSBbase,ADD[uibRbase,6]];
RV[uibCSBbase1,ADD[uibRbase,7]];

RV[uibCursorIOCBptr,ADD[uibRbase,10]];
RV[uibCursorIOCBptr1,ADD[uibRbase,11]];

RV[uibCursX,ADD[uibRbase,10]];
RV[uibCursY,ADD[uibRbase,11]];
RV[uibCursLoadControl,ADD[uibRbase,12]];
RV[uibCursBitmapPtr,ADD[uibRbase,13]];

RV[uibBASE,ADD[uibRbase,14]]; *BASE REGISTER PAIR
RV[uibBASE1,ADD[uibRbase,15]];
RV[uibScanLineCount,ADD[uibRbase,16]];
RV[uibStatusReg1,ADD[uibRbase,17]];
END;