www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/11/25/21:05:39

From: "=?iso-8859-1?Q?stefan_fr=F6berg?=" <traveler AT netti DOT fi>
Newsgroups: comp.os.msdos.djgpp
Subject: Bug squasher(s) needed (or else you do not get any presents...)
Date: Fri, 26 Nov 1999 03:33:11 +0200
Organization: SAUNALAHDEN SERVERIN asiakas
Lines: 147
Message-ID: <81knl1$nkv$1@tron.sci.fi>
NNTP-Posting-Host: mccclxiv.hdyn.saunalahti.fi
Mime-Version: 1.0
X-Newsreader: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Tämä on moniosainen MIME-muotoinen viesti.

------=_NextPart_000_000F_01BF37BE.F6F92420
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello !

About four weeks to Chrismas !

Okay, back to business...
If I ask nicely would some of you cybernauts in cyberspace be so kind
and check the following NASM code that puts a string on the screen using =

BIOS functions and method explained in FAQ 18.2. (I think there is a=20
problem for placing the string to screen)

Also, there are few code examples in GAS, Inline Asm & NASM in my
homepage http://www.saunalahti.fi/traveler (under construction, LIBBIN
and LIBDOS are not ready yet). So it would be nice if somebody could=20
check these too and report any bugs or improvement for me.

Thanks in Advance
And Merry Ch... (Oh, not just yet)
traveler AT netti DOT fi


------=_NextPart_000_000F_01BF37BE.F6F92420
Content-Type: application/octet-stream;
	name="writetext.s"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="writetext.s"

; INT:          10h (BIOS Video Service)
; Service:      13h (Subservice 00h)
; Input:        AH =3D 13h
;               AL =3D 00h
;               BL =3D attribute
;               BH =3D display page
;               DX =3D starting cursor position
;               CX =3D length of the string
;               ES:BP -> start of string

; typedef unsigned char BYTE;
; typedef unsigned short WORD;
;
; void  writetext(WORD location,BYTE color,char *string,BYTE page);


BITS    32
EXTERN  _dosmemput
EXTERN  ___dpmi_allocate_dos_memory
EXTERN  ___dpmi_free_dos_memory
EXTERN  _strlen
GLOBAL  _writetext
SECTION .text
_writetext:     push    ebp
                mov     ebp,esp
                sub     esp,8

                push    dword[ebp+16]          =20
                call    _strlen
                add     esp,4                  =20
                mov     dword[ebp-4],eax        ;copy string length for =
later use

                add     eax,15                  ;convert string size to =
paragraph value
                shr     eax,4

                mov     eax,10
						; is the following necessary
                push    dword[ebp-8]            ;selector (just a =
dummy...)
                push    eax
                call    ___dpmi_allocate_dos_memory
                add     esp,8
                mov     dword[ebp-8],edx        ;save selector for later =
use

                shl     eax,4                   ;convert segment to =
linear address

                push    eax                     ;linear address
                push    dword[ebp-4]            ;length of the string
                push    dword[ebp+16]           ;address of the string
                call    _dosmemput
                add     esp,12

                push    es                     =20
                push    ebp

                mov     ax,0x1300               ;Function 13h, =
subservice 00h
                mov     bl,byte[ebp+12]         ;attribute
                mov     bh,byte[ebp+20]         ;display page
                mov     dx,word[ebp+8]          ;starting cursor =
position
                mov     cx,word[ebp-4]          ;length of the string
                mov     es,word[ebp-8]          ;selector
                xor     ebp,ebp                 ;offset is zero
                int     0x10
               =20
                pop     ebp
                pop     es
               =20

                push    dword[ebp-8]            ;selector
                call    ___dpmi_free_dos_memory
                add     esp,4

                add     esp,8
                pop     ebp
                ret


------=_NextPart_000_000F_01BF37BE.F6F92420
Content-Type: application/octet-stream;
	name="main.c"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="main.c"

#include <conio.h>
#include <go32.h>
#include <dpmi.h>
#include <string.h>
#include <sys/movedata.h>


typedef unsigned char   BYTE;
typedef unsigned char   WORD;

extern  void    setborder(unsigned char color);
extern  void    writetext(unsigned short location,unsigned char =
color,char *string,unsigned char page);


int     main(void)
{
        writetext(40,14,"Hello There",0);
}

------=_NextPart_000_000F_01BF37BE.F6F92420--

- Raw text -


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