• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

CMa Assembly Code Help

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Last question of a 4 question assignment. Here is the question: " Execute CMa code assuming that prior execution of the values of SP = 0. What does the given code compute when the memory allocation with address 3 is given? ". Here is Part A instructions: loadc 0, loadc 1, loadc 13, loadc 1, le, jumpzA. Here is Part B: loada 3, loada 2, geq, jumpzB, loada 3, loada 2, geq, jumpz B, loada 3, loada 2, geq, jumpz B, loada 3, loadc 2, geq, jumpz B, loada 1, loadc 1, add, storea 1, pop, loadc 2, loada 2, mul, storea 2, pop, jumpz A, halt.                                   OK, here is my approach and it would help if someone pointed any misconception or erroneous attempts before I try this. Basically it seems like I need to translate store, load, add into a bunch of 0's and 1's using a things like Oppcode, Assembly language instruction, etc, where, store --> 0 1 1, load --> 0 1 0, and add --> 0 0 0 with mapping Mnemonic to Oppcode is also used where A  is 0 0, B is 0 1, C is 1 0, and D is 1 1. Also part of the tools would be ABC, CDA, DBA, and ADC all with add the have associated different 16 two part 8 digit strings of 0's and 1's. Now, using 3 bit Oppcode allows the processer to map 2'3 Mnemonic there are 8 instructions (this I completely don't understand). However I do get if you increase the Oppcode to 2'8, you then have 256 instructions and I see the relationship of the # of bit operator to instruction. Other but of info I got was a load's source is a memory address, not a register, and the source field is uneeded and must be zeroed out.               OK. I am lost in respect to where I start, how the Mnemonics work to use the store, load, etc that specify the 3 digit Oppcode and how the assembly language instruction is produced to give a ABC --> 16 digit (0, 1), and in what order to do all this. Furthermore, I am not sure how to "execute" CMa code "assuming" that prior execution of the values of SP = 0 and what the given aforementioned code (A and B) computers to when the memory location with address 3 is given as the input. Any help is greatly appreciated, John
 
Saloon Keeper
Posts: 28325
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you re-post the code in "Code" tags (there's a Code button on our forum editor)? It will preserve their formatting. Otherwise the text justifier will just cram everything together as one big unreadable paragraph (which is what it did!)
 
John Griner
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Absolutely, I will when I get a break from work, John
 
Your mother is a hamster and your father smells of tiny ads!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic