Code Monkey home page Code Monkey logo

b-em's Introduction

B-Em

Introduction

B-em is an emulator for various models of BBC Microcomputer as made by Acorn Computers in the 1980s along with a selection of 2nd processors. It is supported for Win32 and Linux/UNIX but may also work on other systems supported by the Allegro library.

B-em is licensed under the GPL, see COPYING for more details.

DEVELOPMENT

Development is active! If you want to know how to work with us, then please make sure you have a look at the SUBMITTING_PATCHES.md file

TODO File

A TODO.md file exists, with ideas for future functionality for future versions of B-em.

Contact

B-em is maintained by a group of volunteers -- please enquire over on the stardot forums for more details.

Compiling

Linux

You will need the following libraries:

  • Allegro 5.2 or later
  • Zlib

Linux distros which include Allegro 5.2 at the time of writing include:

  • Arch
  • Debian Stable (stretch)
  • Ubuntu 17.10 (Artful Aardvark)

Allegro 5.2 packages for Ubuntu 16.04 LTS can be had from Launchpad

Released version

Open a terminal window, navigate to the B-em directory then enter:

./configure && make

From Git Sources

./autogen.sh && ./configure && make

Notes

  • B-Em looks for its config file at $XDG_CONFIGID_RI/b-em/b-em.cfg or, if $XDG_CONFIG_DIR is not defined, at ~/.config/b-em.cfg
  • If a config file cannot be found in those locations it will pick up a default config from where the package is installed or from the build directory, if being run from there. It will always be saved back to $XDG_CONFIGID_RI/b-em/b-em.cfg or ~/.config/b-em.cfg
  • This same config dir is used for CMOS RAM images and hard disc images.
  • On Linux, the debugger expects to use the terminal window from swhich you started b-em for input and output. On Windows it opens a console window for this purpose.
  • With the port to Allegro 5 all the video output modes are available on both Win32 and Linux.

Windows

You will need version 5.2.2.0 of Allegro from:

https://github.com/liballeg/allegro5/releases/tag/5.2.2.0

Later versions have a bug which prevents the ticks in the menus from working correctly. There is a choice of compilers but these instructions only cover MingW and assume you have this correctly installed.

Unpack/clone B-Em into a folder and unpack the Allegro5 into a parallel folder, i.e. so the allegro folder and the b-em folder have the same parent and then from within the b-em folder run makebem.bat

Notes

  • On Windows B-Em looks for resource files in the same directory as the executable with the exception of b-em.cfg, the CMOS RAM image file and hard discs which are stored in a b-em.exe folder within your Windows roaming profile.

Features

  • Emulates Models A, B, B+, Master 128, Master 512, Master Turbo and Master Compact
  • Also emulates ARM evaluation system on Master 128
  • Emulates 6502, 65816 and Z80 and 32016 tubes.
  • Cycle-accurate video emulation
  • All documented and undocumented 6502 instructions
  • 8271 Floppy Disc Controller emulated (double drive, double sided, 80 track, read/write)
  • 1770-based Floppy Disc Controllers from various manufacters emulated including Acorn, Opus, Solidisk, Watford Electronics (double drive, double sided, 80 track, read/write)
  • Supports following disc formats - .ssd, .dsd, .adf, .adl, .img, .fdi and variants thereof for the non-Acorn DFSes.
  • Supports the following tape formats: .uef and .csw
  • Can run many protected disc and tape games.
  • SCSI and IDE hard disc emulation
  • Sound emulation, including sample playback
  • BeebSID emulation
  • Hybrid Music System emulating including Music 500o (synth), Music 4000 (keyboard, emulated via MIDI) and Music 2000 (MIDI).
  • Lots of video tricks, such as overscan, raster splitting, rupture, interlace, mid-line palette and mode splits, etc.
  • Video NuLA extended pallete ULA emulation.
  • Sideways RAM emulation
  • Joystick emulation
  • AMX Mouse emulation

New Features

New With V2.2

  • MOS 3.50 emulation
  • Fixed CRTC bug when programmed with stupid values (MOS 3.50 startup)
  • ADFS disc corruption bug fixed (Carlo Concari)
  • Fixed ACIA bug - Pro Boxing Simulator tape version now works
  • Fixed bug which created endless blank hard disc images
  • Printer port DAC emulation
  • AMX mouse emulation
  • Master 512 mouse now works properly
  • Master Compact joystick emulation
  • IDE emulation available in non-Master models
  • UI fixes (some from Carlo Concari)
  • Improvements to VIA emulation
  • PAL video filter
  • Bugfixes in ARM and 65816 coprocessors
  • Debugger fixes
  • Tidying up of code
  • Windows version can now build on MSVC as well as GCC

New Since Version 2.2

##Features

  • Implement RTC for Master
  • Working 32016 co-processor (shared with PiTubeDirect)
  • Emulate a SCSI hard disk.
  • VDFS - selective access to host filesystem as a standard Acorn filing system.
  • Music 5000 emulation (from Beech, via Hoglet)
  • Music 4000 emulation via MIDI
  • Load ROMs into specific slots
  • Debugging on all current tube processors
  • Debugger "step over subroutine"
  • Debugger: optional refresh screen in single-step/when breakpoint hit.
  • Debugger: tracing instructions to a file
  • Video NuLa
  • Add ROMs to an existing model from anywhere on your PC via menu and file picker.
  • Save state to a snapshot file for a machine running with Tube processor (except 32016)
  • Emulate the external and internal 6502 tube processors with the correct ROMs and speeds
  • Get the visualisation of memory access when debugging working cross-platform
  • Cross-platform keyboard mapping
  • Cross-platform tape catalogue
  • Replace diverged Windows/Linux GUI with single GUI

