Basic Usage
4004 <command> <options> <arguments>
<command>
asm Assemble the input file
dis Disassemble the input file
exe Execute the object file
<options>
-h, - -help: Show help.
-v, - -version: Show the version and exit.
asm
options:
-i, - -input <input file>: assembly language source file.
-o, - -output <output file>: object code output file.
-e, - -exec: execute the assembled program if successful assembly.
-t, - -type <extension>: Type of output required. (multiple output types can be specified)
bin will deliver a binary file of machine code
obj will deliver an object module which can be loaded back into the disassembler for debugging
h will deliver a c-style header file that can be used in a RetroShield Arduino to run the code on a real 4004
ALL will deliver all of the above
-c, - -config <config file>: use the specified config file
-q, - -quiet: Quiet mode on x
-m, - -monitor: Start monitor x
-h, - -help: Show help.
x Mutually exclusive parameters
- Changelog
Added configuration file and output type capabilities in 0.0.1-alpha.2
dis
options.
-o, - -object <object file>: object code or binary input file.
-l, - -labels: show the label table (only available in .OBJ files)
-c, - -config <config file>: use the specified config file
-b, - -inst: number of instructions to disassemble (between 1 and 4096).
-h, - -help: Show help.
It is the user’s responsibility to understand that if a byte count causes the disassembler to end up midway through a 2-byte instruction, that last instruction will not be disassembled correctly.
- Changelog
Added labels capability in 0.0.1-alpha.2
exe
options.
-o, - -object <object file>: object code or binary input file.
-c, - -config <config file>: use the specified config file
-q, - -quiet: Quiet mode on
-h, - -help: Show help.
- Changelog
Added configuration file capability in 0.0.1-alpha.2
Error Messages
Error messages are displayed when there are issues with either the supplied command, or issues with the source code itself. The errors are raised as exceptions, with an exception type together with an information message
Command
Exception
Options
Message
asm
BadParameter
Invalid Parameter Combination:
–quiet and –monitor cannot be used
together
asm
BadOptionUsage
--type
Invalid output type specified
asm
BadOptionUsage
--type
Cannot specify ‘ALL’ with any others
dis
BadOptionUsage
--inst
Instructions should be between 1
and 4096
ALL
ConfigFileNotFound
--config
Configuration file not found.
Exception
Message
CoreNotInstalled
Pyntel4004 core is not installed - use pip install Pyntel4004
Configuration Files
- Changelog
Added configuration file capability in 0.0.1-alpha.2
Pyntel4004-cli configuration files are specified using the TOML notation. This is a notation which favours humans over machines, so it is easy to understand and write the configuration you want.
Example Configuration File - example2.toml
# Configuration for Pyntel4004-cli.
title = "Configuration file for example2.asm"
[asm]
input = "example2.asm"
output = "example2"
type = ["BIN", "H"]
exec = true
monitor = true
quiet = true
[dis]
object = "examples/example2.obj"
inst = 6
labels = true
[exe]
object = "examples/example2.obj"
quiet = true
The configuration file has 4 sections:
This MUST be first
The title - simply a description of what the configuration file is for. Note that any comments (lines starting with a #
can be added anywhere for readability).
(in no particular order)
[asm]
section containing directives for the assembly of a specific program source file
[dis]
section containing directives for the disassembly of a specific object module
[exe]
section containing directives for the execution of a specific object module
The valid configuration tokens are shown in the example above - they mirror the options that can be specified on the command line.
ANY of the configuration tokens can be overriden simply by specifying them on the command line.
Basic Usage
4004 <command> <options> <arguments>
<command>
asm Assemble the input file
dis Disassemble the input file
exe Execute the object file
<options>
-h, - -help: Show help.
-v, - -version: Show the version and exit.
asm
options:
-i, - -input <input file>: assembly language source file.
-o, - -output <output file>: object code output file.
-e, - -exec: execute the assembled program if successful assembly.
-t, - -type <extension>: Type of output required. (multiple output types can be specified)
bin will deliver a binary file of machine code
obj will deliver an object module which can be loaded back into the disassembler for debugging
h will deliver a c-style header file that can be used in a RetroShield Arduino to run the code on a real 4004
ALL will deliver all of the above
-c, - -config <config file>: use the specified config file
-q, - -quiet: Quiet mode on x
-m, - -monitor: Start monitor x
-h, - -help: Show help.
x Mutually exclusive parameters
- Changelog
Added configuration file and output type capabilities in 0.0.1-alpha.2
dis
options.
-o, - -object <object file>: object code or binary input file.
-l, - -labels: show the label table (only available in .OBJ files)
-c, - -config <config file>: use the specified config file
-b, - -inst: number of instructions to disassemble (between 1 and 4096).
-h, - -help: Show help.
It is the user’s responsibility to understand that if a byte count causes the disassembler to end up midway through a 2-byte instruction, that last instruction will not be disassembled correctly.
- Changelog
Added labels capability in 0.0.1-alpha.2
exe
options.
-o, - -object <object file>: object code or binary input file.
-c, - -config <config file>: use the specified config file
-q, - -quiet: Quiet mode on
-h, - -help: Show help.
- Changelog
Added configuration file capability in 0.0.1-alpha.2
Error Messages
Error messages are displayed when there are issues with either the supplied command, or issues with the source code itself. The errors are raised as exceptions, with an exception type together with an information message
Command |
Exception |
Options |
Message |
---|---|---|---|
asm |
BadParameter |
Invalid Parameter Combination: |
|
asm |
BadOptionUsage |
--type |
Invalid output type specified |
asm |
BadOptionUsage |
--type |
Cannot specify ‘ALL’ with any others |
dis |
BadOptionUsage |
--inst |
Instructions should be between 1 |
ALL |
ConfigFileNotFound |
--config |
Configuration file not found. |
Exception |
Message |
---|---|
CoreNotInstalled |
Pyntel4004 core is not installed - use pip install Pyntel4004 |
Configuration Files
- Changelog
Added configuration file capability in 0.0.1-alpha.2
Pyntel4004-cli configuration files are specified using the TOML notation. This is a notation which favours humans over machines, so it is easy to understand and write the configuration you want.
Example Configuration File - example2.toml
# Configuration for Pyntel4004-cli.
title = "Configuration file for example2.asm"
[asm]
input = "example2.asm"
output = "example2"
type = ["BIN", "H"]
exec = true
monitor = true
quiet = true
[dis]
object = "examples/example2.obj"
inst = 6
labels = true
[exe]
object = "examples/example2.obj"
quiet = true
The configuration file has 4 sections:
This MUST be first
The title - simply a description of what the configuration file is for. Note that any comments (lines starting with a
#
can be added anywhere for readability).
(in no particular order)
[asm]
section containing directives for the assembly of a specific program source file[dis]
section containing directives for the disassembly of a specific object module[exe]
section containing directives for the execution of a specific object module
The valid configuration tokens are shown in the example above - they mirror the options that can be specified on the command line.
ANY of the configuration tokens can be overriden simply by specifying them on the command line.