2022-09-14 21:54:59 -05:00
|
|
|
[BITS 16]
|
2023-01-31 21:26:43 -06:00
|
|
|
[SECTION .v86]
|
2023-02-06 02:27:33 -06:00
|
|
|
global v86Interrupt
|
|
|
|
v86Interrupt:
|
|
|
|
int 0x00
|
|
|
|
int 0x30
|
|
|
|
jmp $
|
|
|
|
|
2022-09-14 21:54:59 -05:00
|
|
|
real_hexprint:
|
|
|
|
xor cx, cx
|
|
|
|
mov bl, al
|
|
|
|
shr al, 4
|
|
|
|
jmp .donibble
|
|
|
|
.nibble2:
|
|
|
|
mov al, bl
|
|
|
|
inc cx
|
|
|
|
.donibble:
|
|
|
|
and al, 0x0F
|
|
|
|
cmp al, 0x0A
|
|
|
|
jl .noadjust
|
|
|
|
add al, 'A' - '0' - 10
|
|
|
|
.noadjust:
|
|
|
|
add al, '0'
|
|
|
|
mov ah, 0x1f
|
|
|
|
stosw
|
|
|
|
test cx, cx
|
|
|
|
jz .nibble2
|
|
|
|
ret
|
|
|
|
real_printword:
|
|
|
|
mov dx, ax
|
|
|
|
mov al, ah
|
|
|
|
call real_hexprint
|
|
|
|
mov ax, dx
|
|
|
|
call real_hexprint
|
|
|
|
ret
|
2023-01-04 19:36:29 -06:00
|
|
|
|
2022-09-19 16:06:01 -05:00
|
|
|
global v86Test
|
|
|
|
v86Test:
|
2022-09-14 21:54:59 -05:00
|
|
|
mov ax, 0xb814
|
|
|
|
mov es, ax
|
|
|
|
mov di, 20
|
|
|
|
mov ax, sp
|
|
|
|
call real_printword
|
|
|
|
add di, 2
|
|
|
|
mov ax, ds
|
|
|
|
call real_printword
|
|
|
|
add di, 2
|
|
|
|
mov ax, cs
|
|
|
|
call real_printword
|
2022-09-16 15:50:58 -05:00
|
|
|
int 3
|
2022-09-14 21:54:59 -05:00
|
|
|
int 0x30 ; exit
|
|
|
|
jmp $
|
2023-01-04 19:36:29 -06:00
|
|
|
|
2023-02-02 01:44:35 -06:00
|
|
|
global v86TransFlag
|
|
|
|
v86TransFlag:
|
|
|
|
push cs
|
|
|
|
pop es
|
|
|
|
mov ax, 0x13
|
|
|
|
int 0x10
|
|
|
|
mov ax,0x1012
|
|
|
|
xor bx,bx
|
|
|
|
mov cx,5
|
|
|
|
mov dx,.c
|
|
|
|
int 0x10
|
|
|
|
push 0xa000
|
|
|
|
pop es
|
|
|
|
xor di,di
|
|
|
|
xor ax,ax
|
|
|
|
.loop:
|
|
|
|
mov cx, 12800
|
|
|
|
rep stosb
|
|
|
|
inc ax
|
|
|
|
cmp ax,5
|
|
|
|
jl .loop
|
|
|
|
int 0x30
|
|
|
|
jmp $
|
|
|
|
.c: db `\0263>=*.\?\?\?=*.\0263>`
|
|
|
|
|
2022-09-19 19:46:26 -05:00
|
|
|
global v86TextMode
|
|
|
|
v86TextMode:
|
|
|
|
mov ax, 0x3
|
|
|
|
int 0x10
|
|
|
|
int 0x30
|
|
|
|
jmp $
|
2023-01-04 19:36:29 -06:00
|
|
|
|
2023-02-02 14:52:26 -06:00
|
|
|
global v86VideoInt
|
|
|
|
v86VideoInt:
|
|
|
|
int 0x10
|
|
|
|
int 0x30
|
|
|
|
jmp $
|
|
|
|
|
2022-09-19 19:46:26 -05:00
|
|
|
global v86DiskRead
|
|
|
|
v86DiskRead:
|
|
|
|
xor ax, ax ; TODO fix assuming we're in first 64k
|
|
|
|
mov ds, ax
|
|
|
|
mov ah, 0x42
|
|
|
|
mov dl, 0x80 ; TODO get this from BIOS or something
|
|
|
|
mov si, v86disk_addr_packet ; ds:si
|
|
|
|
int 0x13
|
|
|
|
int 0x30
|
|
|
|
jmp $
|
2022-09-21 17:14:11 -05:00
|
|
|
global v86disk_addr_packet
|
2022-09-19 19:46:26 -05:00
|
|
|
v86disk_addr_packet:
|
|
|
|
db 0x10, 0x00 ; size, reserved
|
2022-09-21 17:14:11 -05:00
|
|
|
dw 0x1 ; blocks
|
2022-09-19 19:46:26 -05:00
|
|
|
dd 0x23000000 ; transfer buffer 0x23000
|
2022-09-21 17:14:11 -05:00
|
|
|
dq 0x1 ; start block
|