TJ's Enshoku PCE development environment ;)

http://www.hyakushiki.net/consoles.htm

damage_x@hyakushiki.net

Note: Likely the only part of this mess that was written with a user in mind
other than myself is this text file. This means: things may not be well
documented, code may not be well written, etc.

Files contained in this archive

GHETTIT.EXE             my graphics editor (see below for more info)
GHETTIT.BAS             MS Quick Basic source code
SPRCOMP.EXE             a program for compressing sprites using a lame but
                        effective method
SPRCOMP.INI             a list of sprites to compress, each input file name
                        is followed by the output file name
SCBATCH.EXE             program that does the work specified in SPRCOMP.INI
*.G                     usually sprites, stored as one or four 16x16 blocks
                        with 16 bits per pixel (only 4 bits used)
*.CE                    compressed sprites
MAP.G                   the map file for working with GHETTIT's character-
                        based background, 128x64x16bit (only 64x64 is used)
BLOCKS.G                an array of 8x8x16bit graphics blocks for GHETTIT's
                        character-based background
PAL.G                   GHETTIT's 64-color palette, each 16-bit word contains
                        a 9-bit RGB value arranged the same as in TG hardware
PAL.L                   same as PAL.G except it only contains 16 colors
*.PAL                   palettes (like PAL.G or PAL.L) that are used in the
                        game
G.PCX                   a 512x512x8bit graphic dump of GHETTIT's character-
                        based background
SPR.G?                  sprites that can be saved/loaded with GHETTIT
SPR.T?                  sprites that were saved in Turbo Grafx native format
                        16x16 4bpp planar blocks, instead of sloppy 16bpp
*.SET                   a set of 8x8 blocks saved in Turbo Grafx native
                        format
*.MAP                   a map saved in a format to be used in the game

P/AS.*                  MAGIC ASM v1.1 and its associated documentation
P/ENSHOKU.*             the game source code and assembled ROM
P/JUNK.DT               the music track composed in my tracker
P/DT.*                  my tracker and associated files

