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 November 30th, 2010, 09:11 PM
goonj goonj is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2010
Posts: 3 goonj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 48 m 13 sec
Reputation Power: 0
Assembly - Assembly language program help

I need to create two procedures:
(1) SetColor receives two BYTE parameters: forecolor and backcolor.
It calls the SetTextColor procedure from the Irvine32 library.
(2) WriteColorChar receives three byte parameters:
char, forecolor, and backcolor.
It displays a single character,using the color attributes specified in forecolor and backcolor.
It calls the SetColor procedure, and it also calls WriteChar from the Irvine32 library. Both SetColor and WriteColorChar must contain declared parameters. Complete the missing part of the code for the two procedures.
Code:
TITLE SetColor and WriteColorChar

INCLUDE Irvine32.inc

SetColor PROTO forecolor:BYTE, backcolor:BYTE
WriteColorChar PROTO char:BYTE,forecolor:BYTE, backcolor:BYTE
.data
.code
main PROC
INVOKE WriteColorChar, 'A', white, blue INVOKE WriteColorChar, 'B', blue, white INVOKE WriteColorChar, 'C', green, black INVOKE WriteColorChar, 'D', yellow, gray INVOKE SetColor, lightGray, black
call Crlf
exit main ENDP

WriteColorChar PROC
******************code for writecolor!!*****************
WriteColorChar ENDP

SetColor PROC
************code for setcolor******************

SetColor ENDP END main


Another program in which i have to write a recursive implementation for Euclid's algorithm for finding GCD of 2 non negative integers.

I have prepared this pseudocode

algorithm GCD(a,b) //a and b are nonnegative integers if b>0 then
return (GCD(b,a mod b)
else // b = 0
return (a)
endif
end

and a rough draft of the program is here-
I need to write the code for the procedure CalcGCD PROC
I can not use .IF, .ELSE, . ENDIF directives.

Code:
INCLUDE Irvine32.inc
CalcGcd PROTO,int1:DWORD, int2:DWORD

.data
array SDWORD 0,5,7,0,11,7,438,226,26,13
;pairs to be tested: 0,5 and 7,0 and 11,7 etc. str1 BYTE "Greatest common divisor is: ",0

.code
main PROC

mov	ecx,LENGTHOF array / 2
mov	esi,OFFSET array

L1:	INVOKE CalcGcd,[esi],[esi+4]
mov	edx,OFFSET str1
call WriteString call WriteDec call Crlf
add	esi,TYPE array * 2
loop L1

exit main ENDP


Reply With Quote
  #2  
Old December 2nd, 2010, 04:19 PM
OmegaZero OmegaZero is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2007
Posts: 737 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 4 Days 23 h 23 m 50 sec
Reputation Power: 928
As I replied to your last thread, you won't get anywhere just dumping your homework here. Ask a questions / show an error message / show an incorrect output vs what you expect to happen and we can help you.

Also, some newlines are missing in the code you posted. It's important that you copy/paste the exact code you're using. Use the "Preview Post" button to check that everything looks right before submitting.
__________________
sub{*{$::{$_}}{CODE}==$_[0]&& print for(%:: )}->(\&Meh);

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreOther Programming Languages > Assembly - Assembly language program 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