6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 22, 2024 3:07 pm

All times are UTC




Post new topic Reply to topic  [ 12 posts ] 
Author Message
PostPosted: Sat Jan 30, 2010 2:45 pm 
Offline

Joined: Mon Mar 19, 2007 1:15 am
Posts: 4
Location: Margate, UK
I have an Acorn Electron board and SMPS and want to use it as the 'brains' for my next project. The PSU connects to the main board by three wires, +5V, 0V and -5V (for the audio I think). I believe I should be able to power up the board with just a 5V 2A supply if I don't use the audio circuits.

I need to know the pinouts of the Expansion connector at the back and also the keyboard connector. For example, is the keyboard a simple array of switches, or does it have any onboard logic to allow the mainboard to work correctly?
Also, are all the address and data lines available on the expansion connector?

Any help or advice greatly appreciated.

_________________
"Either we are alone in this universe, or we are not"


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Jan 30, 2010 4:42 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
Have you had a look at the various app notes on the web?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Jan 30, 2010 4:49 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
Page 45 of the service manual describes the keyboard: looks like a matrix with diodes.

Cheers
Ed


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Jan 30, 2010 5:01 pm 
Offline

Joined: Mon Mar 19, 2007 1:15 am
Posts: 4
Location: Margate, UK
Thanks BigEd, that is exactly what I was looking for.

_________________
"Either we are alone in this universe, or we are not"


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Jan 30, 2010 5:07 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
Actually it's quite interesting: the keyboard matrix seems to be directly driven by 14 bits of the address bus (through diodes) to produce a 4-bit data value which goes to the central ULA. Very low parts count!

Code:
Broken external image link
http://img191.imageshack.us/img191/3391/electronkeyboardmatrix.png

That's from the service manual, which also contains a complete circuit diagram (split over two pages...)
Code:
Broken external image link
http://img31.imageshack.us/img31/7544/electroncircuitdiagram.th.png


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Jan 30, 2010 8:51 pm 
Offline

Joined: Tue Sep 24, 2002 4:56 pm
Posts: 50
Location: Essex, UK
BigEd wrote:
Actually it's quite interesting: the keyboard matrix seems to be directly driven by 14 bits of the address bus (through diodes) to produce a 4-bit data value which goes to the central ULA. Very low parts count!


Just as a further note - it _is_ hooked up to the address bus; out of the 16 "Sideways ROMs" (mapped into $8000-$BFFF), "ROMs" 8 and 9 (duplicates of each other) are used for the keyboard decoding - see page 202 of the "Electron Advanced User Guide".

--Martin

_________________
Martin Penny

.sig in beta - full release to follow.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Jan 30, 2010 9:09 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
Intriguing. By my count, the 14 address bits cause the keyboard to occupy 16k - so, hiding that in sideways ROM space is a clever way to keep it out of the memory map while not in use.

But, why two ROMs? Why are they identical? Am I confused, or could you shed any light on that?

(For the uninitiated, the BBC and Electron memory maps have 32K RAM, a paged 16k area for language and utility ROMs, then 16k for the OS, with 3 pages near the top for i/o.)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Jan 30, 2010 9:46 pm 
Offline

Joined: Tue Sep 24, 2002 4:56 pm
Posts: 50
Location: Essex, UK
ROM pages 8 and 9 (used for keyboard decoding) _are_ identical to each other, as are ROM pages 10 and 11 (normally occupied by the BASIC interpreter code [*1]); in effect, bit 0 of the ROM select latch is ignored, at least as far as these four ROM pages are concerned - this seems to be a "design feature" of the Electron ULA.

This is compared to the way that the BBC Micro has its keyboard hooked up - through its "System" 6522 VIA, which is also used for a number of other timing and control functions; as the Electron was intended to be a physically simpler and cheaper-to-manufacture design, the rather complex hardware design of the BBC Micro was largely abandoned.

[*1] If you have an Electron with socketed ROM chip(s) [*2], then it's possible to replace the BASIC interpreter with, say, the (Electron version of) the VIEW word processor, or perhaps even a ROM from an Electron games cartridge ("Starship Command" for anyone? 8) ).

[*2] Some Electrons have separate 16KB chips for the OS and BASIC ROMs, others have a single 32KB ROM that contains both.

--Martin

_________________
Martin Penny

.sig in beta - full release to follow.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Jan 31, 2010 2:12 pm 
Offline

Joined: Mon Mar 19, 2007 1:15 am
Posts: 4
Location: Margate, UK
The problem I now have is because I don't have an Elk keyboard, do I build one using that circuit diagram, or use a microcontroller connected to a PS2 keyboard to read the address lines and set the appropriate data lines?

