Paulo Custodio > Asm-Z80-Table > <%

Download:
Asm-Z80-Table-0.02.tar.gz

Annotate this POD

View/Report Bugs
Source  

NAME ^

<% $package %> - Z80 assembly / disassembly tables

SYNOPSIS ^

  use <% $package %>;
  Asm::Z80::Table->asm_table->{'adc'}{'a'}{','}{'('}{'hl'}{')'}{''} is [0x8E]
  Asm::Z80::Table->disasm_table->{0x8E}{''} is ['adc', 'a', ',', '(', 'hl', ')']
  my $iter = Asm::Z80::Table->iterator;
  my($tokens, $bytes) = $iter->();

DESCRIPTION ^

This module provides hash tables to assemble / disassemble all Z80 CPU assembly instructions, including undocumented ones (e.g. 'ld ixh,N') and instructions composed by sequences (e.g. 'ld bc,hl').

This module is used in a Z80 assembler / disassembler.

It was spun off the CPU::Z80::Assembler module.

EXPORTS ^

Nothing.

FUNCTIONS ^

asm_table

This function returns the assembly hash table.

Starting at the root and following one sub-hash table for each token, with an empty token at the end of the list, produces an array of opcode bytes of the corresponding Z80 assembly.

disasm_table

Starting at the root key and following one sub-hash table for each opcode byte, with an empty byte at the end of the list, produces an array of tokens of the corresponding disassembled Z80 instruction.

iterator

Returns an iterator function that returns the next pair of token list and bytes list, while traversing all the asm_table. The iterator funtion returns an empty list () at the end.

SPECIAL TOKENS ^

The following special tokens are used in both the tokens and bytes lists:

N

One byte;

NN

One word;

NNl

The low byte of the word;

NNh

The high byte of the word;

NNo

The offset byte of a JR/DJNZ instruction that is converted to NN by adding address + 1;

DIS

The offset of a (ix+DIS) expression;

DIS+1

The offset of a (ix+DIS) expression for 16-bit load, e.g. ld (ix+DIS),bc;

NDIS

The offset of a (ix-NDIS) expression.

NDIS+1

The offset of a (ix-NDIS) expression for 16-bit load, e.g. ld (ix-NDIS),bc;

EXTENSIONS TO STANDARD Z80 ASSEMBLY ^

The following extensions were implemented in this assembly/disassembly table:

Full Z80 Assembly Table

The official Z80 assembly instructions have a maximum of 4 bytes; the composed instructions have a maximum of 10 bytes.

<% assembly_table() %>

ACKNOWLEDGEMENTS ^

Based on sjasmplus http://sjasmplus.sourceforge.net/ undocumented opcodes. See also http://www.z80.info/zip/z80-documented.pdf for a description of the undocumented Z80 instructions.

AUTHOR ^

Paulo Custodio, <pscust at cpan.org>

BUGS and FEEDBACK ^

Please report any bugs or feature requests through the web interface at http://rt.cpan.org/NoAuth/Bugs.html?Dist=Asm-Z80-Table.

LICENSE and COPYRIGHT ^

Copyright (c) 2010 Paulo Custodio.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

syntax highlighting: