• 1

Convert from Pseudo-code to assembly instructions


Question

Hi there, I've got this homework problem I'm stuck with, I've got a few questions so I'm not asking for help on all of them, but if someone could help me out with this first one it'll show me the direction to complete the others.

I have to take small sections of high-level pseudo-code and convert it into assembly instructions, (obviously not majorly specific but to get a general idea of the instructions that would be used).

Currently struggling on BRANCHES used as a replacement for IFs and LOOPs. If someone could do this question, I'd be really grateful, thanks.

A <-- 0;
Repeat
     A <-- A + 1;
Until A = 99; 

For example, I know "A <-- A + 1" would be something like "INC A" for increment.

Many thanks in advance.

5 answers to this question

Recommended Posts

  • 0

sorry i wont do the question for you, however i will give you a little help, basicly what you need to to is move 0 in to ax register, then put a label on the line with the increment ax instruction, compare register a with 99, then do a branch if not equal (BNE) to the label.

guess im a little slow at typing

  • 0
  XenonicRob said:
I see - many thanks - what does the "xor ax, ax" mean?

585024631[/snapback]

It's a habit with x86 programmers. It effectively clears ax (sets it to zero). It's usuallu done this way since it saves one byte of caode (yes, one precious byte). :p

EDIT: Damn it! I didn't read the HW part. I shouldn't have given you the answer. But is you're not using x86 (it's not taught in uni since it's crap), then it's not much help.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • As it would on any other tech website whether it be Windows, Apple, etc. I wouldn’t expect it any other way.
    • Mozilla should shut down everything except the browser and the services they whitelabel (for example Firefox VPN from Mullvad). Everything else just cost them money and have never returned any revenue. Focusing in the browser is what makes sense considering what is going to change regarding their income sources. About Firefox and chromium... if they ever have to abandon Gecko because of financial issues it is more likely to use Apple's WebKit and not Chromium and Blink. WebKit is more versatile for Firefox because it will allow them even to keep Firefox's extension ecosystem. The same way GNOME Web which is a WebKit browser has experimental Firefox extension support.
    • I really dont like how they’ve put shadows under window elements making the sidebar and toolbar buttons look like they sit above the window itself. Looks very odd and clunky.
    • Rubbish. It's chock-full of ads and with manifest 3.0,the gloves are off. Google does not even pretend now. They want évil and want your data
    • Glary Utilities 6.27.0.31 by Razvan Serea Glary Utilities offers numerous powerful and easy-to-use system tools and utilities to fix, speed up, maintain and protect your PC. Glary Utilities allow you to clean common system junk files, as well as invalid registry entries and Internet traces. You can manage and delete browser add-ons, analyze disk space usage and find duplicate files. You can also view and manage installed shell extensions, encrypt your files from unauthorized access and use, split large files into smaller manageable files and then rejoin them. Furthermore, Glary Utilities includes the options to find, fix, or remove broken Windows shortcuts, manage the programs that start at Windows startup and uninstall software. All Glary Utilities tools can be accessed through an eye-pleasing and totally simplistic interface. Glary Utilities 6.27.0.31 changelog: Optimized Disk Cleaner: Optimized the scanning algorithm for Firefox to enhance user experience. Optimized Disk Cleaner: Added support for Nitro Pro 14. Optimized Tracks Eraser: Optimized the scanning algorithm for Firefox to enhance user experience. Optimized Tracks Eraser: Added support for Nitro Pro 14. Optimized Startup Manager: Optimized the review algorithm to enhance user experience. Optimized Uninstaller Manager: Optimized the scanning algorithm to enhance user experience. Minor GUI improvements. Minor bug fixes. Download: Glary Utilities 6.27.0.31 | 27.0 MB (Freeware) Download: Portable Glary Utilities | 32.3 MB View: Glary Utilities Homepage | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
  • Recent Achievements

    • One Month Later
      Æhund earned a badge
      One Month Later
    • One Month Later
      CoolRaoul earned a badge
      One Month Later
    • First Post
      Kurotama earned a badge
      First Post
    • Collaborator
      Carltonbar earned a badge
      Collaborator
    • Explorer
      MusicLover2112 went up a rank
      Explorer
  • Popular Contributors

    1. 1
      +primortal
      508
    2. 2
      ATLien_0
      269
    3. 3
      +FloatingFatMan
      241
    4. 4
      +Edouard
      202
    5. 5
      snowy owl
      168
  • Tell a friend

    Love Neowin? Tell a friend!