changeset 2115:9e49b536525f

Fixed the "crash" bug in the case where CoWin/CoGrf could not load or link grfdrv. This is now fixed.
author boisy
date Wed, 22 Aug 2007 19:15:59 +0000
parents ac2f5aa71f93
children 0a6d8e8c2931
files level2/modules/cowin.asm level2/modules/vtio.asm
diffstat 2 files changed, 38 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/level2/modules/cowin.asm	Wed Aug 22 02:22:41 2007 +0000
+++ b/level2/modules/cowin.asm	Wed Aug 22 19:15:59 2007 +0000
@@ -22,6 +22,10 @@
 * is killed with a display 1b 24 and restarted with a display 1b 20; ie
 * DWSet. Changes are compatible with MultiVue and all test procedures
 * tried. Short Sleep added to stabilize the screen change.
+*
+*  2       2007/08/22  Boisy G. Pitre
+* Fixed crash bug in case where grfdrv wasn't loaded.  See comments at
+* Term label.
 
          nam   CoGrf/CoWin
          ttl   NitrOS-9 Window Module
@@ -33,7 +37,7 @@
 tylg     set   Systm+Objct
 atrv     set   ReEnt+rev
 rev      set   $00
-edition  equ   1
+edition  equ   2
 
 * Color table for 3D look stuff & others - WILL NEED TO SWAP 1 & 2 FOR MENUS
 * This should now match VIEW's color table
@@ -396,7 +400,18 @@
 * Terminate routine
 * Entry: U=Static mem ptr
 *        Y=Path dsc. ptr
-Term     clra             Get start window # for de-allocate
+Term
+* Next two lines added by Boisy on 08/22/2007
+* This test is necessary to prevent a crash in the case that grfdrv cannot be
+* loaded.  If grfdrv isn't properly initialized, then the high bit of BCFFlg will
+* be clear.  Without this check, the test for Wt.STbl,y to be equal to $FF would fail,
+* and a DWEnd would be attempted.  Since grfdrv's init routine sets Wt.STBl,y to $FFFF
+* for each window table entry, this wasn't getting done, and the call to DWEnd would
+* be vectored to grfdrv, which wasn't to be found!
+         tst   WGlobal+G.BCFFlg was Grfdrv found? (hi bit set if so)
+         bpl   TermEx           if not, no nothing got initialized, so leave quietly
+*
+         clra             Get start window # for de-allocate
          ldb   V.DWNum,u    Get device window # from static mem
          pshs  u,y        Preserve static mem & path dsc. ptrs
          bsr   L026A      De-allocate it from window map
@@ -473,7 +488,7 @@
          ldd   #$02FF     Size of graphics tables
          os9   F$SRtMem   Return graphics table memory to system
          bcs   L02F2      If error, exit with it
-         clrb  
+TermEx   clrb  
          rts   
 
          IFEQ  H6309
@@ -1442,7 +1457,7 @@
          leas  2,s        Eat window device dsc. ptr
          ldd   WT.STbl,y  Get screen table ptr of process window
          puls  y          Get window tbl ptr
-         std   WT.Stbl,y  Put into current window's screen tbl ptr
+         std   WT.STbl,y  Put into current window's screen tbl ptr
          clra             No error
          rts              return
 
--- a/level2/modules/vtio.asm	Wed Aug 22 02:22:41 2007 +0000
+++ b/level2/modules/vtio.asm	Wed Aug 22 19:15:59 2007 +0000
@@ -43,6 +43,13 @@
 *   1      2006/03/04  Boisy G. Pitre
 * Added detection of CTRL-ALT-BREAK to invoke system debugger.
 * Renamed to VTIO and reset edition to 1.
+*
+*   2      2007/08/22  Boisy G. Pitre
+* Fixed bug where an error other than E$MNF when linking to CoWin would be ignored.
+* Now, if the error returned from linking CoWin is not E$MNF, we don't bother to look
+* for CoGrf... we just return immediately.
+* 
+* Renamed to VTIO and reset edition to 1.
 
          nam   VTIO
          ttl   Video Terminal I/O Driver for CoCo 3
@@ -56,7 +63,7 @@
 tylg     set   Drivr+Objct
 atrv     set   ReEnt+rev
 rev      set   0
-edition  set   1
+edition  set   2
 
 * Comment out next line for global keyboard mouse; otherwise, it's on/off
 * on a per-window basis.
@@ -1531,6 +1538,17 @@
 
 *++
          bcc   ok
+
+* Bug fix by Boisy on 08/22/2007 - The three lines below were inserted to check to see
+* the nature of the error that occurred fromfailing to link to CoWin/CoGrf.  Since CoWin/CoGrf
+* also load GrfDrv, an error other than E$MNF might arise.  We expect an E$MNF if CoGrf is in
+* place instead of CoWin, but any other error just gets blown away without the three lines below.
+* Now, if any error other than E$MNF is returned from trying to link to CoWin, we don't bother trying
+* to link to CoGrf... we just return the error as is.
+         cmpb  #E$MNF		compare the error to what we expect
+         orcc  #Carry		set the carry again (cmpb above clears it)
+         bne   ok		if the error in B is not E$MNF, just leave this routine
+
          leax  <CoGrf,pcr	point to CoGrf name
          lda   #$80
          bsr   L08D4