84PCSE:OS:Include File

From WikiTI
Revision as of 01:27, 20 February 2013 by Dr. D'nar (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
.nolist
;===============================================================================
;====== Include Stuff ==========================================================
;===============================================================================

;Included for TASM Compatibility
;-------------------------------
#define equ .equ
#define EQU .equ
#define end .end
#define END .end

;Banked Call Equates/Macros
;-----------------------------------------------
rBR_CALL		equ 28h
BRT_JUMP0		equ 50h
#define bcall(xxxx) rst 28h \ .dw xxxx
#define b_call(xxxx) rst 28h \ .dw xxxx
#define bjump(xxxx) call 50h \ .dw xxxx

;Common Restart Routines
;------------------------------
rOP1TOOP2		equ 08h
rFINDSYM		equ 10h
rPUSHREALO1		equ 18h
rMOV9TOOP1		equ 20h
rFPADD			equ 30h

;Error Handler Equates/Macros
;-------------------------------------------
APP_PUSH_ERRORH		equ 59h
APP_POP_ERRORH		equ 5Ch
#define AppOnErr(xxxx) ld hl,xxxx \ call 59h
#define AppOffErr call 5Ch

; System routines
;-----------------------------------------------
_cphlde			equ	400Ch
_PutC			equ	44FBh
_keyscnlnk		equ	4A05h
_createVar		equ	4E55h ;A=type
_EnableCursorHook	equ	4F45h
_DisableCursorHook	equ	4F4Eh
_DelVarArc		equ	4FABh
_getKeyRetOff		equ	4FF0h
_runIndicOn		equ	4564h
_runIndicOff		equ	4567h
_PutS			equ	4501h
_getKey			equ	495Dh
_WriteToFlash		equ	50B0h
_dispHL			equ	44FEh
_CheckOSValidated	equ	8117h
_Disp32			equ	51AFh ;NOTE: Now you must pass number of digits to pad with in A (such as 7)

; Memory Equates
;-----------------------------------------------
appData			equ	8000h
ramCode			equ	8100h
tempSwapArea		equ	82B3h
OP1			equ	84AEh
flags			equ	8B26h
statVars		equ	8C1Ch
pagedCount		equ	9E15h
pagedGetPtr		equ	9E17h
pagedBuf		equ	9E1Bh
localLanguage		equ	9E54h
cursorHookBlockPtr	equ	9E5Dh
userMem			equ	0A60Bh

; EXTENDED TOKENS
;-----------------------------------------------
; These are new on OSes after 1.15 or whatever
tExtTok			equ	0EFh

; MathPrint
tZQuadrant		equ	17h
tZFracHalf		equ	18h
tZFracThird		equ	19h
tZFracFourth		equ	1Ah
tZFracFifth		equ	1Bh
tZFracEighth		equ	1Ch
tZFracTenth		equ	1Dh
tFracSlash		equ	2Eh
tFracMixedNum		equ	2Fh
tSwapImProper		equ	30h
tSwapFracDec		equ	31h
tRemainder		equ	32h
tSummationSigma		equ	33h
tLogBase		equ	34h
tRandIntNoRep		equ	35h
tMathPrint		equ	37h
tClassic		equ	38h
tAutoAnswer		equ	3Bh
tDecAnswer		equ	3Ch
tFracAnswer		equ	3Dh

; TI-84+CSE
tBlue			equ	41h
tRed			equ	42h
tBlack 			equ	43h
tMagenta		equ	44h
tGreen			equ	45h
tOrange			equ	46h
tBrown			equ	47h
tNavy			equ	48h
tLtBlue			equ	49h
tYellow			equ	4Ah
tWhite			equ	4Bh
tLtGray			equ	4Ch
tMedGray		equ	4Dh
tGray			equ	4Eh
tDarkGray		equ	4Fh

tGraphColor		equ	65h
tTextColor		equ	67h
tBackgroundOn		equ	5Bh
tBackgroundOff		equ	64h

tThin			equ	74h
;tThick - 0x7E 0x06 (was "Connected"?)
tAsm84CPrgm		equ	68h
tAsm84CCmp		equ	69h
tBorderColor		equ	6Ch

