Skip to content

Commit

Permalink
Improve Video Hardware Reset
Browse files Browse the repository at this point in the history
- This change avoids clearing the screen every time an OS reset occurs.  A non-destructive VDC reset is now performed that leaves the screen contents and cursor position unchanged.
- If an application overwrites the video RAM, then the screen may contain garbage upon return to OS.  However, the console will still be functional and the user can just press enter a few times to clear the screen.
  • Loading branch information
wwarthen committed Apr 3, 2024
1 parent d294fb6 commit 2d8c373
Show file tree
Hide file tree
Showing 19 changed files with 96 additions and 90 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 ROM Applications.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 ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**RomWBW ReadMe** \
Version 3.5 \
Wayne Warthen ([[email protected]](mailto:[email protected])) \
28 Feb 2024
03 Apr 2024

# Overview

Expand Down
2 changes: 1 addition & 1 deletion ReadMe.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
RomWBW ReadMe
Wayne Warthen ([email protected])
28 Feb 2024
03 Apr 2024



Expand Down
10 changes: 5 additions & 5 deletions Source/Doc/SystemGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,7 @@ specified (set to 0 for default/not specified). Video Mode (E) values
are specific to each VDA. The returned Status (A) is a standard HBIOS
result code.

If the hardware and driver support it, you can specify a Font Bitmap
If the hardware and driver supports it, you can specify a Font Bitmap
(HL) buffer address containing the character bitmap data to be loaded
into the video processor. The buffer **must** be located entirely in the
top 32K of the CPU memory space. HL must be set to zero if no character
Expand Down Expand Up @@ -1372,10 +1372,10 @@ data, then Font Bitmap (HL) will be set to zero on return.
| B: 0x42 | A: Status |
| C: Video Unit | |

Performs a soft reset of the specified Video Unit (C). Will clear the
screen, home the cursor, and restore active attribute/color to defaults.
Keyboard will be flushed. The current video mode will not be changed.
The returned Status (A) is a standard HBIOS result code.
Performs a non-destructive reset of the specified Video Unit (C).
Should re-initialize the video hardware without destroying the screen
contents or cursor position. The current video mode will not be
changed. The returned Status (A) is a standard HBIOS result code.

### Function 0x43 -- Video Device (VDADEV)

Expand Down
20 changes: 9 additions & 11 deletions Source/HBIOS/cvdu.asm
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,15 @@ CVDU_VDAINI:
; RESET VDA
; CURRENTLY IGNORES VIDEO MODE AND BITMAP DATA
CALL CVDU_VDARES ; RESET VDA
LD A,$0E ; ATTRIBUTE IS STANDARD WHITE ON BLACK
LD (CVDU_ATTR),A ; SAVE IT
LD DE,0 ; ROW = 0, COL = 0
CALL CVDU_XY ; SEND CURSOR TO TOP LEFT
LD A,' ' ; BLANK THE SCREEN
LD DE,$800 ; FILL ENTIRE BUFFER
CALL CVDU_FILL ; DO IT
LD DE,0 ; ROW = 0, COL = 0
CALL CVDU_XY ; SEND CURSOR TO TOP LEFT
XOR A ; SIGNAL SUCCESS
RET

Expand All @@ -160,17 +169,6 @@ CVDU_VDAQRY:
RET

CVDU_VDARES:
LD A,$0E ; ATTRIBUTE IS STANDARD WHITE ON BLACK
LD (CVDU_ATTR),A ; SAVE IT

LD DE,0 ; ROW = 0, COL = 0
CALL CVDU_XY ; SEND CURSOR TO TOP LEFT
LD A,' ' ; BLANK THE SCREEN
LD DE,$800 ; FILL ENTIRE BUFFER
CALL CVDU_FILL ; DO IT
LD DE,0 ; ROW = 0, COL = 0
CALL CVDU_XY ; SEND CURSOR TO TOP LEFT

XOR A
RET

Expand Down
14 changes: 8 additions & 6 deletions Source/HBIOS/ef.asm
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,13 @@ EF_VDAINI:
LD A,L
OR H
CALL NZ,EF_LOADFONTS

CALL EF_CLEARALL
CALL EF_LOADCSTYLE
LD DE,0
LD (EF_VDA_OFFSET),DE
CALL EF_VDASCP

