WonderSwan Total Sound Driver
Top＼ MML Compiler＼ MML Reference

## MML Reference - Calculate the work memory of WTD

Calculate the work memory of WTD.
This command can use to set/reset flag of the game, etc..

### Format

0,address,var
1,address,var
2,address,var
3,address,var
4,address,var
5,address,var
6,address,var
7,address,var
8,address,var
9,address,var

### Input

Input | Range | Default |
--- | --- | --- | ---
address | 0 to 255 | - | Work address lower 8bit.
var | 0 to 255 | - | Operand for calculate.

### Explanation

This command can calculate the work momory.
As to the work address upper 8bit, " command can set it. (Default it 0x00)

Offset address = ((" command parameter) x 256 + (address))
Segment address = work area of WTD.

Command | C language | Assembly language (i8086 instruction)
--- | --- | ---
0 | *address = var | MOV [address],var
1 | *address += var | ADD [address],var
2 | *address -= var | SUB [address],var
3 | *address &= var | AND [address],var
4 | *address |= var | OR [address],var
5 | *address ^= var | XOR [address],var
6 | *address |= (0x01 << var) | SET var,[address] (Z-80 instruction)
7 | *address &= ~(0x01 << var) | RES var,[address] (Z-80 instruction)
8 | *address - var | CMP [address],var
9 | *address & var | TEST [address],var

WTD have the Carry flag and the Zero flag.
Result of the calculation, WTD will set/reset those flags.