What is sharptool ?
At the beginning, sharptool was 'only' an offline disassembler
for Sharp pocket computers.
Soon, I've added CPU instruction emulation and finally Sharptool was able to emulate a full PC-1350 .
Sharptool is coming with companions : assembler, binary files manipulators, ...
Sharptool's status
Sharptool is (and surely will stay) in BETA stage. Especially :
- I did had and still have very few time for it so I mainly focused on emulation and riding out any fancy things.
- Lot of work remains in order to make it really portable. For the moment, it focus on my own hardware : Unix (Linux/Solaris/HP-UX), using a QWERTY keyboard.
- poor documentation : these little pages plus embedded help.
- the big miss is currently CPU timing. CPU's cycles are not took in account. As a consequence, emulated is terribly fast making some game unplayable.
In the other hand :
- CPU emulation is very accurate : the only missing instructions are tape related ones (CUP and CDN)
- Thanks to C++ objects programming, any ESH powered pocket can be easily implemented ... After PC-1350, PC-2500 was an obvious target (as very close to PC-1350) but I'll probably also work on PC-1401/02 one day.
- As mainly developed on slow machines, this code is quite well optimised.
- As the real hardware, emulated pocket can act as international version or as an Japanese one.
Obviously, any help welcome to improve it.
Compilation
sharptool needs :
- any POSIX machine
(an Amiga version is planned ... but when ? )
- any recent C++ compiler : the compilation was only tested with GCC but no GNUish has been used,
- X window
- Motif or clone of it (sharptool is known to run with Lesstif).
It was programed and tested on
- SUN Ultra 5 under Solaris 8 & Ultra 60 under Solaris 10
- HP 715 and 712 under HP-UX 10.20 workstation (also tested under HP-UX 11.0).
- Ubuntu 9.10 and 10.4 PCs (2010 update ).
To compile it, just do a make
in the distribution root directory. g++
must be somewhere in your PATH.
NOTEZ BIEN : if the compilation fails at linkage stage:
- Sharptool
needs
nanosleep()
function so you may have to have to add -lrt
in the
Makefile
inside sharptool directory. It's needed for Solaris and
create an error under HP-UX, ... it's up to you to check if your OS
need it.
- On some systems (Linux, ...), X libraries aren't in the search path. I the compilation fails, have a look on
./sharptool/Makefile
and customize the -L
directive ...
asm
Originaly wrote for the Amiga (and still containing Amigaishes ), asm is an ESR_H assembler so suitable to generate binary for Sharp's pockets.
All messages are wrote in French, sorry, but are quite understandable.
Command line arguments
AsmEsr_H [-b] source target
source
: Assembler source code to compile
target
: generated files, binary or basic code
-b
: optional flag to generate basic code ... without it, a binary file is generated.
Labels
asm supports 2 kinds of label :
{label}
- define a local label that will be kept as private to this file
[label]
- define a global label that will be saved in target.lab file
Note : saved labels can be read in sharptool.
It is possible to add an offset to a label : example
jp [mylabel]+3
will jump to 3 bytes after [mylabel]. Obviously, this offset can be negatif
jp [mylabel]-3
Preprocessor
Preprocessor commands are instructions only meaningful to the assembler and, so, not generating any binary. Only 2 preprocessor commands are known :
#deflab [label] address
- define a label ; local labels are also supported
#loadlab file
- load a label file. Tip : Sharptool's label files are compatible.
CPU instructions
In addition to official instructions, asm recognizes
org address
- it must be the first instruction of a source file and define the initial memory address to generate.
liab 16b_value
- generate LIA/LIB pair to store the 16 bits argument in A & B registers.
case/else
pair that replace original CASE1/CASE2 ... so no need to compute ourself the number of values
dc data
- store comma separated data in memory. Example
dc 'c', "blabla", [label], &ABCD, &EF
will store
- a c character
- a blabla string
- the adress of a label
- &ABCD 16 bits binary, lower byte first (so that can be used by a MVBD to load 16 bits pointers)
- &EF 8 bits binary
Bin2Bas
convert a binary dump to a BASIC lines.
Command line arguments
Bin2Bas [-n] [-sAAAA] [-lnum] < infile > outfile
-n
: Doesn't check checksum
-sAAAA
: normaly, data are poked in the adress set in the infile ; with this option, the start adresse should be modified
Gaps between address in the source file are respected.
-lnum
: specify the first line of the basic program (10 default)
Dump2Bin
Convert raw binary file to a binary ...
Command line arguments
Dump2Bin AAAA < infile > outfile
CheckBin
Check if a binary file is correct ...
- Addresses must follows each other
- checksum must be ok
Command line arguments
CheckBin [-n] [-a] < infile
-n
: Doesn't check checksums
-a
: doesn't check addresses
Relog
Change addresses in a binary file
Command line arguments
Relog AAAA < infile > outfile