What's wrong with this code, when I assembled this in MASM32 it says Undefined symbol: DGROUP.
.MODEL SMALL
.STACK 100H
.DATA
STR1 DB 'Enter the First character : $'
STR2 DB 'Enter the Second character : $'
STR3 DB '$ : is first.'
.CODE
MAIN PROC
MOV AX, @DATA ; initialize DS
MOV DS, AX
LEA DX, STR1 ; load and print STR1
MOV AH, 9
INT 21H
MOV AH, 1 ; read a character
INT 21H
MOV BL, AL ; save the input character into BL
MOV AH, 2 ; carriage return
MOV DL, 0DH
INT 21H
MOV DL, 0AH ; line feed
INT 21H
LEA DX, STR2 ; load and print STR2
MOV AH, 9
INT 21H
MOV AH, 1 ; read a character
INT 21H
MOV BH, AL ; save the input character into BH
MOV AH, 2 ; carriage return
MOV DL, 0DH
INT 21H
MOV DL, 0AH ; line feed
INT 21H
LEA DX, STR3 ; load and print STR3
MOV AH, 9
INT 21H
CMP BL, BH ; compare the BL and BH
JNBE @ELSE ; jump to label @ELSE if BL>BH
MOV DL, BL ; move first character into DL
JMP @DISPLAY ; jump to label @DISPLAY
@ELSE: ; jump label
MOV DL, BH ; move second character into DL
@DISPLAY: ; jump label
MOV AH, 2 ; print the character
INT 21H
MOV AH, 4CH ; return control to DOS
INT 21H
MAIN ENDP
END MAIN
it is 16-bit code
you need to use a 16-bit linker, rather than the 32-bit linker
you should have one in the \masm32\bin folder named link16.exe
it assembles ok
i do see a problem with saving the first letter in BL
i do not remember if BX is preserved across INT 21h calls or not, but better to store it or push it onto the stack
here - try the attachment...
How to use 16-bit linker in masm32? I already have the link16.exe file. I have use this command,
c:\masm32\link32 compare.asm
Run File [compare.exe] compare
List File [nul.map]: compare
Libraries [.lib]: compare
Definitions File[nul.def]: compare
LINK : fatal error L1092: cannot open module-definition file - compare.def
Is there any way to modify this code in MASM32 32-bit syntax?
well - it is a 16-bit program
programs generally need to be totally rewritten for 32-bit :bg
for one thing, there is no INT 21h service
but - segmentation is different and so on
this isn't a complex program, so it wouldn't be hard to do
but you'd more or less start from scratch
i attached a working version above
Quotec:\masm32\link32 compare.asm
Run File [compare.exe] compare
List File [nul.map]: compare
Libraries [.lib]: compare
Definitions File[nul.def]: compare
LINK : fatal error L1092: cannot open module-definition file - compare.def
ok - first - i dunno where you got link32 - lol
this looks like link16 renamed as link32
for the definitions file, just hit enter, as you have no def file
I'm sorry it's link16 not link32. I try to translate this code in 32-bit format and I will post it here if it's done. Thanks for the help.
well - in the attachment, i sent a batch file named a16.bat
place it in the \masm32\bin folder - you may use it to assemble 16-bit code
a16 compare
on the other hand, it is better that you write in 32-bit
not sure what your instructor expects
he may be disappointed if you write 32-bit code that he doesn't understand - lol
he may also be disappointed if you use the masm32 libraries and macros to accomplish the task