Exit wozmon

This commit is contained in:
2025-10-03 23:31:43 +02:00
parent 5bb49da246
commit cad4f5081a
2 changed files with 1 additions and 102 deletions

View File

@@ -20,8 +20,7 @@ LDFLAGS = -mregparmcall -Wl,--gc-sections -Os -nostdlib -flto
%.com: %.elf %.com: %.elf
ia16-elf-objcopy -O binary $< $@ ia16-elf-objcopy -O binary $< $@
bootsectors = fat12boot.bin wozmon.bin fat12boot.bin:
$(bootsectors):
ia16-elf-objcopy -O binary $< $@ ia16-elf-objcopy -O binary $< $@
fat12boot.elf: fat12boot.o fat12.o bootsect.S fat12boot.elf: fat12boot.o fat12.o bootsect.S
@@ -37,17 +36,6 @@ polmon.elf: polmon.o stdlib.o
polio.elf: LDFLAGS += -T flat0600.ld polio.elf: LDFLAGS += -T flat0600.ld
polio.elf: polio-main.o polio.s fat12.o paracomm.o stdlib.o polio.elf: polio-main.o polio.s fat12.o paracomm.o stdlib.o
wozmon.o: polmon.cc
wozmon.o: CPPFLAGS = -DWOZMON=1
wozmon.o:
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
wozmon.elf: wozmon.o bootsect.S
wozmon.elf: LDFLAGS += -T bootsect.ld
wozmon.elf: CPPFLAGS += -DNOBPB
wozmon.bin: wozmon.elf
paracli.elf: LDFLAGS += -T doscom.ld paracli.elf: LDFLAGS += -T doscom.ld
paracli.elf: paracli.s paracomm.o paracli.elf: paracli.s paracomm.o

View File

