Electron ULA Documentation Updates

for bbc micro/electron hardware, peripherals & programming issues (NOT emulators!)
User avatar
davidb
Posts: 2381
Joined: Sun Nov 11, 2007 10:11 pm
Contact:

Re: Electron ULA Documentation Updates

Post by davidb » Sun Apr 23, 2017 9:36 pm

hoglet wrote:I'm sure you know this already, but to setup tape input you need to:
- Set bits 2..1 of FE07 to 00 (to select tape in mode)
- Set FE06 to zero (I think this is needed as well, but not 100% sure)
I knew about the first point, but the second point is why I asked here. :) I didn't realise that I had to do anything with FE06. Do I set it once, or each time I receive a byte? Maybe I'll look at the OS code again... :-k

User avatar
hoglet
Posts: 8097
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: Electron ULA Documentation Updates

Post by hoglet » Mon Apr 24, 2017 6:47 am

davidb wrote:
hoglet wrote:I'm sure you know this already, but to setup tape input you need to:
- Set bits 2..1 of FE07 to 00 (to select tape in mode)
- Set FE06 to zero (I think this is needed as well, but not 100% sure)
I knew about the first point, but the second point is why I asked here. :) I didn't realise that I had to do anything with FE06. Do I set it once, or each time I receive a byte? Maybe I'll look at the OS code again... :-k
This was the relevant bit of code.

Code: Select all

