Skip to content

Commit

Permalink
Finish renaming non CP/M BDoS functions
Browse files Browse the repository at this point in the history
  • Loading branch information
MockbaTheBorg committed Jun 10, 2023
1 parent 749d777 commit fd9dd02
Showing 1 changed file with 30 additions and 21 deletions.
51 changes: 30 additions & 21 deletions RunCPM/cpm.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,19 @@ enum eBDOSFunc {
L_WRITEBLK = 112,
F_PARSE = 152,
// RunCPM Stuff
F_PINMODE = 220,
F_DREAD = 221,
F_DWRITE = 222,
F_AREAD = 223,
F_AWRITE = 224,
F_SETMASK = 230,
F_BDOSCALL = 231,
F_UPTIME = 248,
F_MAKEDISK = 249,
F_HOSTOS = 250,
F_VERSION = 251,
F_CCPVERSION = 252,
F_CCPADDR = 253,
F_RUNLUA = 254
};

Expand All @@ -126,17 +139,15 @@ enum eBDOSFunc {
/* set up full PUN and LST filenames to be on drive A: user 0 */
#ifdef USE_PUN
char pun_file[17] = {'A', FOLDERCHAR, '0', FOLDERCHAR, 'P', 'U', 'N', '.', 'T', 'X', 'T', 0};

#endif // ifdef USE_PUN

#ifdef USE_LST
char lst_file[17] = {'A', FOLDERCHAR, '0', FOLDERCHAR, 'L', 'S', 'T', '.', 'T', 'X', 'T', 0};

#endif // ifdef USE_LST

#ifdef PROFILE
unsigned long time_start = 0;
unsigned long time_now = 0;

#endif // ifdef PROFILE

void _PatchCPM(void) {
Expand Down Expand Up @@ -830,7 +841,7 @@ void _Bdos(void) {
#ifdef PROFILE
if (time_start != 0) {
time_now = millis();
printf(": %ld\n", time_now - time_start);
printf(" (%ld)\n", time_now - time_start);
time_start = 0;
}
#endif // ifdef PROFILE
Expand Down Expand Up @@ -1630,60 +1641,58 @@ void _Bdos(void) {
/*
C = 220 (DCh) : PinMode
*/
case 220: {
case F_PINMODE: {
pinMode(HIGH_REGISTER(DE), LOW_REGISTER(DE));
break;
}

/*
C = 221 (DDh) : DigitalRead
*/
case 221: {
case F_DREAD: {
HL = digitalRead(HIGH_REGISTER(DE));
break;
}

/*
C = 222 (DEh) : DigitalWrite
*/
case 222: {
case F_DWRITE: {
digitalWrite(HIGH_REGISTER(DE), LOW_REGISTER(DE));
break;
}

/*
C = 223 (DFh) : AnalogRead
*/
case 223: {
case F_AREAD: {
HL = analogRead(HIGH_REGISTER(DE));
break;
}

#endif // if defined board_digital_io
#if defined board_analog_io

/*
C = 224 (E0h) : AnalogWrite
*/
case 224: {
case F_AWRITE: {
analogWrite(HIGH_REGISTER(DE), LOW_REGISTER(DE));
break;
}

#endif // if defined board_analog_io

/*
C = 230 (E6h) : Set 8 bit masking
*/
case 230: {
case F_SETMASK: {
mask8bit = LOW_REGISTER(DE);
break;
}

/*
C = 231 (E7h) : Host specific BDOS call
*/
case 231: {
case F_BDOSCALL: {
HL = hostbdos(DE);
break;
}
Expand All @@ -1707,10 +1716,10 @@ void _Bdos(void) {
#endif // if defined board_stm32

/*
C = 248 (F8h) : Milliseconds
C = 248 (F8h) : Milliseconds Uptime
Returns the number of milliseconds (since the board started).
*/
case 248:
case F_UPTIME:
{
timer = millis();
HL = timer & 0xFFFF;
Expand All @@ -1722,7 +1731,7 @@ void _Bdos(void) {
C = 249 (F9h) : MakeDisk
Makes a disk directory if not existent.
*/
case 249: {
case F_MAKEDISK: {
HL = _MakeDisk(DE);
break;
}
Expand All @@ -1731,7 +1740,7 @@ void _Bdos(void) {
C = 250 (FAh) : HostOS
Returns: A = 0x00 - Windows / 0x01 - Arduino / 0x02 - Posix / 0x03 - Dos / 0x04 - Teensy / 0x05 - ESP32 / 0x06 - STM32
*/
case 250: {
case F_HOSTOS: {
HL = HostOS;
break;
}
Expand All @@ -1740,7 +1749,7 @@ void _Bdos(void) {
C = 251 (FBh) : Version
Returns: A = 0xVv - Version in BCD representation: V.v
*/
case 251: {
case F_VERSION: {
HL = VersionBCD;
break;
}
Expand All @@ -1749,15 +1758,15 @@ void _Bdos(void) {
C = 252 (FCh) : CCP version
Returns: A = 0x00-0x04 = DRI|CCPZ|ZCPR2|ZCPR3|Z80CCP / 0xVv = Internal version in BCD: V.v
*/
case 252: {
case F_CCPVERSION: {
HL = VersionCCP;
break;
}

/*
C = 253 (FDh) : CCP address
*/
case 253: {
case F_CCPADDR: {
HL = CCPaddr;
break;
}
Expand All @@ -1767,7 +1776,7 @@ void _Bdos(void) {
/*
C = 254 (FEh) : Run Lua file
*/
case 254: {
case F_RUNLUA: {
HL = _RunLua(DE);
break;
}
Expand Down

0 comments on commit fd9dd02

Please sign in to comment.