;Device Information code include "settings.inc" include "ti83plus.inc" include "equates.inc" include "usb8x.inc" SEGMENT Main GLOBALS ON EXTERN USBDriverCall,USBDriverBuf,USBError EXTERN NavNetInit,ProcessNavNetEvents,NavNetRequestDeviceInfo EXTERN Init,ExitApp,VPutSApp,VDispA,StartApp,NavNetKill GetDeviceInfo: B_CALL ClrLCDFull B_CALL GrBufClr ld hl,0 ld (penCol),hl res bufferOnly,(iy+plotFlag3) set plotLoc,(iy+plotFlags) res textWrite,(iy+sGrFlags) ;Initialize the NavNet driver ld hl,USBDriverCall ld de,appBackUpScreen+256 ld bc,USBDriverBuf call NavNetInit jr c,USBError ;Get the device name to OP4 ld a,2 ld hl,OP4 call NavNetRequestDeviceInfo jr c,USBError ld hl,OP4 call VPutSApp ;Request the device information to tempSwapArea ld a,1 ld hl,tempSwapArea call NavNetRequestDeviceInfo jr c,USBError ;Display the data ld hl,sNameSplit call VPutSApp ld hl,tempSwapArea+65 call VPutSApp call VNewLine call VNewLine ld hl,sFlash call VPutSApp ;Display free Flash ROM ld ix,tempSwapArea ld d,(ix+4) ld e,(ix+5) ld h,(ix+6) ld l,(ix+7) call DEHLToOP1 ld a,9 B_CALL DispOP1A ld a,'/' B_CALL VPutMap ;Display physical Flash ROM ld ix,tempSwapArea ld d,(ix+12) ld e,(ix+13) ld h,(ix+14) ld l,(ix+15) call DEHLToOP1 ld a,9 B_CALL DispOP1A call VNewLine ld hl,sRAM call VPutSApp ;Display free RAM ld ix,tempSwapArea ld d,(ix+20) ld e,(ix+21) ld h,(ix+22) ld l,(ix+23) call DEHLToOP1 ld a,9 B_CALL DispOP1A ld a,'/' B_CALL VPutMap ;Display physical RAM ld ix,tempSwapArea ld d,(ix+28) ld e,(ix+29) ld h,(ix+30) ld l,(ix+31) call DEHLToOP1 ld a,9 B_CALL DispOP1A call VNewLine call VNewLine ;Display battery status ld hl,sBatteryLevel call VPutSApp ld a,(tempSwapArea+32) cp 7Fh ld hl,sOK jr z,$F ld hl,sPowered or a jr z,$F ld hl,sLow dec a jr z,$F ld hl,sUnknown $$: call VPutSApp call VNewLine call VNewLine ;Display version numbers ld hl,sProductVersion call VPutSApp ld ix,tempSwapArea+36 call DisplayVersion call VNewLine ld hl,sBoot1Version call VPutSApp ld ix,tempSwapArea+40 call DisplayVersion call VNewLine ld hl,sBoot2Version call VPutSApp ld ix,tempSwapArea+44 call DisplayVersion call NavNetKill mainKeyLoop: B_CALL GetKey cp kQuit jr z,StartApp cp kClear jr z,StartApp cp kEnter jr z,StartApp jr mainKeyLoop DisplayVersion: ld a,(ix+0) call VDispA call DisplayPeriod ld a,(ix+1) call VDispA call DisplayPeriod ld h,(ix+2) ld l,(ix+3) B_CALL SetXXXXOP2 B_CALL OP2ToOP1 ld a,9 B_CALL DispOP1A ret DisplayPeriod: push ix ld a,'.' B_CALL VPutMap pop ix ret VNewLine: xor a ld (penCol),a ld a,(penRow) add a,6 ld (penRow),a ret DEHLToOP1: push hl push de ;Get 65536 in OP1 ld hl,65535 B_CALL SetXXXXOP2 B_CALL OP2ToOP1 B_CALL Plus1 pop hl ;Get the upper part in OP1 B_CALL SetXXXXOP2 B_CALL FPMult pop hl ;Get the lower part in OP2 B_CALL SetXXXXOP2 ;Add them together B_CALL FPAdd ret sNameSplit: DB " - ",0 sFlash:DB "FLASH: ",0 sRAM: DB "RAM: ",0 sBatteryLevel: DB "Battery Status: ",0 sOK: DB "OK",0 sPowered: DB "Powered",0 sLow: DB "Low",0 sUnknown: DB "Unknown",0 sProductVersion: DB "Product Version: ",0 sBoot1Version: DB "Boot1 Version: ",0 sBoot2Version: DB "Boot2 Version: ",0