Skip to content

Commit

Permalink
KBD Interrupt Processing Cleanup
Browse files Browse the repository at this point in the history
- I finally realized there was a much simpler way to setup the instance data pointer (IY) for the interrupt handler.  This implements the change and reduces the complexity of the code.
- Related to PR #460
  • Loading branch information
wwarthen committed Dec 8, 2024
1 parent efb9ac2 commit f9ed565
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 57 deletions.
Binary file modified Doc/RomWBW Applications.pdf
Binary file not shown.
Binary file modified Doc/RomWBW Disk Catalog.pdf
Binary file not shown.
Binary file modified Doc/RomWBW Errata.pdf
Binary file not shown.
Binary file modified Doc/RomWBW System Guide.pdf
Binary file not shown.
Binary file modified Doc/RomWBW User Guide.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion Source/Doc/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ Boot [H=Help]: h
D - Device Inventory
R - Reboot System
W - RomWBW Configure
I <u> [<c>] - Set Console Interface/Baud code
I <u> [<c>] - Set Console Interface/Baud Rate
V [<n>] - View/Set HBIOS Diagnostic Verbosity
<u>[.<s>] - Boot Disk Unit/Slice
```
Expand Down
8 changes: 0 additions & 8 deletions Source/HBIOS/cvdu.asm
Original file line number Diff line number Diff line change
Expand Up @@ -921,11 +921,3 @@ CVDU_IDAT:
.DB KBDMODE_PS2 ; PS/2 8242 KEYBOARD CONTROLLER
.DB CVDU_KBDST
.DB CVDU_KBDDATA
;
; IF WE ARE USING PS2 INTERRUPTS, WE NEED TO PASS THE INSTANCE
; DATA POINTER TO PS2IFACE.INC VIA KBDIDAT FOR USE BY THE INTERRUPT
; HANDLER IN PS2IFACE.INC.
;
#IF (KBDINTS)
KBDIDAT .EQU CVDU_IDAT
#ENDIF
8 changes: 0 additions & 8 deletions Source/HBIOS/gdc.asm
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,3 @@ GDC_IDAT:
.DB KBDMODE_PS2 ; PS/2 8242 KEYBOARD CONTROLLER
.DB GDC_KBDST
.DB GDC_KBDDATA
;
; IF WE ARE USING PS2 INTERRUPTS, WE NEED TO PASS THE INSTANCE
; DATA POINTER TO PS2IFACE.INC VIA KBDIDAT FOR USE BY THE INTERRUPT
; HANDLER IN PS2IFACE.INC.
;
#IF (KBDINTS)
KBDIDAT .EQU GDC_IDAT
#ENDIF
11 changes: 0 additions & 11 deletions Source/HBIOS/hbios.asm
Original file line number Diff line number Diff line change
Expand Up @@ -3030,8 +3030,6 @@ HB_SPDTST:
;--------------------------------------------------------------------------------------------------
; ENABLE INTERRUPTS
;--------------------------------------------------------------------------------------------------
;
;;;CALL HB_PREINT_HOOKS ; HACK TO ALLOW SOME DRIVERS TO DO PRE INTERRUPT STUFF
;
#IFDEF TESTING
;
Expand Down Expand Up @@ -9374,15 +9372,6 @@ SIZ_EZ80DRVS .EQU $ - ORG_EZ80DRVS
MEMECHO "RTCDEF="
MEMECHO RTCDEF
MEMECHO "\n"
;;;;
;;;; PRE-INTERRUPT HOOKS
;;;;
;;;HB_PREINT_HOOKS:
;;;;
;;;#IF (KBDENABLE)
;;; CALL KBD_PREINT_HOOK
;;;#ENDIF
;;; RET
;
HB_DRIVERS_END .EQU $
;
Expand Down
33 changes: 29 additions & 4 deletions Source/HBIOS/kbd.asm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
; ROMWBW ADAPTATION BY WAYNE WARTHEN
; INTERRUPT DRIVER ADDITION BY PHIL SUMMERS
;
; THIS DRIVER IS INVOKED BY VIDEO DRIVERS AS NEEDED. WHEN INVOKED,
; THE VIDEO DRIVER IS RESPONSIBLE FOR SETTING IY TO THE INSTANCE
; DATA FOR IT'S INSTANCE OF THE KBD DRIVER. THIS ALLOWS THIS CODE
; TO BE REUSED BY MULTIPLE VIDEO DRIVERS USING MULTIPLE PS/2 KBD
; INTERFACES IN A SINGLE SYSTEM.
;
; WARNING: WHEN INTERRUPTS ARE ENABLED FOR THIS DRIVER (KBDINTS), IT IS
; *NOT* POSSIBLE TO HAVE MULTIPLE VIDEO DRIVERS USING THIS KBD DRIVER
; ACTIVELY IN A SYSTEM. THE USE OF INTERRUPTS IMPLIES ONLY ONE PS/2
; KBD INTERFACE CAN BE USED CONCURRENTLY.
;
; IN DEBUG MODE:
; >>nn SHOWS HEX COMMAND nn BEING WRITTEN TO THE COMMAND PORT
Expand Down Expand Up @@ -70,12 +80,22 @@ KBD_IDLE .DB 0 ; IDLE COUNT
;__________________________________________________________________________________________________
;
#INCLUDE "ps2iface.inc"
;
;__________________________________________________________________________________________________
; KEYBOARD PRE-INITIALIZATION
;__________________________________________________________________________________________________
;
; TO BE CALLED PRIOR TO INITERRUPTS BEING ENABLED
; MUST BE CALLED FROM VIDEO DRIVER PREINIT WITH IY SET
; THIS PREVENTS INTRERRUPT ISSUES IF 8242 HAS INTERRUPTS ENABLED
;
; AT STARTUP. NOT USING IT FOR NOW BECAUSE IT IS NOT A PROBLEM IF
; YOU DON'T USE THE KEYBOARD DURING BOOT.
;
;;;KBD_PREINT:
;;;;
;;;; HACK TO ENSURE PS/2 CONTROLLER INTERRUPTS ARE TURNED OFF!!!
;;;;
;;;KBD_PREINT_HOOK:
;;;#IF (KBDINTS)
;;; LD IY,KBDIDAT
;;; LD A,$60 ; SET COMMAND REGISTER
;;; CALL KBD_PUTCMD ; SEND IT
;;; LD A,$20 ; XLAT DISABLED, MOUSE DISABLED, NO INTS
Expand All @@ -87,7 +107,7 @@ KBD_IDLE .DB 0 ; IDLE COUNT
;;; CALL KBD_IN_P
;;; DJNZ KBD_PREINT_HOOK1
;;;#ENDIF
RET
;;; RET
;
;__________________________________________________________________________________________________
; KEYBOARD INITIALIZATION
Expand Down Expand Up @@ -127,6 +147,7 @@ KBD_INIT:
KBD_INIT1:
#IF ((INTMODE == 2) & KBDINTS)
; CALL KBDQINIT ; INITIALIZE QUEUE
LD (KBD_IDAT),IY ; SAVE IY FOR INT HANDLER
LD HL,KBD_INT ; INSTALL VECTOR
LD (IVT(INT_PS2KB)),HL ; IVT INDEX
#ENDIF
Expand Down Expand Up @@ -770,6 +791,10 @@ KBD_STR_MODEPS2 .TEXT "PS2$"
KBD_STR_MODEVRC .TEXT "VRC$"
KBD_STR_MODEUNK .TEXT "???$"
;
#IF ((INTMODE == 2) & KBDINTS)
KBD_IDAT .DW 0 ; ADR OF INSTANCE DATA FOR INTS
#ENDIF
;
;
;
#IF (KBDKBLOUT == KBD_US)
Expand Down
2 changes: 1 addition & 1 deletion Source/HBIOS/ps2iface.inc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ KBDQ .FILL KBDQSIZ,0 ; CIRCULAR KEYBOARD BUFFER
;
KBD_INT:
; CALL KBDQDBG
LD IY,KBDIDAT
LD IY,(KBD_IDAT) ; POINT TO INSTANCE DATA
LD C,(IY+KBD_ST) ; READ CONTROLLER STATUS
EZ80_IO
IN A,(C)
Expand Down
8 changes: 0 additions & 8 deletions Source/HBIOS/tms.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1189,14 +1189,6 @@ TMS_IDAT:
.DB TMS_DATREG
.DB TMS_CMDREG
;
; IF WE ARE USING PS2 INTERRUPTS, WE NEED TO PASS THE INSTANCE
; DATA POINTER TO PS2IFACE.INC VIA KBDIDAT FOR USE BY THE INTERRUPT
; HANDLER IN PS2IFACE.INC.
;
#IF ((TMSKBD == TMSKBD_KBD) & KBDINTS)
KBDIDAT .EQU TMS_IDAT
#ENDIF
;
;==================================================================================================
; TMS DRIVER - TMS9918 REGISTER INITIALIZATION
;==================================================================================================
Expand Down
8 changes: 0 additions & 8 deletions Source/HBIOS/vga.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1056,11 +1056,3 @@ VGA_IDAT:
.DB KBDMODE_PS2 ; PS/2 8242 KEYBOARD CONTROLLER
.DB VGA_KBDST
.DB VGA_KBDDATA
;
; IF WE ARE USING PS2 INTERRUPTS, WE NEED TO PASS THE INSTANCE
; DATA POINTER TO PS2IFACE.INC VIA KBDIDAT FOR USE BY THE INTERRUPT
; HANDLER IN PS2IFACE.INC.
;
#IF (KBDINTS)
KBDIDAT .EQU VGA_IDAT
#ENDIF
8 changes: 0 additions & 8 deletions Source/HBIOS/vrc.asm
Original file line number Diff line number Diff line change
Expand Up @@ -675,11 +675,3 @@ VRC_IDAT:
.DB KBDMODE_VRC ; VGARC KEYBOARD CONTROLLER
.DB VRC_KBDST
.DB VRC_KBDDATA
;
; IF WE ARE USING PS2 INTERRUPTS, WE NEED TO PASS THE INSTANCE
; DATA POINTER TO PS2IFACE.INC VIA KBDIDAT FOR USE BY THE INTERRUPT
; HANDLER IN PS2IFACE.INC.
;
#IF (KBDINTS)
KBDIDAT .EQU VRC_IDAT
#ENDIF

0 comments on commit f9ed565

Please sign in to comment.