Bug Fixes

  • potential crashes when loading tapes
  • CSW files now work on 64-bit Linux
  • Unix: Fix fullscreen handling
  • Add missing SBC zero page indirect X on tube 6502
  • Fix SBC overflow (V) in binary mode on main and tube 6502
  • Fix aparent error with carry flag in undocumented instructions.
  • i8271: fix emulation always reporting drive as ready
  • i8271: ensure spindown happens on disk fault and on closing a disk image.
  • 65816: Fix failure to remember 65816 is enabled
  • mouse: Fix not working Y direction in 80186 co-pro Gem.
  • 6502: fix BCD errors on both main and tube 6502 (but not 65C02)
  • 65c02: Added missing BIT zp,X (0x34) instruction
  • 65c02 core/tube: Correted NOP lengths
  • 65c02 core/tube: Fixed ZP wrapping issue with inditect addressing
  • 6502tube: implement Rockwell instructions RMB/SMB and BBR/BBS
  • debugging: fix disassembly of 6502 opcode 24, BIT zp
  • Fix 256 byte transfer over Tube hangs
  • video: fix loadstate/savestate inconsistency

Default keyboard mapping

BBC key PC key
BREAK f12
*: @'
+; :;
-= -_
^~ +=
f0 f0 (function keys are based on keycaps, not positioning)
3# 3
6& 6
7' 7
8( 8
9) 9
0 0
Shift lock - ALT

The PC key Page Up acts as a speedup key and Page Down as pause.

GUI

The options are:

File

Option Meaning
Hard reset resets the emulator, clearing all memory.
Load state load a previously saved savestate.
Save state save current emulation status.
Save Screenshot save the current screen to a file
Exit exit to OS.

Edit

Option Meaning
Paste via Keyboard send the contents of the clipbaord as keystoked
Printer to Clipboard capture printer output and copy to clipboard

Disc

Option Meaning
Autoboot disc 0/2 load a disc image into drives 0 and 2, and boot it.
Load disc 0/2 load a disc image into drives 0 and 2.
Load disc 1/3 load a disc image into drives 1 and 3.
Eject disc 0/2 removes disc image from drives 0 and 2.
Eject disc 1/3 removes disc image from drives 1 and 3.
New disc 0/2 creates a new DFS/ADFS disc and loads it into drives 0 and 2.
New disc 1/3 creates a new DFS/ADFS disc and loads it into drives 1 and 3.
Write protect disc 0/2 toggles write protection on drives 0 and 2.
Write protect disc 1/3 toggles write protection on drives 1 and 3.
Default write protect determines whether loaded discs are write protected by default
IDE Hard disc Enables emulation of an IDE hard disc
SCSI Hard disc Enables emulation of a SCSI hard disc
Enable VDFS Enable a subset of host OS files to be visible as an Acorn filing system
Choose VDFS Root Chose the directory on the host that is visible via VDFS

Tape

Option Meaning
Load tape load a tape image.
Eject tape removes a tape image.
Rewind tape rewind the emulated tape.
Show tape catalogue shows the catalogue of the current tape image.
Tape speed select between normal and fast tape speed.

ROMS

This menu shows the contents of the Sideways ROM/RAM banks and enables these to be loaded with a different ROM, enabled as RAM or cleared.

Model

This lists the models in alphabetical order and enabled the model being emulated to be changed. Be aware this causes a reset.

Tube

This lists the available second processors and enabled one to be chosen. The choice in this menu is overridden if the model picked in the model menu is always supplied with a 2nd processor, for example the Master 512. For models like this the bundled 2nd processor is always used.

Settings

Video

Display Type

Option Meaning
Line Doubling stretch the BBC screen by doubling every line.
Scanlines stretch the BBC screen by blanking every other line
Interlaced emulate an interlaced display (useful for a handful of demos). Allows high resolution mode 7.
PAL use PAL filter!
PAL interlaced use PAL filter, with interlacing. Slow! Allows high resolution mode 7.

Borders

Option Meaning
None Remove all the black space around the image area.
Medium borders intended to be attractive rather than accurate
Full The full borders as seen on an old TV
Option Meaning
Fullscreen enters fullscreen mode. Use ALT-ENTER to return to windowed mode.

Sound

Option Meaning
Internal sound chip enable output of the normal BBC sound chip.
BeebSID enable output of the SID emulation.
Music 5000 enable output from an emulated Music 5000 synth
Printer Port DAC enable output of 8-bit DAC connected to the printer port.
Disc drive noise enable output of the disc drive sounds.
Tape noise enable output of the cassette emulation.
Internal sound filter enable bandpass filtering of sound. Reproduces the poor quality of the internal speaker.
Internal waveform choose between several waveforms for the normal BBC sound chip. Square wave is the original.

reSID configuration

Option Meaning
Model choose between many different models of SID. Many tunes sound quite different depending on the model chosen.
Simple method Choose between interpolation and resampling. Resampling is in theory higher quality, but I can't tell the difference.
Disc drive type choose between sound from 5.25" drive or 3.5" drive.
Disc drive volume set the relative volume of the disc drive noise.

Keyboard

Option Meaning
Redefine keys redefine keyboard setup. Map CAPS/CTRL to A/S - remaps those 2 keys. Useful for games where CAPS/CTRL are left/right.

Mouse

Option Meaning
AMX mouse enables AMX mouse emulation.

