Browse Source

Add PS2INFO

- Replaced kbdinfo with more comprehensive ps2info
- Started process of clarifying licensing
pull/283/head
Wayne Warthen 4 years ago
parent
commit
52cd458e76
  1. BIN
      Doc/ROM Applications.pdf
  2. BIN
      Doc/RomWBW Applications.pdf
  3. BIN
      Doc/RomWBW Architecture.pdf
  4. BIN
      Doc/RomWBW Disk Catalog.pdf
  5. BIN
      Doc/RomWBW Getting Started.pdf
  6. 46
      ReadMe.md
  7. 46
      ReadMe.txt
  8. 2
      Source/Apps/Test/Build.cmd
  9. 2
      Source/Apps/Test/Clean.cmd
  10. 2
      Source/Apps/Test/Makefile
  11. 10
      Source/Apps/Test/kbdinfo/Build.cmd
  12. 896
      Source/Apps/Test/kbdinfo/mseinfo.asm
  13. 10
      Source/Apps/Test/ps2info/Build.cmd
  14. 0
      Source/Apps/Test/ps2info/Clean.cmd
  15. 2
      Source/Apps/Test/ps2info/Makefile
  16. 640
      Source/Apps/Test/ps2info/ps2info.asm
  17. BIN
      Source/Apps/VGM/Tunes/filthy01.vgm
  18. 97
      Source/Doc/GettingStarted.md
  19. 2
      Source/Images/fd_zsdos.txt

BIN
Doc/ROM Applications.pdf

Binary file not shown.

BIN
Doc/RomWBW Applications.pdf

Binary file not shown.

BIN
Doc/RomWBW Architecture.pdf

Binary file not shown.

BIN
Doc/RomWBW Disk Catalog.pdf

Binary file not shown.

BIN
Doc/RomWBW Getting Started.pdf

Binary file not shown.

46
ReadMe.md

@ -3,7 +3,7 @@ author: "Wayne Warthen (mailto:wwarthen@gmail.com)"
classoption: classoption:
- oneside - oneside
colorlinks: true colorlinks: true
date: 08 Dec 2021
date: 03 Jan 2022
documentclass: book documentclass: book
fontfamily: helvet fontfamily: helvet
fontsize: 12pt fontsize: 12pt
@ -44,7 +44,7 @@ toc-depth: 1
## Z80/Z180 System Software ## Z80/Z180 System Software
Version 3.1 Pre-release Version 3.1 Pre-release
08 Dec 2021
03 Jan 2022
Wayne Warthen <wwarthen@gmail.com> Wayne Warthen <wwarthen@gmail.com>
@ -1357,6 +1357,48 @@ applications are no longer provided.
Contributions of all kinds to RomWBW are very welcome. Contributions of all kinds to RomWBW are very welcome.
# Licensing
RomWBW is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your
option) any later version.
RomWBW is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along
with RomWBW. If not, see <https://www.gnu.org/licenses/>.
Portions of RomWBW were created by, contributed by, or derived from the
work of others. It is believed that these works are being used in
accordance with the intentions and/or licensing of their creators.
If anyone feels their work is being used outside of it’s intended
licensing, please notify:
Wayne Warthen
wwarthen@gmail.com
RomWBW is an aggregate work. It is composed of many individual,
standalone programs that are distributed as a whole to function as a
cohesive system. Each program may have it’s own licensing which may be
different from other programs within the aggregate.
In some cases, a single program (e.g., CP/M Operating System) is
composed of multiple components with different licenses. It is believed
that in all such cases the licenses are compatible with GPL version 3.
RomWBW encourages code contributions from others. Contributors may
assert their own copyright in their contributions by annotating the
contributed source code appropriately. Contributors are further
encouraged to submit their contributions via the RomWBW source code
control system to ensure their contributions are clearly documented.
All contributions to RomWBW are subject to this license.
# Getting Assistance # Getting Assistance
The best way to get assistance with RomWBW or any aspect of the The best way to get assistance with RomWBW or any aspect of the

46
ReadMe.txt

@ -1,6 +1,6 @@
RomWBW Getting Started RomWBW Getting Started
Wayne Warthen (mailto:wwarthen@gmail.com) Wayne Warthen (mailto:wwarthen@gmail.com)
08 Dec 2021
03 Jan 2022
@ -17,7 +17,7 @@ RomWBW
Z80/Z180 System Software Z80/Z180 System Software
Version 3.1 Pre-release Version 3.1 Pre-release
08 Dec 2021
03 Jan 2022
Wayne Warthen wwarthen@gmail.com Wayne Warthen wwarthen@gmail.com
@ -1360,6 +1360,48 @@ applications are no longer provided.
Contributions of all kinds to RomWBW are very welcome. Contributions of all kinds to RomWBW are very welcome.
Licensing
RomWBW is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your
option) any later version.
RomWBW is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along
with RomWBW. If not, see https://www.gnu.org/licenses/.
Portions of RomWBW were created by, contributed by, or derived from the
work of others. It is believed that these works are being used in
accordance with the intentions and/or licensing of their creators.
If anyone feels their work is being used outside of it’s intended
licensing, please notify:
Wayne Warthen
wwarthen@gmail.com
RomWBW is an aggregate work. It is composed of many individual,
standalone programs that are distributed as a whole to function as a
cohesive system. Each program may have it’s own licensing which may be
different from other programs within the aggregate.
In some cases, a single program (e.g., CP/M Operating System) is
composed of multiple components with different licenses. It is believed
that in all such cases the licenses are compatible with GPL version 3.
RomWBW encourages code contributions from others. Contributors may
assert their own copyright in their contributions by annotating the
contributed source code appropriately. Contributors are further
encouraged to submit their contributions via the RomWBW source code
control system to ensure their contributions are clearly documented.
All contributions to RomWBW are subject to this license.
Getting Assistance Getting Assistance
The best way to get assistance with RomWBW or any aspect of the The best way to get assistance with RomWBW or any aspect of the

2
Source/Apps/Test/Build.cmd

@ -21,7 +21,7 @@ pushd I2C && call Build || exit /b & popd
pushd rzsz && call Build || exit /b & popd pushd rzsz && call Build || exit /b & popd
pushd vdctest && call Build || exit /b & popd pushd vdctest && call Build || exit /b & popd
pushd kbdtest && call Build || exit /b & popd pushd kbdtest && call Build || exit /b & popd
pushd kbdinfo && call Build || exit /b & popd
pushd ps2info && call Build || exit /b & popd
goto :eof goto :eof

2
Source/Apps/Test/Clean.cmd

@ -16,4 +16,4 @@ pushd I2C && call Clean || exit /b 1 & popd
pushd rzsz && call Clean || exit /b 1 & popd pushd rzsz && call Clean || exit /b 1 & popd
pushd vdctest && call Clean || exit /b 1 & popd pushd vdctest && call Clean || exit /b 1 & popd
pushd kbdtest && call Clean || exit /b 1 & popd pushd kbdtest && call Clean || exit /b 1 & popd
pushd kbdinfo && call Clean || exit /b 1 & popd
pushd ps2info && call Clean || exit /b 1 & popd

2
Source/Apps/Test/Makefile

@ -1,5 +1,5 @@
OBJECTS = OBJECTS =
SUBDIRS = DMAmon I2C inttest ppidetst ramtest tstdskng rzsz vdctest kbdtest kbdinfo
SUBDIRS = DMAmon I2C inttest ppidetst ramtest tstdskng rzsz vdctest kbdtest ps2info
DEST = ../../../Binary/Apps/Test DEST = ../../../Binary/Apps/Test
TOOLS =../../../Tools TOOLS =../../../Tools

10
Source/Apps/Test/kbdinfo/Build.cmd

@ -1,10 +0,0 @@
@echo off
setlocal
set TOOLS=../../../../Tools
set PATH=%TOOLS%\tasm32;%PATH%
set TASMTABS=%TOOLS%\tasm32
tasm -t180 -g3 -fFF kbdinfo.asm kbdinfo.com kbdinfo.lst || exit /b
copy /Y kbdinfo.com ..\..\..\..\Binary\Apps\Test\ || exit /b

896
Source/Apps/Test/kbdinfo/mseinfo.asm

