From abf6e7354d29cb6635be423d90e19a8579ba22be Mon Sep 17 00:00:00 2001 From: dwsJason Date: Sun, 12 Jul 2020 19:05:26 -0400 Subject: [PATCH 01/15] import: initial shell import --- Makefile | 77 +++ README.md | 130 +++++ asm/link.s | 75 +++ asm/s.s | 19 + asm/shell.s | 1165 +++++++++++++++++++++++++++++++++++++++++++++ macros/drm.macs.s | 430 +++++++++++++++++ 6 files changed, 1896 insertions(+) create mode 100644 Makefile create mode 100644 asm/link.s create mode 100644 asm/s.s create mode 100644 asm/shell.s create mode 100644 macros/drm.macs.s diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..bed5d7d --- /dev/null +++ b/Makefile @@ -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)) + diff --git a/README.md b/README.md index 1ed4917..5e09d1a 100644 --- a/README.md +++ b/README.md @@ -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? It’s +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, it’s 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 don’t 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 frame’s 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 + diff --git a/asm/link.s b/asm/link.s new file mode 100644 index 0000000..d00d8c4 --- /dev/null +++ b/asm/link.s @@ -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 + diff --git a/asm/s.s b/asm/s.s new file mode 100644 index 0000000..667ca50 --- /dev/null +++ b/asm/s.s @@ -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 diff --git a/asm/shell.s b/asm/shell.s new file mode 100644 index 0000000..0f6e018 --- /dev/null +++ b/asm/shell.s @@ -0,0 +1,1165 @@ + lst off +* +* DreamWorld Software Generic Shell +* +* v .02 10/8/90 +* + +* OA-F "damnmenu" to find menu definitions +* + + rel + dsk shell.l + use drm.macs + + +vidmode = $8080 ;Video mode for QD II (320) ($8000) + ;640 mode ($8080) + +* startup tools, begin program + +tool equ $e10000 + +iobuff equ $80 + +textlength equ 38 ;max length of text + +startup ent + phk + plb ;make the program bank = data bank + +SetRes sep $30 ; 8-bit mode + lda #$5C ; jml + stal $3F8 ; ctrl-y vector + rep $30 ; 16-bit mode + lda #Resume + stal $3F9 ; $3f9,3fa + lda #^Resume ; bank byte + stal $3FB ; $3fb,3fc + + _TLStartUp ;Gotta start this baby + + ~MMStartUp ;start the Memory manager + ; CheckToolError + + pla ;retrieve our program ID + sta ProgID + + PushLong #0 ;result space + lda ProgID ;user ID + pha + pea #$0 ;reference by handle + PushLong #startref + ldx #$1801 ;startuptools + jsl $e10000 + PullLong stref + jmp DoMenu + +:trouble + pha + PushLong #0 + ldx #$1503 + jsl $e10000 + rtl + +backhandle dw 0,0 + +* +* Draw the desktop +* + +DoMenu + ldx #$0001 + lda #$0000 + jsr getmem + bcc :ov3 + brl ShutDown +:ov3 ;handle in a and x + jsl dereference + + sta p:rbuf ; set up Disk I/O buffer + sta iobuff + txa + sta p:rbuf+2 + sta iobuff+2 + + +* PushLong #0 +* PushPtr ExampleM +* _NewMenu +* PushWord #0 +* _InsertMenu + + PushLong #0 + PushPtr EditM + _NewMenu + PushWord #0 + _InsertMenu + + PushLong #0 + PushPtr FileM + _NewMenu + PushWord #0 + _InsertMenu + + PushLong #0 + PushPtr AppleM + _NewMenu + PushWord #0 + _InsertMenu + + PushLong #1 + _FixAppleMenu + + PHA + _FixMenuBar + PLA + + _DrawMenuBar + + _InitCursor + + JSR DoAbout ; Show this to the user before we get going... + + +* Command Processor +* +* Use TaskMaster to handle any and all events. +* We only check for events within the menus +* currently. The 'wInSpecial' ensures that we +* get events 250-255. +* + +GetEvent + pha + PushWord #$FFFF + PushPtr TaskRecord + _TaskMaster + pla + + cmp #25 ;wInSpecial + beq :DoEvent + cmp #17 ;wInMenuBar + bne GetEvent + +:DoEvent + sec + lda TaskData + sbc #250 ;Reduce to 0 and + asl ; double to find + tax ; index into table. + jsr (Cmds,X) + + PushWord #0 + PushWord TaskData+2 + _HiliteMenu + + bra GetEvent + +* damnmenu +* +* Menu definitions +* + +]mnum = 0 ; "1" - 1 = 0 +AppleM Menu '@';'X' +]inum = 255 + Item 'About...';Divide;'';Kybd;'?/' + +FileM Menu ' File ' + ; Item 'New';Kybd;'Nn' + Item 'Open...';Divide;'';Kybd;'Oo' + Item 'Automatic';Divide;'';Kybd;'Aa' +OpenItem = ]inum +]inum = 254 + Item 'Close';Divide;'' ; (#255) +]inum = OpenItem + Item 'Quit';Kybd;'Qq' +QuitItem = ]inum + +EditM Menu ' Edit ' +]inum = 249 + Item 'Undo';Divide;'';Kybd;'Zz' ; (#250) + Item 'Cut';Kybd;'Xx' ; (#251) + Item 'Copy';Kybd;'Cc' ; (#252) + Item 'Paste';Divide;'';Kybd;'Vv' ; (#253) + Item 'Clear' ; (#254) + +*ExampleM Menu ' Example ' +*]inum = QuitItem +* Item 'Bold';Disable;'' +* Item 'Disable';Disable;'' +* Item 'Italic';Disable;'' +* Item 'Underline';Disable;'' +* Item 'Divide';Disable;'' +* Item 'Check';Disable;'' +* Item 'Blank';Disable;'' + + asc '.' ;End of menu. + + +TaskRecord +tType ds 2 ;Event code +tMessage ds 4 ;Type of Event +tWhen ds 4 ;Time since startup +tWhere ds 4 ;Mouse Location +tMod ds 2 ;Event modifier +TaskData ds 4 ;Taskmaster Data +TaskMask adrl $00001FFF ;Taskmaster Handle All + +Fileinfo ;place for file info +Fopen dw 0 ;good info? +Ftype dw 0 ;file type +Atype adrl 0 ;aux type +Nref dw 0 ;Name reference type +Name adrl name ;Where is the name? (pointer) +Pref dw 0 ;Path reference type +Path adrl path ;Where is the path? (pointer) + +name ds 256 ;space for filename +path ds 512 ;space for pathname +fullp ds 768 + +ProgID dw 0 + + +* ShutDown Routine + +ShutDown ent ;a global label so other modules can die here.:) + pea #$0 ;ref is pointer + PushLong stref ;Reference to startstop record + ldx #$1901 + jsl $e10000 ;Shut Down Tools + +MMout ~MMShutDown ProgID + +TLout _TLShutDown + +:1 _QUIT QuitParms + bra :1 ;keep quitting if GS/OS is busy + +QuitParms adrl $0 + ds 2 + +getmem ent + sta :sizelo+1 + stx :sizehi+1 + lda #0 + pha + pha ; Space for Results +:sizehi pea #$0000 +:sizelo pea #$ffff ; Size in Bytes of Block 64k + lda ProgID + pha + pea #%1100000000011100 ; Attributes + lda #0 + pha + pha ; Ptr to where Block is to begin + ldx #$0902 + jsl tool ; NewHandle + pla + plx + rts + +dereference ent + pei 0 + pei 2 + sta 0 + stx 2 + lda [0] + pha + ldy #2 + lda [0],y + tax + ply + pla + sta 2 + pla + sta 0 + tya + rtl + + +* Resume routine for Control-Y vector... + +Resume phk + plb + clc + xce ; set native mode + rep $30 ; 16-bit mode + jmp ShutDown ; Let's get outta here!! + +startref ;tool startup record + dw $0000 ;flags + dw vidmode ;videoMode + ds 6 ;resFileID & dPageHandle are set by the StartUpTools call + dw 19 ;# of tools + ;tool number, version number + dw 1,$0300 ;Tool Locator + dw 2,$0300 ;Memory Manager + dw 3,$0300 ;Miscellaneous Tools + dw 4,$0301 ;QuickDraw II + dw 5,$0302 ;Desk Manager + dw 6,$0300 ;Event Manager + dw 11,$0200 ;Integer Math + dw 14,$0301 ;Window Manager + dw 15,$0301 ;Menu Manager + dw 16,$0301 ;Control Manager + dw 18,$0301 ;QuickDraw II Aux. + dw 19,$0300 ;Print Manager + dw 20,$0301 ;LineEdit Tools + dw 21,$0301 ;Dialog Manager + dw 22,$0300 ;Scrap Manager + dw 23,$0301 ;Standard File Tools + dw 27,$0301 ;Font Manager + dw 28,$0301 ;List Manager + dw 34,$0101 ;TextEdit Manager + +stref adrl 0 ;reference to the startstop record + +* +* Look up table for event processor +* + +Cmds + da DoUndo ; These menu items are set as + da DoCut ; required by Apple for + da DoCopy ; NDA compatibility. + da DoPaste + da DoClear + da DoClose + + da DoAbout ;This starts OUR items. (#256) + + da DoOpen + da DoAutomatic + da ShutDown + +* +* Main code goes here... +* + + +DoAbout + ~NoteAlert #AboutTemplate;#0 + pla + rts + +AboutTemplate + dw 62,128,151,512 ;position + dw 1 + dfb 128,128,128,128 + adrl :Item1 + adrl :Item2 + adrl :Item3 + adrl 0 + +:Item3 da 3 + dw 33,76,43,291 ;rect + da StatTextItem+ItemDisable + adrl :Item3Txt + da 0 + da 0 + adrl 0 +:Item3Txt + str '(C) DreamWorld Software 1991' + +:Item2 dw 2 + dw 13,122,22,251 ;rect + da StatTextItem+ItemDisable + adrl :Item2Txt + da 0 + da 0 + adrl 0 +:Item2Txt str 'DreamStamp v0.8' + +:Item1 da 1 + dw 66,272,78,350 ;rect + da ButtonItem + adrl :Item1Txt + da 0 + da 1 + adrl 0 +:Item1Txt str ' Ok ' + +DoOpen + pea #30 ;x of upper left corner + pea #40 ;y of upper left corner + pea #0 ;type of reference + PushLong #:message ;location of pascal string + PushLong #0 ;Filter... none for now + PushLong #:filter ;Pointer to type list record + PushLong #Fileinfo ;Pointer to reply record + + ldx #$0e17 ;SF Get File 2 + jsl $e10000 + bcc :cont + brl :trouble +:cont + lda Fopen ;good? + bne :keepitup + +:bye rts + +:keepitup + lda path+2 ;length of pathname + sta fullp + + ldx #0 +:lup + lda path+4,x ;make this class 1 string a prodos string + sta fullp+1,x + inx + inx + cpx path+2 + bcc :lup + + _Open p:open + bcs :trouble + + lda p:open + sta p:read + sta p:setmark + _SetMark p:setmark + bcs :trouble + + _Read p:read + bcs :trouble + + _Close p:close + bcs :trouble + brl changestats + +:temp dw 0 + +:trouble + pha + PushLong #0 + ldx #$1503 + jsl $e10000 + rtl + + +:message str 'Select File to Open:' + +:filter dw 1 ;only show s16 files + dw 0,$b3,0,0 ;flags, filetype, auxtype + +p:close +p:open dw 1 ;ref number + adrl fullp ;pathname + adrl 0 ;io buffer, doesn't reallymatter + +p:write +p:read dw 0 +p:rbuf adrl 0 + adrl $8000 ;number requested 32k + adrl 0 ;number transfered + +p:setmark + dw 0 ;ref number +p:where adrl $1c000 ;about 108k into file + + +DoSave + _Open p:open + bcs :trouble + + lda p:open + sta p:read + sta p:setmark + + _SetMark p:setmark + bcs :trouble + + _Write p:write + bcs :trouble + + _Close p:close + bcs :trouble + rts + +:trouble + pha + PushLong #0 + ldx #$1503 + jsl $e10000 + rtl + + +changestats + lda iobuff + sta :modify+1 + lda iobuff+1 + sta :modify+2 + + ldx #0 +:modify ldal $030000,x + cmp text+1 + beq :cont + cpx #$ffff + beq :nope + inx + bra :modify +:nope + rts +:cont + lda text + and #$00ff + ; dec + sta :temp + + stx offset + txy + iny + ldx #0 +:lup lda [iobuff],y + inx + iny + cmp text+1,x + bne :goback + cpx :temp + cpx #6 + bcc :lup + bra :dodialog + +:temp dw 0 + +:goback + ldx offset + inx + brl :modify + +:dodialog + PushLong #0 + PushLong #:getinfo + Tool $3215 ;new dialog + PullLong :pointer + + brl :initialize + +]lp + pea #0 + PushLong #0 + Tool $0f15 ;modal dialog + + pla + beq ]lp + cmp #1 + beq :okay + cmp #2 + beq :cancel + cmp #7 + bcs ]lp + brl :toggle + +:cancel + PushLong :pointer + Tool $0c15 ;close dialog + rts + +:initnew + ldx #0 + sep #$20 + lda #' ' +]dup sta newname,x + inx + cpx #textlength+1 + bcc ]dup + rep #$30 + rts + +:okay + + jsr :initnew ;initialize newname area + + PushLong :pointer + pea #8 ;name of user + PushLong #newname ;place to put the name + Tool $1f15 ;GetIText + + PushLong :pointer + pea #9 ;new serial number + PushLong #newser ;place to put the name + Tool $1f15 ;GetIText + + jsr :putser + bcs ]lp + + lda vernum + asl + tax + jsr (:encode,x) + + PushLong :pointer + Tool $0c15 ;close dialog + + jmp DoSave ;it's over + +:putser ;low word + sep #$20 + ldy #0 +:lloop + lda rserial,y ;location of serial string + ldx #0 +:bloop cmp :ascii,x + beq :okay2 + inx + cpx #17 + bcc :bloop + rep #$30 + sec + rts + + sep #$20 +:okay2 + txa + sta :teeem,y + iny + cpy #8 + bcc :lloop + + lda :teeem + asl + asl + asl + asl + ora :teeem+1 + sta :value+3 + + lda :teeem+2 + asl + asl + asl + asl + ora :teeem+3 + sta :value+2 + + lda :teeem+4 + asl + asl + asl + asl + ora :teeem+5 + sta :value+1 + + lda :teeem+6 + asl + asl + asl + asl + ora :teeem+7 + sta :value + + rep #$30 + + ldy serloc + lda :value + sta [iobuff],y + lda :value+2 + iny + iny + sta [iobuff],y + + clc + rts + + +:teeem dw 0,0,0,0 ;8 bit mode + asc 'shit' +:value dw 0,0 + + +:encode + da :sc1 + da :sc2 + da :sc3 + da :sc4 + +:sc1 + sep #$20 + ldx #0 + ldy texloc +:her0 + lda newname+1,x + sec + sbc maskval + sta [iobuff],y + inx + dey + cpx #textlength+1 + bcc :her0 + rep #$30 + rts + +:sc2 + sep #$20 + ldx #0 + ldy texloc +:her1 + lda newname+1,x + sec + sbc maskval + sta [iobuff],y + inx + dey + cpx #textlength+1 + bcc :her1 + rep #$30 + rts + +:sc3 +:sc4 + rts + +:toggle + sec + sbc #3 ;make value 0-3 + sta vernum ;version number + asl + asl + asl + tax + phx + lda :val,x + pha + PushLong :pointer + pea #3 ;item number + Tool $2f15 ;setditemvalue + + plx + phx + lda :val+2,x + pha + PushLong :pointer + pea #4 ;item number + Tool $2f15 ;setditemvalue + + plx + phx + lda :val+4,x + pha + PushLong :pointer + pea #5 ;item number + Tool $2f15 ;setditemvalue + + plx + lda :val+6,x + pha + PushLong :pointer + pea #6 ;item number + Tool $2f15 ;setditemvalue + + lda vernum + asl + tax + lda :maskval,x + sta maskval + and #$f000 + xba + lsr + lsr + lsr + lsr + tax + sep #$20 + lda :ascii,x + sta maskstr+2 + rep #$30 + lda maskval + and #$0f00 + xba + tax + sep #$20 + lda :ascii,x + sta maskstr+3 + rep #$30 + lda maskval + and #$00f0 + lsr + lsr + lsr + lsr + tax + sep #$20 + lda :ascii,x + sta maskstr+4 + rep #$30 + lda maskval + and #$000f + tax + sep #$20 + lda :ascii,x + sta maskstr+5 + rep #$30 + + PushLong :pointer + pea #10 ;mask value + PushLong #maskstr + Tool $2015 ;setItext + ldy serloc + + lda [iobuff],y + sta serval + iny + iny + lda [iobuff],y + sta serval+2 + + and #$f000 + xba + lsr + lsr + lsr + lsr + tax + sep #$20 + lda :ascii,x + sta serstr+2 + rep #$30 + lda serval+2 + and #$0f00 + xba + tax + sep #$20 + lda :ascii,x + sta serstr+3 + rep #$30 + lda serval+2 + and #$00f0 + lsr + lsr + lsr + lsr + tax + sep #$20 + lda :ascii,x + sta serstr+4 + rep #$30 + lda serval+2 + and #$000f + tax + sep #$20 + lda :ascii,x + sta serstr+5 + rep #$30 + + lda serval + and #$f000 + xba + lsr + lsr + lsr + lsr + tax + sep #$20 + lda :ascii,x + sta serstr+6 + rep #$30 + lda serval + and #$0f00 + xba + tax + sep #$20 + lda :ascii,x + sta serstr+7 + rep #$30 + lda serval + and #$00f0 + lsr + lsr + lsr + lsr + tax + sep #$20 + lda :ascii,x + sta serstr+8 + rep #$30 + lda serval + and #$000f + tax + sep #$20 + lda :ascii,x + sta serstr+9 + rep #$30 + + PushLong :pointer + pea #9 ;serial number + PushLong #serstr + Tool $2015 ;setItext + + lda vernum + asl + tax + lda offset + clc + adc :wheret,x + sta texloc + + jsr (:decode,x) + + PushLong :pointer + pea #7 ;serial number + PushLong #oldname + Tool $2015 ;setItext + + brl ]lp + + +:decode + da :scheme1 + da :scheme2 + da :scheme3 + da :scheme4 + +:scheme1 + sep #$20 + ldx #0 + ldy texloc +:here + lda [iobuff],y + clc + adc maskval + sta oldname+1,x + inx + dey + cpx #textlength+1 + bcc :here + rep #$30 + rts + +:scheme2 + sep #$20 + ldx #0 + ldy texloc +:here2 + lda [iobuff],y + clc + adc maskval + sta oldname+1,x + inx + dey + cpx #textlength+1 + bcc :here2 + rep #$30 + rts + +:scheme3 + rts +:scheme4 + rts + + +:ascii asc '0123456789abcdef' + +:val + dw 1,0,0,0 + dw 0,1,0,0 + dw 0,0,1,0 + dw 0,0,0,1 + +:maskval dw $30,$28,0,0 ;different encoding values for each ver number + +:wheret dw $128,$128,0,0 ;offset to text from end of 'Written by' + +:initialize + + lda text + and #$00ff + clc + adc offset + sta offset + sta serloc + + lda #3 ;version 1 + brl :toggle + +:pointer adrl 0 + +:getinfo + dw 27,82,185,558 ;position + dw -1 ;visible + adrl 0 ;reserved + adrl :item1 + adrl :item2 + adrl :item3 + adrl :item4 + adrl :item5 + adrl :item6 + adrl :item7 + adrl :item10 + adrl :item9 + adrl :item8 + adrl :item11 + adrl :item12 + adrl :item13 + adrl :item14 + adrl :item15 + adrl 0 ;terminator + +:item1 DA 1 + dw 137,340,150,430 ;rect + DA ButtonItem + adrl :Item1Txt + da 0 + da 1 + adrl 0 +:Item1Txt str 'Save' + +:item2 DA 2 + dw 137,210,150,300 ;rect + DA ButtonItem + ADRL :Item2Txt + DA 0 + DA 0 + ADRL 0 +:Item2Txt STR 'Cancel' + +:item3 dw 3 + dw 23,52,32,160 ;rect + dw CheckItem + adrl :i3text +:i3val dw 0,0,0,0 +:i3text str ' Version 1' + +:item4 dw 4 + dw 34,52,43,162 ;rect + dw CheckItem + adrl :i5text +:i5val dw 0,0,0,0 +:i5text str ' Version 2' + +:item5 dw 5 + dw 23,210,32,320 ;rect + dw CheckItem + adrl :i4text +:i4val dw 0,0,0,0 +:i4text str ' Version 3' + +:item6 DA 6 + dw 34,210,43,322 ;rect + dw CheckItem + adrl :i6text +:i6val dw 0,0,0,0 +:i6text str ' Version 4' + +:item7 dw 7 + dw 59,125,72,503 ;rect + dw StatTextItem+ItemDisable + adrl oldname + dw 0,0 + adrl 0 + +:item8 dw 8 + dw 90,50,103,426 ;rect + DA EditLine+ItemDisable + adrl defname + dw textlength + dw 0 + adrl 0 + +:item9 dw 9 + dw 119,52,131,150 ;rect + DA EditLine+ItemDisable + adrl serstr + dw 9 + dw 0 + adrl 0 + +:item10 dw 10 + dw 119,200,131,264 ;rect + DA EditLine+ItemDisable + adrl maskstr + dw 5 + dw 0 + adrl 0 + +:item11 dw 11 + dw 8,180,17,287 ;rect + dw StatTextItem+ItemDisable + adrl :item11txt + dw 0,0 + adrl 0 +:item11txt + dfb 11 + asc 'DreamStamp' + dfb $AA + +:item12 dw 12 + dw 48,50,57,125 ;rect + dw StatTextItem+ItemDisable + adrl :item12txt + dw 0,0 + adrl 0 +:item12txt + str 'Current:' + +:item13 dw 13 + dw 79,50,88,91 ;rect + dw StatTextItem+ItemDisable + adrl :item13txt + dw 0,0 + adrl 0 +:item13txt + str 'New:' + +:item14 dw 14 + dw 108,50,117,161 ;rect + dw StatTextItem+ItemDisable + adrl :item14txt + dw 0,0 + adrl 0 +:item14txt + str 'Serial Number:' + +:item15 dw 15 + dw 108,200,117,275 ;rect + dw StatTextItem+ItemDisable + adrl :item15txt + dw 0,0 + adrl 0 +:item15txt + str 'Mask:' + +vernum dw 0 ;version number 0 - 3 + +DoAutomatic + +DoUndo +DoCut +DoCopy +DoPaste +DoClear +DoClose + RTS + +oldname ;name in the program + dfb textlength + ds textlength + dw 0 + +defname + str 'Joe Hack and The Mercenary' + +newser dfb 0 + dfb 0 +rserial ds 8 + + +newname ds textlength+1 + dw 0 + +maskloc dw 0 ;offset to mask +maskval dw 0 +maskstr str '$0000' + +offset dw 0 + +serloc dw 0 ;offset to serial number +serstr str '$00000000' +serval adrl 0 + +texloc dw 0 ;offset to beginning of text + +text + str "Written By: Jason Andersen and Steven Chiang" diff --git a/macros/drm.macs.s b/macros/drm.macs.s new file mode 100644 index 0000000..273e54c --- /dev/null +++ b/macros/drm.macs.s @@ -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 From 3478bbf43328af4a0bb57e6268582f6625934a03 Mon Sep 17 00:00:00 2001 From: dwsJason Date: Mon, 13 Jul 2020 21:07:07 -0400 Subject: [PATCH 02/15] import filetype stuff for cadius --- _FileInformation.txt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 _FileInformation.txt diff --git a/_FileInformation.txt b/_FileInformation.txt new file mode 100644 index 0000000..228e3fd --- /dev/null +++ b/_FileInformation.txt @@ -0,0 +1,7 @@ +PLAY.SYS16=Type(B3),AuxType(DB07),VersionCreate(24),MinVersion(00),Access(21),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) +XRICK.SYS16=Type(B3),AuxType(DB07),VersionCreate(24),MinVersion(00),Access(21),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) +FUN2GS.SYS16=Type(B3),AuxType(DB07),VersionCreate(24),MinVersion(00),Access(21),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) +FUNK.SYSTEM=Type(FF),AuxType(2000),VersionCreate(24),MinVersion(00),Access(21),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) +BASIC.SYSTEM=Type(FF),AuxType(2000),VersionCreate(24),MinVersion(00),Access(21),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) +XHD=Type(FF),AuxType(2000),VersionCreate(24),MinVersion(00),Access(21),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) +PRODOS=Type(FF),AuxType(0000),VersionCreate(24),MinVersion(00),Access(21),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) From dc2142232f0c7048d8b2fce1df707cb8a24cb298 Mon Sep 17 00:00:00 2001 From: "JASON-6700K\\jandersen" Date: Tue, 14 Jul 2020 15:54:30 -0400 Subject: [PATCH 03/15] Merlin32: get the menus to work correctly in Merlin32 --- asm/shell.s | 12 ++++++------ macros/drm.macs.s | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/asm/shell.s b/asm/shell.s index 0f6e018..b4e6e13 100644 --- a/asm/shell.s +++ b/asm/shell.s @@ -163,22 +163,22 @@ GetEvent ]mnum = 0 ; "1" - 1 = 0 AppleM Menu '@';'X' -]inum = 255 +]inum = 256 Item 'About...';Divide;'';Kybd;'?/' FileM Menu ' File ' ; Item 'New';Kybd;'Nn' Item 'Open...';Divide;'';Kybd;'Oo' Item 'Automatic';Divide;'';Kybd;'Aa' -OpenItem = ]inum -]inum = 254 +]OpenItem = ]inum +]inum = 255 Item 'Close';Divide;'' ; (#255) -]inum = OpenItem +]inum = ]OpenItem Item 'Quit';Kybd;'Qq' -QuitItem = ]inum +]QuitItem = ]inum EditM Menu ' Edit ' -]inum = 249 +]inum = 250 Item 'Undo';Divide;'';Kybd;'Zz' ; (#250) Item 'Cut';Kybd;'Xx' ; (#251) Item 'Copy';Kybd;'Cc' ; (#252) diff --git a/macros/drm.macs.s b/macros/drm.macs.s index 273e54c..133069e 100644 --- a/macros/drm.macs.s +++ b/macros/drm.macs.s @@ -343,11 +343,11 @@ Item MAC ASC ]1 ASC '\H' DA ]inum - DO ]0/2 - DO ]2-Check-1/-1 + DO ]0/2 + DO ]2-Check-1/$FFFF DA ]2 ELSE - DO ]2-Blank-1/-1 + DO ]2-Blank-1/$FFFF DA ]2 ELSE DB ]2 @@ -356,10 +356,10 @@ Item MAC FIN FIN DO ]0/4 - DO ]4-Check-1/-1 + DO ]4-Check-1/$FFFF DA ]4 ELSE - DO ]4-Blank-1/-1 + DO ]4-Blank-1/$FFFF DA ]4 ELSE DB ]4 @@ -368,10 +368,10 @@ Item MAC FIN FIN DO ]0/6 - DO ]6-Check-1/-1 + DO ]6-Check-1/$FFFF DA ]6 ELSE - DO ]6-Blank-1/-1 + DO ]6-Blank-1/$FFFF DA ]6 ELSE DB ]6 From 2bbec103e22617516a417519dee831e56ca762ab Mon Sep 17 00:00:00 2001 From: "JASON-6700K\\jandersen" Date: Tue, 14 Jul 2020 16:39:30 -0400 Subject: [PATCH 04/15] Start Editing the menus --- asm/shell.s | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/asm/shell.s b/asm/shell.s index b4e6e13..e57ce1e 100644 --- a/asm/shell.s +++ b/asm/shell.s @@ -161,7 +161,13 @@ GetEvent * Menu definitions * -]mnum = 0 ; "1" - 1 = 0 +* +*NOTE Currently setup for Merlin32 +*for Merlin 16, adjust the ]mnum, and ]inum definitions down by 1 +*due to how merlin 16 will scope / evaluate them inside the macro +* + +]mnum = 1 ; "1" - 1 = 0 AppleM Menu '@';'X' ]inum = 256 Item 'About...';Divide;'';Kybd;'?/' @@ -169,7 +175,6 @@ AppleM Menu '@';'X' FileM Menu ' File ' ; Item 'New';Kybd;'Nn' Item 'Open...';Divide;'';Kybd;'Oo' - Item 'Automatic';Divide;'';Kybd;'Aa' ]OpenItem = ]inum ]inum = 255 Item 'Close';Divide;'' ; (#255) @@ -332,7 +337,6 @@ Cmds da DoAbout ;This starts OUR items. (#256) da DoOpen - da DoAutomatic da ShutDown * @@ -362,7 +366,7 @@ AboutTemplate da 0 adrl 0 :Item3Txt - str '(C) DreamWorld Software 1991' + str '(C) DreamWorld Software 2020' :Item2 dw 2 dw 13,122,22,251 ;rect @@ -371,7 +375,7 @@ AboutTemplate da 0 da 0 adrl 0 -:Item2Txt str 'DreamStamp v0.8' +:Item2Txt str 'GSLA Player v1.0' :Item1 da 1 dw 66,272,78,350 ;rect @@ -442,8 +446,10 @@ DoOpen :message str 'Select File to Open:' -:filter dw 1 ;only show s16 files - dw 0,$b3,0,0 ;flags, filetype, auxtype +:filter dw 0 ; (count 0/no filter), set to 1 for only show s16 files + +* dw 1 ; (count 1) Show only s16 files +* dw 0,$b3,0,0 ;flags, filetype, auxtype p:close p:open dw 1 ;ref number @@ -1123,8 +1129,6 @@ changestats vernum dw 0 ;version number 0 - 3 -DoAutomatic - DoUndo DoCut DoCopy From 10f5d31c0a1d3532b7815602203d7dd80e41a19b Mon Sep 17 00:00:00 2001 From: "JASON-6700K\\jandersen" Date: Tue, 14 Jul 2020 16:59:38 -0400 Subject: [PATCH 05/15] WIP --- asm/shell.s | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/asm/shell.s b/asm/shell.s index e57ce1e..03c3cf6 100644 --- a/asm/shell.s +++ b/asm/shell.s @@ -119,8 +119,8 @@ DoMenu _InitCursor - JSR DoAbout ; Show this to the user before we get going... - + JSR DoAbout ; Show this to the user before we get going... + JSR DoOpen * Command Processor * @@ -366,7 +366,7 @@ AboutTemplate da 0 adrl 0 :Item3Txt - str '(C) DreamWorld Software 2020' + str '(C)2020 DreamWorld Software' :Item2 dw 2 dw 13,122,22,251 ;rect From fd7d198d5ac5a47f9b0b61c0aced9591d88b191f Mon Sep 17 00:00:00 2001 From: dwsJason Date: Wed, 15 Jul 2020 20:22:22 -0400 Subject: [PATCH 06/15] adjust about text --- asm/shell.s | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/asm/shell.s b/asm/shell.s index 03c3cf6..50915a8 100644 --- a/asm/shell.s +++ b/asm/shell.s @@ -170,7 +170,7 @@ GetEvent ]mnum = 1 ; "1" - 1 = 0 AppleM Menu '@';'X' ]inum = 256 - Item 'About...';Divide;'';Kybd;'?/' + Item 'About GSLA...';Divide;'';Kybd;'?/' FileM Menu ' File ' ; Item 'New';Kybd;'Nn' @@ -444,7 +444,7 @@ DoOpen rtl -:message str 'Select File to Open:' +:message str 'Open GS Lzb Anim:' :filter dw 0 ; (count 0/no filter), set to 1 for only show s16 files @@ -468,31 +468,8 @@ p:where adrl $1c000 ;about 108k into file DoSave - _Open p:open - bcs :trouble - - lda p:open - sta p:read - sta p:setmark - - _SetMark p:setmark - bcs :trouble - - _Write p:write - bcs :trouble - - _Close p:close - bcs :trouble rts -:trouble - pha - PushLong #0 - ldx #$1503 - jsl $e10000 - rtl - - changestats lda iobuff sta :modify+1 From 9ceb025044c9f3b6aedcd2a6d7960a939f07f18a Mon Sep 17 00:00:00 2001 From: "JASON-6700K\\jandersen" Date: Sun, 19 Jul 2020 18:09:36 -0400 Subject: [PATCH 07/15] import: untested anim decoder --- asm/play.s | 132 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 asm/play.s diff --git a/asm/play.s b/asm/play.s new file mode 100644 index 0000000..51490c9 --- /dev/null +++ b/asm/play.s @@ -0,0 +1,132 @@ +// +// New Animated File Format +// + +// xxx_xxxx_xxxx_xxx is the number of bytes 1-16384 to follow (0 == 1 byte) + +%0xxx_xxxx_xxxx_xxx1 - 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_0000- Source Skip -> Source pointer skips to next bank of data +%0000_0000_0000_0010- End of Frame - end of frame +%0000_0000_0000_0110- End of Animation / End of File / no more frames + +// other remaining codes, are reserved for future expansion + + +16 bit opcode + +%1 xxx xxxx xxxx xxx 0 +%0 xxx xxxx xxxx xxx 0 + +// X = SRC +// Y = DST + +// Source Data Stream Copy +// Dictionary Copy +// xx xxxx xxxx xxxx // up to 16384 length of copy (0 is a copy length of 1 byte, so it's length-1) + +// Copy this code to your direct page, please make sure it's aligned to a page +// The buffer is hardcoded to be at $012000, to take advantage of fast reads + +// pass in a pointer to the start of the compressed stream +// ldx #offset in source bank +// lda #source bank +// we assume all next bank data is sequential from this first bank, but it +// wouldn't be hard to work from a list of banks, to make the player more +// friendly + +//--- this code sits at location $0 in the DP register +//--- DP may be anywhere in bank 0, but make sure it's PAGE aligned +//---- for performance reasons + + org $0 + mx %00 + phb + sep #$30 + sta Date: Mon, 20 Jul 2020 19:18:55 -0400 Subject: [PATCH 08/15] gsla player, wip --- asm/link.s | 12 +- asm/play.s | 150 ++++----- asm/shell.s | 754 ++++++---------------------------------------- macros/drm.macs.s | 4 + 4 files changed, 183 insertions(+), 737 deletions(-) diff --git a/asm/link.s b/asm/link.s index d00d8c4..89a150a 100644 --- a/asm/link.s +++ b/asm/link.s @@ -14,12 +14,12 @@ 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 play.s + ds 0 ; padding + knd #$1100 ; kind + ali None ; alignment + lna play ; load name + sna start ; segment name, doesn't work to try and merge segments here *---------------------------------------------- ; asm lz4.s ; ds 0 ; padding diff --git a/asm/play.s b/asm/play.s index 51490c9..aac1864 100644 --- a/asm/play.s +++ b/asm/play.s @@ -1,75 +1,78 @@ -// -// New Animated File Format -// +* +* New Animated File Format +* +* +* xxx_xxxx_xxxx_xxx is the number of bytes 1-16384 to follow (0 == 1 byte) +* +* %0xxx_xxxx_xxxx_xxx1 - 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_0000- Source Skip -> Source pointer skips to next bank of data +* %0000_0000_0000_0010- End of Frame - end of frame +* %0000_0000_0000_0110- End of Animation / End of File / no more frames +* +* other remaining codes, are reserved for future expansion +* +* +* 16 bit opcode +* +* %1 xxx xxxx xxxx xxx 0 +* %0 xxx xxxx xxxx xxx 0 +* +* X = SRC +* Y = DST +* +* Source Data Stream Copy +* Dictionary Copy +* xx xxxx xxxx xxxx // up to 16384 length of copy (0 is a copy length of 1 byte, so it's length-1) +* +* Copy this code to your direct page, please make sure it's aligned to a page +* The buffer is hardcoded to be at $012000, to take advantage of fast reads +* +* pass in a pointer to the start of the compressed stream +* ldx #offset in source bank +* lda #source bank +* we assume all next bank data is sequential from this first bank, but it +* wouldn't be hard to work from a list of banks, to make the player more +* friendly -// xxx_xxxx_xxxx_xxx is the number of bytes 1-16384 to follow (0 == 1 byte) +*--- this code sits at location $0 in the DP register +*--- DP may be anywhere in bank 0, but make sure it's PAGE aligned +*---- for performance reasons -%0xxx_xxxx_xxxx_xxx1 - 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_0000- Source Skip -> Source pointer skips to next bank of data -%0000_0000_0000_0010- End of Frame - end of frame -%0000_0000_0000_0110- End of Animation / End of File / no more frames - -// other remaining codes, are reserved for future expansion - - -16 bit opcode - -%1 xxx xxxx xxxx xxx 0 -%0 xxx xxxx xxxx xxx 0 - -// X = SRC -// Y = DST - -// Source Data Stream Copy -// Dictionary Copy -// xx xxxx xxxx xxxx // up to 16384 length of copy (0 is a copy length of 1 byte, so it's length-1) - -// Copy this code to your direct page, please make sure it's aligned to a page -// The buffer is hardcoded to be at $012000, to take advantage of fast reads - -// pass in a pointer to the start of the compressed stream -// ldx #offset in source bank -// lda #source bank -// we assume all next bank data is sequential from this first bank, but it -// wouldn't be hard to work from a list of banks, to make the player more -// friendly - -//--- this code sits at location $0 in the DP register -//--- DP may be anywhere in bank 0, but make sure it's PAGE aligned -//---- for performance reasons +; rel + dsk play.l +player ent org $0 mx %00 phb sep #$30 - sta Date: Mon, 20 Jul 2020 22:15:28 -0400 Subject: [PATCH 09/15] GSLA player, wip --- asm/link.s | 55 ++--------------------------------------------------- asm/shell.s | 22 ++++++++++++++++++++- 2 files changed, 23 insertions(+), 54 deletions(-) diff --git a/asm/link.s b/asm/link.s index 89a150a..52080ab 100644 --- a/asm/link.s +++ b/asm/link.s @@ -1,5 +1,5 @@ ; -; fun2gs Merlin32 linker file +; GSLA Player Merlin32 linker file ; dsk play.sys16 typ $b3 ; filetype @@ -15,61 +15,10 @@ sna start ; segment name *---------------------------------------------- asm play.s - ds 0 ; padding + ds 0 ; padding knd #$1100 ; kind ali None ; alignment lna play ; 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 diff --git a/asm/shell.s b/asm/shell.s index cf408d4..06ba6db 100644 --- a/asm/shell.s +++ b/asm/shell.s @@ -71,6 +71,8 @@ SetRes sep $30 ; 8-bit mode ldx #$1F02 jsl tool ; CompactMem ;------------------------------------------------------------------------------- +; I'm pretty sure one of the tools is allocating this out from under me +; ; PushLong #0 ; Ask Shadowing Screen ($8000 bytes from $01/2000) ; PushLong #$8000 ; PushWord ProgID @@ -412,7 +414,7 @@ AboutTemplate da 0 adrl 0 :Item3Txt - str '(C)2020 DreamWorld Software' + str '(C) 2020 DreamWorld Software' :Item2 dw 2 dw 13,122,22,251 ;rect @@ -551,11 +553,29 @@ DoSave PlayAnimation + ; ha, this has to parse the headers + ; before it can play the animation + ; copy player to the Direct Page + + lda #127 ; player is really only about 96 bytes + ldx #player + phd + ply + sty :play+1 + + mvn ^player,$00 + + phk + plb + + ; load up a pointer to data lda p:rbuf ldx p:rbuf+2 + ; play the animation + :play jsl $000000 rts From ef1d637e36f244a6636b7968d89159455e1f7cc4 Mon Sep 17 00:00:00 2001 From: dwsJason Date: Tue, 21 Jul 2020 08:32:56 -0400 Subject: [PATCH 10/15] shell: anim loading WIP --- asm/shell.s | 58 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 16 deletions(-) diff --git a/asm/shell.s b/asm/shell.s index 06ba6db..e2d4d53 100644 --- a/asm/shell.s +++ b/asm/shell.s @@ -167,7 +167,7 @@ DoMenu _InitCursor - JSR DoAbout ; Show this to the user before we get going... + ;JSR DoAbout ; Show this to the user before we get going... JSR DoOpen * Command Processor @@ -304,7 +304,7 @@ getmem ent :sizelo pea #$ffff ; Size in Bytes of Block 64k lda ProgID pha - pea #%1100000000011100 ; Attributes +gm_atr pea #%1100000000011100 ; Attributes lda #0 pha pha ; Ptr to where Block is to begin @@ -491,22 +491,30 @@ DoOpen * I've decided that using Tools to spawn a dialog with a loading meter * is actually more work (mentally), than just stomping on the frame buffer * + +; need to allocate each bank separate, to guarantee +; the alignment for the player +; perhaps loop through, and store a list of allocated banks +; starting at $80 in the DP, so DP,x addressing can get at +; them in the player + + lda p:eof ldx p:eof+2 jsr getmem bcs :err_close - jsl dereference - sta p:rbuf - stx p:rbuf+2 +; jsl dereference +; sta p:rbuf +; stx p:rbuf+2 - lda p:eof - ldx p:eof+2 - sta p:rsize - stx p:rsize+2 +; lda p:eof +; ldx p:eof+2 +; sta p:rsize +; stx p:rsize+2 - _Read p:read - bcs :err_close +; _Read p:read +; bcs :err_close _Close p:close bcs :trouble @@ -548,11 +556,10 @@ p:setmark p:where adrl $1c000 ;about 108k into file -DoSave - rts PlayAnimation - + rts + ; ha, this has to parse the headers ; before it can play the animation @@ -563,21 +570,40 @@ PlayAnimation phd ply sty :play+1 + sty :init+1 mvn ^player,$00 phk plb + ; Pointer to the INITial Frame Data + lda #28 ; Header of file + Header of INIT Frame + ldx p:rbuf+2 + +:init jsl $000000 ; for the first frame + ; load up a pointer to data - - lda p:rbuf +:loop + lda p:rbuf + sta $F0 + lda p:rbuf+2 + sta $F2 + + ldy #24 + lda [$F0],y + clc + adc #20 + + ;lda p:rbuf ldx p:rbuf+2 ; play the animation :play jsl $000000 + bra :loop + rts From 4a2db30d213bcea4831282856f7fdb89610280ab Mon Sep 17 00:00:00 2001 From: "JASON-6700K\\jandersen" Date: Tue, 21 Jul 2020 12:42:54 -0400 Subject: [PATCH 11/15] Player Actually Plays a sample Animation --- asm/link.s | 2 +- asm/play.s | 94 +++++++++++++++--------- asm/shell.s | 203 ++++++++++++++++++++++++++++++++++++++++------------ 3 files changed, 218 insertions(+), 81 deletions(-) diff --git a/asm/link.s b/asm/link.s index 52080ab..a3adb07 100644 --- a/asm/link.s +++ b/asm/link.s @@ -15,7 +15,7 @@ sna start ; segment name *---------------------------------------------- asm play.s - ds 0 ; padding + ds 0 ; padding knd #$1100 ; kind ali None ; alignment lna play ; load name diff --git a/asm/play.s b/asm/play.s index aac1864..f03b1f4 100644 --- a/asm/play.s +++ b/asm/play.s @@ -44,55 +44,79 @@ ; rel dsk play.l +; +; Defines, for the list of allocated memory banks +; +banks_count equ $80 +banks_data equ $82 + + player ent org $0 mx %00 phb - sep #$30 - sta srcbank+2 ; self modify the code for mvn - sta read_opcode+3 ; data stream reader - sta dictionary_offset+3 ; opcode stream reader + sep #$20 ; preserve X + sta Date: Tue, 21 Jul 2020 19:34:26 -0400 Subject: [PATCH 12/15] Cleanup: report an eror if the file isn't a GSLA... also hide/show cursor, free memory, and redraw the desktop --- asm/shell.s | 138 ++++++++++++++++++++++++++++++++++++++++++++-- macros/drm.macs.s | 9 +++ 2 files changed, 141 insertions(+), 6 deletions(-) diff --git a/asm/shell.s b/asm/shell.s index 631d558..5194803 100644 --- a/asm/shell.s +++ b/asm/shell.s @@ -410,6 +410,49 @@ Cmds * Main code goes here... * +DoInvalidFile + ~NoteAlert #InvalidTemplate;#0 + pla + rts + +InvalidTemplate + dw 62,128,151,512 ;position + dw 1 + dfb 128,128,128,128 + adrl :Item1 + adrl :Item2 + adrl :Item3 + adrl 0 + +:Item3 da 3 + dw 33,76,43,291 ;rect + da StatTextItem+ItemDisable + adrl :Item3Txt + da 0 + da 0 + adrl 0 +:Item3Txt + str 'This file seems invalid.' + +:Item2 dw 2 + dw 13,122,22,251 ;rect + da StatTextItem+ItemDisable + adrl :Item2Txt + da 0 + da 0 + adrl 0 +:Item2Txt str 'Cannot play!!' + +:Item1 da 1 + dw 66,272,78,350 ;rect + da ButtonItem + adrl :Item1Txt + da 0 + da 1 + adrl 0 +:Item1Txt str ' Ok ' + + DoAbout ~NoteAlert #AboutTemplate;#0 @@ -597,8 +640,8 @@ DoOpen :filter dw 0 ; (count 0/no filter), set to 1 for only show s16 files -* dw 1 ; (count 1) Show only s16 files -* dw 0,$b3,0,0 ;flags, filetype, auxtype +; dw 1 ; (count 1) Show only s16 files +; dw 0,$b3,0,0 ;flags, filetype, auxtype p:close p:open dw 1 ;ref number @@ -614,13 +657,72 @@ p:rsize adrl $10000 ;number requested 64k p:get_eof dw 0 ; reference number p:eof adrl 0 ; end of file -p:setmark - dw 0 ;ref number -p:where adrl $1c000 ;about 108k into file +* +* Hold a backup of the system palette +* +scbs_and_palette + ds 768 +pData = $FC PlayAnimation mx %00 + + ; First verify that the file, looks like what it should be + stz Date: Wed, 22 Jul 2020 11:04:27 -0400 Subject: [PATCH 13/15] GSLA Player - updates for looping, and animation play stopping, and frame syncing --- asm/play.s | 26 +++++++++-------- asm/shell.s | 83 +++++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 91 insertions(+), 18 deletions(-) diff --git a/asm/play.s b/asm/play.s index f03b1f4..d38166b 100644 --- a/asm/play.s +++ b/asm/play.s @@ -41,9 +41,10 @@ *--- DP may be anywhere in bank 0, but make sure it's PAGE aligned *---- for performance reasons -; rel dsk play.l + ext EndOfAnimFrame + ; ; Defines, for the list of allocated memory banks ; @@ -74,18 +75,19 @@ extended_command lsr bcs :end_of_file -* ; end of frame + ; end of frame + ; check elapsed ticks (need at least 1) + ; For now just inline vsync (preferable to check the number of + ; if jiffy that have elapsed, because if the animation uses more than + ; roughly 10% of the screen we don't want to sync here + phx + + jsl EndOfAnimFrame + + plx + bcs :end_of_file + ldy #$2000 -* ; check elapsed ticks (need at least 1) -* ; For now just inline vsync (preferable to check the number of -* ; if jiffy that have elapsed, because if the animation uses more than -* ; roughly 10% of the screen we don't want to sync here -* lda Date: Wed, 22 Jul 2020 11:55:34 -0400 Subject: [PATCH 14/15] Fix issue with menu bar corruption, after you stop playing an animation --- asm/shell.s | 91 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 52 insertions(+), 39 deletions(-) diff --git a/asm/shell.s b/asm/shell.s index b8fafbd..de89128 100644 --- a/asm/shell.s +++ b/asm/shell.s @@ -6,6 +6,8 @@ * * Updated for Merlin 32 07/11/2020 * +* play.s contains the interesting bits of the code +* * OA-F "damnmenu" to find menu definitions * @@ -32,9 +34,6 @@ vidmode = $8080 ;Video mode for QD II (320) ($8000) tool equ $e10000 -iobuff equ $80 - -textlength equ 38 ;max length of text startup ent mx %00 @@ -70,17 +69,6 @@ SetRes sep $30 ; 8-bit mode ; stz Date: Wed, 22 Jul 2020 16:19:52 -0400 Subject: [PATCH 15/15] Update the Read me --- README.md | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 5e09d1a..384ec0d 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,13 @@ Apple IIgs GSLA Player Example of a GS LZB Animation Player +Inspired by Deluxe Animation Run/Skip/Dump, and FLI/FLC with similar properties + +I replace the "Run" with a dictionary/frame buffer copy from the existing +buffer to the existing buffer. This is able to runlength not just a single +byte, but a repeating pattern of arbitrary length. + +-------------------------------------------------------------------------------- New Apple IIgs Animation file format GS LZ Byte Compressed Animation Why? When there are so many image formats would we need another one? It’s @@ -10,10 +17,9 @@ 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 can reduce the number of bank checks in the code. -We will have an opcode, that says “source data bank has changed” +We 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). @@ -120,13 +126,13 @@ 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 +* %0xxx_xxxx_xxxx_xxx1 - 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_0000- Source Skip -> Source pointer skips to next bank of data +* %0000_0000_0000_0010- End of Frame - end of frame +* %0000_0000_0000_0110- End of Animation / End of File / no more frames // other remaining codes, are reserved for future expansion