6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Sep 29, 2024 3:40 pm

All times are UTC




Post new topic Reply to topic  [ 32 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
PostPosted: Sun Sep 10, 2017 3:32 pm 
Offline

Joined: Sat Dec 13, 2003 3:37 pm
Posts: 1004
Sure, but the magic of the IRQ version, in this use case, is that it saves you an extra 40 pin DIP.

The IRQ technique is a very clever way to make this thing fit on a "badge" by reducing chip count.

Plus the idea of driving the IRQ directly by the serial line, vs going through an "I/O chip" is clever and I think eye opening to folks who resist wiring I/O directly to the CPU.


Top
 Profile  
Reply with quote  
PostPosted: Sun Sep 10, 2017 5:06 pm 
Offline

Joined: Wed Jan 08, 2014 3:31 pm
Posts: 578
Oh, I agree that it is clever in this usage. I was trying to understand the limits of the approach.

Lee's designed some 1802 computers where this sort of bit banged I/O is standard, as the 1802 has built in I/O pins. It never occurred to me to try something like this with a 6502.


Top
 Profile  
Reply with quote  
PostPosted: Sun Sep 10, 2017 7:51 pm 
Offline
User avatar

Joined: Tue Oct 25, 2016 8:56 pm
Posts: 362
You could always hang any normal IRQ devices off NMI instead with a little tweaking to the relevant routines.

_________________
Want to design a PCB for your project? I strongly recommend KiCad. Its free, its multiplatform, and its easy to learn!
Also, I maintain KiCad libraries of Retro Computing and Arduino components you might find useful.


Top
 Profile  
Reply with quote  
PostPosted: Sun Sep 10, 2017 8:17 pm 
Offline

Joined: Sat Jul 28, 2012 11:41 am
Posts: 442
Location: Wiesbaden, Germany
Alarm Siren wrote:
You could always hang any normal IRQ devices off NMI instead with a little tweaking to the relevant routines.
Unfortunately not. It is all about timing the bits in a 10-bit frame and any tampering with the interrupt system including NMI will cause errors in the received data. While an NMI is processed, the delay loops for the bit timing cannot function properly.

It is an impressive showcase what you can do on a 65C02 with minimal hardware, especially for us cycle count nerds. It is not a solution for your everyday communication problems. The soft UART requires no other interrupts to be present and no excessive or prolongated use of SEI ... CLI. Even standalone the soft UART would trash its serial output if a frame is received at the same time. As long as you don't type faster then 4800 Baud this is not a problem, but if you copy large chunks of data into your terminal window, you should better make sure that there is a delay after each character. The built in xmodem protocol does not echo data and therefore does not have that problem (as far as I know).

It would be possible to use this as a quick and dirty debug interface switching off all currently running interrupt sources while in use. However, for myself I found a better solution using a homemade I2C to UART adapter. The I2C protocol allows interruptions at any time for any period of time. The downside is that you need 2 open drain output & input ports to make it work. If your project implements an I2C master anyway this is already present at no extra cost.

_________________
6502 sources on GitHub: https://github.com/Klaus2m5


Top
 Profile  
Reply with quote  
PostPosted: Wed Sep 13, 2017 2:30 pm 
Offline

Joined: Wed Jan 08, 2014 3:31 pm
Posts: 578
I am weak and after resisting, I finally succumbed to the urge to by the basic badge kit.


Top
 Profile  
Reply with quote  
PostPosted: Wed Sep 13, 2017 8:18 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1738
Location: Sacramento, CA
I hope you enjoy it Martin! Lee has had several HUNDRED orders, so you may experience a little delay while he gets caught up. Apparently, Chuck Peddle contacted Lee and requested a kit as well. Long live the 6502!

Daryl

_________________
Please visit my website -> https://sbc.rictor.org/


Top
 Profile  
Reply with quote  
PostPosted: Wed Nov 29, 2017 9:53 pm 
Offline
User avatar

Joined: Wed Nov 29, 2017 8:04 pm
Posts: 6
Does anyone have any fun code for this little SBC, I'm working on some BASIC libs now to control the LEDs like a video buffer


Top
 Profile  
Reply with quote  
PostPosted: Wed Nov 29, 2017 10:40 pm 
Offline
User avatar

Joined: Wed Nov 29, 2017 8:04 pm
Posts: 6
I have some (Broken) Basic that will look up ASCII in the font table and spit them out, the LED Driver doesn't like me doing it this fast, need to find a good way to slow these loops down to keep the LED refresh rate going while I POKE things into the main buffers.

BADR is the main buffer for the LCD
BF is the starting address for the font table
$FD4B is the LCD_Scan function called by everything to update the display.

Code:
10 BADR=$02A0
20 BF=$0FC42
21 POKE $00E5,$00
22 POKE $00E2,$00
23 POKE $00E6,$00
30 FOR X = 100000 TO 999999
40 POKE BADR, PEEK(BF+(ASC(MID$(STR$(X),2,1)) - 32))
41 CALL $FD4B
42 POKE BADR+1, PEEK(BF+(ASC(MID$(STR$(X),3,1)) - 32))
43 CALL $FD4B
44 POKE BADR+2, PEEK(BF+(ASC(MID$(STR$(X),4,1)) - 32))
45 CALL $FD4B
46 POKE BADR+3, PEEK(BF+(ASC(MID$(STR$(X),5,1)) - 32))
47 CALL $FD4B
48 POKE BADR+4, PEEK(BF+(ASC(MID$(STR$(X),6,1)) - 32))
49 CALL $FD4B
50 POKE BADR+5, PEEK(BF+(ASC(MID$(STR$(X),7,1)) - 32))
51 CALL $FD4B
52 CALL $FD4B
53 CALL $FD4B
54 CALL $FD4B
55 CALL $FD4B
56 CALL $FD4B
57 CALL $FD4B
100 NEXT


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 30, 2017 1:13 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1738
Location: Sacramento, CA
I just got home... give me a few hours to come up with a few ideas.

Daryl

_________________
Please visit my website -> https://sbc.rictor.org/


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 30, 2017 5:40 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1738
Location: Sacramento, CA
Ok, try this out:

Code:
10 BADR=$02A0
20 BF=$0FC42
21 POKE $00E5,$00
22 POKE $00E2,$00
30 FOR X = 100000 TO 999999
40 POKE BADR, PEEK(BF+(ASC(MID$(STR$(X),2,1)) - 32))
42 POKE BADR+1, PEEK(BF+(ASC(MID$(STR$(X),3,1)) - 32))
44 POKE BADR+2, PEEK(BF+(ASC(MID$(STR$(X),4,1)) - 32))
46 POKE BADR+3, PEEK(BF+(ASC(MID$(STR$(X),5,1)) - 32))
48 POKE BADR+4, PEEK(BF+(ASC(MID$(STR$(X),6,1)) - 32))
50 POKE BADR+5, PEEK(BF+(ASC(MID$(STR$(X),7,1)) - 32))
52 POKE BADR+6, $80
60 FOR D = 1 TO 100
62 FOR W = 0 TO 3: CALL $FD4F: NEXT W
68 NEXT D
100 NEXT X


You do not need to clear $00E6. You will bypass the built-in delay of the LED_scan routine and call $FD4F (at the PHA instruction). This allows the refresh to happen at a decent rate.

You can also update all the digits at once before refreshing them, as done above. There are ways to streamline this and allow for more code in between refresh calls if needed.

I hope this helps!

Daryl

_________________
Please visit my website -> https://sbc.rictor.org/


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 30, 2017 5:51 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1738
Location: Sacramento, CA
jrwr wrote:
Does anyone have any fun code for this little SBC, I'm working on some BASIC libs now to control the LEDs like a video buffer


I wrote this just to test the XMODEM transfer in EhBASIC. It resets the text to the default message and turns the Knight Rider effect into a binary counter. This just fills the two buffers with new data. It relies on the OS's LED_scan to refresh the display.

Code:
5 REM DEFAULT TEXT MESSAGE
10 DATA $FB, $FA, $BF, $DD, $80, $F3, $EF, $D7
15 DATA $BB, $F9, $80, $E9, $D3, $C1, $80, $B7
20 DATA $B9, $E9, $80, $80, $80, $80, $80, $80
25 DATA $80, $80, $80, $80, $80, $80, $80, $80
30 FOR X = 0 TO 31
40 READ A
50 POKE $02A0+X, A
60 NEXT
100 REM 5 BIT BINARY COUNTER
110 DATA $80, $90, $81, $91, $82, $92, $83, $93
115 DATA $84, $94, $85, $95, $86, $96, $87, $97
120 DATA $88, $98, $89, $99, $8a, $9a, $8b, $9b
125 DATA $8c, $9c, $8d, $9d, $8e, $9e, $8f, $9f
130 FOR X = 0 TO 31
140 READ A
150 POKE $02C0+X, A
160 NEXT


Daryl

_________________
Please visit my website -> https://sbc.rictor.org/


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 30, 2017 7:51 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10940
Location: England
(Welcome to our world, jrwr!)


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 30, 2017 9:23 pm 
Offline
User avatar

Joined: Wed Nov 29, 2017 8:04 pm
Posts: 6
@biged, Its been great so far

@8Bit, I love your code, The ASM is super easy to read!


Top
 Profile  
Reply with quote  
PostPosted: Fri Dec 01, 2017 1:26 am 
Offline
User avatar

Joined: Wed Nov 29, 2017 8:04 pm
Posts: 6
My main project is to have the badge play chess with it self (badly) and say witty things after it wins/loses to it self

Interesting side effect, you cannot update the LED $00E3 buffer, it just sticks on the second green LED while in the loop


Top
 Profile  
Reply with quote  
PostPosted: Fri Dec 01, 2017 3:06 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1738
Location: Sacramento, CA
Not sure what $00E3 buffer is, but if you mean the Discrete LED's, that pattern is stored in the LDBuff @ $02C0 (32 bytes). It will refresh when LDig = 7. it will normally scroll through the 32 characters as the display scrolls, but since you have the scrolling disabled, the LED's stay fixed.

Here's the bit pattern for the discrete LED's:

Code:
 3   2 1   0 x   4 x
 G   G G   R R   Y Y


So the LED's get a bit weight of:
Code:
$08 $04 $02 $01 $10
 G   G   G   R   Y

You can update it with POKE $02C7, $80 + sum of bit weights to turn on. Example, to Turn on G _ G _ Y, the bit weight is $1A ($08+$02+$10). Add that to $80 (that keeps the serial port Idle) and a POKE $02C7, $9A will set those LED's.

Kind of odd, but it does work.

Daryl

_________________
Please visit my website -> https://sbc.rictor.org/


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 20 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: