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 June 29th, 2011, 03:24 PM
ddmeightball's Avatar
ddmeightball ddmeightball is offline
Man with a plan.
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Location: Nebraska
Posts: 322 ddmeightball User rank is Corporal (100 - 500 Reputation Level)ddmeightball User rank is Corporal (100 - 500 Reputation Level)ddmeightball User rank is Corporal (100 - 500 Reputation Level)ddmeightball User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 23 h 2 m 30 sec
Reputation Power: 12
Send a message via MSN to ddmeightball Send a message via Yahoo to ddmeightball
Other Language - LC-3 programming

I am taking an Information Systems Architecture class and the teacher has us writing a program in an LC-3 simulator that gets input from the keyboard until the user enters a asterisk, while each time they enter a capitol letter increment some sort of counter variable and then print it off once they enter an asterisk, all in binary.

So far I have written the program so that it gets input from the user, outputs it (just so I can see it) and then subtracts 42 (the ASCII value for the asterisk, via adding a -16, -16, and a -10 ) to see if they entered an asterisk or not. If it is either positive or negative, go back 6 memory locations and run the code again. If it is a zero, then that means they did enter an asterisk and then the program exits.

The trouble I am coming across is being able to determine whether the value they entered is a capitol letter or not. The ASCII value of a capitol A is 65 and Z is 90. I don't know if there is an easy way to check, but what I was thinking about doing is comparing the ASCII value of what the user entered and see if it is less than A (65) or greater than Z (90). If it matches both criteria, then it is definitely a capitol letter. My biggest issue is figuring out how to do this using the LC-3 simulator and in binary.

The binary below is my actual code, but I included so text describing what it is doing as well.

Code:
;	do
;		Obtain a character
;		Output a character
;		Check IF character < A
;		Check IF character > Z
;	while character != *


0011 000000000000 	;set x3000 as beginning location
1111 000000100011 	;input obtain a character
1111 000000100001 	;output output a character

0001 000 000 110000 	;Add -16 from R0
0001 000 000 110000	;ADD -16 from R0
0001 000 000 110110	;ADD -10 from R0
0000 101 111111010	;WHILE character !=* branch to loop if negative or positive by Adding -6

1111000000100101 	;halt
__________________
Otaku no Kamisama – God of the Geeks

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreOther Programming Languages > Other Language - LC-3 programming

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