<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Fri, 05 Feb 2016 13:31:31 +0000
From   : julian_stenning@... (Julian Stenning)
Subject: 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.
                                         
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>