Easyvm analysis is not completed)

Source: Internet
Author: User
E: \ test \ easyvm_small _
Command Parsing, CPU virtual
Virtual device, such as display, DMA, floppy, harddisk, keyboard, PIC, printer, RTC, timer, serial
Program Flow, Architecture

Easy release of easyvm 0.2

Introduction:
================================
Easyvm is a simple virtual machine.
Version 0.1 only supports the 8086 Instruction Set and some simple I/O devices, and only supports English text display.
Version 0.2 is mainly based on version 0.1 with a small part of 32-bit commands (push eax, etc.), so that easyvm can run MS-DOS 6.22 comes with most of the program.

File description:
================================
BiOS \ bios. Bin BIOS Program
BiOS \ biosdata. Bin CMOS Data Zone
Images for DOS. IMG MS-DOS 6.22
Easyvm.exe easyvm main program
Easyvm. ini easyvm configuration file
Readme.txt
TC. IMG floppy disk image containing trubo C 2.0
Dos622c. IMG hard disk image

Easyvm. ini configuration file
[Memory]
; MB
Size = 32

[Img]
A = dos. img
B = tc. img
C =
Cylinders = 20
Heads = 16
SPT = 63

[Boot]
Boot =

Procedure:
Winmain
Vminit
Cpuinit
Set the CPU to run from ecpu. cs = 0xf000; ecpu. IP = 0xfff0;
Initialize intable, and outtable
Malloc memory for memorystart
Read BIOS \ biosdata. bin to memorystart + 0x400, size = 0x100
Set boot drive
* (Char *) (memorystart + 0x0400 + 0x0100) = 0 for
* (Char *) (memorystart + 0x0400 + 0x0100) = 1 for B
Read BIOS \ bios. bin to memorystart + 0xf0000, size =
Dispinit
Picinit ();
Rtcinit ();
Floppyinit ();
Harddiskinit ();
Dmainit ();
Printerinit ();
Serialinit ();
Keyboardinit ();
Systemtimerinit ();
Vmrun
Cpurun: it uses a for continuous execution.
Execins
Obtain the current command OPC in the memory according to the current IP Address: evip
Obtain the address of the function corresponding to the instruction from instable [OPC ].
Execute this function
Refreshvideoram

Vmshutdown
Cputerminate

CPU virtual files are CPU/CPU. cpp, CPU/instructions. cpp
Struct CPU defines all the registers of the CPU
Setupinstructiontable is used to set instable,

Message response, such as keyboard and wm_paint, is defined in the wndproc function (IO \ Display. cpp ).

For the display module, I/O commands are used to replace the entire int 10 h (Out 0b0h, Al. In easyvmbios. ASM instructions). The specific int10h program is implemented in display. cpp,
Function io_write_00b0

Onpaint
Textbufout
Based on different character attributes, the video memory buffer is divided into multiple sub-strings and displayed separately
Draw cursor

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.