Bona Fide OS Developer
View unanswered posts | View active topics It is currently Sat May 30, 2020 7:14 am



Post new topic Reply to topic  [ 1 post ] 
 x86 CPU Emulator for directing Real Hardware 
Author Message

Joined: Sun Sep 19, 2010 9:45 am
Posts: 21
Post x86 CPU Emulator for directing Real Hardware
I have a JavaScript emulator called Z86Emu.

It emulates around 98% of 8086/8088 instructions.

It's based in a loop that resolves instruction prefixes and opcodes to the end for each individual instruction.

It has a table-based function array where each prefix/opcode byte 0-255 has a direct corresponding pointer with the function to execute.

It is all JavaScript, so the instructions need to be implemented from the ground up with typed arrays for exactness.

Implementing it in x86 assembler itself will be much easier. I only need to resolve functions from the prefix/opcode byte indexes and wrap the real instructions/registers/memory access with a given base address/I/O ports to the emulator functions.

This emulator has the capability of accessing 32-bit memory from Unreal Mode (always enabled in it), which I will need for being able to emulate things like VESA video with high PCI addresses and maybe ACPI/APM.

At the end of the project I need to be able to have a full log of the addresses read/written to and the values written, all in sequence, so that I can repeat those sequences with native code. Then I won't need to emulate those calls anymore, only repeating them from the binary execution logs. The effect will be like having native drivers from video, ACPI, APM..., but based on the functions that the emulated BIOS for each machine indicate me at boot time (cache of execution logs refreshed at every boot).

The most tedious will be writing functions to log structured, typed events (to/from RAM or ports) to disk, and displaying debug information to string.

The funniest will be seeing how the emulator works in pure Unreal Mode without any other drivers like DPMI, XMS, EMS. If possible, from a simple COM or DOS EXE file (if the Unreal Mode CPU doesn't fit), and finally having the clean logs for things like enabling every single VGA and Super VGA mode in the current video card natively.

_________________
Image ~
Image


Thu Oct 31, 2019 10:58 pm
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin and tweaked by the BF Team.