;LinkMan v0.2 ; (C) 2007 by Brandon Wilson. All rights reserved. ;LinkMan is a TI-83/84 Plus Flash application which controls all aspects of linking and silent linking. ; ;You can: ; Log what and when link stuff happens (to RAM page of your choice on SEs and 84+, AppVar on original 83+) ; Receive unsigned OSes on both 83+ and 84+ series (with your own prgmUNLOCK which unlocks Flash, not included) ; Send unsigned OSes to 73, 83+, and 84+ series (even if the other calculator cannot run it) ; Receive variables from other model calculators (85, 86, 89, 92, 92+, Voyage 200) and store them in AppVars (compatible with X-Link) ; Send other-model variables back to the original calculator (85, 86, 89, 92, 92+, Voyage 200) (compatible with X-Link) ; View contents of other calculator on your own screen and request any variable ; Send any variable to connected 83+/84+ series calculator through silent linking ; Remote control of connected 83+/84+ series calculator ; Ignore all silent link communication ; Actively reject all silent link packets ; "Stealth" mode, which receives and accepts all variables and commands, but will NOT store or act on them (including Testguard2/Press-to-Test) ; Choose another program to run when receiving "remote program/application execution" packet ; Run a BASIC/assembly program when any communication is detected ; Remotely view any address and page of the other calculator's memory ; Remotely execute any code on the other calculator ; ;This supports both the serial I/O link and USB SilverLink cable (84+/84+SE only) through the usb8x driver. ;v0.1 Changelog ;Initial release ;To Do: ;Rework silent link hook: ; Make the rest of it work again (?!) ; Maybe log when something happens ; Maybe substitute program for remote control packet ; Maybe run program when something happens ; Receive and store variables from other calculators in form of AppVars ;Add ability to send X-Link appvars and finish send menus ;Add ability to send normal vars through silent linking, both serial and SilverLink ;Finish OS-sending code (get calculator type first, then send accordingly) ;Finish remote viewer and requester, both serial and SilverLink ;Finish remote hex viewer include "settings.inc" NOLIST include "ti83plus.inc" LIST include "equates.inc" include "header.asm" SEGMENT MAIN GLOBALS ON EXTERN DialogBox,VPutSApp,VPutSAppCenter,linkActivityHook,getCSCHook,PutSApp,ReceiveOS EXTERN Send85,Send86,Send89,Send92,Send92Plus,SendVoyage200,cursorHook,silentLinkHook EXTERN ConfigureLinkMan,SendOS,RemoteView,Send83Plus,ViewLog,SetupLog,EraseLog,RemoteControl EXTERN BHL_plus_DE,RemoteHexView,ExecCode Var menuTable,2 ;pointer to current menu Var prevMenu,2 ;pointer to previous menu routine Var curChoice,2 ;current menu choice Var maxChoice,2 ;maximum menu choice (31h-37h) Var tempByte,1 ;temporary byte for whatever Var currentOffset,2 ;current Flash offset Var currentPage,1 ;current Flash page Var Abackup,1 ;backup of A for BCALL replacement Var DEbackup,2 ;backup of DE for BCALL replacement Var HLbackup,2 ;backup of HL for BCALL replacement Var BCbackup,2 ;backup of BC for BCALL replacement Var machineID,1 ;machine ID used in link routines Var curVarType,1 ;current variable type from findCompatibleAppVar search Var varNameOffset,2 ;number of variables to ignore when reading directory request data (so, offset in master list) Var curVarOffset,2 ;pointer to next empty spot in varNameTable Var curAppOffset,2 ;pointer to next empty spot in appNameTable Var curScreenChoice,1 ;current choice visible on screen (1-6) Var curVarAdder,2 ; Var curVarEnd,2 ; Var topChoice,2 ;2 bytes just to be safe (I forgot why I made the others two) Var logPage,1 ;1 byte, log page for SE logging Var varNameBackup,10 ; Var hexAddr,2 ;hex viewer address Var hexPage,1 ;hex viewer Flash/RAM page StartApp: call loadAppVar ld hl,mainMenu ld (menuTable),hl ld hl,0 ld (prevMenu),hl ld a,3Ch ld (maxChoice),a DrawMenu: B_CALL ClrLCDFull ld de,0 ld (curRow),de ld hl,(menuTable) set textInverse,(iy+textFlags) call PutSApp res textInverse,(iy+textFlags) ld a,31h ld (topChoice),a ld (curChoice),a redrawMenu: ld hl,(menuTable) xor a ld bc,128 cpir ld de,1 ld (curRow),de ld a,(topChoice) ld b,a sub 31h ld d,a or a jr z,displayLoop push bc $$: xor a ld bc,128 cpir inc hl inc hl dec d jr nz,$B pop bc displayLoop: ld a,(curChoice) cp b jr nz,$F set textInverse,(iy+textFlags) $$: ld a,b cp 3Ah jr c,$F ld a,'0' jr z,$F ld a,b sub 3Bh add a,'A' $$: B_CALL PutC ld a,(topChoice) cp b ld a,':' jr nz,$F ld a,b cp 31h ld a,':' jr z,drawIndicator ld a,LupArrow jr drawIndicator $$: ld a,(curRow) cp 7 ld a,':' jr nz,drawIndicator ld a,(maxChoice) cp b ld a,':' jr z,drawIndicator ld a,LdownArrow jr drawIndicator drawIndicator: B_CALL PutC inc b res textInverse,(iy+textFlags) call PutSApp B_CALL EraseEOL ld a,(curRow) inc a cp 8 jr z,keyLoop ld e,a ld d,0 ld (curRow),de inc hl inc hl ld a,(hl) or a jr nz,displayLoop keyLoop: B_CALL GetKey cp kQuit jr z,ExitApp cp kClear jr z,previousMenu cp kUp jr z,menuUp cp kDown jr z,menuDown cp kEnter jr nz,$F ld a,(curChoice) sub 30h jr execChoice $$: cp k0 jp m,keyLoop cp kCapZ jp p,keyLoop cp kCapA jp m,$F sub kCapA add a,11 jr execChoice $$: sub k0 execChoice: ld hl,(menuTable) or a jr nz,$F ld a,10 $$: ld d,a xor a ld bc,0FFFh cpir ld c,d searchLoop: ld a,(hl) or a jr z,keyLoop push bc xor a ld bc,0FFFFh cpir pop bc ld e,(hl) inc hl ld d,(hl) inc hl dec c jr nz,searchLoop ex de,hl jp (hl) previousMenu: ld hl,(prevMenu) ld a,h or l jr z,ExitApp jp (hl) menuUp: ld a,(curChoice) cp 31h jr z,keyLoop ld b,a ld a,(topChoice) cp b ld a,b jr z,menuUpScroll dec a jr $F menuUpScroll: dec a ld (curChoice),a ld a,(topChoice) dec a ld (topChoice),a jr redrawMenu menuDown: ld a,(maxChoice) ld b,a ld a,(topChoice) add a,6 ld c,a ld a,(curChoice) cp b jr z,keyLoop cp c jr z,menuDownScroll inc a $$: ld (curChoice),a jr redrawMenu menuDownScroll: inc a ld (curChoice),a ld a,(topChoice) inc a ld (topChoice),a jr redrawMenu InstallHooks: res textWrite,(iy+sGrFlags) B_CALL GrBufClr in a,(6) ld hl,silentLinkHook B_CALL EnableSilentLinkHook ld l,13 ld h,15 ld e,79 ld d,47 call DialogBox ld hl,sHooksInstalled ld a,20 ld (penRow),a call VPutSAppCenter ld a,35 ld (penRow),a ld hl,sPressAnyKey call VPutSAppCenter B_CALL GetKey jr StartApp UninstallHooks: res textWrite,(iy+sGrFlags) B_CALL GrBufClr B_CALL DisableSilentLinkHook ld l,10 ld h,15 ld e,82 ld d,47 call DialogBox ld hl,sHooksUninstalled ld a,20 ld (penRow),a call VPutSAppCenter ld a,35 ld (penRow),a call VPutSAppCenter B_CALL GetKey jr StartApp SendVars: ld hl,StartApp ld (prevMenu),hl ld hl,selectCalc ld (menuTable),hl ld a,37h ld (maxChoice),a jr DrawMenu Logging: ld hl,StartApp ld (prevMenu),hl in a,(2) and 80h jr nz,$F ld hl,loggingMenu ld (menuTable),hl ld a,33h ld (maxChoice),a jr DrawMenu $$: ld hl,loggingMenuSE ld (menuTable),hl ld a,33h ld (maxChoice),a jr DrawMenu ExitApp: ld hl,sHomescreenProg rst 20h B_CALL ChkFindSym B_CALL DelVarArc ld hl,sHomescreenProg rst 20h ld hl,0 ld (cmdCursor),hl ld (cmdShadCur),hl B_CALL CreateProg B_CALL ClrLCDFull B_CALL HomeUp B_CALL FillBasePageTable B_CALL DelRes ld hl,cmdShadow ld de,cmdShadow+1 ld (hl),' ' ld bc,127 ldir ld hl,textShadow ld de,textShadow+1 ld (hl),' ' ld bc,127 ldir B_JUMP JForceCmdNoChar loadAppVar: ld hl,appData ld bc,128 B_CALL MemClear ld hl,sLinkManAppVar rst 20h B_CALL ChkFindSym call c,createLinkManAppVar ld hl,4 add hl,de ld a,b or a jr z,$F sbc hl,de ld de,17 add hl,de $$: ld de,appData ld bc,APPVAR_SIZE-2 B_CALL FlashToRam ret createLinkManAppVar: ld hl,APPVAR_SIZE B_CALL CreateAppVar ex de,hl inc hl inc hl ld (hl),72h inc hl ld (hl),85h inc hl ld bc,48 B_CALL MemClear ld hl,sLinkManAppVar rst 20h B_CALL ChkFindSym ret sHomescreenProg: DB 05h,21h,00h sHooksInstalled: DB "LinkMan Installed",0 sHooksUninstalled: DB "LinkMan Uninstalled",0 sPressAnyKey: DB "Press any key...",0 mainMenu: DB "Link Manager",0 DB "Install",0 DW InstallHooks DB "Uninstall",0 DW UninstallHooks DB "Configure",0CEh,0 DW ConfigureLinkMan DB "Send OS",0CEh,0 DW SendOS DB "Receive OS",0CEh,0 DW ReceiveOS DB "Var Explorer",0CEh,0 DW RemoteView DB "Send Vars",0CEh,0 DW SendVars DB "Hex Viewer",0CEh,0 DW RemoteHexView DB "Remote Cntrl",0 DW RemoteControl DB "Exec Code",0CEh,0 DW ExecCode DB "Logging",0CEh,0 DW Logging DB "Quit",0 DW ExitApp DB 0 selectCalc: DB "Select Device",0 DB "TI-83 Plus",0CEh,0 DW Send83Plus DB "TI-85",0CEh,0 DW Send85 DB "TI-86",0CEh,0 DW Send86 DB "TI-89",0CEh,0 DW Send89 DB "TI-92",0CEh,0 DW Send92 DB "TI-92 Plus",0CEh,0 DW Send92Plus DB "Voyage 200",0CEh,0 DW SendVoyage200 DB 0 loggingMenuSE: DB "Link Logging",0 DB "Setup Log",0CEh,0 DW SetupLog DB "Erase Log",0 DW EraseLog DB "View Log",0CEh,0 DW ViewLog DB 0 loggingMenu: DB "Link Logging",0 DB "Setup Log",0CEh,0 DW SetupLog DB "Delete Log",0 DW EraseLog DB "View Log",0CEh,0 DW ViewLog DB 0 sLinkManAppVar: DB AppVarObj,"LinkMan",0