@ -1,896 +0,0 @@
;
;=======================================================================
; Mouse Information Utility (MSEINFO)
;=======================================================================
;
; Simple utility that attempts to determine the status of the mouse you
; have attached to an 8242 keyboard controller.
;
; Based on Wayne Warthen's KBDINFO program, Thanks to his great work
; on RomWBW and support to the Retrobrewcomputers community at large
;
; Additional help from these websites
; https://isdaman.com/alsos/hardware/mouse/ps2interface.htm
;
; Second PS/2 write data port info from
; https://wiki.osdev.org/%228042%22_PS/2_Controller#Second_PS.2F2_Port
;
; PS/2 Mouse initialization code in C
; http://bos.asmhackers.net/docs/mouse/snippet_2/mouse.inc
;
;=======================================================================
;
; Mouse controller port addresses (adjust as needed)
;
iocmd .equ $E3 ; keyboard controller command port address
iodat .equ $E2 ; keyboard controller data port address
;
; General operational equates (should not requre adjustment)
;
stksiz .equ $40 ; Working stack size
;
timeout .equ $00 ; Controller timeout constant
;
restart .equ $0000 ; CP/M restart vector
bdos .equ $0005 ; BDOS invocation vector
;
;=======================================================================
;
.org $100 ; standard CP/M executable
;
;
; setup stack (save old value)
ld (stksav),sp ; save stack
ld sp,stack ; set new stack
;
call crlf
ld de,str_banner ; banner
call prtstr
;
call main ; do the real work
;
exit:
call crlf2
ld de,str_exit
call prtstr
;call crlf
; clean up and return to command processor
call crlf ; formatting
ld sp,(stksav) ; restore stack
jp restart ; return to CP/M via restart
;
;
;=======================================================================
; Main Program
;=======================================================================
;
main:
;
; Display active mouse controller port addresses
;
call crlf2
ld de,str_cmdport
call prtstr
ld a,iocmd
call prthex
call crlf
ld de,str_dataport
call prtstr
ld a,iodat
call prthex
;
; Attempt self-test command on mouse controller
;
; Mouse controller should respond with an 0x55 on data port
; after being sent a 0xAA on the command port.
;
call crlf2
ld de,str_ctrl_test
call prtstr
ld a,$aa ; self-test command
call put_cmd_dbg
jp c,err_ctlr_io ; handle controller error
call get_data_dbg
jp c,err_ctlr_io ; handle controller error
cp $55 ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
ld de,str_ctrl_test_ok
call prtstr
;
; Send 0xA8 Mouse Enable command to 8242 controller
;
call crlf2
ld de,str_enable_mouse
call prtstr
ld a,$a8 ; Send Mouse Enable command to 8242
call put_cmd_dbg
jp c,err_ctlr_io ; handle controller error
call get_data_dbg ; Read Mouse for self-test status
jp c,err_ctlr_io ; handle controller error
cp $AA ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
call get_data_dbg ; Read Mouse for Mouse ID
jp c,err_ctlr_io ; handle controller error
cp $00 ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
;
; Disable translation on keyboard controller to get raw scan codes! Enable Mouse
;
; call crlf2
; ld de,str_trans_off
; call prtstr
; ld a,$60 ; write to command register 0
; call put_cmd_dbg
; jp c,err_ctlr_io ; handle controller error
; ld a,$00 ; xlat disabled, mouse enabled, no ints
; call put_cmd_dbg
; jp c,err_ctlr_io ; handle controller error
; Attempt four reset commands on mouse controller
;
call crlf2
ld de,str_mse_init
call prtstr
; Reset Pass #1
ld a,$ff ; Send Mouse Reset command
call put_data_dbg
jp c,err_ctlr_io ; handle controller error
call get_data_dbg ; Read Mouse for Acknowledge
jp c,err_ctlr_io ; handle controller error
cp $fa ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
ld de,str_ctrl_test_ok
call prtstr
call get_data_dbg ; Read Mouse for self-test status
jp c,err_ctlr_io ; handle controller error
cp $AA ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
call get_data_dbg ; Read Mouse for Mouse ID
jp c,err_ctlr_io ; handle controller error
cp $00 ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
; Reset Pass #2
ld a,$ff ; Send Mouse Reset command
call put_data_dbg
jp c,err_ctlr_io ; handle controller error
call get_data_dbg ; Read Mouse for Acknowledge
jp c,err_ctlr_io ; handle controller error
cp $fa ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
ld de,str_ctrl_test_ok
call prtstr
call get_data_dbg ; Read Mouse for self-test status
jp c,err_ctlr_io ; handle controller error
cp $AA ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
call get_data_dbg ; Read Mouse for Mouse ID
jp c,err_ctlr_io ; handle controller error
cp $00 ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
; Reset Pass #3
ld a,$ff ; Send Mouse Reset command
call put_data_dbg
jp c,err_ctlr_io ; handle controller error
call get_data_dbg ; Read Mouse for Acknowledge
jp c,err_ctlr_io ; handle controller error
cp $fa ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
ld de,str_ctrl_test_ok
call prtstr
call get_data_dbg ; Read Mouse for self-test status
jp c,err_ctlr_io ; handle controller error
cp $AA ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
call get_data_dbg ; Read Mouse for Mouse ID
jp c,err_ctlr_io ; handle controller error
cp $00 ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
; Reset Pass #4
ld a,$ff ; Send Mouse Reset command
call put_data_dbg
jp c,err_ctlr_io ; handle controller error
call get_data_dbg ; Read Mouse for Acknowledge
jp c,err_ctlr_io ; handle controller error
cp $fa ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
ld de,str_ctrl_test_ok
call prtstr
call get_data_dbg ; Read Mouse for self-test status
jp c,err_ctlr_io ; handle controller error
cp $AA ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
call get_data_dbg ; Read Mouse for Mouse ID
jp c,err_ctlr_io ; handle controller error
cp $00 ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
; Begin setting mouse parameters, Request Microsoft Scrolling Mouse Mode
ld a,$f3 ; Send Set Sample Rate command
call put_data_dbg
jp c,err_ctlr_io ; handle controller error
call get_data_dbg ; Read Mouse for Acknowledge
jp c,err_ctlr_io ; handle controller error
cp $fa ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
ld de,str_ctrl_test_ok
call prtstr
ld a,$c8 ; Send Decimal 200 command
call put_data_dbg
jp c,err_ctlr_io ; handle controller error
call get_data_dbg ; Read Mouse for Acknowledge
jp c,err_ctlr_io ; handle controller error
cp $fa ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
ld de,str_ctrl_test_ok
call prtstr
ld a,$f3 ; Send Set Sample Rate command
call put_data_dbg
jp c,err_ctlr_io ; handle controller error
call get_data_dbg ; Read Mouse for Acknowledge
jp c,err_ctlr_io ; handle controller error
cp $fa ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
ld de,str_ctrl_test_ok
call prtstr
ld a,$64 ; Send Decimal 100 command
call put_data_dbg
jp c,err_ctlr_io ; handle controller error
call get_data_dbg ; Read Mouse for Acknowledge
jp c,err_ctlr_io ; handle controller error
cp $fa ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
ld de,str_ctrl_test_ok
call prtstr
ld a,$f3 ; Send Set Sample Rate command
call put_data_dbg
jp c,err_ctlr_io ; handle controller error
call get_data_dbg ; Read Mouse for Acknowledge
jp c,err_ctlr_io ; handle controller error
cp $fa ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
ld de,str_ctrl_test_ok
call prtstr
ld a,$50 ; Send Decimal 80 command
call put_data_dbg
jp c,err_ctlr_io ; handle controller error
call get_data_dbg ; Read Mouse for Acknowledge
jp c,err_ctlr_io ; handle controller error
cp $fa ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
ld de,str_ctrl_test_ok
call prtstr
ld a,$f2 ; Send Read Device Type command
call put_data_dbg
jp c,err_ctlr_io ; handle controller error
call get_data_dbg ; Read Mouse for Acknowledge
jp c,err_ctlr_io ; handle controller error
cp $fa ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
ld de,str_ctrl_test_ok
call prtstr
call get_data_dbg ; Read Mouse for Mouse ID
jp c,err_ctlr_io ; handle controller error
cp $03 ; detect MS Intellimouse/Microsoft Scrolling Mouse
jp z,Intellimouse
cp $00 ; expected value? ($00 if Regular PS/2 Mouse)
jp z,ReadMouseID
Intellimouse:
call crlf
ld de,str_intellimouse_ok
call prtstr
ReadMouseID:
jp nz,err_ctlr_test ; handle self-test error
call crlf
ld a,$f3 ; Send Set Sample Rate command
call put_data_dbg
jp c,err_ctlr_io ; handle controller error
call get_data_dbg ; Read Mouse for Acknowledge
jp c,err_ctlr_io ; handle controller error
cp $fa ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
ld de,str_ctrl_test_ok
call prtstr
ld a,$0a ; Send Decimal 10 command
call put_data_dbg
jp c,err_ctlr_io ; handle controller error
call get_data_dbg ; Read Mouse for Acknowledge
jp c,err_ctlr_io ; handle controller error
cp $fa ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
ld de,str_ctrl_test_ok
call prtstr
ld a,$f2 ; Send Read Device Type command
call put_data_dbg
jp c,err_ctlr_io ; handle controller error
call get_data_dbg ; Read Mouse for Acknowledge
jp c,err_ctlr_io ; handle controller error
cp $fa ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
ld de,str_ctrl_test_ok
call prtstr
call get_data_dbg ; Read Mouse for Mouse ID
jp c,err_ctlr_io ; handle controller error
cp $03 ; detect MS Intellimouse/Microsoft Scrolling Mouse
jp z,Intellimouse2
cp $00 ; expected value? ($00 if Regular PS/2 Mouse)
jp z,ReadMouseID2
Intellimouse2:
call crlf
ld de,str_intellimouse_ok
call prtstr
ReadMouseID2:
jp nz,err_ctlr_test ; handle self-test error
call crlf
ld a,$e8 ; Send Set Resolution command
call put_data_dbg
jp c,err_ctlr_io ; handle controller error
call get_data_dbg ; Read Mouse for Acknowledge
jp c,err_ctlr_io ; handle controller error
cp $fa ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
ld de,str_ctrl_test_ok
call prtstr
ld a,$03 ; Send 8 Counts/mm command
call put_data_dbg
jp c,err_ctlr_io ; handle controller error
call get_data_dbg ; Read Mouse for Acknowledge
jp c,err_ctlr_io ; handle controller error
cp $fa ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
ld de,str_ctrl_test_ok
call prtstr
ld a,$e6 ; Send Set Scaling 1:1 command
call put_data_dbg
jp c,err_ctlr_io ; handle controller error
call get_data_dbg ; Read Mouse for Acknowledge
jp c,err_ctlr_io ; handle controller error
cp $fa ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
ld de,str_ctrl_test_ok
call prtstr
ld a,$f3 ; Send Set Sample Rate command
call put_data_dbg
jp c,err_ctlr_io ; handle controller error
call get_data_dbg ; Read Mouse for Acknowledge
jp c,err_ctlr_io ; handle controller error
cp $fa ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
ld de,str_ctrl_test_ok
call prtstr
ld a,$28 ; Send Decimal 40 command
call put_data_dbg
jp c,err_ctlr_io ; handle controller error
call get_data_dbg ; Read Mouse for Acknowledge
jp c,err_ctlr_io ; handle controller error
cp $fa ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
ld de,str_ctrl_test_ok
call prtstr
ld a,$f4 ; Send Enable command
call put_data_dbg
jp c,err_ctlr_io ; handle controller error
call get_data_dbg ; Read Mouse for Acknowledge
jp c,err_ctlr_io ; handle controller error
cp $fa ; expected value?
jp nz,err_ctlr_test ; handle self-test error
call crlf
ld de,str_ctrl_test_ok
call prtstr
; Initialization Complete
ReadMousePackets:
; call check_read
; jp nz, ReadMousePackets
call get_data_dbg ; Read Mouse for self-test status
jp c,err_ctlr_io ; handle controller error
call crlf
call get_data_dbg ; Read Mouse for Mouse ID
jp c,err_ctlr_io ; handle controller error
call crlf
call get_data_dbg ; Read Mouse for Mouse ID
jp c,err_ctlr_io ; handle controller error
call crlf
call crlf
jp ReadMousePackets
;
done:
ret
;
;=======================================================================
; Mouse Controller I/O Routines
;=======================================================================
;
wait_write:
;
; Wait for mouse controller to be ready for a write
; A=0 indicates success (ZF set)
;
ld b,timeout ; setup timeout constant
wait_write1:
in a,(iocmd) ; get status
ld c,a ; save status
and $02 ; isolate input buf status bit
ret z ; 0 means ready, all done
call delay ; wait a bit
djnz wait_write1 ; loop until counter exhausted
ld de,str_timeout_write ; write timeout message
call crlf
call prtstr
ld a,c ; recover last status value
call prthex
or $ff ; signal error
ret
;
wait_read:
;
; Wait for mouse controller to be ready to read a byte
; A=0 indicates success (ZF set)
;
ld b,timeout ; setup timeout constant
wait_read1:
in a,(iocmd) ; get status
ld c,a ; save status
and $01 ; isolate input buf status bit
xor $01 ; invert so 0 means ready
ret z ; if 0, all done
call delay ; wait a bit
djnz wait_read1 ; loop until counter exhausted
ld de,str_timeout_read ; write timeout message
call crlf
call prtstr
ld a,c ; recover last status value
call prthex
or $ff ; signal error
ret
;
check_read:
;
; Check for data ready to read
; A=0 indicates data available (ZF set)
;
in a,(iocmd) ; get status
and $01 ; isolate input buf status bit
xor $01 ; invert so 0 means ready
ret
;
put_cmd:
;
; Put a cmd byte from A to the mouse interface with timeout
; CF set indicates timeout error
;
ld e,a ; save incoming value
call wait_write ; wait for controller ready
jr z,put_cmd1 ; if ready, move on
scf ; else, signal timeout error
ret ; and bail out
put_cmd1:
ld a,e ; recover value to write
out (iocmd),a ; write it
or a ; clear CF for success
ret
;
put_cmd_dbg:
call put_cmd
ret c
push af
call crlf
ld de,str_put_cmd
call prtstr
call prthex
pop af
ret
;
put_data:
;
; Put a data byte from A to the mouse interface with timeout
; CF set indicates timeout error
;
; note: direct data to second PS/2 port, send $d4 to 8242 command register
; different than keyboard which uses first PS/2 port
push af ; save contents of a
ld e,a ; save incoming value
call wait_write ; wait for controller ready
jr z,put_data0 ; if ready, move on
scf ; else, signal timeout error
ret ; and bail out
put_data0:
ld a,$d4 ; direct to second PS/2 port for mouse
out (iocmd),a ; send second port command to 8242
pop af
; rest of put_data is the same as for PS/2 keyboard
ld e,a ; save incoming value
call wait_write ; wait for controller ready
jr z,put_data1 ; if ready, move on
scf ; else, signal timeout error
ret ; and bail out
put_data1:
ld a,e ; recover value to write
out (iodat),a ; write it
or a ; clear CF for success
ret
;
put_data_dbg:
call put_data
ret c
push af
call crlf
ld de,str_put_data
call prtstr
call prthex
pop af
ret
;
; Get a data byte from the mouse interface to A with timeout
; CF set indicates timeout error
;
get_data:
;
call wait_read ; wait for byte to be ready
jr z,get_data1 ; if ready, move on
scf ; else signal timeout error
ret ; and bail out
get_data1:
in a,(iodat) ; get data byte
or a ; clear CF for success
ret
;
get_data_dbg:
call get_data
ret c
push af
call crlf
ld de,str_get_data
call prtstr
call prthex
pop af
ret
;
; Error Handlers
;
err_ctlr_io:
ld de,str_err_ctrl_io
jr err_ret
;
err_ctlr_test:
ld de,str_err_ctrl_test
jr err_ret
;
err_mse_reset:
ld de,str_err_mse_reset
jr err_ret
;
err_ret:
call crlf2
call prtstr
or $ff ; signal error
ret
;
;=======================================================================
; Utility Routines
;=======================================================================
;
;
; Print character in A without destroying any registers
;
prtchr:
push bc ; save registers
push de
push hl
ld e,a ; character to print in E
ld c,$02 ; BDOS function to output a character
call bdos ; do it
pop hl ; restore registers
pop de
pop bc
ret
;
prtdot:
;
; shortcut to print a dot preserving all regs
push af ; save af
ld a,'.' ; load dot char
call prtchr ; print it
pop af ; restore af
ret ; done
;
; Print a zero terminated string at (de) without destroying any registers
;
prtstr:
push af
push de
;
prtstr1:
ld a,(de) ; get next char
or a
jr z,prtstr2
call prtchr
inc de
jr prtstr1
;
prtstr2:
pop de ; restore registers
pop af
ret
;
; Print the value in A in hex without destroying any registers
;
prthex:
push af ; save AF
push de ; save DE
call hexascii ; convert value in A to hex chars in DE
ld a,d ; get the high order hex char
call prtchr ; print it
ld a,e ; get the low order hex char
call prtchr ; print it
pop de ; restore DE
pop af ; restore AF
ret ; done
;
; print the hex word value in hl
;
prthexword:
push af
ld a,h
call prthex
ld a,l
call prthex
pop af
ret
;
; print the hex dword value in de:hl
;
prthex32:
push bc
push de
pop bc
call prthexword
push hl
pop bc
call prthexword
pop bc
ret
;
; Convert binary value in A to ascii hex characters in DE
;
hexascii:
ld d,a ; save A in D
call hexconv ; convert low nibble of A to hex
ld e,a ; save it in E
ld a,d ; get original value back
rlca ; rotate high order nibble to low bits
rlca
rlca
rlca
call hexconv ; convert nibble
ld d,a ; save it in D
ret ; done
;
; Convert low nibble of A to ascii hex
;
hexconv:
and $0F ; low nibble only
add a,$90
daa
adc a,$40
daa
ret
;
; Print value of A or HL in decimal with leading zero suppression
; Use prtdecb for A or prtdecw for HL
;
prtdecb:
push hl
ld h,0
ld l,a
call prtdecw ; print it
pop hl
ret
;
prtdecw:
push af
push bc
push de
push hl
call prtdec0
pop hl
pop de
pop bc
pop af
ret
;
prtdec0:
ld e,'0'
ld bc,-10000
call prtdec1
ld bc,-1000
call prtdec1
ld bc,-100
call prtdec1
ld c,-10
call prtdec1
ld e,0
ld c,-1
prtdec1:
ld a,'0' - 1
prtdec2:
inc a
add hl,bc
jr c,prtdec2
sbc hl,bc
cp e
ret z
ld e,0
call prtchr
ret
;
; Start a new line
;
crlf2:
call crlf ; two of them
crlf:
push af ; preserve AF
ld a,13 ; <CR>
call prtchr ; print it
ld a,10 ; <LF>
call prtchr ; print it
pop af ; restore AF
ret
;
; Brief delay
;
delay:
push bc
ld b,0
delay1:
ex (sp),hl
ex (sp),hl
ex (sp),hl
ex (sp),hl
ex (sp),hl
ex (sp),hl
ex (sp),hl
ex (sp),hl
djnz delay1
pop bc
ret
;
;=======================================================================
; Constants
;=======================================================================
;
str_banner .db "Mouse Information, v0.1",0
str_exit .db "Done, Thank you for using MSEINFO!",0
str_cmdport .db "Mouse Controller Command Port: 0x",0
str_dataport .db "Mouse Controller Data Port: 0x",0
str_timeout_write .db "Mouse Controller Write Timeout, Status: 0x",0
str_timeout_read .db "Mouse Controller Read Timeout, Status: 0x",0
str_err_ctrl_io .db "Mouse Controller I/O Failure",0
str_err_ctrl_test .db "Mouse Controller Self-Test Failed",0
str_put_cmd .db "Sent Command 0x",0
str_put_data .db "Sent Data 0x",0
str_get_data .db "Got Data 0x",0
str_ctrl_test .db "Attempting Controller Self-Test",0
str_mse_init .db "Attempting Mouse Initialization",0
str_enable_mouse .db "Enabling Mouse in 8242 Controller",0
str_ctrl_test_ok .db "Controller Self-Test OK",0
str_intellimouse_ok .db "MS Intellimouse OK",0
str_trans_off .db "Disabling Controller Translation",0
str_mse_reset .db "Attempting Mouse Reset",0
str_mse_reset_ok .db "Mouse Reset OK",0
str_err_mse_reset .db "Mouse Reset Failed",0
;
;=======================================================================
; Working data
;=======================================================================
;
stksav .dw 0 ; stack pointer saved at start
.fill stksiz,0 ; stack
stack .equ $ ; stack top
;
workbuf .fill 8
workbuf_len .db 0
;
;=======================================================================
;
.end

