diff options
Diffstat (limited to 'frontends/calculator/CEdev/examples/fileio_detect')
| -rw-r--r-- | frontends/calculator/CEdev/examples/fileio_detect/autotester.json | 33 | ||||
| -rw-r--r-- | frontends/calculator/CEdev/examples/fileio_detect/bin/DEMO.8xp | bin | 0 -> 557 bytes | |||
| -rw-r--r-- | frontends/calculator/CEdev/examples/fileio_detect/bin/DEMO.bin | bin | 0 -> 481 bytes | |||
| -rw-r--r-- | frontends/calculator/CEdev/examples/fileio_detect/bin/DEMO.map | 148 | ||||
| -rw-r--r-- | frontends/calculator/CEdev/examples/fileio_detect/makefile | 15 | ||||
| -rw-r--r-- | frontends/calculator/CEdev/examples/fileio_detect/obj/main.src | 182 | ||||
| -rw-r--r-- | frontends/calculator/CEdev/examples/fileio_detect/readme.md | 11 | ||||
| -rw-r--r-- | frontends/calculator/CEdev/examples/fileio_detect/screenshot.png | bin | 0 -> 1369 bytes | |||
| -rw-r--r-- | frontends/calculator/CEdev/examples/fileio_detect/src/main.c | 47 |
9 files changed, 436 insertions, 0 deletions
diff --git a/frontends/calculator/CEdev/examples/fileio_detect/autotester.json b/frontends/calculator/CEdev/examples/fileio_detect/autotester.json new file mode 100644 index 0000000..b8563a6 --- /dev/null +++ b/frontends/calculator/CEdev/examples/fileio_detect/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_detect/bin/DEMO.8xp b/frontends/calculator/CEdev/examples/fileio_detect/bin/DEMO.8xp Binary files differnew file mode 100644 index 0000000..d4fc967 --- /dev/null +++ b/frontends/calculator/CEdev/examples/fileio_detect/bin/DEMO.8xp diff --git a/frontends/calculator/CEdev/examples/fileio_detect/bin/DEMO.bin b/frontends/calculator/CEdev/examples/fileio_detect/bin/DEMO.bin Binary files differnew file mode 100644 index 0000000..a2a9ac4 --- /dev/null +++ b/frontends/calculator/CEdev/examples/fileio_detect/bin/DEMO.bin diff --git a/frontends/calculator/CEdev/examples/fileio_detect/bin/DEMO.map b/frontends/calculator/CEdev/examples/fileio_detect/bin/DEMO.map new file mode 100644 index 0000000..082420b --- /dev/null +++ b/frontends/calculator/CEdev/examples/fileio_detect/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 D1AA3B ECh +data D1AA3B D1AA5D 22h +strsect D1AA5D D1AA5D 0h +text D1AA5D D1AA60 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 = D1AA19 +_main = D1A99B +_ti_CloseAll = D1A8EE +_ti_Detect = D1A8F2 diff --git a/frontends/calculator/CEdev/examples/fileio_detect/makefile b/frontends/calculator/CEdev/examples/fileio_detect/makefile new file mode 100644 index 0000000..1f1b36b --- /dev/null +++ b/frontends/calculator/CEdev/examples/fileio_detect/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_detect/obj/main.src b/frontends/calculator/CEdev/examples/fileio_detect/obj/main.src new file mode 100644 index 0000000..aef9b8b --- /dev/null +++ b/frontends/calculator/CEdev/examples/fileio_detect/obj/main.src @@ -0,0 +1,182 @@ +; 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 <stdbool.h>
+; 2 #include <stddef.h>
+; 3 #include <stdint.h>
+; 4 #include <tice.h>
+; 5
+; 6 #include <stdio.h>
+; 7 #include <stdlib.h>
+; 8 #include <string.h>
+; 9
+; 10 #include <fileioc.h>
+; 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,-10
+ CALL __frameset
+; 17 /* Declare some variables -- search_pos must be NULL to begin with */
+; 18 uint8_t *search_pos = NULL;
+ LD BC,0
+ LD (IX+-10),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+-7
+; 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_4
+; 29
+; 30 /* Find all of the variables that start with this string */
+; 31 while ((var_name = ti_Detect(&search_pos, search_string)) != NULL) {
+L_5:
+; 32 /* Print the name of the variable (Should be LibLoad) */
+; 33 printText(0, y++, var_name);
+ LD C,(IX+-1)
+ INC (IX+-1)
+ LD DE,(IX+-4)
+ PUSH DE
+ LD B,0
+ PUSH BC
+ LD BC,0
+ PUSH BC
+ CALL _printText
+ POP BC
+ POP BC
+ POP BC
+; 34 }
+L_4:
+ PEA IX+-7
+ PEA IX+-10
+ CALL _ti_Detect
+ POP BC
+ POP BC
+ LD (IX+-4),HL
+ CALL __icmpzero
+ JR NZ,L_5
+; 35
+; 36 /* Wait for a key */
+; 37 while (!os_GetCSC());
+L_8:
+ CALL _os_GetCSC
+ OR A,A
+ JR Z,L_8
+; 38
+; 39 /* Close all open files */
+; 40 ti_CloseAll();
+ CALL _ti_CloseAll
+; 41 }
+ LD SP,IX
+ POP IX
+ RET
+
+
+;**************************** _main ***************************
+;Name Addr/Register Size Type
+;_ti_CloseAll IMPORT ----- function
+;_os_GetCSC IMPORT ----- function
+;_ti_Detect 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-10 3 variable
+;search_string IX-7 3 variable
+;var_name IX-4 3 variable
+;y IX-1 1 variable
+
+
+; Stack Frame Size: 16 (bytes)
+; Spill Code: 0 (instruction)
+
+
+ SEGMENT TEXT
+_0temp0:
+ DB 191
+ DB 254
+ DB 0
+ SEGMENT CODE
+; 42
+; 43 /* Draw text on the homescreen at the given X/Y location */
+; 44 void printText(int8_t xpos, int8_t ypos, const char *text) {
+_printText:
+ CALL __frameset0
+; 45 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
+; 46 os_PutStrFull(text);
+ LD BC,(IX+12)
+ PUSH BC
+ CALL _os_PutStrFull
+ POP BC
+; 47 }
+ 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_Detect: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_detect/readme.md b/frontends/calculator/CEdev/examples/fileio_detect/readme.md new file mode 100644 index 0000000..41ecb73 --- /dev/null +++ b/frontends/calculator/CEdev/examples/fileio_detect/readme.md @@ -0,0 +1,11 @@ +### FileIO File Detection Demo + +This demo shows how to use the ti_Detect function to search for a varible that starts with a particular sequence of bytes +LibLoad is used because it is known to exist for demonstration. + + + +--- + +This demo is a part of the C SDK Toolchain for use on the CE. + diff --git a/frontends/calculator/CEdev/examples/fileio_detect/screenshot.png b/frontends/calculator/CEdev/examples/fileio_detect/screenshot.png Binary files differnew file mode 100644 index 0000000..d5c9e73 --- /dev/null +++ b/frontends/calculator/CEdev/examples/fileio_detect/screenshot.png diff --git a/frontends/calculator/CEdev/examples/fileio_detect/src/main.c b/frontends/calculator/CEdev/examples/fileio_detect/src/main.c new file mode 100644 index 0000000..d3be5a5 --- /dev/null +++ b/frontends/calculator/CEdev/examples/fileio_detect/src/main.c @@ -0,0 +1,47 @@ +#include <stdbool.h> +#include <stddef.h> +#include <stdint.h> +#include <tice.h> + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include <fileioc.h> + +/* 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; + 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_Detect(&search_pos, search_string)) != NULL) { + /* 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); +} |