Git Product home page Git Product logo

mz700-js's Introduction

MZ-700 Full JavaScript Emulator

Build Status

Description

This is an emulator of "MZ-700", a Japanese historical 8-bit microcomputer.

This emulator is written by JavaScript. It works on the modern HTML5 web browser. I would strongly recommend Google Chrome, because of the emulation speed and its stability.

MZ-700

The MZ-700 is produced by SHARP in Nov.15,1982. It equipped a Z80A CPU 3.58MHz, and represents various characters in eight colors and a monoral beep sound, but no graphics.

There were three models:

  • MZ-711 - The base model.
  • MZ-721 - A built-in cassette deck is available
  • MZ-731 - A cassette deck and 4 color plotter printer were built in.

Many people were saying,

"MZ-700 Has No LIMIT"

PREREQUISITES and FEATURES

  • Node.js 8.10 or later is required.
  • This emulator bundles MZ-NEW MONITOR to boot.
  • You can drop a MZT-file to the screen to run.
  • Z80 assembler and disassembler is available on the Web and also CLI command.
  • And, it's a somewhat a crazy feature, the emulator running on the CLI with Node.js is also available.

INSTALLATION

$ npm install   # Build
$ npm start     # Start local web server and run the app.

Access http://localhost:3000/mz700-js/emu.html with your browser, if the emulation page does not open.

Or the emulation page is available without local installation.

LICENCE

MIT

mz700-js's People

Contributors

dependabot[bot] avatar jtams avatar takamin 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

Watchers

 avatar  avatar  avatar  avatar

Forkers

afaber999

mz700-js's Issues

Displacement d is unsigned (should be signed) in (IX+d) and (IY+d)

In instructions like LD A,(IX+d), the emulator considers the 8-bit displacement d as an unsigned integer, ranging from 0 up to and including 255.

This is incorrect. A real Z80 considers d as a signed integer, ranging from -128 up to and including +127. It is typically sign-extended to 16 bits before being added to IX or IY. This is similar to the way e is added to the program counter in relative jumps like JR e.

For example, DD 7E FF is the object code for LD A,(IX-1). The emulator incorrectly interprets it as LD A,(IX+255).

This is a serious dealbreaker for programs that rely on indexed addressing.

The issue is easy to reproduce with the following program. It should print digits 123456789 at the top left of the screen. In the emulator, digit 9 is printed on the right spot, all others are printed in the center of the screen.

0000   DD 21 59 D0            LD   IX,0D059h   
0004   DD 36 00 29            LD   (IX+0),29h   
0008   DD 36 FF 28            LD   (IX-1),28h   
000C   DD 36 FE 27            LD   (IX-2),27h   
0010   DD 36 FD 26            LD   (IX-3),26h   
0014   DD 36 FC 25            LD   (IX-4),25h   
0018   DD 36 FB 24            LD   (IX-5),24h   
001C   DD 36 FA 23            LD   (IX-6),23h   
0020   DD 36 F9 22            LD   (IX-7),22h   
0024   DD 36 F8 21            LD   (IX-8),21h   
0028   76                     HALT

The dump list layout crumble.

When the container panel width is changed to narrow, the UI-controls to specify an address for the memory dump list are folded to next line and the layout is crumbled.

Very small program makes emulator halt

