Simple I/O card Basic test program

79 views
Skip to first unread message

Alberto C.

unread,
Jul 10, 2024, 9:44:16 AMJul 10
to PAL 6502 computer
Hi guys,
Could someone please be so kind as to share a BASIC test program to be used with he Simple I/O card?
I would love to learn how to drive the LED's and read the input/status from the switches.
Many thanks in advance,
Kind regards,
Alberto

GN Liu

unread,
Jul 12, 2024, 7:50:11 AMJul 12
to PAL 6502 computer
Here is a demo program:

LIST

 100 POKE 5891,255
 200 POKE 5890,0
 300 POKE 5889,0
 400 D=PEEK(5888)
 500 B=0
 600 FOR I=0 TO 7
 700 BIT = (D AND (2^I)) / (2^I)
 800 IF BIT=0 THEN B=B+(2^I)
 900 NEXT I
 1000 POKE 5890,B
 1100 GOTO 400
OK

Because the KB doesn't have an XOR operand, we need to do it manually. The speed is a bit slow, and the LED will respond after 1.5 to 2 seconds.
If you don't mind the reversed switches, you can just poke the value to PB, which will be faster.

Liu

Alberto C.

unread,
Jul 12, 2024, 12:16:52 PMJul 12
to PAL 6502 computer
Hi Liu,
That's brilliant, many thanks!
When you get a chance, could you please explain to me the meaning of the addresses:
5889
5890
5891

Thanks a lot!

Alberto

Alberto C.

unread,
Jul 12, 2024, 12:44:25 PMJul 12
to PAL 6502 computer
Of course!
5889 = $1701 for the data direction
but what about the other 2 addresses:
5890=$1701
5891=$1702
Thanks!

Alberto C.

unread,
Jul 12, 2024, 12:53:24 PMJul 12
to PAL 6502 computer
Sorry I meant:

5890=$1702
5891=$1703

Thanks

Alberto C.

unread,
Jul 12, 2024, 6:26:57 PMJul 12
to PAL 6502 computer
I have figured it out, after reading the specifications:

$1702 is for the PORTA
$1702 IS FOR THE PORTB

Alberto C.

unread,
Jul 13, 2024, 4:23:13 AMJul 13
to PAL 6502 computer
Sorry for the messy responses, using a phone while on the train did not help!
So to summarise, after reading the specifications for the 6532 and based on the PAL-1 memory map:

$1700 is the DRA - Port A data register
$1701 is the DDRA - Port A data direction register
$1702 is the DRB -  Port B data register
$1703 is the DDRB - Port B data direction register

Hopefully this time I gave got it right! :)

GN Liu

unread,
Jul 14, 2024, 10:24:06 PMJul 14
to PAL 6502 computer
Yes, you're right.

The different number system is because decimal is the only acceptable format in KB.

Michael Barry

unread,
Aug 8, 2024, 8:48:00 AMAug 8
to PAL 6502 computer
I haven't tested it, but I think you can speed things up a bit by deleting lines 500 to 900 and modifying line 1000:
1000 POKE 5890,255-D

GN Liu

unread,
Aug 8, 2024, 10:10:36 PMAug 8
to PAL 6502 computer
just try it ;)
Reply all
Reply to author
Forward
0 new messages