import: initial shell import

This commit is contained in:
dwsJason 2020-07-12 19:05:26 -04:00
parent 7a0bc676f4
commit abf6e7354d
6 changed files with 1896 additions and 0 deletions

77
Makefile Normal file
View File

@ -0,0 +1,77 @@
#
# gslaplay/Makefile
#
# This makefile was created by Jason Andersen
#
# I build on Windows-10 64-bit, this makefile is designed to run under
# a Windows-10 Command Prompt, and makes use of DOS shell commands
#
# As far a free stuff, I setup a c:\bin directory, in my path
# the following packages and executables are in there
#
# Fine Tools from Brutal Deluxe
# http://www.brutaldeluxe.fr/products/crossdevtools/
# Cadius.exe
# Merlin32.exe
# OMFAnalyzer.exe
# LZ4.exe
#
# gnumake-4.2.1-x64.exe (with a symbolic link that aliases this to "make")
#
# https://apple2.gs/plus/
# gsplus32.exe (KEGS based GS Emulator fork by Dagen Brock)
# I configure this to boot the player.po image directly
# once that's done "make run" will build, update the disk image
# and boot into the player.
#
# Make and Build Variables
TARGETNAME = play
VPATH = src:obj
ASMFILES = $(wildcard asm/*.s)
ASM = merlin32
help:
@echo.
@echo $(TARGETNAME) Makefile
@echo -------------------------------------------------
@echo build commands:
@echo make gs - Apple IIgs
@echo make image - Build Bootable .PO File
@echo make run - Build / Run IIgs on emulator
@echo make clean - Clean intermediate/target files
@echo make depend - Build dependencies
@echo -------------------------------------------------
@echo.
$(TARGETNAME).sys16: $(ASMFILES) $(OBJFILES)
$(ASM) -v macros asm/link.s
move /y asm\$(TARGETNAME).sys16 .
gs: $(TARGETNAME).sys16
disk image: gs
@echo Updating $(TARGETNAME).po
@echo Remove $(TARGETNAME).sys16
cadius deletefile $(TARGETNAME).po /$(TARGETNAME)/$(TARGETNAME).sys16
@echo Add $(TARGETNAME).sys16
cadius addfile $(TARGETNAME).po /$(TARGETNAME) ./$(TARGETNAME).sys16
run: image
gsplus32
clean:
@echo Remove $(TARGETNAME).sys16
$(shell if exist $(TARGETNAME).sys16 echo Y | del $(TARGETNAME).sys16)
# @echo Remove Intermediate Files
# @del /q obj\*
depend:
@echo TODO - make dependencies
# Create all the directories
#$(shell if not exist $(DIRS) mkdir $(DIRS))

130
README.md
View File

@ -1,2 +1,132 @@
# gslaplay
Apple IIgs GSLA Player
Example of a GS LZB Animation Player
New Apple IIgs Animation file format
GS LZ Byte Compressed Animation
Why? When there are so many image formats would we need another one? Its
because $C2/Paintworks animation format is just terribly inefficient.
Care is taken in the encoder, to make sure the 65816 does not have to cross bank
boundaries during any copy. This is so we can use the MVN instruction, and so
we can reduce the number of bank checks in the code. Some bank checks will be
required, because we are dealing with data sizes that exceed 64KB at times.
We will have an opcode, that says “source data bank has changed”
Goals include a good balance between file size, and playback performance
(since one often makes a trade off with the other).
The file is defined as a byte stream.
I will attempt to define the format as
file-offset: the thing that is at the offset
Header of the File is 20 bytes as follows
File Offset Data Commentary
------------------------------------------------------------------
0 0x47 ; G Graphics
1 0x53 ; S
2 0x4C ; L LZB
3 0x41 ; A Animation
; File Length, is the total length of the file
4 FileLengthLow ; Low byte, 32-bit file length
5 LengthLowHigh ; High byte of low word
6 LengthHighLow ; Low byte, of high word
7 LengthHighHigh ; High Byte, of high word
; 16 bit word with version #
8 VL ; Version # of the file format, currently only version 0
9 VH ; Version High Byte
; %RVVV_VVVV_VVVV_VVVV
; V is a version #, 0 for now
; R is the MSB, R = 0 no ring frame
; R = 1, there is a ring frame
; A Ring Frame is a frame that will delta from the last
; frame of the animation, back to the first, for smoother
; looping , If a ring frame exists, its also in the
; frame count
// next is a word, width in bytes (only 160 for now)
0xA WL ; Display Width in bytes low byte
0xB WH ; Display Width in bytes high byte
// next is a word, height (likely 200 for now, in tiled mode a multiple of 16)
0xC HL ; Display Height in bytes, low byte
0xD HH ; Display Height in bytes, high byte
// 2 bytes, Frame Size in Bytes, since a “Frame” may contain more than just the
// width * height, worth of pixels, for now this is $8000, or 32768
0xE FBL ; Frame Buffer Length Low
0xF FBH ; Frame Buffer Length High
// 4 byte, 32-bit, Frame Count (includes total frame count, so if there is a
// ring frame, this is included in the total)
0x10 FrameCountLow
0x11 FrameCountLowHigh
0x12 FrameCountHighLow
0x13 FrameCountHigh
After this comes AIFF style chunks of data, basically a 4 byte chunk name,
followed by a 4 byte length (inclusive of the chunk size). The idea is that
you can skip chunks you dont understand.
File Offset:
0x14 First Chunk (followed by more Chunks, until end of file)
Chunk Definitions
Name: INIT - Initial Frame Chunk, this is the data used to first
initialize the playback buffer
0: 0x49 ; I
1: 0x4E ; N
2: 0x49 ; I
3: 0x54 ; T
// 32 bit long, length, little endian, including the 8 byte header
4: length low low
5: length low high
6: length high low
7: length high high
8: This is a single frame of data, that decodes/decompresses into frame sized
bytes (right now 0x8000)
This data stream includes, an end of animation opcode, so that the normal
animation decompressor, can be called on this data, and it will emit the initial
frame onto the screen
Name: ANIM - Frames
0: 0x41 A
1: 0x4E N
2: 0x49 I
3: 0x4D M
// 32 bit long, length, little endian, including chunk header
4: length low low
5: length low high
6: length high low
7: length high high
// This is followed by the frames, with the intention of decompressing them at
// 60FPS, which is why no play speed is included, if you need a play-rate slower
// than this, blank frames should be inserted into the animation data
// Every attempt is made to delta encode the image, meaning we just encode
// information about what changed each frame. We attempt to make the size
// efficient by supporting dictionary copies (where the dictionary is made up of
// existing pixels in the frame buffer).
Command Word, encoded low-high, what the bits mean:
// xxx_xxxx_xxxx_xxx is the number of bytes 1-16384 to follow (0 == 1 byte)
%0xxx_xxxx_xxxx_xxx0 - Copy Bytes - straight copy bytes
%1xxx_xxxx_xxxx_xxx1 - Skip Bytes - skip bytes / move the cursor
%1xxx_xxxx_xxxx_xxx0 - Dictionary Copy Bytes from frame buffer to frame buffer
%0000_0000_0000_0001- Source Skip -> Source pointer skips to next bank of data
%0000_0000_0000_0011- End of Frame - end of frame
%0000_0000_0000_0111- End of Animation / End of File / no more frames
// other remaining codes, are reserved for future expansion

75
asm/link.s Normal file
View File

@ -0,0 +1,75 @@
;
; fun2gs Merlin32 linker file
;
dsk play.sys16
typ $b3 ; filetype
aux $db07 ; auxtype
;xpl ; Add ExpressLoad
*----------------------------------------------
asm shell.s
ds 0 ; padding
knd #$1100 ; kind
ali None ; alignment
lna play ; load name
sna start ; segment name
*----------------------------------------------
; asm dbgfnt.s
; ds 0 ; padding
; knd #$1100 ; kind
; ali None ; alignment
; lna fun2gs ; load name
; sna start ; segment name, doesn't work to try and merge segments here
*----------------------------------------------
; asm lz4.s
; ds 0 ; padding
; knd #$1100 ; kind
; ali None ; alignment
; lna fun2gs ; load name
; sna lz4code ; JSL only access
*----------------------------------------------
; asm blit.s
; ds 0 ; padding
; knd #$1100 ; kind
; ali None ; alignment
; lna fun2gs ; load name
; sna blitcode ; segment name, JSL only access
*----------------------------------------------
; asm penguin.s
; ds 0 ; padding
; knd #$1100 ; kind
; ali None ; alignment
; lna fun2gs ; load name
; sna penguin ; segment name
*---------------------------------------------
; asm sprdata0.s
; ds 0 ; padding
; knd #$1100 ; kind
; ali None ; alignment
; lna fun2gs ; load name
; sna sprdata0 ; segment name
*----------------------------------------------
; asm gng.tiles.s
; ds 0 ; padding
; knd #$1100 ; kind
; ali None ; alignment
; lna fun2gs ; load name
; sna gngtiles
*----------------------------------------------
; asm cat.s
; ds 0 ; padding
; knd #$1100 ; kind
; ali None ; alignment
; lna fun2gs ;
; sna cat
*----------------------------------------------
* Combined Stack and Direct Page
; $$JGA this works, but giving up all this space in the executable is stupid
; x65 assembler makes this much easier
; asm stack.s
; ds 0 ; padding, note changing the padding doesn't work
; knd $0012 ; kind DP/Stack
; ali None ; alignment, note this doesn't work
; lna fun2gs ; load name
; sna stack ; segment name

19
asm/s.s Normal file
View File

@ -0,0 +1,19 @@
lkv $02
ver $02
nol
do pass
else
cmd err.usr
fin
asm shell
lnk shell.l
save dwshell
do pass
cmd purge.mem
cmd =dwshell
fin
* eof

1165
asm/shell.s Normal file

File diff suppressed because it is too large Load Diff

430
macros/drm.macs.s Normal file
View File

@ -0,0 +1,430 @@
_ADBStartUp MAC
Tool $209
<<<
_ADBShutDown MAC
Tool $309
<<<
~CtlStartUp MAC
PxW ]1;]2
Tool $210
<<<
_CtlShutDown MAC
Tool $310
<<<
_DeskStartUp MAC
Tool $205
<<<
_DeskShutDown MAC
Tool $305
<<<
_FixAppleMenu MAC
Tool $1E05
<<<
~DialogStartUp MAC
PHW ]1
Tool $215
<<<
_DialogShutDown MAC
Tool $315
<<<
_DialogStatus MAC
Tool $615
<<<
~StopAlert MAC
PHA
PxL ]1;]2
Tool $1815
<<<
~NoteAlert MAC
PHA
PxL ]1;]2
Tool $1915
<<<
~EMStartUp MAC
PxW ]1;]2;]3;]4
PxW ]5;]6;]7
Tool $206
<<<
_EMShutDown MAC
Tool $306
<<<
~FMStartUp MAC
PxW ]1;]2
Tool $21B
<<<
_FMShutDown MAC
Tool $31B
<<<
_IMStartUp MAC
Tool $20B
<<<
_IMShutDown MAC
Tool $30B
<<<
~LEStartUp MAC
PxW ]1;]2
Tool $214
<<<
_LEShutDown MAC
Tool $314
<<<
_TLStartUp MAC
Tool $201
<<<
_TLShutDown MAC
Tool $301
<<<
~TLVersion MAC
PHA
Tool $401
<<<
~LoadTools MAC
PHL ]1
Tool $E01
<<<
~TLMountVolume MAC
PHA
PxW ]1;]2
PxL ]3;]4;]5;]6
Tool $1101
<<<
_TLTextMountVol MAC
Tool $1201
<<<
~MMStartUp MAC
PHA
Tool $202
<<<
~MMShutDown MAC
PHW ]1
Tool $302
<<<
~MMVersion MAC
PHA
Tool $402
<<<
~NewHandle MAC
P2SL ]1
PxW ]2;]3
PHL ]4
Tool $902
<<<
~DisposeHandle MAC
PHL ]1
Tool $1002
<<<
~GetHandleSize MAC
P2SL ]1
Tool $1802
<<<
~MenuStartUp MAC
PxW ]1;]2
Tool $20F
<<<
_MenuShutDown MAC
Tool $30F
<<<
_InsertMenu MAC
Tool $D0F
<<<
_FixMenuBar MAC
Tool $130F
<<<
_DrawMenuBar MAC
Tool $2A0F
<<<
_HiliteMenu MAC
Tool $2C0F
<<<
_NewMenu MAC
Tool $2D0F
<<<
_MTStartUp MAC
Tool $203
<<<
_MTShutDown MAC
Tool $303
<<<
~MTVersion MAC
PHA
Tool $403
<<<
~QDStartUp MAC
PxW ]1;]2;]3;]4
Tool $204
<<<
_QDShutDown MAC
Tool $304
<<<
~QDVersion MAC
PHA
Tool $404
<<<
~MoveTo MAC
PxW ]1;]2
Tool $3A04
<<<
_ShowCursor MAC
Tool $9104
<<<
~DrawString MAC
PHL ]1
Tool $A504
<<<
_InitCursor MAC
Tool $CA04
<<<
_QDAuxStartUp MAC
Tool $212
<<<
_QDAuxShutDown MAC
Tool $312
<<<
_ScrapStartUp MAC
Tool $216
<<<
_ScrapShutDown MAC
Tool $316
<<<
~WindStartUp MAC
PHW ]1
Tool $20E
<<<
_WindShutDown MAC
Tool $30E
<<<
_TaskMaster MAC
Tool $1D0E
<<<
~RefreshDesktop MAC
PHL ]1
Tool $390E
<<<
_GET_BOOT_VOL MAC
DOS16 $28;]1
<<<
_QUIT MAC
DOS16 $29;]1
<<<
_Close mac
DOS16 $14;]1
eom
_Open mac
DOS16 $10;]1
eom
_Read mac
DOS16 $12;]1
eom
_Write mac
DOS16 $13;]1
eom
_SetMark mac
DOS16 $16;]1
eom
DOS16 MAC
JSL $E100A8
DA ]1
ADRL ]2
<<<
PxW MAC
DO ]0/1
PHW ]1
DO ]0/2
PHW ]2
DO ]0/3
PHW ]3
DO ]0/4
PHW ]4
FIN
FIN
FIN
FIN
<<<
PxL MAC
DO ]0/1
PHL ]1
DO ]0/2
PHL ]2
DO ]0/3
PHL ]3
DO ]0/4
PHL ]4
FIN
FIN
FIN
FIN
<<<
P2SL MAC
PHA
PHA
IF #=]1
PEA ^]1
ELSE
PHW ]1+2
FIN
PHW ]1
<<<
PHL MAC
IF #=]1
PEA ^]1
ELSE
PHW ]1+2
FIN
PHW ]1
<<<
PHW MAC
IF #=]1
PEA ]1
ELSE
IF MX/2
LDA ]1+1
PHA
FIN
LDA ]1
PHA
FIN
<<<
PushPtr MAC
PEA ^]1
PEA ]1
<<<
PushLong MAC
IF #=]1
PushWord #^]1
ELSE
PushWord ]1+2
FIN
PushWord ]1
<<<
PushWord MAC
IF #=]1
PEA ]1
ELSE
IF MX/2
LDA ]1+1
PHA
FIN
LDA ]1
PHA
FIN
<<<
PullLong MAC
DO ]0
PullWord ]1
PullWord ]1+2
ELSE
PullWord
PullWord
FIN
<<<
PullWord MAC
PLA
DO ]0
STA ]1
FIN
IF MX/2
PLA
DO ]0
STA ]1+1
FIN
FIN
<<<
Tool MAC
LDX #]1
JSL $E10000
<<<
Item MAC
ASC '--'
ASC ]1
ASC '\H'
DA ]inum
DO ]0/2
DO ]2-Check-1/-1
DA ]2
ELSE
DO ]2-Blank-1/-1
DA ]2
ELSE
DB ]2
ASC ]3
FIN
FIN
FIN
DO ]0/4
DO ]4-Check-1/-1
DA ]4
ELSE
DO ]4-Blank-1/-1
DA ]4
ELSE
DB ]4
ASC ]5
FIN
FIN
FIN
DO ]0/6
DO ]6-Check-1/-1
DA ]6
ELSE
DO ]6-Blank-1/-1
DA ]6
ELSE
DB ]6
ASC ]7
FIN
FIN
FIN
DB $00
]inum = ]inum+1
<<<
Menu MAC
ASC '>>'
ASC ]1
ASC '\H'
DA ]mnum
DO ]0>1
ASC ]2
FIN
DB 0
]mnum = ]mnum+1
<<<
* Menu Contents and Equates
Bold = 'B' ; bold menu item
Disable = 'D' ; disabled menu item
Italic = 'I' ; italic menu item
Underline = 'U' ; underlined menu item
Divide = 'V' ; menu dividing line
ColorHi = 'X' ; color hilite menu item
Kybd = '*' ; keyboard menu equivalent
Check = $1243 ; menu item with checkmark
Blank = $2043 ; menu item with blank
* Dialog Equates
CheckItem = 11
RadioItem = 12
ScrollBarItem = 13
PicItem = 19
UserItem = 20
ButtonItem EQU $0A
EditLine equ $11
StatText EQU $0F
StatTextItem = $f
ItemDisable EQU $8000
* macros
test mac
sep #$30
ldal $e1c034
inc
stal $e1c034
rep #$30
eom