On Mon, 10 May 2004, Alex Fedosov wrote: > > To: Allan Cruse > Subject: bug in try32bit.s (and derivatives) > I spotted a bug in your try32bit.s demo (and all subsequent demos and projects that are based on it) in the compute_vram_offset procedure. Originally, it looks like this: compute_vram_offset: imul edi, ebx, #4096 ; EDI = offset to page movzx ebx, dh ; extended row-number imul ebx, #160 ; times row-length add edi, ebx ; added to page-origin movzx ebx, dl ; extended col-number imul ebx, #2 ; times col-width add edi, ebx ; added to row-origin ret Code that runs after this procedure (specifically, scroll_vpage_up procedure) expects to find the video RAM page number in the EBX register but this function uses the EBX register to temporarily store the offset within VRAM on the current page. Because of this, scroll_vpage_up would crash whenever called. (And we never noticed before because only for the current project our Linux executables print more than a whole screen of text, requiring scrolling.) Pushing EBX on the stack at the beginning of the procedure and popping before returning seems work fine as a fix. Alex ------------------------------------------------------------------- Note added by Instructor: The list of posted demo-programs derived from 'try32bit.s' and thus affected by this bug-fix is shown below. 'tryexec.s' posted 29 MAR 2004 'ondemand.s' posted 05 APR 2004 'trydebug.s' posted 07 APR 2004 'trydebug2.s' posted 08 APR 2004 'trydebug3.s' posted 12 APR 2004 Thanks to Alex Fedosov for pointing out this previously undetected error, and for proposing a very simple way of correcting it. --ABC -------------------------------------------------------------------