www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/20/08:51:42

From: *SPAM*henrikra AT icenet DOT fi (Orcus)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Tricks of game programming gurus ---> doesn't work? - setmodec.c (0/1)
Date: Fri, 18 Sep 1998 04:50:04 GMT
Organization: Scifi Communications International, http://www.sci.fi/, helpdesk AT sci DOT fi, +358 3 2899111
Lines: 73
Message-ID: <3601e622.16908697@news.icenet.fi>
References: <3601e2e2 DOT 16076692 AT news DOT icenet DOT fi>
NNTP-Posting-Host: ccxxxi.rdyn.saunalahti.fi
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Fri, 18 Sep 1998 04:46:20 GMT, *SPAM*henrikra AT icenet DOT fi (Orcus)
wrote:

>I bought LaMothe's book "Tricks of game programming gurus".
>I've got a cd with compiler (DJGPP) and source of code from the book.
>I compiled FIRST code "setmodec.c" and got error message:"undefined
>reference to 'Set_Mode´"
>I compiled the code with arguments "gcc setmodec.c"
>Do i have to some how link that Assembly code to my C-file?
>
>Please help me...
>
>I attached the code to my message!
>
ups...
attach :setmodec.c

#include <stdio.h>

#define VGA256 0x13
#define TEXT_MODE 0x03

extern void Set_Mode(int mode);


void main(void)
{

// set video mode to 320x200 256 color mode

Set_Mode(VGA256);

// wait for keyboard to be hit

while(!kbhit()){}

// go back to text mode

Set_Mode(TEXT_MODE);

} // end main

attach:setmodec.asm

.MODEL MEDIUM,C                 ; use medium model with C parameter
passing
	
.CODE 				; this is the beginning of the code

PUBLIC Set_Mode                 ; this let's the linker have access to
the function
                                ; name so that it can be exported

Set_Mode PROC FAR C vmode:WORD    ; the function takes one parameter


mov ah,0                        ; function 0:set video mode
mov al, BYTE PTR vmode          ; set the mode we want to change to
int 10h                         ; use BIOS to set the mode

ret                             ; return to caller

Set_Mode ENDP                   ; this is the end of the procedure

END                             ; this is the end of the code









- Raw text -


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