delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/29/07:05:47

From: DavMac AT iname DOT com (Davin McCall)
Newsgroups: alt.lang.asm,comp.os.msdos.djgpp,comp.os.msdos.programmer
Subject: Re: NASM + DJGPP linking
Date: Tue, 29 Jun 1999 02:40:55 GMT
Organization: Monash Uni
Lines: 48
Distribution: world
Message-ID: <377831c4.1237283@newsserver.cc.monash.edu.au>
References: <930622805 DOT 86738 AT kyle DOT inet DOT net DOT nz>
NNTP-Posting-Host: damcc5.halls.monash.edu.au
X-Trace: towncrier.cc.monash.edu.au 930624026 6945 130.194.198.138 (29 Jun 1999 02:40:26 GMT)
X-Complaints-To: abuse AT monash DOT edu DOT au
NNTP-Posting-Date: 29 Jun 1999 02:40:26 GMT
X-Newsreader: Forte Free Agent 1.1/32.230
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

SP points to topmost stack value. You do:
	push BP
	mov BP, SP
which sets [BP]=(old BP), [BP+4]=(return address), [BP+8]=first
argument.

Therefore you need to  use [BP+8] instead of [BP+4].

Davin.

On Tue, 29 Jun 1999 14:05:57 +1200, "David Mitchell"
<dmitchell AT inet DOT net DOT nz> wrote:

>Umm, I have written the following for NASM:
>
>[SECTION .text]
>
>GLOBAL _setmode     ; setmode(int mode)
>
>_setmode:
>    push bp
>    mov bp, sp
>
>    push ax
>    push dx
>
>    mov ax, [bp+4]
>    int 10h
>
>    pop dx
>    pop ax
>
>    pop bp
>
>    ret
>

[snip]

>
>when I run a.exe, nothing happens.  But it should change to screen 13h.
>What is happening, can somebody please help!
>
>David

__________________________________________________________
       *** davmac - sharkin'!! davmac AT iname DOT com ***
my programming page: http://yoyo.cc.monash.edu.au/~davmac/

- Raw text -


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