10
Source/Apps/Test/ps2info/Build.cmd

@ -0,0 +1,10 @@
@echo off
setlocal
set TOOLS=../../../../Tools
set PATH=%TOOLS%\tasm32;%PATH%
set TASMTABS=%TOOLS%\tasm32
tasm -t180 -g3 -fFF ps2info.asm ps2info.com ps2info.lst || exit /b
copy /Y ps2info.com ..\..\..\..\Binary\Apps\Test\ || exit /b

0
Source/Apps/Test/kbdinfo/Clean.cmd → Source/Apps/Test/ps2info/Clean.cmd

2
Source/Apps/Test/kbdinfo/Makefile → Source/Apps/Test/ps2info/Makefile

@ -1,4 +1,4 @@
OBJECTS = kbdinfo.com
OBJECTS = ps2info.com
DEST = ../../../../Binary/Apps/Test DEST = ../../../../Binary/Apps/Test
TOOLS =../../../../Tools TOOLS =../../../../Tools

640
Source/Apps/Test/kbdinfo/kbdinfo.asm → Source/Apps/Test/ps2info/ps2info.asm

@ -1,17 +1,17 @@
; ;
;======================================================================= ;=======================================================================
; Keyboard Information Utility (KBDINFO)
; PS/2 Keyboard/Mouse Information Utility (PS2INFO)
;======================================================================= ;=======================================================================
; ;
; Simple utility that attempts to determine the type of keyboard you
; have attached to an 8242 keyboard controller.
; Simple utility that performs simple tests of an 8242 PS/2 controller,
; keyboard, and mouse.
; ;
;======================================================================= ;=======================================================================
; ;
; Keyboard controller port addresses (adjust as needed)
; PS/2 Keyboard/Mouse controller port addresses (adjust as needed)
; ;
iocmd .equ $E3 ; keyboard controller command port address
iodat .equ $E2 ; keyboard controller data port address
iocmd .equ $E3 ; PS/2 controller command port address
iodat .equ $E2 ; PS/2 controller data port address
; ;
cpumhz .equ 8 ; for time delay calculations (not critical) cpumhz .equ 8 ; for time delay calculations (not critical)
; ;
@ -39,10 +39,6 @@ bdos .equ $0005 ; BDOS invocation vector
call prtstr call prtstr
; ;
call main ; do the real work call main ; do the real work
jr z,exit ; completed all tests
ld de,str_run_failed
call crlf2
call prtstr
; ;
exit: exit:
call crlf2 call crlf2
@ -61,7 +57,7 @@ exit:
; ;
main: main:
; ;
; Display active keyboard controller port addresses
; Display active controller port addresses
; ;
call crlf2 call crlf2
ld de,str_cmdport ld de,str_cmdport
@ -73,16 +69,66 @@ main:
call prtstr call prtstr
ld a,iodat ld a,iodat
call prthex call prthex
;
call test_ctlr
jr z,main0 ; continue if ctlr OK
ld de,str_kbd_failed
call crlf2
call prtstr
jr mainz ; bail out if ctlr fails
;
main0:
call test_kbd
jr z,main1 ; completed all tests, continue
ld de,str_kbd_failed
call crlf2
call prtstr
;
main1:
call test_mse
jr z,main2 ; completed all tests, continue
ld de,str_mse_failed
call crlf2
call prtstr
;
main2:
call test_kbdmse
;
mainz:
xor a
ret
;
; Test 8242 PS/2 Controller
;
test_ctlr:
call crlf2
ld de,str_ctlr
call prtstr
;
call ctlr_test
ret nz
;
call ctlr_test_p1
;ret nz
;
call ctlr_test_p2
;ret nz
;
ret
;
; Test Keyboard
;
test_kbd:
; ;
; First, we attempt to contact the controller and keyboard, then ; First, we attempt to contact the controller and keyboard, then
; print the keyboard identity and scan codes scupported
; print the keyboard identity and scan codes supported
; ;
; Run test series with translation off ; Run test series with translation off
call crlf2 call crlf2
ld de,str_basic ld de,str_basic
call prtstr call prtstr
; ;
call do_basic
call test_kbd_basic
ret nz ret nz
; ;
; We make two passes through the test series with different controller ; We make two passes through the test series with different controller
@ -94,29 +140,78 @@ main:
ld de,str_trans_off ld de,str_trans_off
call prtstr call prtstr
; ;
ld a,$20 ; xlat disabled, mouse disabled, no ints
ld a,$20 ; kbd enabled, xlat disabled, mouse disabled, no ints
ld (ctlr_cfgval),a ld (ctlr_cfgval),a
call do_tests
call test_kbd_keys
; ;
; Run test series with translation on ; Run test series with translation on
call crlf2 call crlf2
ld de,str_trans_on ld de,str_trans_on
call prtstr call prtstr
; ;
ld a,$60 ; xlat enabled, mouse disabled, no ints
ld a,$60 ; kbd enabled, xlat enabled, mouse disabled, no ints
ld (ctlr_cfgval),a ld (ctlr_cfgval),a
call do_tests
call test_kbd_keys
;
ret
;
; Test Mouse
;
test_mse:
call crlf2
ld de,str_basic_mse
call prtstr
;
ld a,$10 ; kbd disabled, mse enabled, no ints
call ctlr_setup
ret nz
;
call mse_reset
ret nz
;
call mse_ident
ret nz
;
call mse_stream
ret nz
;
call mse_echo
;
xor a ; signal success xor a ; signal success
ret ret
; ;
; Perform basic keyboard tests, display keyboard identity, and
; inventory the supported scan code sets.
; Test Everything
; ;
do_basic:
call ctlr_test
test_kbdmse:
call crlf2
ld de,str_kbdmse
call prtstr
;
ld a,$00 ; kbd enabled, mse enabled, no ints
call ctlr_setup
ret nz ret nz
; ;
call kbd_reset
ret nz
;
ld a,2
call kbd_setsc
;
call mse_reset
ret nz
;
call mse_stream
ret nz
;
call kbdmse_echo
;
xor a ; signal success
ret
;
; Perform basic keyboard tests, display keyboard identity, and
; inventory the supported scan code sets.
;
test_kbd_basic:
ld a,$20 ; Xlat off for this checking ld a,$20 ; Xlat off for this checking
call ctlr_setup call ctlr_setup
ret nz ret nz
@ -129,7 +224,7 @@ do_basic:
; ;
ld b,3 ; Loop control, 3 scan code sets ld b,3 ; Loop control, 3 scan code sets
ld c,1 ; Current scan code number ld c,1 ; Current scan code number
do_basic1:
test_kbd_basic1:
ld a,c ; Scan code set to A ld a,c ; Scan code set to A
push bc push bc
call kbd_setsc ; Attempt to set it call kbd_setsc ; Attempt to set it
@ -142,12 +237,12 @@ do_basic1:
call prtdecb call prtdecb
pop af ; restore result pop af ; restore result
ld de,str_sc_ok ld de,str_sc_ok
jr z,do_basic2
jr z,test_kbd_basic2
ld de,str_sc_fail ld de,str_sc_fail
do_basic2:
test_kbd_basic2:
call prtstr call prtstr
inc c inc c
djnz do_basic1
djnz test_kbd_basic1
; ;
xor a ; signal success xor a ; signal success
ret ret
@ -156,10 +251,7 @@ do_basic2:
; desired controller setup value should be placed in ctlr_cfgval ; desired controller setup value should be placed in ctlr_cfgval
; prior to invoking this routine. ; prior to invoking this routine.
; ;
do_tests:
call ctlr_test
ret nz
;
test_kbd_keys:
ld a,(ctlr_cfgval) ld a,(ctlr_cfgval)
call ctlr_setup call ctlr_setup
ret nz ret nz
@ -177,19 +269,19 @@ do_tests:
call kbd_dispsc call kbd_dispsc
;ret nz ;ret nz
; ;
call kbd_showkeys
call kbd_echo
;ret nz ;ret nz
; ;
xor a ; signal success xor a ; signal success
ret ret
; ;
;======================================================================= ;=======================================================================
; Keyboard/Controller Test Routines
; Controller/Keyboard/Mouse Test Routines
;======================================================================= ;=======================================================================
; ;
; Attempt self-test command on keyboard controller
; Attempt self-test command on PS/2 controller
; ;
; Keyboard controller should respond with an 0x55 on data port
; PS/2 controller should respond with an 0x55 on data port
; after being sent a 0xAA on the command port. ; after being sent a 0xAA on the command port.
; ;
ctlr_test: ctlr_test:
@ -209,9 +301,47 @@ ctlr_test:
xor a xor a
ret ret
; ;
; Keyboard controller setup
; Attempt self-test of first port of controller
;
ctlr_test_p1:
call crlf2
ld de,str_ctlr_test_p1
call prtstr
ld a,$ab ; self-test first port
call put_cmd_dbg
jp c,err_ctlr_to ; handle controller error
call get_data_dbg
jp c,err_ctlr_to ; handle controller error
cp $00 ; expected value?
jp nz,err_ctlr_test_p1 ; handle self-test error
call crlf
ld de,str_ctlr_test_p1_ok
call prtstr
xor a
ret
;
; Attempt self-test of second port of controller
; ;
; Set keyboard controller command register to value in A
ctlr_test_p2:
call crlf2
ld de,str_ctlr_test_p2
call prtstr
ld a,$a9 ; self-test second port
call put_cmd_dbg
jp c,err_ctlr_to ; handle controller error
call get_data_dbg
jp c,err_ctlr_to ; handle controller error
cp $00 ; expected value?
jp nz,err_ctlr_test_p2 ; handle self-test error
call crlf
ld de,str_ctlr_test_p2_ok
call prtstr
xor a
ret
;
; PS/2 controller setup
;
; Set controller command register to value in A
; ;
ctlr_setup: ctlr_setup:
push af ; save incoming value push af ; save incoming value
@ -243,7 +373,7 @@ kbd_reset:
jp nz,err_kbd_reset jp nz,err_kbd_reset
call get_data_dbg call get_data_dbg
jp c,err_ctlr_to ; handle controller error jp c,err_ctlr_to ; handle controller error
cp $AA ; Success?
cp $aa ; Success?
jp nz,err_kbd_reset jp nz,err_kbd_reset
call crlf call crlf
ld de,str_kbd_reset_ok ld de,str_kbd_reset_ok
@ -313,7 +443,7 @@ kbd_ident4:
xor a xor a
ret ret
; ;
; Display active scan code set being used
; Display keyboard active scan code set being used
; ;
kbd_dispsc: kbd_dispsc:
call crlf2 call crlf2
@ -344,7 +474,7 @@ kbd_dispsc:
xor a xor a
ret ret
; ;
; Set active scan code set to value in A
; Set keyboard active scan code set to value in A
; ;
kbd_setsc: kbd_setsc:
ld (kbd_setsc_val),a ; Save incoming value ld (kbd_setsc_val),a ; Save incoming value
@ -371,10 +501,9 @@ kbd_setsc:
; ;
kbd_setsc_val .db 0 kbd_setsc_val .db 0
; ;
;
; Read and display raw scan codes ; Read and display raw scan codes
; ;
kbd_showkeys:
kbd_echo:
call crlf2 call crlf2
ld de,str_disp_scan_codes ld de,str_disp_scan_codes
call prtstr call prtstr
@ -384,7 +513,7 @@ read_loop:
call bdos call bdos
cp $1B ; Escape key? cp $1B ; Escape key?
ret z ret z
call check_read
call check_read_kbd
jr nz,read_loop jr nz,read_loop
call get_data call get_data
jp c,err_ctlr_to ; handle controller error jp c,err_ctlr_to ; handle controller error
@ -399,13 +528,255 @@ read_loop:
call prtchr call prtchr
jr read_loop jr read_loop
; ;
; Reset Mouse
;
mse_reset:
call crlf2
ld de,str_mse_reset
call prtstr
ld a,$f2 ; Identify mouse command
call put_data_mse_dbg
jp c,err_ctlr_to ; handle controller error
call get_data_dbg
jp c,err_ctlr_to ; handle controller error
cp $fa ; Is it an ack as expected?
jp nz,err_mse_reset
call crlf
ld de,str_mse_reset_ok
call prtstr
xor a
ret
;
; Identify Mouse
;
mse_ident:
call crlf2
ld de,str_mse_ident
call prtstr
ld a,$f2 ; Identify mouse command
call put_data_mse_dbg
jp c,err_ctlr_to ; handle controller error
call get_data_dbg
jp c,err_ctlr_to ; handle controller error
cp $fa ; Is it an ack as expected?
jp nz,err_mse_ident
call get_data_dbg
jp c,err_ctlr_to ; handle controller error
push af
call crlf
ld de,str_mse_ident_disp
call prtstr
pop af
call prtdecb
xor a
ret
;
; Enable mouse packet streaming
;
mse_stream:
call crlf2
ld de,str_mse_stream
call prtstr
ld a,$f4 ; Stream packets cmd
call put_data_mse_dbg
jp c,err_ctlr_to ; handle controller error
call get_data_dbg
jp c,err_ctlr_to ; handle controller error
cp $FA ; Is it an ack as expected?
jp nz,err_mse_stream
xor a
ret
;
; Read and display raw mouse packets
;
mse_echo:
call crlf2
ld de,str_disp_mse_pkts
call prtstr
call mse_track_disp ; show mouse status
xor a
ld (msebuflen),a
mse_echo1:
ld c,$06 ; BDOS direct console I/O
ld e,$FF ; Subfunction = read
call bdos
cp $1B ; Escape key?
ret z
call check_read_mse
jr nz,mse_echo1
call get_data
jp c,err_ctlr_to ; handle controller error
push af
ld a,(msebuflen) ; current bytes in buf
ld hl,msebuf ; start of buf
call addhla ; point to next buf pos
pop af
ld (hl),a ; save byte in buf
ld a,(msebuflen)
inc a
ld (msebuflen),a ; inc buf len
cp 3 ; got 3 bytes?
jr nz,mse_echo1 ; if not, get some more
call mse_track
call mse_track_disp
jr mse_echo1 ; and loop
;
; Read and display data from keyboard and mouse
;
kbdmse_echo:
call crlf2
ld de,str_disp_kbdmse
call prtstr
xor a
ld (msebuflen),a
call kbdmse_track_disp
;
kbdmse_echo1:
; Check for user abort
ld c,$06 ; BDOS direct console I/O
ld e,$FF ; Subfunction = read
call bdos
cp $1B ; Escape key?
ret z
;
call kbdmse_echo2
call kbdmse_echo3
jr kbdmse_echo1
;
kbdmse_echo2:
; Check & handle keyboard data
call check_read_kbd
ret nz
call get_data
ld (kbd_byte),a
call kbdmse_track_disp
ret
;
kbdmse_echo3:
; Check & handle mouse data
call check_read_mse
ret nz
call get_data
jp c,err_ctlr_to ; handle controller error
push af
ld a,(msebuflen) ; current bytes in buf
ld hl,msebuf ; start of buf
call addhla ; point to next buf pos
pop af
ld (hl),a ; save byte in buf
ld a,(msebuflen)
inc a
ld (msebuflen),a ; inc buf len
cp 3 ; full packet?
ret nz ; if not, loop
call mse_track
call kbdmse_track_disp
ret
;
; Update mouse tracking stuff
; This routine assumes that msebuf has been filled with a complete
; 3 byte mouse packet.
;
mse_track:
; Buttons...
ld a,(msebuf)
ld (mse_stat),a
;
; X Coordinate
ld a,(msebuf+1)
ld e,a
ld d,0
ld a,(msebuf)
and %00010000 ; sign bit
jr z,mse_track_x
ld d,$ff ; sign extend
mse_track_x:
ld hl,(mse_x)
add hl,de
ld (mse_x),hl ; save result
;
; Y Coordinate
ld a,(msebuf+2)
ld e,a
ld d,0
ld a,(msebuf)
and %00100000 ; sign bit
jr z,mse_track_y
ld d,$ff ; sign extend
mse_track_y:
ld hl,(mse_y)
add hl,de
ld (mse_y),hl ; save result
;
; Reset mouse buffer
xor a
ld (msebuflen),a
ret
;
; Display current mouse tracking info (buttons and coordinates)
;
mse_track_disp:
ld a,13 ; CR only
call prtchr
ld de,str_msestat1 ; "L="
call prtstr
ld a,(mse_stat)
and %00000001
call updown
ld de,str_msestat2 ; ", M="
call prtstr
ld a,(mse_stat)
and %00000100
call updown
ld de,str_msestat3 ; ", R="
call prtstr
ld a,(mse_stat)
and %00000010
call updown
;
ld de,str_msestat4 ; ", X="
call prtstr
ld hl,(mse_x) ; save result
call prthexword
;
ld de,str_msestat5 ; ", Y="
call prtstr
ld hl,(mse_y) ; save result
call prthexword
;
ret
;
updown:
jr nz,updown1
ld de,str_up
jr updown2
updown1:
ld de,str_down
updown2:
call prtstr
ret
;
; Display all keyboard and mouse tracking
;
kbdmse_track_disp:
call mse_track_disp
ld a,' '
call prtchr
ld a,'['
call prtchr
ld a,(kbd_byte)
call prthex
ld a,']'
call prtchr
ret
;
;======================================================================= ;=======================================================================
; Keyboard Controller I/O Routines
; PS/2 Controller I/O Routines
;======================================================================= ;=======================================================================
; ;
wait_write: wait_write:
; ;
; Wait for keyboard controller to be ready for a write
; Wait for controller to be ready for a write
; A=0 indicates success (ZF set) ; A=0 indicates success (ZF set)
; ;
ld a,(timeout) ; setup timeout constant ld a,(timeout) ; setup timeout constant
@ -427,7 +798,7 @@ wait_write1:
; ;
wait_read: wait_read:
; ;
; Wait for keyboard controller to be ready to read a byte
; Wait for controller to be ready to read a byte
; A=0 indicates success (ZF set) ; A=0 indicates success (ZF set)
; ;
ld a,(timeout) ; setup timeout constant ld a,(timeout) ; setup timeout constant
@ -458,9 +829,29 @@ check_read:
xor $01 ; invert so 0 means ready xor $01 ; invert so 0 means ready
ret ret
; ;
check_read_kbd:
;
; Check for keyboard data ready to read
; A=0 indicates data available (ZF set)
;
in a,(iocmd) ; get status
and %00100001 ; isolate input buf status bit
cp %00000001 ; data ready, not mouse
ret
;
check_read_mse:
;
; Check for mouse data ready to read
; A=0 indicates data available (ZF set)
;
in a,(iocmd) ; get status
and %00100001 ; isolate input buf status bit
cp %00100001 ; data ready, is mouse
ret
;
put_cmd: put_cmd:
; ;
; Put a cmd byte from A to the keyboard interface with timeout
; Put a cmd byte from A to the controller with timeout
; CF set indicates timeout error ; CF set indicates timeout error
; ;
ld e,a ; save incoming value ld e,a ; save incoming value
@ -484,18 +875,12 @@ put_cmd_dbg:
call prtstr call prtstr
call prthex call prthex
; ld de,str_prefix ; " "
; call prtstr
; call prthex
; ld de,str_cmdout ; "->(CMD)"
; call prtstr
pop af pop af
ret ret
; ;
put_data: put_data:
; ;
; Put a data byte from A to the keyboard interface with timeout
; Put a data byte from A to the controller interface with timeout
; CF set indicates timeout error ; CF set indicates timeout error
; ;
ld e,a ; save incoming value ld e,a ; save incoming value
@ -519,17 +904,41 @@ put_data_dbg:
call prtstr call prtstr
call prthex call prthex
; ld de,str_prefix ; " "
; call prtstr
; call prthex
; ld de,str_dataout ; "->(DATA)"
; call prtstr
pop af pop af
ret ret
;
put_data_mse:
;
; Put a data byte from A to the mouse interface with timeout
; CF set indicates timeout error
;
ld e,a ; save incoming value
push de
ld a,$d4 ; mouse channel prefix
call put_cmd
pop de
ret c
ld a,e ; recover value
call put_data
ret
;
put_data_mse_dbg:
ld e,a ; save incoming value
push de
ld a,$d4 ; mouse channel prefix
call put_cmd_dbg
pop de
ret c
ld a,e ; recover value
call put_data_dbg
ret
; ;
; Get a data byte from the keyboard interface to A with timeout
; Get a data byte from the controller interface to A with timeout
; CF set indicates timeout error ; CF set indicates timeout error
; ;
get_data: get_data:
@ -552,10 +961,6 @@ get_data_dbg:
call prtstr call prtstr
call prthex call prthex
; ld de,str_datain ; " (DATA)->"
; call prtstr
; call prthex
pop af pop af
ret ret
; ;
@ -569,6 +974,14 @@ err_ctlr_test:
ld de,str_err_ctlr_test ld de,str_err_ctlr_test
jr err_ret jr err_ret
; ;
err_ctlr_test_p1:
ld de,str_err_ctlr_test_p1
jr err_ret
;
err_ctlr_test_p2:
ld de,str_err_ctlr_test_p2
jr err_ret
;
err_kbd_reset: err_kbd_reset:
ld de,str_err_kbd_reset ld de,str_err_kbd_reset
jr err_ret jr err_ret
@ -585,6 +998,18 @@ err_kbd_ident:
ld de,str_err_kbd_ident ld de,str_err_kbd_ident
jr err_ret jr err_ret
; ;
err_mse_reset:
ld de,str_err_mse_reset
jr err_ret
;
err_mse_ident:
ld de,str_err_mse_ident
jr err_ret
;
err_mse_stream:
ld de,str_err_mse_stream
jr err_ret
;
err_ret: err_ret:
call crlf2 call crlf2
call prtstr call prtstr
@ -648,7 +1073,6 @@ prthexpre:
call prtchr call prtchr
pop af pop af
ret ret
; ;
; Print the value in A in hex without destroying any registers ; Print the value in A in hex without destroying any registers
; ;
@ -779,6 +1203,17 @@ crlf:
pop af ; restore AF pop af ; restore AF
ret ret
; ;
; Add hl,a
;
; A register is destroyed!
;
addhla:
add a,l
ld l,a
ret nc
inc h
ret
;
; Delay ~10ms ; Delay ~10ms
; ;
delay: delay:
@ -804,30 +1239,36 @@ delay1:
; Constants ; Constants
;======================================================================= ;=======================================================================
; ;
str_banner .db "Keyboard Information v0.2, 23-Dec-2021",0
str_exit .db "Done, Thank you for using Keyboard Information!",0
str_cmdport .db "Keyboard Controller Command Port: ",0
str_dataport .db "Keyboard Controller Data Port: ",0
;str_prefix .db " ",0
;str_cmdout .db "->(CMD)",0
;str_dataout .db "->(DATA)",0
;str_datain .db " (DATA)->",0
;str_timeout_write .db "Keyboard Controller Write Timeout, Status: ",0
;str_timeout_read .db "Keyboard Controller Read Timeout, Status: ",0
str_err_ctlr_to .db "Keyboard Controller I/O Timeout",0
str_err_ctlr_test .db "Keyboard Controller Self-Test Failed",0
str_banner .db "PS/2 Keyboard/Mouse Information v0.4, 7-Jan-2022",0
str_exit .db "Done, Thank you for using PS/2 Keyboard/Mouse Information!",0
str_cmdport .db "Controller Command Port: ",0
str_dataport .db "Controller Data Port: ",0
str_err_ctlr_to .db "Controller I/O Timeout",0
str_err_ctlr_test .db "Controller Self-Test Failed",0
str_put_cmd .db " Sent Command ",0 str_put_cmd .db " Sent Command ",0
str_put_data .db " Sent Data ",0 str_put_data .db " Sent Data ",0
str_get_data .db " Got Data ",0 str_get_data .db " Got Data ",0
str_ctlr_test .db "Attempting Controller Self-Test",0 str_ctlr_test .db "Attempting Controller Self-Test",0
str_ctlr_test_ok .db "Controller Self-Test OK",0 str_ctlr_test_ok .db "Controller Self-Test OK",0
str_ctlr_test_p1 .db "Attempting Self-Test of First Controller Port",0
str_ctlr_test_p1_ok .db "Controller First Port Self-Test OK",0
str_err_ctlr_test_p1 .db "Controller First Port Self-Test Failed",0
str_ctlr_test_p2 .db "Attempting Self-Test of Second Controller Port",0
str_ctlr_test_p2_ok .db "Controller Second Port Self-Test OK",0
str_err_ctlr_test_p2 .db "Controller Second Port Self-Test Failed",0
str_ctlr_setup .db "Performing Controller Setup",0 str_ctlr_setup .db "Performing Controller Setup",0
str_ctlr .db "***** Basic 8242 PS/2 Controller Tests *****",0
str_basic .db "***** Basic Keyboard Checks and Scan Code Inventory *****",0 str_basic .db "***** Basic Keyboard Checks and Scan Code Inventory *****",0
str_trans_off .db "***** Testing with Scan Code Translation DISABLED *****",0
str_trans_on .db "***** Testing with Scan Code Translation ENABLED *****",0
str_trans_off .db "***** Testing Keyboard with Scan Code Translation DISABLED *****",0
str_trans_on .db "***** Testing Keyboard with Scan Code Translation ENABLED *****",0
str_basic_mse .db "***** Basic Mouse Tests *****",0
str_kbdmse .db "***** Test All Devices Combined *****",0
str_kbd_reset .db "Attempting Keyboard Reset",0 str_kbd_reset .db "Attempting Keyboard Reset",0
str_kbd_reset_ok .db "Keyboard Reset OK",0 str_kbd_reset_ok .db "Keyboard Reset OK",0
str_err_kbd_reset .db "Keyboard Reset Failed",0 str_err_kbd_reset .db "Keyboard Reset Failed",0
str_mse_reset .db "Attempting Mouse Reset",0
str_mse_reset_ok .db "Mouse Reset OK",0
str_err_mse_reset .db "Mouse Reset Failed",0
str_kbd_getsc .db "Requesting Active Scan Code Set from Keyboard",0 str_kbd_getsc .db "Requesting Active Scan Code Set from Keyboard",0
str_kbd_dispsc .db "Active Keyboard Scan Code Set is #",0 str_kbd_dispsc .db "Active Keyboard Scan Code Set is #",0
str_err_kbd_getsc .db "Error getting Active Keyboard Scan Code Set",0 str_err_kbd_getsc .db "Error getting Active Keyboard Scan Code Set",0
@ -835,18 +1276,42 @@ str_kbd_setsc .db "Setting Active Keyboard Scan Code Set to #",0
str_err_kbd_setsc .db "Error setting Active Keyboard Scan Code Set",0 str_err_kbd_setsc .db "Error setting Active Keyboard Scan Code Set",0
str_kbd_ident .db "Keyboard Identification",0 str_kbd_ident .db "Keyboard Identification",0
str_kbd_ident_disp .db "Keyboard Identity: ",0 str_kbd_ident_disp .db "Keyboard Identity: ",0
str_mse_ident .db "Mouse Identification",0
str_mse_ident_disp .db "Mouse Identity: ",0
str_mse_stream .db "Enable Mouse Packet Streaming",0
str_err_mse_stream .db "Error enabling Mouse Packet Streaming",0
str_msestat1 .db "L=",0
str_msestat2 .db ", M=",0
str_msestat3 .db ", R=",0
str_msestat4 .db ", X=",0
str_msestat5 .db ", Y=",0
str_up .db "UP",0
str_down .db "DN",0
str_sc_tag .db "Scan Code Set #",0 str_sc_tag .db "Scan Code Set #",0
str_sc_ok .db " IS supported",0 str_sc_ok .db " IS supported",0
str_sc_fail .db " IS NOT supported",0 str_sc_fail .db " IS NOT supported",0
str_err_kbd_ident .db "Error performing Keyboard Identification",0 str_err_kbd_ident .db "Error performing Keyboard Identification",0
str_err_mse_ident .db "Error performing Mouse Identification",0
str_disp_scan_codes .db "Displaying Raw Scan Codes",13,10 str_disp_scan_codes .db "Displaying Raw Scan Codes",13,10
.db " Press keys on test keyboard to display scan codes",13,10 .db " Press keys on test keyboard to display scan codes",13,10
.db " Press <esc> on CP/M console to end",13,10,13,10,0 .db " Press <esc> on CP/M console to end",13,10,13,10,0
str_run_failed .db "***** HARDWARE ERROR *****",13,10,13,10
str_disp_mse_pkts .db "Displaying Mouse Packets",13,10
.db " Move mouse and click mouse buttons",13,10
.db " Press <esc> on CP/M console to end",13,10,13,10,0
str_disp_kbdmse .db "Displaying Keyboard & Mouse Activity",13,10
.db " Press keys on test keyboard to display scan codes",13,10
.db " Move mouse and click mouse buttons",13,10
.db " Press <esc> on CP/M console to end",13,10,13,10,0
str_kbd_failed .db "***** KEYBOARD HARDWARE ERROR *****",13,10,13,10
.db "A basic hardware or configuration issue prevented",13,10 .db "A basic hardware or configuration issue prevented",13,10
.db "Keyboard Information from completing the full set",13,10
.db "of tests. Check your hardware and verify the port",13,10
.db "addresses being used for the keyboard controller",0
.db "the completion of the full set of keyboard tests.",13,10
.db "Check your hardware and verify the port",13,10
.db "addresses being used for the controller",0
str_mse_failed .db "***** MOUSE HARDWARE ERROR *****",13,10,13,10
.db "A basic hardware or configuration issue prevented",13,10
.db "the completion of the full set of mouse tests.",13,10
.db "Check your hardware and verify the port",13,10
.db "addresses being used for the controller",0
; ;
;======================================================================= ;=======================================================================
; Working data ; Working data
@ -859,6 +1324,15 @@ stack .equ $ ; stack top
workbuf .fill 8 workbuf .fill 8
workbuf_len .db 0 workbuf_len .db 0
; ;
msebuf .fill 5,0
msebuflen .db 0
;
mse_stat .db 0
mse_x .dw 0
mse_y .dw 0
;
kbd_byte .db 0
;
ctlr_cfgval .db 0 ; Value for controller cmd reg 0 ctlr_cfgval .db 0 ; Value for controller cmd reg 0
; ;
cpuscl .db cpumhz - 2 cpuscl .db cpumhz - 2

