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 --- .../CEdev/examples/debugging/bin/DEMO.8xp | Bin 0 -> 584 bytes .../CEdev/examples/debugging/bin/DEMO.bin | Bin 0 -> 508 bytes .../CEdev/examples/debugging/bin/DEMO.dbg | Bin 0 -> 971 bytes .../CEdev/examples/debugging/bin/DEMO.map | 35 ++ .../calculator/CEdev/examples/debugging/makefile | 18 + .../CEdev/examples/debugging/obj/main.src | 484 +++++++++++++++++++++ .../calculator/CEdev/examples/debugging/readme.md | 10 + .../CEdev/examples/debugging/screenshot.png | Bin 0 -> 139570 bytes .../calculator/CEdev/examples/debugging/src/main.c | 47 ++ 9 files changed, 594 insertions(+) create mode 100644 frontends/calculator/CEdev/examples/debugging/bin/DEMO.8xp create mode 100644 frontends/calculator/CEdev/examples/debugging/bin/DEMO.bin create mode 100644 frontends/calculator/CEdev/examples/debugging/bin/DEMO.dbg create mode 100644 frontends/calculator/CEdev/examples/debugging/bin/DEMO.map create mode 100644 frontends/calculator/CEdev/examples/debugging/makefile create mode 100644 frontends/calculator/CEdev/examples/debugging/obj/main.src create mode 100644 frontends/calculator/CEdev/examples/debugging/readme.md create mode 100644 frontends/calculator/CEdev/examples/debugging/screenshot.png create mode 100644 frontends/calculator/CEdev/examples/debugging/src/main.c (limited to 'frontends/calculator/CEdev/examples/debugging') diff --git a/frontends/calculator/CEdev/examples/debugging/bin/DEMO.8xp b/frontends/calculator/CEdev/examples/debugging/bin/DEMO.8xp new file mode 100644 index 0000000..477a3d0 Binary files /dev/null and b/frontends/calculator/CEdev/examples/debugging/bin/DEMO.8xp differ diff --git a/frontends/calculator/CEdev/examples/debugging/bin/DEMO.bin b/frontends/calculator/CEdev/examples/debugging/bin/DEMO.bin new file mode 100644 index 0000000..10c5c3c Binary files /dev/null and b/frontends/calculator/CEdev/examples/debugging/bin/DEMO.bin differ diff --git a/frontends/calculator/CEdev/examples/debugging/bin/DEMO.dbg b/frontends/calculator/CEdev/examples/debugging/bin/DEMO.dbg new file mode 100644 index 0000000..8430b95 Binary files /dev/null and b/frontends/calculator/CEdev/examples/debugging/bin/DEMO.dbg differ diff --git a/frontends/calculator/CEdev/examples/debugging/bin/DEMO.map b/frontends/calculator/CEdev/examples/debugging/bin/DEMO.map new file mode 100644 index 0000000..4462134 --- /dev/null +++ b/frontends/calculator/CEdev/examples/debugging/bin/DEMO.map @@ -0,0 +1,35 @@ +Segment Base Top High Length +-------- ------ ------ ------ ------- +icon D1A882 D1A882 0h +launcher D1A882 D1A882 0h +libs D1A882 D1A882 0h +startup D1A882 D1A8C1 3Fh +cleanup D1A8C1 D1A8D5 14h +exit D1A8D5 D1A8DB 6h +code D1A8DB D1A9D6 FBh +data D1A9D6 D1A9D6 0h +strsect D1A9D6 D1AA7B A5h +text D1AA7B D1AA7B 0h +bss D031F6 D031F6 D13FD6 0h +header D1A87F D1A882 3h + +Label Value +------------------------- ------ +_os_DisableHomeTextBuffer = D1A8DB +_os_EnableHomeTextBuffer = D1A8ED +_dbg_Debugger = D1A8FF +_dbg_RemoveAllBreakpoints = D1A905 +_dbg_RemoveWatchpoint = D1A90B +_dbg_SetWatchpoint = D1A915 +_dbg_RemoveAllWatchpoints = D1A921 +_dbg_SetWriteWatchpoint = D1A927 +_abort = D1A933 +_sprintf = 0000BC +__ccleanup = D1A8C1 +_errno = D008DC +_init = D1A882 +_exit = D1A8D7 +__exit = D1A8B0 +__exitsp = D1A8B0 +__errsp = D1A8B0 +_main = D1A93C diff --git a/frontends/calculator/CEdev/examples/debugging/makefile b/frontends/calculator/CEdev/examples/debugging/makefile new file mode 100644 index 0000000..3ea542a --- /dev/null +++ b/frontends/calculator/CEdev/examples/debugging/makefile @@ -0,0 +1,18 @@ +# ---------------------------- +# 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" + +# ---------------------------- + +# This is just so the main makefile in $CEDEV/examples makes this one be like "make debug" +.DEFAULT_GOAL := debug + +include $(CEDEV)/include/.makefile diff --git a/frontends/calculator/CEdev/examples/debugging/obj/main.src b/frontends/calculator/CEdev/examples/debugging/obj/main.src new file mode 100644 index 0000000..4a90981 --- /dev/null +++ b/frontends/calculator/CEdev/examples/debugging/obj/main.src @@ -0,0 +1,484 @@ +; Zilog eZ80 ANSI C Compiler Release 3.4 +; -debug -optsize -noreduceopt -nomodsect -peephole -globalopt +; -localcse -const=ROM + FILE "SRC\MAIN.C" + .assume ADL=1 +.DEBUG "C" + SEGMENT CODE +.BEGREC "NONAME0",9 +.DEFINE "sign" +.VALUE 0 +.CLASS 8 +.TYPE 2 +.ENDEF +.DEFINE "exp" +.VALUE 1 +.CLASS 8 +.TYPE 2 +.ENDEF +.DEFINE "mant" +.VALUE 2 +.CLASS 8 +.DIM 7 +.TYPE 108 +.ENDEF +.ENDREC "NONAME0" +.BEGREC "NONAME1",18 +.DEFINE "real" +.VALUE 0 +.CLASS 8 +.TAG "NONAME0" +.TYPE 8 +.ENDEF +.DEFINE "imag" +.VALUE 9 +.CLASS 8 +.TAG "NONAME0" +.TYPE 8 +.ENDEF +.ENDREC "NONAME1" +.BEGREC "NONAME2",11 +.DEFINE "dim" +.VALUE 0 +.CLASS 8 +.TYPE 13 +.ENDEF +.DEFINE "items" +.VALUE 2 +.CLASS 8 +.DIM 1 +.TAG "NONAME0" +.TYPE 104 +.ENDEF +.ENDREC "NONAME2" +.BEGREC "NONAME3",20 +.DEFINE "dim" +.VALUE 0 +.CLASS 8 +.TYPE 13 +.ENDEF +.DEFINE "items" +.VALUE 2 +.CLASS 8 +.DIM 1 +.TAG "NONAME1" +.TYPE 104 +.ENDEF +.ENDREC "NONAME3" +.BEGREC "NONAME4",11 +.DEFINE "cols" +.VALUE 0 +.CLASS 8 +.TYPE 12 +.ENDEF +.DEFINE "rows" +.VALUE 1 +.CLASS 8 +.TYPE 12 +.ENDEF +.DEFINE "items" +.VALUE 2 +.CLASS 8 +.DIM 1 +.TAG "NONAME0" +.TYPE 104 +.ENDEF +.ENDREC "NONAME4" +.BEGREC "NONAME5",3 +.DEFINE "len" +.VALUE 0 +.CLASS 8 +.TYPE 13 +.ENDEF +.DEFINE "data" +.VALUE 2 +.CLASS 8 +.DIM 1 +.TYPE 98 +.ENDEF +.ENDREC "NONAME5" +.BEGREC "NONAME6",3 +.DEFINE "len" +.VALUE 0 +.CLASS 8 +.TYPE 13 +.ENDEF +.DEFINE "data" +.VALUE 2 +.CLASS 8 +.DIM 1 +.TYPE 98 +.ENDEF +.ENDREC "NONAME6" +.BEGREC "NONAME7",3 +.DEFINE "size" +.VALUE 0 +.CLASS 8 +.TYPE 13 +.ENDEF +.DEFINE "data" +.VALUE 2 +.CLASS 8 +.DIM 1 +.TYPE 108 +.ENDEF +.ENDREC "NONAME7" +.BEGREC "fmt_type",19 +.DEFINE "status" +.VALUE 0 +.CLASS 8 +.TYPE 12 +.ENDEF +.DEFINE "flags" +.VALUE 1 +.CLASS 8 +.TYPE 12 +.ENDEF +.DEFINE "size" +.VALUE 2 +.CLASS 8 +.TYPE 2 +.ENDEF +.DEFINE "chr" +.VALUE 3 +.CLASS 8 +.TYPE 2 +.ENDEF +.DEFINE "type" +.VALUE 4 +.CLASS 8 +.TYPE 2 +.ENDEF +.DEFINE "field_width" +.VALUE 5 +.CLASS 8 +.TYPE 2 +.ENDEF +.DEFINE "precision" +.VALUE 6 +.CLASS 8 +.TYPE 2 +.ENDEF +.DEFINE "set_begin" +.VALUE 7 +.CLASS 8 +.TYPE 34 +.ENDEF +.DEFINE "set_end" +.VALUE 10 +.CLASS 8 +.TYPE 34 +.ENDEF +.DEFINE "pad_whole" +.VALUE 13 +.CLASS 8 +.TYPE 12 +.ENDEF +.DEFINE "pad_pre_fract" +.VALUE 14 +.CLASS 8 +.TYPE 12 +.ENDEF +.DEFINE "pad_post_fract" +.VALUE 15 +.CLASS 8 +.TYPE 12 +.ENDEF +.DEFINE "pad_at" +.VALUE 16 +.CLASS 8 +.TYPE 34 +.ENDEF +.ENDREC "fmt_type" +.BEGREC "flt_info",12 +.DEFINE "flags" +.VALUE 0 +.CLASS 8 +.TYPE 12 +.ENDEF +.DEFINE "exp" +.VALUE 1 +.CLASS 8 +.TYPE 2 +.ENDEF +.DEFINE "digits" +.VALUE 2 +.CLASS 8 +.DIM 10 +.TYPE 108 +.ENDEF +.ENDREC "flt_info" +.BEGREC "NONAME8",6 +.DEFINE "quot" +.VALUE 0 +.CLASS 8 +.TYPE 4 +.ENDEF +.DEFINE "rem" +.VALUE 3 +.CLASS 8 +.TYPE 4 +.ENDEF +.ENDREC "NONAME8" +.BEGREC "NONAME9",8 +.DEFINE "quot" +.VALUE 0 +.CLASS 8 +.TYPE 5 +.ENDEF +.DEFINE "rem" +.VALUE 4 +.CLASS 8 +.TYPE 5 +.ENDEF +.ENDREC "NONAME9" +.BEGREC "header",6 +.DEFINE "s" +.VALUE 0 +.CLASS 11 +.TAG "NONAME10" +.TYPE 8 +.ENDEF +.DEFINE "x" +.VALUE 0 +.CLASS 11 +.TYPE 2 +.ENDEF +.ENDREC "header" +.BEGREC "NONAME10",6 +.DEFINE "ptr" +.VALUE 0 +.CLASS 8 +.TAG "header" +.TYPE 40 +.ENDEF +.DEFINE "size" +.VALUE 3 +.CLASS 8 +.TYPE 14 +.ENDEF +.ENDREC "NONAME10" +.BEGREC "__stdio_file",1 +.DEFINE "slot" +.VALUE 0 +.CLASS 8 +.TYPE 12 +.ENDEF +.ENDREC "__stdio_file" +; 1 #include +; 2 #include +; 3 #include +; 4 #include +; 5 +; 6 #include +; 7 #include +; 8 +; 9 /* +; 10 * Even though debug.h has prototypes for Debugger, SetWriteWatchpoint, SetWatchpoint, RemoveWatchpoint, RemoveAllWatchpoints, RemoveAllBreakpoints... +; 11 * you have to use the dbg_ prefix as shown here: +; 12 */ +; 13 +; 14 void main(void) { +_main: +.DEFINE "_main" + +.VALUE _main + +.CLASS 2 + +.TYPE 65 + +.ENDEF + +.BEGFUNC "main",14,"_main" + +.LINE 14 + +.DEFINE "dbg_test_var_2" + +.CLASS 65 + +.VALUE -1 + +.TYPE 12 + +.ENDEF + +.DEFINE "dbg_test_var_1" + +.CLASS 65 + +.VALUE -4 + +.TYPE 4 + +.ENDEF + + PUSH IX + LD IX,0 + ADD IX,SP + PUSH BC + DEC SP +; 15 /* Set the intial value of some variables */ +; 16 int dbg_test_var_1 = 10; +.LINE 16 + + LD BC,10 + LD (IX+-4),BC +; 17 uint8_t dbg_test_var_2 = 3; +.LINE 17 + + LD (IX+-1),3 +; 18 +; 19 /* Print a simple debugging string */ +; 20 dbg_sprintf(dbgout, "This is the start of a CEmu debugging test\n"); +.LINE 20 + + LD BC,L__0 + PUSH BC + LD BC,16449536 + PUSH BC + CALL _sprintf + POP BC + POP BC +; 21 +; 22 /* You can enter the debugger manually */ +; 23 dbg_Debugger(); +.LINE 23 + + CALL _dbg_Debugger +; 24 +; 25 /* Set a watchpoint that will break anytime we write/change this variable */ +; 26 dbg_SetWriteWatchpoint(&dbg_test_var_1, sizeof dbg_test_var_1); +.LINE 26 + + LD BC,3 + PUSH BC + PEA IX+-4 + CALL _dbg_SetWriteWatchpoint + POP BC + POP BC +; 27 +; 28 /* Set a non breaking watchpoint just so we can see what is in this variable at any given time */ +; 29 dbg_SetWatchpoint(&dbg_test_var_2, sizeof dbg_test_var_2); +.LINE 29 + + LD BC,1 + PUSH BC + PEA IX+-1 + CALL _dbg_SetWatchpoint + POP BC + POP BC +; 30 +; 31 /* Now, let's write to the variable to see what happens (Go to the 'Watchpoints' tab in CEmu to view the status) */ +; 32 dbg_test_var_1 = 5; +.LINE 32 + + LD BC,5 + LD (IX+-4),BC +; 33 +; 34 /* Remove the watchpoint that we had set */ +; 35 dbg_RemoveWatchpoint(&dbg_test_var_1); +.LINE 35 + + PEA IX+-4 + CALL _dbg_RemoveWatchpoint + POP BC +; 36 dbg_RemoveWatchpoint(&dbg_test_var_2); +.LINE 36 + + PEA IX+-1 + CALL _dbg_RemoveWatchpoint + POP BC +; 37 +; 38 /* We can also use those */ +; 39 dbg_RemoveAllWatchpoints(); +.LINE 39 + + CALL _dbg_RemoveAllWatchpoints +; 40 dbg_RemoveAllBreakpoints(); +.LINE 40 + + CALL _dbg_RemoveAllBreakpoints +; 41 +; 42 /* Set this value to zero */ +; 43 dbg_test_var_2 = 0; +.LINE 43 + + LD (IX+-1),0 +; 44 +; 45 /* Fail this assertion */ +; 46 assert(dbg_test_var_2); +.LINE 46 + + LD A,(IX+-1) + OR A,A + JR NZ,L_3 + LD BC,46 + PUSH BC + LD BC,L__2 + PUSH BC + LD BC,L__3 + PUSH BC + LD BC,L__4 + PUSH BC + LD BC,16449536 + PUSH BC + CALL _sprintf + POP BC + POP BC + POP BC + POP BC + POP BC + CALL _abort +; 47 } +L_3: +.LINE 47 + + LD SP,IX + POP IX + RET + + +;**************************** _main *************************** +;Name Addr/Register Size Type +;_abort IMPORT ----- function +;_dbg_RemoveAllBreakpoints IMPORT ----- function +;_dbg_RemoveAllWatchpoints IMPORT ----- function +;_dbg_RemoveWatchpoint IMPORT ----- function +;_dbg_SetWatchpoint IMPORT ----- function +;_dbg_SetWriteWatchpoint IMPORT ----- function +;_dbg_Debugger IMPORT ----- function +;_sprintf IMPORT ----- function +;dbg_test_var_1 IX-4 3 variable +;dbg_test_var_2 IX-1 1 variable + + +; Stack Frame Size: 10 (bytes) +; Spill Code: 0 (instruction) + + +.ENDFUNC "main",47,"_main" + SEGMENT STRSECT +L__0: + DB "This is the start of a CEmu debugging test" + DB 10,0 +L__2: + DB "Z:\\HOME\\WALTZ\\DOCUMENTS\\TOOLCHAIN\\EXAMPLES\\DEBUGGING\\SRC\\MAIN.C" + DB 0 +L__3: + DB "dbg_test_var_2" + DB 0 +L__4: + DB "Assertion failure: %s, file: %s, line %d" + DB 10,0 + XREF _dbg_RemoveAllBreakpoints:ROM + XREF _dbg_RemoveAllWatchpoints:ROM + XREF _dbg_RemoveWatchpoint:ROM + XREF _dbg_SetWriteWatchpoint:ROM + XREF _dbg_SetWatchpoint:ROM + XREF _dbg_Debugger:ROM + XREF _sprintf:ROM + XREF _abort:ROM + XDEF _main + END diff --git a/frontends/calculator/CEdev/examples/debugging/readme.md b/frontends/calculator/CEdev/examples/debugging/readme.md new file mode 100644 index 0000000..9d95f90 --- /dev/null +++ b/frontends/calculator/CEdev/examples/debugging/readme.md @@ -0,0 +1,10 @@ +### Debugging Demo + +This demo demonstrates how to use a few of the debugging features implemented in CEmu + +![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/debugging/screenshot.png b/frontends/calculator/CEdev/examples/debugging/screenshot.png new file mode 100644 index 0000000..7c7ab17 Binary files /dev/null and b/frontends/calculator/CEdev/examples/debugging/screenshot.png differ diff --git a/frontends/calculator/CEdev/examples/debugging/src/main.c b/frontends/calculator/CEdev/examples/debugging/src/main.c new file mode 100644 index 0000000..67b5bac --- /dev/null +++ b/frontends/calculator/CEdev/examples/debugging/src/main.c @@ -0,0 +1,47 @@ +#include +#include +#include +#include + +#include +#include + +/* + * Even though debug.h has prototypes for Debugger, SetWriteWatchpoint, SetWatchpoint, RemoveWatchpoint, RemoveAllWatchpoints, RemoveAllBreakpoints... + * you have to use the dbg_ prefix as shown here: + */ + +void main(void) { + /* Set the intial value of some variables */ + int dbg_test_var_1 = 10; + uint8_t dbg_test_var_2 = 3; + + /* Print a simple debugging string */ + dbg_sprintf(dbgout, "This is the start of a CEmu debugging test\n"); + + /* You can enter the debugger manually */ + dbg_Debugger(); + + /* Set a watchpoint that will break anytime we write/change this variable */ + dbg_SetWriteWatchpoint(&dbg_test_var_1, sizeof dbg_test_var_1); + + /* Set a non breaking watchpoint just so we can see what is in this variable at any given time */ + dbg_SetWatchpoint(&dbg_test_var_2, sizeof dbg_test_var_2); + + /* Now, let's write to the variable to see what happens (Go to the 'Watchpoints' tab in CEmu to view the status) */ + dbg_test_var_1 = 5; + + /* Remove the watchpoint that we had set */ + dbg_RemoveWatchpoint(&dbg_test_var_1); + dbg_RemoveWatchpoint(&dbg_test_var_2); + + /* We can also use those */ + dbg_RemoveAllWatchpoints(); + dbg_RemoveAllBreakpoints(); + + /* Set this value to zero */ + dbg_test_var_2 = 0; + + /* Fail this assertion */ + assert(dbg_test_var_2); +} -- cgit v1.2.3-101-g0448