Speed

Choose an soeed relative to a real model of that type.

Debug

Option Meaning
Debugger Enters debugger for debugging the main 6502. Type '?' to get list of commands.
Debug Tube Enters debugger for debugging the current 2nd processor.
Break break into debugger.

Command Line Options

b-em [discimage|tapeimage|snapshot] [-u name.uef] [-mx] [-tx] [-i] [-c] [-fx] [-spx]

discimage name.ssd/dsd/adf/adl/img etc. tapeimage name.uef/csw snapshote name.snp (previously saved snapshot) -u name.uef - load UEF image name.uef

-mx - model to emulate, where x is

0 - BBC A with OS 0.1
1 - BBC B with OS 0.1
2 - BBC A
3 - BBC B with 8271 FDC
4 - BBC B with 8271 FDC + loads of sideways RAM
5 - BBC B with 1770 FDC + loads of sideways RAM
6 - BBC B US with 8271 FDC
7 - BBC B German with 8271 FDC
8 - B+ 64K
9 - B+ 128K
10 - Master 128 w/ MOS 3.20
11 - Master 512
12 - Master Turbo
13 - Master Compact
14 - ARM Evaluation System
15 - Master 128 w/ MOS 3.50
16 - BBC B with no FDC + loads of sideways RAM
17 - BBC B w/Solidisk 1770 FDC
18 - BBC B w/Opus 1770 FDC
19 - BBC B w/Watford 1770 FDC
20 - BBC B w/65C02, Acorn 1770
21 - BBC B with 65C02, no FDC

-tx - enable tube, where x is:

0 - 6502 (internal)
1 - ARM (Master only)
2 - Z80
3 - 80186 (Master only)
4 - 65816 (if ROMs available)
5 - 32016
6 - 6502 (external)

-i - enable interlace mode (only useful on a couple of demos)

-c - enables scanlines

-fx - set frameskip to x (1-9, 1=no skip)

-fasttape - speeds up tape access

-spx - emulation speed where x is 0 to 9 (default = 4)

IDE Hard Discs

To initialise a hard disc, use the included HDINIT program. Press 'I' to investigate the drive - this will set up the default parameters for a 50 mb drive. If you want a different size press 'Z' and enter the desired size - it does not matter that this does not match the size given in the emulated hardware.

Then press 'F' to format, and follow the prompts.

Master 512

Master 512 includes mouse emulation. This is used by trapping the mouse in the emulator window - click in the window to capture it, and press CTRL + END to release.

All disc images used by the Master 512 should have the .img extension - the type is determined by size. Both 640k and 800k discs are supported, as well as DOS standard 360k and 720k.

You can use the IDE hard disc emulation with this, run HDISK.CMD in DOS-Plus, then HDINSTAL.BAT. Go make a cup of tea while doing this, it takes forever! HDISK.CMD will create a file 'DRIVE_C' in ADFS so you will need to format the hard disc using ADFS first.

65816 coprocessor

The ROMs for this coprocessor are not included with the emulator. You will need to acquire the file ReCo6502ROM_816 and place it in roms\tube.

The 65816 runs at 16mhz, regardless of what the firmware is set to.

Hardware emulated

Processor Meaning
The 6502 processor All instructions should be emulated. Attempts to be cycle perfect. 65C02 is emulated for Master 128 mode.
The 65C12 tube As a parasite processor.
The 65816 tube As a parasite processor. Emulator from Snem.
The Z80 tube As a parasite processor. Probably a few bugs. Emulator from ZX82.
The ARM processor As a parasite processor for Master 128 only. Emulator from Arculator.
The 80186 tube As a parasite processor for Master 512 only. Emulator from PCem.
The 6845 CRTC Cycle-exact emulation. Runs everything I've tried, with all effects working.
The Video ULA Cycle-exact emulation, though I think palette changes are a cycle off? Might be a delay in the real chip.
The System VIA Keyboard and sound emulated. Also CMOS on Master-based models.
The User VIA Emulated.
8271 FDC Double disc, double sided, 40/80 tracks, read/write. With authentic noise. Supports read-only access of protected FDI images.
1770 FDC Double disc, double sided, 40/80 tracks, read/write. With authentic noise. Supports read-only access of protected FDI images.
IDE hard disc Emulates 2 discs. Emulation from Arculator.
SCSI hard disc Emulates 4 discs. Emulation from BeebEm.
Sound All channels emulated, with sample support and some undocumented behaviour (Crazee Rider). With optional bandpass filter.
BeebSID Emulated using resid-fp, so should be pretty accurate. Is only emulated when accessed, to reduce CPU load.
ADC Real joystick emulation, supporting both joysticks.
6850 ACIA Emulated for cassettes. Read only.
Serial ULA Emulated.
Music 5000 Hybrid synth emulated. Emulation from Beech
Music 4000 Hybrid music keyboard. Emulated via MIDI, Emulation original to B-Em
Music 2000 Hybrid MIDI I/F. Connects to host MIDI, Emulation original to B-Em

Hardware NOT emulated

  • Serial Port
  • Econet

