Exit wozmon
This commit is contained in:
14
src/Makefile
14
src/Makefile
@@ -20,8 +20,7 @@ LDFLAGS = -mregparmcall -Wl,--gc-sections -Os -nostdlib -flto
|
||||
%.com: %.elf
|
||||
ia16-elf-objcopy -O binary $< $@
|
||||
|
||||
bootsectors = fat12boot.bin wozmon.bin
|
||||
$(bootsectors):
|
||||
fat12boot.bin:
|
||||
ia16-elf-objcopy -O binary $< $@
|
||||
|
||||
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: 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: paracli.s paracomm.o
|
||||
|
||||
|
@@ -2,77 +2,8 @@
|
||||
#include <cstdio>
|
||||
#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 {
|
||||
|
||||
#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;
|
||||
|
||||
// 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);
|
||||
WriteUint8(d);
|
||||
}
|
||||
#if ASCIIDUMP
|
||||
putchar(' ');
|
||||
putchar(' ');
|
||||
for (int i = 0; i < count; i++) {
|
||||
@@ -184,7 +114,6 @@ void Dump(uint16_t addr, uint16_t seg, int count) {
|
||||
putchar('.');
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void DumpHex(uint16_t addr, uint16_t seg) {
|
||||
@@ -286,8 +215,6 @@ void LaunchFile(const char* name) {
|
||||
: "ax", "bx", "cx", "dx", "memory");
|
||||
}
|
||||
|
||||
#if CTRLBREAK
|
||||
|
||||
constexpr uint16_t kCtrlBreakVector = (0x1b * 4);
|
||||
|
||||
extern "C" void cbreak();
|
||||
@@ -313,8 +240,6 @@ void InstallCtrlBreak() {
|
||||
vec[1] = 0;
|
||||
}
|
||||
|
||||
#endif // CTRLBREAK
|
||||
|
||||
bool ParseCommand(const char* buf, uint16_t& cur_addr, uint16_t& cur_seg) {
|
||||
bool dump = true;
|
||||
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);
|
||||
putchar('\r');
|
||||
putchar('\n');
|
||||
#if INT80H
|
||||
} else if (*ptr == 'i') {
|
||||
dump = false;
|
||||
int nargs = 0;
|
||||
@@ -355,14 +279,10 @@ bool ParseCommand(const char* buf, uint16_t& cur_addr, uint16_t& cur_seg) {
|
||||
WriteUint16(ret);
|
||||
putchar('\r');
|
||||
putchar('\n');
|
||||
#endif // INT80H
|
||||
#if CLEARSCREENCMD
|
||||
} else if (*ptr == 'l') {
|
||||
dump = false;
|
||||
ClearScreen();
|
||||
ptr++;
|
||||
#endif // CLEARSCREENCMD
|
||||
#if LAUNCH
|
||||
} else if (*ptr == 'r') {
|
||||
dump = false;
|
||||
ptr++;
|
||||
@@ -374,7 +294,6 @@ bool ParseCommand(const char* buf, uint16_t& cur_addr, uint16_t& cur_seg) {
|
||||
}
|
||||
LaunchFile(ptr);
|
||||
ptr += l;
|
||||
#endif // LAUNCH
|
||||
} else if (*ptr == 'w') {
|
||||
dump = false;
|
||||
uint16_t addr = cur_addr;
|
||||
@@ -410,9 +329,7 @@ void polmon() {
|
||||
char* inptr = inbuf;
|
||||
|
||||
ClearScreen();
|
||||
#if SHOWTITLE
|
||||
puts("PolMon for Workgroups 3.1\r\n");
|
||||
#endif // SHOWTITLE
|
||||
DisplayPrompt();
|
||||
|
||||
while (1) {
|
||||
@@ -434,7 +351,6 @@ void polmon() {
|
||||
first = false;
|
||||
inptr = inbuf;
|
||||
DisplayPrompt();
|
||||
#if BACKSPACE
|
||||
} else if (c == kBackspace || c == kOtherBackspace) {
|
||||
inptr--;
|
||||
if (inptr < inbuf) {
|
||||
@@ -444,7 +360,6 @@ void polmon() {
|
||||
}
|
||||
putchar(' ');
|
||||
putchar(kOtherBackspace);
|
||||
#endif
|
||||
} else {
|
||||
*inptr = c;
|
||||
inptr++;
|
||||
@@ -455,15 +370,11 @@ void polmon() {
|
||||
} // namespace
|
||||
|
||||
int main() {
|
||||
#if CTRLBREAK
|
||||
InstallCtrlBreak();
|
||||
#endif // CTRLBREAK
|
||||
polmon();
|
||||
}
|
||||
|
||||
#if BOOTSTRAP
|
||||
__attribute__((section(".init"), noreturn, used)) void _start() {
|
||||
main();
|
||||
__builtin_unreachable();
|
||||
}
|
||||
#endif // BOOTSTRAP
|
||||
|
Reference in New Issue
Block a user