
' OVERSCAN © Charles Vassallo
' Demonstration of overscan display completely mouse controlled under
' HiSoft-Basic, through the use of a little assembly routine,

' © 1991 by Charles VASSALLO -- All rights reserved

' Beware! Due to insufficient information about overscan operation
' there could be some hidden bug... You use the program at your own risk!  

' This is Basic source code for the program on this disk in compiled form.
' This file is PowerPacked to conserve space.

' ---------------------------------------------------------------------
' USE :
'
' As usual, the assembly code is loaded in an integer array. Once the
' overscan screen is opened, call the routine as follows:
'
'    CALL LOC address&,width,height,mode,VARPTR(OK&)
'
' where: address&=code address, i.e.  VARPTR(array(0))
'        width, height = screen dimensions
'        mode          = Basic "mode" of the screen
'        OK&           = return variable. A failure is detected by OK&=0
'
' Before closing your program, you MUST recall the routine with a zero
' width (namely CALL LOC address&,0,...) in order to restore the
' initial display and to release internal buffers.
'
' The width must be at most 368 in low-res (704 in 16-color laced hi-res,
' or 736 in 8-color laced hi-res)

' The routine can also be used under AmigaBasic; the syntax then is
'       CALL address&(width,height,mode,VARPTR(OK&))
' of course, loading the code into the array is not so easy
' (see Basic ILBM tutorial in JumpDisk, August 89)
' ------------------------------------------------------------------

  DEFINT a-z
  DIM ovscan(250)
  BLOAD "ovscan.bcode",VARPTR(ovscan(0))  :' loads the assembly code

'parameters for a low res overscan screen

  mode  =1
  large =367                      
  height=220 
'changing "height" in case of PAL display
  IF PEEKW(SYSTAB+2)>250 THEN height=283     
  
'opening screen+window
  SCREEN 1,large,height,5,mode
  WINDOW 2,,,16,1
  
  LOCATE 5
  PRINT "  This is the way HiSoft-Basic normally"
  PRINT "opens an overscan screen 367 x";height
  PRINT "The screen is not centered; its right"
  PRINT "part (and its lower part under WB 1.3)"
  PRINT "are out of the display. Furthermore,"
  PRINT "unless you are under WB 2.0, the mouse"
  PRINT "can't go anywhere in the screen; it can't"
  PRINT "trespass the usual Workbench screen"
  PRINT "boundaries."
  LOCATE 16,20 : COLOR 2 : PRINT "Click to proceed" : COLOR 1
  WHILE MOUSE(0)<>0 : WEND
  WHILE MOUSE(0)=0  : WEND
  CLS
  
  OK&=0
  ad&=VARPTR(ovscan(0))
  CALL LOC ad&,large,height,mode,VARPTR(OK&)            
  LOCATE 5
  IF OK&<>0 THEN
    PRINT "    The display should now be centered"
    PRINT "    (if the physical controls of your"
    PRINT "     monitor are correctly set) "
    COLOR 3
    PRINT "      and you can go anywhere you want"
    PRINT "      on the screen with the mouse."
    COLOR 1
    LOCATE 11
    PRINT "     Read the Basic listing to get the"
    PRINT "     recipe, a little assembly utility."
  ELSE
    PRINT "Horror! Failure!!!"
  END IF  
  
  LOCATE 15,1 : COLOR 2 
  PRINT TAB(20);"Write on the screen by"
  PRINT TAB(20);"dragging the mouse."
  LOCATE 18
  PRINT TAB(20);"Hit 'Esc' to exit" : COLOR 1
  a$=""
  WHILE a$<>CHR$(27)
    WHILE MOUSE(0)=-1
     x=MOUSE(1) : y=MOUSE(2)
     PSET (x,y),4 
    WEND
    a$=INKEY$
  WEND
  CLS

  ad&=VARPTR(ovscan(0))
  CALL LOC ad&,0,height,mode,VARPTR(OK&)            
  WINDOW CLOSE 2
  SCREEN CLOSE 1
  LOCATE 10,1
  PRINT "The initial display is now restored."

  END