;------ Hardware Ports ---------------------------------------------------------
; p = Port
; LnkAst = Link Assist, Pg = Page
; Se = Silver Edition, Be = Basic Edition (anything NOT a TI-83+)
; Cfg = Configuration, Ctrl = Control, Buf = Buffer, Prot = Protection
; M = Memory, Int = Interrupt, Id = Identification, Crstl = Crystal
; Tmr = Timer, Div = Divided by, Rtc = Real Time Clock, Usb = USB
; Unk = Unknown, Exec = Execution
;
; R:n = RAM page n (always indexed from 0; no more saying RAM page 80h)
; F:nn = Flash page nn
; P:nn = Port nn
; LR:nn = LCD Register nn
pLink			equ	0
pKey			equ	1
pStatus			equ	2
pIntMask		equ	3
pIntId			equ	4
pMMapTmrFreq		equ	4
pMPageC			equ	5
pLnkAstBeRead		equ	5
pMPgA			equ	6
pMPgB			equ	7
pLnkAstSeEnable		equ	8
pLnkAstSeStatus		equ	9
pLnkAstSeInBuf		equ	0Ah
pLnkAstSeCfg		equ	0Ah
pLnkAstSeRcvTimeout	equ	0Bh
pLnkAstSeSndTimeout	equ	0Ch
pLnkAstSeOutBuf		equ	0Dh
pMPgAHigh		equ	0Eh
pMPgBHigh		equ	0Fh
pLcdCmd			equ	10h
pLcdData		equ	11h
pProtCtrl		equ	14h
pAsicId			equ	15h
pBeFlashExecCtrl	equ	16h
pCpuSpeed		equ	20h
pFlashTypeRamMask	equ	21h
pFlashType		equ	21h
pRamMask		equ	21h
pFlashExecLowerLimit	equ	22h
pFlashExecUpperLimit	equ	23h
pFlashExecExecOverride	equ	24h
pRamExecLowerLimit	equ	25h
pRamExecUpperLimit	equ	26h
pBlockMRemapC		equ	27h
pBlockMRemapB		equ	28h
pLcdDelay0		equ	29h
pLcdDelay1		equ	2Ah
pLcdDelay2		equ	2Bh
pLcdDelay3		equ	2Ch
pUnknown2D		equ	2Dh
pMemDelay		equ	2Eh
pLcdGenDelay		equ	2Fh
pCrstlTmr1Freq		equ	30h
pCrstlTmr1Cfg		equ	31h
pCrstlTmr1Count		equ	32h
pCrstlTmr2Freq		equ	33h
pCrstlTmr2Cfg		equ	34h
pCrstlTmr2Count		equ	35h
pCrstlTmr3Freq		equ	36h
pCrstlTmr3Cfg		equ	37h
pCrstlTmr3Count		equ	38h
pUsbUnkOldFlg		equ	39h
pUsbUnkOldFlg2		equ	3Ah
pRtcCtrl		equ	40h
pRtcSet0		equ	41h
pRtcSet1		equ	42h
pRtcSet2		equ	43h
pRtcSet3		equ	44h
pRtc0			equ	45h ; Reading
pRtc1			equ	46h
pRtc2			equ	47h
pRtc3			equ	48h