.LFACD
LDX #&00        :\ FACD= A2 00       ".
STX LFE06       :\ FACF= 8E 06 FE    ..~
STX &CA         :\ FAD2= 86 CA       .J
LDA &025B       :\ FAD4= AD 5B 02    -[.
AND #&DF        :\ FAD7= 29 DF       )_
ORA #&50        :\ FAD9= 09 50       .P
TAY             :\ FADB= A8          (
TXA             :\ FADC= 8A          .
.LFADD
ORA #&40        :\ FADD= 09 40       .@
STA &02F4       :\ FADF= 8D F4 02    .t.
PHP             :\ FAE2= 08          .
SEI             :\ FAE3= 78          x
LDA &0282       :\ FAE4= AD 82 02    -..
AND #&F9        :\ FAE7= 29 F9       )y
ORA &02F4       :\ FAE9= 0D F4 02    .t.
STA &0282       :\ FAEC= 8D 82 02    ...
PLP             :\ FAEF= 28          (
STA LFE07       :\ FAF0= 8D 07 FE    ..~
STY &025B       :\ FAF3= 8C 5B 02    .[.
STY LFE00       :\ FAF6= 8C 00 FE    ..~
RTS             :\ FAF9= 60
It is used by both BPUT and BGET, and is called for each character (I think).

But please take a look at your the disassembly and make your own mind up.
http://mdfs.net/System/ROMs/AcornMOS/El ... ELK100.zip

In Electron FPGA, although tape input works, I'm far from sure it is implemented in the same way as it is on the real ULA. So I'm finding this thread very interesting.

Dave

User avatar
davidb
Posts: 2381
Joined: Sun Nov 11, 2007 10:11 pm
Contact:

Re: Electron ULA Documentation Updates

Post by davidb » Tue Apr 25, 2017 9:33 pm

I'm struggling a bit with reading from cassette, so progress is slow. I've used Elkulator to trap reads and writes to FE00,04,05,06,07 while doing *. and *LOAD on a UEF file. I'm not seeing a pattern of access I can use at the moment.

Each read from FE04 is followed by a write of &40 (clear high tone interrupt) to FE05. Reads from FE04 seem to occur even for high tone detect interrupts, which is a bit strange, but perhaps those values are discarded.

There's a write to FE06 before cassette input starts, but nothing more until after my one block test file *LOADs.

Lots of other operating system services do things with interrupts, so separating all things out is a little difficult. I'll investigate further.

User avatar
jms2
Posts: 2212
Joined: Mon Jan 08, 2007 6:38 am
Location: Derby, UK
Contact:

Re: Electron ULA Documentation Updates

Post by jms2 » Tue Apr 25, 2017 10:13 pm

I have realised that I have more work to do in updating the memory map chapter, and I've been progressing that a bit today.

There will be quite a lot of changes for the third edition; please keep the ULA discoveries (and other suggestions) coming!

A question : what is &2F4 used for? It just says "ULA" in the list on mdfs.

User avatar
davidb
Posts: 2381
Joined: Sun Nov 11, 2007 10:11 pm
Contact:

Re: Electron ULA Documentation Updates

Post by davidb » Tue Apr 25, 2017 11:26 pm

It looks like I wasn't setting up all the relevant interrupts correctly - at least now I've written a program to read a stream of bytes from the cassette interface, though there are a few wrinkles to iron out of it.

I'll try and upload what I've done soon. It's just too tempting to tinker with it! :D

User avatar
davidb
Posts: 2381
Joined: Sun Nov 11, 2007 10:11 pm
Contact:

Re: Electron ULA Documentation Updates

Post by davidb » Tue Apr 25, 2017 11:36 pm

jms2 wrote:I have realised that I have more work to do in updating the memory map chapter, and I've been progressing that a bit today.
That's much appreciated. Thanks!
jms2 wrote:There will be quite a lot of changes for the third edition; please keep the ULA discoveries (and other suggestions) coming!

A question : what is &2F4 used for? It just says "ULA" in the list on mdfs.
It seems to be used in the process of setting the flags in FE07. A value is stored there that is ORed with another to create the flags value. I'd say it's an internal cassette filing system variable.

User avatar
davidb
Posts: 2381
Joined: Sun Nov 11, 2007 10:11 pm
Contact:

Re: Electron ULA Documentation Updates

Post by davidb » Wed Apr 26, 2017 11:35 pm

A couple of videos to show progress:
The screen data video is really a proof of concept. I don't think there's much point in handling data in that way (without CRCs) for anything other than transient information.

I aim to upload the code I've used to a repository in the stardot organisation on Github in the next day or so.

User avatar
jms2
Posts: 2212
Joined: Mon Jan 08, 2007 6:38 am
Location: Derby, UK
Contact:

Re: Electron ULA Documentation Updates

Post by jms2 » Thu Apr 27, 2017 7:47 pm

Thanks -- that's now included.

I've got another interesting little anomaly to resolve now, which relates to the main system variables (those set by OSBYTES &A6-&FF). I'm including all the details of these from the "Allmem" file into the EAUG, excluding anything which is not relevant to the Electron.

Location &242 is affected by *FX178 and on the BBC is the keyboard semaphore (I'm actually not sure what that means, but for the purposes of this exercise it probably doesn't matter). For the Electron the Allmem file has it marked as "undefined" which matches what the original EAUG said about *FX178. However, based on an article by Michael Jakobsen about Citadel in Electron User (August 1986) I have added the actual behaviour of *FX178 which is this:

*FX178,0,0 Turns off keyboard interrupt
*FX178,255,0 Turns on keyboard interrupt

This poses two questions:

a) How did Michael Jakobsen discover this? (Well, presumably by disassembling the OS, but others have done this and not found it)
b) Is location &242 used for anything else?

User avatar
jms2
Posts: 2212
Joined: Mon Jan 08, 2007 6:38 am
Location: Derby, UK
Contact:

Re: Electron ULA Documentation Updates

Post by jms2 » Sun Apr 30, 2017 7:32 pm

OK - here's Draft 2 of Issue 3 of the Electron Advanced User Guide. I think this now includes everything that people have asked for following the review of draft 1. The headline changes compared to Issue 2 (still in red text for review purposes) are:

- New cover picture to replace the bizarre composite image used previously. Hope you like what I've chosen - seemed appropriate :D
- Chapter 12 (Memory usage) greatly expanded
- Chapter 15 (Hardware) extended with new discoveries about ULA behaviour
- New Appendix E (6502 instruction set)
- Appendix F greatly expanded with hardware details of known expansions
- Appendix G Circuit Diagram redrawn, and now actually readable.
- Many other diagrams redrawn
- Lots of corrections, tweaks etc.

I have not yet fixed the index, just in case anyone wants to suggest anything else to go in.

Also - I can do the graphics at much higher resolution than this, but kept it down for the draft just to minimise file size.
Attachments
EAUG - Issue 3D2.zip
(2.1 MiB) Downloaded 66 times

paulb
Posts: 811
Joined: Mon Jan 20, 2014 9:02 pm
Contact:

Re: Electron ULA Documentation Updates

Post by paulb » Sun Apr 30, 2017 8:44 pm

jms2 wrote:- Appendix G Circuit Diagram redrawn, and now actually readable.
This looks very good now! I haven't really looked at much else, but I appreciate your work on this.

Post Reply