. > Emulate65 This is a little guide on the 6502 emulators for Arthur/Archimedes, by SSwales. (but it's not all my fault this time). There are at present three types of 6502 emulator for Arthur; all are relocatable modules. Depending on an assmebly time option, they can each be made in two variants - ones which claim the emulated 6502 space as part of their module workspace and those which use application space at &8000 upwards for the emulated 6502 space. (i) 65Tube (used to be known as 65Arthur) Emulates a 6502 second processor environment, so that calls to WrCh,OSByte etc. are in general not trapped locally, but are passed to the Host machine, in this case the Arthur OS. Two 6502 code images are strapped onto the end of the ARM code at assembly time - a Tube OS lookalike that traps a few OSBytes (a la real second processor TOS) etc. but passes most calls on to the ARM code via unused single byte 6502 opcodes (typically &x3), and a copy of HIBASIC 4.31, which is copied into RAM whenever *basic is executed in emulated code. It executes code as if the 6502 processor were being clocked at about 1.36 MHz (deduced from BASIC benchmark programs). This emulator can be used to run many 6502 language ROM images; often enhancing the facilities provided by these packages - for instance View and ViewSheet can be used in the Arthur 132 column modes, and due to the speed of WrCh being greater than on the BBC micro their screen update is actually much faster than when running on the old BBC. Double ROM systems such as Acornsoft Logo and ISO-Pascal which use sideways ROM OSByte calls to page each other across the Tube do not work. MASM (part of the 6502 Development package) does not work as no hardware trapping is done, so that peeking/poking Tube hardware does not work; also there is not I/O processor to communicate with! Star commands are passed to Arthur OS_CLI, and you can use whatever filing system you want. Use *EmulateTube to start the emulator. Use *Quit to exit the emulator. Deviant versions of the above can be made containing any language ROM, for instance View. (ii) 65Turbo Emulates an extended (Turbo) 6502 second processor environment, similar to 65Tube, but understands the difference between normal and Turbo 6502 code if they have a standard image header (normally associated with sideways ROM code, but it's actually more general). Normal 6502 code images have type bytes of the form 2_x1xx0010 (ProcType = 2_000)for a language or 2_01100000 for BASIC (special case), whereas Turbo code has type bytes of the form 2_x1xx0011 (ProcType = 2_001). A Turbo second processor has nothing to do with the Master Turbo, which is just a faster 6502 second processor; it is in fact a 256 KByte 6502 second processor which uses page 03 as extra indirection bytes, so that indirect and indirect,Y opcodes take an extra cycle to fetch a byte from &0301 + zp_offset to yield a 24-bit address, of which only the bottom 18 bits is used. The extra memory cannot be accessed using any other addressing modes than these two. When not executing code with a Turbo type byte, it behaves just like a normal 64K Byte second processor. This emulator is useful for running TurMasm and TurMasm816 which are needed to build BBC OS'es, 6502 emulator code, File Server code, Communicator code etc. Due to the extra address fetch involved in all xxxI and xxxIY opcodes, it is about 1.5% slower than the standard emulator on typical BASIC programs. However, it is probably of little interest to outside punters, as Turbo processors never really got outside of Acorn. Use *EmulateTurbo to start the emulator. Use *Quit to exit the emulator. Deviant versions of the above can be made containing any language ROM, for instance TurMasm. (iii) 65Host Emulates a BBC Model B running OS 1.20 - it does NOT emulate B+, Master 128 or anything else. It supports paged sideways ROMs, as well as direct screen access. This emulator is slightly slower (don't know quite how much yet) than 65Tube as it has to trap accesses to hardware devices and various other memory locations. It can be used in conjunction with ROM podules; on initialisation it enumerates rom:@ looking for files of type &BBC ('BBC ROM') and stores these filenames in a table for later use. An image of BASIC 2 is made available in socket 12 by default. This emulator actually uses 128K of memory as it fills areas of the 64K address space which are to be trapped with a trap byte and those trapped areas that correspond to memory and not other hardware devices have their real contents stored at 64K + memory address. A trap byte of &FB was chosen as it is less likely to be loaded than most other data bytes. Accesses to some OSByte variables are trapped in order to access the real Arthur OS_Byte variables instead of a local copy. Writes to screen memory &xx00..&7FFF are trapped in order to update the displayed screen, converting the BBC style byte into Archimedes style bytes. The Archimedes screen is accessed directly for speed. FRED (FCxx) and JIM (FDxx) devices: 1MHz bus accesses are trapped and issue OS_Byte calls which are processed by the BBC I/O Podule software if that podule is present, otherwise reads return &FF, writes ignored. SHEILA (FExx) devices: 6845 CRTC R0-R7 not implemented. Uses Arthur VDU 23,0,r,v| to do other functions. reads from R16,17 (light pen position) return &00. 6850 ACIA not implemented: reads return &00, writes ignored. Serial ULA reads return &FE, no cassette relay to turn on or off when writing to it. Can set Tx/Rx baud rates. Video ULA screen cleared on MODE change. Can't set cursor width. Econet ID reads the Econet station number from CMOS RAM as if set by Molex links on BBC board. Econet IntOn not implemented: reads return &FE. 74LS161 ROMSEL writes to this copy the corresponding sideways ROM image from cache into &8000..&BFFF. If no ROM occupying socket then &8000..&800F is written to the ROM number to indicate socket uniqueness (speeds up initialisation) and invalid ROM (no (C) string). reads return current value (unlike real BBC, but like Master 128). 6522 VIAA reads from most registers echo current value. reads from IRB depend on I/O Podule to provide ADVAL for FIRE button state. Handles slow I/O bus accesses for BBC keyboard scanning. 6522 VIAB depends on I/O Podule to provide SHEILA handling, otherwise writes ignored, reads return &00. 8271 FDC not implemented; reads return &FE, writes ignored. 6854 ADLC not implemented: reads return &FE, writes ignored. u7002 ADC depends on I/O Podule to provide SHEILA handling, otherwise writes ignored, reads return &00. Tube ULA not implemented: reads return &FE, writes ignored. Two Arthur MODE changes are done for each real BBC MODE change due to the way BBC OS 1.20 programs the Video ULA Flashing colours are not done properly. Keyboard emulation not quite up to par: can't do OSByte &7A, &79 -ve etc. MODE 3,6 hardware scroll wrong. The emulator provides several star commands: *ListROMs gives a list of all the sideways ROMs that the emulator knows about, and whether they are cached or not. *SwapROMs swaps the pointers to the specified cached objects (may be empty) *CacheROM [] with no filename argument ensures that the current linked name is cached. Otherwise it loads the specified BBC ROM file (must be 16K long) into store for use when the emulator is run. *LinkROM [] with no filename argument frees the store used for that ROM socket. Otherwise it takes a copy of the name to cache when the emulator is run. *EmulateBBC starts up the emulator, first cacheing any linked files. A BBC ROM file is needed in order to access any filing systems; this is the ARFS file. *CacheROM 0 ARFS is used to load this for use - this command must be executed before entering the emulator! NB. Once the emulator is running, star commands do not get passed out to the Arthur OS_CLI handler as the screen must not be corrupted. Use *Quit to exit the emulator. Where do I get it all from ? ---------------------------- 65Tube is available on net#arf(49.254):$.a500.rm.65Tube 65TubeView net#arf(49.254):$.a500.rm.65TubeView 65Turbo net#arf(49.254):$.a500.rm.65Turbo 65TurboMasm net#arf(49.254):$.a500.rm.TurboMasm 65Host net#arf(49.254):$.a500.rm.65Host ARFS net#arf(49.254):$.a500.arfs You can log on as Guest to access any of the above files. Stuart