├── LICENSE ├── README.md ├── bin ├── terminal.bin └── terminal.com ├── doc ├── bios.pdf ├── bios.png ├── bios.sch └── bios.sxw ├── img ├── im003727.jpg └── im003728.jpg └── src ├── Makefile ├── checksum.c ├── io.c ├── keyboard.c ├── loader.asm ├── screen.c ├── serial.c ├── terminal.c ├── types.h └── vt100.c /LICENSE: -------------------------------------------------------------------------------- 1 | (C) Copyright 2004 Wojtek Kaniewski 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to 5 | deal in the Software without restriction, including without limitation the 6 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | sell copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | IN THE SOFTWARE. 20 | 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | BIOS Terminal 2 | ============= 3 | 4 | This is a simple serial terminal to run from PC BIOS extension. It was 5 | a university project along with a hardware ISA card hosting the EEPROM 6 | chip. 7 | 8 | The documentation is available only in Polish, unfortunately. 9 | 10 | License 11 | ------- 12 | 13 | (C) Copyright 2004 Wojtek Kaniewski 14 | 15 | Source code released under the terms of MIT license. 16 | 17 | -------------------------------------------------------------------------------- /bin/terminal.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wojtekka/bios-terminal/fd3020cbcc2aafbd159c67b252f3ff66754839c6/bin/terminal.bin -------------------------------------------------------------------------------- /bin/terminal.com: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wojtekka/bios-terminal/fd3020cbcc2aafbd159c67b252f3ff66754839c6/bin/terminal.com -------------------------------------------------------------------------------- /doc/bios.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wojtekka/bios-terminal/fd3020cbcc2aafbd159c67b252f3ff66754839c6/doc/bios.pdf -------------------------------------------------------------------------------- /doc/bios.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wojtekka/bios-terminal/fd3020cbcc2aafbd159c67b252f3ff66754839c6/doc/bios.png -------------------------------------------------------------------------------- /doc/bios.sch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wojtekka/bios-terminal/fd3020cbcc2aafbd159c67b252f3ff66754839c6/doc/bios.sch -------------------------------------------------------------------------------- /doc/bios.sxw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wojtekka/bios-terminal/fd3020cbcc2aafbd159c67b252f3ff66754839c6/doc/bios.sxw -------------------------------------------------------------------------------- /img/im003727.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wojtekka/bios-terminal/fd3020cbcc2aafbd159c67b252f3ff66754839c6/img/im003727.jpg -------------------------------------------------------------------------------- /img/im003728.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wojtekka/bios-terminal/fd3020cbcc2aafbd159c67b252f3ff66754839c6/img/im003728.jpg -------------------------------------------------------------------------------- /src/Makefile: -------------------------------------------------------------------------------- 1 | all: terminal.bin terminal.com 2 | 3 | terminal.s: terminal.c 4 | x=`cat .build`; x=$$((x+1)); echo $$x > .build 5 | bcc -ansi -0 -S -DDATE="\"`date +%D`\"" -DBUILD="\"`cat .build`\"" terminal.c -o terminal.s 6 | 7 | terminal2.s: terminal.c 8 | bcc -ansi -0 -S -DCOM -DDATE="\"`date +%D`\"" -DBUILD="\"`cat .build`\"" terminal.c -o terminal2.s 9 | 10 | terminal.bin: terminal.s checksum 11 | as86 -j terminal.s -b terminal.bin -l terminal.lst 12 | dd if=/dev/zero of=terminal.bin bs=1 count=1 seek=32767 13 | ./checksum -o 0x0006 terminal.bin 14 | 15 | terminal.com: terminal2.s 16 | as86 -j terminal2.s -b terminal.tmp 17 | rm -f terminal2.s 18 | dd if=terminal.tmp of=terminal.com bs=256 skip=1 19 | rm -f terminal.tmp 20 | 21 | checksum: checksum.c 22 | gcc -Wall $< -o $@ 23 | 24 | clean: 25 | rm -f *.bin *.com *.s *.o *.lst *~ core checksum 26 | 27 | poke: terminal.bin 28 | seprog port /dev/ttyS0 chip at29c010 write terminal.bin 29 | 30 | .PHONY: poke clean 31 | 32 | -------------------------------------------------------------------------------- /src/checksum.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #define BUFSIZE 4096 10 | 11 | void usage(const char *argv0, int retcode) 12 | { 13 | printf("usage: %s [-o offset] [filename]\n\n", argv0); 14 | 15 | exit(retcode); 16 | } 17 | 18 | int main(int argc, char **argv) 19 | { 20 | int ch, offset_set = 0, fd = 0; 21 | unsigned int offset = 0, fpos = 0, checksum32 = 0; 22 | unsigned char buf[BUFSIZE], checksum = 0; 23 | unsigned short checksum16 = 0; 24 | 25 | while ((ch = getopt(argc, argv, "o:h")) != -1) { 26 | switch (ch) { 27 | case 'o': 28 | errno = 0; 29 | offset = strtoul(optarg, NULL, 0); 30 | if (errno == ERANGE) { 31 | perror(argv[0]); 32 | exit(1); 33 | } 34 | offset_set = 1; 35 | break; 36 | 37 | case 'h': 38 | usage(argv[0], 0); 39 | } 40 | } 41 | 42 | if (argc - optind > 1) 43 | usage(argv[0], 1); 44 | 45 | if (argc - optind == 1) 46 | fd = open(argv[optind], (offset_set) ? O_RDWR : O_RDONLY); 47 | else { 48 | offset_set = 0; 49 | fd = 0; 50 | } 51 | 52 | if (fd == -1) { 53 | perror(argv[optind]); 54 | exit(1); 55 | } 56 | 57 | for (;;) { 58 | int res, i; 59 | 60 | res = read(fd, buf, sizeof(buf)); 61 | 62 | if (res < 0) { 63 | perror(argv[0]); 64 | exit(1); 65 | } 66 | 67 | if (res == 0) 68 | break; 69 | 70 | for (i = 0; i < res; i++, fpos++) { 71 | if (offset_set && fpos == offset) 72 | continue; 73 | 74 | checksum += buf[i]; 75 | checksum16 += buf[i]; 76 | checksum32 += buf[i]; 77 | } 78 | } 79 | 80 | printf("0x%.2x, 0x%.4x, 0x%.8x\n", checksum, checksum16, checksum32); 81 | 82 | if (checksum != 0) 83 | checksum = 256 - checksum; 84 | 85 | if (offset_set) { 86 | lseek(fd, offset, SEEK_SET); 87 | if (write(fd, &checksum, 1) < 1) { 88 | perror("write"); 89 | exit(1); 90 | } 91 | } 92 | 93 | if (fd > 0) 94 | close(fd); 95 | 96 | return 0; 97 | } 98 | -------------------------------------------------------------------------------- /src/io.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wojtekka/bios-terminal/fd3020cbcc2aafbd159c67b252f3ff66754839c6/src/io.c -------------------------------------------------------------------------------- /src/keyboard.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wojtekka/bios-terminal/fd3020cbcc2aafbd159c67b252f3ff66754839c6/src/keyboard.c -------------------------------------------------------------------------------- /src/loader.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wojtekka/bios-terminal/fd3020cbcc2aafbd159c67b252f3ff66754839c6/src/loader.asm -------------------------------------------------------------------------------- /src/screen.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wojtekka/bios-terminal/fd3020cbcc2aafbd159c67b252f3ff66754839c6/src/screen.c -------------------------------------------------------------------------------- /src/serial.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wojtekka/bios-terminal/fd3020cbcc2aafbd159c67b252f3ff66754839c6/src/serial.c -------------------------------------------------------------------------------- /src/terminal.c: -------------------------------------------------------------------------------- 1 | #undef DEBUG_KEYBOARD 2 | #undef DEBUG_SERIAL 3 | #undef DEBUG_TRANSFER 4 | 5 | #include "loader.asm" 6 | #include "types.h" 7 | #include "io.c" 8 | #include "screen.c" 9 | #include "keyboard.c" 10 | #include "serial.c" 11 | #include "vt100.c" 12 | 13 | int main() 14 | { 15 | screenInit(); 16 | 17 | screenPutString("BIOS Terminal v1.0 build " BUILD "\r\n(C) Copyright 2004 Wojtek Kaniewski \r\nPress F12 to configure serial port\r\n\r\n"); 18 | 19 | serialSetup(); 20 | 21 | for (;;) { 22 | 23 | #ifdef DEBUG_SERIAL 24 | byte x, y, a; 25 | 26 | x = screenX; y = screenY; a = screenAttr; 27 | screenX = 30; screenY = 24; screenAttr = 7*16; 28 | screenCursorNoUpdate = 1; 29 | screenPutString(" s:"); 30 | screenPutHex((char)((char) serialRxHead - (char) serialRxTail)); 31 | screenPutString(" i:"); 32 | screenPutHex(portRead(0x21)); 33 | screenPutString(" t:"); 34 | screenPutHex(serialRxTail >> 8); 35 | screenPutHex(serialRxTail &255); 36 | screenPutString("/h:"); 37 | screenPutHex(serialRxHead >> 8); 38 | screenPutHex(serialRxHead &255); 39 | screenPutString(","); 40 | screenPutHex(portRead(serialPort+1)); 41 | screenPutString(","); 42 | screenPutHex(serialInterruptLast); // +2 43 | screenPutString(","); 44 | screenPutHex(portRead(serialPort+3)); 45 | screenPutString(","); 46 | screenPutHex(portRead(serialPort+4)); 47 | screenPutString(","); 48 | screenPutHex(portRead(serialPort+5)); 49 | screenPutString(","); 50 | screenPutHex(portRead(serialPort+6)); 51 | screenPutString(" k:"); 52 | screenCursorNoUpdate = 0; 53 | screenX = x; screenY = y; screenAttr = a; 54 | 55 | screenCursorUpdate(); 56 | #endif // DEBUG_SERIAL 57 | 58 | if (keyboardPressed()) { 59 | char *seq = vtGetChar(); 60 | 61 | while (*seq) { 62 | serialPutChar(*seq); 63 | seq++; 64 | } 65 | } 66 | 67 | while (serialDataReady()) { 68 | char ch = serialGetChar(); 69 | 70 | vtPutChar(ch); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/types.h: -------------------------------------------------------------------------------- 1 | #ifndef __TYPES_H 2 | #define __TYPES_H 1 3 | 4 | typedef unsigned char byte; 5 | typedef unsigned short word; 6 | typedef unsigned long dword; 7 | 8 | #endif /* __TYPES_H */ 9 | 10 | -------------------------------------------------------------------------------- /src/vt100.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wojtekka/bios-terminal/fd3020cbcc2aafbd159c67b252f3ff66754839c6/src/vt100.c --------------------------------------------------------------------------------