From: Joseph Rose Newsgroups: comp.os.msdos.djgpp Subject: Re: 3rd Try: Maybe an asm problem? (Problems linking) Date: Fri, 28 Apr 2000 17:21:51 -0400 Organization: Posted via Supernews, http://www.supernews.com Lines: 153 Message-ID: <390A00EE.695124@pop.gis.net> References: <39096460 DOT 1D069B39 AT pop DOT gis DOT net> <390969a0 DOT 9237112 AT news DOT freeserve DOT net> <3909DAFE DOT CADFC30F AT pop DOT gis DOT net> <3909ed43 DOT 42944527 AT news DOT freeserve DOT net> X-Complaints-To: newsabuse AT supernews DOT com X-Mailer: Mozilla 4.7 [en]C-NECCK (Win98; I) X-Accept-Language: en MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Steamer wrote: > Joseph Rose wrote: > > >I have described what the asm source code looks like. > > Only very vaguely. My NASM files look like that too, but they work. > How have you declared the segments? > SECTION .text All data and stack as of yet are given by the calling routine, so there is no data section. > > >If you need more, I can publish a function in question and > >the beginning of the file. > > Go on then. > It's at the end of the post. > > Looking at your other post, however, your problem may be elsewhere. > The prototypes for your asm functions need to be wrapped in > extern "C" {} if you're using C++, unless you've taken name-mangling > into account in your asm file. > I'll try that. If name-mangling is more than "_" at the beginning of the name, then I don't know about it. > > S. . == -|-=- |\_/| ; ----/ -= - / .-=| \[/ - -=|-\=--= | ..-==\ --==+==-- --=-|=|- -= / .---==\ /[\ =- /==-==- / ..---===\ ; =-|- -\-- --__----__--- . | - | ```` ` / \ -------------- VGADr386.asm: . . . BITS 32 COMMON VidBuffer 6 SECTION .text ;SEGMENT VGA8_2D FLAT PUBLIC 'GRAPHICS' GLOBAL _ClrScn, _Screen_Copy GLOBAL _Draw_Pixel, _Read_Pixel GLOBAL _Draw_Line_Horiz, _Draw_Line_Vert, _Draw_Line GLOBAL Draw_Line_Horiz GLOBAL _Draw_Box, _Draw_Tri GLOBAL _Draw_Image, _Font_Print ;EXPORT _Draw_Line_Horiz %INCLUDE "c:\zzz\gr\386p\VGADR386.MAC" . . . %IFDEF Line2 ;Draws a horizontal line from left to right. _Draw_Line_Horiz: ;PROC NEAR ;Draw_Line_Horiz: ; PROC ;InitX=D[EBP+16] ;InitY=D[EBP+12] ;Len=W[EBP+10] ;Col=W[EBP+8] PUSH EBP ;Set up to read stack. MOV EBP,ESP PUSH DS MOVZX ECX,WORD [SS:EBP+10] ;Load length of line. JECXZ .Exit ;No length? Exit. ;Error Check: %IFDEF OffScreen CMP DWORD [SS:EBP+12],200 ;Is line outside screen limits? JAE .Exit ; Yes--Exit. MOVSX EBX,WORD [SS:EBP+16] ;Load InitX into BX reg. for testing. CMP EBX,320 ;Off the right side of the screen?--Exit. JGE .Exit TEST EBX,EBX ;Negative? JNS .ChkX2 ADD ECX,EBX ;If so, decrease length by -InitX to counteract ; screen overflow, JS .Exit ; (Exit if line's to the left of the screen) XOR EBX,EBX ; and make InitX = 0. MOV DWORD [SS:EBP+16],EBX .ChkX2: ADD EBX,ECX ;Will line be drawn off the right screen border? SUB EBX,320 JS .ChkXF SUB ECX,EBX ;If so, truncate the overflow. .ChkXF: %ENDIF ;Draw Line: LDS EDI,[CS:VidBuffer] ;Load memory pointer to video buffer. ;Calculate starting pos. CalcPixelLoc EDI,EAX,DWORD [SS:EBP+16],DWORD [SS:EBP+10] MOV AL,BYTE [SS:EBP+6] ;Load color twice (for hi byte and low byte) for MOV AH,AL ; faster writing in Dword increments. MOV BX,AX SHL EAX,16 MOV AX,BX CALL _Draw_Line_HorizHere .Exit: POP DS POP EBP ;Exit. RET ;ENDP %ENDIF %IFDEF Line2 ;Draws a horizontal line of color AX and length CX starting at pixel at ;DS:DI. The caller is responsible for error-checking. _Draw_Line_HorizHere: ; PROC JCXZ .Exit SHR ECX,1 JNC .W MOV [DS:EDI],AL INC EDI JCXZ .Exit .W: SHR ECX,1 JNC .D MOV [DS:EDI],AX ADD EDI,2 .D: MOV [DS:EDI],EAX ADD EDI,4 DEC ECX JNZ .D .Exit: RET %ENDIF . . .