BIN
Source/Apps/VGM/Tunes/filthy01.vgm

Binary file not shown.

97
Source/Doc/GettingStarted.md

@ -1083,7 +1083,7 @@ through the normal startup process just like it was started from ROM.
However, your ROM has not been updated and the next time you boot your However, your ROM has not been updated and the next time you boot your
system, it will revert to the system image contained in ROM. system, it will revert to the system image contained in ROM.
# Upgrading via Flash Utility
## Upgrading via Flash Utility
If you do not have easy access to a ROM programmer, it is usually If you do not have easy access to a ROM programmer, it is usually
possible to reprogram your system ROM using the FLASH utility from possible to reprogram your system ROM using the FLASH utility from
@ -1128,7 +1128,7 @@ system and boot an operating system from ROM. Do not boot from a disk
device yet. Review the boot messages to see if any issues have device yet. Review the boot messages to see if any issues have
occurred. occurred.
# Upgrading via XModem Flash Updater
## Upgrading via XModem Flash Updater
Similar to using the Flash utility, the system ROM can be updated Similar to using the Flash utility, the system ROM can be updated
or upgraded through the ROM based updater utility. This works by or upgraded through the ROM based updater utility. This works by
@ -1143,7 +1143,7 @@ U (Begin Update). Then initiate the Xmodem transfer of the .img or
More information can be found in the ROM Applications document. More information can be found in the ROM Applications document.
# Post Update System Image and Application update process
## Post Upgrade System Image and Application Update Process
Once you are satisfied that the ROM is working well, you will need to Once you are satisfied that the ROM is working well, you will need to
update the system images and RomWBW custom applications on your disk update the system images and RomWBW custom applications on your disk
@ -1214,23 +1214,22 @@ operating system on your disk.
After this is done, you will need to use `SYSCOPY` to place After this is done, you will need to use `SYSCOPY` to place
the ZPM3 loader image on the boot tracks of all ZPM3 the ZPM3 loader image on the boot tracks of all ZPM3
boot disks/slices. The loader image is called `CPMLDR.SYS`.
boot disks/slices. The loader image is called `ZPMLDR.SYS`.
You must then copy (at a minimum) `CPM3.SYS`, `ZCCP.COM`, You must then copy (at a minimum) `CPM3.SYS`, `ZCCP.COM`,
`ZINSTAL.ZPM`, and `STARTZPM.COM` onto the disk/slice. `ZINSTAL.ZPM`, and `STARTZPM.COM` onto the disk/slice.
Assuming you copied the ZPM3 boot files onto your RAM disk Assuming you copied the ZPM3 boot files onto your RAM disk
at A:, you would use: at A:, you would use:
``` ```
A>B:SYSCOPY C:=CPMLDR.SYS
A>B:SYSCOPY C:=ZPMLDR.SYS
A>B:COPY CPM3.SYS C: A>B:COPY CPM3.SYS C:
A>B:COPY ZCCP.COM C: A>B:COPY ZCCP.COM C:
A>B:COPY ZINSTAL.ZPM C: A>B:COPY ZINSTAL.ZPM C:
A>B:COPY STARTZPM.COM C: A>B:COPY STARTZPM.COM C:
``` ```
You may be wondering if the references to `CPMLDR.SYS` and
`CPM3.SYS` are typos. They are not. ZPM3 uses the same loader
image as CPM3. The ZPM3 main system code file is called `CPM3.SYS`
You may be wondering if the reference to `CPM3.SYS` is a typo.
It is not. The ZPM3 main system code file is called `CPM3.SYS`
which is the same name as CP/M 3 uses, but the file contents are which is the same name as CP/M 3 uses, but the file contents are
not the same. not the same.
@ -1263,29 +1262,34 @@ images.
* FAT.COM * FAT.COM
* TUNE.COM * TUNE.COM
# System Update
## System Update
If the system running ROMWBW utilizes the SST39SF040 Flash chip then it is possible to do a System Update in place of
a System Upgrade in some cases.
If the system running ROMWBW utilizes the SST39SF040 Flash chip then it
is possible to do a System Update in place of a System Upgrade in some
cases.
A System Update would involve only updating the BIOS, ROM applications and CP/M system.
A System Update would involve only updating the BIOS, ROM applications
and CP/M system.
A System Update may be more favorable than a System Upgrade in cases such as:
A System Update may be more favorable than a System Upgrade in cases
such as:
- Overwriting of the ROM drive is not desired. - Overwriting of the ROM drive is not desired.
- Space is unavailable to hold a full ROMWBW ROM. - Space is unavailable to hold a full ROMWBW ROM.
- To mimimize time taken to transfer and flash a full ROM. - To mimimize time taken to transfer and flash a full ROM.
- Configuration changes are only minor and do not impact disk applications. - Configuration changes are only minor and do not impact disk applications.
The ROMWBW build process generates a system upgrade file along with the normal ROM image and can be identified by the
extension ".upd". It will be 128Kb in size. In comparison the normal ROM image will have the extension ".rom" and be
512Kb or 1024Kb in size.
The ROMWBW build process generates a system upgrade file along with
the normal ROM image and can be identified by the extension ".upd". It
will be 128Kb in size. In comparison the normal ROM image will have
the extension ".rom" and be 512Kb or 1024Kb in size.
Transferring and flashing the System Update is accomplished in the same manner as described above in *Upgrading* with
the required difference being that the flash application needs to be directed to complete a partial flash using the
/p command line switch.
Transferring and flashing the System Update is accomplished in the
same manner as described above in *Upgrading* with the required
difference being that the flash application needs to be directed to
complete a partial flash using the /P command line switch.
`E>flash write rom.upd /p`
`E>FLASH WRITE ROM.UPD /P`
# RomWBW Distribution # RomWBW Distribution
@ -1303,7 +1307,7 @@ directories are:
| Application | Description | | Application | Description |
| ----------- | -------------------------------------------------------------- | | ----------- | -------------------------------------------------------------- |
| Binary | The final output files of the build process are placed here. Most importantly, are the ROM images with the file names ending in ".rom". |
| Binary | The final output files of the build process are placed here. Most importantly, the ROM images with the file names ending in ".rom". |
| Doc | Contains various detailed documentation including the operating systems, RomWBW architecture, etc. | | Doc | Contains various detailed documentation including the operating systems, RomWBW architecture, etc. |
| Source | Contains the source code files used to build the software and ROM images. | | Source | Contains the source code files used to build the software and ROM images. |
| Tools | Contains the MS Windows programs that are used by the build process or that may be useful in setting up your system. | | Tools | Contains the MS Windows programs that are used by the build process or that may be useful in setting up your system. |
@ -1327,10 +1331,11 @@ these applications are no longer provided.
driver. driver.
* Ed Brindley contributed some of the code that supports the RC2014 * Ed Brindley contributed some of the code that supports the RC2014
platform. platform.
* Phil Summers contributed Forth and BASIC in ROM, the AY-3-8910 sound
driver as well as a long list of general code enhancements.
* Phil Summers contributed the Forth and BASIC adaptations in ROM, the
AY-3-8910 sound driver as well as a long list of general code
enhancements.
* Phillip Stevens contributed support for FreeRTOS. * Phillip Stevens contributed support for FreeRTOS.
* Curt Mayer contributed the Linux / MacOS build process.
* Curt Mayer contributed the original Linux / MacOS build process.
* UNA BIOS and FDISK80 are the products of John Coffman. * UNA BIOS and FDISK80 are the products of John Coffman.
* FLASH4 is a product of Will Sowerbutts. * FLASH4 is a product of Will Sowerbutts.
* CLRDIR is a product of Max Scane. * CLRDIR is a product of Max Scane.
@ -1341,6 +1346,50 @@ the SN76489 sound driver.
Contributions of all kinds to RomWBW are very welcome. Contributions of all kinds to RomWBW are very welcome.
# Licensing
RomWBW is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
RomWBW is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with RomWBW. If not, see <https://www.gnu.org/licenses/>.
Portions of RomWBW were created by, contributed by, or derived from
the work of others. It is believed that these works are being used
in accordance with the intentions and/or licensing of their creators.
If anyone feels their work is being used outside of it's intended
licensing, please notify:
> Wayne Warthen
> wwarthen@gmail.com
RomWBW is an aggregate work. It is composed of many individual,
standalone programs that are distributed as a whole to function as
a cohesive system. Each program may have it's own licensing which
may be different from other programs within the aggregate.
In some cases, a single program (e.g., CP/M Operating System) is
composed of multiple components with different licenses. It is
believed that in all such cases the licenses are compatible with
GPL version 3.
RomWBW encourages code contributions from others. Contributors
may assert their own copyright in their contributions by
annotating the contributed source code appropriately. Contributors
are further encouraged to submit their contributions via the RomWBW
source code control system to ensure their contributions are clearly
documented.
All contributions to RomWBW are subject to this license.
# Getting Assistance # Getting Assistance
The best way to get assistance with RomWBW or any aspect of the The best way to get assistance with RomWBW or any aspect of the

2
Source/Images/fd_zsdos.txt

@ -47,7 +47,7 @@ d_cpm22/u0/XSUB.COM 0:
# Add Tune sample files # Add Tune sample files
# #
../../Binary/Apps/Tunes/*.pt? 3: ../../Binary/Apps/Tunes/*.pt? 3:
../../Binary/Apps/Tunes/*.mym 3:
#../../Binary/Apps/Tunes/*.mym 3:
../../Binary/Apps/Tunes/*.vgm 3: ../../Binary/Apps/Tunes/*.vgm 3:
# #
# Add OS image # Add OS image

Loading…
Cancel
Save