XOR A
RET
;
Expand All @@ -586,13 +593,8 @@ EF_VDAQRY:
;
EF_VDARES:
; VIDEO RESET
; SOFT RESET, CLEAR SCREEN, HOME CURSOR, RESTORE ATTRIBUTE/COLOR DEFAULTS
; SOFT RESET
;
CALL EF_CLEARALL
CALL EF_LOADCSTYLE
LD DE,0
LD (EF_VDA_OFFSET),DE
CALL EF_VDASCP
XOR A
RET
;
Expand Down
3 changes: 1 addition & 2 deletions Source/HBIOS/gdc.asm
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,7 @@ GDC_VDAQRY: ; VIDEO INFORMATION QUERY
RET
;
GDC_VDARES: ; VIDEO SYSTEM RESET
; *** TODO: RESET VIDEO SYSTEM HERE, CLEAR SCREEN,
; CURSOR TO TOP LEFT, CLEAR ATTRIBUTES
; *** TODO: RESET VIDEO SYSTEM HERE
XOR A
RET
;
Expand Down
19 changes: 9 additions & 10 deletions Source/HBIOS/term.asm
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ TERM_ATTACH:
LD A,(TERM_DEVCNT) ; GET NEXT DEVICE NUMBER TO USE
LD B,A ; PUT IT IN B
PUSH HL ; SAVE VDA INSTANCE DATA PTR
;
LD A,C ; VIDEO UNIT TO A
LD (TERM_VDADEV),A ; SAVE IT
;
; SETUP EMULATOR MODULE FUNC TBL ADDRESS BASED ON DESIRED EMULATION
; EMULATOR PASSES BACK IT'S FUNC TBL ADDRESS IN DE
Expand Down Expand Up @@ -99,22 +102,18 @@ TERM_RESET:
RET
;
TERM_RESET1:
; CALL EMULATOR INITDEV FUNCTION
#IF (VDAEMU == EMUTYP_TTY)
CALL TTY_INITDEV
#ENDIF
#IF (VDAEMU == EMUTYP_ANSI)
CALL ANSI_INITDEV
#ENDIF
;
XOR A
RET
; RESET THE ATTACHED VDA DEVICE
LD B,BF_VDARES ; FUNC: RESET
LD A,(TERM_VDADEV) ; GET VDA UNIT NUM
LD C,A ; PUT IN C
JP ANSI_VDADISP ; CALL THE VDA DRIVER
;
;======================================================================
; TERMINAL DRIVER PRIVATE DATA
;======================================================================
;
TERM_DEVCNT .DB 0 ; TERMINAL DEVICE COUNT
TERM_VDADEV .DB 0 ; ATTACHED VDA UNIT
;
;======================================================================
; EMULATION MODULES
Expand Down
51 changes: 30 additions & 21 deletions Source/HBIOS/tms.asm
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ TMS_INIT:
TMS_INIT1:
CALL TMS_CRTINIT ; SETUP THE TMS CHIP REGISTERS
CALL TMS_LOADFONT ; LOAD FONT DATA FROM ROM TO TMS STRORAGE
CALL TMS_VDARES1
CALL TMS_CLEAR ; CLEAR SCREEN, HOME CURSOR
#IF (TMSMODE == TMSMODE_N8)
CALL PPK_INIT ; INITIALIZE PPI KEYBOARD DRIVER
#ENDIF
Expand Down Expand Up @@ -335,6 +335,7 @@ TMS_VDAINI:
; RESET VDA
; CURRENTLY IGNORES VIDEO MODE AND BITMAP DATA
CALL TMS_VDARES ; RESET VDA
CALL TMS_CLEAR ; CLEAR SCREEN
XOR A ; SIGNAL SUCCESS
RET