Thanks

  • Sarah Walker for B-Em up to V2.2
  • David Gilbert for writing Beebem and distributing the sources with it
  • James Fidell for writing Xbeeb and distributing the sources with it
  • Tom Seddon for updating Model B, indirectly motivating me to do v0.6, and for identifying the Empire Strikes Back bug.
  • Ken Lowe for assistance with the Level 9 adventures.
  • Rebecca Gellman for her help with a few things (hardware-related).
  • Thomas Harte for some UEF code - I wrote my own in the end - and for the OS X port.
  • Dave Moore for making and hosting the B-em site
  • Rich Talbot-Watkins and Peter Edwards (also Dave Moore) for testing
  • Robert Schmidt for The BBC Lives!
  • DJ Delorie for DJGPP
  • Shawn Hargreaves for Allegro
  • Robert Sprowson for the ARM7 TDMI firmware. (http://www.sprow.co.uk/bbc/armcopro.htm)

Acorn for making the BBC in the first place:

David Allen,Bob Austin,Ram Banerjee,Paul Bond,Allen Boothroyd,Cambridge, Cleartone,John Coll,John Cox,Andy Cripps,Chris Curry,6502 designers, Jeremy Dion,Tim Dobson,Joe Dunn,Paul Farrell,Ferranti,Steve Furber,Jon Gibbons, Andrew Gordon,Lawrence Hardwick,Dylan Harris,Hermann Hauser,Hitachi, Andy Hopper,ICL,Martin Jackson,Brian Jones,Chris Jordan,David King, David Kitson,Paul Kriwaczek,Computer Laboratory,Peter Miller,Arthur Norman, Glyn Phillips,Mike Prees,John Radcliffe,Wilberforce Road,Peter Robinson, Richard Russell,Kim Spence-Jones,Graham Tebby,Jon Thackray,Chris Turner, Adrian Warner,Roger Wilson and Alan Wright for contributing to the development of the BBC Computer (among others too numerous to mention)

b-em's People

Contributors

ajgbarnes avatar dominicbeesley avatar dp111 avatar fesh0r avatar hoglet67 avatar homo-carbonis avatar jamesyoungman avatar komadori avatar lovebug2084 avatar myelin avatar richardfearn avatar rjpontefract avatar sai2791 avatar samtygier avatar sarah-walker-pcem avatar stevefosdick avatar thomasadam avatar zornslemma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

b-em's Issues

Master Turbo mode leaves 6502 second processor permanently selected

I just built 4ce6e9d (current master HEAD) on Linux. It works great generally, but if I choose Settings->Model->Master Turbo, it seems to enter a strange stuck state where I can't turn the second processor off. If I subsequently choose Settings->Model->BBC Master 128 it doesn't turn the second processor off. Choosing a different second processor or none from Settings->Second processor doesn't make any difference - I always have a 6502 second processor.

Cheers.

Steve

NuLA palette ignored in mode 7

Reported by guesser in the B-Em release thread in the Stardot Forums. B-Em's emulation of Video NuLA does not include mapping the Mode 7 colours to the NuLA RGB palette as demonstrated by this test program:

   10 REM MODE 7 Video NuLA Test Program
   20 MODE 7
   30 PRINTCHR$(129);"This line is red"
   40 PRINTCHR$(130);"This line is green"
   50 PRINTCHR$(131);"This line is yellow"
   60 PRINTCHR$(132);"This line is blue"
   70 PRINTCHR$(133);"This line is magenta"
   80 PRINTCHR$(134);"This line is cyan"
   90 PRINTCHR$(135);"This line is white"
  100 PRINTCHR$(136);"This line should flash"
  110 PRINT
  120 PRINT"Press a key to enable NuLA...";
  130 K%=GET
  140 PRINT:PRINT
  150 *FX151,35,120
  160 *FX151,35,136
  170 *FX151,35,106
  180 *FX151,35,66
  190 *FX151,35,95
  200 *FX151,35,80
  210 PRINTCHR$(133);"Magenta should now be orange"
  220 PRINTCHR$(134);"Cyan should now be brown"
  230 PRINTCHR$(135);"White should now be grey"
  240 PRINT
  250 PRINT"Press a key to reset NuLA...";
  260 K%=GET
  270 PRINT
  280 *FX151,34,64

Allegro5: Review OS-specific features

At some point I'd also like to investigate the set of differences between the Windows and Linux builds. With the Allegro 5 native dialogue option and hopefully the bugs in video bitmaps fixed on Linux there should be less need for platform specific code inside B-Em - that's what Allegro is supposed to handle.

Emulation of Music 2000 MIDI Interface

With the emulation of the Music 5000 syntheisier and the Music 4000 keyboard (via MIDI) it would be good to complete the set with the Music 2000 MIDI interface.

Code adjustements for W10/MinGW64 build

While attempting a build I noticed some issues which only seem to occur on this newer version of the compiler.

  • tsearch.c contains a typedef for max_allign_t which now seems to be already done in the standard headers, or the surrounding #ifndef text must have changed
    /* #ifndef __CLANG_MAX_ALIGN_T_DEFINED typedef long double max_align_t; #endif */
  • Makebem.bat points hardcoded to C:/Mingw where in Msys2 we have C:\msys64\mingw32 and mingw64
    set MINGW=c:\MinGW. Also, a makebem.sh seems more natural but preferably the autogen part should work.
  • Compling Z80.c fails because in the Makefile.win it is actually called z80.c (lower case). Somehow this compiler version is case-sensitive.

Key Redefinition GUI not working on Linux

There is code in B-Em to allow the keyboard to be redefined on Linux and there is even an option on the menu to do so, but clicking the menu item doesn't cause anything to appear.

VDFS always *RUNs in the I/O processor

If you have a Tube system and you try to run a transient executable on the Tube, it gets loaded and run in the I/O processor instead. With sometimes hilarious results.

https://www.youtube.com/watch?v=4icSz0ks2pE

Modifying the code in run_file() to load the binary into the Tube is really easy, but actually calling the code isn't, and may need ROM support --- out of my pay grade, unfortunately.

Implement Video NuLA Spectrum attributes

From Hoglet in the comments on Issue#50:

Hi Guys,

I'm sure you are aware of this, but VideoNuLA now implements three different attribute based modes:

normal attribute mode (reg 6 = 1, reg 7 = 0)
text attribute mode (reg 6 = 1, reg 7 = 1)
spectrum attribute mode (reg 6 = 2, reg 7 = don't care I think)
It looks like the B-Em emulates normal and text attribute mode, but not the spectrum attribute mode.

Probably we should create a separate issue to track this.

Dave

So this is the separate issue.

allegro5: Segmentation fault with no b-em.cfg file.

See http://stardot.org.uk/forums/viewtopic.php?f=4&t=10823&sid=1b0ce810467ebecbbd16449177d5a13e&start=270#p196074

The issue is caused because, when B-Em with Allegro 5 starts and is unable to open the config file, it does not create an empty config in the way that Allegro 4 does but waits until it is time to save the configuration before creating that config. This means code that previously wrote config changes while running, i.e. before config save time, must no longer do so.

open with .uef/.ssd files

If you click on a uef file associated with b-em it does not load it in b-em as a tape but try's to load it as a disc image.

256 byte transfer over Tube hangs on Tube release call

Boot the attached ssd tube-bug.zip in Master Turbo mode. In MODE 7 you should see a message on screen, in any other mode a flash of green raster and then some crap left in the screen buffer.

This is copying 256 bytes from the parasite RAM over to the host RAM using the 256 byte "fast" transfer protocol - see AUG page 338 for details.

Alas on b-em (and jsbeeb) the Tube code hangs during the Tube release call waiting for a byte from the parasite that never arrives. This has been verified to work on my actual Master Turbo hardware.

Provide a "virtual printer" output to image/PDF or some modern format...

Per a StarDot thread, I felt I should formally open an issue here..

What is the concern:
Most software written for the BBC micro uses an obsolete printer control method, using Escape sequences which were available on Centronics or Serial interfaced printers of their era. Current printers connected to Mac or PC systems are more likely to be USB based, and use entirely different printer control languages such as PostScript or HP-PCL.

What is desired:

A "virtual printer" that can emulate the control seqeunces translating them into an appropriate modern format, should be implemented. The output format of this could be PDF, or a suitable bitmpa image format for graphics.. If no specialist sequences are used then a plain text file could also be generated.

IIRC a "Virtual Printer" was implemented in some experimental builds of DosBox, but I have no further details at present...

Menus don't work on Allegro 5 build (Ubuntu 18.04 amd64 as VirtualBox guest)

Hi,

I don't know if this is my fault and/or it's an uninteresting case, but for what it's worth...

I'm running Ubuntu 18.04 amd64 as a guest operating system under VirtualBox 5.2.12 (Windows 7 host). I have the guest extensions installed. I've built f1dd7d2 from github without any problems (just a few warnings about ignored fread() return values). When I start the emulator it looks OK (I see the b-em window with menu bar and a BBC B mode 7 startup screen underneath it) but the terminal I launched it from says:

OpenGL Warning: vboxCall failed with VBox status code VERR_BUFFER_OVERFLOW

That may or may not be relevant. The b-em menus don't work; if I click on (e.g.) File it is highlighted but no menu appears beneath it. There's no additional terminal output when this happens.

Much more fuzzily - if I click on another window hidden behind the b-em window, the b-em menu bar and frame disappears but the actual emulated machine's screen remains in the foreground, whereas I'd expect it to be hidden. (I tried to take a screenshot of this but the b-em emulated screen isn't visible in the screenshot.)

Sorry if this is a bit incomprehensible and I appreciate it may not be easy to reproduce, but I thought I'd at least mention it. Let me know if there's anything I can do to help debug this, although I will be away from this virtual machine from tomorrow evening (I use it to get my Linux fix while visiting family, and my visit ends tomorrow...)

I don't know if the machine is a bit underpowered (i5-2500K, 2 CPUs in the emulated machine); if I type into the emulated BBC B I lose some keypresses. CPU use for b-em hovers around 65% in top.

Cheers.

Steve

VDFS seg faults

If I modify a directory which the emulated platform has open, I frequently get a null pointer access in scan_dir(). I don't know why because I don't know the logic, unfortunately --- it appears that there are NULL entries in dir->cat_tab, which causes this loop to fail:

while (ptr < end) {
    ent = *ptr++;
    ent->attribs |= ATTR_DELETED;
}

Adding a simple if ent {} around the obvious line stops the immediate crash, but is probably the wrong solution.

Pixels seem to have inconsistent widths on emulated screen

If you look at the attached screenshot, you can see that some of the P characters look different to others. This is with allegro4 on Linux, built from commit 8277fe9.

screenshot

I have seen similar results using older versions of b-em on Windows. I suspect the cause is that the emulator's window is not a neat multiple of the BBC screen size, so one BBC pixel gets mapped to a fractional number of pixels on the host screen and so some BBC pixels are (say) 2 host pixels wide and some are (say) 3 host pixels wide. On Windows I was able to fix this by using the menus to force the emulated window to an appropriate size, but I don't see any such options on Linux (nor is the window itself resizable)

In preview release, Eject Disc menu option is non-functional along with new-disc option.

In B.EM 2.2 The Eject disc menu option allows for a disc to be ejected.

In the current preview release this option appears to have NO effect, the loaded disc remaining on the menu.

In B-EM 2.2 , New disc menu option is supposed to create a new disc image.

This option appears to be non-functional in the current preview release, as it asks for a filename and then says it can't find it.

NuLA extended attributes mode inconsistent with real hardware

As discussed at http://stardot.org.uk/forums/viewtopic.php?f=3&t=12150&start=510#p196887 the NuLA emulation doesn't match the behaviour of real NuLA hardware in extended attributes mode. If you run this program:

REM Start off in a known state
*VNRESET
MODE 0
?&FE22=&61:REM attribute mode
?&FE22=&71:REM extended attribute mode
REM display a block using colour pair 7 - i.e. foreground is logical colour 15,
REM background is logical colour 14
FOR I%=0 TO 127
I%?&3000=255
NEXT
?&FE21=(15*16)+(8 EOR 7):REM set logical colour 15 to physical colour 8
?&FE21=(14*16)+(0 EOR 7):REM set logical colour 14 to physical colour 0
?&FE23=&88:?&FE23=&88:REM set physical colour 8 to mid-grey
REM ?&FE23=&F8:?&FE23=&00:REM set physical colour 15 to mid-red
PRINTTAB(0,5);
REPEAT UNTIL FALSE

it should produce a group of non-flashing mid-grey blocks with black lines between them, but on b-em it produces a group of flashing mid-grey/white blocks.

sn76489 audio output sounds slightly grainy

This is a follow on from #11 (which we decided to make specific to Music 5000) and have since resolved.

These comments apply to official B-Em 2.2 release, as well as the current build. The problem seems to be present on Linux and Windows.

In very general terms, the sn74689 audio sounds slightly grainy. I really noticed this when I hooked up a decent amp and speakers, so that I could compare the B-Em sn76489 emulation with an FPGA hardware implementation (that uses a decent SPI DAC).

The difference was significant. My testy case was simply the ^G beep.

I think there are a few going on:

  • the audio output of most PCs is pretty noisy
  • the output level of B-Em is quite low compared to other applications
  • the default re-sampling is probably just using linear interpolation
  • on Windows the default openal32.dll is routing directly to DirectSounds3D - it may be better to replace this with OpenAL Soft, then we can control global levels and resampling via alsoft.ini file in %AppData%
  • there is some noticeable modulation on the ^G beep

As a comparison, I tried the Beech emulator on Windows, and this sounded very clean in comparison.

Looking at the ^G waveform on a scope:
image
you can see there is one sample's worth of jitter.

I'm not sure if this is the problem, or if it's even avoidable. The real sn76489 runs at 4MHz/16 = 250KHz, which is 8x the audio sampling clock. So clearly some frequencies will jitter.

Oh, and the sn76489 code is much more complicated that I would expect:
https://github.com/stardot/b-em/blob/master/src/sn76489.c
I don't understand what sidcount is doing here!

I need to do some more investigation, but I would be interested in feedback from other people. Most people I suspect would not notice, unless the issue is pointed out to them.

Provide a key shortcut to toggle between 100% speed and 500% speed

I like to use 500% speed when running the test suite for a program I'm developing, but I have to drop back to 100% when I want to type something in to the emulated machine. It would be nice if there was a single key I could press to toggle between normal speed and maximum speed instead of having to navigate the menu each time.

Alternatively - but I suspect this is hard/impossible - if some magic could make it possible to type normally even when the machine is running at 500% speed, I wouldn't need the toggle and could just leave the machine at 500% all the time.

I hope it's OK to raise a feature request as an issue like this, please let me know if it's not.

Thanks.

Steve

Build errors for tag allegro5-pre2 on Ubuntu 16.04

I haven't spent a lot of time trying to investigate this myself, so don't take it too seriously, but FWIW I had a quick go at building this and it failed...

steven@riemann:~/src/b-em3/b-em$ make 2>&1 | head -20
Making all in src
make[1]: Entering directory '/home/steven/src/b-em3/b-em/src'
  CC       b_em-gui-allegro.o
gui-allegro.c:41:8: error: unknown type name ‘ALLEGRO_MENU’
 static ALLEGRO_MENU *disc_menu;
        ^
gui-allegro.c:58:31: error: unknown type name ‘ALLEGRO_MENU’
 static void add_checkbox_item(ALLEGRO_MENU *parent, char const *title, uint16_t id, bool checked)
                               ^
gui-allegro.c:66:28: error: unknown type name ‘ALLEGRO_MENU’
 static void add_radio_item(ALLEGRO_MENU *parent, char const *title, uint16_t id, int this_value, int cur_value)
                            ^
gui-allegro.c:71:27: error: unknown type name ‘ALLEGRO_MENU’
 static void add_radio_set(ALLEGRO_MENU *parent, char const **labels, uint16_t id, int cur_value)
                           ^
gui-allegro.c:87:28: error: unknown type name ‘ALLEGRO_MENU’
 static void add_sorted_set(ALLEGRO_MENU *parent, menu_map_t *map, size_t items, uint16_t id, int cur_value)
                            ^
gui-allegro.c:98:8: error: unknown type name ‘ALLEGRO_MENU’
 static ALLEGRO_MENU *create_file_menu(void)
steven@riemann:~/src/b-em3/b-em$ dpkg -l | grep -i allegro
ii  liballegro-acodec5-dev:amd64                  2:5.0.11-2                                   amd64        header files for the Allegro 5 audio codec addon
ii  liballegro-acodec5.0:amd64                    2:5.0.11-2                                   amd64        audio codec addon for the Allegro 5 library
ii  liballegro-audio5-dev:amd64                   2:5.0.11-2                                   amd64        header files for the Allegro 5 audio addon
ii  liballegro-audio5.0:amd64                     2:5.0.11-2                                   amd64        audio addon for the Allegro 5 library
ii  liballegro-dialog5-dev:amd64                  2:5.0.11-2                                   amd64        header files for the Allegro 5 dialog addon
ii  liballegro-dialog5.0:amd64                    2:5.0.11-2                                   amd64        dialog addon for the Allegro 5 library
ii  liballegro-image5-dev:amd64                   2:5.0.11-2                                   amd64        header files for the Allegro 5 image addon
ii  liballegro-image5.0:amd64                     2:5.0.11-2                                   amd64        image addon for the Allegro 5 library
ii  liballegro-physfs5-dev:amd64                  2:5.0.11-2                                   amd64        header files for the Allegro 5 physfs addon
ii  liballegro-physfs5.0:amd64                    2:5.0.11-2                                   amd64        physfs addon for the Allegro 5 library
ii  liballegro-ttf5-dev:amd64                     2:5.0.11-2                                   amd64        header files for the Allegro 5 TTF addon
ii  liballegro-ttf5.0:amd64                       2:5.0.11-2                                   amd64        TTF addon for the Allegro 5 library
ii  liballegro5-dev:amd64                         2:5.0.11-2                                   amd64        development files for the Allegro 5 library
ii  liballegro5.0:amd64                           2:5.0.11-2                                   amd64        portable library for cross-platform game and multimedia development

Let me know if you need any more information, of course.

Cheers.

Steve

Add pass through Star Command Processing

Allow elements of the emulation environment to be controlled using star commands from the "Beeb".

e.g. *MUSIC5000 would "turn on" the 5000 Music system code.

This should be done by passing all unprocessed Commands to the emulator raw to be parsed.
Be careful not to make the commands too general as to cause security issues.

Consider using default config when running from build dir

Previous versions of b-em would run from the build directory. This one won't because it can't find the config. Can you consider either:

  • Adding the b-em executable directory to the search path
  • Creating the config in the home directory if it doesn't exist

b-em can't read SSD file (which works in other emulators)

Attached in an ssd generated from beebasm; it works fine in MAME and jsbeeb, but half the files show up as corrupt in b-em.

To reproduce, load into a BBC Master 128 with DFS and autoboot. It'll crash on startup because setscrn is corrupt. Try it on jsbeeb and setscrn will contain real machine code.

I originally thought this was a beebasm bug (stardot/beebasm#32) until I realised that the disk catalogue between the known-good image and the known-bad image was identical. Somehow b-em is just reading half the files from the wrong place on the disk.

I've checked that I'm up-to-date with the head of master.

mandel.zip

Compiler warning on VideoNULA video.c on Windows

When compiling on Windows, gcc gives the following warnings:

gcc.exe -std=gnu99 -O3 -Wall -DBEM -DVERSION="Win32" -DINCLUDE_DEBUGGER -DUSE_MEMORY_POINTER -c video.c
video.c: In function 'videoula_write':
video.c:130:78: warning: array subscript is below array bounds [-Warray-bounds]
video.c:130:78: warning: array subscript is below array bounds [-Warray-bounds]
video.c:130:78: warning: array subscript is below array bounds [-Warray-bounds]
video.c:130:78: warning: array subscript is below array bounds [-Warray-bounds]
video.c:130:78: warning: array subscript is below array bounds [-Warray-bounds]
video.c:130:78: warning: array subscript is below array bounds [-Warray-bounds]
video.c:130:78: warning: array subscript is below array bounds [-Warray-bounds]
video.c:130:78: warning: array subscript is below array bounds [-Warray-bounds]

This is >gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.6.2/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.6.2/configure --enable-languages=c,c++,ada,fortran,objc,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgomp --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-runtime-libs --build=mingw32 --prefix=/mingw
Thread model: win32
gcc version 4.6.2 (GCC)

Pause & single step functions

I extended my own version of b-em to have pause on PAGE DOWN (to complement PAGE UP) and single frame (20ms) step on RIGHT ARROW when paused. These are both very helpful for debugging, particularly graphical effects. Would this be useful to integrate into the main repo?

I'm not sure how to do a PR across repos plus don't have the "official" build environment set up on my machine to properly test - just a hacked together Visual Studio solution.

The small changes are here: kieranhj/b-em@7adb94f

Recent work has broken Windows (MinGW) build

C:\MinGW\b-em>makebem.bat
windres.exe -i b-em.rc --input-format=rc -o b-em.res -O coff
C:\MinGW\bin\windres.exe: b-em.rc:145: syntax error
b-em.rc:4:0: fatal error: when writing output to : Invalid argument
compilation terminated.
C:\MinGW\bin\windres.exe: preprocessing failed.
make: *** [b-em.res] Error 1

HDinit.ssd not in distribution.

Readme file refers to an HDInit.ssd progrma used to initalise a Hard disc image. This disc image is not present in the distribution.

VDFS cannot rename or delete files

Me again, I'm afraid...

My Cowgol build script got around 2/3 of the way through a build and failed weirdly; investigation shows that VDFS seems not to be able to delete or rename files. They fail silently.

*BASIC
>SAVE "FOO"
>*.
FOO        WR/r
>*RENAME FOO BAR
>*.
FOO        WR/r
>*DELETE FOO
>*.
FOO        WR/r

My build script was failing because it it does this:

*RUN PROGRAM1
*DELETE INPUTFILE
*RENAME OUTPUTFILE INPUTFILE
*RUN PROGRAM2

...so on VDFS, program2 is using the same input file program1 was.

I have a suspicion that the * commands are recognised but not implemented yet --- I haven't made *DELETE, *RENAME, *DESTROY etc produce anything, not even an error, even when given completely bogus input.

I'll have a quick look, but I don't have much time at the moment. (At the very least it'd be nice to report an error.)

b-em crashes when selecting Master 128 w/ MOS 3.5

If I select the "BBC Master 128 w/ MOS 3.5" option, b-em immediately aborts:
steven@ubuntu:~/src/b-em$ ./b-em
double free or corruption (!prev)
Aborted (core dumped)

Running under gdb:

steven@ubuntu:~/src/b-em$ gdb ./b-em
GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./b-em...done.
(gdb) run
Starting program: /home/steven/src/b-em/b-em 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffeab38700 (LWP 2061)]
[New Thread 0x7fffe853a700 (LWP 2062)]
[New Thread 0x7fffe7d39700 (LWP 2063)]
[New Thread 0x7fffe7538700 (LWP 2064)]
[New Thread 0x7fffe68f0700 (LWP 2065)]
[New Thread 0x7fffd6aa5700 (LWP 2066)]
[New Thread 0x7fffd62a4700 (LWP 2067)]
[New Thread 0x7fffd5aa3700 (LWP 2068)]
[New Thread 0x7fffd509a700 (LWP 2069)]
[New Thread 0x7fffa3444700 (LWP 2070)]
[New Thread 0x7fffa2c43700 (LWP 2071)]
[New Thread 0x7fffa2442700 (LWP 2072)]
[New Thread 0x7fffa1c41700 (LWP 2073)]
[New Thread 0x7fffa1440700 (LWP 2074)]
[New Thread 0x7fffa0c3f700 (LWP 2075)]
[New Thread 0x7fff57fff700 (LWP 2076)]
[New Thread 0x7fff4b7fe700 (LWP 2077)]
[New Thread 0x7fff4affd700 (LWP 2078)]
[New Thread 0x7fff4a7fc700 (LWP 2079)]
[New Thread 0x7fff49ffb700 (LWP 2080)]
double free or corruption (!prev)

Thread 1 "b-em" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.

ROM loading order

After changing the set of ROMs to be loaded for a particular model the order in which they are loaded, and thus which slots they appear in, is not stable.

For each model emulated, B-Em loads the roms from a sub-directory of the roms directory in the distribution. It starts at slot 15 and works downwards processing the rom files in the order they are returned by the Allegro al_findfirst/al_findnext functions. On Linux, at least, these functions return the filenames not in any obvious order, like alphanumeric, but in the order the OS happens to have the filenames stored in the filesystem. On some hash-based filesystems this is in hash order and may as well be random, while on others it is the order in which the files were copied into that directory independent of the name.

Controlling which rom goes into which slot is sometimes important as it sometimes necessary, for example if two ROMs implement the same command its may be necessary to put the one that should take priority in a higher numbered slot.

Two possible solutions come to mind:

  1. Read the set of files in the directrory and then sort this list before processing it.

  2. Make two passes through the files in the directory. On the first pass process only those rom files whose filename starts with a number indicating a specific slot to be loaded. On the second pass load the remaining roms into the remaining slots.

Screen flicker

Building the allegro5-pre2 release candidate from source and running in Arch linux, the first two runs after a cold boot give a flickering line at the bottom of the window (Tested twice). Subsequent runs don't exhibit this problem.

I am not totally convinced that this is a b-em problem - it goes away, but raising it anyway just in case.

See this video (Sorry, the focus could be better - let me know if you need me to try to get a better one)
Google drive link

And thank you for your work on b-em. It is a massive improvement over the previous version. I hope you find these reports useful!

Support 65C102 "turbo" second processor

I know it's only a small thing, but I would like to see the appropriate startup banner (and possibly any other subtle behaviour changes) when using a Master Turbo. The relevant ROM is available at mdfs.net (http://mdfs.net/Software/Tube/6502/) and it works fine if I drop it in in place of the existing second processor ROM, but it would be nice if b-em supported both ROMs. We could either make this a new second processor type (which you could then use with a BBC B or whatever; I believe there were add-ons to allow this with real hardware) or make selecting it part of the Master Turbo option.

Music 5000 audio output sounds pretty rough

These comments apply to official B-Em 2.2 release, as well as the current build. The problem seems to be present on Linux and Windows.

The changes I have made so far in db-music5000 haven't made things worse, but also haven't made things better. But then I wouldn't have expected them to change much (it's mostly been refactoring)

In very general terms, the audio output sounds pretty rough. I really noticed this when I hooked up a decent amp and speakers, so that I could compare the B-Em Music 5000 emulation with an FPGA hardware implementation (that uses a decent SPI DAC). The difference was very marked!

Initially I assumed it was something amiss with the Music 5000 emulation, but then I realised that even the ^G Beep (VDU 7) was suffering.

I think there are several things going on:

  • the audio output of most PCs is pretty noisy
  • the output level of B-Em is quite low compared to other applications
  • there is possibly a bug in the sound system that is causing discontinuities when switching audio buffers (every 32ms).

Something is definitely not right here.

As a comparison, I tried the Beech emulator on Windows, and this sounded very clean in comparison.

I need to do some more investigation, but I would be interested in feedback from other people. Most people I suspect would not notice, unless the issue is pointed out to them.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.