@@ -2,77 +2,8 @@
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>
#ifndef WOZMON
#define WOZMON 0
#endif
#if WOZMON
#define BACKSPACE 0
#define ASCIIDUMP 0
#define CLEARSCREENCMD 0
#define INT80H 0
#define SHOWTITLE 0
#define BOOTSTRAP 0
#define LAUNCH 0
#define CTRLBREAK 0
#endif // WOZMON
#ifndef BACKSPACE
#define BACKSPACE 1
#endif
#ifndef ASCIIDUMP
#define ASCIIDUMP 1
#endif
#ifndef CLEARSCREENCMD
#define CLEARSCREENCMD 1
#endif
#ifndef INT80H
#define INT80H 1
#endif
#ifndef SHOWTITLE
#define SHOWTITLE 1
#endif
#ifndef BOOTSTRAP
#define BOOTSTRAP 1
#endif
#ifndef LAUNCH
#define LAUNCH 1
#endif
#ifndef CTRLBREAK
#define CTRLBREAK 1
#endif
namespace { namespace {
#if WOZMON
int getchar() {
register char c asm("al");
asm volatile("movb $0x00, %%ah\n\t"
"int $0x16"
: "=r"(c)::"ah", "cc");
return c;
}
void putchar(int c) {
asm volatile("push %%bp \n\t"
"mov %0, %%ax \n\t"
"movb $0x0e, %%ah \n\t"
"movb $0, %%bh \n\t"
"int $0x10 \n\t"
"pop %%bp \n\t" ::"r"(c)
: "ax", "bh", "cc");
}
#endif // WOZMON
constexpr int kDumpSize = 16; constexpr int kDumpSize = 16;
// arguments on the stack in reverse order // arguments on the stack in reverse order
@@ -173,7 +104,6 @@ void Dump(uint16_t addr, uint16_t seg, int count) {
uint8_t d = __get_far_u8__(addr + i, seg); uint8_t d = __get_far_u8__(addr + i, seg);
WriteUint8(d); WriteUint8(d);
} }
#if ASCIIDUMP
putchar(' '); putchar(' ');
putchar(' '); putchar(' ');
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
@@ -184,7 +114,6 @@ void Dump(uint16_t addr, uint16_t seg, int count) {
putchar('.'); putchar('.');
} }
} }
#endif
} }
void DumpHex(uint16_t addr, uint16_t seg) { void DumpHex(uint16_t addr, uint16_t seg) {
@@ -286,8 +215,6 @@ void LaunchFile(const char* name) {
: "ax", "bx", "cx", "dx", "memory"); : "ax", "bx", "cx", "dx", "memory");
} }
#if CTRLBREAK
constexpr uint16_t kCtrlBreakVector = (0x1b * 4); constexpr uint16_t kCtrlBreakVector = (0x1b * 4);
extern "C" void cbreak(); extern "C" void cbreak();
@@ -313,8 +240,6 @@ void InstallCtrlBreak() {
vec[1] = 0; vec[1] = 0;
} }
#endif // CTRLBREAK
bool ParseCommand(const char* buf, uint16_t& cur_addr, uint16_t& cur_seg) { bool ParseCommand(const char* buf, uint16_t& cur_addr, uint16_t& cur_seg) {
bool dump = true; bool dump = true;
for (const char* ptr = buf; *ptr;) { for (const char* ptr = buf; *ptr;) {
@@ -332,7 +257,6 @@ bool ParseCommand(const char* buf, uint16_t& cur_addr, uint16_t& cur_seg) {
WriteUint16(ret); WriteUint16(ret);
putchar('\r'); putchar('\r');
putchar('\n'); putchar('\n');
#if INT80H
} else if (*ptr == 'i') { } else if (*ptr == 'i') {
dump = false; dump = false;
int nargs = 0; int nargs = 0;
@@ -355,14 +279,10 @@ bool ParseCommand(const char* buf, uint16_t& cur_addr, uint16_t& cur_seg) {
WriteUint16(ret); WriteUint16(ret);
putchar('\r'); putchar('\r');
putchar('\n'); putchar('\n');
#endif // INT80H
#if CLEARSCREENCMD
} else if (*ptr == 'l') { } else if (*ptr == 'l') {
dump = false; dump = false;
ClearScreen(); ClearScreen();
ptr++; ptr++;
#endif // CLEARSCREENCMD
#if LAUNCH
} else if (*ptr == 'r') { } else if (*ptr == 'r') {
dump = false; dump = false;
ptr++; ptr++;
@@ -374,7 +294,6 @@ bool ParseCommand(const char* buf, uint16_t& cur_addr, uint16_t& cur_seg) {
} }
LaunchFile(ptr); LaunchFile(ptr);
ptr += l; ptr += l;
#endif // LAUNCH
} else if (*ptr == 'w') { } else if (*ptr == 'w') {
dump = false; dump = false;
uint16_t addr = cur_addr; uint16_t addr = cur_addr;
@@ -410,9 +329,7 @@ void polmon() {
char* inptr = inbuf; char* inptr = inbuf;
ClearScreen(); ClearScreen();
#if SHOWTITLE
puts("PolMon for Workgroups 3.1\r\n"); puts("PolMon for Workgroups 3.1\r\n");
#endif // SHOWTITLE
DisplayPrompt(); DisplayPrompt();
while (1) { while (1) {
@@ -434,7 +351,6 @@ void polmon() {
first = false; first = false;
inptr = inbuf; inptr = inbuf;
DisplayPrompt(); DisplayPrompt();
#if BACKSPACE
} else if (c == kBackspace || c == kOtherBackspace) { } else if (c == kBackspace || c == kOtherBackspace) {
inptr--; inptr--;
if (inptr < inbuf) { if (inptr < inbuf) {
@@ -444,7 +360,6 @@ void polmon() {
} }
putchar(' '); putchar(' ');
putchar(kOtherBackspace); putchar(kOtherBackspace);
#endif
} else { } else {
*inptr = c; *inptr = c;
inptr++; inptr++;
@@ -455,15 +370,11 @@ void polmon() {
} // namespace } // namespace
int main() { int main() {
#if CTRLBREAK
InstallCtrlBreak(); InstallCtrlBreak();
#endif // CTRLBREAK
polmon(); polmon();
} }
#if BOOTSTRAP
__attribute__((section(".init"), noreturn, used)) void _start() { __attribute__((section(".init"), noreturn, used)) void _start() {
main(); main();
__builtin_unreachable(); __builtin_unreachable();
} }
#endif // BOOTSTRAP