From 60699af63f92f43cc4b4b9e3050fcdd2a8468281 Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Wed, 10 Apr 2019 15:14:00 -0400 Subject: add opengl fronend, remove sdl frontend, refactor build system --- .../examples/fileio_detectany/autotester.json | 33 ++++ .../CEdev/examples/fileio_detectany/bin/DEMO.8xp | Bin 0 -> 568 bytes .../CEdev/examples/fileio_detectany/bin/DEMO.bin | Bin 0 -> 492 bytes .../CEdev/examples/fileio_detectany/bin/DEMO.map | 148 ++++++++++++++++ .../CEdev/examples/fileio_detectany/makefile | 15 ++ .../CEdev/examples/fileio_detectany/obj/main.src | 190 +++++++++++++++++++++ .../CEdev/examples/fileio_detectany/readme.md | 11 ++ .../CEdev/examples/fileio_detectany/screenshot.png | Bin 0 -> 1369 bytes .../CEdev/examples/fileio_detectany/src/main.c | 49 ++++++ 9 files changed, 446 insertions(+) create mode 100644 frontends/calculator/CEdev/examples/fileio_detectany/autotester.json create mode 100644 frontends/calculator/CEdev/examples/fileio_detectany/bin/DEMO.8xp create mode 100644 frontends/calculator/CEdev/examples/fileio_detectany/bin/DEMO.bin create mode 100644 frontends/calculator/CEdev/examples/fileio_detectany/bin/DEMO.map create mode 100644 frontends/calculator/CEdev/examples/fileio_detectany/makefile create mode 100644 frontends/calculator/CEdev/examples/fileio_detectany/obj/main.src create mode 100644 frontends/calculator/CEdev/examples/fileio_detectany/readme.md create mode 100644 frontends/calculator/CEdev/examples/fileio_detectany/screenshot.png create mode 100644 frontends/calculator/CEdev/examples/fileio_detectany/src/main.c (limited to 'frontends/calculator/CEdev/examples/fileio_detectany') diff --git a/frontends/calculator/CEdev/examples/fileio_detectany/autotester.json b/frontends/calculator/CEdev/examples/fileio_detectany/autotester.json new file mode 100644 index 0000000..b8563a6 --- /dev/null +++ b/frontends/calculator/CEdev/examples/fileio_detectany/autotester.json @@ -0,0 +1,33 @@ +{ + "rom": "84pce_515.rom", + "transfer_files": [ + "bin/DEMO.8xp" + ], + "target": { + "name": "DEMO", + "isASM": true + }, + "sequence": [ + "action|launch", + "delay|1000", + "hash|1", + "key|enter", + "delay|200", + "hashWait|2" + ], + "hashes": { + "1": { + "description": "'LibLoad' is displayed", + "start": "vram_start", + "size": "vram_16_size", + "expected_CRCs": [ "D874E0B0" ] + }, + "2": { + "description": "Back to the home screen (exit check)", + "start": "vram_start", + "size": "vram_16_size", + "expected_CRCs": [ "FFAF89BA", "101734A5", "9DA19F44" ] + } + } +} + diff --git a/frontends/calculator/CEdev/examples/fileio_detectany/bin/DEMO.8xp b/frontends/calculator/CEdev/examples/fileio_detectany/bin/DEMO.8xp new file mode 100644 index 0000000..9bd4645 Binary files /dev/null and b/frontends/calculator/CEdev/examples/fileio_detectany/bin/DEMO.8xp differ diff --git a/frontends/calculator/CEdev/examples/fileio_detectany/bin/DEMO.bin b/frontends/calculator/CEdev/examples/fileio_detectany/bin/DEMO.bin new file mode 100644 index 0000000..36a8f64 Binary files /dev/null and b/frontends/calculator/CEdev/examples/fileio_detectany/bin/DEMO.bin differ diff --git a/frontends/calculator/CEdev/examples/fileio_detectany/bin/DEMO.map b/frontends/calculator/CEdev/examples/fileio_detectany/bin/DEMO.map new file mode 100644 index 0000000..4b8f06a --- /dev/null +++ b/frontends/calculator/CEdev/examples/fileio_detectany/bin/DEMO.map @@ -0,0 +1,148 @@ +Segment Base Top High Length +-------- ------ ------ ------ ------- +icon D1A882 D1A882 0h +launcher D1A882 D1A8DA 58h +libs D1A8DA D1A8F6 1Ch +startup D1A8F6 D1A935 3Fh +cleanup D1A935 D1A949 14h +exit D1A949 D1A94F 6h +code D1A94F D1AA46 F7h +data D1AA46 D1AA68 22h +strsect D1AA68 D1AA68 0h +text D1AA68 D1AA6B 3h +bss D031F6 D031F6 D13FD6 0h +header D1A87F D1A882 3h + +Label Value +------------------------- ------ +_os_DisableHomeTextBuffer = D1A94F +_os_EnableHomeTextBuffer = D1A961 +_boot_GetBootMajorVer = 000080 +_boot_GetHardwareVer = 000084 +_boot_GetBootMinorVer = 00008C +_boot_DebugPrintf = 0000B4 +_boot_ClearVRAM = 000374 +_boot_TurnOff = 000388 +_boot_NewLine = 000390 +_boot_Set6MHzMode = 00039C +_boot_Set48MHzMode = 0003A0 +_boot_Set6MHzModeI = 0003A4 +_boot_Set48MHzModeI = 0003A8 +_boot_GetBatteryStatus = 0003B0 +_boot_WaitShort = 0003B4 +_boot_CheckOnPressed = 00057C +_boot_SetDate = 000598 +_boot_GetDate = 0005A8 +_boot_GetTime = 0005B0 +_boot_SetTime = 0005B4 +_boot_IsAfterNoon = 0005C8 +_os_NewLine = 0207F0 +_os_PushErrorHandler = 021C78 +_os_PopErrorHandler = 021C7C +_os_ThrowError = 021C80 +_os_RealCopy = 021C84 +_os_RealAsinRad = 021C88 +_os_RealAcosRad = 021C8C +_os_RealAtanRad = 021C90 +_os_RealAdd = 021C94 +_os_CplxSquare = 021C98 +_os_RealCompare = 021C9C +_os_RealCosRad = 021CA0 +_os_RealRadToDeg = 021CA4 +_os_RealDiv = 021CA8 +_os_RealExp = 021CAC +_os_RealFloor = 021CB0 +_os_RealToStr = 021CB4 +_os_RealFrac = 021CB8 +_os_RealGcd = 021CBC +_os_RealRoundInt = 021CC0 +_os_RealLcm = 021CC4 +_os_RealLog = 021CC8 +_os_RealMax = 021CCC +_os_RealMin = 021CD0 +_os_RealMul = 021CD4 +_os_RealNcr = 021CD8 +_os_RealNeg = 021CDC +_os_RealNpr = 021CE0 +_os_RealPow = 021CE4 +_os_RealDegToRad = 021CE8 +_os_RealRandInt = 021CEC +_os_RealInv = 021CF0 +_os_RealMod = 021CF4 +_os_RealRound = 021CF8 +_os_RealSinRad = 021CFC +_os_RealSqrt = 021D00 +_os_RealSub = 021D04 +_os_RealTanRad = 021D08 +_os_StrToReal = 021D0C +_os_RealInt = 021D10 +_os_SetFlagBits = 021D14 +_os_ResetFlagBits = 021D18 +_os_TestFlagBits = 021D1C +_os_SetFlagByte = 021D20 +_os_GetFlagByte = 021D24 +_os_GetCursorPos = 021D28 +_os_PutStrFull = 021D2C +_os_PutStrLine = 021D30 +_os_SetCursorPos = 021D34 +_os_AppInit = 021D40 +_os_GetKey = 021D38 +_os_GetCSC = 021D3C +_os_DisableCursor = 021DE4 +_os_EnableCursor = 021DE8 +_os_FontDrawText = 021E00 +_os_FontGetHeight = 021E14 +_os_FontGetWidth = 021E18 +_os_InitDrawing = 021E1C +_os_SetDrawBGColor = 021E20 +_os_SetDrawFGColor = 021E24 +_os_FontSelect = 021E28 +_os_RclAns = 021E70 +_os_SetTimer1 = 021EC8 +_os_DisableTimer1 = 021ECC +_os_GetSystemStats = 021ED4 +_os_GetDrawBGColor = 021EE4 +_os_GetDrawFGColor = 021EE8 +_os_FontGetID = 021EEC +_os_RealToInt24 = 021EF4 +_os_Int24ToReal = 021EF8 +_os_ForceCmdNoChar = 021FA8 +_os_GetSymTablePtr = 021FB0 +_os_NextSymEntry = 021FB4 +_os_ChkFindSym = 021FB8 +_os_MemChk = 021FF0 +_os_SetTimer2 = 022080 +_os_DisableTimer2 = 022084 +_os_FloatToReal = 022170 +_os_RealToFloat = 022174 +_os_FontDrawTransText = 022178 +_os_CreateAppVar = 022184 +_asm_MoveDown = 0207F4 +_asm_MoveUp = 020800 +_asm_ClrLCDFull = 020808 +_asm_ClrLCD = 02080C +_asm_ClrTxtShd = 020818 +_asm_HomeUp = 020828 +_asm_RunIndicOn = 020844 +_asm_RunIndicOff = 020848 +_asm_DelRes = 020E5C +_asm_DisableAPD = 021134 +_asm_EnableAPD = 021138 +_asm_DrawStatusBar = 021A3C +_asm_ArcChk = 022040 +__OS = D1A973 +__frameset0 = D1A97D +__icmpzero = D1A988 +__frameset = D1A98D +__findlibload = D1A882 +__ccleanup = D1A935 +_errno = D008DC +_init = D1A882 +_exit = D1A94B +__exit = D1A924 +__exitsp = D1A924 +__errsp = D1A924 +_printText = D1AA24 +_main = D1A99B +_ti_CloseAll = D1A8EE +_ti_DetectAny = D1A8F2 diff --git a/frontends/calculator/CEdev/examples/fileio_detectany/makefile b/frontends/calculator/CEdev/examples/fileio_detectany/makefile new file mode 100644 index 0000000..1f1b36b --- /dev/null +++ b/frontends/calculator/CEdev/examples/fileio_detectany/makefile @@ -0,0 +1,15 @@ +# ---------------------------- +# Set NAME to the program name +# Set ICON to the png icon file name +# Set DESCRIPTION to display within a compatible shell +# Set COMPRESSED to "YES" to create a compressed program +# ---------------------------- + +NAME ?= DEMO +COMPRESSED ?= NO +ICON ?= iconc.png +DESCRIPTION ?= "C SDK Demo" + +# ---------------------------- + +include $(CEDEV)/include/.makefile diff --git a/frontends/calculator/CEdev/examples/fileio_detectany/obj/main.src b/frontends/calculator/CEdev/examples/fileio_detectany/obj/main.src new file mode 100644 index 0000000..4e2f655 --- /dev/null +++ b/frontends/calculator/CEdev/examples/fileio_detectany/obj/main.src @@ -0,0 +1,190 @@ +; Zilog eZ80 ANSI C Compiler Release 3.4 +; -optsize -noreduceopt -nomodsect -peephole -globalopt +; -localcse -const=ROM + FILE "SRC\MAIN.C" + .assume ADL=1 + SEGMENT CODE +; 1 #include +; 2 #include +; 3 #include +; 4 #include +; 5 +; 6 #include +; 7 #include +; 8 #include +; 9 +; 10 #include +; 11 +; 12 /* Function prototypes */ +; 13 void printText(int8_t xpos, int8_t ypos, const char *text); +; 14 +; 15 /* Main Function */ +; 16 void main(void) { +_main: + LD HL,-11 + CALL __frameset +; 17 /* Declare some variables -- search_pos must be NULL to begin with */ +; 18 uint8_t *search_pos = NULL, type; + LD BC,0 + LD (IX+-11),BC +; 19 int8_t y = 0; + LD (IX+-1),0 +; 20 ti_var_t myVar; +; 21 char *var_name; +; 22 +; 23 /* First couple bytes of the LibLoad AppVar, which is known to exist * +; 24 /* Technically is a null-terminated string, if an odd looking one */ +; 25 const char search_string[] = { 0xBF, 0xFE, 0x00 }; + LEA DE,IX+-8 +; 26 +; 27 /* Clear the homescreen */ +; 28 os_ClrHome(); + LD BC,_asm_ClrLCD + PUSH BC + LD HL,_0temp0 + LD BC,3 + LDIR + CALL __OS + POP BC + LD BC,_asm_HomeUp + PUSH BC + CALL __OS + POP BC + LD BC,_asm_DrawStatusBar + PUSH BC + CALL __OS + POP BC + JR L_5 +; 29 +; 30 /* Find all of the variables that start with this string */ +; 31 while ((var_name = ti_DetectAny(&search_pos, search_string, &type)) != NULL) { +L_6: +; 32 if (type == TI_APPVAR_TYPE) { + LD A,(IX+-2) + CP A,21 + JR NZ,L_5 +; 33 /* Print the name of the variable (Should be LibLoad) */ +; 34 printText(0, y++, var_name); + LD C,(IX+-1) + INC (IX+-1) + LD DE,(IX+-5) + PUSH DE + LD B,0 + PUSH BC + LD BC,0 + PUSH BC + CALL _printText + POP BC + POP BC + POP BC +; 35 } +; 36 } +L_5: + PEA IX+-2 + PEA IX+-8 + PEA IX+-11 + CALL _ti_DetectAny + POP BC + POP BC + POP BC + LD (IX+-5),HL + CALL __icmpzero + JR NZ,L_6 +; 37 +; 38 /* Wait for a key */ +; 39 while (!os_GetCSC()); +L_9: + CALL _os_GetCSC + OR A,A + JR Z,L_9 +; 40 +; 41 /* Close all open files */ +; 42 ti_CloseAll(); + CALL _ti_CloseAll +; 43 } + LD SP,IX + POP IX + RET + + +;**************************** _main *************************** +;Name Addr/Register Size Type +;_ti_CloseAll IMPORT ----- function +;_os_GetCSC IMPORT ----- function +;_ti_DetectAny IMPORT ----- function +;_printText IMPORT ----- function +;_asm_DrawStatusBar IMPORT ----- function +;_asm_HomeUp IMPORT ----- function +;_asm_ClrLCD IMPORT ----- function +;__OS IMPORT ----- function +;_0temp0 STATIC 3 variable +;search_pos IX-11 3 variable +;search_string IX-8 3 variable +;var_name IX-5 3 variable +;type IX-2 1 variable +;y IX-1 1 variable + + +; Stack Frame Size: 17 (bytes) +; Spill Code: 0 (instruction) + + + SEGMENT TEXT +_0temp0: + DB 191 + DB 254 + DB 0 + SEGMENT CODE +; 44 +; 45 /* Draw text on the homescreen at the given X/Y location */ +; 46 void printText(int8_t xpos, int8_t ypos, const char *text) { +_printText: + CALL __frameset0 +; 47 os_SetCursorPos(ypos, xpos); + LD C,(IX+6) + LD B,0 + PUSH BC + LD C,(IX+9) + PUSH BC + CALL _os_SetCursorPos + POP BC + POP BC +; 48 os_PutStrFull(text); + LD BC,(IX+12) + PUSH BC + CALL _os_PutStrFull + POP BC +; 49 } + LD SP,IX + POP IX + RET + + +;**************************** _printText *************************** +;Name Addr/Register Size Type +;_os_PutStrFull IMPORT ----- function +;_os_SetCursorPos IMPORT ----- function +;text IX+12 3 parameter +;ypos IX+9 1 parameter +;xpos IX+6 1 parameter + + +; Stack Frame Size: 15 (bytes) +; Spill Code: 0 (instruction) + + + XREF _ti_DetectAny:ROM + XREF _ti_CloseAll:ROM + XREF _asm_DrawStatusBar:ROM + XREF _asm_ClrLCD:ROM + XREF _asm_HomeUp:ROM + XREF __OS:ROM + XREF _os_GetCSC:ROM + XREF _os_PutStrFull:ROM + XREF _os_SetCursorPos:ROM + XREF __frameset0:ROM + XREF __frameset:ROM + XREF __icmpzero:ROM + XDEF _printText + XDEF _main + END diff --git a/frontends/calculator/CEdev/examples/fileio_detectany/readme.md b/frontends/calculator/CEdev/examples/fileio_detectany/readme.md new file mode 100644 index 0000000..21a7e26 --- /dev/null +++ b/frontends/calculator/CEdev/examples/fileio_detectany/readme.md @@ -0,0 +1,11 @@ +### FileIO File Detection Demo + +This demo shows how to use the ti_DetectAny function to search for a variable that starts with a particular sequence of bytes +LibLoad is used because it is known to exist for demonstration. + +![Screenshot](screenshot.png) + +--- + +This demo is a part of the C SDK Toolchain for use on the CE. + diff --git a/frontends/calculator/CEdev/examples/fileio_detectany/screenshot.png b/frontends/calculator/CEdev/examples/fileio_detectany/screenshot.png new file mode 100644 index 0000000..d5c9e73 Binary files /dev/null and b/frontends/calculator/CEdev/examples/fileio_detectany/screenshot.png differ diff --git a/frontends/calculator/CEdev/examples/fileio_detectany/src/main.c b/frontends/calculator/CEdev/examples/fileio_detectany/src/main.c new file mode 100644 index 0000000..6809123 --- /dev/null +++ b/frontends/calculator/CEdev/examples/fileio_detectany/src/main.c @@ -0,0 +1,49 @@ +#include +#include +#include +#include + +#include +#include +#include + +#include + +/* Function prototypes */ +void printText(int8_t xpos, int8_t ypos, const char *text); + +/* Main Function */ +void main(void) { + /* Declare some variables -- search_pos must be NULL to begin with */ + uint8_t *search_pos = NULL, type; + int8_t y = 0; + ti_var_t myVar; + char *var_name; + + /* First couple bytes of the LibLoad AppVar, which is known to exist * + /* Technically is a null-terminated string, if an odd looking one */ + const char search_string[] = { 0xBF, 0xFE, 0x00 }; + + /* Clear the homescreen */ + os_ClrHome(); + + /* Find all of the variables that start with this string */ + while ((var_name = ti_DetectAny(&search_pos, search_string, &type)) != NULL) { + if (type == TI_APPVAR_TYPE) { + /* Print the name of the variable (Should be LibLoad) */ + printText(0, y++, var_name); + } + } + + /* Wait for a key */ + while (!os_GetCSC()); + + /* Close all open files */ + ti_CloseAll(); +} + +/* Draw text on the homescreen at the given X/Y location */ +void printText(int8_t xpos, int8_t ypos, const char *text) { + os_SetCursorPos(ypos, xpos); + os_PutStrFull(text); +} -- cgit v1.2.3-101-g0448