6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 24, 2024 7:40 pm

All times are UTC




Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: ASCII character set
PostPosted: Thu Aug 09, 2018 6:25 am 
Offline

Joined: Mon May 21, 2018 8:39 am
Posts: 41
I'm using Merlin-Pro on AppleWin 1.27.0.0 emulator (Enhanced Apple IIe)

The following code:

ORG $8000
CTR EQU $06
HOME EQU $FC58
COUT EQU $FDED
START JSR HOME
LDA #$FF
STA CTR
LOOP LDA CTR
JSR COUT
DEC CTR
BEQ END
JMP LOOP
END RTS

when assembled and run it with >8000G< for the first time, it produces the result in the first picture below.
If I type >8000G< one more time, it produces the result in the second picture.
Why in the first time, I can't see all the range of ASCII characters? (lowercase etc.)
Why in the second time, I see "MORE" characters than 255? (256-1) I mean, "blank characters" are the Control characters but if you count them, the total exceeds the 255. (Blinking characters are printed just fine but you can't see them on the photos)

By the way, the above code is taken from the book Assembly Lines, page 30. It was intended (as far as I know) for an Apple II computer and for the original Merlin Macro Assembler.

Does it has to do with the Merlin-Pro I'm using or it's just an internal (programming) fault of the emulator I'm using?

Merlin-Pro runs on different resolution than the Monitor. Maybe this creates that problem?

I'm confused! Please, help!

P.S. Do I have to consider buying an original Apple II computer from e-bay? :(


Attachments:
File comment: First time I run it with >8000G<
FIRST TIME.jpg
FIRST TIME.jpg [ 21.29 KiB | Viewed 4197 times ]
File comment: Second time I run it with >8000G<
SECOND TIME.jpg
SECOND TIME.jpg [ 32.62 KiB | Viewed 4197 times ]
Top
 Profile  
Reply with quote  
 Post subject: Re: ASCII character set
PostPosted: Thu Aug 09, 2018 8:59 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
If some of those unprintable characters are having an effect: such as clearing the screen, homing the cursor, tabbing... perhaps that would explain what you see? It's not unusual to start printing from character 32 instead of from zero.

On many systems, if you poke the bottom 32 characters to character screen memory (if there is such a thing) you will find there are characters designed for them. But the standard print-to-output routine won't print them, because it interprets them.

BTW, I'm glad you attributed the code! It has a rather awkward branch-around-a-jump which seem unnecessary in this case.


Top
 Profile  
Reply with quote  
 Post subject: Re: ASCII character set
PostPosted: Thu Aug 09, 2018 3:23 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1952
Location: Sacramento, CA, USA
$FDED is vectored, and usually has multiple layers of "services" wedged into it, listening for and responding to control characters between $80 and $9F. Even the "uncooked" version at $FDF0 does this a bit, ringing the bell for $87 and giving us a new line for $8D, among a couple of others.

If I run your program on an older ][, it prints something similar to your second example, the same result every run. Why your system acts slightly differently the first time through is a bit puzzling, and would require further investigation on my part when I get some time.

_________________
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)


Top
 Profile  
Reply with quote  
 Post subject: Re: ASCII character set
PostPosted: Fri Aug 10, 2018 6:30 am 
Offline

Joined: Mon May 21, 2018 8:39 am
Posts: 41
Hmmmm....

$89 = (Tab) which means it skips columns (how many columns? 4? 6?)
$8D = (Return) which means the cursor goes to the beginning of a new line

Well, yeah, that would partially explain why the number of "blank characters" exceed the number 32 as it was normally expected. For a complete explanation though, is there a place where I can read about each one of the control characters how they're interpreted by the routine $FDED (COUT)?


Top
 Profile  
Reply with quote  
 Post subject: Re: ASCII character set
PostPosted: Fri Aug 10, 2018 3:13 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1952
Location: Sacramento, CA, USA
You're definitely on the right track to understanding. A "complete explanation" may be a bit difficult, because $FDED is really nothing more than a spring board to the first of a chain of output device handlers, each one with its own control character interpretation. The most common output device handlers are for the Disk ][, the 80-column card, the printer and the modem, but the possibilities are practically endless. On the 8-bit Apples I know, the (default) end of that chain is $FDF0, so you can disassemble and study that portion of the monitor ROM. Note that there are differences in the $FDF0 code as well, depending on whether you're using a ][, ][+, IIe, IIc, or IIgs. You can even change the equate in your program from $FDED to $FDF0, and see if the output is a bit more consistent.

Good luck on your adventure! I am not an expert on the subject, but I hope that I gave you a path to pursue, and that I didn't confuse you with any misinformation.

_________________
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)


