Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 02-12-2008, 09:30 PM   #1
Solid State Member
 
Join Date: Aug 2006
Posts: 16
Default Assembly programming anyone?

Not sure if there are any assembly programmers here but I will give it a shot anyway. I am trying to write a simple password program that will take in 4 digits, store them in a buffer, then compare them to the string. If the 2 match, it will display UNLOCK message, if they don't match it will display LOCK message. I am using TASM to do the assembling but that doesn't really matter. My code is not working correctly however and I am not sure why. Here is the code if anyone wants to have a look and tell me if they see a problem.

Code:
			
DTSEG		SEGMENT
SECRET_CODE	DB	"1234"
STRING		DB	"Enter 4-digit code ",07H,24H
UNLOCK		DB	" Unlocked",07H,24H
LOCKED		DB	" Incorrect code: LOCKED",07H,24H
INBUF		DB	20	DUP(?)
DTSEG		ENDS


                        MOV AH,9H
			MOV DX,OFFSET STRING
			INT 21H
			MOV	DI,OFFSET INBUF		

NXTCH:		   MOV	AH,7H				
			INT	21H
			CMP AL,0DH
			JE 	CHECK
			MOV	[DI],AL				 
			INC	DI					 
			MOV	AH,2H
			MOV DL,'*'
			INT	21H
			JMP	NXTCH				

CHECK:		   MOV AL,0H
			MOV	[DI],AL
			MOV	DI,OFFSET INBUF
			MOV	BX,OFFSET SECRET_CODE
			CMP BX,DI
			JE	UNLOCKED
			MOV AH,9H
			MOV	DX,OFFSET LOCKED
			INT	21H
			MOV	AH,4CH				
			INT	21H					
	
UNLOCKED:	MOV AH,9H
			MOV	DX,OFFSET UNLOCK
			INT	21H
			MOV	AH,4CH				
			INT	21H
__________________

3 blue merks is offline   Reply With Quote
Old 02-12-2008, 10:11 PM   #2
88
Fully Optimized
 
88's Avatar
 
Join Date: May 2005
Posts: 4,775
Send a message via MSN to 88
Default Re: Assembly programming anyone?

I only know MIPS architecture, what's the one you're using called?
__________________

__________________
Killing under the cloak of war is no different than murder

Kein Alkohol ist auch keine Lsung!
88 is offline   Reply With Quote
Old 02-12-2008, 10:20 PM   #3
Solid State Member
 
Join Date: Aug 2006
Posts: 16
Default Re: Assembly programming anyone?

Intel 8086/88.
3 blue merks is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 12:47 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0