Other Programming Languages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreOther Programming Languages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 22nd, 2012, 04:47 PM
starofstar starofstar is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 2 starofstar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 40 sec
Reputation Power: 0
Assembly help

I have done half, but don't know other half.
By looking at the comment, fill in the question marked filled.

org 100h
jmp START

_numberOperators EQU 7h
operatorString db ' +-*/^()' ;list of valid operators for IS_OPERATOR preceeded with a space

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;…
;This infinite loop reads a one character symbol from the keyboard and echoes it to the screen.
;Then calls IS_OPERATOR to find if it is true(1) or false(0) that the symbol is an operator.
;The '1' or '0' rv is sent to the screen and the screen advances to a new line.
;Kill this infinite loop by clicking the window's x button

START:
mov ah, 07h ;Read symbol
int 21h ;from keyboard.
mov ah, 02h ;Echo
mov dl, al ;symbol
int 21h ;to screen

push dx ;Push argument. The previous "mov dl, al" moved symbol into dl.
call IS_OPERATOR ;Call IS_OPERATOR to find if input symbol is an operator.
pop dx ;This loads dl with rv (1 0r 0) to be echoed to screen.
mov ah, 02h ;Send rv
int 21h ;to screen

;Advance screen to new print line
mov ah, 02h
mov dl,0Dh
int 21h
mov dl,0Ah
int 21h

jmp START ;Jump to START of infinite loop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;…


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;…
;IS_OPERATOR returns true(1) or false(0) that the input parameter is an operator
IS_OPERATOR Proc

;Push 3 registers subrtn will use.
push ax ;Stores the input char in al
push bx ;Used as subscript i in C++ version
push bp ;Stores sp

;???????? ;mov sp to bp

;??? ;mov argument (input char) to ax
;??? ;mov _numberOperators to bx
;??? ;mov input char to beginning of operatorString; in C++ operatorString[0]=symbol;

jmp WHILE_CONDITION
WHILE_TOP: ;loop to see if input is an operator
;??? ;in C++ i = i-1;
WHILE_CONDITION:
;cmp ??? ;check to see if the input is equal to one of the operators:
;j? ??? ;in C++ if (symbol != operators[i])goto WHILE_TOP;

;If bx=0, symbol wasn't found in the original initialization of the array and return 0 (equivalent to false).
;Else symbol was part of the original initialization of the array and set bx=1 (equivalent to true).
;cmp ???
;???
;??? ;set up to return 1 (the symbol is an operator).
END_IF:

;this line makes 0 into '0' and 1 into '1' so they will print to the screen in ascii
add bx,30h ;AFTER proving to me that your pgm works, remove this line

;??? ;mov bx (the rv) to the stack

;Restore registers subrtn used
;???
;???
;???
ret
IS_OPERATOR ENDP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;…

THE OUT PUT SHOULD LOOK LIKE THIS:
+1
-1
*1
/1
^1
<1
>1
00
10
20
30
40
50
60
70
80
90

Reply With Quote
  #2  
Old October 22nd, 2012, 06:12 PM
OmegaZero OmegaZero is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2007
Posts: 738 OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 6 h 2 m 27 sec
Reputation Power: 928
__________________
sub{*{$::{$_}}{CODE}==$_[0]&& print for(%:: )}->(\&Meh);

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreOther Programming Languages > Assembly help

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap