ASCII character set

5 posts / 0 new
Last post
Offline
Last seen: 5 years 7 months ago
Joined: Aug 2 2018 - 13:15
Posts: 3
ASCII character set
AttachmentSize
Image icon First time I type >8000G<21.29 KB
Image icon Second time I type >8000G<32.62 KB

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.

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? Sad

macnoyd's picture
Offline
Last seen: 2 days 3 hours ago
Joined: Oct 15 2012 - 08:59
Posts: 835
Just a shot in the dark...

What happens when you add JSR FB60 at the beginning of your code?

Offline
Last seen: 5 years 6 months ago
Joined: Aug 9 2018 - 07:31
Posts: 4
You should be using the index

You should be using the index registers for your counting. Also, If COUT processes ASCII, then the first 32 characters are control codes. If you do a control code for backspace, for example, it will back up the cursor by one position. The control code for Bell will beep. I would rather put the data directly into video memory located at $0400. It's easier, skips the control codes, and shows you all the characters the video circuits can produce.

You should be doing something like
---------------------------------
ORG $8000 ;Start of the program
JSR $FC58 ;Clear Screen
LDY #$00 ; Load Y with 0
loop:
TYA Put what is in Y into A
STA $0400,y ;Put whatever is in A in memory location $0400+Y
INY ; increase Y by 1
bne loop ; Loop until Y wraps around from 255 back to 0
BRK ; Stop the program
---------------------
$4000 is where the text page starts on an Apple II, I'm putting text directly on video memory

mmphosis's picture
Online
Last seen: 1 hour 9 min ago
Joined: Aug 18 2005 - 16:26
Posts: 432
control characters definitely have an affect

As halkun mentioned skipping displaying the control characters should work better as it won't have side effects. There are definitely more efficient ways to write this routine, but I think it is written as a start to learning 6502 assembler.

I think that routine does different things on different models of Apple II due to the control characters.

The control characters definitely have an affect. I ran the routine on KEGSMAC, an Apple IIGS emulator, and it changes the cursor to the "]" character, actually it's the Ctrl-] character which appears as the "]" glyph. This happens because Ctrl-^ changes the cursor to the next character that is output.

http://www.1000bit.it/support/manuali/apple/technotes/iigs/tn.iigs.065.html

When I typed 8000G, the second time it dropped me into Applesoft BASIC because the 8 in 8000G gets lost, so it does 000G which goes to Applesoft.

This routine should work okay on an Apple II or Apple II Plus (emulated or not) which is probably the model of Apple II the routine was originally created on. I know that AppleWin emulates an Apple IIe by default, but it also allows you to choose machine type: I would select either Apple II or Apple II+.

mmphosis's picture
Online
Last seen: 1 hour 9 min ago
Joined: Aug 18 2005 - 16:26
Posts: 432
Applesoft BASIC program

Applesoft BASIC program to display all 256 TEXT characters...

NEW

0 LET H$ = "0123456789ABCDEF"
1 HOME : VTAB 3 : HTAB 13
2 PRINT H$
3 FOR V = 1 TO 16 : PRINT
4     HTAB 11 : A = PEEK (41) * 256
5     LET A = A + PEEK(40)
6     PRINT MID$(H$, V, 1);
7     FOR H = 1 TO 16
8         POKE A + H + 11, C : C = C + 1
9 NEXT H, V

RUN

POKE 49167,0 : REM Show ALTCHRSET

POKE 49166,0 : REM Don't show ALTCHRSET

Log in or register to post comments