-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
217 additions
and
26 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Copyright (c) 2019-2024 Andreas T Jonsson <mail@andreasjonsson.se> | ||
// | ||
// This software is provided 'as-is', without any express or implied | ||
// warranty. In no event will the authors be held liable for any damages | ||
// arising from the use of this software. | ||
// | ||
// Permission is granted to anyone to use this software for any purpose, | ||
// including commercial applications, and to alter it and redistribute it | ||
// freely, subject to the following restrictions: | ||
// | ||
// 1. The origin of this software must not be misrepresented; you must not | ||
// claim that you wrote the original software. If you use this software in | ||
// a product, an acknowledgment (see the following) in the product | ||
// documentation is required. | ||
// | ||
// This product make use of the VirtualXT software emulator. | ||
// Visit https://virtualxt.org for more information. | ||
// | ||
// 2. Altered source versions must be plainly marked as such, and must not be | ||
// misrepresented as being the original software. | ||
// | ||
// 3. This notice may not be removed or altered from any source distribution. | ||
|
||
#include <vxt/vxtu.h> | ||
|
||
struct post { | ||
int code; | ||
}; | ||
|
||
static vxt_byte in(struct post *c, vxt_word port) { | ||
(void)port; | ||
return c->code; | ||
} | ||
|
||
static void out(struct post *c, vxt_word port, vxt_byte data) { | ||
(void)port; | ||
c->code = data; | ||
VXT_LOG("0x%01X", data); | ||
} | ||
|
||
static vxt_error install(struct post *c, vxt_system *s) { | ||
struct vxt_pirepheral *p = VXT_GET_PIREPHERAL(c); | ||
vxt_system_install_io_at(s, p, 0x80); | ||
return VXT_NO_ERROR; | ||
} | ||
|
||
static vxt_error reset(struct post *c) { | ||
c->code = 0; | ||
return VXT_NO_ERROR; | ||
} | ||
|
||
static const char *name(struct post *c) { | ||
(void)c; return "Post Card"; | ||
} | ||
|
||
VXTU_MODULE_CREATE(post, { | ||
PIREPHERAL->install = &install; | ||
PIREPHERAL->reset = &reset; | ||
PIREPHERAL->name = &name; | ||
PIREPHERAL->io.in = ∈ | ||
PIREPHERAL->io.out = &out; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
files "post.c" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import sys | ||
import struct | ||
|
||
size = 0 | ||
sum = 0 | ||
|
||
with open(sys.argv[1], "rb") as f: | ||
f.seek(0, os.SEEK_END) | ||
size = f.tell() | ||
f.seek(0, os.SEEK_SET) | ||
|
||
num = size | ||
while num > 1: | ||
sum += int(struct.unpack("B", f.read(1))[0]) | ||
num -= 1 | ||
|
||
sum = (256 - (sum & 0xFF)) & 0xFF | ||
print("BIOS Checksum: 0x{:02X}".format(sum)) | ||
|
||
with open(sys.argv[1], "rb+") as f: | ||
f.seek(size - 1, os.SEEK_SET) | ||
f.write(struct.pack("B", sum)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
; Copyright (c) 2019-2024 Andreas T Jonsson <mail@andreasjonsson.se> | ||
; | ||
; This software is provided 'as-is', without any express or implied | ||
; warranty. In no event will the authors be held liable for any damages | ||
; arising from the use of this software. | ||
; | ||
; Permission is granted to anyone to use this software for any purpose, | ||
; including commercial applications, and to alter it and redistribute it | ||
; freely, subject to the following restrictions: | ||
; | ||
; 1. The origin of this software must not be misrepresented; you must not | ||
; claim that you wrote the original software. If you use this software in | ||
; a product, an acknowledgment (see the following) in the product | ||
; documentation is required. | ||
; | ||
; This product make use of the VirtualXT software emulator. | ||
; Visit https://virtualxt.org for more information. | ||
; | ||
; 2. Altered source versions must be plainly marked as such, and must not be | ||
; misrepresented as being the original software. | ||
; | ||
; 3. This notice may not be removed or altered from any source distribution. | ||
|
||
cpu 8086 | ||
org 256 | ||
|
||
start: | ||
jmp init | ||
|
||
intFC_handler: | ||
out 0xB2, al | ||
iret | ||
|
||
packet_buffer: | ||
times 0x3F00 dd 0 | ||
|
||
end_of_resident: | ||
|
||
init: | ||
lea dx, init_msg | ||
mov ax, 0x900 | ||
int 0x21 | ||
|
||
in al, 0xB2 | ||
cmp al, 0 | ||
jne .no_network | ||
|
||
; Setup buffer | ||
lea dx, [cs:packet_buffer] | ||
mov ah, 0xFF | ||
out 0xB2, al | ||
|
||
mov ax, 0x25FC | ||
mov dx, intFC_handler | ||
int 0x21 | ||
|
||
lea dx, installed_msg | ||
mov ax, 0x900 | ||
int 0x21 | ||
|
||
mov ax, 0x3100 ; Terminate and stay resident. | ||
mov dx, (end_of_resident - start + 256 + 15) >> 4 | ||
int 0x21 | ||
|
||
.no_network: | ||
lea dx, not_network_msg | ||
mov ax, 0x900 | ||
int 0x21 | ||
|
||
; DOS "terminate" function. | ||
mov al, -1 | ||
mov ah, 0x4C | ||
int 0x21 | ||
|
||
init_msg: | ||
db 'VirtualXT extension for Fake86 packet driver', 0xA, 0xD, '$' | ||
|
||
installed_msg: | ||
db 'Driver installed!', 0xA, 0xD, '$' | ||
|
||
not_network_msg: | ||
db 'No network module! Driver not installed.', 0xA, 0xD, '$' |