{"id":13568617,"url":"https://github.com/sizious/dcload-ip","last_synced_at":"2025-04-04T04:31:30.410Z","repository":{"id":89894078,"uuid":"152573341","full_name":"sizious/dcload-ip","owner":"sizious","description":"A Dreamcast ethernet loader originally by ADK/Napalm — This project is part of KallistiOS. [⚠️ Unofficial, Most Advanced, Experimental Version ⚠️]","archived":false,"fork":false,"pushed_at":"2025-03-21T06:02:48.000Z","size":359,"stargazers_count":45,"open_issues_count":2,"forks_count":16,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-21T07:20:21.304Z","etag":null,"topics":["developer-tools","development-tools","dreamcast","homebrew-launcher","sega","sega-dreamcast"],"latest_commit_sha":null,"homepage":"https://github.com/KallistiOS/dcload-ip","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sizious.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-11T10:25:49.000Z","updated_at":"2025-03-21T06:02:53.000Z","dependencies_parsed_at":"2024-01-14T03:47:53.435Z","dependency_job_id":"98aa2f4d-ff16-44c5-92ef-9e62989d3600","html_url":"https://github.com/sizious/dcload-ip","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sizious%2Fdcload-ip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sizious%2Fdcload-ip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sizious%2Fdcload-ip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sizious%2Fdcload-ip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sizious","download_url":"https://codeload.github.com/sizious/dcload-ip/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247123072,"owners_count":20887259,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["developer-tools","development-tools","dreamcast","homebrew-launcher","sega","sega-dreamcast"],"created_at":"2024-08-01T14:00:29.271Z","updated_at":"2025-04-04T04:31:25.396Z","avatar_url":"https://github.com/sizious.png","language":"C","funding_links":[],"categories":["Testing and Debugging"],"sub_categories":[],"readme":"\n# dcload-ip 2.0.1\n\nA Dreamcast ethernet loader originally by [Andrew Kieschnick](http://napalm-x.thegypsy.com/andrewk/dc/).\nUpdated and overhauled by Moopthehedgehog\n\n## Features\n\n* Load  `elf`, `srec`, and `bin`\n* PC I/O (read, write, etc to PC - compatible with original dcload)\n* Exception handler\n* Extremely fast\n* Now works on 100mbit\n* Supports both the **Broadband Adapter** (HIT-0400) and **LAN Adapter** (HIT-0300)\n  in a single binary\n- DHCP support (use an IP address of 0.0.0.0 in `Makefile.cfg` to enable it)\n- NTSC 480i, PAL 576i, and VGA display output modes supported\n- Dumping exceptions over the network if the dcload console is enabled\n\n## Building\n\n1. Edit `Makefile.cfg` for your system and network, and then run `make`.\n\nNOTE: GCC 4.7.x users using the KOS 2.1.0 build environment must ensure\n``USING_KOS_GCC`` is enabled in `Makefile.cfg`. Disabling that flag uses compile\noptions meant for a portable copy of GCC 9.2/Binutils 2.33.1 compiled with an\n``sh4-elf-`` prefix, which won't work with the KOS 2.1.0 compiler.\n\n## Installation\n\n1. PC - run `make install` (installs dc-tool)\n2. DC\n\n a. `cd make-cd`, edit `Makefile`, insert blank cd-r, run `make`. If\n   `1st_read.bin` hasn't been built yet, this `Makefile` will build it  \n or  \n b. take `target-src/1st_read/1st_read.bin` and stuff it on a cd yourself\n      (please use the `IP.BIN` from the `make-cd` directory if you are going\n      to distribute either cds or cd images).\n\n## On-screen display\n\n* If you see the message `NO ETHERNET ADAPTER DETECTED!`, something has\n  gone wrong. The background of the screen will be red.\n\n* The correct display is something like:\n\n  `dcload-ip 2.0.1`  \u003c- name/version\n  `Broadband Adapter (HIT-0400)`  \u003c- adapter driver in use  \n  `00:d0:f1:02:ab:dd`  \u003c- dc hardware address  \n  `192.168.1.92`  \u003c- dc ip address  \n  `idle...`  \u003c- status  \n\n  The background of the screen will be blue (Broadband Adapter) or green (LAN Adapter).\n\n* If the status line reports `link change...` and does not change back to\n  `idle...` within a short period of time, you may have a cable problem.\n  dcload-ip will not work while `link change...` is displayed, or before it is\n  displayed the first time. The `link change...` message normally is seen when\n  you start dcload-ip, when you execute `dc-tool -r`, and when you disconnect\n  the ethernet cable.\n\n* If an exception is caught while a loaded program is running, the screen\n  will turn lighter blue and display the exception info for a time set by\n  `EXCEPTION_SECONDS` in Makefile.cfg (default is 15 seconds). dcload-ip should\n  be active again after that point. See the Exception Dumping section of this\n  README for what happens if an exception occurs while the dc-tool console is used.\n\n## Testing\n\n1. `cd example-src`\n2. `dc-tool -x console-test` (tests some PC I/O)\n3. `dc-tool -x exception-test` (generates an exception)\n4. `dc-tool -x gethostinfo` (displays the Dreamcast's ip, and the ip and port of\n   the dc-tool host)\n\n## KOS GDB-over-dcload\n\nTo run a GNU debugger session over the dcload connection:\n\n1. Build/obtain an sh-elf targetted GNU debugger\n2. Put a `gdb_init()` call somewhere in the startup area of your\n   KOS-based program\n3. Build your program with the `-g` GCC switch to include debugging info\n4. Launch your program using `dc-tool -g -x \u003cprog.elf\u003e`\n5. Launch sh-elf-gdb and connect to the dc-tool using `target remote :2159`\n6. Squash bugs\n\n## Maple Passthrough\n\nYou can send packets to various maple devices attached to the Dreamcast by using\nthe MAPL command. Simply send a command packet to the Dreamcast that is formatted\nas follows:\n\n```\ntypedef struct __attribute__ ((packed)) {\n\tunsigned char id[4]; // MAPL\n\tunsigned int address; // Ignored, set to 0\n\tunsigned int size; // The length of Maple packet data (the data[] member)\n\tunsigned char data[];\n} command_t;\n```\n\nMaple command data format:\n\n- Maple Command (1 byte)  \n- Maple Port # (1 byte)  \n- Maple Slot # (1 byte)  \n- Maple data in 4-byte increments (1 byte)  \n- Any data to be sent with the command (multiple of 4 bytes)  \n\nYou will get a similarly formatted response in return.\n\n## Performance Counter Control\n\nNewly added is the ability to control Dreamcast/SH7091 performance counters over\nthe network. These were a previously hidden aspect of the Dreamcast's CPU, and\nthis program uses one of them to keep track of DHCP lease time across loaded\nprograms. There are two of them, and they are both 48-bit. See perfctr.h/.c for\ndetails (they are from https://github.com/Moopthehedgehog/DreamHAL).\n\nSimilarly to the Maple packets, the format of a performance counter control packet\nis as follows:\n\n```\ntypedef struct __attribute__ ((packed)) {\n\tunsigned char id[4]; // PMCR\n\tunsigned int address; // Ignored, set to 0\n\tunsigned int size; // Length of data[]. This field isn't actually checked, though...\n\tunsigned char data[];\n} command_t;\n```\nFor anyone making a program to take advantage of this functionality, the packet\npayload data essentially just needs to conform to this struct, and \"id\" should\nbe \"PMCR\" (without null-termination).\n\nRegarding the data field, it should be formatted according to the following information:\n\nThe 6 performance counter control functions are:\n```\n\t// (I) Clear counter and enable\n\tvoid PMCR_Init(unsigned char which, unsigned char mode, unsigned char count_type);\n\n\t// (E) Enable one or both of these \"undocumented\" performance counters\n\tvoid PMCR_Enable(unsigned char which, unsigned char mode, unsigned char count_type, unsigned char reset_counter);\n\n\t// (B) Disable, clear, and re-enable with new mode (or same mode)\n\tvoid PMCR_Restart(unsigned char which, unsigned char mode, unsigned char count_type);\n\n\t// (R) Read a counter\n\tunsigned long long int PMCR_Read(unsigned char which);\n\n\t// (G) Get a counter's current configuration\n\tunsigned short PMCR_Get_Config(unsigned char which);\n\n\t// (S) Stop counter(s) (without clearing)\n\tvoid PMCR_Stop(unsigned char which);\n\n\t// (D) Disable counter(s) (without clearing)\n\tvoid PMCR_Disable(unsigned char which);\n```\nThe command is the first letter of the function name (capitalized), followed by\neach of the function's parameters. Note that restart's command letter is 'B'--read\nis 'R', so restart is 'B' (think reBoot). The command letters are included in\nparentheses for each function in the above comment block.\n\n- Sending command data of 'D' 0x1 (2 bytes) disables ('D') perf counter 1 (0x1)   \n- Sending command data 'E' 0x3 0x23 0x0 0x1 (5 bytes) enables ('E') both perf\ncounters (0x3) to elapsed time mode (0x23) where count is 1 cpu cycle = 1 count\n(0x0) and continue the counter from its current value (0x1)\n- Sending command data 'B' 0x2 0x23 0x1 (4 bytes) restarts ('B') perf counter 2\n(0x2) to elapsed time mode (0x23) and count is CPU/bus ratio method (0x1)  \n...  \netc.\n\nNotes:\n- Remember to disable before leaving dcload-ip to execute a program if dcload's\ncounter is needed by that program.\n- See perfctr.h for how to calculate time using the CPU/bus ratio method, in\naddition to the available counter modes (and for loads of other information)\n- PMCR_Init() and PMCR_Enable() will do nothing if the perf counter is already running!\n\n## Exception Dumping\n\nAnother new feature is the ability to send a full register dump to a host PC\nrunning dc-tool-ip with the console enabled (i.e. not invoked with the `-n`\ncommand line option).\n\nIn the event of an exception, dcload will print a full register dump on the\nscreen and to the dc-tool console. It will also make a file called\n`dcload_exception_dump.bin` in the directory that the terminal is currently in.\n\nThe format of the dump binary is as follows:\n```\n// Exception struct\nstruct _exception_struct_t {\n\tunsigned char id[4]; // EXPT\n\tunsigned int expt_code; // Exception code\n\tunsigned int pc;\n\tunsigned int pr;\n\tunsigned int sr;\n\tunsigned int gbr;\n\tunsigned int vbr;\n\tunsigned int dbr;\n\tunsigned int mach;\n\tunsigned int macl;\n\tunsigned int r0b0;\n\tunsigned int r1b0;\n\tunsigned int r2b0;\n\tunsigned int r3b0;\n\tunsigned int r4b0;\n\tunsigned int r5b0;\n\tunsigned int r6b0;\n\tunsigned int r7b0;\n\tunsigned int r0b1;\n\tunsigned int r1b1;\n\tunsigned int r2b1;\n\tunsigned int r3b1;\n\tunsigned int r4b1;\n\tunsigned int r5b1;\n\tunsigned int r6b1;\n\tunsigned int r7b1;\n\tunsigned int r8;\n\tunsigned int r9;\n\tunsigned int r10;\n\tunsigned int r11;\n\tunsigned int r12;\n\tunsigned int r13;\n\tunsigned int r14;\n\tunsigned int r15;\n\tunsigned int fpscr;\n\tunsigned int fr0;\n\tunsigned int fr1;\n\tunsigned int fr2;\n\tunsigned int fr3;\n\tunsigned int fr4;\n\tunsigned int fr5;\n\tunsigned int fr6;\n\tunsigned int fr7;\n\tunsigned int fr8;\n\tunsigned int fr9;\n\tunsigned int fr10;\n\tunsigned int fr11;\n\tunsigned int fr12;\n\tunsigned int fr13;\n\tunsigned int fr14;\n\tunsigned int fr15;\n\tunsigned int fpul;\n\tunsigned int xf0;\n\tunsigned int xf1;\n\tunsigned int xf2;\n\tunsigned int xf3;\n\tunsigned int xf4;\n\tunsigned int xf5;\n\tunsigned int xf6;\n\tunsigned int xf7;\n\tunsigned int xf8;\n\tunsigned int xf9;\n\tunsigned int xf10;\n\tunsigned int xf11;\n\tunsigned int xf12;\n\tunsigned int xf13;\n\tunsigned int xf14;\n\tunsigned int xf15;\n} __attribute__ ((__packed__));\n```\n\n## Notes\n\n* You can use `arp` instead of setting the Dreamcast's IP in `Makefile.cfg`.\n  On Windows, you may use the `netsh` command which is more reliable (e.g. `netsh\n  interface ip add neighbors \"Ethernet\" 192.168.10.1 AA-BB-CC-DD-EE-FF)`. In that\n  case, don't forget to specify an IP address in the Ethernet card of your computer.\n  Please set the Dreamcast's IP in `Makefile.cfg` to be in the range 169.254.xxx.xxx\n  when using this method, as 0.0.0.0 is used by the DHCP protocol for network\n  discovery purposes (actually the entire 0.x.x.x range is).\n* Tested systems: Debian GNU/Linux 2.2-3.0, Cygwin, MinGW,\n[DreamSDK](https://www.dreamsdk.org), Windows Subsystem for Linux v2 (Debian)\n* Many, many bugs have been squashed and much of the code overhauled\n* Patches and improvements are welcome; please raise an issue here in the \"Issues\"\nsection for that\n\n## Credits\n\n* [SiZiOUS](https://www.github.com/SiZiOUS) for maintaining this program\n* rtl8139 code based on code by Dan Potter\n* LAN Adapter driver code, originally derived from early KOS, majorly overhauled by Moopthehedgehog\n* DHCP support, exception dumping, perf counters, performance improvements by Moopthehedgehog\n* DHCP retry functionality by darcagn\n* There are some various files from `newlib-1.8.2` here\n* `video.s`, `maple.c`, and `maple.h` were written by Marcus Comstedt\n* initial win32 porting and implementation of -t by Florian 'Proff' Schulze\n* win32 bugfix by The Gypsy\n* fixes for cygwin by Florian 'Proff' Schulze\n* rx config bug pointed out by Slant\n* horridly buggy nature of 1.0.1 + 1.0.2 pointed out by Dan Potter\n* Fixes for `libbfd` segfaults by Atani\n* Inspiration for `MAPL` packet by Tim Hentenaar\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsizious%2Fdcload-ip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsizious%2Fdcload-ip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsizious%2Fdcload-ip/lists"}