;Log viewer ;Mostly (completely :/) written by Dan Englender include "settings.inc" include "ti83plus.inc" include "equates.inc" SEGMENT Main GLOBALS ON EXTERN IPutS,DispHexA,IGetKey,INewLine,Start,ILdHLInd,USBErrorFeatureDisabled,DispHexHL,GetHexA,INewLine,Init DispLog: ld a,LOG_PAGE ld (logViewPage),a ld hl,LOG_ADDRESS ld (logViewAddress),hl res appAutoScroll,(iy+appFlags) call GetLogVal ld a,logSetupLog cp b jr nz,NoLogData DispLogLoop: call DispLogScreen $$: call IGetKey cp kClear jr z,DispLogDone cp kQuit jr z,DispLogDone cp kEnter jr z,LogEnter cp kUp jr z,LogUp cp kAdd jr z,LogWayDown cp kSub jr z,LogWayUp cp kDown jr nz,$b LogDown: call GetLogVal ld a,b cp logLogDone jr z,$b cp logQuit jr z,$b call IncLogAddr jr DispLogLoop LogUp: call GetLogVal ld a,b cp logSetupLog jr z,$b call DecLogAddr jr DispLogLoop LogWayDown: ld b,8 LogWayDownLoop: push bc call GetLogVal ld a,b pop bc cp logLogDone jr z,DispLogLoop cp logQuit jr z,DispLogLoop push bc call IncLogAddr pop bc djnz LogWayDownLoop jr DispLogLoop LogWayUp: ld b,8 LogWayUpLoop: push bc call GetLogVal ld a,b pop bc cp logSetupLog jr z,DispLogLoop push bc call DecLogAddr pop bc djnz LogWayUpLoop jr DispLogLoop LogEnter: call GetLogVal ld a,logDataStart cp b jr nz,$b B_CALL ClrLCDFull B_CALL HomeUp ld hl,(logViewAddress) push hl inc hl inc hl ld (logViewAddress),hl call GetLogVal ld e,b ld d,c dec de dec de dec de dec de ;Place to end loop inc hl inc hl ld (logViewAddress),hl LogEnterLoop: call GetLogVal ld a,b call DispHexA ld a,c call DispHexA inc hl inc hl ld (logViewAddress),hl B_CALL CpHLDE jr nz,LogEnterLoop call IGetKey pop hl ld (logViewAddress),hl jp DispLogLoop DispLogDone: set appAutoScroll,(iy+appFlags) jr Init DecLogAddr: ld hl,(logViewAddress) jr z,DecLogData dec hl dec hl dec hl dec hl ld (logViewAddress),hl call GetLogVal ld a,logDataEnd cp b ret nz DecLogData: IncLogData: inc hl inc hl ld (logViewAddress),hl call GetLogVal ld h,c ld l,b ld (logViewAddress),hl ret IncLogAddr: call GetLogVal ld a,logDataStart cp b ld hl,(logViewAddress) jr z,IncLogData inc hl inc hl inc hl inc hl ld (logViewAddress),hl ret DispLogScreen: B_CALL ClrLCDFull B_CALL HomeUp ld hl,(logViewAddress) push hl ld b,8 $$: push bc call GetLogVal ld a,NumLogVals cp b ld hl,lsLogError jr c,BadLogVal ld l,b ld h,0 add hl,hl ld de,LogStringTable add hl,de B_CALL ldhlind BadLogVal: call IPutS ld a,14 ld (curCol),a ld a,c call DispHexA ld a,b cp logLogDone jr z,$f cp logQuit jr z,$f call IncLogAddr pop bc djnz $b push bc $$: pop bc pop hl ld (logViewAddress),hl ret GetLogVal: ;Output ; B = Log Type ; C = Log data1 ; HL -> current LogAddr push de in a,(7) ld d,a ld hl,(logViewAddress) ld a,(logViewPage) di out (7),a ld b,(hl) inc hl ld c,(hl) ld a,d out (7),a ei dec hl pop de ret NoLogData: B_CALL ClrLCDFull B_CALL HomeUp ld hl,NoLogDataTXT call IPutS call IGetKey jr Init NoLogDataTXT: db "No Log Data",0 LogStringTable: DW lsLogError DW lsLogGetMaxPacketSize DW lsLogData DW lsLogQuit DW lsLogDataEnd DW lsLogSetupLog DW lsLogDataStart DW lsLogLogDone DW lsLogCustom DW lsLogInterrupt DW lsLogHubStatus NumLogVals EQU ($-LogStringTable)/2 lsLogGetMaxPacketSize: DB "GetMaxPack",0 lsLogData: DB "Data",0 lsLogQuit: DB "Quit",0 lsLogDataEnd: DB "DataEnd",0 lsLogSetupLog: DB "SetupLog",0 lsLogDataStart: DB "DataStart",0 lsLogLogDone: DB "LogDone",0 lsLogCustom: DB "Custom",0 lsLogInterrupt: DB "Interrupt",0 lsLogError: DB "LOG ERROR",0 lsLogHubStatus: DB "GetHubSatus",0 LogPageTXT: db "Log Page:",0 LogAddrTXT: db "Log Addr:",0