Jump to content
IGNORED

Grids - 1k intro


MaPa

Recommended Posts

I really love your releases. First I see the effect and think: "How the hell..." Then I look at the source and think "Why the hell...".

Very nice again. When I saw the unrolled code in the source :? :? :? , then I realized it must be for the benefit of the packing ratio.

Is this a custom RLE packer?

Link to comment
Share on other sites

When I saw the unrolled code in the source :? :? :? , then I realized it must be for the benefit of the packing ratio.

 

Usually, unrolled code is done for speed. If you use a packer that can recognize it, then all the better.

Link to comment
Share on other sites

Yes, the unrolled code (and redundant repeating code) is for the benefit when packing as the packer is based on LZ77 algorithm. Btw. I'm not so happy with this intro but lack of time and ideas forced me to use 2 years old code and finish it to have at least some entry for compo. I coded it (the main effect) after Bitplanes intro (which was on New year's disk 2010) as it uses similar approach.

Edited by MaPa
Link to comment
Share on other sites

unrolled means that you expand code to avoid loops.

 

f.e.

 

LDX #10

loop LDA #

STA MEM,X

DEX

BNE LOOP

 

can be unrolled to

 

LDA #

STA MEM

STA MEM+1

 

STA MEM+2

 

STA MEM+3

 

STA MEM+4

 

STA MEM+5

 

STA MEM+6

 

STA MEM+7

 

STA MEM+8

 

STA MEM+9

 

as an example. costs memory but saves CPU cycles as you don't need the loop commands like BNE, DEX etc

  • Like 1
Link to comment
Share on other sites

or what packers might like would be

 

LDA #

LDX #10

STA MEM,X

DEX

 

STA MEM,X

DEX

 

STA MEM,X

DEX

 

STA MEM,X

DEX

 

STA MEM,X

DEX

 

STA MEM,X

DEX

 

STA MEM,X

DEX

 

STA MEM,X

DEX

 

STA MEM,X

DEX

 

STA MEM,X

DEX

 

STA MEM,X

DEX

 

so packer might recognise the sequenze STA MEM,X DEX so packer could save "put 10 times following sequenze into memory" STA MEM,X DEX

  • Like 1
Link to comment
Share on other sites

Unrolled code mean code which could be writte as (short but slow) loop is "unrolled" into a linear sequence of (long but fast) code.

As Bryan stated this is normally done to trade space for speed.


ldx #0
sta $d000,x
inx
adc #24
cpx #8
bne loop

 

The following saves the "BNE" at the expense of 8 times the memory.

ldx #0
sta $d000,x
inx
adc #24
sta $d000,x
inx
adc #24
sta $d000,x
inx
adc #24
sta $d000,x
inx
adc #24
sta $d000,x
inx
adc #24
sta $d000,x
inx
adc #24
sta $d000,x
inx
adc #24
sta $d000,x
inx
adc #24

 

MaPa's intro contains a very neat (small) unpacker which makes it worth while to unroll the code and let the packer compress it.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...