mirror of
https://github.com/86Box/probing-tools.git
synced 2026-02-24 20:35:34 -07:00
viakey: Add utility based on Discord source drop
This commit is contained in:
12
viakey/README.md
Normal file
12
viakey/README.md
Normal file
@@ -0,0 +1,12 @@
|
||||
viakey
|
||||
======
|
||||
DOS tool for probing VIA VT82C42N keyboard controllers.
|
||||
|
||||
Usage
|
||||
-----
|
||||
Run `VIAKEY.COM`. If a VT82C42N keyboard controller is found (either standalone or integrated to a VIA southbridge), its revision code will be displayed. Any errors in the probing process will be displayed on screen.
|
||||
|
||||
Building
|
||||
--------
|
||||
* **Windows:** Run `build.bat VIAKEY` with [NewBasic](http://www.fysnet.net/newbasic.htm) present in `%PATH%`.
|
||||
* **Other platforms:** This tool is only guaranteed to assemble and function properly with the (DOS- and Windows-only) NewBasic assembler, but feel free to try other assemblers.
|
||||
172
viakey/VIAKEY.ASM
Normal file
172
viakey/VIAKEY.ASM
Normal file
@@ -0,0 +1,172 @@
|
||||
;
|
||||
; 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
; running old operating systems and software designed for IBM
|
||||
; PC systems and compatibles from 1981 through fairly recent
|
||||
; system designs based on the PCI bus.
|
||||
;
|
||||
; This file is part of the 86Box Probing Tools distribution.
|
||||
;
|
||||
; VIA VT82C42N keyboard controller probing tool.
|
||||
;
|
||||
;
|
||||
;
|
||||
; Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
;
|
||||
; Copyright 2021 Miran Grca.
|
||||
;
|
||||
|
||||
.model tiny
|
||||
.386
|
||||
.code
|
||||
|
||||
start:
|
||||
jmp real_start
|
||||
|
||||
wait_for_nibf:
|
||||
push ax
|
||||
mov cx,0010h
|
||||
nibf_push_cx:
|
||||
push cx
|
||||
xor cx,cx
|
||||
nibf_in:
|
||||
in al,64h
|
||||
test al,2
|
||||
loopne nibf_in
|
||||
pop cx
|
||||
loopne nibf_push_cx
|
||||
pop ax
|
||||
ret
|
||||
|
||||
wait_for_obf:
|
||||
push ax
|
||||
mov cx,0010h
|
||||
obf_push_cx:
|
||||
push cx
|
||||
xor cx,cx
|
||||
obf_in:
|
||||
in al,64h
|
||||
test al,1
|
||||
loope obf_in
|
||||
pop cx
|
||||
loope obf_push_cx
|
||||
pop ax
|
||||
ret
|
||||
|
||||
print_string:
|
||||
mov ah,9
|
||||
int 21h
|
||||
ret
|
||||
|
||||
convert_digit:
|
||||
and al,0fh
|
||||
add al,30h
|
||||
cmp al,39h
|
||||
ja short digit_is_letter
|
||||
jmp short output_digit
|
||||
digit_is_letter:
|
||||
add al,7
|
||||
output_digit:
|
||||
mov [si],al
|
||||
inc si
|
||||
ret
|
||||
|
||||
convert_to_hex:
|
||||
push ax
|
||||
push ax
|
||||
shr al,4
|
||||
call convert_digit
|
||||
pop ax
|
||||
call convert_digit
|
||||
pop ax
|
||||
ret
|
||||
|
||||
viakey_test:
|
||||
xor dx,dx
|
||||
mov al,0afh
|
||||
out 64h,al
|
||||
call wait_for_nibf
|
||||
jnz gcv_stuck
|
||||
call wait_for_obf
|
||||
jz not_viakey
|
||||
in al,60h
|
||||
mov si,offset ver
|
||||
call convert_to_hex
|
||||
mov byte [erl],0
|
||||
jmp short viakey_ret
|
||||
not_viakey:
|
||||
mov byte [erl],3
|
||||
jmp short viakey_ret
|
||||
gcv_stuck:
|
||||
mov byte [erl],2
|
||||
viakey_ret:
|
||||
ret
|
||||
|
||||
disable_kbd:
|
||||
mov al,0adh
|
||||
out 64h,al
|
||||
call wait_for_nibf
|
||||
jz dkbd_ret
|
||||
mov byte [erl],1
|
||||
dkbd_ret:
|
||||
ret
|
||||
|
||||
enable_kbd:
|
||||
mov al,0aeh
|
||||
out 64h,al
|
||||
call wait_for_nibf
|
||||
jz ekbd_ret
|
||||
mov byte [erl],4
|
||||
ekbd_ret:
|
||||
ret
|
||||
|
||||
print_out:
|
||||
mov si,[erl]
|
||||
shl si,1
|
||||
add si,offset strs
|
||||
mov dx,[si]
|
||||
call print_string
|
||||
ret
|
||||
|
||||
new_cmd db 57h
|
||||
saved_cmd
|
||||
db 0
|
||||
erl dw 0
|
||||
strs dw offset succ,offset err_1,offset err_2,offset err_3,offset err_4
|
||||
|
||||
succ db "VIA VT82C42N detected: "
|
||||
ver db "0",0dh,0ah
|
||||
copr dup 512, 0
|
||||
db 0dh,0ah,'$'
|
||||
err_1 db "Disable Keyboard command stuck",0dh,0ah,'$'
|
||||
err_2 db "Get Controller Version command stuck",0dh,0ah,'$'
|
||||
err_3 db "VIA VT82C42N not detected",0dh,0ah,'$'
|
||||
err_4 db "Enable Keyboard command stuck",0dh,0ah,'$'
|
||||
|
||||
|
||||
;ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
;
|
||||
; External Entry Point
|
||||
;
|
||||
;ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
|
||||
real_start:
|
||||
; First round of tests
|
||||
cli
|
||||
call disable_kbd
|
||||
cmp byte [erl],0
|
||||
jnz short stop_tests
|
||||
call viakey_test
|
||||
cmp byte [erl],0
|
||||
jnz short stop_tests
|
||||
stop_tests:
|
||||
call enable_kbd
|
||||
sti
|
||||
call print_out
|
||||
mov al,[erl]
|
||||
cmp al,0
|
||||
mov ah,4ch
|
||||
int 21h
|
||||
|
||||
.end start
|
||||
|
||||
end
|
||||
BIN
viakey/VIAKEY.COM
Normal file
BIN
viakey/VIAKEY.COM
Normal file
Binary file not shown.
35
viakey/build.bat
Normal file
35
viakey/build.bat
Normal file
@@ -0,0 +1,35 @@
|
||||
@echo off
|
||||
:
|
||||
: 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
: running old operating systems and software designed for IBM
|
||||
: PC systems and compatibles from 1981 through fairly recent
|
||||
: system designs based on the PCI bus.
|
||||
:
|
||||
: This file is part of the 86Box Probing Tools distribution.
|
||||
:
|
||||
: Build script for compiling assembly tools with NewBasic.
|
||||
:
|
||||
:
|
||||
:
|
||||
: Authors: RichardG, <richardg867@gmail.com>
|
||||
:
|
||||
: Copyright 2021 RichardG.
|
||||
:
|
||||
|
||||
: Check for NBASM presence.
|
||||
set NBASMBIN=nbasm32
|
||||
%NBASMBIN% /v > NUL 2> NUL
|
||||
if not errorlevel 100 goto build
|
||||
set NBASMBIN=nbasm64
|
||||
%NBASMBIN% /v > NUL 2> NUL
|
||||
if not errorlevel 100 goto build
|
||||
set NBASMBIN=nbasm16
|
||||
%NBASMBIN% /v > NUL 2> NUL
|
||||
if not errorlevel 100 goto build
|
||||
|
||||
: No NBASM found.
|
||||
echo NewBasic not found. Make sure NBASM16/32/64 is present in PATH.
|
||||
exit /b 1
|
||||
|
||||
:build
|
||||
%NBASMBIN% %1.ASM %1.COM
|
||||
Reference in New Issue
Block a user