Expand All @@ -350,30 +351,16 @@ TMS_VDARES:
#IF (CPUFAM == CPU_Z180)
CALL TMS_Z180IO
#ENDIF
CALL TMS_CRTINIT
CALL TMS_CRTINIT1A
#IF (!USELZSA2)
; WE WANT TO RELOAD THE FONT ON RESET, BUT THIS IS NOT CURRENTLY
; POSSIBLE WHEN FONT COMPRESSION IS IN USE.
CALL TMS_LOADFONT
CALL TMS_LOADFONT ; RELOAD FONT
LD A,$FF ; REMOVE
LD (TMS_CURSAV),A ; ... SAVED CURSOR CHAR
CALL TMS_SETCUR ; SET NEW CURSOR
#ENDIF
;
; ENTRY POINT USED BY TMS_INIT TO AVOID DUPLICATE CALL TO TMS_CRTINIT
; AND TMS_Z180IO.
;
TMS_VDARES1:
LD DE,0 ; ROW = 0, COL = 0
CALL TMS_XY ; SEND CURSOR TO TOP LEFT
LD A,' ' ; BLANK THE SCREEN
LD DE,TMS_ROWS * TMS_COLS ; FILL ENTIRE BUFFER
CALL TMS_FILL ; DO IT
LD DE,0 ; ROW = 0, COL = 0
CALL TMS_XY ; SEND CURSOR TO TOP LEFT
XOR A
DEC A
LD (TMS_CURSAV),A
CALL TMS_SETCUR ; SET CURSOR

XOR A ; SIGNAL SUCCESS
RET

TMS_VDADEV:
Expand Down Expand Up @@ -634,6 +621,8 @@ TMS_CRTINIT1:
LD A,D
OR E
JR NZ,TMS_CRTINIT1
;
TMS_CRTINIT1A:
;
; INITIALIZE VDU REGISTERS
LD C,0 ; START WITH REGISTER 0
Expand All @@ -655,6 +644,26 @@ TMS_CRTINIT2:
RET
;
;----------------------------------------------------------------------
; CLEAR SCREEN AND HOME CURSOR
;----------------------------------------------------------------------
;
TMS_CLEAR:
LD DE,0 ; ROW = 0, COL = 0
CALL TMS_XY ; SEND CURSOR TO TOP LEFT
LD A,' ' ; BLANK THE SCREEN
LD DE,TMS_ROWS * TMS_COLS ; FILL ENTIRE BUFFER
CALL TMS_FILL ; DO IT
LD DE,0 ; ROW = 0, COL = 0
CALL TMS_XY ; SEND CURSOR TO TOP LEFT
XOR A
DEC A
LD (TMS_CURSAV),A
CALL TMS_SETCUR ; SET CURSOR
;
XOR A ; SIGNAL SUCCESS
RET
;
;----------------------------------------------------------------------
; LOAD FONT DATA
;----------------------------------------------------------------------
;
Expand Down Expand Up @@ -707,7 +716,7 @@ TMS_STACK .DW 0
;
; VIRTUAL CURSOR IS GENERATED BY DYNAMICALLY CHANGING FONT GLYPH
; FOR CHAR 255 TO BE THE INVERSE OF THE GLYPH OF THE CHARACTER UNDER
; THE CURRENT CURSOR POSITION. THE CHARACTER CODE IS THEN SWITCH TO
; THE CURRENT CURSOR POSITION. THE CHARACTER CODE IS THEN SWITCHED TO
; THE VALUE 255 AND THE ORIGINAL VALUE IS SAVED. WHEN THE DISPLAY
; NEEDS TO BE CHANGED THE PROCESS IS UNDONE. IT IS ESSENTIAL THAT
; ALL DISPLAY CHANGES BE BRACKETED WITH CALLS TO TMS_CLRCUR PRIOR TO
Expand Down
13 changes: 6 additions & 7 deletions Source/HBIOS/vdu.asm
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ VDU_VDAINI:
; RESET VDA
; CURRENTLY IGNORES VIDEO MODE AND BITMAP DATA
CALL VDU_VDARES ; RESET VDA
LD DE,0
LD (VDU_OFFSET),DE
CALL VDU_XY
LD A,' '
LD DE,1024*16
CALL VDU_FILL
XOR A ; SIGNAL SUCCESS
RET

Expand All @@ -176,13 +182,6 @@ VDU_VDAQRY:
RET

VDU_VDARES:
LD DE,0
LD (VDU_OFFSET),DE
CALL VDU_XY
LD A,' '
LD DE,1024*16
CALL VDU_FILL

XOR A
RET

