Problem with Supermon

25 views
Skip to first unread message

Neil Andretti

unread,
Jan 18, 2026, 8:33:55 AMJan 18
to PAL 6502 computer
Hi Group,
I ran into a strange problem with Supermon (all files att.)

If I test it in the KIM Simulator, the program works
If I test it in PAL-1 / 2 it doesn't interprete the input correct and responds with an error message  "?"

What did I miss?
The programs attatched are compiled to address 0200

Nils

smontest.bin
smontest.ptp
supermon-kim-a.s

Hans Otten

unread,
Jan 18, 2026, 9:23:36 AMJan 18
to PAL 6502 computer
Strange. Supermon I/O saves Y, the KIM-1 OUTCHR and GETCH do not destroy X.  No problem there.

What makes the Simulator and a real 6502 different is that the Simulator writes 0 to all RAM locations at startup. 
So there may be a variable (zeropage) which is not initialized to a known value , e.g. 0 

Eduardo Casino

unread,
Jan 18, 2026, 10:02:17 AMJan 18
to PAL 6502 computer
Hi, probably not the cause, but GETCH destroys X sometimes. I found it when porting CP/M-65 to the KIM-1. Look at the colored lines. When BIT SAD is not 0, returns with X == 8:

 940  1E5A  86 FD     GETCH   STX   TMPX      SAVE X REG
 941  1E5C  A2 08             LDX   #$08      SET UP 8-BIT CNT
 942  1E5E  A9 01             LDA   #$01

 943  1E60  2C 40 17  GET1    BIT   SAD
 944  1E63  D0 22             BNE   GET6

 945  1E65  30 F9             BMI   GET1      WAIT FOR START BIT
 946  1E67  20 D4 1E          JSR   DELAY     DELAY 1 BIT
 947  1E6A  20 EB 1E  GET5    JSR   DEHALF    DELAY 1/2 BIT TIME
 948  1E6D  AD 40 17  GET2    LDA   SAD       GET 8 BITS
 949  1E70  29 80             AND   #$80      MASK OFF LOW ORDER BITS
 950  1E72  46 FE             LSR   CHAR      SHIFT RIGHT CHAR
 951  1E74  05 FE             ORA   CHAR
 952  1E76  85 FE             STA   CHAR
 953  1E78  20 D4 1E          JSR   DELAY     DELAY 1 BIT TIME
 954  1E7B  CA                DEX  
 955  1E7C  D0 EF             BNE   GET2      GET NEXT CHAR
 956  1E7E  20 EB 1E          JSR   DEHALF    EXIT THIS RTN
 957                  ;
 958  1E81  A6 FD             LDX   TMPX
 959  1E83  A5 FE             LDA   CHAR
 960  1E85  2A                ROL   A         SHIFT OFF PARITY
 961  1E86  4A                LSR   A
 962  1E87  60        GET6    RTS



Hans Otten

unread,
Jan 18, 2026, 10:06:31 AMJan 18
to PAL 6502 computer
Eduardo is right. 

I always save X and Y when calling GETCH.
And X, Y and A when calling OUTCH. 

Neil Andretti

unread,
Jan 18, 2026, 12:10:08 PM (14 days ago) Jan 18
to PAL 6502 computer
Hm---- I found it.
I used the standard config file of CC65, and in this file the variables are set in .BSS ( I had no idea what that meant)
And this is "somewhere" in the ROM area.
I now placed all variables in the Zeropage, defined those on the none.cfg file in CC65s config folder and
 ... it works ;)

Thanks for your help
supermon_0200.ptp
Reply all
Reply to author
Forward
0 new messages