CPCWiki forum

General Category => Programming => Topic started by: roudoudou on 12:45, 23 September 18

Title: Amstrad Plus sprite compiler v1.3
Post by: roudoudou on 12:45, 23 September 18
Here is a small utility i use to compile hardware sprites (16x16 with 15 colors+transparency)
There is a few options to chain code produced (for metasprites for example)

Code: [Select]
compiler.exe v1.2 / Edouard BERGE 2018-09


syntaxe is: compiler file1 [file2] [options]


options:
-idx <sequence(s)>  define sprite indexes to compute
-c     compile a full sprite
-d     compile difference between two sprites or a sequence
-noret do not add RET at the end of the routine
-inch  add a INC H at the end of the routine
-jpix  add a JP (IX) at the end of the routine
-jpiy  add a JP (IY) at the end of the routine
-l <label>  insert a numbered label for multi diff

Here is a sample code produced by the tool. With more complex sprite there is an optimizer which may reallocate registers, ...
Code: [Select]
; diff routine from bulle5.b02 to bulle5.b03
xor a
ld b,1

ld l,81
ld (hl),b
inc l : ld (hl),a
ld l,93 : ld (hl),a
inc l : ld (hl),b
ld l,112 : ld (hl),b
inc l : ld (hl),a
ld l,126 : ld (hl),a
inc l : ld (hl),b
inc l : ld (hl),b
inc l : ld (hl),a
ld l,142 : ld (hl),a
inc l : ld (hl),b
ld l,161 : ld (hl),b
inc l : ld (hl),a
ld l,173 : ld (hl),a
inc l : ld (hl),b
ret
Title: Re: Amstrad Plus sprite compiler v1.0
Post by: roudoudou on 13:48, 23 September 18
There is no PUSH version for full sprite compilation. Maybe in a future release.
Title: Re: Amstrad Plus sprite compiler v1.0
Post by: fgbrain on 12:38, 07 October 18
sorry for my dump questions .. BUT:

1)  "file1"   contains what  (raw data or asm text) ??
2) 
what do you mean by " difference " ??
3) what is a metasprite  ??


Title: Re: Amstrad Plus sprite compiler v1.0
Post by: roudoudou on 16:39, 07 October 18
sorry for my dump questions .. BUT:

1)  "file1"   contains what  (raw data or asm text) ??
2) 
what do you mean by " difference " ??
3) what is a metasprite  ??
file1 is a raw data sprite (256 bytes)
difference need file1 and file2 -> the generated code makes changes from sprite1 to sprite2
a metasprite is a bundle of sprites. If you need two consecutives sprites for an object, you can chain the code by removing final RET and adding an INC H

Title: Re: Amstrad Plus sprite compiler v1.0
Post by: Shining on 18:29, 14 December 18
Little off-topic here:


Compiling a sprite-animation with this tool for a straight-forward animation is a great thing.


But is there any clever idea to reduce the amount of data which has to be written to a hardware-sprite which has different animations in all 8 directions without using 8 hw-sprites ?
Title: Re: Amstrad Plus sprite compiler v1.0
Post by: roudoudou on 12:03, 01 July 19
a small update for the tool


you may compile multiple diff with only one variable input file...


Code: [Select]
compiler.exe -d sprite%02d.spr

and the compiler will try to start from 0 or 1 then increment counter until there is no more files found


another behaviour may be useful with big sprite binaries


Code: [Select]
compiler.exe -d planche.bin -idx 0-10,40,30-40,55 planche.bin -idx 1-11,41,31,41,0

and the compiler will load planche.bin (must be at least 56*256 bytes) twice
and run differences for 0-1, 1-2, 2-3 ...  40-41, ... 55-0
the 2 -idx sequences description MUST describe sequences with the very same count


binaries+sources updated in the first post



Title: Re: Amstrad Plus sprite compiler v1.0
Post by: GUNHED on 23:51, 01 July 19
On 6128 Plus I use the GMSK utility to convert MODE 0 screen parts into sprite date (4 x 4 sprites). But for PC I didn't see a solution before.  :)
Title: Re: Amstrad Plus sprite compiler v1.0
Post by: roudoudou on 23:56, 01 July 19
On 6128 Plus I use the GMSK utility to convert MODE 0 screen parts into sprite date (4 x 4 sprites). But for PC I didn't see a solution before.  :)
i have a converter from PNG but it's still in progress (cause it is supposed to manage many conversions)

now i'm working on optimisations for the sprite compiler (and multi-threading to boost multi-compilations)
Title: Re: Amstrad Plus sprite compiler v1.0
Post by: GUNHED on 15:50, 02 July 19
Nice!!!  ;D
Title: Re: Amstrad Plus sprite compiler v1.2
Post by: roudoudou on 21:53, 02 July 19
update 1.2 with bugfixed, better optimizer and multi-threaded batch computations (x10 boost!!!)
Title: Re: Amstrad Plus sprite compiler v1.3
Post by: roudoudou on 11:19, 17 April 20
update 1.3 with better register reallocation  8)
Title: Re: Amstrad Plus sprite compiler v1.3
Post by: Sykobee (Briggsy) on 12:05, 17 April 20
A clever tool to optimise plus animated sprites - how does it handle the first sprite in a sequence and looping around, and changing to a different sequence of sprites? I guess there will need to be a few 'key frame' sprites for these cases?
Title: Re: Amstrad Plus sprite compiler v1.3
Post by: roudoudou on 12:11, 17 April 20
Correct, you need to create a keyframe to begin, with the tool or not (option -c)

But to switch between different sequences you just need different compilations and manage cases as you like