Font_read_defn

Chris Johnson chris at bulldog.u-net.com
Sun Feb 18 16:56:41 GMT 2001


I have been converting my old BASIC apps to C/oslib. I have hit a problem
with the routine to deal with fonts at a mode change. I have isolated the
problem to the oslib function

        font_read_defn

Every time it is called (whether an actual mode change or not) it causes a
fatal exit due to a "no stack for trap handler" error.

The oslib/font.h file gives the following info:

**********************************************
 * Function:      font_read_defn()
 *
 * Description:   Reads details about a font
 *
 * Input:         font - value of R0 on entry
 *
 * Output:        xsize - value of R2 on exit
 *                ysize - value of R3 on exit
 *                xres - value of R4 on exit
 *                yres - value of R5 on exit
 *                age - value of R6 on exit
 *                usage_count - value of R7 on exit
 *
 * Other notes:   Calls SWI 0x40083 with R3 = 0x0.
 */

extern os_error *xfont_read_defn (font_f font, int *xsize,
      int *ysize, int *xres, int *yres, int *age,
      int *usage_count);
extern void font_read_defn (font_f font, int *xsize,
      int *ysize, int *xres, int *yres, int *age,
      int *usage_count);

************************************************

If I simply call the following function in my program:

void reset_fonts_on_mode_change ( void )
{
  int xeig, yeig;
  int xsize, ysize;
  int xres, yres;
  int shift;
  int age, usage_count;
  int xres_out, yres_out;

  font_read_defn (gr.font_handle, &xsize, &ysize,
                   &xres, &yres, &age, &usage_count );
  return;
}

then the "no stack" error is raised.

In the original BASIC program I simply called SYS "Font_ReadDefn", but
that requires a pointer to a buffer (for font identifier) to be passed in
R1. There is no evidence of this in the oslib version.

The other odd thing is that if I use DDT and single step through the
program, the error is not raised.

What am I doing that is stupid 8o)

Chris...

-- 
CHRIS JOHNSON                     mailto:C.A.Johnson at hw.ac.uk     (work)
                                  mailto:chris at bulldog.u-net.com  (home)



More information about the oslib-user mailing list