Top
 Profile  
Reply with quote  
 Post subject: Re: ASCII character set
PostPosted: Fri Aug 10, 2018 4:49 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
Here's a version of the Red Book which contains a disassembly.

Edit: fixed up URL, I hope. Thanks!


Last edited by BigEd on Fri Aug 10, 2018 5:43 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: ASCII character set
PostPosted: Fri Aug 10, 2018 5:17 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1952
Location: Sacramento, CA, USA
BigEd wrote:
Here's a version of the Red Book which contains a disassembly:
http://www.classiccmp.org/cini/pdf/Appl ... 20(Redbook)%20Reference%20Manual%2030th%20Anniversary.pdf

Your link didn't come through cleanly, Ed. Here's my attempt.

P.S. This is the original monitor ROM, shipped with the original ][, and is packed full of little tricks to save a byte of precious ROM here and there. An example:
Code:
FC2C: 49 C0     ESC1    EOR #$C0        ESC-@?
FC2E: F0 28             BEQ HOME        IF SO, DO HOME AND CLEAR
FC30: 69 FD             ADC #$FD        ESC-A OR B CHECK
FC32: 90 C0             BCC ADVANCE     A, ADVANCE
FC34: F0 DA             BEQ BS          B, BACKSPACE
FC36: 69 FD             ADC #$FD        ESC-C OR D CHECK
FC38: 90 2C             BCC LF          C, DOWN
FC3A: F0 DE             BEQ UP          D, GO UP
FC3C: 69 FD             ADC #$FD        ESC-E OR F CHECK
FC3E: 90 5C             BCC CLREOL      E, CLEAR TO END OF LINE
FC40: D0 E9             BNE RTS4        NOT F, RETURN
FC42: A4 24     CLREOP  LDY CH          CURSOR H TO Y INDEX
                        ...

Here, Woz has a high-bit-set ASCII code in A and a set carry, and wants to act on eight different possibilities (@, A, B, C, D, E, F, other). He does it in 22 bytes, without a single CMP # ...

_________________
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)


Last edited by barrym95838 on Fri Aug 10, 2018 5:47 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: ASCII character set
PostPosted: Fri Aug 10, 2018 5:41 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
Thanks!


Top
 Profile  
Reply with quote  
 Post subject: Re: ASCII character set
PostPosted: Sat Aug 11, 2018 7:57 am 
Offline

Joined: Mon May 21, 2018 8:39 am
Posts: 41
Is there a text editor for Windows that supports syntax highlighting (among other goodies) for Merlin assembler?


Top
 Profile  
Reply with quote  
 Post subject: Re: ASCII character set
PostPosted: Sat Aug 11, 2018 8:09 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
Looks like you only need a page of XML to configure Notepad++
http://notepad-plus.sourceforge.net/com ... sembly.xml
http://docs.notepad-plus-plus.org/index ... uage_Files


Top
 Profile  
Reply with quote  
 Post subject: Re: ASCII character set
PostPosted: Sat Aug 11, 2018 8:18 am 
Offline

Joined: Mon May 21, 2018 8:39 am
Posts: 41
Thank you BigEd. Though the xml file you put a link is for 68k assembly. Something for the 6502?


Top
 Profile  
Reply with quote  
 Post subject: Re: ASCII character set
PostPosted: Sat Aug 11, 2018 8:20 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
I didn't see anything, but I imagine modifying the 68k would be a good way to start with a Merlin 6502 mode.


Top
 Profile  
Reply with quote  
 Post subject: Re: ASCII character set
PostPosted: Sat Aug 11, 2018 8:28 am 
Offline

Joined: Mon May 21, 2018 8:39 am
Posts: 41
BigEd wrote:
I didn't see anything, but I imagine modifying the 68k would be a good way to start with a Merlin 6502 mode.


So there isn't any ready made solution....I have to create it....


Top
 Profile  
Reply with quote  
 Post subject: Re: ASCII character set
PostPosted: Sat Aug 11, 2018 8:42 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
I think you probably will - but it shouldn't be too difficult.


Top
 Profile  
Reply with quote  
 Post subject: Re: ASCII character set
PostPosted: Sat Aug 11, 2018 9:57 am 
Offline

Joined: Mon May 21, 2018 8:39 am
Posts: 41
:D Yeah....SHOULD not be too difficult..... I don't know anything about XML and I'm a n00b in 6502 assembly. Yes, it should not be too difficult..... :D


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 71 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: