www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/07/18:02:26

From: Richard Nichols <tiberius AT mailhost DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Help with NASM+DJGPP
Date: Thu, 08 Jan 1998 08:31:02 +1000
Organization: None
Lines: 80
Message-ID: <34B40226.1136@mailhost.net>
Reply-To: tiberius AT mailhost DOT net
NNTP-Posting-Host: 138.77.56.32
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I'm in the middle of writing an all encompassing game library in
DJGPP+NASM but I keep getting crashes for no apparent reason.
Specifically I KNOW there is a problem with this function for
drawing a vertical line. In works in an arbitrary video mode, the
width and height being contained in vidCurrentWidth and 
vidCurrentHeight. The max window coords are in vidMaxX and vidMaxY.
It works for a few 100 lines and then gets a SIGSEGV anyone got
any ideas?


;
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
; gfxVline : Draws a vertical line in a single colour
;
; void gfxVline(int x, int y1, int y2, UCHAR col, UCHAR *where);
;
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
_gfxVline:
        push ebp
        mov ebp, esp

        mov ebx, [ebp + 8]              ; \
        cmp ebx, 0                      ; |
        jl .endit                       ; |>--- check x clipping
        cmp ebx, [_vidMaxX]             ; |
        jg .endit                       ; /

        mov eax, [ebp + 12]             ; \
        mov ecx, [ebp + 16]             ; |
        cmp ecx, eax                    ; |\___ check that ecx is bottom
y
        jg .dontxchg                    ; |/
        xchg ecx, eax                   ; |
.dontxchg:                              ; /

        cmp ecx, 0                      ; \
        jl .endit                       ; |___  check y clipping
        cmp eax, [_vidMaxY]             ; |
        jg .endit                       ; /

        cmp eax, 0                      ; \
        jnl .notopclip                  ; |
        xor eax, eax                    ; |
.notopclip:                             ; |\____  clip line to screen
        cmp ecx, [_vidMaxY]             ; |/
        jng .nobottomclip               ; |
        mov ecx, [_vidMaxY]             ; |
.nobottomclip:                          ; /

        mov edi, [ebp + 24]             ; \
        add edi, ebx                    ; |
        mov ebx, [_vidCurrentWidth]     ; |\
        sub ecx, eax                    ; ||---  setup destination and
copy
        xor edx, edx                    ; |/
        mul ebx                         ; |
        add edi, eax                    ; |
        mov eax, [ebp + 20]             ; /

.loopstart:                             ; \
        mov [edi], al                   ; |___ draw the line
        add edi, ebx                    ; |
        loop .loopstart                 ; /

.endit:
        pop ebp
        ret

-Richard

-- 
  .------------------------------+--------------------------------.
  | Richard Nichols              | Inspire Media (Demos/Games)    |
  | mailto:tiberius AT mailhost DOT net | mailto:InspireMedia AT post1 DOT com  |
  | http://tiberius.home.ml.org/ | http://inspire.home.ml.org/    |
  +------------------------------+--------------------------------+
  |               Organizer, coder for Inspire Media              |
  `---------------------------------------------------------------'
        "The life of the coder is that of the hermit, except
           the hermit can't make shadebobs." -- Leviathan

- Raw text -


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