I’m using an LC3 microarchitecture simulator to write assembly code. I’ve only been writing assembly for about three weeks, so I am still very new.
My goal is to print all the numbers leading up to a set value, so for example, if the user selects ‘6’ the console prints 012345
My code works, but the unit test says my code is inefficient or has an infinite loop.
I set the value by manually setting R1 in my simulator to any value, the rest is automated with the code. Starting at 0x3000
LD, R0, X3001 ;Load R0 with 0 0 ;I did this b/c I don't know how to load a register with ascii values AND R2, R2, #0 ; Set R2=0 NOT R3, R1 ;invert R1, store in R3 ADD R3, R3, #1 ;Add 1 to R3, now R3=-R1 ADD R4, R0, R3 ; better way to perform loop? added these to maintain loop BRz X300b ; if previous math ever produces 0, skip to halt OUT ; print single char ADD R0, R0, #1 ; R0++ ADD R1, R1 #-1 ; R1-- BRnzp X3006 ;Always branch back to the above BR instruction HALT
3000 2000 0030 54a0 967f 16e1 1803 0404 f021 1021 127f 0ffb f025
So my question is, is there any way to make this more efficient?
✓ Extra quality
ExtraProxies brings the best proxy quality for you with our private and reliable proxies
✓ Extra anonymity
Top level of anonymity and 100% safe proxies – this is what you get with every proxy package
✓ Extra speed
1,ooo mb/s proxy servers speed – we are way better than others – just enjoy our proxies!
USA proxy location
We offer premium quality USA private proxies – the most essential proxies you can ever want from USA
Our proxies have TOP level of anonymity + Elite quality, so you are always safe and secure with your proxies
Use your proxies as much as you want – we have no limits for data transfer and bandwidth, unlimited usage!
Superb fast proxy servers with 1,000 mb/s speed – sit back and enjoy your lightning fast private proxies!
99,9% servers uptime
Alive and working proxies all the time – we are taking care of our servers so you can use them without any problems
No usage restrictions
You have freedom to use your proxies with every software, browser or website you want without restrictions
Perfect for SEO
We are 100% friendly with all SEO tasks as well as internet marketing – feel the power with our proxies
Buy more proxies and get better price – we offer various proxy packages with great deals and discounts
We are working 24/7 to bring the best proxy experience for you – we are glad to help and assist you!