Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas-jonsson committed Dec 18, 2023
1 parent 267b567 commit e672f29
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tools/emuctrl/emuctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
#include <stdlib.h>
#include <stdio.h>

#define VERSION "1.0.0"
#define COMMAND_PORT 0xB4
#define DATA_PORT 0xB5

#if !defined(__BCC__) || !defined(__MSDOS__)
#error Use BCC to produce MSDOS executable!
#endif
Expand All @@ -27,7 +31,7 @@ enum {
static int read_status(void) {
#asm
xor ax, ax
in al, 0xB4
in al, COMMAND_PORT
#endasm
}

Expand All @@ -36,7 +40,7 @@ static void write_command_(unsigned char c) {
push bx
mov bx, sp
mov al, [bx+4]
out 0xB4, al
out COMMAND_PORT, al
pop bx
#endasm
}
Expand All @@ -56,21 +60,22 @@ static void write_data(unsigned char c) {
push bx
mov bx, sp
mov al, [bx+4]
out 0xB5, al
out DATA_PORT, al
pop bx
#endasm
}

static unsigned char read_data(void) {
#asm
xor ax, ax
in al, 0xB5
in al, DATA_PORT
#endasm
}

static void print_help(void) {
printf(
"Usage: emuctrl [cmd] <args...>\n\n"
" version Display software information\n"
" shutdown Terminates the emulator\n"
" popen <args...> Execute command on host and pipe input to guest\n"
" push [src] [dest] Upload file from guest to host\n"
Expand Down Expand Up @@ -169,6 +174,9 @@ int main(int argc, char *argv[]) {

write_command(FRONTEND_CTRL_FCLOSE);
fclose(fp);
} else if (!strcmp(argv[1], "version")) {
printf("VirtualXT Control Software\n");
printf("Version: %s\n", VERSION);
} else {
print_help();
}
Expand Down

0 comments on commit e672f29

Please sign in to comment.