[comp.sys.amiga.tech] mystery code

pl@kaarne.tut.fi (Lehtinen Pertti) (04/25/89)

>Jim B Howard writes:
> I have been having trouble with the following asm code that is
>driving me NUTS.  The code works perfectly, as long as it is 
>not in CHIP mem.  If its in any form of FAST mem, it functions.
>But if its in CHIP mem, it crashes and burns.  I cant think of any
>reason that this could happen, so maybe some of you could come
>up with some reasons.  I've never had this happen in any of my
>programs before..  When I step through the program with a debugger,
>it crashes when it calls the _LVOClearScreen routine, but
>_only_ when its in CHIP mem.  
> 
 ... code removed ...

	Well I think code actually shouldn't work from FAST ram
	either (but it does I tried).

	Actually problem is in the way how ClearScreen works.

	It is Text function and its works on text line based.
	So its zero point is at text baseline, where it assumes
	us to stay when it is called.

	As manual says, it first calls ClearEOL to clear current line.

	Fine, if our current position in rasterport is atleast
	baseline rasters below zero. In normal screen that means
	line 6.

	In current example we were at line 0, which means that
	we clear also 6 rasterlines above our bitplane.

	This is always wrong, but in this case only when we were
	at CHIP ram this was fatal. As fatal as clearing our stack
	could ever be. 

	Obvious fix is to use some raster based function to clear
	rasterport, or use move function to position 'cursor' on
	legal area.

					Pertti Lehtinen
					pl@tut.fi
pl@tut.fi				! -------------------------------- !
Pertti Lehtinen				!  Alone at the edge of the world  !
Tampere University of Technology	! -------------------------------- !
Software Systems Laboratory