1

I'm a computer science student, currently taking a course on computer organization. I would just like some help in understanding how to derive character operands in Assembly. The instructions in assembly are straightforward, charo/chari, deco/deci, etc. My misunderstanding lies in the operands. For instance:

CHARO 0x0007,d ;This will output "H"
CHARO 0x0008,d ;This will output "i"

How do you make the leap from "H", it's hex equivalent being 48, to 0x0007? Any clarification would be appreciated. I'm just trying to wrap my head around this so I can focus on the logic.


Edit by @mpetch:

What is missing is context. The full program is as follows:

CHARO 0x0007,d ;This will output "H"
CHARO 0x0008,d ;This will output "i"
STOP
.ASCII "Hi"
.END

The Pep/8 encoding of this program is:

51 00 07 51 00 08 00 48 69 zz
Michael Petch
  • 46,082
  • 8
  • 107
  • 198
Benjik26
  • 11
  • 1
  • 2
    What tooling and emulator do you use? Real modern computers would output a beep tone when printing 0x0007, not a "H". 0x0048 would output a "H" and 0x0069 would output an "i". On the Commodore home computers (which were very popular in the 1980s) 0x0008 would be a "H" and 0x0009 would be an "I" (these computers did not have lower-case letters)... – Martin Rosenau Feb 26 '20 at 05:54
  • Apologies, I forgot that it's machine dependent and didn't include that information. I'm using a pep/8 simulator. – Benjik26 Feb 26 '20 at 06:12
  • @Benjik26 Please add this detail to your question. Assembly is highly architecture and operating system dependent, so without knowing exactly what you are programming for, it is impossible to help you. – fuz Feb 26 '20 at 09:32
  • PEP/8 really outputs upper-case "H" for 7, but lower-case "i" for 8? That makes zero sense as an encoding scheme, even separate from ASCII. – Peter Cordes Feb 26 '20 at 10:56
  • Zero background in PEP/8. Based on this (https://people.stfx.ca/igondra/csci140/lectures/part6-2.pdf) `0x0007` is the offset and `d` is the data segment. I guess in your code before `CHARO` there are many `STA`, right? Those assign the values to `d`. – W. Chang Feb 26 '20 at 12:36
  • 2
    @PeterCordes: No. 0x0007 is the memory address, where the ASCII 'H' is . `d` means "direct memory" (`i` would load the value "immediately"). Take a look here: https://books.google.de/books?id=HC3jGITkyP8C&lpg=PA231&ots=Po5z0J6ZLT&dq=CHARO%200x0007&hl=de&pg=PA195#v=onepage&q=CHARO%200x0007&f=false – rkhb Feb 26 '20 at 12:43

0 Answers0