On 2013-08-02, Dennis Lee Bieber <wlfr...@ix.netcom.com> wrote: > On Thu, 1 Aug 2013 19:29:06 +0000 (UTC), Grant Edwards ><invalid@invalid.invalid> declaimed the following: > >> >>I got tired of hand assembling (and disassembling) code for a custom >>microprocessor, so I wrote an assembler and a disassembler. > > Let me know when you recreate XDS meta-symbol. It didn't even have the > Sigma native instruction set built in, one had to specify the instruction > set using a "system" directive. What it did have was a directive to define > instruction formats (my manuals are in storage so this is pseudo-code). > > MOV opt,2,3,3 b'01',af(1),af(2) > > Which translates as: mnemonic is MOV, format is 2-bits, 3-bits, 3-bits, > first field is binary 01, second field is argument field 1, third field is > argument field 2.
That's pretty much how my assembler works. There is one variable bit-width operand field in the opcode byte, and some instructions have a single byte immediate operand following the opcode byte. Operands can eitehr be absolute values or PC-relative offsets (in the case of branch instructions). -- Grant Edwards grant.b.edwards Yow! I hope the at ``Eurythmics'' practice gmail.com birth control ... -- http://mail.python.org/mailman/listinfo/python-list