glu Skrevet 5. januar 2004 Del Skrevet 5. januar 2004 Jeg har såvidt begynt på assembly og lager noen svært enkle programmer nå i begynnelsen. Jeg tenkte jeg skulle prøve å la en asm fil hente prosedyrene sine i en annen asm fil, men får ikke dette til å funke. Begge filene assembles helt fint, men når jeg skal linke dem går det galt og jeg får denne feilmeldingen: Microsoft (R) Incremental Linker Version 5.12.8087 Copyright (C) Microsoft Corp 1992-1998. All rights reserved. LINK: error : Segment reference in fixup record eat.obj : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt De to *.asm filene mine ser slik ut, eat.asm skal hente noen prosedyrer fra vidlib.asm, og vidlib.asm får noen verdier fra eat.asm, dette er skrevet for en 8086 CPU: Eat.asm: MyStack SEGMENT STACK DB 512 DUP (?) MyStack ENDS MyData SEGMENT PUBLIC PUBLIC CRLF,LRXY Eat1 DB "Eat at Joe's...",'$' Eat2 DB "...some other string",'$' CRLF DB 0AH,0DH,'$' LRXY DW 184FH ;18H = 24D; 4FH = 79D TextPos DW ? MyData ENDS MyCode SEGMENT PUBLIC EXTRN GotoXY:PROC,Write:PROC,Writeln:PROC,ClrScr:PROC assume CS:MyCode,DS:MyData Start: Main PROC mov AX,MyData mov DS,AX call ClrScr mov TextPos,0914H;0914H = X @ 20, Y @ 9 mov DX,TextPos call GotoXY lea DX,Eat1 call write mov DX,Textpos mov DH,10 call GotoXY lea DX,Eat2 call writeln mov AH,4CH mov AL,0 int 21H Main ENDP MyCode ENDS END Start Vidlib.asm: MyData SEGMENT PUBLIC EXTRN CRLF:BYTE,LRXY:WORD MyData ENDS MyCode SEGMENT PUBLIC PUBLIC Write,Writeln,GotoXY,ClrScr assume CS:MyCode,DS:MyData ;------------------------------------------------------------- ;GOTOXY -- Positions the hardware cursor to X,Y ; 1 Entry point: ; GotoXY: ; caller must pass: ; DL: X value These are both 0-based; i.e., they ; DH: Y value assume a screen 24x79 not 25x80 ; Action: Moves the hardware cursor to the X,Y position ; loaded into DL and DH ;------------------------------------------------------------- GotoXY PROC mov AH,02H ;Select VIDEO service 2: Position cursor mov BH,0 ;Stay with display page 0 int 10H ;Call VIDEO ret GotoXY ENDP ;------------------------------------------------------------- ;Write: Displays information on the screen via DOS service ; 9H: Print string ;------------------------------------------------------------- Write PROC mov AH,09H ;select DOS service 9: Print string int 21H ;call DOS ret Write ENDP ;------------------------------------------------------------- ;Writeln: Displays information on the screen via DOS service ; 9H: Print string and issues a newline ;------------------------------------------------------------- Writeln PROC call Write lea DX,CRLF;load address of newline into DS:DX call write ret Writeln ENDP ;------------------------------------------------------------- ;ClrScr: Clears the entire screen to blanks with 07H as the ; display attribute ;------------------------------------------------------------- ClrScr PROC mov CX,0 ;Upper-left corner of full screen mov DX,LRXY;load lower-right XY coordinates into DX mov AL,0 ;0 specifies clear entire region mov BH,07H ;Secify "normal" attribute for blanked line(s) mov AH,06H ;Select VIDEO service 6: initialize/scroll int 10H ;call VIDEO ret ClrScr ENDP MyCode ENDS END Når jeg skal linke de to *.obj filene bruker jeg kommandoen "link eat.obj vidlib.obj", er det her feilen ligger og ikke i kildekoden? Lenke til kommentar
glu Skrevet 5. januar 2004 Forfatter Del Skrevet 5. januar 2004 Glem det, fant feilen. 32bits linkere funker ikke på 16bits programmer Lenke til kommentar
Anbefalte innlegg
Opprett en konto eller logg inn for å kommentere
Du må være et medlem for å kunne skrive en kommentar
Opprett konto
Det er enkelt å melde seg inn for å starte en ny konto!
Start en kontoLogg inn
Har du allerede en konto? Logg inn her.
Logg inn nå