need help on pep/8 machine language program

Reply

Join Date: Nov 2005
Posts: 27
Reputation: jack223 is an unknown quantity at this point 
Solved Threads: 0
jack223 jack223 is offline Offline
Light Poster

need help on pep/8 machine language program

 
0
  #1
Dec 6th, 2006
sorry, i don't know which forum i should post this question.

Q) a machine language program to input 2 numbers then adds 2 numbers then output the single-character result.

this is what i got so far but it doesn't work..any help plz~~

  1. 0000 4900FE ;Get input from the user and store it @ 00FE
  2. 0003 4900FF ;Get input from the user and store it @ 00FF
  3. 0006 910022 ;Convert second input to decimal
  4. 0009 F100FA ;Store second decimal
  5. 000C D100FE ;Load first input into memory
  6. 000F 910022 ;Convert first input to decimal
  7. 0012 7100FA ;Add two numbers
  8. 0015 A10020 ;convert sum to character
  9. 0018 F1001F ;store the character
  10. 001B 51001F ;output the character
  11. 001E 00 ; stop
  12. 001F 00 ; character to output
  13. 0020 0030 ; convert mask to ASCII from decimal
  14. 0022 000F ; convert mask to decimal from ASCII
  15.  
  16. Hex Version for the Loader in Pep/8 simulator
  17.  
  18. 49 00 FE 49 00 FF 91 00 22 F1 00 FA D1 00 FE 91 00 22 71 00 FA A1 00 20 F1 00 1F 51 00 1F 00 00 00 30 00 0F zz
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 23
Reputation: Day Brown is an unknown quantity at this point 
Solved Threads: 0
Day Brown Day Brown is offline Offline
Newbie Poster

Re: need help on pep/8 machine language program

 
0
  #2
Dec 7th, 2006
for what purpose? And why not just store and add the hex, then if you want convert only the answer to dec for std out.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 20
Reputation: skeet123 is an unknown quantity at this point 
Solved Threads: 0
skeet123 skeet123 is offline Offline
Newbie Poster

Re: need help on pep/8 machine language program

 
0
  #3
Apr 7th, 2007
Originally Posted by Day Brown View Post
for what purpose? And why not just store and add the hex, then if you want convert only the answer to dec for std out.

Did anyone ever figure out why this did not work?
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 23
Reputation: Day Brown is an unknown quantity at this point 
Solved Threads: 0
Day Brown Day Brown is offline Offline
Newbie Poster

Re: need help on pep/8 machine language program

 
0
  #4
Apr 7th, 2007
Originally Posted by skeet123 View Post
Did anyone ever figure out why this did not work?
i DIDNT even think about it. As I infer in another post, with today's DRAM and CPU speed, simplicity is far more important, and nothing is simpler than a lookup table.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 20
Reputation: skeet123 is an unknown quantity at this point 
Solved Threads: 0
skeet123 skeet123 is offline Offline
Newbie Poster

Re: need help on pep/8 machine language program

 
0
  #5
Apr 11th, 2007
I am trying to get this problem worked out but still not able get it right.

0000 4900FE ;Get input from the user and store it @ 00FE
0003 4900FF ;Get input from the user and store it @ 00FF
0006 D100FE ;load first input to memory
0009 910025 ;Convert first input to decimal
000C F100FE ;Store first decimal
000F D100FF ;Load second input into memory
0012 910025 ;Convert second input to decimal
0015 7100FE ;Add two numbers
0018 A10023 ;convert sum to character
001B F100FF ;store the character
001E 5100FF ;output the character
0021 00 ; stop
0022 00 ; character to output
0023 0030 ; convert mask to ASCII from decimal
0025 000F ; convert mask to decimal from ASCII



49 00 FE 49 00 FF D1 00 FE 91 00 25 F1 00 FE D1
00 FF 91 00 25 71 00 FE A1 00 23 F1 00 FF 51 00
FF 00 00 00 30 00 0F zz

My input is:
5
2

Output:
4


Any help would be appreciated.
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 23
Reputation: Day Brown is an unknown quantity at this point 
Solved Threads: 0
Day Brown Day Brown is offline Offline
Newbie Poster

Re: need help on pep/8 machine language program

 
0
  #6
Apr 12th, 2007
Originally Posted by skeet123 View Post
I am trying to get this problem worked out but still not able get it right.

0000 4900FE ;Get input from the user and store it @ 00FE
0003 4900FF ;Get input from the user and store it @ 00FF
0006 D100FE ;load first input to memory
0009 910025 ;Convert first input to decimal
000C F100FE ;Store first decimal
000F D100FF ;Load second input into memory
0012 910025 ;Convert second input to decimal
0015 7100FE ;Add two numbers
0018 A10023 ;convert sum to character
001B F100FF ;store the character
001E 5100FF ;output the character
0021 00 ; stop
0022 00 ; character to output
0023 0030 ; convert mask to ASCII from decimal
0025 000F ; convert mask to decimal from ASCII



49 00 FE 49 00 FF D1 00 FE 91 00 25 F1 00 FE D1
00 FF 91 00 25 71 00 FE A1 00 23 F1 00 FF 51 00
FF 00 00 00 30 00 0F zz

My input is:
5
2

Output:
4


Any help would be appreciated.
Do all the math in hex. Only convert to decimal at output.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC