0

I am trying to write an assembly language program that prints a first name--e.g., Thomas. It is supposed to use the .ASCII pseudo-operation to store the characters at the bottom of the program, and the CHARO instruction to output the characters. When I look at an example in the textbook:

;Stan Warford

;January 13, 2009

;A program to output "Hi"

;

CHARO   0x0007,d   ;Output 'H'

CHARO   0x0008,d   ;Output 'i'

STOP  

.ASCII  "Hi"

.END

This outputs "Hi" correctly. However, when I try to write a program that outputs
Thomas, it doesn't work. What I have:

CHARO       0x0004 ,d   ;output T
CHARO       0x0005 ,d   ;output h
CHARO       0x0006 ,d   ;output o
CHARO       0x0007 ,d   ;output m
CHARO       0x0008 ,d   ;output a
CHARO       0x0009 ,d   ;output s
STOP
.ASCII      "Thomas"
.END

When I run this, nothing is being output to the screen. I am trying to run this on the Pep/8 simulator. Am I missing something really obvious here? Is there a specific hex value I need to start with when using the CHARO commands--e.g., 0x0007? Thanks in advance for the advice.

2 Answers2

1

I haven't ever used pep8, but according to docs, these variants will work:

CHARO       0x0013,d
CHARO       0x0014,d
CHARO       0x0015,d
CHARO       0x0016,d
CHARO       0x0017,d
CHARO       0x0018,d
STOP
.ASCII      "Thomas"
.END

or:

CHARO   'T',i
CHARO   'h',i
CHARO   'o',i
CHARO   'm',i
CHARO   'a',i
CHARO   's',i
STOP  

.END

or

STRO msg,d
STOP
msg: .ASCII "Thomas\x00"
.END
Iłya Bursov
  • 23,342
  • 4
  • 33
  • 57
0

This is the correct code, using the name "Miranda" as an example:

    CHARO 0x0016 ,d ;output M
    CHARO 0x0017 ,d ;output i
    CHARO 0x0018 ,d ;output r
    CHARO 0x0019 ,d ;output a
    CHARO 0x001a ,d ;output n
    CHARO 0x001b ,d ;output d
    CHARO 0x001c ,d ;output a
    STOP
    .ASCII "Miranda"
    .END