Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mrspeaker/zads

zads
https://github.com/mrspeaker/zads

Last synced: 14 days ago
JSON representation

zads

Awesome Lists containing this project

README

        

* zardox

z/assmebler assembler and emulator for learning and playing with basic HLASM.

To get started, select a program from the dropdown list and hit `assemble`. This will assemble and load the program into the emulator. In the bottom right hit "run" to see it go (or hit "step" to single-step through each instruction).

** Note on errors!
Currently there is NO ERROR REPORTING or help if you get something wrong. Sorry.
The best thing to do is to look in the browser console and see if there is a javascript error. (I'll fix this, promise!).

** Supported instructions
You can see all the supported functions by checking the `ops.js` file. Though, support is pretty stetchy, even for the implemented instructions!

** Special symbols

`screen`: location in memory of the 128x128 pixel screen output. This is a 16x16 list of sprite indexes. For example, write a "1" to screen+16 will print tile #1 from the sprite-drawing screen in the first column, second row of the screen.

`vic`: pointer to the sprite paramter locations. See the offsets in `vic.js`. There are also direct symbols to improve readability. There are 4 sprites available. To use other sprites change the `0` to `1`-`3` in the following:
`spr0_idx`: the sprite tile to draw from the drawing screen (0-63)
`spr0_x`: x location of the sprite (0-128)
`spr0_y`: y location of the sprite (0-128)
`key_left`: `1` if left-arrow key is down (else `0`)
`key_right`: right arrow
`key_up`: up arrow
`key_down`: down arrow
`key_fire`: `1` if the `z` key is pressed (else `0`)
`key_fire_2`: `1` if the `x` key is pressed (else `0`)

* Other notes....

** instruction format notes

An instruction is one, two, or three halfwords in length and must be located in storage on a halfword boundary. Each instruction is in one of 26 basic formats: E, I, RI, RIE, RIL, RIS, RR, RRE, RRF, RRR, RRS, RS, RSI, RSL, RSY, RX, RXE, RXF, RXY, S, SI, SIL, SIY, SS, SSE, and SSF, with two variations of RI, RIL, RS, RSY, and RXY, three of RRF, and five of RIE and SS.

The two most significant bits of the first halfword determines the length of instruction.

*** RI Format
Denotes a register-and-immediate operation and an extended op-code field.

#+begin_src sh
| 0 | 8 | 12 | 16 | 31 |
|----------+----+-------+----+----|
| Opcode | R1 | OpCd | I2 | |
| Opcode | M1| OpCd | I2 | |
#+end_src

*** RR Format
Denotes a register-and-register operation.

| 0 | 8 | 12 | 15 |
|--------+----+----+----|
| OpCode | R1 | R2 | |

*** RX Format
Denotes a register-and-indexed-storage operation.

0 8 12 16 20 31
OpCode R1 X2 B2 D2

*** SI Format
0 8 16 20 31
OpCode I2 B1 D1

*** SS Format
... several...

** Machine instructions

#+BEGIN_SRC

Figure 1. Machine instructions

┌───────────────┐ ┌───────────────┐ ┌───────────────┐
│ │ │ │ │ │
│ NAME │ │ OPERATION │ │ OPERAND │
│ Field │ │ Field │ │ Field │
│ │ │ │ │ │
└───────┬───────┘ └───────┬───────┘ └───────┬───────┘
│ │ │
V Which V Which V Which
│ can be │ must be │ can be
┌───────┴───────┐ ┌───────┴───────┐ ┌───────┴───────┐
│ │ │ │ │ │
│ A Symbol¹ │ │ A symbolic │ │ Zero or more │
│ (or space) │ │ Operation │ │ arguments │
│ │ │ Code │ │ │
└───────────────┘ └───────────────┘ └───────┬───────┘

V Composed of one of
┌────────────────────────┬───────────┴────────────┐
V V V
┌───────┴───────┐ ┌───────┴───────┐ ┌───────┴───────┐
│ │ │ │ │ │
│ │ │ │ │ Exp(Exp,Exp) │
│ Expression │ │ Exp(Exp) │ │ or │
│ │ │ │ │ Exp(,Exp) │
│ │ │ │ │ │
└───────┬───────┘ └───────────────┘ └───────────────┘

V Which can be one of
┌────────────┴───────────┐
V V
┌───────┴───────┐ ┌───────┴───────┐
│ │ │ │
│ │ │ Arithmetic │
│ Term │ │ combination │
│ │ │ of terms │
│ │ │ │
└───────┬───────┘ └───────────────┘

V Which can be any of
├────────────────────────┬────────────────────────┬────────────────────────┬────────────────────────┐
V V V V V
┌───────┴───────┐ ┌───────┴───────┐ ┌───────┴───────┐ ┌───────┴───────┐ ┌───────┴───────┐
│ │ │ │ │ │ │ │ │ │
│ A Symbol │ │ Location │ │ Symbol │ │ A │ │ A Literal │
│ │ │ Counter │ │ Attribute │ │ Self-Defining │ │ │
│ │ │ Reference │ │ Reference │ │ Term │ │ │
│ (e.g. HERE) │ │ (i.e. *) │ │ (e.g. L'HERE) │ │ │ │ (e.g. =H'9') │
└───────────────┘ └───────────────┘ └───────────────┘ └───────┬───────┘ └───────────────┘

V Which can be any of
┌────────────────────────┬────────────────────────┬────────────────────────┼────────────────────────┐
V V V V V
┌───────┴───────┐ ┌───────┴───────┐ ┌───────┴───────┐ ┌───────┴───────┐ ┌───────┴───────┐
│ │ │ │ │ │ │ │ │ │
│ Decimal │ │ Hexadecimal │ │ Binary │ │ Character │ │ Graphic² │
│ │ │ │ │ │ │ │ │ │
│ (e.g. 9) │ │ (e.g. X'F9') │ │ (e.g. B'111') │ │ (e.g. C'JAN') │ │ (e.g. G'<.A>')│
│ │ │ │ │ │ │ │ │ │
└───────────────┘ └───────────────┘ └───────────────┘ └───────────────┘ └───────────────┘

¹ Can be an ordinary symbol, a variable symbol, or a sequence symbol
² With DBCS option only

#+END_SRC

#+BEGIN_SRC

Figure 1. Ordinary assembler instruction statements

┌───────────────┐ ┌───────────────┐ ┌───────────────┐
│ NAME │ │ OPERATION │ │ OPERAND │
│ Field │ │ Field │ │ Field │
└───────┬───────┘ └───────┬───────┘ └───────┬───────┘
│ │ │
V Which V Which V Which
│ can be │ must be │ can be
┌───────┴───────┐ ┌───────┴───────┐ ┌───────┴───────┐
│ A Symbol¹ │ │ A symbolic │ │ Zero or more │
│ (or space) │ │ Operation │ │ operands │
│ │ │ Code² │ │ │
└───────────────┘ └───────────────┘ └───────┬───────┘


┌───────────────────────────────────────────────┴────────────────────────────┐
V V
┌──────────┴──────────┐ ┌──────────┴──────────┐
│ For Data Definition │ │ For all other │
│ (DC and DS │ │ ordinary Assembler │
│ Instructions) │ │ Instructions │
└──────────┬──────────┘ └──────────┬──────────┘
│ │
V Operands can be V Operands
│ composed of one │ can be composed
│ to five subfields³ │ of³
┌────────────────┼──────────────┬───────────────┬────────────────┐ ┌───────────────┼────────────────┐
│ │ │ │ │ │ │ │
┌─────┴──────┐ ┌──────┴─────┐ ┌─────┴──────┐ ┌─────┴──────┐ ┌─────┴──────┐ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │
│Duplication │ │ Type │ │ Type │ │ Modifiers │ │ Nominal │ │ │ │
│ factor │ │ │ │ Extension │ │ │ │ Value │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │
└──────┬─────┘ └──────┬─────┘ └─────┬──────┘ └─────┬──────┘ └─────┬──────┘ │ │ │
│ │ │ │ │ V V V
│ │ │ │ │ │ │ │
V V V V V ┌─────┴──────┐ ┌─────┴──────┐ ┌─────┴──────┐
│ ┌─────────────┘ │ │ │ │ Expression │ │ Character │ │ Symbolic │
│ │ ┌─────────────────────────┘ │ │ │ (e.g.*+14) │ │ String │ │ Option │
│ │ │ ┌─────────────────────────────────────┘ │ │ │ │ (e.g. 'XX')│ │ (e.g. GEN) │
│ │ │ │ ┌──────┐ │ └────────────┘ └────────────┘ └────────────┘
│ │ │ │ │ │ │
V V V V V │ V
e.g. 10 E B L2 '12' │ │ One or more nominal values
└──┴──┴──┴───┴─────┘ │ ┌────────────────────────┬────────────┴─────────────┬──────────────────────────┐
∧ │ │ │ │
│ V V V V
┌───┴───┴───────┐ ┌───────┴───────┐ ┌──────┴──────┐ ┌───────┴───────┐
│ 'Decimal │ │ (Expression) │ │ 'Character │ │ 'Graphic │
│ number' │ │ │ │ string' │ │ string'⁴ │
│ (e.g. '12') │ │ (e.g. (ADDR)) │ │ (e.g. 'ABC')│ │ (e.g. '<.A>') │
└───────────────┘ └───────────────┘ └─────────────┘ └───────────────┘

¹ Can be an ordinary symbol, a variable symbol, or a sequence symbol
² Includes symbolic operation codes of macro definitions
³ Discussed more fully where individual instructions are described
⁴ With DBCS option only

#+END_SRC