TITLE/*.*               directory containing graphics for the opening
                        animation
SPRITES/*.*             directory containing some sprite graphics
NUM/*.*                 directory containing the gfx for some numerals
SPRITES2/*.*            more sprite gfx


About GHETTIT

The name is some combination of GHETTO, GRAPHICS, and EDIT.

If you are running an OS other than DOS, Win3.x, or Win9x you may or may not
be able to run GHETTIT.

Run the program from the directory you intend to work in (where your data
files are). A menu will be presented:

1. map+blocks+pal
2. BMP file
3. default junk
4. load BMP file and use blocks.g
5. load PCX file and use blocks.g
6. PCX file

Option 1:
GHETTIT will prompt you for the name of the map file you want to load from,
as well as the blocks file and palette file

Option 2:
GHETTIT will load from a .BMP file. It should use only the first 64 colors in
the palette and should be arranged in 8x8 blocks which can each only contain
colors from one of the four 16-color palettes. (This option is not very useful
and I haven't used it more than a couple times)

Option 3:
My favorite option. GHETTIT loads data from the files: MAP.G, BLOCKS.G, and
PAL.G

If the files don't exist then you'll start with a blank slate.

Option 4:
mostly the same as #2.

When a .PCX or .BMP is loaded, GHETTIT process each 8x8 graphics block and
strips out duplicates. If options 2 or 6 are selected GHETTIT will start from
scratch with making a database of blocks. If options 4 or 5 are selected
GHETTIT will load the existing BLOCKS.G file and will only add more blocks
to its database from the .PCX or .BMP if they are not already in BLOCKS.G

Option 5:
see explanation above

Option 6:

like option #2 except this one is actually quite useful. First of all, you can
load .PCX screenshots generated by GENECYST. Second, you can load the G.PCX
file.

The GHETTIT Interface:

The 64-color palette is displayed at the bottom. Helpful hints are displayed
at the right side.

There are various different editting "modes" in GHETTIT, with their own
helpful hints.

These are displayed in all modes:
"eXit   "       x key will exit the program
"Map    "       m changes to map mode
"pAlette"       a changes to palette mode
"Sprites"       s changes to sprite mode
"Walk   "       w changes to walk mode
"4 g map"       4 saves map to MAP.G file
"5 g blk"       5 saves blocks to BLOCKS.G
"7 t blk"       7 saves blocks to BLOCKS.T
"8 t map"       8 saves map to MAP.T
"9 pal  "       9 saves the palette to PAL.G
"   0   "       0 scrolls up
" o   p "       o or p scrolls left or right
"   l   "       l scrolls down

The map saved with 8 is a 32x32 array of bytes. Each byte specifies the ID of
a 16x16 block. Following the first 1024 bytes is an array which specifies
which 8x8 blocks make up a 16x16 block (4 words/8 bytes per entry). These
maps are used in my Phantasy Star game.

Hidden option:  * saves a rawmap which is a 64x64 array of 16-bit words
                  (it gets copied directly to the video memory)
                  these maps are currently used by Enshoku

Map mode:
This is the default mode when entering GHETTIT. Your cursor is an 8x8 white
square.

"c PCX  "       c creates the G.PCX file
"P spr2b"       P pastes whatever is in the sprite editing buffer to the map
                  [yes, keyboard input is case sensitive]
" g   h "       g gets the ID of the selected block
                h will set the selected map cell to the block "gotten" with g
"get put"

" area  "       v defines the upper left corner of a region
"v/b def"       b defines bottom right corner and causes data to be saved
"n put  "       n pastes the previously defined region into the map

"B 64x28"       B saves a map of size 64x28 blocks
                  these maps are used in my Phantasy Star game
"e/N blk"       e brings up the currently selected block for editing
                  (all instances of this block on the map will change)
                n creates a new block for editing (only the selected block
                  will change)

see block editing mode below

Hidden options: A changes the palette of the currently selected block
                  (and all instances of that block on the map)
                - changes the selected cell to the previous block in GHETTIT's
                  database
                = changes the selected cell to the next block in GHETTIT's
                  database

Note that you won't get a proper PCX file that can actually be read by other
programs unless you have a proper header for a 512x512x8 PCX stored in the
file PCXH. (header is written as normal by newer version of ghettit!)

Palette mode:
"1 inc R"       1 increments the red component of currently selected color
"2 inc G"       2       "        green
"3 inc B"       3       "        blue
"- sav l"       - saves the current row of 16 colors to PAL.L
"_ loadl"       _ loads PAL.L into the current row
"b black"       sets a color to black ($0000)

Palette mode is so easy you're sure to love it.

Sprites mode:
"SHIFT  "       
"goes 8 "       holding shift while moving the 16x16 cursor of sprite mode
                moves 8 pixels at a time instead of 1
"d load "       d loads a sprite from a SPR.G? file which is selected by
                typing the numeral 1-9 or letter a-g of the slot
"6 new  "       begins editing a new sprite by copying graphics from the map
                at the location of the cursor

see sprite editing mode below

Walk mode:
This is used for editing an attributes map. It's not used for Enshoku.

"- decr "       - toggles bit 0 in the value for the selected cell
"= incr "       = increments the value specified by bits 1-3
"f forgr"       f toggles bit 5 ("foreground")
"g load "       g loads the attributes map from WALK.G
"h save "       h saves the attributes map to WALK.G
"e msked"       e opens a mask sprite (1bpp) for editing
"t msg  "       t toggles bit 4 ("message")
"u ugh  "       u toggles bit 6 (I forget why it's called "ugh")

Mask Sprite editing mode:
Mask sprites are used to generate the appearance of a foreground layer above
the character sprites in my phantasy star game.

"- reset"       - toggles a pixel on or off

" line  "
"f reset"       f turns the entire row off
"j set  "       j turns the entire row on

"q quit "       q goes back to walk mode
"s save "       s saves a MASK.G? file

Sprite editing mode:
"z sav32"       z saves a SPR.G? file which will contain 4x 16x16x16bpp blocks
                  type a numeral 1-9 or letter a-g to specify the "slot"                
"g get  "       g "gets" the color of the selected pixel
"h put  "       h "puts" the currently stored color into the selected pixel
"- decr "       - changes the pixel to the previous color in the palette
"= incr "       = changes the pixel to the next color in the palette
"a pal  "       a changes the palette used by the sprite
"q quit "       q quits to sprites mode
"s save "       s saves a SPR.G? file with only one 16x16 block in it
                  type a numeral 1-9 or letter a-g to specify the "slot"                
"6 savet"       6 saves a SPR.T? file in Turbo Grafx native format (one block)
                  type a numeral 1-9 or letter a-g to specify the "slot"                
"0opl   "       these keys are used to shift the gfx around inside the 32x32
                window
"fj line"       f copies a whole row of pixels
                h pastes a whole row of pixels
"i fliph"       i flips the gfx left to right

Hidden option:  H changes all the pixels that are the same color as the
                  selected cell... to the currently stored color

You can work with sprites as 16x16 objects or as a group of four making up a
32x32 object. Use the arrow keys to move the cursor inside a 16x16 section
and to move between sections. Note that if a 32x32 (2048 bytes) SPR.G? file
already exists when you save a 16x16 sprite with "s" command, only the first
quarter (512 bytes) will be overwritten and the file will remain 2KB in size.

Block editing mode:
"g get  "       g "gets" the color of the selected pixel
"h put  "       h "puts" the currently stored color into the selected pixel
"- decr "       - changes the pixel to the previous color in the palette
"= incr "       = changes the pixel to the next color in the palette
"a pal  "       a changes the palette used by the block
"q quit "       q quits to map mode

"Hputall"       H changes all the pixels that are the same color as the
                  selected cell... to the currently stored color

This is pretty much the same as sprite editing mode.

Hidden options: j sets the row of pixels to the currently stored color
                k sets the column of pixels to the currently stored color

Bugs and other info:

There are some bizarre "features" in my program which I have yet to change.
Anyone else can call them bugs. The big one to watch out for is having the
block database become larger than 64KB in which case bad things will happen.

If you are working with the character-based background (and especially if you
are pasting in a lot of 32x32 objects from the sprite editor) be sure to save
a backup copy of everything by pressing "c" to create the G.PCX file. If you
find gfx becoming corrupt on the screen or see that the BLOCKS.G file is
approaching 64KB after saving then there is a simple way to avoid problems.
Delete (or rename) the BLOCKS.G file and then run GHETTIT, choose option 6,
and specify G.PCX as the file to load from. After it loads, hit 4, 5, and 9
to save everything and the BLOCKS.G file should be smaller now. GHETTIT will
have stripped out unused blocks when loading from G.PCX

Notice in GHETTIT.BAS that there is a line commented out that says gbamode=1?
If GHETTIT is compiled (or run inside QB) with gbamode=1 then some features
are added/changed to suit GBA development. The formats of some output files
are changed to chunky instead of planar gfx and the palette becomes 15-bit
RGB instead of 9-bit.

Ganbatte kudasai!
