Git Product home page Git Product logo

dd86's Introduction

_______ _______     ___ ______   ______
|  __  \|  __  \   /  //  __  \ / ____/
| |  \ || |  \ |  /  / \ \__/ //  __ \
| |__/ || |__/ | /  /  / /__\ \| \__\ \
|______/|______//__/   \______/\______/
DD/86
IBM PC Virtual Machine and DOS Emulation Layer

This project aims to be a complete IBM PC emulation layer for DOS
applications, like NTVDM and dosemu, for multiple operating systems.

"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Edison

Project homes:
	https://github.com/dd86k/dd86

┌───────────────┐
│ DOCUMENTATION │
└───────────────┘

User: docs/dd86.1
Technical: https://dd86k.space/docs/dd86-manual.pdf

dd86's People

Contributors

dd86k avatar gsass1 avatar kenanmillet 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

dd86's Issues

"Oops" panic page

Consider adding a kernel-like panic page on an unrecoverable error, either as a DD-DOS feature (I highly doubt MS-DOS had that) or interpreter feature (have to check action on illegal instruction).

Improve threading sleeping timing

I'm fairly certain my sleep timing procedure kind of suck. Either I calculate, somewhat like bogomips, what I need and sleeping at those exactly intervals or I do it dynamically timed-based like everything out there.

Implement -D, use default settings

The -D option would indicate dd-dos to not load any setting whatsoever and use defaults (must be defined in reference manual later). Think of a "safe mode".

Centralize configurations/compile settings

For compile settings, it would be nicer to have a single file for all of that.

Thinking of compile_config.d -- which would include cpu timing/sleeping strategies, memory configurations, etc.

Incremental Verbosity Level

Implement a verbosity level. Default should be 0 and maximum for debug build.

Possible model:

  1. Silence
  2. Critical -- non-recoverable crashes
  3. Error
  4. Warning
  5. Informal
  6. Debug

FLAG handler

A function where we pass the result of an operation would ease development.

Ideally, have byte/word/dword versions.

Significant instruction names / instruction structuration

v16_AE is not a good name, something like v16_scasw or i_scasw would be much better (es. in debugging).

  • v16_mov_rm16_im16 if we continue with the array functions for different operating modes
  • i_mov_rm16_im16 if we are going to incorporate more global-ish functions where memory fetching functions have CPU context (even better?)

Move away from getopt

The getopt module is fantastic.

However, it uses some D Runtime features, like the Structured Exception Handler (try/catch) for GetOptException.

Best case scenario would be making an optimized CLI by hand, not as a module.

Consider halt codes

Reason

Though rare, while MS-DOS had its own error codes, DD-DOS (not vDOS) COULD have its own "halt codes", whenever it panics. These codes can also be used and returned within the CLI, even for files not found.

Format

SHOULD be a 2-byte number.

Either plain or reserve a few bits (4?) for categorize things around.

Source Code

To void confusion with the vDOS codes, DD-DOS halt codes COULD take the DD_E_ prefix. Messages appends the _M suffix.

Example (CLI): DD_E_FILE_NOT_FOUND = 5 and DD_E_FILE_NOT_FOUND_M = "File was not found."

panic

panic SHOULD stay with the string+number signature.

It's easier to add an error code then add the panic line at one place than add the panic line + extra code in panic code.

Move away from properties

While great and simple, it's still a function, therefore still having the penalty of calling a function, whatever the calling convention is.

One idea would be moving registers to a struct for two reasons:

  1. vCPU.* clearly states that we use the virtual CPU.
  2. Members can be pointers and be used as regular members (vCPU.AX = 2 is possible)
  3. Manually casting (on-demand) is only a syntax-wise issue.
  4. State of vCPU can be saved as a whole (if we need that later on (likely in DOS)).
  5. Struct may be more properly aligned compared to global memory, which MAY improve cache performance.

Rename exec as exec16

Change function name from exec to exec16 since it solely executions instructions in real-mode

Consider string-switch usage

Once major compilers (DMD, GDC, LDC) support string comparison in switch statements in betterC code (2.082.0), consider switching to the feature.

Checklist

A lot of things should be considered and checked:

  • Can char* be used in those switches, if not, can it be cast?
  • If the feature depends on a library (e.g. C stdlib)
  • How is the feature assembled (check with DMD, GDC, and LDC)
  • In terms of performance and size, is the string-switch feature better than using strcmp?

Why I consider it

  • Better-looking code
  • Being part of D, perhaps compilers could use this feature to better optimize string comparison
    • Unless it's the same story in non-betterC code
    • Otherwise, could be possible the feature uses the same optimization techniques used in popular standard C libraries (GNU's, Microsoft's, etc.)

Example

Current implementation:

if (strcmp(*argv, "time") == 0) {
	vCPU.AH = 0x2C;
	Raise(0x21);
	printf("It is currently %02d:%02d:%02d.%02d\n",
		vCPU.CH, vCPU.CL, vCPU.DH, vCPU.DL);
	goto SHELL_SHART;
}

New implementation:

switch (*argv) {
case "time":
	vCPU.AH = 0x2C;
	Raise(0x21);
	printf("It is currently %02d:%02d:%02d.%02d\n",
		vCPU.CH, vCPU.CL, vCPU.DH, vCPU.DL);
	goto SHELL_SHART;
}

Consider Pre-increment EIP before executing instruction

Pre-incrementing, in this case, incrementing the EIP register before doing stuff, could save us some extra later calculations, instead of incrementing it afterwards.

However, this would require us to re-pass the entire interpreter code.

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.