0

So I am very new to Assembly Language, my professor has been in and out of the class so we haven't had much time to really thoroughly go through the course material. So for our project we are using Pep9 and we have couple of things to do, which i am comfortable with but I need help getting started.

Our goal for part 1 is to simply type out our name using pep9. We used one of the programs built in pep9 figure 4.33 which prints out the letters "Hi" as a format for our name. This is how the figure shows it

0000  D1000D  ;Load byte accumulator 'H'
0003  F1FC16  ;Store byte accumulator output device
0006  D1000E  ;Load byte accumulator 'i'
0009  F1FC16  ;Store byte accumulator output device
000C  00      ;Stop
000D  4869    ;ASCII "Hi" characters

How it looks written horizontally

D1 00 0D F1 FC 16 D1 00 0E F1 FC 16 00 48 69 zz

My name is Arslan and this is the how I write it following the ASC11 table

D1 00 25 F1 FC 16 D1 00 26 F1 FC 16 D1 00 27 F1 FC 16 D1 00 28 F1 FC 16 D1 
00 29 F1 FC 16 D1 00 2A F1 FC 16 00 41 72 73 6C 61 6E zz

This prints out my first name "Arslan"

Now here is my question, I had to do this all by hand meaning I had to draw the ram from 0000 - 002A and move them down by however much i needed. So I wanted to ask is their a better way to do this, meaning in the first example the letter 'H' was stored in location 0D and letter 'i' was stored in the location 0E thats two letter in total but when I added extra 4 more letters with those load and store instructions to the program everything shifted down and the letters were now stored at location 00024 - 0002B now is their an algorithm or easier way to figure how much will the location shift down, how did it goes from 0D to 25 for the first letter?

I feel like there is a simple answer for this but I am very new to this and I am slow for this language then compared to C++ or JAVA

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Arslan K
  • 13
  • 2
  • Normally one would place the starting address in a register, and then have a loop which during each iteration loads and prints a single character. You stop looping when you find the string terminator, or when you've printed some predetermined number of characters. – Michael Nov 06 '18 at 07:34
  • "how did it goes from 0D to 25": The code to write a single character needs 6 bytes, plus 1 for the 'stop'. So writing the 6 characters of the string - using your way of coding - consumes 6*6+1 = 37 bytes = 0x25. (0x00-0x24 is the code, 0x25+ the string) – Tommylee2k Nov 06 '18 at 10:31

0 Answers0