delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/03/12/03:59:41

From: Matthew Moss <mmoss AT panix DOT com>
Subject: What's wrong with my grafx routine?
To: djgpp AT sun DOT soe DOT clarkson DOT edu (DJGPP Mailing List)
Date: Sat, 12 Mar 1994 03:32:40 -0500 (EST)

I'm trying to write a simple graphics routine using the GNU assembler which is
quite different from what I'm used to.

The routine is a simple, mode 13h specific, horizontal line-drawing function.
The "C" function prototype is:  hLine(int offset, int length, int color);
where offset is pre-calculated memory offset from 0xA0000, length is the
line length, and color is, well, the desired color.

        .text
.globl  _hLine

_hLine:
        pushl   %ebp			; save last frame pointer
        movl    %esp, %ebp		; set frame pointer to current frame
        pushl   %edi			; save value of %edi

        movl    $0xA0000, %eax		; video memory starts at 0xA0000
        addw    8(%ebp), %ax		; add the offset
        movl    %eax, %edi		; move into %edi -- used by stosb
        movl    $0, %ecx		; clear count variable
        movw    10(%ebp), %cx		; load it with length of line
        movb    12(%ebp), %al		; load data with color byte

        rep				; draw line of length %ecx
        stosb				; and color %al

        popl    %edi			; recall old %edi value
        movl    %ebp, %esp		; undo stack and frame changes
        popl    %ebp			;    made at beginning
        ret


After calling my routine to set the mode (which I can see does work), I'm
getting the generic segmentation errors that I always get from DJGPP.
Anyone have any ideas? This should be useable by any current machine, since
this is a VGA mode, *not* SVGA nor VESA.

Thanx for help....

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019