I'd need 18 lines connected to the Elk and another two to the PS2 keyboard, so something like a 16F872. It seems kind of a waste to use a PIC or similar just for that. As there are only 54 keys, an 8x8 matrix would have been better, and easier for me! I could have used a smaller PIC.

Maybe I could use a 16 to 4 line multiplexer between the address bus and the PIC? ( Can't find any 16 to 4 multiplexers so would probably have to use two 8 to 3 something like a 74xx151)

_________________
"Either we are alone in this universe, or we are not"


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Jan 31, 2010 2:31 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
You might get away with one or more priority encoders, if the matrix is addressed by only setting one line at a time.
    74148: 8-Line to 3-Line Priority Encoder
    74147: 10-Line to 4-Line Priority Encoder

You'd need to dig into the electron ROM I suppose - I don't know of a disassembly of it. I imagine it's very similar to the Beeb OS ROM, but of course the point is that keyboard handling will be different.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Jan 31, 2010 3:27 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
Not sure that a priority encoder will do it - at least one of the ROM routines can select multiple columns.

It's some kind of keypress-detected routine:
Code:
; some kind of preparation for keyboard reading?
; stores to FA and to 02C1 (beeb doesn't use that location)
; also returns partial result in A
ECF8 08         php
ECF9 48     H   pha
ECFA 293F   )?  and #3F
ECFC 4A     J   lsra
ECFD 4A     J   lsra
ECFE AA         tax
ECFF BD17ED     lda ED17,X
ED02 85FB       sta FB
ED04 8DC202     sta 02C2
ED07 BD25ED  %  lda ED25,X
ED0A 85FA       sta FA       ; bit masks for the address byte - keyboard column
ED0C 8DC102     sta 02C1
ED0F 68     h   pla
ED10 2903   )   and #03
ED12 AA         tax
ED13 BD86F0     lda F086,X   ; small powers of two for the data byte (keyboard row)
ED16 28     (   plp
ED17 60     `   rts


; some constants for keyboard reading
ED18 BF         ill
ED19 BF         ill
ED1A BF         ill
ED1B BF         ill
ED1C BF         ill
ED1D BF         ill
ED1E BF         ill
ED1F BF         ill
ED20 BEBDBB     ldx BBBD,Y
ED23 B7         ill
ED24 AF         ill

; more constants for keyboard reading
ED25 9F         ill
ED26 FEFDFB     inc FBFD,X
ED29 F7         ill
ED2A EF         ill
ED2B DF         ill
ED2C BF         ill
ED2D 7F         ill
ED2E FF         ill
ED2F FF         ill
ED30 FF         ill
ED31 FF         ill
ED32 FF         ill
ED33 FF         ill


I think I'll stop there...

Cheers
Ed


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Jan 31, 2010 3:34 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
just one more snippet - there are probably other places which check the keyboard

Code:
ED76 B8         clv
ED77 B90000     lda 0000,Y
ED7A F009       beq ED85
ED7C 2CBCD8 ,   bit D8BC
ED7F 20F8EC     jsr ECF8  ; prepare keyboard access routine
ED82 8DC002     sta 02C0
ED85 A5F4       lda F4
ED87 48     H   pha
ED88 A908       lda #08   ; switch to ROM 8 for keyboard
ED8A 85F4       sta F4
ED8C 8D05FE     sta FE05
ED8F A0FF       ldy #FF
ED91 84FA       sty FA
ED93 A2AF       ldx #AF
ED95 86FB       stx FB
ED97 AD00A0     lda A000   ; keyboard pseudo-ROM access - escape/caps/control/shift
ED9A 290F   )   and #0F
ED9C F018       beq EDB6
ED9E 2038ED  8  jsr ED38
EDA1 290F   )   and #0F
EDA3 F005       beq EDAA
EDA5 2064EC  d  jsr EC64
EDA8 D020       bne EDCA
EDAA A5FB       lda FB
EDAC 49C0   I   eor #C0
EDAE 38     8   sec
EDAF 6A     j   rora
EDB0 66FA   f   ror FA
EDB2 85FB       sta FB
EDB4 B0E8       bcs ED9E
EDB6 A99F       lda #9F
EDB8 85FB       sta FB
EDBA ADFF9F     lda 9FFF  ; keyboard pseudo-ROM access - any non-modifier pressed?
EDBD 2903   )   and #03
EDBF F005       beq EDC6
EDC1 2064EC  d  jsr EC64
EDC4 D004       bne EDCA
EDC6 A280       ldx #80
EDC8 3003   0   bmi EDCD
EDCA 2047F0  G  jsr F047
EDCD 68     h   pla
EDCE 20A0E3     jsr E3A0 ; put back the previous ROM
EDD1 8A         txa
EDD2 60     `   rts


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC


Who is online

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