Date : Fri, 01 Apr 2016 15:32:42 +0000
From : julian_stenning@... (Julian Stenning)
Subject: Emulation
Hello,
I'm still pressing on with this BBC emulation with powershell as time allows.
It's continuing to be a great learning experience, not just in Powershell
but also the workings of the BBC Micro.
I'm at the point where I have a emulated BBC that will boot to a BASIC prompt
with paged RAM and it will allow me to load the Acorn DFS ROM (with me fudging
the 8271 status register to allow boot to proceed, nothing more at present).
So I'm now looking at 6522 & keyboard input and whilst I've had a few lightbulb
moments I've hit a wall & once again need to call in the experts.
There's something I'm not understanding correctly about enabling interrupts.
I'm looking at $FE40 (doing nothing with User VIA at the moment) and in the
disassembly I see:DA80 LDX #&F2 ;enable interrupts 1,4,5,6 of system VIA
DA82 STX &FE4E ;
;0 Keyboard enabled as needed
;1 Frame sync pulse
;4 End of A/D conversion
;5 T2 counter (for speech)
;6 T1 counter (10 mSec intervals)
What does 'enabled as needed' mean? I'm assuming here that each bit of FE4E
being high means IRQ enabled, but bit zero is not set, is this a special
case (and what does bit 7 do)?
In my emulation I'm scanning the keyboard and setting Bit 7 and Bit 0 of
&FE4D to signify a keyboard IRQ request, which I think is correct, but this
never gets serviced as bit zero of FE4D is low.
Another part of the disassembly I don't understand is "Clear interrupt and
enable registers of Both VIAs", which does the following:DA6B LDA #&7F
DA6D INX
DA6E STA &FE4D,X
DA71 STA &FE6D,X
DA74 DEX
DA75 BPL &DA6E
Why is an offset of FE4D / FE6D being addressed?
Any comments & help gratefully received.
Regards,Julian.
From: julian_stenning@...
To: bbc-micro@...
Subject: RE: [BBC-Micro] Emulation
Date: Sat, 6 Feb 2016 23:14:08 +0000
Making progress here, thanks for the help. JSBeeb is a wonderful resource,
thanks Matt, being able to stop at any point and compare status really is
extremely useful.
JGH you're spot on, LDY Abs,Y was indeed wrong. At risk of embarrassing
myself, here's today's fixes:- Memory initialised low, amateur!
- Z & N not considered on SBC ADC
- ADC & SBC results could exceed 8 bits
- ROR implemented incorrectly
- Z & N not considered on PLA
- Corrected V flag logic in SBC / ADC
- LDX Abs,Y ($BE) wasn't adding Y offset
- LDY Abs,X ($BC) was LDX Abs,Y !
Getting things wrong is all part of the learning process & getting them right
of course, and it's all good fun.
Thanks again, I may be back shortly...Julian.
> Date: Fri, 5 Feb 2016 17:35:50 +0000
> From: jgh@...
> To: bbc-micro@...
> Subject: Re: [BBC-Micro] Emulation
>
> Steve Fewell wrote:
> > It looks like &0356 should contain values between 0 and 4. In your
> > code fragment (below), 0 would JMP to &CC02, 1 would JMP to &CC32, 2
> > would JMP to &CC7A, 3 would JMP to &CC92 and 4 would JMP to &CCE6
> > So a value of &0E definitely seems incorrect to me.
>
> That makes me suspect that:
>
> CB64 LDY &C440,X ;screen display memory index table
> CB67 STY &0356 ;memory map type
>
> is wrong, that the emulation of LDY abs,X is wrong. Supported by earlier
> code being:
>
> CB54 LDA #&07 ;else A=7
> CB56 ASL ;A=A*2
> CB57 TAY ;Y=A
>
> so Y=&0E at that point. If LDY abs,X is being implemented as LDX abs,X
> then &0356 is being set to &0E instead of the memory map type.
>
> --
> J.G.Harston - jgh@... - mdfs.net/jgh
>
>
> _______________________________________________
> bbc-micro mailing list
> bbc-micro@...
> http://lists.cloud9.co.uk/mailman/listinfo/bbc-micro