Expand Down
23 changes: 12 additions & 11 deletions Source/HBIOS/vga.asm
Original file line number Diff line number Diff line change
Expand Up @@ -180,18 +180,7 @@ VGA_VDAINI:
; RESET VDA
; CURRENTLY IGNORES VIDEO MODE AND BITMAP DATA
CALL VGA_VDARES ; RESET VDA
XOR A ; SIGNAL SUCCESS
RET

VGA_VDAQRY:
LD C,$00 ; MODE ZERO IS ALL WE KNOW
LD D,VGA_ROWS ; ROWS
LD E,VGA_COLS ; COLS
LD HL,0 ; EXTRACTION OF CURRENT BITMAP DATA NOT SUPPORTED YET
XOR A ; SIGNAL SUCCESS
RET

VGA_VDARES:
LD A,$07 ; ATTRIBUTE IS STANDARD WHITE ON BLACK
LD (VGA_ATTR),A ; SAVE IT
XOR A ; ZERO (REVERSE, UNDERLINE, BLINK)
Expand All @@ -205,6 +194,18 @@ VGA_VDARES:
LD DE,0 ; ROW = 0, COL = 0
CALL VGA_XY ; SEND CURSOR TO TOP LEFT

XOR A ; SIGNAL SUCCESS
RET

VGA_VDAQRY:
LD C,$00 ; MODE ZERO IS ALL WE KNOW
LD D,VGA_ROWS ; ROWS
LD E,VGA_COLS ; COLS
LD HL,0 ; EXTRACTION OF CURRENT BITMAP DATA NOT SUPPORTED YET
XOR A ; SIGNAL SUCCESS
RET

VGA_VDARES:
LD HL,$0404 | VGA_89BIT; SET VIDEO ENABLE BIT
CALL VGA_SETCFG ; DO IT

Expand Down
25 changes: 12 additions & 13 deletions Source/HBIOS/vrc.asm
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,6 @@ VRC_VDAINI:
; RESET VDA
; CURRENTLY IGNORES VIDEO MODE AND BITMAP DATA
CALL VRC_VDARES ; RESET VDA
XOR A ; SIGNAL SUCCESS
RET

VRC_VDAQRY:
LD C,$00 ; MODE ZERO IS ALL WE KNOW
LD D,VRC_ROWS ; ROWS
LD E,VRC_COLS ; COLS
LD HL,0 ; EXTRACTION OF CURRENT BITMAP DATA NOT SUPPORTED YET
XOR A ; SIGNAL SUCCESS
RET

VRC_VDARES:
XOR A ; CLEAR ATTRIBUTES (REV VIDEO OFF)
LD (VRC_ATTR),A ; SAVE IT
DEC A ; INIT CUR NESTING, INIT TO HIDDEN
Expand All @@ -143,7 +131,18 @@ VRC_VDARES:
LD DE,0 ; ROW = 0, COL = 0
CALL VRC_XY ; SEND CURSOR TO TOP LEFT
CALL VRC_SHOWCUR ; NOW SHOW THE CURSOR
;
XOR A ; SIGNAL SUCCESS
RET

VRC_VDAQRY:
LD C,$00 ; MODE ZERO IS ALL WE KNOW
LD D,VRC_ROWS ; ROWS
LD E,VRC_COLS ; COLS
LD HL,0 ; EXTRACTION OF CURRENT BITMAP DATA NOT SUPPORTED YET
XOR A ; SIGNAL SUCCESS
RET

VRC_VDARES:
XOR A ; SIGNAL SUCCESS
RET

Expand Down
2 changes: 1 addition & 1 deletion Source/ver.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#DEFINE RMN 5
#DEFINE RUP 0
#DEFINE RTP 0
#DEFINE BIOSVER "3.5.0-dev.23"
#DEFINE BIOSVER "3.5.0-dev.24"
#define rmj RMJ
#define rmn RMN
#define rup RUP
Expand Down
2 changes: 1 addition & 1 deletion Source/ver.lib
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ rmn equ 5
rup equ 0
rtp equ 0
biosver macro
db "3.5.0-dev.23"
db "3.5.0-dev.24"
endm

2 comments on commit 2d8c373

@MorfeoMatrixx
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work Wayne !
Thanks a lot.

@wwarthen
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @MorfeoMatrixx.

Note that I am not quite done yet. I am still working on an issue related to restoring the font data. I think I know how to deal with this, but need a few more days.

Thanks,

Wayne

Please sign in to comment.