; Constants for bitfields
; St = Status, Batt = Batteries
; Rcv = Receive, Snd = Send, Err = Error
; Port 2 (pStatus)
stBattGood		equ	1
stLcdReady		equ	2
stFlashUnlocked		equ	4
stIsNot83pSe		equ	5
stIsSeModel		equ	7
; Port 3 (pIntMask)
intMaskOnKey		equ	1
intMaskTmr1		equ	2
intMaskTmr2		equ	4
intDisableLowPowerMode	equ	8
intMaskLinkport		equ	10h
intMaskNormal		equ	intMaskOnKey+intMaskTmr1+intDisableLowPowerMode
; Port 4 (pMMapTmrFreq)
intIdOnKey		equ	1
intIdTmr1		equ	2
intIdTmr2		equ	4
intIdOnKeyDown		equ	8
intIdLinkport		equ	16
intIdCrstlTmr1		equ	32
intIdCrstlTmr2		equ	64
intIdCrstlTmr3		equ	128
memMapMode0		equ	0
memMapMode1		equ	1
tmrFreq0		equ	0
tmrFreq1		equ	2
tmrFreq2		equ	4
tmrFreq3		equ	6
battVoltage0		equ	0
battVoltage1		equ	64
battVoltage2		equ	128
battVoltage3		equ	192
; Port 8 (pLnkAstSeEnable)
lnkSeIntRcv		equ	1
lnkSeIntSnd		equ	2
lnkSeIntErr		equ	4
lnkSeIntDisable		equ	128
lnkSeRcving		equ	8
lnkSeRcvd		equ	16
lnkSeSndReady		equ	32
lnkSndErr		equ	64
lnkSnding		equ	128
; Port 14h (pProtCtrl)
protLockFlash		equ	0
protUnlockFlash		equ	1
; Port 15h (pAsicId)
asic83pTA2		equ	33h
asic84pTA2		equ	44h
asic84pTA3		equ	45h
asic84pTA1		equ	55h
; Port 20h (pCpuSpeed)
cpu6MHz			equ	0
cpu15MHz		equ	1
cpu15MHz2		equ	2
cpu15MHz3		equ	3
; Port 21h (pFlashTypeRamMask)
flashTypeMask		equ	3
flashType1MB		equ	0
flashType2MB		equ	1
flashType4MB		equ	4
flashTyle8MB		equ	8
ramExecModeMask		equ	30h
ramExecMode0		equ	00h
ramExecMode1		equ	10h
ramExecMode2		equ	20h
ramExecMode3		equ	30h
; Port 24h (pFlashExecExecOverride)
flashAllowExecAll	equ	1
flashForbidExecAll	equ	2	; Except boot pages and overrides in bit 0 and port 22
; Ports 29h-2Ch (pLcdDelay0-3)
delayFlashEnable	equ	1
delayRamEnable		equ	2
delayCycleCountMask	equ	0FCh
delayCycleCountShift	equ	2
; Port 2E (pMemDelay)
delayFlashExec		equ	1
delayFlashRead		equ	2
delayFlashWrite		equ	4
delayRamExec		equ	10h
delayRamRead		equ	20h
delayRamWrite		equ	40h
; Port 2F (pLcdGenDelay)
cpu1LcdDelay48		equ	0
cpu1LcdDelay112		equ	1
cpu1LcdDelay176		equ	2
cpu1LcdDelay240		equ	3
cpu2LcdDelay48		equ	0
cpu2LcdDelay112		equ	4
cpu2LcdDelay176		equ	8
cpu2LcdDelay240		equ	12
cpu2LcdDelay304		equ	16
cpu2LcdDelay368		equ	20
cpu2LcdDelay432		equ	24
cpu2LcdDelay496		equ	28
cpu3LcdDelay48		equ	0
cpu3LcdDelay112		equ	32
cpu3LcdDelay176		equ	64
cpu3LcdDelay240		equ	96
cpu3LcdDelay304		equ	128
cpu3LcdDelay368		equ	160
cpu3LcdDelay432		equ	192
cpu3LcdDelay496		equ	224
; Crystal Timer Equates
tmrOff			equ	0
tmr11000Hz		equ	40h
tmr1000Hz		equ	41h
tmr100Hz		equ	42h
tmr10Hz			equ	43h
tmr32768Hz		equ	44h
tmr2048Hz		equ	45h
tmr128Hz		equ	46h
tmr8Hz			equ	47h
tmrCpu			equ	80h
tmrCpuDiv2		equ	81h
tmrCpuDiv4		equ	82h
tmrCpuDiv8		equ	84h
tmrCpuDiv16		equ	88h
tmrCpuDiv32		equ	90h
tmrCpuDiv64		equ	0A0h
tmrNullAck		equ	0
tmrLoop			equ	1
tmrInt			equ	2
tmrLoopAndInt		equ	3
; Port 40h (pRtcCtrl)
rtcEnable		equ	1
rtcSetCommand		equ	2

;------ Color LCD Control Registers --------------------------------------------
; Color LCD-Related Stuff
; lr = LCD Register, Disp = Display, Win = Window, Img = Image
; Col = Column, Cur = Cursor, Vert = vertical, Horiz = Horizontal
; Use these macros with the bitfield definitions below.
#define lcdHigh(x) x >> 8
#define lcdLow(x) x & 255

; Registers
lrSync			equ	0
lrDriverCode		equ	0
lrOutCtrl1		equ	1
lrDriveCtrl		equ	2
lrEntryMode		equ	3
lrRow			equ	20h
lrCol			equ	21h
lrGram			equ	22h
lrWinRowStart		equ	50h
lrWinRowEnd		equ	51h
lrWinColStart		equ	52h
lrWinColEnd		equ	53h
lrBaseImgDispCtrl	equ	61h
lrHorizScroll		equ	6Ah

; Register 1 (lrOutCtrl1) Bitfields
lcdReverseCol		equ	0100h
lcdReverseRow		equ	0400h
; Register 2 (lrDriveCtrl) Bitfields
lcdEOR			equ	0100h
lcdBDivC		equ	0200h
; Register 3 (lrDispCtrl1) Bitfields
lcdAM			equ	0008h	; If set, the cursor moves left/right after every write.
lcdCurMoveHoriz		equ	lcdAM	; Alias
lcdVertInc		equ	0010h	; If unset, the cursor is instead decremented
lcdHorizInc		equ	0020h	
lcdORG			equ	0080h	; If set, when window is changed, cursor is reset to corner
lcdBGR			equ	1000h
lcdTRI			equ	4000h	; If set, 18-bit color is accepted
lcdDFM			equ	8000h	; Unpacked mode: Write R, G, and B separately if TRI is set
; Register 61 (lrBaseImgDispCtrl) Bitfields
lcdREV			equ	0001h	; If set, reverse color mode
lcdVLE			equ	0002h	; If set, lrHorizScroll is enabled

.list