Hello forum!
I'm having fun with DREAM assembler on a real dragon64, some 6809 books and an old letter quality printer. I've learned quite to try to "invent examples" on my own. Now I'm trying to do a "simple string manipulation library", at the moment at the 2nd stage of input from keyboard and output on screen: I'm capable of getting a string from keyboard and printing it on the screen, via subroutine and memory and the first version of this program works. The problems arrive when I try to implement a more general library that permits user to select where the string has to be printed, on screen on or serial. At the moment I'm trying to have the same results of the first version,the input from keyboard and the output to screen but all I have is constant garbage at every run and at the end only my complete string. Could I ask you some help to let me figure out what's going on?
I've uploaded image with the code...sorry they are scan of the printed code from Dream...I can save code on cassette only with the /S command on DREAM or with a /PM command printing the code...so funny...so old style....so tedious to do....
If you have time to help me thank you in advance
PS: another thing I would ask you: from the book "inside the dragon", my main source, I've seen many constant char declaration; they don't work as expected with my program. I've found the one that works is
MYSTR FCC LENGHT+1,/STRING/,0
Attachment:
-first version of the program
- second version of the program: on the image there are the main and the newer version of the PRINTL subroutine. Other 2 subroutines remain the same of the first image
dragon64 assembler: string I/O
- heavyfranz
- Posts: 6
- Joined: Sun Sep 01, 2013 10:37 am
- Location: Italy
Re: dragon64 assembler: string I/O
Wow, that's real retrocomputing! Welcome to the forum, heavyfranz!
But reading an upside-down scan of a poor printout is a pain... I have surely gotten spoiled over the years, but any chance you can get it transferred to tape (or directly to a computer) and post some plain text here?
If you can save it to tape and record the sound as a WAV on a computer you can use XRoar to convert it to a data file, by saving or printing to a file.
But reading an upside-down scan of a poor printout is a pain... I have surely gotten spoiled over the years, but any chance you can get it transferred to tape (or directly to a computer) and post some plain text here?
If you can save it to tape and record the sound as a WAV on a computer you can use XRoar to convert it to a data file, by saving or printing to a file.
Re: dragon64 assembler: string I/O
First I have to transform this "listings" just to be able to read it. Other may participate:
http://klasek.at/hc/string-io/
This style remembers to my decades old documention I had so far from my projects ...
http://klasek.at/hc/string-io/
This style remembers to my decades old documention I had so far from my projects ...
The dragon on my side: http://klasek.at/hc/dragon/
Re: dragon64 assembler: string I/O
The string definitions looks strange to me, they don't match the string termination character idea.
I don't know the assembler you are using, but mine accepts only one parameter and takes the first character as delemiter character which is expected as terminator for the string. Other restricts the terminator char to dedicated set like ['"/]. Therefore everything is taken verbose, the real terminating byte comes from the FCB statement.
A test in my simulator prints ",/STRINGA=/,0" ...
Code: Select all
FCC 9,/STRINGA=/,0
FCB 0
A test in my simulator prints ",/STRINGA=/,0" ...
The dragon on my side: http://klasek.at/hc/dragon/
Re: dragon64 assembler: string I/O
That's how the official Motorola assembler worked, but DREAM accepts multiple arguments and instead limits what can be used as the delimiter. Saner approach if you ask me (and so I adopt that approach in my own assembler).
Re: dragon64 assembler: string I/O
Ok, nice.sixxie wrote:That's how the official Motorola assembler worked, but DREAM accepts multiple arguments and instead limits what can be used as the delimiter. Saner approach if you ask me (and so I adopt that approach in my own assembler).
In this case
Code: Select all
FCC 9,/STRINGA=/,0
09 53 54 52 49 4E 47 41 3D 00
If this is correct, the leading length byte is not needed at all, because the printing routine just counts on the end delimiter. I don't know how a 09 (horizontal tab) or other control characters influence the output. Even if not garbled, I would estimate it leads to something at least unexpected.
The dragon on my side: http://klasek.at/hc/dragon/
Re: dragon64 assembler: string I/O
Okay, a couple of thoughts from a quick glance:
1. I can't remember whether or not OUTCH ($800C) preserves the registers you're using (you need X, U and A preserved). Please check?
2. I didn't follow what GETLNE is doing with B. It didn't seem to be used until you decremented it. Maybe you want CLR 2,U before the SCHAR loop instead and remove the B stuff?
1. I can't remember whether or not OUTCH ($800C) preserves the registers you're using (you need X, U and A preserved). Please check?
2. I didn't follow what GETLNE is doing with B. It didn't seem to be used until you decremented it. Maybe you want CLR 2,U before the SCHAR loop instead and remove the B stuff?
Re: dragon64 assembler: string I/O
Both OUTCH and INCH preserves the registers (just checked in the Dragon32 ROMs, probably this may hold for the D64 too).Sarah wrote: 1. I can't remember whether or not OUTCH ($800C) preserves the registers you're using (you need X, U and A preserved). Please check?
Luckily, in the combination GETLNE and PRINTL is used even if the length from GETLNE is broken, PRINTL doesn't need it.Sarah wrote: 2. I didn't follow what GETLNE is doing with B. It didn't seem to be used until you decremented it. Maybe you want CLR 2,U before the SCHAR loop instead and remove the B stuff?
The dragon on my side: http://klasek.at/hc/dragon/
Re: dragon64 assembler: string I/O
Yes, that's true.
Okay, moving onto the 'Example' listing, I think it's trying to output TXT2 using CR as a terminator instead of NULL. So presumably it runs off the end of the text and continues output until it finds the CR from the LDA #CR instruction.
Okay, moving onto the 'Example' listing, I think it's trying to output TXT2 using CR as a terminator instead of NULL. So presumably it runs off the end of the text and continues output until it finds the CR from the LDA #CR instruction.
- heavyfranz
- Posts: 6
- Joined: Sun Sep 01, 2013 10:37 am
- Location: Italy
Re: dragon64 assembler: string I/O
Hello!
Thank you for your replyies! They are a lot! I've had some problems getting the "topic approvation email" from yahoo. I need some time to understand them completely and truly follow the conversation and learn from it. First of all excuse me for the poor code listing printout...I would have to fix the code (yes I've print the last part in reverse becuse I'd like to have all code on the same face and I don't know how to impose tab at the start of each line during printing on DREAM, but I've something about it, maybe in the ALLDREAM manual only).
The "string explain request" part of the first message was not complete, I've hit "enter" on preview mode and the message was given to the forum instead of give a CR to the text...So the question is:
All the manuals ( Leventhal, Inside the dragon, Dream manual...) says that constant string had to be instantiated with
MYSTRING FCC /STRING/ or
MYSTRING FCC /STRING/,0 or
MYSTRING FCC LENGHT,/STRING/ ; lenght is without terminator or
(from example) MYSTRING FCC /STRING/
FCB 0
From what I've seen (I have not a monitor in my DREAM) the only construct that works is
MYSTRING FCC N+1,/STRING/,0
FCB 0
In all the other case seems that the terminator is not set, so the PRINTL routine go ahead, printing a "memory dump", until a NULL is read.
So I don't know if my "string declaration" is only "conservative", because I waste a byte storing a 0 after the 0 placed by the FCC directive, or if is "dangerous" because start "an evil mechanism that drive my program and my head crazy".
At the end of this message I'll run DREAM and I'll take a photo of the program output of the misworking code and I'll post it here. I would really thank you for your enthusiasm replying me. See you soon!
Thank you for your replyies! They are a lot! I've had some problems getting the "topic approvation email" from yahoo. I need some time to understand them completely and truly follow the conversation and learn from it. First of all excuse me for the poor code listing printout...I would have to fix the code (yes I've print the last part in reverse becuse I'd like to have all code on the same face and I don't know how to impose tab at the start of each line during printing on DREAM, but I've something about it, maybe in the ALLDREAM manual only).
The "string explain request" part of the first message was not complete, I've hit "enter" on preview mode and the message was given to the forum instead of give a CR to the text...So the question is:
All the manuals ( Leventhal, Inside the dragon, Dream manual...) says that constant string had to be instantiated with
MYSTRING FCC /STRING/ or
MYSTRING FCC /STRING/,0 or
MYSTRING FCC LENGHT,/STRING/ ; lenght is without terminator or
(from example) MYSTRING FCC /STRING/
FCB 0
From what I've seen (I have not a monitor in my DREAM) the only construct that works is
MYSTRING FCC N+1,/STRING/,0
FCB 0
In all the other case seems that the terminator is not set, so the PRINTL routine go ahead, printing a "memory dump", until a NULL is read.
So I don't know if my "string declaration" is only "conservative", because I waste a byte storing a 0 after the 0 placed by the FCC directive, or if is "dangerous" because start "an evil mechanism that drive my program and my head crazy".
At the end of this message I'll run DREAM and I'll take a photo of the program output of the misworking code and I'll post it here. I would really thank you for your enthusiasm replying me. See you soon!