Date : Fri, 05 Feb 2016 15:52:29 +0000
From : julian_stenning@... (Julian Stenning)
Subject: Emulation
Thanks Matt, that's a really useful tool to help me out here.
I've probably got something wrong in the code somewhere and have corrected
an error on the BIT implementation whilst looking where Steve had pointed
me. Obviously my Y reg value at CBDD is wrong, so there's a few more errors
I'm yet to discover...
From: matt@...
Date: Fri, 5 Feb 2016 15:31:20 +0000
Subject: Re: [BBC-Micro] Emulation
To: julian_stenning@...; kranser@...; bbc-micro at
cloud9.co.uk
Hi Julian,
Perhaps jsbeeb can be helpful here: https://bbc.godbolt.org/ -- press ctrl-HOME
to bring up the debugger; then clicking just to the left of each address
sets a breakpoint. You can hit 'G' to go and then press ctrl-F12 (for ctrl-break).
(more full details on the debugger at https://github.com/mattgodbolt/jsbeeb/wiki/Debugger
)
I set breakpoints at CBDD and observed Y=$e6 and Y=$CC at CBE2. The X register
is $04 so the LDY $c454,X is reading from c458.
jsbeeb supports memory read/write breakpoints too, so feasibly I can help
find when $356 is written to. That said; when debugging jsbeeb I also found
reading JG's annotated disassembly http://mdfs.net/Docs/Comp/BBC/OS1-20 useful
(though I recommend putting all the pieces together to make it easily searchable).
Let me know (off-list if you'd prefer) if I can help you more!
-matt
On Fri, Feb 5, 2016@... AM Julian Stenning <julian_stenning@...>
wrote:
Hi,
C454-8 look good, same content as the disassembly, &0356 contains 0E at termination
(0357 is FF, if that helps). Does that indicate anything?
Date: Fri, 5 Feb 2016 14:25:15 +0000
From: kranser@...
To: julian_stenning@...; bbc-micro@...
Subject: Re: [BBC-Micro] Emulation
Hi Julian,
Maybe your data at &0356 (memory map type) is incorrect, or the &C454-&C458
table (as specified at http://mdfs.net/Docs/Comp/BBC/OS1-20/C300) is incorrect.
Just some thoughts...
Steve.
From: Julian Stenning <julian_stenning@...>
To: BBC Mailing List <bbc-micro@...>
Sent: Friday, 5 February 2016, 13:31
Subject: [BBC-Micro] Emulation
Hello,
In order to boost my knowledge of PowerShell (a Microsoft scripting language
useful for my work) I gave myself a task of writing a 6502 emulator as an
objective. It's a pretty simple affair but has been a very good learning
tool and I wondered what would happen if I loaded the OS 1.2 Rom in to memory
and tried running it. Using the really handy disassembly info on MDFS.net
I could see if my emulation was working as I stepped through the instructions
from &D9CD.
So I wondered how far I could take this in order to extend the exercise,
perhaps I could get the OS boot sequence to complete. At this point I must
say that I'm not (yet) emulating any other hardware, timers, or dealing with
interrupts, I'm simply running through the 6502 opcodes & taking the appropriate
action.
The emulation plods away through the memory initialisation quite happily,
but the snag I've hit is when reaching somewhere in the screen init. At CBF0
is the instruction JMP (&035D) which for me is referring to an invalid location
of &CC0D (it's the 2nd byte of an STA instruction at CC0B).
>From the disassembly (http://mdfs.net/Docs/Comp/BBC/OS1-20/CA39):CBC1 LDX
#&00 ;X=0
CBC3 LDA &034E ;hi byte of screen RAM address
CBC6 STX &0350 ;window area start address lo
CBC9 STA &0351 ;window area start address hi
CBCC JSR &C9F6 ;use X and Y to set new cursor address
CBCF LDY #&0C ;Y=12
CBD1 JSR &CA2B ;set registers 12 and 13 in CRTC
CBD4 LDA &0358 ;background text colour
CBD7 LDX &0356 ;memory map type
CBDA LDY &C454,X ;get section control number
CBDD STY &035D ;set it in jump vector lo
CBE0 LDY #&CC ;Y=&CC
CBE2 STY &035E ;upper byte of link address
CBE5 LDX #&00 ;X=0
CBE7 STX &0269 ;paged mode counter
CBEA STX &0318 ;text column
CBED STX &0319 ;current text line
CBF0 JMP (&035D) ;jump vector set up previously
For me at CBDD Y=OD and at CBE2 Y=CC. This task is also helping me understand
some of the 'under the bonnet' parts of the BBC but at this point I've reached
the limit of my knowledge.
Can anyone give me some guidance of what might be wrong here?
Thanks,Julian.
_______________________________________________
bbc-micro mailing list
bbc-micro@...
http://lists.cloud9.co.uk/mailman/listinfo/bbc-micro
_______________________________________________
bbc-micro mailing list
bbc-micro@...
http://lists.cloud9.co.uk/mailman/listinfo/bbc-micro