While testing another issue (#161), I noticed something weird. When trying to load a very small program, the emulated CPU will stop at whatever instruction it was busy with before loading the new program. This could be an instruction in the monitor's keyboard handler, but it could also be an instruction of the currently running program that had been loaded before loading the new program. So it would appear the problem does not occur while executing the new program, but earlier, possibly while loading the new program into memory.

This seems to happen only with programs of 11 instructions or less. Programs with 12 instructions or more are fine. The number of bytes does not appear to matter; it's really about the number of instructions.

Workaround: pad your program with NOP instructions.

Steps to reproduce:

  1. Make an MZT file from the assembly program below.
  2. Drag and drop the MZT file onto the emulator.
  3. Notice that digits appear on screen - OK.
  4. Remove the NOP instructions. Make a new MZT file.
  5. Restart the emulator. Drag and drop the MZT file onto the emulator.
  6. Notice the 'cmt' name is not updated - not OK.
  7. Notice the emulator freezes on some instruction in the monitor - not OK.
0000   DD 21 4A D1            LD   IX,0D000H+330   
0004   DD 36 7E 29            LD   (IX+126),29h   
0008   DD 36 7F 28            LD   (IX+127),28h   
000C   DD 36 80 27            LD   (IX-128),27h   
0010   DD 36 81 26            LD   (IX-127),26h   
0014   DD 36 82 25            LD   (IX-126),25h   
0018   76                     HALT   
0019   00                     NOP   
001A   00                     NOP   
001B   00                     NOP   
001C   00                     NOP   
001D   00                     NOP   

The location of the buttons for debug are misplaced

Though the buttons of stop/start and step are located near of the reset button, but those should be near of the assemble list at the right pane. The list has a feature to set break-points and they are used to debug the emulator.

It's inconvenient that the buttons were disappeared after certain time is past when debugging.
And essentially, those buttons are not peripherals of real MZ-700.

Cloud file interface

I want to be able to use files on cloud owned by individual user.
The format of files are MZT, Z80 assembly source, binary and so on.

The first target cloud that currently I'm planning is Google Documents.
And Dropbox, Microsoft OneNote, GitHub, ... might be followed.

interrupt process does not work

The emulation of the intel8253 is not correct.
CH2 counter of the 8253 never be raising an interrupt.
But, the instruction EI of Z80 is calling address 0038h as interrupt routine.

MZ-700 hardware-addon: add an extended bank-switching in the range $0000-$0FFF.

Feature.

I'm designing a hardware addon fpr MZ-700 here . The purpose is to add 128/256/512KByte through a nvRAM or a NOR-FLASH as a set of 4KByte pages accessible in address range $0000-$0FFF.

To do so, I implement a page switching which is executing an IN instruction in the I/O port $FF. While $FE and $FF are used for printer port, the process of reading at $FF is not implemented for the printer (no device will output data bus). So I use that fact so my device will implement a page selection when reading $FF by using a trick where the content of A through IN AL,($FF) or B through IN A,(C) will be put in address bus A15..A8 and be captured by my device.

To select a page and copy a block of it into RAM:

    LD HL,<first_byte_offset_in_page> 
    LD DE,<address_in_ram>
    LD BC,<last_byte_offset_in_page>-<first_byte_offset_in_page>+1 
    LD A,<page_number>
    DI ; disable interrupts
    IN A,($FF) ; select the page 
    LDIR ; copy a block from the page into RAM
    XOR A ; page 0 (MONITOR)
    EI ; enable interrupts after IN execution
    IN A,($FF) ; back to MONITOR page 

The same page selection can be also achieved by using IN A,(C) with B = page number and C = $FF.

Writing a page is easy with nvRAM as support. Since it is like an SRAM, you only need to swap HL and DE.

For a NOR-Flash, it is a little more complex as you need first erase a sector through a sequence of bytes with specific addresses. And then you can program each byte in the sector with another sequence of bytes with specific addresses. I won't detail them for the moment because emulating a nvRAM extension is enough for me.

Would it be possible to add this emulation for a 128/256/512KB nvRAM? knowing that you may need a toggle to switch between the original ROM and the nvRAM (page 0 is a patched MONITOR)?

My purpose is to develop some tools and a file system to store some binaries in the nvRAM which are launchable through an IPL running at boot.

Lack of a vertical scrollbar.

The assemble list and the dump list in the right pane should offer a vertical scrollbar.
Even it can be scrolled by the mouse wheel, but might be unavailable for mobile users.

Incorrect calculation in 8-bit ADC instruction

ADC A,s and ADC A,n always return either 0 or 1 (value depends on the intended result being even or odd). Effectively, the instruction clears all bits except bit 0 when storing the result of the addition in the accumulator.

Appears to be a parenthesis bug in register.ts, line 384:

const q = (this.getA() + n + (this.getF()) & Z80_Register.C_FLAG);

Should be:

const q = this.getA() + n + (this.getF() & Z80_Register.C_FLAG);

v1.2.4 or later cannot be installed.

v1.2.4 or later cannot be installed. Below is the log.

...
Running "browserify:build" (browserify) task

Error: Cannot find module 'js-cookie' from '/Users/hogehoge/.nvm/versions/node/v12.13.0/lib/node_modules/mz700-js/lib'
Warning: Error running grunt-browserify. Use --force to continue.

Aborted due to warnings.
npm ERR! code ELIFECYCLE
npm ERR! errno 6
npm ERR! [email protected] postinstall: grunt release
npm ERR! Exit status 6
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/hogehoge/.npm/_logs/2019-11-15T12_53_09_792Z-debug.log

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.