4:3 aspect ratio in Dosbox with Little Bird 5" display?

I have a Raspberry Pi 3 with this Little Bird 5" display
https://www.littlebirdelectronics.com.au/5-inch-lcd-hdmi-touch-screen-display-for-raspberry

Dosbox games are stretched to the full width of the display, rather than staying at a fixed aspect ratio with black bars on the side.

To show you what I mean, I’m seeing the “incorrect” one below;

In fact, I’m able to plug my Pi 3 into my own 16:9 desktop monitor, and it displays correctly (with the black bars). Then I plug the Pi 3 into the Little Bird display, reboot, and it displays incorrectly (stretched without the black bars) and I didn’t change any settings in Dosbox!

Running Dosbox on Windows on my desktop PC, getting the correct aspect ratio (as in the 2nd image with the black bars) is as simple as editing dosbox.conf and setting the following

fullscreen=0x0
output=overlay
aspect=true

But these same settings don’t work with my experiments on the Pi.

I’ve scoured the internet, talked with people on other forums, and experimented with many things. I’m very close to giving up.

I am open to running Dosbox in ANY environment which will get this to work.

I first tried Batocera and Recalbox - it was under those environments that I was able to swap between my desktop monitor and the Little Bird display and see the different images above. It’s my understanding that they use a specialised version of Dosbox with a different method of drawing to the screen (eg. available settings for “output” are “texture”, not “overlay”).

I’ve also tried RetroPie, but once I got Dosbox installed, I was unable to get it to display at the correct aspect (2nd picture, with the black bars) even on my monitor, so I don’t know what’s up with that.

It’s worth noting that other emulators can render the game window at the correct aspect ratio. What can I do to get Dosbox to display at 4:3 with black bars on the side?

Note: I had to strip out links to the above operating systems (Batocera, RecalBox, and RetroPie) since I was prevented from making my first post before doing so. Sorry about that.

Actually my problem is I didn’t have the display configured correctly in the config.txt file. It’s important to include the settings given on the product page - even though things appear to work correctly for the most part without them! Once I included these settings, Dosbox correctly scaled the aspect ratio, the way the other emulators were already doing before the settings were applied;

  hdmi_force_hotplug=1
  hdmi_group=2
  hdmi_mode=1
  hdmi_mode=87
  hdmi_cvt=800 480 60 6 0 0 0
  max_usb_current=1

There may be other settings to check depending on the emulator and operating system. Eg. in Dosbox you need to find the conf file and set aspect=true, and if you’re using Recalbox as a front end, you need to global.videomode=default in the recalbox.conf to have the same screen ratio applied to all emulators (other than dosbox) but that’s all documented here: https://github.com/recalbox/recalbox-os/wiki/TFT5-Screen-HDMI-(EN)