delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/31/16:01:37

Xref: news2.mv.net comp.os.msdos.djgpp:6630
From: dbarrett AT srvr1 DOT engin DOT umich DOT edu (David M Barrett)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Inline ASM :'Error : ect. ect."
Date: 31 Jul 1996 19:07:42 GMT
Organization: University of Michigan Engineering, Ann Arbor
Lines: 45
Message-ID: <4toatu$psp@srvr1.engin.umich.edu>
References: <s9404619 DOT 10 DOT 02B06262 AT student DOT utwente DOT nl> <4tnuup$mv0 AT srvr1 DOT engin DOT umich DOT edu>
NNTP-Posting-Host: blazers.engin.umich.edu
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

David M Barrett (dbarrett AT news-server DOT engin DOT umich DOT edu) wrote:
: : void VGA_Mode_13h_Normal_Blit_Video_Buffer(Video_Buffer *In_Buf,
: :                                            U16 X, U16 Y){
: : U8 *Data_Ptr;
: : U16 A,B;

: :         ASM("                                   \n
: :                 pushw %%es                      \n 
: :                 movw _our_global_selector, %%es \n 
: : --------------> movw %%es, %%ds                 \n 
: :                 movl $0xA0000, %%edi            \n 
: :                 imulw $320, %%ax                \n  (shifts would be faster)
: :                 addw %%bx, %%ax                 \n 
: : --------------> addw %%ax, %%edi                \n 
: :               next_line:                      \n (Is that label legal ???)
: :                         pushw   %%cx            \n 
: :                         movw    %%dx, %%cx      \n 
: :                         rep                     \n   
: :                         movsb                   \n 
: :                         pop %%cx                \n  (popw ????)
: :                         addw $320, %%edi        \n 
: :                         loop next_lineb         \n 
: :                 popw %%es                       \n 
: :             "
: :             :
: :             : "a" (Y),
: :               "b" (X),
: :               "c" (In_Buf->Dimensions.Y),
: :               "d" (In_Buf->Dimensions.X),
: :               "S" (In_Buf->Data));
: : }              

Ok, I figured out where my problems were.  I'm rather new to asm in 
general, and I didn't realize that you couldn't move between es and ds 
directly.  So, I just did "mov %_our_global_selector, %ds" and all was 
well.  But, I never did figure out what was wrong with the loop.  I just 
replaced it with a jnz and did the counter manually.  So, I'm still 
confused there.  Just to keep everyone up to par!

-David :)

-----------------------------------------------------------------------------
 David M. Barrett :)         |     University of Michigan / CAEN Hotline
 dbarrett AT engin DOT umich DOT edu    | http://www-personal.engin.umich.edu/~dbarrett
-----------------------------------------------------------------------------

- Raw text -


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