Jump to content

Adding BDOS calls to #RunCPM

Recommended Posts

Part of #FujiNet's integration, relies on needing to make calls to the #FujiNet itself to access the network (and potentially WiFi MODEM). Because RunCPM provides its own BIOS and BDOS in C, and this is being compiled into the firmware, it's possible to add new commands that talk to the ESP32 firmware.


To start, I've implemented BDOS command 176, which gets the current FujiNet network config, and places it in the buffer provided by registers DE to specify the target address in Z80 space, consistent with many other BDOS calls.


It looks like this:




The implementation in the firmware is here: https://github.com/FujiNetWIFI/fujinet-platformio/blob/master/lib/runcpm/abstraction_fujinet.h#L507


You can see, it literally:

* Sets up a data structure for the network config

* Fills it

* Transfers it into Z80 memory at the address specified by the function parameter addr.


Once this is implemented, hooking into the BDOS is as simple as adding a case statement in bdos() here: https://github.com/FujiNetWIFI/fujinet-platformio/blob/master/lib/runcpm/cpm.h#L809


Once there, it can be called from inside CP/M as a BDOS call, e.g. in C I call it like this:


		char ssid[32];
		char hostname[64];
		unsigned char localIP[4];
		unsigned char gateway[4];
		unsigned char netmask[4];
		unsigned char dnsIP[4];
		unsigned char macAddress[6];
		unsigned char bssid[6];
		char fn_version[15];
	} cfg;

bdos(176,&cfg); // call BDOS, on return, network config is in cfg struct.
printf("My IP Address is: %u.%u.%u.%u\n",localIP[0],localIP[1],localIP[2],localIP[3]);

This will be extended to support all of the BDOS functions needed to implement the current crop of fnc-tools for CP/M.


  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...