1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-06-02 00:41:42 +00:00
kickc/src/test/ref/examples/multiplexer/simple-multiplexer.log
2019-04-20 22:12:56 +02:00

4351 lines
234 KiB
Plaintext

Fixing pointer array-indexing *((word[PLEX_COUNT]) PLEX_XPOS + (byte) plexShowSprite::xpos_idx)
Fixing pointer array-indexing *((word[PLEX_COUNT]) PLEX_XPOS + (byte) plexShowSprite::xpos_idx)
Fixing pointer array-indexing *((word[PLEX_COUNT]) PLEX_XPOS + (byte) init::sx)
Identified constant variable (byte*) SCREEN
Identified constant variable (byte*) SPRITE
Identified constant variable (byte*) YSIN
Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx
Inlined call call plexSetScreen (byte*) plexInit::screen
Inlined call call plexFreePrepare
Inlined call call plexFreeAdd (byte) plexShowSprite::ypos
Inlined call (byte~) loop::$7 ← call plexFreeNextYpos
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
(byte*) SPRITES_XPOS#0 ← ((byte*)) (word/dword/signed dword) $d000
(byte*) SPRITES_YPOS#0 ← ((byte*)) (word/dword/signed dword) $d001
(byte*) SPRITES_XMSB#0 ← ((byte*)) (word/dword/signed dword) $d010
(byte*) RASTER#0 ← ((byte*)) (word/dword/signed dword) $d012
(byte*) SPRITES_ENABLE#0 ← ((byte*)) (word/dword/signed dword) $d015
(byte*) BORDERCOL#0 ← ((byte*)) (word/dword/signed dword) $d020
(byte*) SPRITES_COLS#0 ← ((byte*)) (word/dword/signed dword) $d027
(byte*) D011#0 ← ((byte*)) (word/dword/signed dword) $d011
(byte) VIC_RST8#0 ← (byte/word/signed word/dword/signed dword) $80
(byte) VIC_DEN#0 ← (byte/signed byte/word/signed word/dword/signed dword) $10
(byte) VIC_RSEL#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8
(byte) BLACK#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
(byte) GREEN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 5
to:@4
@4: scope:[] from @begin
(byte) PLEX_COUNT#0 ← (byte/signed byte/word/signed word/dword/signed dword) $20
(word[PLEX_COUNT#0]) PLEX_XPOS#0 ← { fill( PLEX_COUNT#0, 0) }
(byte[PLEX_COUNT#0]) PLEX_YPOS#0 ← { fill( PLEX_COUNT#0, 0) }
(byte[PLEX_COUNT#0]) PLEX_PTR#0 ← { fill( PLEX_COUNT#0, 0) }
(word/signed word/dword/signed dword~) $0 ← (word/signed word/dword/signed dword) $400 + (word/signed word/dword/signed dword) $3f8
(byte*) PLEX_SCREEN_PTR#0 ← ((byte*)) (word/signed word/dword/signed dword~) $0
(byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 ← { fill( PLEX_COUNT#0, 0) }
(byte) plex_show_idx#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
(byte) plex_sprite_idx#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
(byte) plex_sprite_msb#0 ← (byte/signed byte/word/signed word/dword/signed dword) 1
to:@9
plexInit: scope:[plexInit] from init
(byte*) plexInit::screen#1 ← phi( init/(byte*) plexInit::screen#0 )
(byte*) plexInit::plexSetScreen1_screen#0 ← (byte*) plexInit::screen#1
to:plexInit::plexSetScreen1
plexInit::plexSetScreen1: scope:[plexInit] from plexInit
(byte*) plexInit::plexSetScreen1_screen#1 ← phi( plexInit/(byte*) plexInit::plexSetScreen1_screen#0 )
(byte*) plexInit::plexSetScreen1_$0#0 ← (byte*) plexInit::plexSetScreen1_screen#1 + (word/signed word/dword/signed dword) $3f8
(byte*) PLEX_SCREEN_PTR#1 ← (byte*) plexInit::plexSetScreen1_$0#0
to:plexInit::@3
plexInit::@3: scope:[plexInit] from plexInit::plexSetScreen1
(byte*) PLEX_SCREEN_PTR#22 ← phi( plexInit::plexSetScreen1/(byte*) PLEX_SCREEN_PTR#1 )
(byte/signed word/word/dword/signed dword~) plexInit::$1 ← (byte) PLEX_COUNT#0 - (byte/signed byte/word/signed word/dword/signed dword) 1
(byte) plexInit::i#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
to:plexInit::@1
plexInit::@1: scope:[plexInit] from plexInit::@1 plexInit::@3
(byte*) PLEX_SCREEN_PTR#15 ← phi( plexInit::@1/(byte*) PLEX_SCREEN_PTR#15 plexInit::@3/(byte*) PLEX_SCREEN_PTR#22 )
(byte) plexInit::i#2 ← phi( plexInit::@1/(byte) plexInit::i#1 plexInit::@3/(byte) plexInit::i#0 )
*((byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexInit::i#2) ← (byte) plexInit::i#2
(byte) plexInit::i#1 ← (byte) plexInit::i#2 + rangenext(0,plexInit::$1)
(bool~) plexInit::$2 ← (byte) plexInit::i#1 != rangelast(0,plexInit::$1)
if((bool~) plexInit::$2) goto plexInit::@1
to:plexInit::@return
plexInit::@return: scope:[plexInit] from plexInit::@1
(byte*) PLEX_SCREEN_PTR#8 ← phi( plexInit::@1/(byte*) PLEX_SCREEN_PTR#15 )
(byte*) PLEX_SCREEN_PTR#2 ← (byte*) PLEX_SCREEN_PTR#8
return
to:@return
plexSort: scope:[plexSort] from loop::@11
(byte/signed word/word/dword/signed dword~) plexSort::$1 ← (byte) PLEX_COUNT#0 - (byte/signed byte/word/signed word/dword/signed dword) 2
(byte) plexSort::m#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
to:plexSort::@1
plexSort::@1: scope:[plexSort] from plexSort plexSort::@2
(byte) plexSort::m#2 ← phi( plexSort/(byte) plexSort::m#0 plexSort::@2/(byte) plexSort::m#1 )
(byte/signed word/word/dword/signed dword~) plexSort::$2 ← (byte) plexSort::m#2 + (byte/signed byte/word/signed word/dword/signed dword) 1
(byte) plexSort::nxt_idx#0 ← *((byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte/signed word/word/dword/signed dword~) plexSort::$2)
(byte) plexSort::nxt_y#0 ← *((byte[PLEX_COUNT#0]) PLEX_YPOS#0 + (byte) plexSort::nxt_idx#0)
(bool~) plexSort::$3 ← (byte) plexSort::nxt_y#0 < *((byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::m#2))
(bool~) plexSort::$4 ← ! (bool~) plexSort::$3
if((bool~) plexSort::$4) goto plexSort::@2
to:plexSort::@5
plexSort::@2: scope:[plexSort] from plexSort::@1 plexSort::@4
(byte) plexSort::m#3 ← phi( plexSort::@1/(byte) plexSort::m#2 plexSort::@4/(byte) plexSort::m#5 )
(byte) plexSort::m#1 ← (byte) plexSort::m#3 + rangenext(0,plexSort::$1)
(bool~) plexSort::$9 ← (byte) plexSort::m#1 != rangelast(0,plexSort::$1)
if((bool~) plexSort::$9) goto plexSort::@1
to:plexSort::@6
plexSort::@5: scope:[plexSort] from plexSort::@1
(byte) plexSort::nxt_idx#3 ← phi( plexSort::@1/(byte) plexSort::nxt_idx#0 )
(byte) plexSort::nxt_y#2 ← phi( plexSort::@1/(byte) plexSort::nxt_y#0 )
(byte) plexSort::m#4 ← phi( plexSort::@1/(byte) plexSort::m#2 )
(byte) plexSort::s#0 ← (byte) plexSort::m#4
to:plexSort::@3
plexSort::@3: scope:[plexSort] from plexSort::@3 plexSort::@5
(byte) plexSort::m#6 ← phi( plexSort::@3/(byte) plexSort::m#6 plexSort::@5/(byte) plexSort::m#4 )
(byte) plexSort::nxt_idx#2 ← phi( plexSort::@3/(byte) plexSort::nxt_idx#2 plexSort::@5/(byte) plexSort::nxt_idx#3 )
(byte) plexSort::nxt_y#1 ← phi( plexSort::@3/(byte) plexSort::nxt_y#1 plexSort::@5/(byte) plexSort::nxt_y#2 )
(byte) plexSort::s#3 ← phi( plexSort::@3/(byte) plexSort::s#1 plexSort::@5/(byte) plexSort::s#0 )
(byte/signed word/word/dword/signed dword~) plexSort::$5 ← (byte) plexSort::s#3 + (byte/signed byte/word/signed word/dword/signed dword) 1
*((byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte/signed word/word/dword/signed dword~) plexSort::$5) ← *((byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#3)
(byte) plexSort::s#1 ← -- (byte) plexSort::s#3
(bool~) plexSort::$6 ← (byte) plexSort::s#1 != (byte/word/signed word/dword/signed dword) $ff
(bool~) plexSort::$7 ← (byte) plexSort::nxt_y#1 < *((byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#1))
(bool~) plexSort::$8 ← (bool~) plexSort::$6 && (bool~) plexSort::$7
if((bool~) plexSort::$8) goto plexSort::@3
to:plexSort::@4
plexSort::@4: scope:[plexSort] from plexSort::@3
(byte) plexSort::m#5 ← phi( plexSort::@3/(byte) plexSort::m#6 )
(byte) plexSort::nxt_idx#1 ← phi( plexSort::@3/(byte) plexSort::nxt_idx#2 )
(byte) plexSort::s#4 ← phi( plexSort::@3/(byte) plexSort::s#1 )
(byte) plexSort::s#2 ← ++ (byte) plexSort::s#4
*((byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#2) ← (byte) plexSort::nxt_idx#1
to:plexSort::@2
plexSort::@6: scope:[plexSort] from plexSort::@2
(byte) plex_show_idx#1 ← (byte/signed byte/word/signed word/dword/signed dword) 0
(byte) plex_sprite_idx#1 ← (byte/signed byte/word/signed word/dword/signed dword) 0
(byte) plex_sprite_msb#1 ← (byte/signed byte/word/signed word/dword/signed dword) 1
to:plexSort::plexFreePrepare1
plexSort::plexFreePrepare1: scope:[plexSort] from plexSort::@6
(byte) plex_sprite_msb#39 ← phi( plexSort::@6/(byte) plex_sprite_msb#1 )
(byte) plex_sprite_idx#40 ← phi( plexSort::@6/(byte) plex_sprite_idx#1 )
(byte) plex_show_idx#40 ← phi( plexSort::@6/(byte) plex_show_idx#1 )
(byte) plexSort::plexFreePrepare1_s#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
to:plexSort::plexFreePrepare1_@1
plexSort::plexFreePrepare1_@1: scope:[plexSort] from plexSort::plexFreePrepare1 plexSort::plexFreePrepare1_@1
(byte) plex_sprite_msb#31 ← phi( plexSort::plexFreePrepare1/(byte) plex_sprite_msb#39 plexSort::plexFreePrepare1_@1/(byte) plex_sprite_msb#31 )
(byte) plex_sprite_idx#33 ← phi( plexSort::plexFreePrepare1/(byte) plex_sprite_idx#40 plexSort::plexFreePrepare1_@1/(byte) plex_sprite_idx#33 )
(byte) plex_show_idx#33 ← phi( plexSort::plexFreePrepare1/(byte) plex_show_idx#40 plexSort::plexFreePrepare1_@1/(byte) plex_show_idx#33 )
(byte) plexSort::plexFreePrepare1_s#2 ← phi( plexSort::plexFreePrepare1/(byte) plexSort::plexFreePrepare1_s#0 plexSort::plexFreePrepare1_@1/(byte) plexSort::plexFreePrepare1_s#1 )
*((byte[8]) PLEX_FREE_YPOS#0 + (byte) plexSort::plexFreePrepare1_s#2) ← (byte/signed byte/word/signed word/dword/signed dword) 0
(byte) plexSort::plexFreePrepare1_s#1 ← (byte) plexSort::plexFreePrepare1_s#2 + rangenext(0,7)
(bool) plexSort::plexFreePrepare1_$0#0 ← (byte) plexSort::plexFreePrepare1_s#1 != rangelast(0,7)
if((bool) plexSort::plexFreePrepare1_$0#0) goto plexSort::plexFreePrepare1_@1
to:plexSort::plexFreePrepare1_@2
plexSort::plexFreePrepare1_@2: scope:[plexSort] from plexSort::plexFreePrepare1_@1
(byte) plex_sprite_msb#23 ← phi( plexSort::plexFreePrepare1_@1/(byte) plex_sprite_msb#31 )
(byte) plex_sprite_idx#22 ← phi( plexSort::plexFreePrepare1_@1/(byte) plex_sprite_idx#33 )
(byte) plex_show_idx#22 ← phi( plexSort::plexFreePrepare1_@1/(byte) plex_show_idx#33 )
(byte) plex_free_next#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
to:plexSort::@return
plexSort::@return: scope:[plexSort] from plexSort::plexFreePrepare1_@2
(byte) plex_free_next#11 ← phi( plexSort::plexFreePrepare1_@2/(byte) plex_free_next#0 )
(byte) plex_sprite_msb#12 ← phi( plexSort::plexFreePrepare1_@2/(byte) plex_sprite_msb#23 )
(byte) plex_sprite_idx#11 ← phi( plexSort::plexFreePrepare1_@2/(byte) plex_sprite_idx#22 )
(byte) plex_show_idx#11 ← phi( plexSort::plexFreePrepare1_@2/(byte) plex_show_idx#22 )
(byte) plex_show_idx#2 ← (byte) plex_show_idx#11
(byte) plex_sprite_idx#2 ← (byte) plex_sprite_idx#11
(byte) plex_sprite_msb#2 ← (byte) plex_sprite_msb#12
(byte) plex_free_next#1 ← (byte) plex_free_next#11
return
to:@return
plexShowSprite: scope:[plexShowSprite] from loop::@21
(byte) plex_sprite_msb#40 ← phi( loop::@21/(byte) plex_sprite_msb#28 )
(byte*) PLEX_SCREEN_PTR#23 ← phi( loop::@21/(byte*) PLEX_SCREEN_PTR#26 )
(byte) plex_free_next#21 ← phi( loop::@21/(byte) plex_free_next#27 )
(byte) plex_show_idx#12 ← phi( loop::@21/(byte) plex_show_idx#23 )
(byte) plex_sprite_idx#12 ← phi( loop::@21/(byte) plex_sprite_idx#23 )
(byte~) plexShowSprite::$0 ← (byte) plex_sprite_idx#12 << (byte/signed byte/word/signed word/dword/signed dword) 1
(byte) plexShowSprite::plex_sprite_idx2#0 ← (byte~) plexShowSprite::$0
(byte) plexShowSprite::ypos#0 ← *((byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#12))
*((byte*) SPRITES_YPOS#0 + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte) plexShowSprite::ypos#0
(byte) plexShowSprite::plexFreeAdd1_ypos#0 ← (byte) plexShowSprite::ypos#0
to:plexShowSprite::plexFreeAdd1
plexShowSprite::plexFreeAdd1: scope:[plexShowSprite] from plexShowSprite
(byte) plex_sprite_msb#32 ← phi( plexShowSprite/(byte) plex_sprite_msb#40 )
(byte) plexShowSprite::plex_sprite_idx2#2 ← phi( plexShowSprite/(byte) plexShowSprite::plex_sprite_idx2#0 )
(byte) plex_sprite_idx#24 ← phi( plexShowSprite/(byte) plex_sprite_idx#12 )
(byte*) PLEX_SCREEN_PTR#16 ← phi( plexShowSprite/(byte*) PLEX_SCREEN_PTR#23 )
(byte) plex_show_idx#24 ← phi( plexShowSprite/(byte) plex_show_idx#12 )
(byte) plex_free_next#12 ← phi( plexShowSprite/(byte) plex_free_next#21 )
(byte) plexShowSprite::plexFreeAdd1_ypos#1 ← phi( plexShowSprite/(byte) plexShowSprite::plexFreeAdd1_ypos#0 )
(byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0 ← (byte) plexShowSprite::plexFreeAdd1_ypos#1 + (byte/signed byte/word/signed word/dword/signed dword) $15
*((byte[8]) PLEX_FREE_YPOS#0 + (byte) plex_free_next#12) ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0
(byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 ← (byte) plex_free_next#12 + (byte/signed byte/word/signed word/dword/signed dword) 1
(byte/word/dword) plexShowSprite::plexFreeAdd1_$2#0 ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 & (byte/signed byte/word/signed word/dword/signed dword) 7
(byte) plex_free_next#2 ← (byte/word/dword) plexShowSprite::plexFreeAdd1_$2#0
to:plexShowSprite::@7
plexShowSprite::@7: scope:[plexShowSprite] from plexShowSprite::plexFreeAdd1
(byte) plex_free_next#44 ← phi( plexShowSprite::plexFreeAdd1/(byte) plex_free_next#2 )
(byte) plex_sprite_msb#24 ← phi( plexShowSprite::plexFreeAdd1/(byte) plex_sprite_msb#32 )
(byte) plexShowSprite::plex_sprite_idx2#1 ← phi( plexShowSprite::plexFreeAdd1/(byte) plexShowSprite::plex_sprite_idx2#2 )
(byte) plex_sprite_idx#13 ← phi( plexShowSprite::plexFreeAdd1/(byte) plex_sprite_idx#24 )
(byte*) PLEX_SCREEN_PTR#9 ← phi( plexShowSprite::plexFreeAdd1/(byte*) PLEX_SCREEN_PTR#16 )
(byte) plex_show_idx#13 ← phi( plexShowSprite::plexFreeAdd1/(byte) plex_show_idx#24 )
*((byte*) PLEX_SCREEN_PTR#9 + (byte) plex_sprite_idx#13) ← *((byte[PLEX_COUNT#0]) PLEX_PTR#0 + *((byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#13))
(byte) plexShowSprite::xpos_idx#0 ← *((byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#13)
(byte) plexShowSprite::$10 ← (byte) plexShowSprite::xpos_idx#0 * (const byte) SIZEOF_WORD
(byte~) plexShowSprite::$2 ← < *((word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::$10)
*((byte*) SPRITES_XPOS#0 + (byte) plexShowSprite::plex_sprite_idx2#1) ← (byte~) plexShowSprite::$2
(byte) plexShowSprite::$11 ← (byte) plexShowSprite::xpos_idx#0 * (const byte) SIZEOF_WORD
(byte~) plexShowSprite::$3 ← > *((word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::$11)
(bool~) plexShowSprite::$4 ← (byte~) plexShowSprite::$3 != (byte/signed byte/word/signed word/dword/signed dword) 0
if((bool~) plexShowSprite::$4) goto plexShowSprite::@1
to:plexShowSprite::@4
plexShowSprite::@1: scope:[plexShowSprite] from plexShowSprite::@7
(byte) plex_free_next#38 ← phi( plexShowSprite::@7/(byte) plex_free_next#44 )
(byte) plex_show_idx#25 ← phi( plexShowSprite::@7/(byte) plex_show_idx#13 )
(byte) plex_sprite_idx#25 ← phi( plexShowSprite::@7/(byte) plex_sprite_idx#13 )
(byte) plex_sprite_msb#13 ← phi( plexShowSprite::@7/(byte) plex_sprite_msb#24 )
*((byte*) SPRITES_XMSB#0) ← *((byte*) SPRITES_XMSB#0) | (byte) plex_sprite_msb#13
to:plexShowSprite::@2
plexShowSprite::@4: scope:[plexShowSprite] from plexShowSprite::@7
(byte) plex_free_next#39 ← phi( plexShowSprite::@7/(byte) plex_free_next#44 )
(byte) plex_show_idx#26 ← phi( plexShowSprite::@7/(byte) plex_show_idx#13 )
(byte) plex_sprite_idx#26 ← phi( plexShowSprite::@7/(byte) plex_sprite_idx#13 )
(byte) plex_sprite_msb#14 ← phi( plexShowSprite::@7/(byte) plex_sprite_msb#24 )
(byte/word/dword~) plexShowSprite::$9 ← (byte/word/signed word/dword/signed dword) $ff ^ (byte) plex_sprite_msb#14
*((byte*) SPRITES_XMSB#0) ← *((byte*) SPRITES_XMSB#0) & (byte/word/dword~) plexShowSprite::$9
to:plexShowSprite::@2
plexShowSprite::@2: scope:[plexShowSprite] from plexShowSprite::@1 plexShowSprite::@4
(byte) plex_free_next#30 ← phi( plexShowSprite::@1/(byte) plex_free_next#38 plexShowSprite::@4/(byte) plex_free_next#39 )
(byte) plex_sprite_msb#15 ← phi( plexShowSprite::@1/(byte) plex_sprite_msb#13 plexShowSprite::@4/(byte) plex_sprite_msb#14 )
(byte) plex_show_idx#14 ← phi( plexShowSprite::@1/(byte) plex_show_idx#25 plexShowSprite::@4/(byte) plex_show_idx#26 )
(byte) plex_sprite_idx#14 ← phi( plexShowSprite::@1/(byte) plex_sprite_idx#25 plexShowSprite::@4/(byte) plex_sprite_idx#26 )
(byte/signed word/word/dword/signed dword~) plexShowSprite::$5 ← (byte) plex_sprite_idx#14 + (byte/signed byte/word/signed word/dword/signed dword) 1
(byte/word/dword~) plexShowSprite::$6 ← (byte/signed word/word/dword/signed dword~) plexShowSprite::$5 & (byte/signed byte/word/signed word/dword/signed dword) 7
(byte) plex_sprite_idx#3 ← (byte/word/dword~) plexShowSprite::$6
(byte) plex_show_idx#3 ← ++ (byte) plex_show_idx#14
(byte) plex_sprite_msb#3 ← (byte) plex_sprite_msb#15 << (byte/signed byte/word/signed word/dword/signed dword) 1
(bool~) plexShowSprite::$7 ← (byte) plex_sprite_msb#3 == (byte/signed byte/word/signed word/dword/signed dword) 0
(bool~) plexShowSprite::$8 ← ! (bool~) plexShowSprite::$7
if((bool~) plexShowSprite::$8) goto plexShowSprite::@3
to:plexShowSprite::@6
plexShowSprite::@3: scope:[plexShowSprite] from plexShowSprite::@2
(byte) plex_sprite_msb#25 ← phi( plexShowSprite::@2/(byte) plex_sprite_msb#3 )
(byte) plex_show_idx#27 ← phi( plexShowSprite::@2/(byte) plex_show_idx#3 )
(byte) plex_sprite_idx#27 ← phi( plexShowSprite::@2/(byte) plex_sprite_idx#3 )
(byte) plex_free_next#22 ← phi( plexShowSprite::@2/(byte) plex_free_next#30 )
to:plexShowSprite::@return
plexShowSprite::@6: scope:[plexShowSprite] from plexShowSprite::@2
(byte) plex_show_idx#28 ← phi( plexShowSprite::@2/(byte) plex_show_idx#3 )
(byte) plex_sprite_idx#28 ← phi( plexShowSprite::@2/(byte) plex_sprite_idx#3 )
(byte) plex_free_next#23 ← phi( plexShowSprite::@2/(byte) plex_free_next#30 )
(byte) plex_sprite_msb#4 ← (byte/signed byte/word/signed word/dword/signed dword) 1
to:plexShowSprite::@return
plexShowSprite::@return: scope:[plexShowSprite] from plexShowSprite::@3 plexShowSprite::@6
(byte) plex_sprite_msb#16 ← phi( plexShowSprite::@3/(byte) plex_sprite_msb#25 plexShowSprite::@6/(byte) plex_sprite_msb#4 )
(byte) plex_show_idx#15 ← phi( plexShowSprite::@3/(byte) plex_show_idx#27 plexShowSprite::@6/(byte) plex_show_idx#28 )
(byte) plex_sprite_idx#15 ← phi( plexShowSprite::@3/(byte) plex_sprite_idx#27 plexShowSprite::@6/(byte) plex_sprite_idx#28 )
(byte) plex_free_next#13 ← phi( plexShowSprite::@3/(byte) plex_free_next#22 plexShowSprite::@6/(byte) plex_free_next#23 )
(byte) plex_free_next#3 ← (byte) plex_free_next#13
(byte) plex_sprite_idx#4 ← (byte) plex_sprite_idx#15
(byte) plex_show_idx#4 ← (byte) plex_show_idx#15
(byte) plex_sprite_msb#5 ← (byte) plex_sprite_msb#16
return
to:@return
@9: scope:[] from @4
(byte) plex_sprite_msb#41 ← phi( @4/(byte) plex_sprite_msb#0 )
(byte) plex_sprite_idx#41 ← phi( @4/(byte) plex_sprite_idx#0 )
(byte) plex_show_idx#41 ← phi( @4/(byte) plex_show_idx#0 )
(byte*) PLEX_SCREEN_PTR#27 ← phi( @4/(byte*) PLEX_SCREEN_PTR#0 )
(byte[8]) PLEX_FREE_YPOS#0 ← { fill( 8, 0) }
(byte) plex_free_next#4 ← (byte/signed byte/word/signed word/dword/signed dword) 0
to:@12
@12: scope:[] from @9
(byte) plex_free_next#37 ← phi( @9/(byte) plex_free_next#4 )
(byte) plex_sprite_msb#38 ← phi( @9/(byte) plex_sprite_msb#41 )
(byte) plex_sprite_idx#39 ← phi( @9/(byte) plex_sprite_idx#41 )
(byte) plex_show_idx#39 ← phi( @9/(byte) plex_show_idx#41 )
(byte*) PLEX_SCREEN_PTR#25 ← phi( @9/(byte*) PLEX_SCREEN_PTR#27 )
(byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) $400
(byte*) SPRITE#0 ← ((byte*)) (word/signed word/dword/signed dword) $2000
(byte*) YSIN#0 ← ((byte*)) (word/signed word/dword/signed dword) $2100
kickasm(location (byte*) YSIN#0) {{ .var min = 50
.var max = 250-21
.var ampl = max-min;
.for(var i=0;i<256;i++)
.byte round(min+(ampl/2)+(ampl/2)*sin(toRadians(360*i/256)))
}}
kickasm(location (byte*) SPRITE#0) {{ .var pic = LoadPicture("balloon.png", List().add($000000, $ffffff))
.for (var y=0; y<21; y++)
.for (var x=0;x<3; x++)
.byte pic.getSinglecolorByte(x,y)
}}
to:@15
main: scope:[main] from @15
(byte) plex_free_next#31 ← phi( @15/(byte) plex_free_next#29 )
(byte) plex_sprite_msb#33 ← phi( @15/(byte) plex_sprite_msb#30 )
(byte) plex_sprite_idx#34 ← phi( @15/(byte) plex_sprite_idx#32 )
(byte) plex_show_idx#34 ← phi( @15/(byte) plex_show_idx#32 )
(byte*) PLEX_SCREEN_PTR#17 ← phi( @15/(byte*) PLEX_SCREEN_PTR#21 )
asm { sei }
call init
to:main::@1
main::@1: scope:[main] from main
(byte) plex_free_next#24 ← phi( main/(byte) plex_free_next#31 )
(byte) plex_sprite_msb#26 ← phi( main/(byte) plex_sprite_msb#33 )
(byte) plex_sprite_idx#29 ← phi( main/(byte) plex_sprite_idx#34 )
(byte) plex_show_idx#29 ← phi( main/(byte) plex_show_idx#34 )
(byte*) PLEX_SCREEN_PTR#10 ← phi( main/(byte*) PLEX_SCREEN_PTR#6 )
(byte*) PLEX_SCREEN_PTR#3 ← (byte*) PLEX_SCREEN_PTR#10
call loop
to:main::@2
main::@2: scope:[main] from main::@1
(byte*) PLEX_SCREEN_PTR#18 ← phi( main::@1/(byte*) PLEX_SCREEN_PTR#3 )
(byte) plex_free_next#14 ← phi( main::@1/(byte) plex_free_next#9 )
(byte) plex_sprite_msb#17 ← phi( main::@1/(byte) plex_sprite_msb#10 )
(byte) plex_sprite_idx#16 ← phi( main::@1/(byte) plex_sprite_idx#9 )
(byte) plex_show_idx#16 ← phi( main::@1/(byte) plex_show_idx#9 )
(byte) plex_show_idx#5 ← (byte) plex_show_idx#16
(byte) plex_sprite_idx#5 ← (byte) plex_sprite_idx#16
(byte) plex_sprite_msb#6 ← (byte) plex_sprite_msb#17
(byte) plex_free_next#5 ← (byte) plex_free_next#14
to:main::@return
main::@return: scope:[main] from main::@2
(byte) plex_free_next#15 ← phi( main::@2/(byte) plex_free_next#5 )
(byte) plex_sprite_msb#18 ← phi( main::@2/(byte) plex_sprite_msb#6 )
(byte) plex_sprite_idx#17 ← phi( main::@2/(byte) plex_sprite_idx#5 )
(byte) plex_show_idx#17 ← phi( main::@2/(byte) plex_show_idx#5 )
(byte*) PLEX_SCREEN_PTR#11 ← phi( main::@2/(byte*) PLEX_SCREEN_PTR#18 )
(byte*) PLEX_SCREEN_PTR#4 ← (byte*) PLEX_SCREEN_PTR#11
(byte) plex_show_idx#6 ← (byte) plex_show_idx#17
(byte) plex_sprite_idx#6 ← (byte) plex_sprite_idx#17
(byte) plex_sprite_msb#7 ← (byte) plex_sprite_msb#18
(byte) plex_free_next#6 ← (byte) plex_free_next#15
return
to:@return
init: scope:[init] from main
(byte*) PLEX_SCREEN_PTR#19 ← phi( main/(byte*) PLEX_SCREEN_PTR#17 )
(byte~) init::$0 ← (byte) VIC_DEN#0 | (byte) VIC_RSEL#0
(byte/word/dword~) init::$1 ← (byte~) init::$0 | (byte/signed byte/word/signed word/dword/signed dword) 3
*((byte*) D011#0) ← (byte/word/dword~) init::$1
(byte*) plexInit::screen#0 ← (byte*) SCREEN#0
call plexInit
to:init::@5
init::@5: scope:[init] from init
(byte*) PLEX_SCREEN_PTR#12 ← phi( init/(byte*) PLEX_SCREEN_PTR#2 )
(byte*) PLEX_SCREEN_PTR#5 ← (byte*) PLEX_SCREEN_PTR#12
(word) init::xp#0 ← (byte/signed byte/word/signed word/dword/signed dword) $20
(byte/signed word/word/dword/signed dword~) init::$3 ← (byte) PLEX_COUNT#0 - (byte/signed byte/word/signed word/dword/signed dword) 1
(byte) init::sx#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
to:init::@1
init::@1: scope:[init] from init::@1 init::@5
(byte*) PLEX_SCREEN_PTR#28 ← phi( init::@1/(byte*) PLEX_SCREEN_PTR#28 init::@5/(byte*) PLEX_SCREEN_PTR#5 )
(word) init::xp#2 ← phi( init::@1/(word) init::xp#1 init::@5/(word) init::xp#0 )
(byte) init::sx#2 ← phi( init::@1/(byte) init::sx#1 init::@5/(byte) init::sx#0 )
(byte*~) init::$4 ← (byte*) SPRITE#0 / (byte/signed byte/word/signed word/dword/signed dword) $40
(byte~) init::$5 ← ((byte)) (byte*~) init::$4
*((byte[PLEX_COUNT#0]) PLEX_PTR#0 + (byte) init::sx#2) ← (byte~) init::$5
(byte) init::$8 ← (byte) init::sx#2 * (const byte) SIZEOF_WORD
*((word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) init::$8) ← (word) init::xp#2
(word) init::xp#1 ← (word) init::xp#2 + (byte/signed byte/word/signed word/dword/signed dword) 9
(byte) init::sx#1 ← (byte) init::sx#2 + rangenext(0,init::$3)
(bool~) init::$6 ← (byte) init::sx#1 != rangelast(0,init::$3)
if((bool~) init::$6) goto init::@1
to:init::@2
init::@2: scope:[init] from init::@1
(byte*) PLEX_SCREEN_PTR#24 ← phi( init::@1/(byte*) PLEX_SCREEN_PTR#28 )
*((byte*) SPRITES_ENABLE#0) ← (byte/word/signed word/dword/signed dword) $ff
(byte) init::ss#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
to:init::@3
init::@3: scope:[init] from init::@2 init::@3
(byte*) PLEX_SCREEN_PTR#20 ← phi( init::@2/(byte*) PLEX_SCREEN_PTR#24 init::@3/(byte*) PLEX_SCREEN_PTR#20 )
(byte) init::ss#2 ← phi( init::@2/(byte) init::ss#0 init::@3/(byte) init::ss#1 )
*((byte*) SPRITES_COLS#0 + (byte) init::ss#2) ← (byte) GREEN#0
(byte) init::ss#1 ← (byte) init::ss#2 + rangenext(0,7)
(bool~) init::$7 ← (byte) init::ss#1 != rangelast(0,7)
if((bool~) init::$7) goto init::@3
to:init::@return
init::@return: scope:[init] from init::@3
(byte*) PLEX_SCREEN_PTR#13 ← phi( init::@3/(byte*) PLEX_SCREEN_PTR#20 )
(byte*) PLEX_SCREEN_PTR#6 ← (byte*) PLEX_SCREEN_PTR#13
return
to:@return
loop: scope:[loop] from main::@1
(byte*) PLEX_SCREEN_PTR#47 ← phi( main::@1/(byte*) PLEX_SCREEN_PTR#3 )
(byte) plex_free_next#32 ← phi( main::@1/(byte) plex_free_next#24 )
(byte) plex_sprite_msb#34 ← phi( main::@1/(byte) plex_sprite_msb#26 )
(byte) plex_sprite_idx#35 ← phi( main::@1/(byte) plex_sprite_idx#29 )
(byte) plex_show_idx#35 ← phi( main::@1/(byte) plex_show_idx#29 )
(byte) loop::sin_idx#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
to:loop::@1
loop::@1: scope:[loop] from loop loop::@25
(byte*) PLEX_SCREEN_PTR#46 ← phi( loop/(byte*) PLEX_SCREEN_PTR#47 loop::@25/(byte*) PLEX_SCREEN_PTR#48 )
(byte) loop::sin_idx#8 ← phi( loop/(byte) loop::sin_idx#0 loop::@25/(byte) loop::sin_idx#9 )
(byte) plex_free_next#28 ← phi( loop/(byte) plex_free_next#32 loop::@25/(byte) plex_free_next#33 )
(byte) plex_sprite_msb#29 ← phi( loop/(byte) plex_sprite_msb#34 loop::@25/(byte) plex_sprite_msb#35 )
(byte) plex_sprite_idx#31 ← phi( loop/(byte) plex_sprite_idx#35 loop::@25/(byte) plex_sprite_idx#36 )
(byte) plex_show_idx#31 ← phi( loop/(byte) plex_show_idx#35 loop::@25/(byte) plex_show_idx#36 )
if(true) goto loop::@2
to:loop::@return
loop::@2: scope:[loop] from loop::@1
(byte*) PLEX_SCREEN_PTR#44 ← phi( loop::@1/(byte*) PLEX_SCREEN_PTR#46 )
(byte) plex_free_next#48 ← phi( loop::@1/(byte) plex_free_next#28 )
(byte) plex_sprite_msb#47 ← phi( loop::@1/(byte) plex_sprite_msb#29 )
(byte) plex_sprite_idx#47 ← phi( loop::@1/(byte) plex_sprite_idx#31 )
(byte) plex_show_idx#47 ← phi( loop::@1/(byte) plex_show_idx#31 )
(byte) loop::sin_idx#6 ← phi( loop::@1/(byte) loop::sin_idx#8 )
to:loop::@4
loop::@4: scope:[loop] from loop::@2 loop::@5
(byte*) PLEX_SCREEN_PTR#43 ← phi( loop::@2/(byte*) PLEX_SCREEN_PTR#44 loop::@5/(byte*) PLEX_SCREEN_PTR#45 )
(byte) plex_free_next#45 ← phi( loop::@2/(byte) plex_free_next#48 loop::@5/(byte) plex_free_next#49 )
(byte) plex_sprite_msb#45 ← phi( loop::@2/(byte) plex_sprite_msb#47 loop::@5/(byte) plex_sprite_msb#48 )
(byte) plex_sprite_idx#45 ← phi( loop::@2/(byte) plex_sprite_idx#47 loop::@5/(byte) plex_sprite_idx#48 )
(byte) plex_show_idx#45 ← phi( loop::@2/(byte) plex_show_idx#47 loop::@5/(byte) plex_show_idx#48 )
(byte) loop::sin_idx#4 ← phi( loop::@2/(byte) loop::sin_idx#6 loop::@5/(byte) loop::sin_idx#7 )
(bool~) loop::$0 ← *((byte*) RASTER#0) != (byte/word/signed word/dword/signed dword) $ff
if((bool~) loop::$0) goto loop::@5
to:loop::@6
loop::@5: scope:[loop] from loop::@4
(byte*) PLEX_SCREEN_PTR#45 ← phi( loop::@4/(byte*) PLEX_SCREEN_PTR#43 )
(byte) plex_free_next#49 ← phi( loop::@4/(byte) plex_free_next#45 )
(byte) plex_sprite_msb#48 ← phi( loop::@4/(byte) plex_sprite_msb#45 )
(byte) plex_sprite_idx#48 ← phi( loop::@4/(byte) plex_sprite_idx#45 )
(byte) plex_show_idx#48 ← phi( loop::@4/(byte) plex_show_idx#45 )
(byte) loop::sin_idx#7 ← phi( loop::@4/(byte) loop::sin_idx#4 )
to:loop::@4
loop::@6: scope:[loop] from loop::@4
(byte*) PLEX_SCREEN_PTR#42 ← phi( loop::@4/(byte*) PLEX_SCREEN_PTR#43 )
(byte) plex_free_next#40 ← phi( loop::@4/(byte) plex_free_next#45 )
(byte) plex_sprite_msb#42 ← phi( loop::@4/(byte) plex_sprite_msb#45 )
(byte) plex_sprite_idx#42 ← phi( loop::@4/(byte) plex_sprite_idx#45 )
(byte) plex_show_idx#42 ← phi( loop::@4/(byte) plex_show_idx#45 )
(byte) loop::sin_idx#2 ← phi( loop::@4/(byte) loop::sin_idx#4 )
*((byte*) BORDERCOL#0) ← ++ *((byte*) BORDERCOL#0)
(byte) loop::y_idx#0 ← (byte) loop::sin_idx#2
(byte/signed word/word/dword/signed dword~) loop::$1 ← (byte) PLEX_COUNT#0 - (byte/signed byte/word/signed word/dword/signed dword) 1
(byte) loop::sy#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
to:loop::@10
loop::@10: scope:[loop] from loop::@10 loop::@6
(byte*) PLEX_SCREEN_PTR#41 ← phi( loop::@10/(byte*) PLEX_SCREEN_PTR#41 loop::@6/(byte*) PLEX_SCREEN_PTR#42 )
(byte) plex_free_next#34 ← phi( loop::@10/(byte) plex_free_next#34 loop::@6/(byte) plex_free_next#40 )
(byte) plex_sprite_msb#36 ← phi( loop::@10/(byte) plex_sprite_msb#36 loop::@6/(byte) plex_sprite_msb#42 )
(byte) plex_sprite_idx#37 ← phi( loop::@10/(byte) plex_sprite_idx#37 loop::@6/(byte) plex_sprite_idx#42 )
(byte) plex_show_idx#37 ← phi( loop::@10/(byte) plex_show_idx#37 loop::@6/(byte) plex_show_idx#42 )
(byte) loop::sin_idx#5 ← phi( loop::@10/(byte) loop::sin_idx#5 loop::@6/(byte) loop::sin_idx#2 )
(byte) loop::sy#2 ← phi( loop::@10/(byte) loop::sy#1 loop::@6/(byte) loop::sy#0 )
(byte) loop::y_idx#2 ← phi( loop::@10/(byte) loop::y_idx#1 loop::@6/(byte) loop::y_idx#0 )
*((byte[PLEX_COUNT#0]) PLEX_YPOS#0 + (byte) loop::sy#2) ← *((byte*) YSIN#0 + (byte) loop::y_idx#2)
(byte) loop::y_idx#1 ← (byte) loop::y_idx#2 + (byte/signed byte/word/signed word/dword/signed dword) 8
(byte) loop::sy#1 ← (byte) loop::sy#2 + rangenext(0,loop::$1)
(bool~) loop::$2 ← (byte) loop::sy#1 != rangelast(0,loop::$1)
if((bool~) loop::$2) goto loop::@10
to:loop::@11
loop::@11: scope:[loop] from loop::@10
(byte*) PLEX_SCREEN_PTR#40 ← phi( loop::@10/(byte*) PLEX_SCREEN_PTR#41 )
(byte) plex_free_next#25 ← phi( loop::@10/(byte) plex_free_next#34 )
(byte) plex_sprite_msb#27 ← phi( loop::@10/(byte) plex_sprite_msb#36 )
(byte) plex_sprite_idx#30 ← phi( loop::@10/(byte) plex_sprite_idx#37 )
(byte) plex_show_idx#30 ← phi( loop::@10/(byte) plex_show_idx#37 )
(byte) loop::sin_idx#3 ← phi( loop::@10/(byte) loop::sin_idx#5 )
(byte) loop::sin_idx#1 ← (byte) loop::sin_idx#3 + (byte/signed byte/word/signed word/dword/signed dword) 1
*((byte*) BORDERCOL#0) ← ++ *((byte*) BORDERCOL#0)
call plexSort
to:loop::@30
loop::@30: scope:[loop] from loop::@11
(byte) loop::sin_idx#21 ← phi( loop::@11/(byte) loop::sin_idx#1 )
(byte*) PLEX_SCREEN_PTR#39 ← phi( loop::@11/(byte*) PLEX_SCREEN_PTR#40 )
(byte) plex_free_next#16 ← phi( loop::@11/(byte) plex_free_next#1 )
(byte) plex_sprite_msb#19 ← phi( loop::@11/(byte) plex_sprite_msb#2 )
(byte) plex_sprite_idx#18 ← phi( loop::@11/(byte) plex_sprite_idx#2 )
(byte) plex_show_idx#18 ← phi( loop::@11/(byte) plex_show_idx#2 )
(byte) plex_show_idx#7 ← (byte) plex_show_idx#18
(byte) plex_sprite_idx#7 ← (byte) plex_sprite_idx#18
(byte) plex_sprite_msb#8 ← (byte) plex_sprite_msb#19
(byte) plex_free_next#7 ← (byte) plex_free_next#16
*((byte*) BORDERCOL#0) ← (byte) BLACK#0
to:loop::@12
loop::@12: scope:[loop] from loop::@13 loop::@30
(byte) loop::sin_idx#19 ← phi( loop::@13/(byte) loop::sin_idx#20 loop::@30/(byte) loop::sin_idx#21 )
(byte*) PLEX_SCREEN_PTR#37 ← phi( loop::@13/(byte*) PLEX_SCREEN_PTR#38 loop::@30/(byte*) PLEX_SCREEN_PTR#39 )
(byte) plex_sprite_msb#52 ← phi( loop::@13/(byte) plex_sprite_msb#53 loop::@30/(byte) plex_sprite_msb#8 )
(byte) plex_show_idx#52 ← phi( loop::@13/(byte) plex_show_idx#53 loop::@30/(byte) plex_show_idx#7 )
(byte) plex_sprite_idx#52 ← phi( loop::@13/(byte) plex_sprite_idx#53 loop::@30/(byte) plex_sprite_idx#7 )
(byte) plex_free_next#41 ← phi( loop::@13/(byte) plex_free_next#46 loop::@30/(byte) plex_free_next#7 )
(byte~) loop::$4 ← *((byte*) D011#0) & (byte) VIC_RST8#0
(bool~) loop::$5 ← (byte~) loop::$4 != (byte/signed byte/word/signed word/dword/signed dword) 0
if((bool~) loop::$5) goto loop::@13
to:loop::@14
loop::@13: scope:[loop] from loop::@12
(byte) loop::sin_idx#20 ← phi( loop::@12/(byte) loop::sin_idx#19 )
(byte*) PLEX_SCREEN_PTR#38 ← phi( loop::@12/(byte*) PLEX_SCREEN_PTR#37 )
(byte) plex_sprite_msb#53 ← phi( loop::@12/(byte) plex_sprite_msb#52 )
(byte) plex_show_idx#53 ← phi( loop::@12/(byte) plex_show_idx#52 )
(byte) plex_sprite_idx#53 ← phi( loop::@12/(byte) plex_sprite_idx#52 )
(byte) plex_free_next#46 ← phi( loop::@12/(byte) plex_free_next#41 )
to:loop::@12
loop::@14: scope:[loop] from loop::@12
(byte) loop::sin_idx#18 ← phi( loop::@12/(byte) loop::sin_idx#19 )
(byte*) PLEX_SCREEN_PTR#35 ← phi( loop::@12/(byte*) PLEX_SCREEN_PTR#37 )
(byte) plex_sprite_msb#51 ← phi( loop::@12/(byte) plex_sprite_msb#52 )
(byte) plex_show_idx#51 ← phi( loop::@12/(byte) plex_show_idx#52 )
(byte) plex_sprite_idx#51 ← phi( loop::@12/(byte) plex_sprite_idx#52 )
(byte) plex_free_next#35 ← phi( loop::@12/(byte) plex_free_next#41 )
(byte/signed word/word/dword/signed dword~) loop::$6 ← (byte) PLEX_COUNT#0 - (byte/signed byte/word/signed word/dword/signed dword) 1
(byte) loop::ss#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
to:loop::@18
loop::@18: scope:[loop] from loop::@14 loop::@31
(byte) loop::sin_idx#17 ← phi( loop::@14/(byte) loop::sin_idx#18 loop::@31/(byte) loop::sin_idx#10 )
(byte*) PLEX_SCREEN_PTR#34 ← phi( loop::@14/(byte*) PLEX_SCREEN_PTR#35 loop::@31/(byte*) PLEX_SCREEN_PTR#36 )
(byte) loop::ss#9 ← phi( loop::@14/(byte) loop::ss#0 loop::@31/(byte) loop::ss#1 )
(byte) plex_sprite_msb#50 ← phi( loop::@14/(byte) plex_sprite_msb#51 loop::@31/(byte) plex_sprite_msb#9 )
(byte) plex_show_idx#50 ← phi( loop::@14/(byte) plex_show_idx#51 loop::@31/(byte) plex_show_idx#8 )
(byte) plex_sprite_idx#50 ← phi( loop::@14/(byte) plex_sprite_idx#51 loop::@31/(byte) plex_sprite_idx#8 )
(byte) plex_free_next#26 ← phi( loop::@14/(byte) plex_free_next#35 loop::@31/(byte) plex_free_next#8 )
*((byte*) BORDERCOL#0) ← (byte) BLACK#0
to:loop::plexFreeNextYpos1
loop::plexFreeNextYpos1: scope:[loop] from loop::@18
(byte) loop::sin_idx#16 ← phi( loop::@18/(byte) loop::sin_idx#17 )
(byte*) PLEX_SCREEN_PTR#33 ← phi( loop::@18/(byte*) PLEX_SCREEN_PTR#34 )
(byte) loop::ss#8 ← phi( loop::@18/(byte) loop::ss#9 )
(byte) plex_sprite_msb#49 ← phi( loop::@18/(byte) plex_sprite_msb#50 )
(byte) plex_show_idx#49 ← phi( loop::@18/(byte) plex_show_idx#50 )
(byte) plex_sprite_idx#49 ← phi( loop::@18/(byte) plex_sprite_idx#50 )
(byte) plex_free_next#17 ← phi( loop::@18/(byte) plex_free_next#26 )
(byte) loop::plexFreeNextYpos1_return#0 ← *((byte[8]) PLEX_FREE_YPOS#0 + (byte) plex_free_next#17)
to:loop::plexFreeNextYpos1_@return
loop::plexFreeNextYpos1_@return: scope:[loop] from loop::plexFreeNextYpos1
(byte) loop::sin_idx#15 ← phi( loop::plexFreeNextYpos1/(byte) loop::sin_idx#16 )
(byte*) PLEX_SCREEN_PTR#32 ← phi( loop::plexFreeNextYpos1/(byte*) PLEX_SCREEN_PTR#33 )
(byte) loop::ss#7 ← phi( loop::plexFreeNextYpos1/(byte) loop::ss#8 )
(byte) plex_sprite_msb#46 ← phi( loop::plexFreeNextYpos1/(byte) plex_sprite_msb#49 )
(byte) plex_free_next#47 ← phi( loop::plexFreeNextYpos1/(byte) plex_free_next#17 )
(byte) plex_show_idx#46 ← phi( loop::plexFreeNextYpos1/(byte) plex_show_idx#49 )
(byte) plex_sprite_idx#46 ← phi( loop::plexFreeNextYpos1/(byte) plex_sprite_idx#49 )
(byte) loop::plexFreeNextYpos1_return#2 ← phi( loop::plexFreeNextYpos1/(byte) loop::plexFreeNextYpos1_return#0 )
(byte) loop::plexFreeNextYpos1_return#1 ← (byte) loop::plexFreeNextYpos1_return#2
to:loop::@29
loop::@29: scope:[loop] from loop::plexFreeNextYpos1_@return
(byte) loop::sin_idx#14 ← phi( loop::plexFreeNextYpos1_@return/(byte) loop::sin_idx#15 )
(byte*) PLEX_SCREEN_PTR#31 ← phi( loop::plexFreeNextYpos1_@return/(byte*) PLEX_SCREEN_PTR#32 )
(byte) loop::ss#6 ← phi( loop::plexFreeNextYpos1_@return/(byte) loop::ss#7 )
(byte) plex_sprite_msb#44 ← phi( loop::plexFreeNextYpos1_@return/(byte) plex_sprite_msb#46 )
(byte) plex_free_next#43 ← phi( loop::plexFreeNextYpos1_@return/(byte) plex_free_next#47 )
(byte) plex_show_idx#44 ← phi( loop::plexFreeNextYpos1_@return/(byte) plex_show_idx#46 )
(byte) plex_sprite_idx#44 ← phi( loop::plexFreeNextYpos1_@return/(byte) plex_sprite_idx#46 )
(byte) loop::plexFreeNextYpos1_return#3 ← phi( loop::plexFreeNextYpos1_@return/(byte) loop::plexFreeNextYpos1_return#1 )
(byte~) loop::$7 ← (byte) loop::plexFreeNextYpos1_return#3
(byte) loop::rasterY#0 ← (byte~) loop::$7
to:loop::@19
loop::@19: scope:[loop] from loop::@20 loop::@29
(byte) loop::sin_idx#12 ← phi( loop::@20/(byte) loop::sin_idx#13 loop::@29/(byte) loop::sin_idx#14 )
(byte*) PLEX_SCREEN_PTR#29 ← phi( loop::@20/(byte*) PLEX_SCREEN_PTR#30 loop::@29/(byte*) PLEX_SCREEN_PTR#31 )
(byte) loop::ss#4 ← phi( loop::@20/(byte) loop::ss#5 loop::@29/(byte) loop::ss#6 )
(byte) plex_sprite_msb#37 ← phi( loop::@20/(byte) plex_sprite_msb#43 loop::@29/(byte) plex_sprite_msb#44 )
(byte) plex_free_next#36 ← phi( loop::@20/(byte) plex_free_next#42 loop::@29/(byte) plex_free_next#43 )
(byte) plex_show_idx#38 ← phi( loop::@20/(byte) plex_show_idx#43 loop::@29/(byte) plex_show_idx#44 )
(byte) plex_sprite_idx#38 ← phi( loop::@20/(byte) plex_sprite_idx#43 loop::@29/(byte) plex_sprite_idx#44 )
(byte) loop::rasterY#1 ← phi( loop::@20/(byte) loop::rasterY#2 loop::@29/(byte) loop::rasterY#0 )
(bool~) loop::$8 ← *((byte*) RASTER#0) < (byte) loop::rasterY#1
if((bool~) loop::$8) goto loop::@20
to:loop::@21
loop::@20: scope:[loop] from loop::@19
(byte) loop::sin_idx#13 ← phi( loop::@19/(byte) loop::sin_idx#12 )
(byte*) PLEX_SCREEN_PTR#30 ← phi( loop::@19/(byte*) PLEX_SCREEN_PTR#29 )
(byte) loop::ss#5 ← phi( loop::@19/(byte) loop::ss#4 )
(byte) plex_sprite_msb#43 ← phi( loop::@19/(byte) plex_sprite_msb#37 )
(byte) plex_free_next#42 ← phi( loop::@19/(byte) plex_free_next#36 )
(byte) plex_show_idx#43 ← phi( loop::@19/(byte) plex_show_idx#38 )
(byte) plex_sprite_idx#43 ← phi( loop::@19/(byte) plex_sprite_idx#38 )
(byte) loop::rasterY#2 ← phi( loop::@19/(byte) loop::rasterY#1 )
to:loop::@19
loop::@21: scope:[loop] from loop::@19
(byte) loop::sin_idx#11 ← phi( loop::@19/(byte) loop::sin_idx#12 )
(byte*) PLEX_SCREEN_PTR#26 ← phi( loop::@19/(byte*) PLEX_SCREEN_PTR#29 )
(byte) loop::ss#3 ← phi( loop::@19/(byte) loop::ss#4 )
(byte) plex_sprite_msb#28 ← phi( loop::@19/(byte) plex_sprite_msb#37 )
(byte) plex_free_next#27 ← phi( loop::@19/(byte) plex_free_next#36 )
(byte) plex_show_idx#23 ← phi( loop::@19/(byte) plex_show_idx#38 )
(byte) plex_sprite_idx#23 ← phi( loop::@19/(byte) plex_sprite_idx#38 )
*((byte*) BORDERCOL#0) ← ++ *((byte*) BORDERCOL#0)
call plexShowSprite
to:loop::@31
loop::@31: scope:[loop] from loop::@21
(byte*) PLEX_SCREEN_PTR#36 ← phi( loop::@21/(byte*) PLEX_SCREEN_PTR#26 )
(byte) loop::sin_idx#10 ← phi( loop::@21/(byte) loop::sin_idx#11 )
(byte) loop::ss#2 ← phi( loop::@21/(byte) loop::ss#3 )
(byte) plex_sprite_msb#20 ← phi( loop::@21/(byte) plex_sprite_msb#5 )
(byte) plex_show_idx#19 ← phi( loop::@21/(byte) plex_show_idx#4 )
(byte) plex_sprite_idx#19 ← phi( loop::@21/(byte) plex_sprite_idx#4 )
(byte) plex_free_next#18 ← phi( loop::@21/(byte) plex_free_next#3 )
(byte) plex_free_next#8 ← (byte) plex_free_next#18
(byte) plex_sprite_idx#8 ← (byte) plex_sprite_idx#19
(byte) plex_show_idx#8 ← (byte) plex_show_idx#19
(byte) plex_sprite_msb#9 ← (byte) plex_sprite_msb#20
(byte) loop::ss#1 ← (byte) loop::ss#2 + rangenext(0,loop::$6)
(bool~) loop::$10 ← (byte) loop::ss#1 != rangelast(0,loop::$6)
if((bool~) loop::$10) goto loop::@18
to:loop::@25
loop::@25: scope:[loop] from loop::@31
(byte*) PLEX_SCREEN_PTR#48 ← phi( loop::@31/(byte*) PLEX_SCREEN_PTR#36 )
(byte) loop::sin_idx#9 ← phi( loop::@31/(byte) loop::sin_idx#10 )
(byte) plex_free_next#33 ← phi( loop::@31/(byte) plex_free_next#8 )
(byte) plex_sprite_msb#35 ← phi( loop::@31/(byte) plex_sprite_msb#9 )
(byte) plex_sprite_idx#36 ← phi( loop::@31/(byte) plex_sprite_idx#8 )
(byte) plex_show_idx#36 ← phi( loop::@31/(byte) plex_show_idx#8 )
*((byte*) BORDERCOL#0) ← (byte) BLACK#0
to:loop::@1
loop::@return: scope:[loop] from loop::@1
(byte) plex_free_next#19 ← phi( loop::@1/(byte) plex_free_next#28 )
(byte) plex_sprite_msb#21 ← phi( loop::@1/(byte) plex_sprite_msb#29 )
(byte) plex_sprite_idx#20 ← phi( loop::@1/(byte) plex_sprite_idx#31 )
(byte) plex_show_idx#20 ← phi( loop::@1/(byte) plex_show_idx#31 )
(byte) plex_show_idx#9 ← (byte) plex_show_idx#20
(byte) plex_sprite_idx#9 ← (byte) plex_sprite_idx#20
(byte) plex_sprite_msb#10 ← (byte) plex_sprite_msb#21
(byte) plex_free_next#9 ← (byte) plex_free_next#19
return
to:@return
@15: scope:[] from @12
(byte) plex_free_next#29 ← phi( @12/(byte) plex_free_next#37 )
(byte) plex_sprite_msb#30 ← phi( @12/(byte) plex_sprite_msb#38 )
(byte) plex_sprite_idx#32 ← phi( @12/(byte) plex_sprite_idx#39 )
(byte) plex_show_idx#32 ← phi( @12/(byte) plex_show_idx#39 )
(byte*) PLEX_SCREEN_PTR#21 ← phi( @12/(byte*) PLEX_SCREEN_PTR#25 )
call main
to:@16
@16: scope:[] from @15
(byte) plex_free_next#20 ← phi( @15/(byte) plex_free_next#6 )
(byte) plex_sprite_msb#22 ← phi( @15/(byte) plex_sprite_msb#7 )
(byte) plex_sprite_idx#21 ← phi( @15/(byte) plex_sprite_idx#6 )
(byte) plex_show_idx#21 ← phi( @15/(byte) plex_show_idx#6 )
(byte*) PLEX_SCREEN_PTR#14 ← phi( @15/(byte*) PLEX_SCREEN_PTR#4 )
(byte*) PLEX_SCREEN_PTR#7 ← (byte*) PLEX_SCREEN_PTR#14
(byte) plex_show_idx#10 ← (byte) plex_show_idx#21
(byte) plex_sprite_idx#10 ← (byte) plex_sprite_idx#21
(byte) plex_sprite_msb#11 ← (byte) plex_sprite_msb#22
(byte) plex_free_next#10 ← (byte) plex_free_next#20
to:@end
@end: scope:[] from @16
SYMBOL TABLE SSA
(word/signed word/dword/signed dword~) $0
(label) @12
(label) @15
(label) @16
(label) @4
(label) @9
(label) @begin
(label) @end
(byte) BLACK
(byte) BLACK#0
(byte*) BORDERCOL
(byte*) BORDERCOL#0
(byte*) D011
(byte*) D011#0
(byte) GREEN
(byte) GREEN#0
(byte) PLEX_COUNT
(byte) PLEX_COUNT#0
(byte[8]) PLEX_FREE_YPOS
(byte[8]) PLEX_FREE_YPOS#0
(byte[PLEX_COUNT#0]) PLEX_PTR
(byte[PLEX_COUNT#0]) PLEX_PTR#0
(byte*) PLEX_SCREEN_PTR
(byte*) PLEX_SCREEN_PTR#0
(byte*) PLEX_SCREEN_PTR#1
(byte*) PLEX_SCREEN_PTR#10
(byte*) PLEX_SCREEN_PTR#11
(byte*) PLEX_SCREEN_PTR#12
(byte*) PLEX_SCREEN_PTR#13
(byte*) PLEX_SCREEN_PTR#14
(byte*) PLEX_SCREEN_PTR#15
(byte*) PLEX_SCREEN_PTR#16
(byte*) PLEX_SCREEN_PTR#17
(byte*) PLEX_SCREEN_PTR#18
(byte*) PLEX_SCREEN_PTR#19
(byte*) PLEX_SCREEN_PTR#2
(byte*) PLEX_SCREEN_PTR#20
(byte*) PLEX_SCREEN_PTR#21
(byte*) PLEX_SCREEN_PTR#22
(byte*) PLEX_SCREEN_PTR#23
(byte*) PLEX_SCREEN_PTR#24
(byte*) PLEX_SCREEN_PTR#25
(byte*) PLEX_SCREEN_PTR#26
(byte*) PLEX_SCREEN_PTR#27
(byte*) PLEX_SCREEN_PTR#28
(byte*) PLEX_SCREEN_PTR#29
(byte*) PLEX_SCREEN_PTR#3
(byte*) PLEX_SCREEN_PTR#30
(byte*) PLEX_SCREEN_PTR#31
(byte*) PLEX_SCREEN_PTR#32
(byte*) PLEX_SCREEN_PTR#33
(byte*) PLEX_SCREEN_PTR#34
(byte*) PLEX_SCREEN_PTR#35
(byte*) PLEX_SCREEN_PTR#36
(byte*) PLEX_SCREEN_PTR#37
(byte*) PLEX_SCREEN_PTR#38
(byte*) PLEX_SCREEN_PTR#39
(byte*) PLEX_SCREEN_PTR#4
(byte*) PLEX_SCREEN_PTR#40
(byte*) PLEX_SCREEN_PTR#41
(byte*) PLEX_SCREEN_PTR#42
(byte*) PLEX_SCREEN_PTR#43
(byte*) PLEX_SCREEN_PTR#44
(byte*) PLEX_SCREEN_PTR#45
(byte*) PLEX_SCREEN_PTR#46
(byte*) PLEX_SCREEN_PTR#47
(byte*) PLEX_SCREEN_PTR#48
(byte*) PLEX_SCREEN_PTR#5
(byte*) PLEX_SCREEN_PTR#6
(byte*) PLEX_SCREEN_PTR#7
(byte*) PLEX_SCREEN_PTR#8
(byte*) PLEX_SCREEN_PTR#9
(byte[PLEX_COUNT#0]) PLEX_SORTED_IDX
(byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0
(word[PLEX_COUNT#0]) PLEX_XPOS
(word[PLEX_COUNT#0]) PLEX_XPOS#0
(byte[PLEX_COUNT#0]) PLEX_YPOS
(byte[PLEX_COUNT#0]) PLEX_YPOS#0
(byte*) RASTER
(byte*) RASTER#0
(byte*) SCREEN
(byte*) SCREEN#0
(const byte) SIZEOF_WORD = (byte/signed byte/word/signed word/dword/signed dword) 2
(byte*) SPRITE
(byte*) SPRITE#0
(byte*) SPRITES_COLS
(byte*) SPRITES_COLS#0
(byte*) SPRITES_ENABLE
(byte*) SPRITES_ENABLE#0
(byte*) SPRITES_XMSB
(byte*) SPRITES_XMSB#0
(byte*) SPRITES_XPOS
(byte*) SPRITES_XPOS#0
(byte*) SPRITES_YPOS
(byte*) SPRITES_YPOS#0
(byte) VIC_DEN
(byte) VIC_DEN#0
(byte) VIC_RSEL
(byte) VIC_RSEL#0
(byte) VIC_RST8
(byte) VIC_RST8#0
(byte*) YSIN
(byte*) YSIN#0
(void()) init()
(byte~) init::$0
(byte/word/dword~) init::$1
(byte/signed word/word/dword/signed dword~) init::$3
(byte*~) init::$4
(byte~) init::$5
(bool~) init::$6
(bool~) init::$7
(byte) init::$8
(label) init::@1
(label) init::@2
(label) init::@3
(label) init::@5
(label) init::@return
(byte) init::ss
(byte) init::ss#0
(byte) init::ss#1
(byte) init::ss#2
(byte) init::sx
(byte) init::sx#0
(byte) init::sx#1
(byte) init::sx#2
(word) init::xp
(word) init::xp#0
(word) init::xp#1
(word) init::xp#2
(void()) loop()
(bool~) loop::$0
(byte/signed word/word/dword/signed dword~) loop::$1
(bool~) loop::$10
(bool~) loop::$2
(byte~) loop::$4
(bool~) loop::$5
(byte/signed word/word/dword/signed dword~) loop::$6
(byte~) loop::$7
(bool~) loop::$8
(label) loop::@1
(label) loop::@10
(label) loop::@11
(label) loop::@12
(label) loop::@13
(label) loop::@14
(label) loop::@18
(label) loop::@19
(label) loop::@2
(label) loop::@20
(label) loop::@21
(label) loop::@25
(label) loop::@29
(label) loop::@30
(label) loop::@31
(label) loop::@4
(label) loop::@5
(label) loop::@6
(label) loop::@return
(label) loop::plexFreeNextYpos1
(label) loop::plexFreeNextYpos1_@return
(byte) loop::plexFreeNextYpos1_return
(byte) loop::plexFreeNextYpos1_return#0
(byte) loop::plexFreeNextYpos1_return#1
(byte) loop::plexFreeNextYpos1_return#2
(byte) loop::plexFreeNextYpos1_return#3
(byte) loop::rasterY
(byte) loop::rasterY#0
(byte) loop::rasterY#1
(byte) loop::rasterY#2
(byte) loop::sin_idx
(byte) loop::sin_idx#0
(byte) loop::sin_idx#1
(byte) loop::sin_idx#10
(byte) loop::sin_idx#11
(byte) loop::sin_idx#12
(byte) loop::sin_idx#13
(byte) loop::sin_idx#14
(byte) loop::sin_idx#15
(byte) loop::sin_idx#16
(byte) loop::sin_idx#17
(byte) loop::sin_idx#18
(byte) loop::sin_idx#19
(byte) loop::sin_idx#2
(byte) loop::sin_idx#20
(byte) loop::sin_idx#21
(byte) loop::sin_idx#3
(byte) loop::sin_idx#4
(byte) loop::sin_idx#5
(byte) loop::sin_idx#6
(byte) loop::sin_idx#7
(byte) loop::sin_idx#8
(byte) loop::sin_idx#9
(byte) loop::ss
(byte) loop::ss#0
(byte) loop::ss#1
(byte) loop::ss#2
(byte) loop::ss#3
(byte) loop::ss#4
(byte) loop::ss#5
(byte) loop::ss#6
(byte) loop::ss#7
(byte) loop::ss#8
(byte) loop::ss#9
(byte) loop::sy
(byte) loop::sy#0
(byte) loop::sy#1
(byte) loop::sy#2
(byte) loop::y_idx
(byte) loop::y_idx#0
(byte) loop::y_idx#1
(byte) loop::y_idx#2
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@return
(void()) plexInit((byte*) plexInit::screen)
(byte/signed word/word/dword/signed dword~) plexInit::$1
(bool~) plexInit::$2
(label) plexInit::@1
(label) plexInit::@3
(label) plexInit::@return
(byte) plexInit::i
(byte) plexInit::i#0
(byte) plexInit::i#1
(byte) plexInit::i#2
(label) plexInit::plexSetScreen1
(byte*~) plexInit::plexSetScreen1_$0
(byte*) plexInit::plexSetScreen1_$0#0
(byte*) plexInit::plexSetScreen1_screen
(byte*) plexInit::plexSetScreen1_screen#0
(byte*) plexInit::plexSetScreen1_screen#1
(byte*) plexInit::screen
(byte*) plexInit::screen#0
(byte*) plexInit::screen#1
(void()) plexShowSprite()
(byte~) plexShowSprite::$0
(byte) plexShowSprite::$10
(byte) plexShowSprite::$11
(byte~) plexShowSprite::$2
(byte~) plexShowSprite::$3
(bool~) plexShowSprite::$4
(byte/signed word/word/dword/signed dword~) plexShowSprite::$5
(byte/word/dword~) plexShowSprite::$6
(bool~) plexShowSprite::$7
(bool~) plexShowSprite::$8
(byte/word/dword~) plexShowSprite::$9
(label) plexShowSprite::@1
(label) plexShowSprite::@2
(label) plexShowSprite::@3
(label) plexShowSprite::@4
(label) plexShowSprite::@6
(label) plexShowSprite::@7
(label) plexShowSprite::@return
(label) plexShowSprite::plexFreeAdd1
(byte/signed word/word/dword/signed dword~) plexShowSprite::plexFreeAdd1_$0
(byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0
(byte/signed word/word/dword/signed dword~) plexShowSprite::plexFreeAdd1_$1
(byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0
(byte/word/dword~) plexShowSprite::plexFreeAdd1_$2
(byte/word/dword) plexShowSprite::plexFreeAdd1_$2#0
(byte) plexShowSprite::plexFreeAdd1_ypos
(byte) plexShowSprite::plexFreeAdd1_ypos#0
(byte) plexShowSprite::plexFreeAdd1_ypos#1
(byte) plexShowSprite::plex_sprite_idx2
(byte) plexShowSprite::plex_sprite_idx2#0
(byte) plexShowSprite::plex_sprite_idx2#1
(byte) plexShowSprite::plex_sprite_idx2#2
(byte) plexShowSprite::xpos_idx
(byte) plexShowSprite::xpos_idx#0
(byte) plexShowSprite::ypos
(byte) plexShowSprite::ypos#0
(void()) plexSort()
(byte/signed word/word/dword/signed dword~) plexSort::$1
(byte/signed word/word/dword/signed dword~) plexSort::$2
(bool~) plexSort::$3
(bool~) plexSort::$4
(byte/signed word/word/dword/signed dword~) plexSort::$5
(bool~) plexSort::$6
(bool~) plexSort::$7
(bool~) plexSort::$8
(bool~) plexSort::$9
(label) plexSort::@1
(label) plexSort::@2
(label) plexSort::@3
(label) plexSort::@4
(label) plexSort::@5
(label) plexSort::@6
(label) plexSort::@return
(byte) plexSort::m
(byte) plexSort::m#0
(byte) plexSort::m#1
(byte) plexSort::m#2
(byte) plexSort::m#3
(byte) plexSort::m#4
(byte) plexSort::m#5
(byte) plexSort::m#6
(byte) plexSort::nxt_idx
(byte) plexSort::nxt_idx#0
(byte) plexSort::nxt_idx#1
(byte) plexSort::nxt_idx#2
(byte) plexSort::nxt_idx#3
(byte) plexSort::nxt_y
(byte) plexSort::nxt_y#0
(byte) plexSort::nxt_y#1
(byte) plexSort::nxt_y#2
(label) plexSort::plexFreePrepare1
(bool~) plexSort::plexFreePrepare1_$0
(bool) plexSort::plexFreePrepare1_$0#0
(label) plexSort::plexFreePrepare1_@1
(label) plexSort::plexFreePrepare1_@2
(byte) plexSort::plexFreePrepare1_s
(byte) plexSort::plexFreePrepare1_s#0
(byte) plexSort::plexFreePrepare1_s#1
(byte) plexSort::plexFreePrepare1_s#2
(byte) plexSort::s
(byte) plexSort::s#0
(byte) plexSort::s#1
(byte) plexSort::s#2
(byte) plexSort::s#3
(byte) plexSort::s#4
(byte) plex_free_next
(byte) plex_free_next#0
(byte) plex_free_next#1
(byte) plex_free_next#10
(byte) plex_free_next#11
(byte) plex_free_next#12
(byte) plex_free_next#13
(byte) plex_free_next#14
(byte) plex_free_next#15
(byte) plex_free_next#16
(byte) plex_free_next#17
(byte) plex_free_next#18
(byte) plex_free_next#19
(byte) plex_free_next#2
(byte) plex_free_next#20
(byte) plex_free_next#21
(byte) plex_free_next#22
(byte) plex_free_next#23
(byte) plex_free_next#24
(byte) plex_free_next#25
(byte) plex_free_next#26
(byte) plex_free_next#27
(byte) plex_free_next#28
(byte) plex_free_next#29
(byte) plex_free_next#3
(byte) plex_free_next#30
(byte) plex_free_next#31
(byte) plex_free_next#32
(byte) plex_free_next#33
(byte) plex_free_next#34
(byte) plex_free_next#35
(byte) plex_free_next#36
(byte) plex_free_next#37
(byte) plex_free_next#38
(byte) plex_free_next#39
(byte) plex_free_next#4
(byte) plex_free_next#40
(byte) plex_free_next#41
(byte) plex_free_next#42
(byte) plex_free_next#43
(byte) plex_free_next#44
(byte) plex_free_next#45
(byte) plex_free_next#46
(byte) plex_free_next#47
(byte) plex_free_next#48
(byte) plex_free_next#49
(byte) plex_free_next#5
(byte) plex_free_next#6
(byte) plex_free_next#7
(byte) plex_free_next#8
(byte) plex_free_next#9
(byte) plex_show_idx
(byte) plex_show_idx#0
(byte) plex_show_idx#1
(byte) plex_show_idx#10
(byte) plex_show_idx#11
(byte) plex_show_idx#12
(byte) plex_show_idx#13
(byte) plex_show_idx#14
(byte) plex_show_idx#15
(byte) plex_show_idx#16
(byte) plex_show_idx#17
(byte) plex_show_idx#18
(byte) plex_show_idx#19
(byte) plex_show_idx#2
(byte) plex_show_idx#20
(byte) plex_show_idx#21
(byte) plex_show_idx#22
(byte) plex_show_idx#23
(byte) plex_show_idx#24
(byte) plex_show_idx#25
(byte) plex_show_idx#26
(byte) plex_show_idx#27
(byte) plex_show_idx#28
(byte) plex_show_idx#29
(byte) plex_show_idx#3
(byte) plex_show_idx#30
(byte) plex_show_idx#31
(byte) plex_show_idx#32
(byte) plex_show_idx#33
(byte) plex_show_idx#34
(byte) plex_show_idx#35
(byte) plex_show_idx#36
(byte) plex_show_idx#37
(byte) plex_show_idx#38
(byte) plex_show_idx#39
(byte) plex_show_idx#4
(byte) plex_show_idx#40
(byte) plex_show_idx#41
(byte) plex_show_idx#42
(byte) plex_show_idx#43
(byte) plex_show_idx#44
(byte) plex_show_idx#45
(byte) plex_show_idx#46
(byte) plex_show_idx#47
(byte) plex_show_idx#48
(byte) plex_show_idx#49
(byte) plex_show_idx#5
(byte) plex_show_idx#50
(byte) plex_show_idx#51
(byte) plex_show_idx#52
(byte) plex_show_idx#53
(byte) plex_show_idx#6
(byte) plex_show_idx#7
(byte) plex_show_idx#8
(byte) plex_show_idx#9
(byte) plex_sprite_idx
(byte) plex_sprite_idx#0
(byte) plex_sprite_idx#1
(byte) plex_sprite_idx#10
(byte) plex_sprite_idx#11
(byte) plex_sprite_idx#12
(byte) plex_sprite_idx#13
(byte) plex_sprite_idx#14
(byte) plex_sprite_idx#15
(byte) plex_sprite_idx#16
(byte) plex_sprite_idx#17
(byte) plex_sprite_idx#18
(byte) plex_sprite_idx#19
(byte) plex_sprite_idx#2
(byte) plex_sprite_idx#20
(byte) plex_sprite_idx#21
(byte) plex_sprite_idx#22
(byte) plex_sprite_idx#23
(byte) plex_sprite_idx#24
(byte) plex_sprite_idx#25
(byte) plex_sprite_idx#26
(byte) plex_sprite_idx#27
(byte) plex_sprite_idx#28
(byte) plex_sprite_idx#29
(byte) plex_sprite_idx#3
(byte) plex_sprite_idx#30
(byte) plex_sprite_idx#31
(byte) plex_sprite_idx#32
(byte) plex_sprite_idx#33
(byte) plex_sprite_idx#34
(byte) plex_sprite_idx#35
(byte) plex_sprite_idx#36
(byte) plex_sprite_idx#37
(byte) plex_sprite_idx#38
(byte) plex_sprite_idx#39
(byte) plex_sprite_idx#4
(byte) plex_sprite_idx#40
(byte) plex_sprite_idx#41
(byte) plex_sprite_idx#42
(byte) plex_sprite_idx#43
(byte) plex_sprite_idx#44
(byte) plex_sprite_idx#45
(byte) plex_sprite_idx#46
(byte) plex_sprite_idx#47
(byte) plex_sprite_idx#48
(byte) plex_sprite_idx#49
(byte) plex_sprite_idx#5
(byte) plex_sprite_idx#50
(byte) plex_sprite_idx#51
(byte) plex_sprite_idx#52
(byte) plex_sprite_idx#53
(byte) plex_sprite_idx#6
(byte) plex_sprite_idx#7
(byte) plex_sprite_idx#8
(byte) plex_sprite_idx#9
(byte) plex_sprite_msb
(byte) plex_sprite_msb#0
(byte) plex_sprite_msb#1
(byte) plex_sprite_msb#10
(byte) plex_sprite_msb#11
(byte) plex_sprite_msb#12
(byte) plex_sprite_msb#13
(byte) plex_sprite_msb#14
(byte) plex_sprite_msb#15
(byte) plex_sprite_msb#16
(byte) plex_sprite_msb#17
(byte) plex_sprite_msb#18
(byte) plex_sprite_msb#19
(byte) plex_sprite_msb#2
(byte) plex_sprite_msb#20
(byte) plex_sprite_msb#21
(byte) plex_sprite_msb#22
(byte) plex_sprite_msb#23
(byte) plex_sprite_msb#24
(byte) plex_sprite_msb#25
(byte) plex_sprite_msb#26
(byte) plex_sprite_msb#27
(byte) plex_sprite_msb#28
(byte) plex_sprite_msb#29
(byte) plex_sprite_msb#3
(byte) plex_sprite_msb#30
(byte) plex_sprite_msb#31
(byte) plex_sprite_msb#32
(byte) plex_sprite_msb#33
(byte) plex_sprite_msb#34
(byte) plex_sprite_msb#35
(byte) plex_sprite_msb#36
(byte) plex_sprite_msb#37
(byte) plex_sprite_msb#38
(byte) plex_sprite_msb#39
(byte) plex_sprite_msb#4
(byte) plex_sprite_msb#40
(byte) plex_sprite_msb#41
(byte) plex_sprite_msb#42
(byte) plex_sprite_msb#43
(byte) plex_sprite_msb#44
(byte) plex_sprite_msb#45
(byte) plex_sprite_msb#46
(byte) plex_sprite_msb#47
(byte) plex_sprite_msb#48
(byte) plex_sprite_msb#49
(byte) plex_sprite_msb#5
(byte) plex_sprite_msb#50
(byte) plex_sprite_msb#51
(byte) plex_sprite_msb#52
(byte) plex_sprite_msb#53
(byte) plex_sprite_msb#6
(byte) plex_sprite_msb#7
(byte) plex_sprite_msb#8
(byte) plex_sprite_msb#9
Inversing boolean not [46] (bool~) plexSort::$4 ← (byte) plexSort::nxt_y#0 >= *((byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::m#2)) from [45] (bool~) plexSort::$3 ← (byte) plexSort::nxt_y#0 < *((byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::m#2))
Inversing boolean not [117] (bool~) plexShowSprite::$8 ← (byte) plex_sprite_msb#3 != (byte/signed byte/word/signed word/dword/signed dword) 0 from [116] (bool~) plexShowSprite::$7 ← (byte) plex_sprite_msb#3 == (byte/signed byte/word/signed word/dword/signed dword) 0
Successful SSA optimization Pass2UnaryNotSimplification
Alias (byte*) plexInit::plexSetScreen1_screen#0 = (byte*) plexInit::screen#1 (byte*) plexInit::plexSetScreen1_screen#1
Alias (byte*) PLEX_SCREEN_PTR#1 = (byte*) plexInit::plexSetScreen1_$0#0 (byte*) PLEX_SCREEN_PTR#22
Alias (byte*) PLEX_SCREEN_PTR#15 = (byte*) PLEX_SCREEN_PTR#8 (byte*) PLEX_SCREEN_PTR#2
Alias (byte) plexSort::m#2 = (byte) plexSort::m#4 (byte) plexSort::s#0
Alias (byte) plexSort::nxt_y#0 = (byte) plexSort::nxt_y#2
Alias (byte) plexSort::nxt_idx#0 = (byte) plexSort::nxt_idx#3
Alias (byte) plexSort::s#1 = (byte) plexSort::s#4
Alias (byte) plexSort::nxt_idx#1 = (byte) plexSort::nxt_idx#2
Alias (byte) plexSort::m#5 = (byte) plexSort::m#6
Alias (byte) plex_show_idx#1 = (byte) plex_show_idx#40
Alias (byte) plex_sprite_idx#1 = (byte) plex_sprite_idx#40
Alias (byte) plex_sprite_msb#1 = (byte) plex_sprite_msb#39
Alias (byte) plex_show_idx#11 = (byte) plex_show_idx#22 (byte) plex_show_idx#33 (byte) plex_show_idx#2
Alias (byte) plex_sprite_idx#11 = (byte) plex_sprite_idx#22 (byte) plex_sprite_idx#33 (byte) plex_sprite_idx#2
Alias (byte) plex_sprite_msb#12 = (byte) plex_sprite_msb#23 (byte) plex_sprite_msb#31 (byte) plex_sprite_msb#2
Alias (byte) plex_free_next#0 = (byte) plex_free_next#11 (byte) plex_free_next#1
Alias (byte) plexShowSprite::plex_sprite_idx2#0 = (byte~) plexShowSprite::$0 (byte) plexShowSprite::plex_sprite_idx2#2 (byte) plexShowSprite::plex_sprite_idx2#1
Alias (byte) plexShowSprite::plexFreeAdd1_ypos#0 = (byte) plexShowSprite::ypos#0 (byte) plexShowSprite::plexFreeAdd1_ypos#1
Alias (byte) plex_free_next#12 = (byte) plex_free_next#21
Alias (byte) plex_show_idx#12 = (byte) plex_show_idx#24 (byte) plex_show_idx#13 (byte) plex_show_idx#25 (byte) plex_show_idx#26
Alias (byte*) PLEX_SCREEN_PTR#16 = (byte*) PLEX_SCREEN_PTR#23 (byte*) PLEX_SCREEN_PTR#9
Alias (byte) plex_sprite_idx#12 = (byte) plex_sprite_idx#24 (byte) plex_sprite_idx#13 (byte) plex_sprite_idx#25 (byte) plex_sprite_idx#26
Alias (byte) plex_sprite_msb#13 = (byte) plex_sprite_msb#32 (byte) plex_sprite_msb#40 (byte) plex_sprite_msb#24 (byte) plex_sprite_msb#14
Alias (byte) plex_free_next#2 = (byte/word/dword) plexShowSprite::plexFreeAdd1_$2#0 (byte) plex_free_next#44 (byte) plex_free_next#38 (byte) plex_free_next#39
Alias (byte) plex_sprite_idx#27 = (byte) plex_sprite_idx#3 (byte/word/dword~) plexShowSprite::$6 (byte) plex_sprite_idx#28
Alias (byte) plex_free_next#22 = (byte) plex_free_next#30 (byte) plex_free_next#23
Alias (byte) plex_show_idx#27 = (byte) plex_show_idx#3 (byte) plex_show_idx#28
Alias (byte) plex_sprite_msb#25 = (byte) plex_sprite_msb#3
Alias (byte) plex_free_next#13 = (byte) plex_free_next#3
Alias (byte) plex_sprite_idx#15 = (byte) plex_sprite_idx#4
Alias (byte) plex_show_idx#15 = (byte) plex_show_idx#4
Alias (byte) plex_sprite_msb#16 = (byte) plex_sprite_msb#5
Alias (byte*) PLEX_SCREEN_PTR#0 = (byte*) PLEX_SCREEN_PTR#27 (byte*) PLEX_SCREEN_PTR#25 (byte*) PLEX_SCREEN_PTR#21
Alias (byte) plex_show_idx#0 = (byte) plex_show_idx#41 (byte) plex_show_idx#39 (byte) plex_show_idx#32
Alias (byte) plex_sprite_idx#0 = (byte) plex_sprite_idx#41 (byte) plex_sprite_idx#39 (byte) plex_sprite_idx#32
Alias (byte) plex_sprite_msb#0 = (byte) plex_sprite_msb#41 (byte) plex_sprite_msb#38 (byte) plex_sprite_msb#30
Alias (byte) plex_free_next#29 = (byte) plex_free_next#37 (byte) plex_free_next#4
Alias (byte) plex_show_idx#29 = (byte) plex_show_idx#34
Alias (byte) plex_sprite_idx#29 = (byte) plex_sprite_idx#34
Alias (byte) plex_sprite_msb#26 = (byte) plex_sprite_msb#33
Alias (byte) plex_free_next#24 = (byte) plex_free_next#31
Alias (byte*) PLEX_SCREEN_PTR#10 = (byte*) PLEX_SCREEN_PTR#3 (byte*) PLEX_SCREEN_PTR#18 (byte*) PLEX_SCREEN_PTR#11 (byte*) PLEX_SCREEN_PTR#4
Alias (byte) plex_show_idx#16 = (byte) plex_show_idx#5 (byte) plex_show_idx#17 (byte) plex_show_idx#6
Alias (byte) plex_sprite_idx#16 = (byte) plex_sprite_idx#5 (byte) plex_sprite_idx#17 (byte) plex_sprite_idx#6
Alias (byte) plex_sprite_msb#17 = (byte) plex_sprite_msb#6 (byte) plex_sprite_msb#18 (byte) plex_sprite_msb#7
Alias (byte) plex_free_next#14 = (byte) plex_free_next#5 (byte) plex_free_next#15 (byte) plex_free_next#6
Alias (byte*) PLEX_SCREEN_PTR#12 = (byte*) PLEX_SCREEN_PTR#5
Alias (byte*) PLEX_SCREEN_PTR#24 = (byte*) PLEX_SCREEN_PTR#28
Alias (byte*) PLEX_SCREEN_PTR#13 = (byte*) PLEX_SCREEN_PTR#20 (byte*) PLEX_SCREEN_PTR#6
Alias (byte) loop::sin_idx#6 = (byte) loop::sin_idx#8
Alias (byte) plex_show_idx#20 = (byte) plex_show_idx#47 (byte) plex_show_idx#31 (byte) plex_show_idx#9
Alias (byte) plex_sprite_idx#20 = (byte) plex_sprite_idx#47 (byte) plex_sprite_idx#31 (byte) plex_sprite_idx#9
Alias (byte) plex_sprite_msb#10 = (byte) plex_sprite_msb#47 (byte) plex_sprite_msb#29 (byte) plex_sprite_msb#21
Alias (byte) plex_free_next#19 = (byte) plex_free_next#48 (byte) plex_free_next#28 (byte) plex_free_next#9
Alias (byte*) PLEX_SCREEN_PTR#44 = (byte*) PLEX_SCREEN_PTR#46
Alias (byte) loop::sin_idx#2 = (byte) loop::sin_idx#7 (byte) loop::sin_idx#4 (byte) loop::y_idx#0
Alias (byte) plex_show_idx#42 = (byte) plex_show_idx#48 (byte) plex_show_idx#45
Alias (byte) plex_sprite_idx#42 = (byte) plex_sprite_idx#48 (byte) plex_sprite_idx#45
Alias (byte) plex_sprite_msb#42 = (byte) plex_sprite_msb#48 (byte) plex_sprite_msb#45
Alias (byte) plex_free_next#40 = (byte) plex_free_next#49 (byte) plex_free_next#45
Alias (byte*) PLEX_SCREEN_PTR#42 = (byte*) PLEX_SCREEN_PTR#45 (byte*) PLEX_SCREEN_PTR#43
Alias (byte) loop::sin_idx#3 = (byte) loop::sin_idx#5
Alias (byte) plex_show_idx#30 = (byte) plex_show_idx#37
Alias (byte) plex_sprite_idx#30 = (byte) plex_sprite_idx#37
Alias (byte) plex_sprite_msb#27 = (byte) plex_sprite_msb#36
Alias (byte) plex_free_next#25 = (byte) plex_free_next#34
Alias (byte*) PLEX_SCREEN_PTR#39 = (byte*) PLEX_SCREEN_PTR#40 (byte*) PLEX_SCREEN_PTR#41
Alias (byte) loop::sin_idx#1 = (byte) loop::sin_idx#21
Alias (byte) plex_show_idx#18 = (byte) plex_show_idx#7
Alias (byte) plex_sprite_idx#18 = (byte) plex_sprite_idx#7
Alias (byte) plex_sprite_msb#19 = (byte) plex_sprite_msb#8
Alias (byte) plex_free_next#16 = (byte) plex_free_next#7
Alias (byte) plex_free_next#35 = (byte) plex_free_next#46 (byte) plex_free_next#41
Alias (byte) plex_sprite_idx#51 = (byte) plex_sprite_idx#53 (byte) plex_sprite_idx#52
Alias (byte) plex_show_idx#51 = (byte) plex_show_idx#53 (byte) plex_show_idx#52
Alias (byte) plex_sprite_msb#51 = (byte) plex_sprite_msb#53 (byte) plex_sprite_msb#52
Alias (byte*) PLEX_SCREEN_PTR#35 = (byte*) PLEX_SCREEN_PTR#38 (byte*) PLEX_SCREEN_PTR#37
Alias (byte) loop::sin_idx#18 = (byte) loop::sin_idx#20 (byte) loop::sin_idx#19
Alias (byte) plex_free_next#17 = (byte) plex_free_next#26 (byte) plex_free_next#47 (byte) plex_free_next#43
Alias (byte) plex_sprite_idx#44 = (byte) plex_sprite_idx#49 (byte) plex_sprite_idx#50 (byte) plex_sprite_idx#46
Alias (byte) plex_show_idx#44 = (byte) plex_show_idx#49 (byte) plex_show_idx#50 (byte) plex_show_idx#46
Alias (byte) plex_sprite_msb#44 = (byte) plex_sprite_msb#49 (byte) plex_sprite_msb#50 (byte) plex_sprite_msb#46
Alias (byte) loop::ss#6 = (byte) loop::ss#8 (byte) loop::ss#9 (byte) loop::ss#7
Alias (byte*) PLEX_SCREEN_PTR#31 = (byte*) PLEX_SCREEN_PTR#33 (byte*) PLEX_SCREEN_PTR#34 (byte*) PLEX_SCREEN_PTR#32
Alias (byte) loop::sin_idx#14 = (byte) loop::sin_idx#16 (byte) loop::sin_idx#17 (byte) loop::sin_idx#15
Alias (byte) loop::plexFreeNextYpos1_return#0 = (byte) loop::plexFreeNextYpos1_return#2 (byte) loop::plexFreeNextYpos1_return#1 (byte) loop::plexFreeNextYpos1_return#3 (byte~) loop::$7 (byte) loop::rasterY#0
Alias (byte) loop::rasterY#1 = (byte) loop::rasterY#2
Alias (byte) plex_sprite_idx#23 = (byte) plex_sprite_idx#43 (byte) plex_sprite_idx#38
Alias (byte) plex_show_idx#23 = (byte) plex_show_idx#43 (byte) plex_show_idx#38
Alias (byte) plex_free_next#27 = (byte) plex_free_next#42 (byte) plex_free_next#36
Alias (byte) plex_sprite_msb#28 = (byte) plex_sprite_msb#43 (byte) plex_sprite_msb#37
Alias (byte) loop::ss#2 = (byte) loop::ss#5 (byte) loop::ss#4 (byte) loop::ss#3
Alias (byte*) PLEX_SCREEN_PTR#26 = (byte*) PLEX_SCREEN_PTR#30 (byte*) PLEX_SCREEN_PTR#29 (byte*) PLEX_SCREEN_PTR#36 (byte*) PLEX_SCREEN_PTR#48
Alias (byte) loop::sin_idx#10 = (byte) loop::sin_idx#13 (byte) loop::sin_idx#12 (byte) loop::sin_idx#11 (byte) loop::sin_idx#9
Alias (byte) plex_free_next#18 = (byte) plex_free_next#8 (byte) plex_free_next#33
Alias (byte) plex_sprite_idx#19 = (byte) plex_sprite_idx#8 (byte) plex_sprite_idx#36
Alias (byte) plex_show_idx#19 = (byte) plex_show_idx#8 (byte) plex_show_idx#36
Alias (byte) plex_sprite_msb#20 = (byte) plex_sprite_msb#9 (byte) plex_sprite_msb#35
Alias (byte*) PLEX_SCREEN_PTR#14 = (byte*) PLEX_SCREEN_PTR#7
Alias (byte) plex_show_idx#10 = (byte) plex_show_idx#21
Alias (byte) plex_sprite_idx#10 = (byte) plex_sprite_idx#21
Alias (byte) plex_sprite_msb#11 = (byte) plex_sprite_msb#22
Alias (byte) plex_free_next#10 = (byte) plex_free_next#20
Successful SSA optimization Pass2AliasElimination
Alias (byte) plex_sprite_idx#12 = (byte) plex_sprite_idx#14
Alias (byte) plex_show_idx#12 = (byte) plex_show_idx#14
Alias (byte) plex_sprite_msb#13 = (byte) plex_sprite_msb#15
Alias (byte) plex_free_next#13 = (byte) plex_free_next#22 (byte) plex_free_next#2
Alias (byte) plex_sprite_idx#15 = (byte) plex_sprite_idx#27
Alias (byte) plex_show_idx#15 = (byte) plex_show_idx#27
Successful SSA optimization Pass2AliasElimination
Self Phi Eliminated (byte*) PLEX_SCREEN_PTR#15
Self Phi Eliminated (byte) plexSort::nxt_y#1
Self Phi Eliminated (byte) plexSort::nxt_idx#1
Self Phi Eliminated (byte) plexSort::m#5
Self Phi Eliminated (byte) plex_show_idx#11
Self Phi Eliminated (byte) plex_sprite_idx#11
Self Phi Eliminated (byte) plex_sprite_msb#12
Self Phi Eliminated (byte*) PLEX_SCREEN_PTR#24
Self Phi Eliminated (byte*) PLEX_SCREEN_PTR#13
Self Phi Eliminated (byte) loop::sin_idx#2
Self Phi Eliminated (byte) plex_show_idx#42
Self Phi Eliminated (byte) plex_sprite_idx#42
Self Phi Eliminated (byte) plex_sprite_msb#42
Self Phi Eliminated (byte) plex_free_next#40
Self Phi Eliminated (byte*) PLEX_SCREEN_PTR#42
Self Phi Eliminated (byte) loop::sin_idx#3
Self Phi Eliminated (byte) plex_show_idx#30
Self Phi Eliminated (byte) plex_sprite_idx#30
Self Phi Eliminated (byte) plex_sprite_msb#27
Self Phi Eliminated (byte) plex_free_next#25
Self Phi Eliminated (byte*) PLEX_SCREEN_PTR#39
Self Phi Eliminated (byte) plex_free_next#35
Self Phi Eliminated (byte) plex_sprite_idx#51
Self Phi Eliminated (byte) plex_show_idx#51
Self Phi Eliminated (byte) plex_sprite_msb#51
Self Phi Eliminated (byte*) PLEX_SCREEN_PTR#35
Self Phi Eliminated (byte) loop::sin_idx#18
Self Phi Eliminated (byte) loop::rasterY#1
Self Phi Eliminated (byte) plex_sprite_idx#23
Self Phi Eliminated (byte) plex_show_idx#23
Self Phi Eliminated (byte) plex_free_next#27
Self Phi Eliminated (byte) plex_sprite_msb#28
Self Phi Eliminated (byte) loop::ss#2
Self Phi Eliminated (byte*) PLEX_SCREEN_PTR#26
Self Phi Eliminated (byte) loop::sin_idx#10
Successful SSA optimization Pass2SelfPhiElimination
Redundant Phi (byte*) plexInit::plexSetScreen1_screen#0 (byte*) plexInit::screen#0
Redundant Phi (byte*) PLEX_SCREEN_PTR#15 (byte*) PLEX_SCREEN_PTR#1
Redundant Phi (byte) plexSort::nxt_y#1 (byte) plexSort::nxt_y#0
Redundant Phi (byte) plexSort::nxt_idx#1 (byte) plexSort::nxt_idx#0
Redundant Phi (byte) plexSort::m#5 (byte) plexSort::m#2
Redundant Phi (byte) plex_show_idx#11 (byte) plex_show_idx#1
Redundant Phi (byte) plex_sprite_idx#11 (byte) plex_sprite_idx#1
Redundant Phi (byte) plex_sprite_msb#12 (byte) plex_sprite_msb#1
Redundant Phi (byte) plex_sprite_idx#12 (byte) plex_sprite_idx#23
Redundant Phi (byte) plex_show_idx#12 (byte) plex_show_idx#23
Redundant Phi (byte) plex_free_next#12 (byte) plex_free_next#27
Redundant Phi (byte*) PLEX_SCREEN_PTR#16 (byte*) PLEX_SCREEN_PTR#26
Redundant Phi (byte) plex_sprite_msb#13 (byte) plex_sprite_msb#28
Redundant Phi (byte*) PLEX_SCREEN_PTR#17 (byte*) PLEX_SCREEN_PTR#0
Redundant Phi (byte) plex_show_idx#29 (byte) plex_show_idx#0
Redundant Phi (byte) plex_sprite_idx#29 (byte) plex_sprite_idx#0
Redundant Phi (byte) plex_sprite_msb#26 (byte) plex_sprite_msb#0
Redundant Phi (byte) plex_free_next#24 (byte) plex_free_next#29
Redundant Phi (byte*) PLEX_SCREEN_PTR#10 (byte*) PLEX_SCREEN_PTR#13
Redundant Phi (byte) plex_show_idx#16 (byte) plex_show_idx#20
Redundant Phi (byte) plex_sprite_idx#16 (byte) plex_sprite_idx#20
Redundant Phi (byte) plex_sprite_msb#17 (byte) plex_sprite_msb#10
Redundant Phi (byte) plex_free_next#14 (byte) plex_free_next#19
Redundant Phi (byte*) PLEX_SCREEN_PTR#19 (byte*) PLEX_SCREEN_PTR#17
Redundant Phi (byte*) PLEX_SCREEN_PTR#12 (byte*) PLEX_SCREEN_PTR#15
Redundant Phi (byte*) PLEX_SCREEN_PTR#24 (byte*) PLEX_SCREEN_PTR#12
Redundant Phi (byte*) PLEX_SCREEN_PTR#13 (byte*) PLEX_SCREEN_PTR#24
Redundant Phi (byte) plex_show_idx#35 (byte) plex_show_idx#29
Redundant Phi (byte) plex_sprite_idx#35 (byte) plex_sprite_idx#29
Redundant Phi (byte) plex_sprite_msb#34 (byte) plex_sprite_msb#26
Redundant Phi (byte) plex_free_next#32 (byte) plex_free_next#24
Redundant Phi (byte*) PLEX_SCREEN_PTR#47 (byte*) PLEX_SCREEN_PTR#10
Redundant Phi (byte) loop::sin_idx#2 (byte) loop::sin_idx#6
Redundant Phi (byte) plex_show_idx#42 (byte) plex_show_idx#20
Redundant Phi (byte) plex_sprite_idx#42 (byte) plex_sprite_idx#20
Redundant Phi (byte) plex_sprite_msb#42 (byte) plex_sprite_msb#10
Redundant Phi (byte) plex_free_next#40 (byte) plex_free_next#19
Redundant Phi (byte*) PLEX_SCREEN_PTR#42 (byte*) PLEX_SCREEN_PTR#44
Redundant Phi (byte) loop::sin_idx#3 (byte) loop::sin_idx#2
Redundant Phi (byte) plex_show_idx#30 (byte) plex_show_idx#42
Redundant Phi (byte) plex_sprite_idx#30 (byte) plex_sprite_idx#42
Redundant Phi (byte) plex_sprite_msb#27 (byte) plex_sprite_msb#42
Redundant Phi (byte) plex_free_next#25 (byte) plex_free_next#40
Redundant Phi (byte*) PLEX_SCREEN_PTR#39 (byte*) PLEX_SCREEN_PTR#42
Redundant Phi (byte) plex_show_idx#18 (byte) plex_show_idx#11
Redundant Phi (byte) plex_sprite_idx#18 (byte) plex_sprite_idx#11
Redundant Phi (byte) plex_sprite_msb#19 (byte) plex_sprite_msb#12
Redundant Phi (byte) plex_free_next#16 (byte) plex_free_next#0
Redundant Phi (byte) plex_free_next#35 (byte) plex_free_next#16
Redundant Phi (byte) plex_sprite_idx#51 (byte) plex_sprite_idx#18
Redundant Phi (byte) plex_show_idx#51 (byte) plex_show_idx#18
Redundant Phi (byte) plex_sprite_msb#51 (byte) plex_sprite_msb#19
Redundant Phi (byte*) PLEX_SCREEN_PTR#35 (byte*) PLEX_SCREEN_PTR#39
Redundant Phi (byte) loop::sin_idx#18 (byte) loop::sin_idx#1
Redundant Phi (byte) loop::rasterY#1 (byte) loop::plexFreeNextYpos1_return#0
Redundant Phi (byte) plex_sprite_idx#23 (byte) plex_sprite_idx#44
Redundant Phi (byte) plex_show_idx#23 (byte) plex_show_idx#44
Redundant Phi (byte) plex_free_next#27 (byte) plex_free_next#17
Redundant Phi (byte) plex_sprite_msb#28 (byte) plex_sprite_msb#44
Redundant Phi (byte) loop::ss#2 (byte) loop::ss#6
Redundant Phi (byte*) PLEX_SCREEN_PTR#26 (byte*) PLEX_SCREEN_PTR#31
Redundant Phi (byte) loop::sin_idx#10 (byte) loop::sin_idx#14
Redundant Phi (byte) plex_free_next#18 (byte) plex_free_next#13
Redundant Phi (byte) plex_sprite_idx#19 (byte) plex_sprite_idx#15
Redundant Phi (byte) plex_show_idx#19 (byte) plex_show_idx#15
Redundant Phi (byte) plex_sprite_msb#20 (byte) plex_sprite_msb#16
Redundant Phi (byte*) PLEX_SCREEN_PTR#14 (byte*) PLEX_SCREEN_PTR#10
Redundant Phi (byte) plex_show_idx#10 (byte) plex_show_idx#16
Redundant Phi (byte) plex_sprite_idx#10 (byte) plex_sprite_idx#16
Redundant Phi (byte) plex_sprite_msb#11 (byte) plex_sprite_msb#17
Redundant Phi (byte) plex_free_next#10 (byte) plex_free_next#14
Successful SSA optimization Pass2RedundantPhiElimination
Redundant Phi (byte) plexSort::m#3 (byte) plexSort::m#2
Successful SSA optimization Pass2RedundantPhiElimination
Simple Condition (bool~) plexInit::$2 [35] if((byte) plexInit::i#1!=rangelast(0,plexInit::$1)) goto plexInit::@1
Simple Condition (bool~) plexSort::$4 [47] if((byte) plexSort::nxt_y#0>=*((byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::m#2))) goto plexSort::@2
Simple Condition (bool~) plexSort::$9 [51] if((byte) plexSort::m#1!=rangelast(0,plexSort::$1)) goto plexSort::@1
Simple Condition (bool) plexSort::plexFreePrepare1_$0#0 [74] if((byte) plexSort::plexFreePrepare1_s#1!=rangelast(0,7)) goto plexSort::plexFreePrepare1_@1
Simple Condition (bool~) plexShowSprite::$4 [104] if((byte~) plexShowSprite::$3!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto plexShowSprite::@1
Simple Condition (bool~) plexShowSprite::$8 [118] if((byte) plex_sprite_msb#25!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto plexShowSprite::@3
Simple Condition (bool~) init::$6 [175] if((byte) init::sx#1!=rangelast(0,init::$3)) goto init::@1
Simple Condition (bool~) init::$7 [183] if((byte) init::ss#1!=rangelast(0,7)) goto init::@3
Simple Condition (bool~) loop::$0 [194] if(*((byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) $ff) goto loop::@5
Simple Condition (bool~) loop::$2 [206] if((byte) loop::sy#1!=rangelast(0,loop::$1)) goto loop::@10
Simple Condition (bool~) loop::$5 [220] if((byte~) loop::$4!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto loop::@13
Simple Condition (bool~) loop::$8 [236] if(*((byte*) RASTER#0)<(byte) loop::plexFreeNextYpos1_return#0) goto loop::@20
Simple Condition (bool~) loop::$10 [248] if((byte) loop::ss#1!=rangelast(0,loop::$6)) goto loop::@18
Successful SSA optimization Pass2ConditionalJumpSimplification
Rewriting && if()-condition to two if()s [60] (bool~) plexSort::$8 ← (bool~) plexSort::$6 && (bool~) plexSort::$7
Successful SSA optimization Pass2ConditionalAndOrRewriting
Constant (const byte*) SPRITES_XPOS#0 = ((byte*))$d000
Constant (const byte*) SPRITES_YPOS#0 = ((byte*))$d001
Constant (const byte*) SPRITES_XMSB#0 = ((byte*))$d010
Constant (const byte*) RASTER#0 = ((byte*))$d012
Constant (const byte*) SPRITES_ENABLE#0 = ((byte*))$d015
Constant (const byte*) BORDERCOL#0 = ((byte*))$d020
Constant (const byte*) SPRITES_COLS#0 = ((byte*))$d027
Constant (const byte*) D011#0 = ((byte*))$d011
Constant (const byte) VIC_RST8#0 = $80
Constant (const byte) VIC_DEN#0 = $10
Constant (const byte) VIC_RSEL#0 = 8
Constant (const byte) BLACK#0 = 0
Constant (const byte) GREEN#0 = 5
Constant (const byte) PLEX_COUNT#0 = $20
Constant (const word/signed word/dword/signed dword) $0 = $400+$3f8
Constant (const byte) plex_show_idx#0 = 0
Constant (const byte) plex_sprite_idx#0 = 0
Constant (const byte) plex_sprite_msb#0 = 1
Constant (const byte) plexInit::i#0 = 0
Constant (const byte) plexSort::m#0 = 0
Constant (const byte) plex_show_idx#1 = 0
Constant (const byte) plex_sprite_idx#1 = 0
Constant (const byte) plex_sprite_msb#1 = 1
Constant (const byte) plexSort::plexFreePrepare1_s#0 = 0
Constant (const byte) plex_free_next#0 = 0
Constant (const byte) plex_sprite_msb#4 = 1
Constant (const byte[8]) PLEX_FREE_YPOS#0 = { fill( 8, 0) }
Constant (const byte) plex_free_next#29 = 0
Constant (const byte*) SCREEN#0 = ((byte*))$400
Constant (const byte*) SPRITE#0 = ((byte*))$2000
Constant (const byte*) YSIN#0 = ((byte*))$2100
Constant (const word) init::xp#0 = $20
Constant (const byte) init::sx#0 = 0
Constant (const byte) init::ss#0 = 0
Constant (const byte) loop::sin_idx#0 = 0
Constant (const byte) loop::sy#0 = 0
Constant (const byte) loop::ss#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Constant (const word[PLEX_COUNT#0]) PLEX_XPOS#0 = { fill( PLEX_COUNT#0, 0) }
Constant (const byte[PLEX_COUNT#0]) PLEX_YPOS#0 = { fill( PLEX_COUNT#0, 0) }
Constant (const byte[PLEX_COUNT#0]) PLEX_PTR#0 = { fill( PLEX_COUNT#0, 0) }
Constant (const byte*) PLEX_SCREEN_PTR#0 = ((byte*))$0
Constant (const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 = { fill( PLEX_COUNT#0, 0) }
Constant (const byte/signed word/word/dword/signed dword) plexInit::$1 = PLEX_COUNT#0-1
Constant (const byte/signed word/word/dword/signed dword) plexSort::$1 = PLEX_COUNT#0-2
Constant (const byte) init::$0 = VIC_DEN#0|VIC_RSEL#0
Constant (const byte*) plexInit::screen#0 = SCREEN#0
Constant (const byte/signed word/word/dword/signed dword) init::$3 = PLEX_COUNT#0-1
Constant (const byte*) init::$4 = SPRITE#0/$40
Constant (const byte/signed word/word/dword/signed dword) loop::$1 = PLEX_COUNT#0-1
Constant (const byte/signed word/word/dword/signed dword) loop::$6 = PLEX_COUNT#0-1
Successful SSA optimization Pass2ConstantIdentification
Constant (const byte*) PLEX_SCREEN_PTR#1 = plexInit::screen#0+$3f8
Constant (const byte/word/dword) init::$1 = init::$0|3
Constant (const byte) init::$5 = ((byte))init::$4
Successful SSA optimization Pass2ConstantIdentification
Consolidated array index constant in assignment *(PLEX_SORTED_IDX#0+1 + plexSort::$2)
Consolidated array index constant in assignment *(PLEX_SORTED_IDX#0+1 + plexSort::$5)
Successful SSA optimization Pass2ConstantAdditionElimination
if() condition always true - replacing block destination [73] if(true) goto loop::@2
Successful SSA optimization Pass2ConstantIfs
Inferred type updated to byte in [6] (byte/signed word/word/dword/signed dword~) plexSort::$2 ← (byte) plexSort::m#2
Inferred type updated to byte in [13] (byte/signed word/word/dword/signed dword~) plexSort::$5 ← (byte) plexSort::s#3
Eliminating unused variable - keeping the phi block (byte) plex_show_idx#20
Eliminating unused variable - keeping the phi block (byte) plex_sprite_idx#20
Eliminating unused variable - keeping the phi block (byte) plex_sprite_msb#10
Eliminating unused variable - keeping the phi block (byte) plex_free_next#19
Eliminating unused constant (const byte*) PLEX_SCREEN_PTR#0
Successful SSA optimization PassNEliminateUnusedVars
Eliminating unused constant (const word/signed word/dword/signed dword) $0
Eliminating unused constant (const byte) plex_show_idx#0
Eliminating unused constant (const byte) plex_sprite_idx#0
Eliminating unused constant (const byte) plex_sprite_msb#0
Eliminating unused constant (const byte) plex_free_next#29
Successful SSA optimization PassNEliminateUnusedVars
Removing unused block loop::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Resolved ranged next value plexInit::i#1 ← ++ plexInit::i#2 to ++
Resolved ranged comparison value if(plexInit::i#1!=rangelast(0,plexInit::$1)) goto plexInit::@1 to (const byte/signed word/word/dword/signed dword) plexInit::$1+(byte/signed byte/word/signed word/dword/signed dword) 1
Resolved ranged next value plexSort::m#1 ← ++ plexSort::m#2 to ++
Resolved ranged comparison value if(plexSort::m#1!=rangelast(0,plexSort::$1)) goto plexSort::@1 to (const byte/signed word/word/dword/signed dword) plexSort::$1+(byte/signed byte/word/signed word/dword/signed dword) 1
Resolved ranged next value plexSort::plexFreePrepare1_s#1 ← ++ plexSort::plexFreePrepare1_s#2 to ++
Resolved ranged comparison value if(plexSort::plexFreePrepare1_s#1!=rangelast(0,7)) goto plexSort::plexFreePrepare1_@1 to (byte/signed byte/word/signed word/dword/signed dword) 8
Resolved ranged next value init::sx#1 ← ++ init::sx#2 to ++
Resolved ranged comparison value if(init::sx#1!=rangelast(0,init::$3)) goto init::@1 to (const byte/signed word/word/dword/signed dword) init::$3+(byte/signed byte/word/signed word/dword/signed dword) 1
Resolved ranged next value init::ss#1 ← ++ init::ss#2 to ++
Resolved ranged comparison value if(init::ss#1!=rangelast(0,7)) goto init::@3 to (byte/signed byte/word/signed word/dword/signed dword) 8
Resolved ranged next value loop::sy#1 ← ++ loop::sy#2 to ++
Resolved ranged comparison value if(loop::sy#1!=rangelast(0,loop::$1)) goto loop::@10 to (const byte/signed word/word/dword/signed dword) loop::$1+(byte/signed byte/word/signed word/dword/signed dword) 1
Resolved ranged next value loop::ss#1 ← ++ loop::ss#6 to ++
Resolved ranged comparison value if(loop::ss#1!=rangelast(0,loop::$6)) goto loop::@18 to (const byte/signed word/word/dword/signed dword) loop::$6+(byte/signed byte/word/signed word/dword/signed dword) 1
Rewriting multiplication to use shift (byte) plexShowSprite::$10 ← (byte) plexShowSprite::xpos_idx#0 * (const byte) SIZEOF_WORD
Rewriting multiplication to use shift (byte) plexShowSprite::$11 ← (byte) plexShowSprite::xpos_idx#0 * (const byte) SIZEOF_WORD
Rewriting multiplication to use shift (byte) init::$8 ← (byte) init::sx#2 * (const byte) SIZEOF_WORD
Successful SSA optimization Pass2MultiplyToShiftRewriting
Culled Empty Block (label) @4
Culled Empty Block (label) plexInit::@3
Culled Empty Block (label) plexSort::@5
Culled Empty Block (label) plexSort::@6
Culled Empty Block (label) plexSort::plexFreePrepare1_@2
Culled Empty Block (label) plexShowSprite::@3
Culled Empty Block (label) @9
Culled Empty Block (label) main::@2
Culled Empty Block (label) init::@5
Culled Empty Block (label) loop::@2
Culled Empty Block (label) loop::@5
Culled Empty Block (label) loop::@13
Culled Empty Block (label) loop::@14
Culled Empty Block (label) loop::plexFreeNextYpos1_@return
Culled Empty Block (label) loop::@29
Culled Empty Block (label) loop::@20
Culled Empty Block (label) @16
Successful SSA optimization Pass2CullEmptyBlocks
Alias (byte) plexSort::m#2 = (byte~) plexSort::$2
Alias (byte) plexSort::s#3 = (byte~) plexSort::$5
Successful SSA optimization Pass2AliasElimination
Self Phi Eliminated (byte*) PLEX_SCREEN_PTR#31
Self Phi Eliminated (byte) loop::sin_idx#14
Successful SSA optimization Pass2SelfPhiElimination
Redundant Phi (byte*) PLEX_SCREEN_PTR#31 (byte*) PLEX_SCREEN_PTR#44
Redundant Phi (byte) loop::sin_idx#14 (byte) loop::sin_idx#1
Successful SSA optimization Pass2RedundantPhiElimination
Simple Condition (bool~) plexSort::$6 [18] if((byte) plexSort::s#1!=(byte/word/signed word/dword/signed dword) $ff) goto plexSort::@8
Simple Condition (bool~) plexSort::$7 [96] if((byte) plexSort::nxt_y#0<*((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#1))) goto plexSort::@3
Successful SSA optimization Pass2ConditionalJumpSimplification
Eliminating unused constant (const byte) SIZEOF_WORD
Successful SSA optimization PassNEliminateUnusedVars
Self Phi Eliminated (byte*) PLEX_SCREEN_PTR#44
Successful SSA optimization Pass2SelfPhiElimination
Redundant Phi (byte*) PLEX_SCREEN_PTR#44 (const byte*) PLEX_SCREEN_PTR#1
Successful SSA optimization Pass2RedundantPhiElimination
Inlining constant with var siblings (const byte) plexInit::i#0
Inlining constant with var siblings (const byte) plexSort::m#0
Inlining constant with var siblings (const byte) plexSort::plexFreePrepare1_s#0
Inlining constant with var siblings (const word) init::xp#0
Inlining constant with var siblings (const byte) init::sx#0
Inlining constant with var siblings (const byte) init::ss#0
Inlining constant with var siblings (const byte) loop::sin_idx#0
Inlining constant with var siblings (const byte) loop::sy#0
Inlining constant with var siblings (const byte) loop::ss#0
Inlining constant with var siblings (const byte) plex_show_idx#1
Inlining constant with var siblings (const byte) plex_sprite_idx#1
Inlining constant with var siblings (const byte) plex_sprite_msb#1
Inlining constant with var siblings (const byte) plex_free_next#0
Inlining constant with var siblings (const byte) plex_sprite_msb#4
Constant inlined init::xp#0 = (byte/signed byte/word/signed word/dword/signed dword) $20
Constant inlined plexInit::$1 = (const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1
Constant inlined plexSort::$1 = (const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 2
Constant inlined plexSort::plexFreePrepare1_s#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined init::ss#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined plexInit::i#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined plexSort::m#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined init::$3 = (const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1
Constant inlined init::$1 = (const byte) VIC_DEN#0|(const byte) VIC_RSEL#0|(byte/signed byte/word/signed word/dword/signed dword) 3
Constant inlined loop::sin_idx#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined init::$0 = (const byte) VIC_DEN#0|(const byte) VIC_RSEL#0
Constant inlined plexInit::screen#0 = (const byte*) SCREEN#0
Constant inlined plex_sprite_msb#4 = (byte/signed byte/word/signed word/dword/signed dword) 1
Constant inlined init::$5 = ((byte))(const byte*) SPRITE#0/(byte/signed byte/word/signed word/dword/signed dword) $40
Constant inlined plex_show_idx#1 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined plex_sprite_idx#1 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined plex_sprite_msb#1 = (byte/signed byte/word/signed word/dword/signed dword) 1
Constant inlined init::$4 = (const byte*) SPRITE#0/(byte/signed byte/word/signed word/dword/signed dword) $40
Constant inlined loop::$1 = (const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1
Constant inlined loop::sy#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined plex_free_next#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined loop::$6 = (const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1
Constant inlined loop::ss#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined init::sx#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting loop::@32(between loop::@10 and loop::@10)
Added new block during phi lifting loop::@33(between loop::@31 and loop::@18)
Added new block during phi lifting plexShowSprite::@8(between plexShowSprite::@2 and plexShowSprite::@return)
Added new block during phi lifting plexSort::@9(between plexSort::@2 and plexSort::@1)
Added new block during phi lifting plexSort::@10(between plexSort::@8 and plexSort::@3)
Added new block during phi lifting plexSort::@11(between plexSort::@1 and plexSort::@3)
Added new block during phi lifting plexSort::@12(between plexSort::plexFreePrepare1_@1 and plexSort::plexFreePrepare1_@1)
Added new block during phi lifting init::@6(between init::@1 and init::@1)
Added new block during phi lifting init::@7(between init::@3 and init::@3)
Added new block during phi lifting plexInit::@4(between plexInit::@1 and plexInit::@1)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @15
Adding NOP phi() at start of @end
Adding NOP phi() at start of main::@1
Adding NOP phi() at start of loop
Adding NOP phi() at start of plexShowSprite::@6
Adding NOP phi() at start of plexSort
Adding NOP phi() at start of plexSort::plexFreePrepare1
Adding NOP phi() at start of plexInit
Adding NOP phi() at start of plexInit::plexSetScreen1
CALL GRAPH
Calls in [] to main:4
Calls in [main] to init:7 loop:9
Calls in [loop] to plexSort:23 plexShowSprite:32
Calls in [init] to plexInit:96
Created 16 initial phi equivalence classes
Not coalescing [15] loop::y_idx#4 ← loop::sin_idx#6
Coalesced [36] loop::sin_idx#22 ← loop::sin_idx#1
Coalesced [37] plex_free_next#50 ← plex_free_next#13
Coalesced [38] plex_sprite_idx#54 ← plex_sprite_idx#15
Coalesced [39] plex_show_idx#54 ← plex_show_idx#15
Coalesced [40] plex_sprite_msb#54 ← plex_sprite_msb#16
Coalesced [41] loop::ss#10 ← loop::ss#1
Coalesced [42] loop::y_idx#3 ← loop::y_idx#1
Coalesced [43] loop::sy#3 ← loop::sy#1
Coalesced [69] plex_sprite_msb#55 ← plex_sprite_msb#25
Not coalescing [76] plexSort::s#6 ← plexSort::m#2
Coalesced [91] plexSort::plexFreePrepare1_s#3 ← plexSort::plexFreePrepare1_s#1
Coalesced [92] plexSort::m#7 ← plexSort::m#1
Coalesced [94] plexSort::s#5 ← plexSort::s#1
Coalesced [110] init::ss#3 ← init::ss#1
Coalesced [111] init::sx#3 ← init::sx#1
Coalesced [112] init::xp#3 ← init::xp#1
Coalesced [120] plexInit::i#3 ← plexInit::i#1
Coalesced down to 15 phi equivalence classes
Culled Empty Block (label) loop::@33
Culled Empty Block (label) loop::@32
Culled Empty Block (label) plexShowSprite::@6
Culled Empty Block (label) plexSort::@12
Culled Empty Block (label) plexSort::@9
Culled Empty Block (label) plexSort::@10
Culled Empty Block (label) init::@7
Culled Empty Block (label) init::@6
Culled Empty Block (label) plexInit::@4
Renumbering block @12 to @1
Renumbering block @15 to @2
Renumbering block plexSort::@8 to plexSort::@5
Renumbering block plexSort::@11 to plexSort::@6
Renumbering block plexShowSprite::@4 to plexShowSprite::@3
Renumbering block plexShowSprite::@7 to plexShowSprite::@4
Renumbering block plexShowSprite::@8 to plexShowSprite::@5
Renumbering block loop::@4 to loop::@2
Renumbering block loop::@6 to loop::@3
Renumbering block loop::@10 to loop::@4
Renumbering block loop::@11 to loop::@5
Renumbering block loop::@12 to loop::@6
Renumbering block loop::@18 to loop::@7
Renumbering block loop::@19 to loop::@8
Renumbering block loop::@21 to loop::@9
Renumbering block loop::@25 to loop::@10
Renumbering block loop::@30 to loop::@11
Renumbering block loop::@31 to loop::@12
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
Adding NOP phi() at start of main::@1
Adding NOP phi() at start of loop
Adding NOP phi() at start of plexShowSprite::@5
Adding NOP phi() at start of plexSort
Adding NOP phi() at start of plexSort::plexFreePrepare1
Adding NOP phi() at start of plexInit
Adding NOP phi() at start of plexInit::plexSetScreen1
FINAL CONTROL FLOW GRAPH
@begin: scope:[] from
[0] phi()
to:@1
@1: scope:[] from @begin
kickasm(location (const byte*) YSIN#0) {{ .var min = 50
.var max = 250-21
.var ampl = max-min;
.for(var i=0;i<256;i++)
.byte round(min+(ampl/2)+(ampl/2)*sin(toRadians(360*i/256)))
}}
kickasm(location (const byte*) SPRITE#0) {{ .var pic = LoadPicture("balloon.png", List().add($000000, $ffffff))
.for (var y=0; y<21; y++)
.for (var x=0;x<3; x++)
.byte pic.getSinglecolorByte(x,y)
}}
to:@2
@2: scope:[] from @1
[3] phi()
[4] call main
to:@end
@end: scope:[] from @2
[5] phi()
main: scope:[main] from @2
asm { sei }
[7] call init
to:main::@1
main::@1: scope:[main] from main
[8] phi()
[9] call loop
to:main::@return
main::@return: scope:[main] from main::@1
[10] return
to:@return
loop: scope:[loop] from main::@1
[11] phi()
to:loop::@1
loop::@1: scope:[loop] from loop loop::@10
[12] (byte) loop::sin_idx#6 ← phi( loop/(byte/signed byte/word/signed word/dword/signed dword) 0 loop::@10/(byte) loop::sin_idx#1 )
to:loop::@2
loop::@2: scope:[loop] from loop::@1 loop::@2
[13] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) $ff) goto loop::@2
to:loop::@3
loop::@3: scope:[loop] from loop::@2
[14] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0)
[15] (byte~) loop::y_idx#4 ← (byte) loop::sin_idx#6
to:loop::@4
loop::@4: scope:[loop] from loop::@3 loop::@4
[16] (byte) loop::sy#2 ← phi( loop::@4/(byte) loop::sy#1 loop::@3/(byte/signed byte/word/signed word/dword/signed dword) 0 )
[16] (byte) loop::y_idx#2 ← phi( loop::@4/(byte) loop::y_idx#1 loop::@3/(byte~) loop::y_idx#4 )
[17] *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + (byte) loop::sy#2) ← *((const byte*) YSIN#0 + (byte) loop::y_idx#2)
[18] (byte) loop::y_idx#1 ← (byte) loop::y_idx#2 + (byte/signed byte/word/signed word/dword/signed dword) 8
[19] (byte) loop::sy#1 ← ++ (byte) loop::sy#2
[20] if((byte) loop::sy#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto loop::@4
to:loop::@5
loop::@5: scope:[loop] from loop::@4
[21] (byte) loop::sin_idx#1 ← (byte) loop::sin_idx#6 + (byte/signed byte/word/signed word/dword/signed dword) 1
[22] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0)
[23] call plexSort
to:loop::@11
loop::@11: scope:[loop] from loop::@5
[24] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0
to:loop::@6
loop::@6: scope:[loop] from loop::@11 loop::@6
[25] (byte~) loop::$4 ← *((const byte*) D011#0) & (const byte) VIC_RST8#0
[26] if((byte~) loop::$4!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto loop::@6
to:loop::@7
loop::@7: scope:[loop] from loop::@12 loop::@6
[27] (byte) loop::ss#6 ← phi( loop::@6/(byte/signed byte/word/signed word/dword/signed dword) 0 loop::@12/(byte) loop::ss#1 )
[27] (byte) plex_sprite_msb#44 ← phi( loop::@6/(byte/signed byte/word/signed word/dword/signed dword) 1 loop::@12/(byte) plex_sprite_msb#16 )
[27] (byte) plex_show_idx#44 ← phi( loop::@6/(byte/signed byte/word/signed word/dword/signed dword) 0 loop::@12/(byte) plex_show_idx#15 )
[27] (byte) plex_sprite_idx#44 ← phi( loop::@6/(byte/signed byte/word/signed word/dword/signed dword) 0 loop::@12/(byte) plex_sprite_idx#15 )
[27] (byte) plex_free_next#17 ← phi( loop::@6/(byte/signed byte/word/signed word/dword/signed dword) 0 loop::@12/(byte) plex_free_next#13 )
[28] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0
to:loop::plexFreeNextYpos1
loop::plexFreeNextYpos1: scope:[loop] from loop::@7
[29] (byte) loop::plexFreeNextYpos1_return#0 ← *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plex_free_next#17)
to:loop::@8
loop::@8: scope:[loop] from loop::@8 loop::plexFreeNextYpos1
[30] if(*((const byte*) RASTER#0)<(byte) loop::plexFreeNextYpos1_return#0) goto loop::@8
to:loop::@9
loop::@9: scope:[loop] from loop::@8
[31] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0)
[32] call plexShowSprite
to:loop::@12
loop::@12: scope:[loop] from loop::@9
[33] (byte) loop::ss#1 ← ++ (byte) loop::ss#6
[34] if((byte) loop::ss#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto loop::@7
to:loop::@10
loop::@10: scope:[loop] from loop::@12
[35] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0
to:loop::@1
plexShowSprite: scope:[plexShowSprite] from loop::@9
[36] (byte) plexShowSprite::plex_sprite_idx2#0 ← (byte) plex_sprite_idx#44 << (byte/signed byte/word/signed word/dword/signed dword) 1
[37] (byte) plexShowSprite::plexFreeAdd1_ypos#0 ← *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44))
[38] *((const byte*) SPRITES_YPOS#0 + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte) plexShowSprite::plexFreeAdd1_ypos#0
to:plexShowSprite::plexFreeAdd1
plexShowSprite::plexFreeAdd1: scope:[plexShowSprite] from plexShowSprite
[39] (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0 ← (byte) plexShowSprite::plexFreeAdd1_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) $15
[40] *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plex_free_next#17) ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0
[41] (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 ← (byte) plex_free_next#17 + (byte/signed byte/word/signed word/dword/signed dword) 1
[42] (byte) plex_free_next#13 ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 & (byte/signed byte/word/signed word/dword/signed dword) 7
to:plexShowSprite::@4
plexShowSprite::@4: scope:[plexShowSprite] from plexShowSprite::plexFreeAdd1
[43] *((const byte*) PLEX_SCREEN_PTR#1 + (byte) plex_sprite_idx#44) ← *((const byte[PLEX_COUNT#0]) PLEX_PTR#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44))
[44] (byte) plexShowSprite::xpos_idx#0 ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44)
[45] (byte) plexShowSprite::$10 ← (byte) plexShowSprite::xpos_idx#0 << (byte/signed byte/word/signed word/dword/signed dword) 1
[46] (byte~) plexShowSprite::$2 ← < *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::$10)
[47] *((const byte*) SPRITES_XPOS#0 + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte~) plexShowSprite::$2
[48] (byte) plexShowSprite::$11 ← (byte) plexShowSprite::xpos_idx#0 << (byte/signed byte/word/signed word/dword/signed dword) 1
[49] (byte~) plexShowSprite::$3 ← > *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::$11)
[50] if((byte~) plexShowSprite::$3!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto plexShowSprite::@1
to:plexShowSprite::@3
plexShowSprite::@3: scope:[plexShowSprite] from plexShowSprite::@4
[51] (byte/word/dword~) plexShowSprite::$9 ← (byte/word/signed word/dword/signed dword) $ff ^ (byte) plex_sprite_msb#44
[52] *((const byte*) SPRITES_XMSB#0) ← *((const byte*) SPRITES_XMSB#0) & (byte/word/dword~) plexShowSprite::$9
to:plexShowSprite::@2
plexShowSprite::@2: scope:[plexShowSprite] from plexShowSprite::@1 plexShowSprite::@3
[53] (byte/signed word/word/dword/signed dword~) plexShowSprite::$5 ← (byte) plex_sprite_idx#44 + (byte/signed byte/word/signed word/dword/signed dword) 1
[54] (byte) plex_sprite_idx#15 ← (byte/signed word/word/dword/signed dword~) plexShowSprite::$5 & (byte/signed byte/word/signed word/dword/signed dword) 7
[55] (byte) plex_show_idx#15 ← ++ (byte) plex_show_idx#44
[56] (byte) plex_sprite_msb#25 ← (byte) plex_sprite_msb#44 << (byte/signed byte/word/signed word/dword/signed dword) 1
[57] if((byte) plex_sprite_msb#25!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto plexShowSprite::@5
to:plexShowSprite::@return
plexShowSprite::@return: scope:[plexShowSprite] from plexShowSprite::@2 plexShowSprite::@5
[58] (byte) plex_sprite_msb#16 ← phi( plexShowSprite::@5/(byte) plex_sprite_msb#25 plexShowSprite::@2/(byte/signed byte/word/signed word/dword/signed dword) 1 )
[59] return
to:@return
plexShowSprite::@5: scope:[plexShowSprite] from plexShowSprite::@2
[60] phi()
to:plexShowSprite::@return
plexShowSprite::@1: scope:[plexShowSprite] from plexShowSprite::@4
[61] *((const byte*) SPRITES_XMSB#0) ← *((const byte*) SPRITES_XMSB#0) | (byte) plex_sprite_msb#44
to:plexShowSprite::@2
plexSort: scope:[plexSort] from loop::@5
[62] phi()
to:plexSort::@1
plexSort::@1: scope:[plexSort] from plexSort plexSort::@2
[63] (byte) plexSort::m#2 ← phi( plexSort/(byte/signed byte/word/signed word/dword/signed dword) 0 plexSort::@2/(byte) plexSort::m#1 )
[64] (byte) plexSort::nxt_idx#0 ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) plexSort::m#2)
[65] (byte) plexSort::nxt_y#0 ← *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + (byte) plexSort::nxt_idx#0)
[66] if((byte) plexSort::nxt_y#0>=*((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::m#2))) goto plexSort::@2
to:plexSort::@6
plexSort::@6: scope:[plexSort] from plexSort::@1
[67] (byte~) plexSort::s#6 ← (byte) plexSort::m#2
to:plexSort::@3
plexSort::@3: scope:[plexSort] from plexSort::@5 plexSort::@6
[68] (byte) plexSort::s#3 ← phi( plexSort::@5/(byte) plexSort::s#1 plexSort::@6/(byte~) plexSort::s#6 )
[69] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) plexSort::s#3) ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#3)
[70] (byte) plexSort::s#1 ← -- (byte) plexSort::s#3
[71] if((byte) plexSort::s#1!=(byte/word/signed word/dword/signed dword) $ff) goto plexSort::@5
to:plexSort::@4
plexSort::@4: scope:[plexSort] from plexSort::@3 plexSort::@5
[72] (byte) plexSort::s#2 ← ++ (byte) plexSort::s#1
[73] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#2) ← (byte) plexSort::nxt_idx#0
to:plexSort::@2
plexSort::@2: scope:[plexSort] from plexSort::@1 plexSort::@4
[74] (byte) plexSort::m#1 ← ++ (byte) plexSort::m#2
[75] if((byte) plexSort::m#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 2+(byte/signed byte/word/signed word/dword/signed dword) 1) goto plexSort::@1
to:plexSort::plexFreePrepare1
plexSort::plexFreePrepare1: scope:[plexSort] from plexSort::@2
[76] phi()
to:plexSort::plexFreePrepare1_@1
plexSort::plexFreePrepare1_@1: scope:[plexSort] from plexSort::plexFreePrepare1 plexSort::plexFreePrepare1_@1
[77] (byte) plexSort::plexFreePrepare1_s#2 ← phi( plexSort::plexFreePrepare1/(byte/signed byte/word/signed word/dword/signed dword) 0 plexSort::plexFreePrepare1_@1/(byte) plexSort::plexFreePrepare1_s#1 )
[78] *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plexSort::plexFreePrepare1_s#2) ← (byte/signed byte/word/signed word/dword/signed dword) 0
[79] (byte) plexSort::plexFreePrepare1_s#1 ← ++ (byte) plexSort::plexFreePrepare1_s#2
[80] if((byte) plexSort::plexFreePrepare1_s#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto plexSort::plexFreePrepare1_@1
to:plexSort::@return
plexSort::@return: scope:[plexSort] from plexSort::plexFreePrepare1_@1
[81] return
to:@return
plexSort::@5: scope:[plexSort] from plexSort::@3
[82] if((byte) plexSort::nxt_y#0<*((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#1))) goto plexSort::@3
to:plexSort::@4
init: scope:[init] from main
[83] *((const byte*) D011#0) ← (const byte) VIC_DEN#0|(const byte) VIC_RSEL#0|(byte/signed byte/word/signed word/dword/signed dword) 3
[84] call plexInit
to:init::@1
init::@1: scope:[init] from init init::@1
[85] (word) init::xp#2 ← phi( init::@1/(word) init::xp#1 init/(byte/signed byte/word/signed word/dword/signed dword) $20 )
[85] (byte) init::sx#2 ← phi( init::@1/(byte) init::sx#1 init/(byte/signed byte/word/signed word/dword/signed dword) 0 )
[86] *((const byte[PLEX_COUNT#0]) PLEX_PTR#0 + (byte) init::sx#2) ← ((byte))(const byte*) SPRITE#0/(byte/signed byte/word/signed word/dword/signed dword) $40
[87] (byte) init::$8 ← (byte) init::sx#2 << (byte/signed byte/word/signed word/dword/signed dword) 1
[88] *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) init::$8) ← (word) init::xp#2
[89] (word) init::xp#1 ← (word) init::xp#2 + (byte/signed byte/word/signed word/dword/signed dword) 9
[90] (byte) init::sx#1 ← ++ (byte) init::sx#2
[91] if((byte) init::sx#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto init::@1
to:init::@2
init::@2: scope:[init] from init::@1
[92] *((const byte*) SPRITES_ENABLE#0) ← (byte/word/signed word/dword/signed dword) $ff
to:init::@3
init::@3: scope:[init] from init::@2 init::@3
[93] (byte) init::ss#2 ← phi( init::@2/(byte/signed byte/word/signed word/dword/signed dword) 0 init::@3/(byte) init::ss#1 )
[94] *((const byte*) SPRITES_COLS#0 + (byte) init::ss#2) ← (const byte) GREEN#0
[95] (byte) init::ss#1 ← ++ (byte) init::ss#2
[96] if((byte) init::ss#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto init::@3
to:init::@return
init::@return: scope:[init] from init::@3
[97] return
to:@return
plexInit: scope:[plexInit] from init
[98] phi()
to:plexInit::plexSetScreen1
plexInit::plexSetScreen1: scope:[plexInit] from plexInit
[99] phi()
to:plexInit::@1
plexInit::@1: scope:[plexInit] from plexInit::@1 plexInit::plexSetScreen1
[100] (byte) plexInit::i#2 ← phi( plexInit::@1/(byte) plexInit::i#1 plexInit::plexSetScreen1/(byte/signed byte/word/signed word/dword/signed dword) 0 )
[101] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexInit::i#2) ← (byte) plexInit::i#2
[102] (byte) plexInit::i#1 ← ++ (byte) plexInit::i#2
[103] if((byte) plexInit::i#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto plexInit::@1
to:plexInit::@return
plexInit::@return: scope:[plexInit] from plexInit::@1
[104] return
to:@return
VARIABLE REGISTER WEIGHTS
(byte) BLACK
(byte*) BORDERCOL
(byte*) D011
(byte) GREEN
(byte) PLEX_COUNT
(byte[8]) PLEX_FREE_YPOS
(byte[PLEX_COUNT#0]) PLEX_PTR
(byte*) PLEX_SCREEN_PTR
(byte[PLEX_COUNT#0]) PLEX_SORTED_IDX
(word[PLEX_COUNT#0]) PLEX_XPOS
(byte[PLEX_COUNT#0]) PLEX_YPOS
(byte*) RASTER
(byte*) SCREEN
(byte*) SPRITE
(byte*) SPRITES_COLS
(byte*) SPRITES_ENABLE
(byte*) SPRITES_XMSB
(byte*) SPRITES_XPOS
(byte*) SPRITES_YPOS
(byte) VIC_DEN
(byte) VIC_RSEL
(byte) VIC_RST8
(byte*) YSIN
(void()) init()
(byte) init::$8 22.0
(byte) init::ss
(byte) init::ss#1 16.5
(byte) init::ss#2 16.5
(byte) init::sx
(byte) init::sx#1 16.5
(byte) init::sx#2 8.8
(word) init::xp
(word) init::xp#1 7.333333333333333
(word) init::xp#2 8.25
(void()) loop()
(byte~) loop::$4 202.0
(byte) loop::plexFreeNextYpos1_return
(byte) loop::plexFreeNextYpos1_return#0 551.0
(byte) loop::rasterY
(byte) loop::sin_idx
(byte) loop::sin_idx#1 1.4666666666666666
(byte) loop::sin_idx#6 3.666666666666667
(byte) loop::ss
(byte) loop::ss#1 151.5
(byte) loop::ss#6 33.666666666666664
(byte) loop::sy
(byte) loop::sy#1 151.5
(byte) loop::sy#2 101.0
(byte) loop::y_idx
(byte) loop::y_idx#1 67.33333333333333
(byte) loop::y_idx#2 157.0
(byte~) loop::y_idx#4 22.0
(void()) main()
(void()) plexInit((byte*) plexInit::screen)
(byte) plexInit::i
(byte) plexInit::i#1 16.5
(byte) plexInit::i#2 22.0
(byte*~) plexInit::plexSetScreen1_$0
(byte*) plexInit::plexSetScreen1_screen
(byte*) plexInit::screen
(void()) plexShowSprite()
(byte) plexShowSprite::$10 4.0
(byte) plexShowSprite::$11 4.0
(byte~) plexShowSprite::$2 4.0
(byte~) plexShowSprite::$3 4.0
(byte/signed word/word/dword/signed dword~) plexShowSprite::$5 4.0
(byte/word/dword~) plexShowSprite::$9 4.0
(byte/signed word/word/dword/signed dword~) plexShowSprite::plexFreeAdd1_$0
(byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0 4.0
(byte/signed word/word/dword/signed dword~) plexShowSprite::plexFreeAdd1_$1
(byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 4.0
(byte/word/dword~) plexShowSprite::plexFreeAdd1_$2
(byte) plexShowSprite::plexFreeAdd1_ypos
(byte) plexShowSprite::plexFreeAdd1_ypos#0 3.0
(byte) plexShowSprite::plex_sprite_idx2
(byte) plexShowSprite::plex_sprite_idx2#0 0.5454545454545454
(byte) plexShowSprite::xpos_idx
(byte) plexShowSprite::xpos_idx#0 1.5
(byte) plexShowSprite::ypos
(void()) plexSort()
(byte) plexSort::m
(byte) plexSort::m#1 151.5
(byte) plexSort::m#2 42.08333333333333
(byte) plexSort::nxt_idx
(byte) plexSort::nxt_idx#0 30.299999999999997
(byte) plexSort::nxt_y
(byte) plexSort::nxt_y#0 150.375
(bool~) plexSort::plexFreePrepare1_$0
(byte) plexSort::plexFreePrepare1_s
(byte) plexSort::plexFreePrepare1_s#1 151.5
(byte) plexSort::plexFreePrepare1_s#2 151.5
(byte) plexSort::s
(byte) plexSort::s#1 1368.3333333333335
(byte) plexSort::s#2 202.0
(byte) plexSort::s#3 2052.5
(byte~) plexSort::s#6 202.0
(byte) plex_free_next
(byte) plex_free_next#13 4.478260869565218
(byte) plex_free_next#17 20.599999999999998
(byte) plex_show_idx
(byte) plex_show_idx#15 11.444444444444443
(byte) plex_show_idx#44 4.36
(byte) plex_sprite_idx
(byte) plex_sprite_idx#15 10.299999999999999
(byte) plex_sprite_idx#44 4.652173913043479
(byte) plex_sprite_msb
(byte) plex_sprite_msb#16 20.599999999999998
(byte) plex_sprite_msb#25 2.0
(byte) plex_sprite_msb#44 4.115384615384615
Initial phi equivalence classes
[ loop::sin_idx#6 loop::sin_idx#1 ]
[ loop::y_idx#2 loop::y_idx#1 loop::y_idx#4 ]
[ loop::sy#2 loop::sy#1 ]
[ plex_free_next#17 plex_free_next#13 ]
[ plex_sprite_idx#44 plex_sprite_idx#15 ]
[ plex_show_idx#44 plex_show_idx#15 ]
[ plex_sprite_msb#44 plex_sprite_msb#16 plex_sprite_msb#25 ]
[ loop::ss#6 loop::ss#1 ]
[ plexSort::m#2 plexSort::m#1 ]
[ plexSort::s#3 plexSort::s#1 plexSort::s#6 ]
[ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ]
[ init::sx#2 init::sx#1 ]
[ init::xp#2 init::xp#1 ]
[ init::ss#2 init::ss#1 ]
[ plexInit::i#2 plexInit::i#1 ]
Added variable loop::$4 to zero page equivalence class [ loop::$4 ]
Added variable loop::plexFreeNextYpos1_return#0 to zero page equivalence class [ loop::plexFreeNextYpos1_return#0 ]
Added variable plexShowSprite::plex_sprite_idx2#0 to zero page equivalence class [ plexShowSprite::plex_sprite_idx2#0 ]
Added variable plexShowSprite::plexFreeAdd1_ypos#0 to zero page equivalence class [ plexShowSprite::plexFreeAdd1_ypos#0 ]
Added variable plexShowSprite::plexFreeAdd1_$0#0 to zero page equivalence class [ plexShowSprite::plexFreeAdd1_$0#0 ]
Added variable plexShowSprite::plexFreeAdd1_$1#0 to zero page equivalence class [ plexShowSprite::plexFreeAdd1_$1#0 ]
Added variable plexShowSprite::xpos_idx#0 to zero page equivalence class [ plexShowSprite::xpos_idx#0 ]
Added variable plexShowSprite::$10 to zero page equivalence class [ plexShowSprite::$10 ]
Added variable plexShowSprite::$2 to zero page equivalence class [ plexShowSprite::$2 ]
Added variable plexShowSprite::$11 to zero page equivalence class [ plexShowSprite::$11 ]
Added variable plexShowSprite::$3 to zero page equivalence class [ plexShowSprite::$3 ]
Added variable plexShowSprite::$9 to zero page equivalence class [ plexShowSprite::$9 ]
Added variable plexShowSprite::$5 to zero page equivalence class [ plexShowSprite::$5 ]
Added variable plexSort::nxt_idx#0 to zero page equivalence class [ plexSort::nxt_idx#0 ]
Added variable plexSort::nxt_y#0 to zero page equivalence class [ plexSort::nxt_y#0 ]
Added variable plexSort::s#2 to zero page equivalence class [ plexSort::s#2 ]
Added variable init::$8 to zero page equivalence class [ init::$8 ]
Complete equivalence classes
[ loop::sin_idx#6 loop::sin_idx#1 ]
[ loop::y_idx#2 loop::y_idx#1 loop::y_idx#4 ]
[ loop::sy#2 loop::sy#1 ]
[ plex_free_next#17 plex_free_next#13 ]
[ plex_sprite_idx#44 plex_sprite_idx#15 ]
[ plex_show_idx#44 plex_show_idx#15 ]
[ plex_sprite_msb#44 plex_sprite_msb#16 plex_sprite_msb#25 ]
[ loop::ss#6 loop::ss#1 ]
[ plexSort::m#2 plexSort::m#1 ]
[ plexSort::s#3 plexSort::s#1 plexSort::s#6 ]
[ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ]
[ init::sx#2 init::sx#1 ]
[ init::xp#2 init::xp#1 ]
[ init::ss#2 init::ss#1 ]
[ plexInit::i#2 plexInit::i#1 ]
[ loop::$4 ]
[ loop::plexFreeNextYpos1_return#0 ]
[ plexShowSprite::plex_sprite_idx2#0 ]
[ plexShowSprite::plexFreeAdd1_ypos#0 ]
[ plexShowSprite::plexFreeAdd1_$0#0 ]
[ plexShowSprite::plexFreeAdd1_$1#0 ]
[ plexShowSprite::xpos_idx#0 ]
[ plexShowSprite::$10 ]
[ plexShowSprite::$2 ]
[ plexShowSprite::$11 ]
[ plexShowSprite::$3 ]
[ plexShowSprite::$9 ]
[ plexShowSprite::$5 ]
[ plexSort::nxt_idx#0 ]
[ plexSort::nxt_y#0 ]
[ plexSort::s#2 ]
[ init::$8 ]
Allocated zp ZP_BYTE:2 [ loop::sin_idx#6 loop::sin_idx#1 ]
Allocated zp ZP_BYTE:3 [ loop::y_idx#2 loop::y_idx#1 loop::y_idx#4 ]
Allocated zp ZP_BYTE:4 [ loop::sy#2 loop::sy#1 ]
Allocated zp ZP_BYTE:5 [ plex_free_next#17 plex_free_next#13 ]
Allocated zp ZP_BYTE:6 [ plex_sprite_idx#44 plex_sprite_idx#15 ]
Allocated zp ZP_BYTE:7 [ plex_show_idx#44 plex_show_idx#15 ]
Allocated zp ZP_BYTE:8 [ plex_sprite_msb#44 plex_sprite_msb#16 plex_sprite_msb#25 ]
Allocated zp ZP_BYTE:9 [ loop::ss#6 loop::ss#1 ]
Allocated zp ZP_BYTE:10 [ plexSort::m#2 plexSort::m#1 ]
Allocated zp ZP_BYTE:11 [ plexSort::s#3 plexSort::s#1 plexSort::s#6 ]
Allocated zp ZP_BYTE:12 [ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ]
Allocated zp ZP_BYTE:13 [ init::sx#2 init::sx#1 ]
Allocated zp ZP_WORD:14 [ init::xp#2 init::xp#1 ]
Allocated zp ZP_BYTE:16 [ init::ss#2 init::ss#1 ]
Allocated zp ZP_BYTE:17 [ plexInit::i#2 plexInit::i#1 ]
Allocated zp ZP_BYTE:18 [ loop::$4 ]
Allocated zp ZP_BYTE:19 [ loop::plexFreeNextYpos1_return#0 ]
Allocated zp ZP_BYTE:20 [ plexShowSprite::plex_sprite_idx2#0 ]
Allocated zp ZP_BYTE:21 [ plexShowSprite::plexFreeAdd1_ypos#0 ]
Allocated zp ZP_BYTE:22 [ plexShowSprite::plexFreeAdd1_$0#0 ]
Allocated zp ZP_BYTE:23 [ plexShowSprite::plexFreeAdd1_$1#0 ]
Allocated zp ZP_BYTE:24 [ plexShowSprite::xpos_idx#0 ]
Allocated zp ZP_BYTE:25 [ plexShowSprite::$10 ]
Allocated zp ZP_BYTE:26 [ plexShowSprite::$2 ]
Allocated zp ZP_BYTE:27 [ plexShowSprite::$11 ]
Allocated zp ZP_BYTE:28 [ plexShowSprite::$3 ]
Allocated zp ZP_BYTE:29 [ plexShowSprite::$9 ]
Allocated zp ZP_BYTE:30 [ plexShowSprite::$5 ]
Allocated zp ZP_BYTE:31 [ plexSort::nxt_idx#0 ]
Allocated zp ZP_BYTE:32 [ plexSort::nxt_y#0 ]
Allocated zp ZP_BYTE:33 [ plexSort::s#2 ]
Allocated zp ZP_BYTE:34 [ init::$8 ]
INITIAL ASM
//SEG0 File Comments
// A simple usage of the flexible sprite multiplexer routine
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
.label SPRITES_XPOS = $d000
.label SPRITES_YPOS = $d001
.label SPRITES_XMSB = $d010
.label RASTER = $d012
.label SPRITES_ENABLE = $d015
.label BORDERCOL = $d020
.label SPRITES_COLS = $d027
.label D011 = $d011
.const VIC_RST8 = $80
.const VIC_DEN = $10
.const VIC_RSEL = 8
// The colors of the C64
.const BLACK = 0
.const GREEN = 5
// The number of sprites in the multiplexer
.const PLEX_COUNT = $20
// Location of screen & sprites
.label SCREEN = $400
.label SPRITE = $2000
.label YSIN = $2100
.label PLEX_SCREEN_PTR = SCREEN+$3f8
.label plex_free_next = 5
.label plex_sprite_idx = 6
.label plex_show_idx = 7
.label plex_sprite_msb = 8
//SEG3 @begin
bbegin:
jmp b1
//SEG4 @1
b1:
//SEG5 kickasm(location (const byte*) YSIN#0) {{ .var min = 50 .var max = 250-21 .var ampl = max-min; .for(var i=0;i<256;i++) .byte round(min+(ampl/2)+(ampl/2)*sin(toRadians(360*i/256))) }}
//SEG6 kickasm(location (const byte*) SPRITE#0) {{ .var pic = LoadPicture("balloon.png", List().add($000000, $ffffff)) .for (var y=0; y<21; y++) .for (var x=0;x<3; x++) .byte pic.getSinglecolorByte(x,y) }}
//SEG7 [3] phi from @1 to @2 [phi:@1->@2]
b2_from_b1:
jmp b2
//SEG8 @2
b2:
//SEG9 [4] call main
jsr main
//SEG10 [5] phi from @2 to @end [phi:@2->@end]
bend_from_b2:
jmp bend
//SEG11 @end
bend:
//SEG12 main
main: {
//SEG13 asm { sei }
sei
//SEG14 [7] call init
jsr init
//SEG15 [8] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
jmp b1
//SEG16 main::@1
b1:
//SEG17 [9] call loop
//SEG18 [11] phi from main::@1 to loop [phi:main::@1->loop]
loop_from_b1:
jsr loop
jmp breturn
//SEG19 main::@return
breturn:
//SEG20 [10] return
rts
}
//SEG21 loop
// The raster loop
loop: {
.label _4 = $12
.label y_idx = 3
.label sy = 4
.label sin_idx = 2
.label plexFreeNextYpos1_return = $13
.label ss = 9
//SEG22 [12] phi from loop to loop::@1 [phi:loop->loop::@1]
b1_from_loop:
//SEG23 [12] phi (byte) loop::sin_idx#6 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop->loop::@1#0] -- vbuz1=vbuc1
lda #0
sta sin_idx
jmp b1
//SEG24 loop::@1
b1:
jmp b2
//SEG25 loop::@2
b2:
//SEG26 [13] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) $ff) goto loop::@2 -- _deref_pbuc1_neq_vbuc2_then_la1
lda #$ff
cmp RASTER
bne b2
jmp b3
//SEG27 loop::@3
b3:
//SEG28 [14] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
inc BORDERCOL
//SEG29 [15] (byte~) loop::y_idx#4 ← (byte) loop::sin_idx#6 -- vbuz1=vbuz2
lda sin_idx
sta y_idx
//SEG30 [16] phi from loop::@3 to loop::@4 [phi:loop::@3->loop::@4]
b4_from_b3:
//SEG31 [16] phi (byte) loop::sy#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@3->loop::@4#0] -- vbuz1=vbuc1
lda #0
sta sy
//SEG32 [16] phi (byte) loop::y_idx#2 = (byte~) loop::y_idx#4 [phi:loop::@3->loop::@4#1] -- register_copy
jmp b4
//SEG33 [16] phi from loop::@4 to loop::@4 [phi:loop::@4->loop::@4]
b4_from_b4:
//SEG34 [16] phi (byte) loop::sy#2 = (byte) loop::sy#1 [phi:loop::@4->loop::@4#0] -- register_copy
//SEG35 [16] phi (byte) loop::y_idx#2 = (byte) loop::y_idx#1 [phi:loop::@4->loop::@4#1] -- register_copy
jmp b4
//SEG36 loop::@4
b4:
//SEG37 [17] *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + (byte) loop::sy#2) ← *((const byte*) YSIN#0 + (byte) loop::y_idx#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz2
ldy y_idx
lda YSIN,y
ldy sy
sta PLEX_YPOS,y
//SEG38 [18] (byte) loop::y_idx#1 ← (byte) loop::y_idx#2 + (byte/signed byte/word/signed word/dword/signed dword) 8 -- vbuz1=vbuz1_plus_vbuc1
lax y_idx
axs #-[8]
stx y_idx
//SEG39 [19] (byte) loop::sy#1 ← ++ (byte) loop::sy#2 -- vbuz1=_inc_vbuz1
inc sy
//SEG40 [20] if((byte) loop::sy#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto loop::@4 -- vbuz1_neq_vbuc1_then_la1
lda #PLEX_COUNT-1+1
cmp sy
bne b4_from_b4
jmp b5
//SEG41 loop::@5
b5:
//SEG42 [21] (byte) loop::sin_idx#1 ← (byte) loop::sin_idx#6 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1
inc sin_idx
//SEG43 [22] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
inc BORDERCOL
//SEG44 [23] call plexSort
//SEG45 [62] phi from loop::@5 to plexSort [phi:loop::@5->plexSort]
plexSort_from_b5:
jsr plexSort
jmp b11
//SEG46 loop::@11
b11:
//SEG47 [24] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2
lda #BLACK
sta BORDERCOL
jmp b6
//SEG48 loop::@6
b6:
//SEG49 [25] (byte~) loop::$4 ← *((const byte*) D011#0) & (const byte) VIC_RST8#0 -- vbuz1=_deref_pbuc1_band_vbuc2
lda #VIC_RST8
and D011
sta _4
//SEG50 [26] if((byte~) loop::$4!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto loop::@6 -- vbuz1_neq_0_then_la1
lda _4
cmp #0
bne b6
//SEG51 [27] phi from loop::@6 to loop::@7 [phi:loop::@6->loop::@7]
b7_from_b6:
//SEG52 [27] phi (byte) loop::ss#6 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@6->loop::@7#0] -- vbuz1=vbuc1
lda #0
sta ss
//SEG53 [27] phi (byte) plex_sprite_msb#44 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:loop::@6->loop::@7#1] -- vbuz1=vbuc1
lda #1
sta plex_sprite_msb
//SEG54 [27] phi (byte) plex_show_idx#44 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@6->loop::@7#2] -- vbuz1=vbuc1
lda #0
sta plex_show_idx
//SEG55 [27] phi (byte) plex_sprite_idx#44 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@6->loop::@7#3] -- vbuz1=vbuc1
lda #0
sta plex_sprite_idx
//SEG56 [27] phi (byte) plex_free_next#17 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@6->loop::@7#4] -- vbuz1=vbuc1
lda #0
sta plex_free_next
jmp b7
// Show the sprites
//SEG57 [27] phi from loop::@12 to loop::@7 [phi:loop::@12->loop::@7]
b7_from_b12:
//SEG58 [27] phi (byte) loop::ss#6 = (byte) loop::ss#1 [phi:loop::@12->loop::@7#0] -- register_copy
//SEG59 [27] phi (byte) plex_sprite_msb#44 = (byte) plex_sprite_msb#16 [phi:loop::@12->loop::@7#1] -- register_copy
//SEG60 [27] phi (byte) plex_show_idx#44 = (byte) plex_show_idx#15 [phi:loop::@12->loop::@7#2] -- register_copy
//SEG61 [27] phi (byte) plex_sprite_idx#44 = (byte) plex_sprite_idx#15 [phi:loop::@12->loop::@7#3] -- register_copy
//SEG62 [27] phi (byte) plex_free_next#17 = (byte) plex_free_next#13 [phi:loop::@12->loop::@7#4] -- register_copy
jmp b7
//SEG63 loop::@7
b7:
//SEG64 [28] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2
lda #BLACK
sta BORDERCOL
jmp plexFreeNextYpos1
//SEG65 loop::plexFreeNextYpos1
plexFreeNextYpos1:
//SEG66 [29] (byte) loop::plexFreeNextYpos1_return#0 ← *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plex_free_next#17) -- vbuz1=pbuc1_derefidx_vbuz2
ldy plex_free_next
lda PLEX_FREE_YPOS,y
sta plexFreeNextYpos1_return
jmp b8
//SEG67 loop::@8
b8:
//SEG68 [30] if(*((const byte*) RASTER#0)<(byte) loop::plexFreeNextYpos1_return#0) goto loop::@8 -- _deref_pbuc1_lt_vbuz1_then_la1
lda RASTER
cmp plexFreeNextYpos1_return
bcc b8
jmp b9
//SEG69 loop::@9
b9:
//SEG70 [31] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
inc BORDERCOL
//SEG71 [32] call plexShowSprite
jsr plexShowSprite
jmp b12
//SEG72 loop::@12
b12:
//SEG73 [33] (byte) loop::ss#1 ← ++ (byte) loop::ss#6 -- vbuz1=_inc_vbuz1
inc ss
//SEG74 [34] if((byte) loop::ss#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto loop::@7 -- vbuz1_neq_vbuc1_then_la1
lda #PLEX_COUNT-1+1
cmp ss
bne b7_from_b12
jmp b10
//SEG75 loop::@10
b10:
//SEG76 [35] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2
lda #BLACK
sta BORDERCOL
//SEG77 [12] phi from loop::@10 to loop::@1 [phi:loop::@10->loop::@1]
b1_from_b10:
//SEG78 [12] phi (byte) loop::sin_idx#6 = (byte) loop::sin_idx#1 [phi:loop::@10->loop::@1#0] -- register_copy
jmp b1
}
//SEG79 plexShowSprite
// Show the next sprite.
// plexSort() prepares showing the sprites
plexShowSprite: {
.label _2 = $1a
.label _3 = $1c
.label _5 = $1e
.label _9 = $1d
.label _10 = $19
.label _11 = $1b
.label plex_sprite_idx2 = $14
.label plexFreeAdd1_ypos = $15
.label plexFreeAdd1__0 = $16
.label plexFreeAdd1__1 = $17
.label xpos_idx = $18
//SEG80 [36] (byte) plexShowSprite::plex_sprite_idx2#0 ← (byte) plex_sprite_idx#44 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz2_rol_1
lda plex_sprite_idx
asl
sta plex_sprite_idx2
//SEG81 [37] (byte) plexShowSprite::plexFreeAdd1_ypos#0 ← *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44)) -- vbuz1=pbuc1_derefidx_pbuc2_derefidx_vbuz2
ldx plex_show_idx
ldy PLEX_SORTED_IDX,x
ldx PLEX_YPOS,y
stx plexFreeAdd1_ypos
//SEG82 [38] *((const byte*) SPRITES_YPOS#0 + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte) plexShowSprite::plexFreeAdd1_ypos#0 -- pbuc1_derefidx_vbuz1=vbuz2
lda plexFreeAdd1_ypos
ldy plex_sprite_idx2
sta SPRITES_YPOS,y
jmp plexFreeAdd1
//SEG83 plexShowSprite::plexFreeAdd1
plexFreeAdd1:
//SEG84 [39] (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0 ← (byte) plexShowSprite::plexFreeAdd1_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) $15 -- vbuz1=vbuz2_plus_vbuc1
lax plexFreeAdd1_ypos
axs #-[$15]
stx plexFreeAdd1__0
//SEG85 [40] *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plex_free_next#17) ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0 -- pbuc1_derefidx_vbuz1=vbuz2
lda plexFreeAdd1__0
ldy plex_free_next
sta PLEX_FREE_YPOS,y
//SEG86 [41] (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 ← (byte) plex_free_next#17 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz2_plus_1
ldy plex_free_next
iny
sty plexFreeAdd1__1
//SEG87 [42] (byte) plex_free_next#13 ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuz1=vbuz2_band_vbuc1
lda #7
and plexFreeAdd1__1
sta plex_free_next
jmp b4
//SEG88 plexShowSprite::@4
b4:
//SEG89 [43] *((const byte*) PLEX_SCREEN_PTR#1 + (byte) plex_sprite_idx#44) ← *((const byte[PLEX_COUNT#0]) PLEX_PTR#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44)) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_pbuc3_derefidx_vbuz2
ldx plex_show_idx
ldy PLEX_SORTED_IDX,x
lda PLEX_PTR,y
ldx plex_sprite_idx
sta PLEX_SCREEN_PTR,x
//SEG90 [44] (byte) plexShowSprite::xpos_idx#0 ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44) -- vbuz1=pbuc1_derefidx_vbuz2
ldy plex_show_idx
lda PLEX_SORTED_IDX,y
sta xpos_idx
//SEG91 [45] (byte) plexShowSprite::$10 ← (byte) plexShowSprite::xpos_idx#0 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz2_rol_1
lda xpos_idx
asl
sta _10
//SEG92 [46] (byte~) plexShowSprite::$2 ← < *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::$10) -- vbuz1=_lo_pwuc1_derefidx_vbuz2
ldy _10
lda PLEX_XPOS,y
sta _2
//SEG93 [47] *((const byte*) SPRITES_XPOS#0 + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte~) plexShowSprite::$2 -- pbuc1_derefidx_vbuz1=vbuz2
lda _2
ldy plex_sprite_idx2
sta SPRITES_XPOS,y
//SEG94 [48] (byte) plexShowSprite::$11 ← (byte) plexShowSprite::xpos_idx#0 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz2_rol_1
lda xpos_idx
asl
sta _11
//SEG95 [49] (byte~) plexShowSprite::$3 ← > *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::$11) -- vbuz1=_hi_pwuc1_derefidx_vbuz2
ldy _11
lda PLEX_XPOS+1,y
sta _3
//SEG96 [50] if((byte~) plexShowSprite::$3!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto plexShowSprite::@1 -- vbuz1_neq_0_then_la1
lda _3
cmp #0
bne b1
jmp b3
//SEG97 plexShowSprite::@3
b3:
//SEG98 [51] (byte/word/dword~) plexShowSprite::$9 ← (byte/word/signed word/dword/signed dword) $ff ^ (byte) plex_sprite_msb#44 -- vbuz1=vbuc1_bxor_vbuz2
lda #$ff
eor plex_sprite_msb
sta _9
//SEG99 [52] *((const byte*) SPRITES_XMSB#0) ← *((const byte*) SPRITES_XMSB#0) & (byte/word/dword~) plexShowSprite::$9 -- _deref_pbuc1=_deref_pbuc1_band_vbuz1
lda SPRITES_XMSB
and _9
sta SPRITES_XMSB
jmp b2
//SEG100 plexShowSprite::@2
b2:
//SEG101 [53] (byte/signed word/word/dword/signed dword~) plexShowSprite::$5 ← (byte) plex_sprite_idx#44 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz2_plus_1
ldy plex_sprite_idx
iny
sty _5
//SEG102 [54] (byte) plex_sprite_idx#15 ← (byte/signed word/word/dword/signed dword~) plexShowSprite::$5 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuz1=vbuz2_band_vbuc1
lda #7
and _5
sta plex_sprite_idx
//SEG103 [55] (byte) plex_show_idx#15 ← ++ (byte) plex_show_idx#44 -- vbuz1=_inc_vbuz1
inc plex_show_idx
//SEG104 [56] (byte) plex_sprite_msb#25 ← (byte) plex_sprite_msb#44 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_rol_1
asl plex_sprite_msb
//SEG105 [57] if((byte) plex_sprite_msb#25!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto plexShowSprite::@5 -- vbuz1_neq_0_then_la1
lda plex_sprite_msb
cmp #0
bne b5_from_b2
//SEG106 [58] phi from plexShowSprite::@2 to plexShowSprite::@return [phi:plexShowSprite::@2->plexShowSprite::@return]
breturn_from_b2:
//SEG107 [58] phi (byte) plex_sprite_msb#16 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:plexShowSprite::@2->plexShowSprite::@return#0] -- vbuz1=vbuc1
lda #1
sta plex_sprite_msb
jmp breturn
//SEG108 plexShowSprite::@return
breturn:
//SEG109 [59] return
rts
//SEG110 [60] phi from plexShowSprite::@2 to plexShowSprite::@5 [phi:plexShowSprite::@2->plexShowSprite::@5]
b5_from_b2:
jmp b5
//SEG111 plexShowSprite::@5
b5:
//SEG112 [58] phi from plexShowSprite::@5 to plexShowSprite::@return [phi:plexShowSprite::@5->plexShowSprite::@return]
breturn_from_b5:
//SEG113 [58] phi (byte) plex_sprite_msb#16 = (byte) plex_sprite_msb#25 [phi:plexShowSprite::@5->plexShowSprite::@return#0] -- register_copy
jmp breturn
//SEG114 plexShowSprite::@1
b1:
//SEG115 [61] *((const byte*) SPRITES_XMSB#0) ← *((const byte*) SPRITES_XMSB#0) | (byte) plex_sprite_msb#44 -- _deref_pbuc1=_deref_pbuc1_bor_vbuz1
lda SPRITES_XMSB
ora plex_sprite_msb
sta SPRITES_XMSB
jmp b2
}
//SEG116 plexSort
// Ensure that the indices in PLEX_SORTED_IDX is sorted based on the y-positions in PLEX_YPOS
// Assumes that the positions are nearly sorted already (as each sprite just moves a bit)
// Uses an insertion sort:
// 1. Moves a marker (m) from the start to end of the array. Every time the marker moves forward all elements before the marker are sorted correctly.
// 2a. If the next element after the marker is larger that the current element
// the marker can be moved forwards (as the sorting is correct).
// 2b. If the next element after the marker is smaller than the current element:
// elements before the marker are shifted right one at a time until encountering one smaller than the current one.
// It is then inserted at the spot. Now the marker can move forward.
plexSort: {
.label nxt_idx = $1f
.label nxt_y = $20
.label m = $a
.label s = $b
.label s_2 = $21
.label plexFreePrepare1_s = $c
//SEG117 [63] phi from plexSort to plexSort::@1 [phi:plexSort->plexSort::@1]
b1_from_plexSort:
//SEG118 [63] phi (byte) plexSort::m#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:plexSort->plexSort::@1#0] -- vbuz1=vbuc1
lda #0
sta m
jmp b1
//SEG119 [63] phi from plexSort::@2 to plexSort::@1 [phi:plexSort::@2->plexSort::@1]
b1_from_b2:
//SEG120 [63] phi (byte) plexSort::m#2 = (byte) plexSort::m#1 [phi:plexSort::@2->plexSort::@1#0] -- register_copy
jmp b1
//SEG121 plexSort::@1
b1:
//SEG122 [64] (byte) plexSort::nxt_idx#0 ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) plexSort::m#2) -- vbuz1=pbuc1_derefidx_vbuz2
ldy m
lda PLEX_SORTED_IDX+1,y
sta nxt_idx
//SEG123 [65] (byte) plexSort::nxt_y#0 ← *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + (byte) plexSort::nxt_idx#0) -- vbuz1=pbuc1_derefidx_vbuz2
ldy nxt_idx
lda PLEX_YPOS,y
sta nxt_y
//SEG124 [66] if((byte) plexSort::nxt_y#0>=*((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::m#2))) goto plexSort::@2 -- vbuz1_ge_pbuc1_derefidx_pbuc2_derefidx_vbuz2_then_la1
lda nxt_y
ldx m
ldy PLEX_SORTED_IDX,x
cmp PLEX_YPOS,y
bcs b2
jmp b6
//SEG125 plexSort::@6
b6:
//SEG126 [67] (byte~) plexSort::s#6 ← (byte) plexSort::m#2 -- vbuz1=vbuz2
lda m
sta s
//SEG127 [68] phi from plexSort::@5 plexSort::@6 to plexSort::@3 [phi:plexSort::@5/plexSort::@6->plexSort::@3]
b3_from_b5:
b3_from_b6:
//SEG128 [68] phi (byte) plexSort::s#3 = (byte) plexSort::s#1 [phi:plexSort::@5/plexSort::@6->plexSort::@3#0] -- register_copy
jmp b3
//SEG129 plexSort::@3
b3:
//SEG130 [69] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) plexSort::s#3) ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#3) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz1
ldy s
lda PLEX_SORTED_IDX,y
sta PLEX_SORTED_IDX+1,y
//SEG131 [70] (byte) plexSort::s#1 ← -- (byte) plexSort::s#3 -- vbuz1=_dec_vbuz1
dec s
//SEG132 [71] if((byte) plexSort::s#1!=(byte/word/signed word/dword/signed dword) $ff) goto plexSort::@5 -- vbuz1_neq_vbuc1_then_la1
lda #$ff
cmp s
bne b5
jmp b4
//SEG133 plexSort::@4
b4:
//SEG134 [72] (byte) plexSort::s#2 ← ++ (byte) plexSort::s#1 -- vbuz1=_inc_vbuz2
ldy s
iny
sty s_2
//SEG135 [73] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#2) ← (byte) plexSort::nxt_idx#0 -- pbuc1_derefidx_vbuz1=vbuz2
lda nxt_idx
ldy s_2
sta PLEX_SORTED_IDX,y
jmp b2
//SEG136 plexSort::@2
b2:
//SEG137 [74] (byte) plexSort::m#1 ← ++ (byte) plexSort::m#2 -- vbuz1=_inc_vbuz1
inc m
//SEG138 [75] if((byte) plexSort::m#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 2+(byte/signed byte/word/signed word/dword/signed dword) 1) goto plexSort::@1 -- vbuz1_neq_vbuc1_then_la1
lda #PLEX_COUNT-2+1
cmp m
bne b1_from_b2
//SEG139 [76] phi from plexSort::@2 to plexSort::plexFreePrepare1 [phi:plexSort::@2->plexSort::plexFreePrepare1]
plexFreePrepare1_from_b2:
jmp plexFreePrepare1
//SEG140 plexSort::plexFreePrepare1
plexFreePrepare1:
//SEG141 [77] phi from plexSort::plexFreePrepare1 to plexSort::plexFreePrepare1_@1 [phi:plexSort::plexFreePrepare1->plexSort::plexFreePrepare1_@1]
plexFreePrepare1_b1_from_plexFreePrepare1:
//SEG142 [77] phi (byte) plexSort::plexFreePrepare1_s#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:plexSort::plexFreePrepare1->plexSort::plexFreePrepare1_@1#0] -- vbuz1=vbuc1
lda #0
sta plexFreePrepare1_s
jmp plexFreePrepare1_b1
//SEG143 [77] phi from plexSort::plexFreePrepare1_@1 to plexSort::plexFreePrepare1_@1 [phi:plexSort::plexFreePrepare1_@1->plexSort::plexFreePrepare1_@1]
plexFreePrepare1_b1_from_plexFreePrepare1_b1:
//SEG144 [77] phi (byte) plexSort::plexFreePrepare1_s#2 = (byte) plexSort::plexFreePrepare1_s#1 [phi:plexSort::plexFreePrepare1_@1->plexSort::plexFreePrepare1_@1#0] -- register_copy
jmp plexFreePrepare1_b1
//SEG145 plexSort::plexFreePrepare1_@1
plexFreePrepare1_b1:
//SEG146 [78] *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plexSort::plexFreePrepare1_s#2) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- pbuc1_derefidx_vbuz1=vbuc2
lda #0
ldy plexFreePrepare1_s
sta PLEX_FREE_YPOS,y
//SEG147 [79] (byte) plexSort::plexFreePrepare1_s#1 ← ++ (byte) plexSort::plexFreePrepare1_s#2 -- vbuz1=_inc_vbuz1
inc plexFreePrepare1_s
//SEG148 [80] if((byte) plexSort::plexFreePrepare1_s#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto plexSort::plexFreePrepare1_@1 -- vbuz1_neq_vbuc1_then_la1
lda #8
cmp plexFreePrepare1_s
bne plexFreePrepare1_b1_from_plexFreePrepare1_b1
jmp breturn
//SEG149 plexSort::@return
breturn:
//SEG150 [81] return
rts
//SEG151 plexSort::@5
b5:
//SEG152 [82] if((byte) plexSort::nxt_y#0<*((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#1))) goto plexSort::@3 -- vbuz1_lt_pbuc1_derefidx_pbuc2_derefidx_vbuz2_then_la1
lda nxt_y
ldx s
ldy PLEX_SORTED_IDX,x
cmp PLEX_YPOS,y
bcc b3_from_b5
jmp b4
}
//SEG153 init
// Initialize the program
init: {
.label _8 = $22
.label xp = $e
.label sx = $d
.label ss = $10
//SEG154 [83] *((const byte*) D011#0) ← (const byte) VIC_DEN#0|(const byte) VIC_RSEL#0|(byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuc1=vbuc2
lda #VIC_DEN|VIC_RSEL|3
sta D011
//SEG155 [84] call plexInit
//SEG156 [98] phi from init to plexInit [phi:init->plexInit]
plexInit_from_init:
jsr plexInit
//SEG157 [85] phi from init to init::@1 [phi:init->init::@1]
b1_from_init:
//SEG158 [85] phi (word) init::xp#2 = (byte/signed byte/word/signed word/dword/signed dword) $20 [phi:init->init::@1#0] -- vwuz1=vbuc1
lda #$20
sta xp
lda #0
sta xp+1
//SEG159 [85] phi (byte) init::sx#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init->init::@1#1] -- vbuz1=vbuc1
lda #0
sta sx
jmp b1
//SEG160 [85] phi from init::@1 to init::@1 [phi:init::@1->init::@1]
b1_from_b1:
//SEG161 [85] phi (word) init::xp#2 = (word) init::xp#1 [phi:init::@1->init::@1#0] -- register_copy
//SEG162 [85] phi (byte) init::sx#2 = (byte) init::sx#1 [phi:init::@1->init::@1#1] -- register_copy
jmp b1
//SEG163 init::@1
b1:
//SEG164 [86] *((const byte[PLEX_COUNT#0]) PLEX_PTR#0 + (byte) init::sx#2) ← ((byte))(const byte*) SPRITE#0/(byte/signed byte/word/signed word/dword/signed dword) $40 -- pbuc1_derefidx_vbuz1=vbuc2
lda #$ff&SPRITE/$40
ldy sx
sta PLEX_PTR,y
//SEG165 [87] (byte) init::$8 ← (byte) init::sx#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz2_rol_1
lda sx
asl
sta _8
//SEG166 [88] *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) init::$8) ← (word) init::xp#2 -- pwuc1_derefidx_vbuz1=vwuz2
ldy _8
lda xp
sta PLEX_XPOS,y
lda xp+1
sta PLEX_XPOS+1,y
//SEG167 [89] (word) init::xp#1 ← (word) init::xp#2 + (byte/signed byte/word/signed word/dword/signed dword) 9 -- vwuz1=vwuz1_plus_vbuc1
lda #9
clc
adc xp
sta xp
bcc !+
inc xp+1
!:
//SEG168 [90] (byte) init::sx#1 ← ++ (byte) init::sx#2 -- vbuz1=_inc_vbuz1
inc sx
//SEG169 [91] if((byte) init::sx#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto init::@1 -- vbuz1_neq_vbuc1_then_la1
lda #PLEX_COUNT-1+1
cmp sx
bne b1_from_b1
jmp b2
//SEG170 init::@2
b2:
//SEG171 [92] *((const byte*) SPRITES_ENABLE#0) ← (byte/word/signed word/dword/signed dword) $ff -- _deref_pbuc1=vbuc2
// Enable & initialize sprites
lda #$ff
sta SPRITES_ENABLE
//SEG172 [93] phi from init::@2 to init::@3 [phi:init::@2->init::@3]
b3_from_b2:
//SEG173 [93] phi (byte) init::ss#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init::@2->init::@3#0] -- vbuz1=vbuc1
lda #0
sta ss
jmp b3
//SEG174 [93] phi from init::@3 to init::@3 [phi:init::@3->init::@3]
b3_from_b3:
//SEG175 [93] phi (byte) init::ss#2 = (byte) init::ss#1 [phi:init::@3->init::@3#0] -- register_copy
jmp b3
//SEG176 init::@3
b3:
//SEG177 [94] *((const byte*) SPRITES_COLS#0 + (byte) init::ss#2) ← (const byte) GREEN#0 -- pbuc1_derefidx_vbuz1=vbuc2
lda #GREEN
ldy ss
sta SPRITES_COLS,y
//SEG178 [95] (byte) init::ss#1 ← ++ (byte) init::ss#2 -- vbuz1=_inc_vbuz1
inc ss
//SEG179 [96] if((byte) init::ss#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto init::@3 -- vbuz1_neq_vbuc1_then_la1
lda #8
cmp ss
bne b3_from_b3
jmp breturn
//SEG180 init::@return
breturn:
//SEG181 [97] return
rts
}
//SEG182 plexInit
// Initialize the multiplexer data structures
plexInit: {
.label i = $11
//SEG183 [99] phi from plexInit to plexInit::plexSetScreen1 [phi:plexInit->plexInit::plexSetScreen1]
plexSetScreen1_from_plexInit:
jmp plexSetScreen1
//SEG184 plexInit::plexSetScreen1
plexSetScreen1:
//SEG185 [100] phi from plexInit::plexSetScreen1 to plexInit::@1 [phi:plexInit::plexSetScreen1->plexInit::@1]
b1_from_plexSetScreen1:
//SEG186 [100] phi (byte) plexInit::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:plexInit::plexSetScreen1->plexInit::@1#0] -- vbuz1=vbuc1
lda #0
sta i
jmp b1
//SEG187 [100] phi from plexInit::@1 to plexInit::@1 [phi:plexInit::@1->plexInit::@1]
b1_from_b1:
//SEG188 [100] phi (byte) plexInit::i#2 = (byte) plexInit::i#1 [phi:plexInit::@1->plexInit::@1#0] -- register_copy
jmp b1
//SEG189 plexInit::@1
b1:
//SEG190 [101] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexInit::i#2) ← (byte) plexInit::i#2 -- pbuc1_derefidx_vbuz1=vbuz1
ldy i
tya
sta PLEX_SORTED_IDX,y
//SEG191 [102] (byte) plexInit::i#1 ← ++ (byte) plexInit::i#2 -- vbuz1=_inc_vbuz1
inc i
//SEG192 [103] if((byte) plexInit::i#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto plexInit::@1 -- vbuz1_neq_vbuc1_then_la1
lda #PLEX_COUNT-1+1
cmp i
bne b1_from_b1
jmp breturn
//SEG193 plexInit::@return
breturn:
//SEG194 [104] return
rts
}
// Contains the Y-position where each sprite is free again. PLEX_FREE_YPOS[s] holds the Y-position where sprite s is free to use again.
PLEX_FREE_YPOS: .fill 8, 0
// The x-positions of the multiplexer sprites ($000-$1ff)
PLEX_XPOS: .fill 2*PLEX_COUNT, 0
// The y-positions of the multiplexer sprites.
PLEX_YPOS: .fill PLEX_COUNT, 0
// The sprite pointers for the multiplexed sprites
PLEX_PTR: .fill PLEX_COUNT, 0
// Indexes of the plex-sprites sorted by sprite y-position. Each call to plexSort() will fix the sorting if changes to the Y-positions have ruined it.
PLEX_SORTED_IDX: .fill PLEX_COUNT, 0
.pc = YSIN "YSIN"
.var min = 50
.var max = 250-21
.var ampl = max-min;
.for(var i=0;i<256;i++)
.byte round(min+(ampl/2)+(ampl/2)*sin(toRadians(360*i/256)))
.pc = SPRITE "SPRITE"
.var pic = LoadPicture("balloon.png", List().add($000000, $ffffff))
.for (var y=0; y<21; y++)
.for (var x=0;x<3; x++)
.byte pic.getSinglecolorByte(x,y)
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [13] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) $ff) goto loop::@2 [ loop::sin_idx#6 ] ( main:4::loop:9 [ loop::sin_idx#6 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ loop::sin_idx#6 loop::sin_idx#1 ]
Statement [17] *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + (byte) loop::sy#2) ← *((const byte*) YSIN#0 + (byte) loop::y_idx#2) [ loop::sin_idx#6 loop::y_idx#2 loop::sy#2 ] ( main:4::loop:9 [ loop::sin_idx#6 loop::y_idx#2 loop::sy#2 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:3 [ loop::y_idx#2 loop::y_idx#1 loop::y_idx#4 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ loop::sy#2 loop::sy#1 ]
Statement [18] (byte) loop::y_idx#1 ← (byte) loop::y_idx#2 + (byte/signed byte/word/signed word/dword/signed dword) 8 [ loop::sin_idx#6 loop::sy#2 loop::y_idx#1 ] ( main:4::loop:9 [ loop::sin_idx#6 loop::sy#2 loop::y_idx#1 ] ) always clobbers reg byte a
Statement [24] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ loop::sin_idx#1 ] ( main:4::loop:9 [ loop::sin_idx#1 ] ) always clobbers reg byte a
Statement [25] (byte~) loop::$4 ← *((const byte*) D011#0) & (const byte) VIC_RST8#0 [ loop::sin_idx#1 loop::$4 ] ( main:4::loop:9 [ loop::sin_idx#1 loop::$4 ] ) always clobbers reg byte a
Statement [28] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ loop::sin_idx#1 plex_free_next#17 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 loop::ss#6 ] ( main:4::loop:9 [ loop::sin_idx#1 plex_free_next#17 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 loop::ss#6 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:5 [ plex_free_next#17 plex_free_next#13 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:6 [ plex_sprite_idx#44 plex_sprite_idx#15 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:7 [ plex_show_idx#44 plex_show_idx#15 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:8 [ plex_sprite_msb#44 plex_sprite_msb#16 plex_sprite_msb#25 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:9 [ loop::ss#6 loop::ss#1 ]
Statement [35] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ loop::sin_idx#1 ] ( main:4::loop:9 [ loop::sin_idx#1 ] ) always clobbers reg byte a
Statement [36] (byte) plexShowSprite::plex_sprite_idx2#0 ← (byte) plex_sprite_idx#44 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ plex_free_next#17 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plexShowSprite::plex_sprite_idx2#0 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_free_next#17 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plexShowSprite::plex_sprite_idx2#0 ] ) always clobbers reg byte a
Statement [43] *((const byte*) PLEX_SCREEN_PTR#1 + (byte) plex_sprite_idx#44) ← *((const byte[PLEX_COUNT#0]) PLEX_PTR#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44)) [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::plex_sprite_idx2#0 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::plex_sprite_idx2#0 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:20 [ plexShowSprite::plex_sprite_idx2#0 ]
Statement [45] (byte) plexShowSprite::$10 ← (byte) plexShowSprite::xpos_idx#0 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::xpos_idx#0 plexShowSprite::$10 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::xpos_idx#0 plexShowSprite::$10 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:24 [ plexShowSprite::xpos_idx#0 ]
Statement [46] (byte~) plexShowSprite::$2 ← < *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::$10) [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::xpos_idx#0 plexShowSprite::$2 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::xpos_idx#0 plexShowSprite::$2 ] ) always clobbers reg byte a
Statement [48] (byte) plexShowSprite::$11 ← (byte) plexShowSprite::xpos_idx#0 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::$11 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::$11 ] ) always clobbers reg byte a
Statement [49] (byte~) plexShowSprite::$3 ← > *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::$11) [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::$3 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::$3 ] ) always clobbers reg byte a
Statement [51] (byte/word/dword~) plexShowSprite::$9 ← (byte/word/signed word/dword/signed dword) $ff ^ (byte) plex_sprite_msb#44 [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::$9 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::$9 ] ) always clobbers reg byte a
Statement [52] *((const byte*) SPRITES_XMSB#0) ← *((const byte*) SPRITES_XMSB#0) & (byte/word/dword~) plexShowSprite::$9 [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 ] ) always clobbers reg byte a
Statement [61] *((const byte*) SPRITES_XMSB#0) ← *((const byte*) SPRITES_XMSB#0) | (byte) plex_sprite_msb#44 [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 ] ) always clobbers reg byte a
Statement [69] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) plexSort::s#3) ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#3) [ plexSort::m#2 plexSort::nxt_idx#0 plexSort::nxt_y#0 plexSort::s#3 ] ( main:4::loop:9::plexSort:23 [ loop::sin_idx#1 plexSort::m#2 plexSort::nxt_idx#0 plexSort::nxt_y#0 plexSort::s#3 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:10 [ plexSort::m#2 plexSort::m#1 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:31 [ plexSort::nxt_idx#0 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:32 [ plexSort::nxt_y#0 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:11 [ plexSort::s#3 plexSort::s#1 plexSort::s#6 ]
Statement [73] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#2) ← (byte) plexSort::nxt_idx#0 [ plexSort::m#2 ] ( main:4::loop:9::plexSort:23 [ loop::sin_idx#1 plexSort::m#2 ] ) always clobbers reg byte a
Statement [78] *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plexSort::plexFreePrepare1_s#2) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ plexSort::plexFreePrepare1_s#2 ] ( main:4::loop:9::plexSort:23 [ loop::sin_idx#1 plexSort::plexFreePrepare1_s#2 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:12 [ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ]
Statement [82] if((byte) plexSort::nxt_y#0<*((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#1))) goto plexSort::@3 [ plexSort::m#2 plexSort::nxt_idx#0 plexSort::nxt_y#0 plexSort::s#1 ] ( main:4::loop:9::plexSort:23 [ loop::sin_idx#1 plexSort::m#2 plexSort::nxt_idx#0 plexSort::nxt_y#0 plexSort::s#1 ] ) always clobbers reg byte a
Statement [83] *((const byte*) D011#0) ← (const byte) VIC_DEN#0|(const byte) VIC_RSEL#0|(byte/signed byte/word/signed word/dword/signed dword) 3 [ ] ( main:4::init:7 [ ] ) always clobbers reg byte a
Statement [86] *((const byte[PLEX_COUNT#0]) PLEX_PTR#0 + (byte) init::sx#2) ← ((byte))(const byte*) SPRITE#0/(byte/signed byte/word/signed word/dword/signed dword) $40 [ init::sx#2 init::xp#2 ] ( main:4::init:7 [ init::sx#2 init::xp#2 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:13 [ init::sx#2 init::sx#1 ]
Statement [87] (byte) init::$8 ← (byte) init::sx#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ init::sx#2 init::xp#2 init::$8 ] ( main:4::init:7 [ init::sx#2 init::xp#2 init::$8 ] ) always clobbers reg byte a
Statement [88] *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) init::$8) ← (word) init::xp#2 [ init::sx#2 init::xp#2 ] ( main:4::init:7 [ init::sx#2 init::xp#2 ] ) always clobbers reg byte a
Statement [89] (word) init::xp#1 ← (word) init::xp#2 + (byte/signed byte/word/signed word/dword/signed dword) 9 [ init::sx#2 init::xp#1 ] ( main:4::init:7 [ init::sx#2 init::xp#1 ] ) always clobbers reg byte a
Statement [92] *((const byte*) SPRITES_ENABLE#0) ← (byte/word/signed word/dword/signed dword) $ff [ ] ( main:4::init:7 [ ] ) always clobbers reg byte a
Statement [94] *((const byte*) SPRITES_COLS#0 + (byte) init::ss#2) ← (const byte) GREEN#0 [ init::ss#2 ] ( main:4::init:7 [ init::ss#2 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:16 [ init::ss#2 init::ss#1 ]
Statement [13] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) $ff) goto loop::@2 [ loop::sin_idx#6 ] ( main:4::loop:9 [ loop::sin_idx#6 ] ) always clobbers reg byte a
Statement [17] *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + (byte) loop::sy#2) ← *((const byte*) YSIN#0 + (byte) loop::y_idx#2) [ loop::sin_idx#6 loop::y_idx#2 loop::sy#2 ] ( main:4::loop:9 [ loop::sin_idx#6 loop::y_idx#2 loop::sy#2 ] ) always clobbers reg byte a
Statement [18] (byte) loop::y_idx#1 ← (byte) loop::y_idx#2 + (byte/signed byte/word/signed word/dword/signed dword) 8 [ loop::sin_idx#6 loop::sy#2 loop::y_idx#1 ] ( main:4::loop:9 [ loop::sin_idx#6 loop::sy#2 loop::y_idx#1 ] ) always clobbers reg byte a
Statement [24] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ loop::sin_idx#1 ] ( main:4::loop:9 [ loop::sin_idx#1 ] ) always clobbers reg byte a
Statement [25] (byte~) loop::$4 ← *((const byte*) D011#0) & (const byte) VIC_RST8#0 [ loop::sin_idx#1 loop::$4 ] ( main:4::loop:9 [ loop::sin_idx#1 loop::$4 ] ) always clobbers reg byte a
Statement [28] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ loop::sin_idx#1 plex_free_next#17 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 loop::ss#6 ] ( main:4::loop:9 [ loop::sin_idx#1 plex_free_next#17 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 loop::ss#6 ] ) always clobbers reg byte a
Statement [35] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ loop::sin_idx#1 ] ( main:4::loop:9 [ loop::sin_idx#1 ] ) always clobbers reg byte a
Statement [36] (byte) plexShowSprite::plex_sprite_idx2#0 ← (byte) plex_sprite_idx#44 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ plex_free_next#17 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plexShowSprite::plex_sprite_idx2#0 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_free_next#17 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plexShowSprite::plex_sprite_idx2#0 ] ) always clobbers reg byte a
Statement [43] *((const byte*) PLEX_SCREEN_PTR#1 + (byte) plex_sprite_idx#44) ← *((const byte[PLEX_COUNT#0]) PLEX_PTR#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44)) [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::plex_sprite_idx2#0 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::plex_sprite_idx2#0 ] ) always clobbers reg byte a
Statement [45] (byte) plexShowSprite::$10 ← (byte) plexShowSprite::xpos_idx#0 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::xpos_idx#0 plexShowSprite::$10 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::xpos_idx#0 plexShowSprite::$10 ] ) always clobbers reg byte a
Statement [46] (byte~) plexShowSprite::$2 ← < *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::$10) [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::xpos_idx#0 plexShowSprite::$2 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::xpos_idx#0 plexShowSprite::$2 ] ) always clobbers reg byte a
Statement [48] (byte) plexShowSprite::$11 ← (byte) plexShowSprite::xpos_idx#0 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::$11 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::$11 ] ) always clobbers reg byte a
Statement [49] (byte~) plexShowSprite::$3 ← > *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::$11) [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::$3 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::$3 ] ) always clobbers reg byte a
Statement [51] (byte/word/dword~) plexShowSprite::$9 ← (byte/word/signed word/dword/signed dword) $ff ^ (byte) plex_sprite_msb#44 [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::$9 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::$9 ] ) always clobbers reg byte a
Statement [52] *((const byte*) SPRITES_XMSB#0) ← *((const byte*) SPRITES_XMSB#0) & (byte/word/dword~) plexShowSprite::$9 [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 ] ) always clobbers reg byte a
Statement [61] *((const byte*) SPRITES_XMSB#0) ← *((const byte*) SPRITES_XMSB#0) | (byte) plex_sprite_msb#44 [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 ] ) always clobbers reg byte a
Statement [66] if((byte) plexSort::nxt_y#0>=*((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::m#2))) goto plexSort::@2 [ plexSort::m#2 plexSort::nxt_idx#0 plexSort::nxt_y#0 ] ( main:4::loop:9::plexSort:23 [ loop::sin_idx#1 plexSort::m#2 plexSort::nxt_idx#0 plexSort::nxt_y#0 ] ) always clobbers reg byte a
Statement [69] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) plexSort::s#3) ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#3) [ plexSort::m#2 plexSort::nxt_idx#0 plexSort::nxt_y#0 plexSort::s#3 ] ( main:4::loop:9::plexSort:23 [ loop::sin_idx#1 plexSort::m#2 plexSort::nxt_idx#0 plexSort::nxt_y#0 plexSort::s#3 ] ) always clobbers reg byte a
Statement [73] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#2) ← (byte) plexSort::nxt_idx#0 [ plexSort::m#2 ] ( main:4::loop:9::plexSort:23 [ loop::sin_idx#1 plexSort::m#2 ] ) always clobbers reg byte a
Statement [78] *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plexSort::plexFreePrepare1_s#2) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ plexSort::plexFreePrepare1_s#2 ] ( main:4::loop:9::plexSort:23 [ loop::sin_idx#1 plexSort::plexFreePrepare1_s#2 ] ) always clobbers reg byte a
Statement [82] if((byte) plexSort::nxt_y#0<*((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#1))) goto plexSort::@3 [ plexSort::m#2 plexSort::nxt_idx#0 plexSort::nxt_y#0 plexSort::s#1 ] ( main:4::loop:9::plexSort:23 [ loop::sin_idx#1 plexSort::m#2 plexSort::nxt_idx#0 plexSort::nxt_y#0 plexSort::s#1 ] ) always clobbers reg byte a
Statement [83] *((const byte*) D011#0) ← (const byte) VIC_DEN#0|(const byte) VIC_RSEL#0|(byte/signed byte/word/signed word/dword/signed dword) 3 [ ] ( main:4::init:7 [ ] ) always clobbers reg byte a
Statement [86] *((const byte[PLEX_COUNT#0]) PLEX_PTR#0 + (byte) init::sx#2) ← ((byte))(const byte*) SPRITE#0/(byte/signed byte/word/signed word/dword/signed dword) $40 [ init::sx#2 init::xp#2 ] ( main:4::init:7 [ init::sx#2 init::xp#2 ] ) always clobbers reg byte a
Statement [87] (byte) init::$8 ← (byte) init::sx#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ init::sx#2 init::xp#2 init::$8 ] ( main:4::init:7 [ init::sx#2 init::xp#2 init::$8 ] ) always clobbers reg byte a
Statement [88] *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) init::$8) ← (word) init::xp#2 [ init::sx#2 init::xp#2 ] ( main:4::init:7 [ init::sx#2 init::xp#2 ] ) always clobbers reg byte a
Statement [89] (word) init::xp#1 ← (word) init::xp#2 + (byte/signed byte/word/signed word/dword/signed dword) 9 [ init::sx#2 init::xp#1 ] ( main:4::init:7 [ init::sx#2 init::xp#1 ] ) always clobbers reg byte a
Statement [92] *((const byte*) SPRITES_ENABLE#0) ← (byte/word/signed word/dword/signed dword) $ff [ ] ( main:4::init:7 [ ] ) always clobbers reg byte a
Statement [94] *((const byte*) SPRITES_COLS#0 + (byte) init::ss#2) ← (const byte) GREEN#0 [ init::ss#2 ] ( main:4::init:7 [ init::ss#2 ] ) always clobbers reg byte a
Potential registers zp ZP_BYTE:2 [ loop::sin_idx#6 loop::sin_idx#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ loop::y_idx#2 loop::y_idx#1 loop::y_idx#4 ] : zp ZP_BYTE:3 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:4 [ loop::sy#2 loop::sy#1 ] : zp ZP_BYTE:4 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:5 [ plex_free_next#17 plex_free_next#13 ] : zp ZP_BYTE:5 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:6 [ plex_sprite_idx#44 plex_sprite_idx#15 ] : zp ZP_BYTE:6 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:7 [ plex_show_idx#44 plex_show_idx#15 ] : zp ZP_BYTE:7 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:8 [ plex_sprite_msb#44 plex_sprite_msb#16 plex_sprite_msb#25 ] : zp ZP_BYTE:8 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:9 [ loop::ss#6 loop::ss#1 ] : zp ZP_BYTE:9 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:10 [ plexSort::m#2 plexSort::m#1 ] : zp ZP_BYTE:10 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:11 [ plexSort::s#3 plexSort::s#1 plexSort::s#6 ] : zp ZP_BYTE:11 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:12 [ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ] : zp ZP_BYTE:12 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:13 [ init::sx#2 init::sx#1 ] : zp ZP_BYTE:13 , reg byte x , reg byte y ,
Potential registers zp ZP_WORD:14 [ init::xp#2 init::xp#1 ] : zp ZP_WORD:14 ,
Potential registers zp ZP_BYTE:16 [ init::ss#2 init::ss#1 ] : zp ZP_BYTE:16 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:17 [ plexInit::i#2 plexInit::i#1 ] : zp ZP_BYTE:17 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:18 [ loop::$4 ] : zp ZP_BYTE:18 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:19 [ loop::plexFreeNextYpos1_return#0 ] : zp ZP_BYTE:19 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:20 [ plexShowSprite::plex_sprite_idx2#0 ] : zp ZP_BYTE:20 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:21 [ plexShowSprite::plexFreeAdd1_ypos#0 ] : zp ZP_BYTE:21 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:22 [ plexShowSprite::plexFreeAdd1_$0#0 ] : zp ZP_BYTE:22 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:23 [ plexShowSprite::plexFreeAdd1_$1#0 ] : zp ZP_BYTE:23 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:24 [ plexShowSprite::xpos_idx#0 ] : zp ZP_BYTE:24 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:25 [ plexShowSprite::$10 ] : zp ZP_BYTE:25 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:26 [ plexShowSprite::$2 ] : zp ZP_BYTE:26 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:27 [ plexShowSprite::$11 ] : zp ZP_BYTE:27 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:28 [ plexShowSprite::$3 ] : zp ZP_BYTE:28 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:29 [ plexShowSprite::$9 ] : zp ZP_BYTE:29 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:30 [ plexShowSprite::$5 ] : zp ZP_BYTE:30 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:31 [ plexSort::nxt_idx#0 ] : zp ZP_BYTE:31 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:32 [ plexSort::nxt_y#0 ] : zp ZP_BYTE:32 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:33 [ plexSort::s#2 ] : zp ZP_BYTE:33 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:34 [ init::$8 ] : zp ZP_BYTE:34 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [plexSort] 3,622.83: zp ZP_BYTE:11 [ plexSort::s#3 plexSort::s#1 plexSort::s#6 ] 303: zp ZP_BYTE:12 [ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ] 202: zp ZP_BYTE:33 [ plexSort::s#2 ] 193.58: zp ZP_BYTE:10 [ plexSort::m#2 plexSort::m#1 ] 150.38: zp ZP_BYTE:32 [ plexSort::nxt_y#0 ] 30.3: zp ZP_BYTE:31 [ plexSort::nxt_idx#0 ]
Uplift Scope [loop] 551: zp ZP_BYTE:19 [ loop::plexFreeNextYpos1_return#0 ] 252.5: zp ZP_BYTE:4 [ loop::sy#2 loop::sy#1 ] 246.33: zp ZP_BYTE:3 [ loop::y_idx#2 loop::y_idx#1 loop::y_idx#4 ] 202: zp ZP_BYTE:18 [ loop::$4 ] 185.17: zp ZP_BYTE:9 [ loop::ss#6 loop::ss#1 ] 5.13: zp ZP_BYTE:2 [ loop::sin_idx#6 loop::sin_idx#1 ]
Uplift Scope [init] 33: zp ZP_BYTE:16 [ init::ss#2 init::ss#1 ] 25.3: zp ZP_BYTE:13 [ init::sx#2 init::sx#1 ] 22: zp ZP_BYTE:34 [ init::$8 ] 15.58: zp ZP_WORD:14 [ init::xp#2 init::xp#1 ]
Uplift Scope [] 26.72: zp ZP_BYTE:8 [ plex_sprite_msb#44 plex_sprite_msb#16 plex_sprite_msb#25 ] 25.08: zp ZP_BYTE:5 [ plex_free_next#17 plex_free_next#13 ] 15.8: zp ZP_BYTE:7 [ plex_show_idx#44 plex_show_idx#15 ] 14.95: zp ZP_BYTE:6 [ plex_sprite_idx#44 plex_sprite_idx#15 ]
Uplift Scope [plexInit] 38.5: zp ZP_BYTE:17 [ plexInit::i#2 plexInit::i#1 ]
Uplift Scope [plexShowSprite] 4: zp ZP_BYTE:22 [ plexShowSprite::plexFreeAdd1_$0#0 ] 4: zp ZP_BYTE:23 [ plexShowSprite::plexFreeAdd1_$1#0 ] 4: zp ZP_BYTE:25 [ plexShowSprite::$10 ] 4: zp ZP_BYTE:26 [ plexShowSprite::$2 ] 4: zp ZP_BYTE:27 [ plexShowSprite::$11 ] 4: zp ZP_BYTE:28 [ plexShowSprite::$3 ] 4: zp ZP_BYTE:29 [ plexShowSprite::$9 ] 4: zp ZP_BYTE:30 [ plexShowSprite::$5 ] 3: zp ZP_BYTE:21 [ plexShowSprite::plexFreeAdd1_ypos#0 ] 1.5: zp ZP_BYTE:24 [ plexShowSprite::xpos_idx#0 ] 0.55: zp ZP_BYTE:20 [ plexShowSprite::plex_sprite_idx2#0 ]
Uplift Scope [main]
Uplifting [plexSort] best 82392 combination reg byte x [ plexSort::s#3 plexSort::s#1 plexSort::s#6 ] reg byte x [ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ] zp ZP_BYTE:33 [ plexSort::s#2 ] zp ZP_BYTE:10 [ plexSort::m#2 plexSort::m#1 ] zp ZP_BYTE:32 [ plexSort::nxt_y#0 ] zp ZP_BYTE:31 [ plexSort::nxt_idx#0 ]
Limited combination testing to 10 combinations of 972 possible.
Uplifting [loop] best 81192 combination zp ZP_BYTE:19 [ loop::plexFreeNextYpos1_return#0 ] reg byte y [ loop::sy#2 loop::sy#1 ] zp ZP_BYTE:3 [ loop::y_idx#2 loop::y_idx#1 loop::y_idx#4 ] zp ZP_BYTE:18 [ loop::$4 ] zp ZP_BYTE:9 [ loop::ss#6 loop::ss#1 ] zp ZP_BYTE:2 [ loop::sin_idx#6 loop::sin_idx#1 ]
Limited combination testing to 10 combinations of 1296 possible.
Uplifting [init] best 80942 combination reg byte x [ init::ss#2 init::ss#1 ] reg byte x [ init::sx#2 init::sx#1 ] zp ZP_BYTE:34 [ init::$8 ] zp ZP_WORD:14 [ init::xp#2 init::xp#1 ]
Limited combination testing to 10 combinations of 36 possible.
Uplifting [] best 80942 combination zp ZP_BYTE:8 [ plex_sprite_msb#44 plex_sprite_msb#16 plex_sprite_msb#25 ] zp ZP_BYTE:5 [ plex_free_next#17 plex_free_next#13 ] zp ZP_BYTE:7 [ plex_show_idx#44 plex_show_idx#15 ] zp ZP_BYTE:6 [ plex_sprite_idx#44 plex_sprite_idx#15 ]
Limited combination testing to 10 combinations of 81 possible.
Uplifting [plexInit] best 80822 combination reg byte x [ plexInit::i#2 plexInit::i#1 ]
Uplifting [plexShowSprite] best 80812 combination reg byte a [ plexShowSprite::plexFreeAdd1_$0#0 ] reg byte x [ plexShowSprite::plexFreeAdd1_$1#0 ] zp ZP_BYTE:25 [ plexShowSprite::$10 ] zp ZP_BYTE:26 [ plexShowSprite::$2 ] zp ZP_BYTE:27 [ plexShowSprite::$11 ] zp ZP_BYTE:28 [ plexShowSprite::$3 ] zp ZP_BYTE:29 [ plexShowSprite::$9 ] zp ZP_BYTE:30 [ plexShowSprite::$5 ] zp ZP_BYTE:21 [ plexShowSprite::plexFreeAdd1_ypos#0 ] zp ZP_BYTE:24 [ plexShowSprite::xpos_idx#0 ] zp ZP_BYTE:20 [ plexShowSprite::plex_sprite_idx2#0 ]
Limited combination testing to 10 combinations of 2359296 possible.
Uplifting [main] best 80812 combination
Attempting to uplift remaining variables inzp ZP_BYTE:19 [ loop::plexFreeNextYpos1_return#0 ]
Uplifting [loop] best 80812 combination zp ZP_BYTE:19 [ loop::plexFreeNextYpos1_return#0 ]
Attempting to uplift remaining variables inzp ZP_BYTE:3 [ loop::y_idx#2 loop::y_idx#1 loop::y_idx#4 ]
Uplifting [loop] best 80082 combination reg byte x [ loop::y_idx#2 loop::y_idx#1 loop::y_idx#4 ]
Attempting to uplift remaining variables inzp ZP_BYTE:18 [ loop::$4 ]
Uplifting [loop] best 79482 combination reg byte a [ loop::$4 ]
Attempting to uplift remaining variables inzp ZP_BYTE:33 [ plexSort::s#2 ]
Uplifting [plexSort] best 78882 combination reg byte x [ plexSort::s#2 ]
Attempting to uplift remaining variables inzp ZP_BYTE:10 [ plexSort::m#2 plexSort::m#1 ]
Uplifting [plexSort] best 78882 combination zp ZP_BYTE:10 [ plexSort::m#2 plexSort::m#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:9 [ loop::ss#6 loop::ss#1 ]
Uplifting [loop] best 78882 combination zp ZP_BYTE:9 [ loop::ss#6 loop::ss#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:32 [ plexSort::nxt_y#0 ]
Uplifting [plexSort] best 78882 combination zp ZP_BYTE:32 [ plexSort::nxt_y#0 ]
Attempting to uplift remaining variables inzp ZP_BYTE:31 [ plexSort::nxt_idx#0 ]
Uplifting [plexSort] best 78882 combination zp ZP_BYTE:31 [ plexSort::nxt_idx#0 ]
Attempting to uplift remaining variables inzp ZP_BYTE:8 [ plex_sprite_msb#44 plex_sprite_msb#16 plex_sprite_msb#25 ]
Uplifting [] best 78882 combination zp ZP_BYTE:8 [ plex_sprite_msb#44 plex_sprite_msb#16 plex_sprite_msb#25 ]
Attempting to uplift remaining variables inzp ZP_BYTE:5 [ plex_free_next#17 plex_free_next#13 ]
Uplifting [] best 78882 combination zp ZP_BYTE:5 [ plex_free_next#17 plex_free_next#13 ]
Attempting to uplift remaining variables inzp ZP_BYTE:34 [ init::$8 ]
Uplifting [init] best 78842 combination reg byte a [ init::$8 ]
Attempting to uplift remaining variables inzp ZP_BYTE:7 [ plex_show_idx#44 plex_show_idx#15 ]
Uplifting [] best 78842 combination zp ZP_BYTE:7 [ plex_show_idx#44 plex_show_idx#15 ]
Attempting to uplift remaining variables inzp ZP_BYTE:6 [ plex_sprite_idx#44 plex_sprite_idx#15 ]
Uplifting [] best 78842 combination zp ZP_BYTE:6 [ plex_sprite_idx#44 plex_sprite_idx#15 ]
Attempting to uplift remaining variables inzp ZP_BYTE:2 [ loop::sin_idx#6 loop::sin_idx#1 ]
Uplifting [loop] best 78842 combination zp ZP_BYTE:2 [ loop::sin_idx#6 loop::sin_idx#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:25 [ plexShowSprite::$10 ]
Uplifting [plexShowSprite] best 78838 combination reg byte a [ plexShowSprite::$10 ]
Attempting to uplift remaining variables inzp ZP_BYTE:26 [ plexShowSprite::$2 ]
Uplifting [plexShowSprite] best 78832 combination reg byte a [ plexShowSprite::$2 ]
Attempting to uplift remaining variables inzp ZP_BYTE:27 [ plexShowSprite::$11 ]
Uplifting [plexShowSprite] best 78828 combination reg byte a [ plexShowSprite::$11 ]
Attempting to uplift remaining variables inzp ZP_BYTE:28 [ plexShowSprite::$3 ]
Uplifting [plexShowSprite] best 78822 combination reg byte a [ plexShowSprite::$3 ]
Attempting to uplift remaining variables inzp ZP_BYTE:29 [ plexShowSprite::$9 ]
Uplifting [plexShowSprite] best 78816 combination reg byte a [ plexShowSprite::$9 ]
Attempting to uplift remaining variables inzp ZP_BYTE:30 [ plexShowSprite::$5 ]
Uplifting [plexShowSprite] best 78810 combination reg byte x [ plexShowSprite::$5 ]
Attempting to uplift remaining variables inzp ZP_BYTE:21 [ plexShowSprite::plexFreeAdd1_ypos#0 ]
Uplifting [plexShowSprite] best 78801 combination reg byte a [ plexShowSprite::plexFreeAdd1_ypos#0 ]
Attempting to uplift remaining variables inzp ZP_BYTE:24 [ plexShowSprite::xpos_idx#0 ]
Uplifting [plexShowSprite] best 78796 combination reg byte x [ plexShowSprite::xpos_idx#0 ]
Attempting to uplift remaining variables inzp ZP_BYTE:20 [ plexShowSprite::plex_sprite_idx2#0 ]
Uplifting [plexShowSprite] best 78796 combination zp ZP_BYTE:20 [ plexShowSprite::plex_sprite_idx2#0 ]
Coalescing zero page register [ zp ZP_BYTE:5 [ plex_free_next#17 plex_free_next#13 ] ] with [ zp ZP_BYTE:10 [ plexSort::m#2 plexSort::m#1 ] ]
Coalescing zero page register [ zp ZP_BYTE:6 [ plex_sprite_idx#44 plex_sprite_idx#15 ] ] with [ zp ZP_BYTE:31 [ plexSort::nxt_idx#0 ] ]
Coalescing zero page register [ zp ZP_BYTE:7 [ plex_show_idx#44 plex_show_idx#15 ] ] with [ zp ZP_BYTE:32 [ plexSort::nxt_y#0 ] ]
Coalescing zero page register [ zp ZP_BYTE:19 [ loop::plexFreeNextYpos1_return#0 ] ] with [ zp ZP_BYTE:20 [ plexShowSprite::plex_sprite_idx2#0 ] ]
Allocated (was zp ZP_BYTE:5) zp ZP_BYTE:3 [ plex_free_next#17 plex_free_next#13 plexSort::m#2 plexSort::m#1 ]
Allocated (was zp ZP_BYTE:6) zp ZP_BYTE:4 [ plex_sprite_idx#44 plex_sprite_idx#15 plexSort::nxt_idx#0 ]
Allocated (was zp ZP_BYTE:7) zp ZP_BYTE:5 [ plex_show_idx#44 plex_show_idx#15 plexSort::nxt_y#0 ]
Allocated (was zp ZP_BYTE:8) zp ZP_BYTE:6 [ plex_sprite_msb#44 plex_sprite_msb#16 plex_sprite_msb#25 ]
Allocated (was zp ZP_BYTE:9) zp ZP_BYTE:7 [ loop::ss#6 loop::ss#1 ]
Allocated (was zp ZP_WORD:14) zp ZP_WORD:8 [ init::xp#2 init::xp#1 ]
Allocated (was zp ZP_BYTE:19) zp ZP_BYTE:10 [ loop::plexFreeNextYpos1_return#0 plexShowSprite::plex_sprite_idx2#0 ]
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments
// A simple usage of the flexible sprite multiplexer routine
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
.label SPRITES_XPOS = $d000
.label SPRITES_YPOS = $d001
.label SPRITES_XMSB = $d010
.label RASTER = $d012
.label SPRITES_ENABLE = $d015
.label BORDERCOL = $d020
.label SPRITES_COLS = $d027
.label D011 = $d011
.const VIC_RST8 = $80
.const VIC_DEN = $10
.const VIC_RSEL = 8
// The colors of the C64
.const BLACK = 0
.const GREEN = 5
// The number of sprites in the multiplexer
.const PLEX_COUNT = $20
// Location of screen & sprites
.label SCREEN = $400
.label SPRITE = $2000
.label YSIN = $2100
.label PLEX_SCREEN_PTR = SCREEN+$3f8
.label plex_free_next = 3
.label plex_sprite_idx = 4
.label plex_show_idx = 5
.label plex_sprite_msb = 6
//SEG3 @begin
bbegin:
jmp b1
//SEG4 @1
b1:
//SEG5 kickasm(location (const byte*) YSIN#0) {{ .var min = 50 .var max = 250-21 .var ampl = max-min; .for(var i=0;i<256;i++) .byte round(min+(ampl/2)+(ampl/2)*sin(toRadians(360*i/256))) }}
//SEG6 kickasm(location (const byte*) SPRITE#0) {{ .var pic = LoadPicture("balloon.png", List().add($000000, $ffffff)) .for (var y=0; y<21; y++) .for (var x=0;x<3; x++) .byte pic.getSinglecolorByte(x,y) }}
//SEG7 [3] phi from @1 to @2 [phi:@1->@2]
b2_from_b1:
jmp b2
//SEG8 @2
b2:
//SEG9 [4] call main
jsr main
//SEG10 [5] phi from @2 to @end [phi:@2->@end]
bend_from_b2:
jmp bend
//SEG11 @end
bend:
//SEG12 main
main: {
//SEG13 asm { sei }
sei
//SEG14 [7] call init
jsr init
//SEG15 [8] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
jmp b1
//SEG16 main::@1
b1:
//SEG17 [9] call loop
//SEG18 [11] phi from main::@1 to loop [phi:main::@1->loop]
loop_from_b1:
jsr loop
jmp breturn
//SEG19 main::@return
breturn:
//SEG20 [10] return
rts
}
//SEG21 loop
// The raster loop
loop: {
.label sin_idx = 2
.label plexFreeNextYpos1_return = $a
.label ss = 7
//SEG22 [12] phi from loop to loop::@1 [phi:loop->loop::@1]
b1_from_loop:
//SEG23 [12] phi (byte) loop::sin_idx#6 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop->loop::@1#0] -- vbuz1=vbuc1
lda #0
sta sin_idx
jmp b1
//SEG24 loop::@1
b1:
jmp b2
//SEG25 loop::@2
b2:
//SEG26 [13] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) $ff) goto loop::@2 -- _deref_pbuc1_neq_vbuc2_then_la1
lda #$ff
cmp RASTER
bne b2
jmp b3
//SEG27 loop::@3
b3:
//SEG28 [14] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
inc BORDERCOL
//SEG29 [15] (byte~) loop::y_idx#4 ← (byte) loop::sin_idx#6 -- vbuxx=vbuz1
ldx sin_idx
//SEG30 [16] phi from loop::@3 to loop::@4 [phi:loop::@3->loop::@4]
b4_from_b3:
//SEG31 [16] phi (byte) loop::sy#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@3->loop::@4#0] -- vbuyy=vbuc1
ldy #0
//SEG32 [16] phi (byte) loop::y_idx#2 = (byte~) loop::y_idx#4 [phi:loop::@3->loop::@4#1] -- register_copy
jmp b4
//SEG33 [16] phi from loop::@4 to loop::@4 [phi:loop::@4->loop::@4]
b4_from_b4:
//SEG34 [16] phi (byte) loop::sy#2 = (byte) loop::sy#1 [phi:loop::@4->loop::@4#0] -- register_copy
//SEG35 [16] phi (byte) loop::y_idx#2 = (byte) loop::y_idx#1 [phi:loop::@4->loop::@4#1] -- register_copy
jmp b4
//SEG36 loop::@4
b4:
//SEG37 [17] *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + (byte) loop::sy#2) ← *((const byte*) YSIN#0 + (byte) loop::y_idx#2) -- pbuc1_derefidx_vbuyy=pbuc2_derefidx_vbuxx
lda YSIN,x
sta PLEX_YPOS,y
//SEG38 [18] (byte) loop::y_idx#1 ← (byte) loop::y_idx#2 + (byte/signed byte/word/signed word/dword/signed dword) 8 -- vbuxx=vbuxx_plus_vbuc1
txa
axs #-[8]
//SEG39 [19] (byte) loop::sy#1 ← ++ (byte) loop::sy#2 -- vbuyy=_inc_vbuyy
iny
//SEG40 [20] if((byte) loop::sy#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto loop::@4 -- vbuyy_neq_vbuc1_then_la1
cpy #PLEX_COUNT-1+1
bne b4_from_b4
jmp b5
//SEG41 loop::@5
b5:
//SEG42 [21] (byte) loop::sin_idx#1 ← (byte) loop::sin_idx#6 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1
inc sin_idx
//SEG43 [22] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
inc BORDERCOL
//SEG44 [23] call plexSort
//SEG45 [62] phi from loop::@5 to plexSort [phi:loop::@5->plexSort]
plexSort_from_b5:
jsr plexSort
jmp b11
//SEG46 loop::@11
b11:
//SEG47 [24] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2
lda #BLACK
sta BORDERCOL
jmp b6
//SEG48 loop::@6
b6:
//SEG49 [25] (byte~) loop::$4 ← *((const byte*) D011#0) & (const byte) VIC_RST8#0 -- vbuaa=_deref_pbuc1_band_vbuc2
lda #VIC_RST8
and D011
//SEG50 [26] if((byte~) loop::$4!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto loop::@6 -- vbuaa_neq_0_then_la1
cmp #0
bne b6
//SEG51 [27] phi from loop::@6 to loop::@7 [phi:loop::@6->loop::@7]
b7_from_b6:
//SEG52 [27] phi (byte) loop::ss#6 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@6->loop::@7#0] -- vbuz1=vbuc1
lda #0
sta ss
//SEG53 [27] phi (byte) plex_sprite_msb#44 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:loop::@6->loop::@7#1] -- vbuz1=vbuc1
lda #1
sta plex_sprite_msb
//SEG54 [27] phi (byte) plex_show_idx#44 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@6->loop::@7#2] -- vbuz1=vbuc1
lda #0
sta plex_show_idx
//SEG55 [27] phi (byte) plex_sprite_idx#44 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@6->loop::@7#3] -- vbuz1=vbuc1
lda #0
sta plex_sprite_idx
//SEG56 [27] phi (byte) plex_free_next#17 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@6->loop::@7#4] -- vbuz1=vbuc1
lda #0
sta plex_free_next
jmp b7
// Show the sprites
//SEG57 [27] phi from loop::@12 to loop::@7 [phi:loop::@12->loop::@7]
b7_from_b12:
//SEG58 [27] phi (byte) loop::ss#6 = (byte) loop::ss#1 [phi:loop::@12->loop::@7#0] -- register_copy
//SEG59 [27] phi (byte) plex_sprite_msb#44 = (byte) plex_sprite_msb#16 [phi:loop::@12->loop::@7#1] -- register_copy
//SEG60 [27] phi (byte) plex_show_idx#44 = (byte) plex_show_idx#15 [phi:loop::@12->loop::@7#2] -- register_copy
//SEG61 [27] phi (byte) plex_sprite_idx#44 = (byte) plex_sprite_idx#15 [phi:loop::@12->loop::@7#3] -- register_copy
//SEG62 [27] phi (byte) plex_free_next#17 = (byte) plex_free_next#13 [phi:loop::@12->loop::@7#4] -- register_copy
jmp b7
//SEG63 loop::@7
b7:
//SEG64 [28] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2
lda #BLACK
sta BORDERCOL
jmp plexFreeNextYpos1
//SEG65 loop::plexFreeNextYpos1
plexFreeNextYpos1:
//SEG66 [29] (byte) loop::plexFreeNextYpos1_return#0 ← *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plex_free_next#17) -- vbuz1=pbuc1_derefidx_vbuz2
ldy plex_free_next
lda PLEX_FREE_YPOS,y
sta plexFreeNextYpos1_return
jmp b8
//SEG67 loop::@8
b8:
//SEG68 [30] if(*((const byte*) RASTER#0)<(byte) loop::plexFreeNextYpos1_return#0) goto loop::@8 -- _deref_pbuc1_lt_vbuz1_then_la1
lda RASTER
cmp plexFreeNextYpos1_return
bcc b8
jmp b9
//SEG69 loop::@9
b9:
//SEG70 [31] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
inc BORDERCOL
//SEG71 [32] call plexShowSprite
jsr plexShowSprite
jmp b12
//SEG72 loop::@12
b12:
//SEG73 [33] (byte) loop::ss#1 ← ++ (byte) loop::ss#6 -- vbuz1=_inc_vbuz1
inc ss
//SEG74 [34] if((byte) loop::ss#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto loop::@7 -- vbuz1_neq_vbuc1_then_la1
lda #PLEX_COUNT-1+1
cmp ss
bne b7_from_b12
jmp b10
//SEG75 loop::@10
b10:
//SEG76 [35] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2
lda #BLACK
sta BORDERCOL
//SEG77 [12] phi from loop::@10 to loop::@1 [phi:loop::@10->loop::@1]
b1_from_b10:
//SEG78 [12] phi (byte) loop::sin_idx#6 = (byte) loop::sin_idx#1 [phi:loop::@10->loop::@1#0] -- register_copy
jmp b1
}
//SEG79 plexShowSprite
// Show the next sprite.
// plexSort() prepares showing the sprites
plexShowSprite: {
.label plex_sprite_idx2 = $a
//SEG80 [36] (byte) plexShowSprite::plex_sprite_idx2#0 ← (byte) plex_sprite_idx#44 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz2_rol_1
lda plex_sprite_idx
asl
sta plex_sprite_idx2
//SEG81 [37] (byte) plexShowSprite::plexFreeAdd1_ypos#0 ← *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44)) -- vbuaa=pbuc1_derefidx_pbuc2_derefidx_vbuz1
ldx plex_show_idx
ldy PLEX_SORTED_IDX,x
lda PLEX_YPOS,y
//SEG82 [38] *((const byte*) SPRITES_YPOS#0 + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte) plexShowSprite::plexFreeAdd1_ypos#0 -- pbuc1_derefidx_vbuz1=vbuaa
ldy plex_sprite_idx2
sta SPRITES_YPOS,y
jmp plexFreeAdd1
//SEG83 plexShowSprite::plexFreeAdd1
plexFreeAdd1:
//SEG84 [39] (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0 ← (byte) plexShowSprite::plexFreeAdd1_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) $15 -- vbuaa=vbuaa_plus_vbuc1
clc
adc #$15
//SEG85 [40] *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plex_free_next#17) ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0 -- pbuc1_derefidx_vbuz1=vbuaa
ldy plex_free_next
sta PLEX_FREE_YPOS,y
//SEG86 [41] (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 ← (byte) plex_free_next#17 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuz1_plus_1
ldx plex_free_next
inx
//SEG87 [42] (byte) plex_free_next#13 ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuz1=vbuxx_band_vbuc1
lda #7
sax plex_free_next
jmp b4
//SEG88 plexShowSprite::@4
b4:
//SEG89 [43] *((const byte*) PLEX_SCREEN_PTR#1 + (byte) plex_sprite_idx#44) ← *((const byte[PLEX_COUNT#0]) PLEX_PTR#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44)) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_pbuc3_derefidx_vbuz2
ldx plex_show_idx
ldy PLEX_SORTED_IDX,x
lda PLEX_PTR,y
ldx plex_sprite_idx
sta PLEX_SCREEN_PTR,x
//SEG90 [44] (byte) plexShowSprite::xpos_idx#0 ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44) -- vbuxx=pbuc1_derefidx_vbuz1
ldy plex_show_idx
ldx PLEX_SORTED_IDX,y
//SEG91 [45] (byte) plexShowSprite::$10 ← (byte) plexShowSprite::xpos_idx#0 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuxx_rol_1
txa
asl
//SEG92 [46] (byte~) plexShowSprite::$2 ← < *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::$10) -- vbuaa=_lo_pwuc1_derefidx_vbuaa
tay
lda PLEX_XPOS,y
//SEG93 [47] *((const byte*) SPRITES_XPOS#0 + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte~) plexShowSprite::$2 -- pbuc1_derefidx_vbuz1=vbuaa
ldy plex_sprite_idx2
sta SPRITES_XPOS,y
//SEG94 [48] (byte) plexShowSprite::$11 ← (byte) plexShowSprite::xpos_idx#0 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuxx_rol_1
txa
asl
//SEG95 [49] (byte~) plexShowSprite::$3 ← > *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::$11) -- vbuaa=_hi_pwuc1_derefidx_vbuaa
tay
lda PLEX_XPOS+1,y
//SEG96 [50] if((byte~) plexShowSprite::$3!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto plexShowSprite::@1 -- vbuaa_neq_0_then_la1
cmp #0
bne b1
jmp b3
//SEG97 plexShowSprite::@3
b3:
//SEG98 [51] (byte/word/dword~) plexShowSprite::$9 ← (byte/word/signed word/dword/signed dword) $ff ^ (byte) plex_sprite_msb#44 -- vbuaa=vbuc1_bxor_vbuz1
lda #$ff
eor plex_sprite_msb
//SEG99 [52] *((const byte*) SPRITES_XMSB#0) ← *((const byte*) SPRITES_XMSB#0) & (byte/word/dword~) plexShowSprite::$9 -- _deref_pbuc1=_deref_pbuc1_band_vbuaa
and SPRITES_XMSB
sta SPRITES_XMSB
jmp b2
//SEG100 plexShowSprite::@2
b2:
//SEG101 [53] (byte/signed word/word/dword/signed dword~) plexShowSprite::$5 ← (byte) plex_sprite_idx#44 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuz1_plus_1
ldx plex_sprite_idx
inx
//SEG102 [54] (byte) plex_sprite_idx#15 ← (byte/signed word/word/dword/signed dword~) plexShowSprite::$5 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuz1=vbuxx_band_vbuc1
lda #7
sax plex_sprite_idx
//SEG103 [55] (byte) plex_show_idx#15 ← ++ (byte) plex_show_idx#44 -- vbuz1=_inc_vbuz1
inc plex_show_idx
//SEG104 [56] (byte) plex_sprite_msb#25 ← (byte) plex_sprite_msb#44 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_rol_1
asl plex_sprite_msb
//SEG105 [57] if((byte) plex_sprite_msb#25!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto plexShowSprite::@5 -- vbuz1_neq_0_then_la1
lda plex_sprite_msb
cmp #0
bne b5_from_b2
//SEG106 [58] phi from plexShowSprite::@2 to plexShowSprite::@return [phi:plexShowSprite::@2->plexShowSprite::@return]
breturn_from_b2:
//SEG107 [58] phi (byte) plex_sprite_msb#16 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:plexShowSprite::@2->plexShowSprite::@return#0] -- vbuz1=vbuc1
lda #1
sta plex_sprite_msb
jmp breturn
//SEG108 plexShowSprite::@return
breturn:
//SEG109 [59] return
rts
//SEG110 [60] phi from plexShowSprite::@2 to plexShowSprite::@5 [phi:plexShowSprite::@2->plexShowSprite::@5]
b5_from_b2:
jmp b5
//SEG111 plexShowSprite::@5
b5:
//SEG112 [58] phi from plexShowSprite::@5 to plexShowSprite::@return [phi:plexShowSprite::@5->plexShowSprite::@return]
breturn_from_b5:
//SEG113 [58] phi (byte) plex_sprite_msb#16 = (byte) plex_sprite_msb#25 [phi:plexShowSprite::@5->plexShowSprite::@return#0] -- register_copy
jmp breturn
//SEG114 plexShowSprite::@1
b1:
//SEG115 [61] *((const byte*) SPRITES_XMSB#0) ← *((const byte*) SPRITES_XMSB#0) | (byte) plex_sprite_msb#44 -- _deref_pbuc1=_deref_pbuc1_bor_vbuz1
lda SPRITES_XMSB
ora plex_sprite_msb
sta SPRITES_XMSB
jmp b2
}
//SEG116 plexSort
// Ensure that the indices in PLEX_SORTED_IDX is sorted based on the y-positions in PLEX_YPOS
// Assumes that the positions are nearly sorted already (as each sprite just moves a bit)
// Uses an insertion sort:
// 1. Moves a marker (m) from the start to end of the array. Every time the marker moves forward all elements before the marker are sorted correctly.
// 2a. If the next element after the marker is larger that the current element
// the marker can be moved forwards (as the sorting is correct).
// 2b. If the next element after the marker is smaller than the current element:
// elements before the marker are shifted right one at a time until encountering one smaller than the current one.
// It is then inserted at the spot. Now the marker can move forward.
plexSort: {
.label nxt_idx = 4
.label nxt_y = 5
.label m = 3
//SEG117 [63] phi from plexSort to plexSort::@1 [phi:plexSort->plexSort::@1]
b1_from_plexSort:
//SEG118 [63] phi (byte) plexSort::m#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:plexSort->plexSort::@1#0] -- vbuz1=vbuc1
lda #0
sta m
jmp b1
//SEG119 [63] phi from plexSort::@2 to plexSort::@1 [phi:plexSort::@2->plexSort::@1]
b1_from_b2:
//SEG120 [63] phi (byte) plexSort::m#2 = (byte) plexSort::m#1 [phi:plexSort::@2->plexSort::@1#0] -- register_copy
jmp b1
//SEG121 plexSort::@1
b1:
//SEG122 [64] (byte) plexSort::nxt_idx#0 ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) plexSort::m#2) -- vbuz1=pbuc1_derefidx_vbuz2
ldy m
lda PLEX_SORTED_IDX+1,y
sta nxt_idx
//SEG123 [65] (byte) plexSort::nxt_y#0 ← *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + (byte) plexSort::nxt_idx#0) -- vbuz1=pbuc1_derefidx_vbuz2
ldy nxt_idx
lda PLEX_YPOS,y
sta nxt_y
//SEG124 [66] if((byte) plexSort::nxt_y#0>=*((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::m#2))) goto plexSort::@2 -- vbuz1_ge_pbuc1_derefidx_pbuc2_derefidx_vbuz2_then_la1
lda nxt_y
ldx m
ldy PLEX_SORTED_IDX,x
cmp PLEX_YPOS,y
bcs b2
jmp b6
//SEG125 plexSort::@6
b6:
//SEG126 [67] (byte~) plexSort::s#6 ← (byte) plexSort::m#2 -- vbuxx=vbuz1
ldx m
//SEG127 [68] phi from plexSort::@5 plexSort::@6 to plexSort::@3 [phi:plexSort::@5/plexSort::@6->plexSort::@3]
b3_from_b5:
b3_from_b6:
//SEG128 [68] phi (byte) plexSort::s#3 = (byte) plexSort::s#1 [phi:plexSort::@5/plexSort::@6->plexSort::@3#0] -- register_copy
jmp b3
//SEG129 plexSort::@3
b3:
//SEG130 [69] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) plexSort::s#3) ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#3) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
lda PLEX_SORTED_IDX,x
sta PLEX_SORTED_IDX+1,x
//SEG131 [70] (byte) plexSort::s#1 ← -- (byte) plexSort::s#3 -- vbuxx=_dec_vbuxx
dex
//SEG132 [71] if((byte) plexSort::s#1!=(byte/word/signed word/dword/signed dword) $ff) goto plexSort::@5 -- vbuxx_neq_vbuc1_then_la1
cpx #$ff
bne b5
jmp b4
//SEG133 plexSort::@4
b4:
//SEG134 [72] (byte) plexSort::s#2 ← ++ (byte) plexSort::s#1 -- vbuxx=_inc_vbuxx
inx
//SEG135 [73] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#2) ← (byte) plexSort::nxt_idx#0 -- pbuc1_derefidx_vbuxx=vbuz1
lda nxt_idx
sta PLEX_SORTED_IDX,x
jmp b2
//SEG136 plexSort::@2
b2:
//SEG137 [74] (byte) plexSort::m#1 ← ++ (byte) plexSort::m#2 -- vbuz1=_inc_vbuz1
inc m
//SEG138 [75] if((byte) plexSort::m#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 2+(byte/signed byte/word/signed word/dword/signed dword) 1) goto plexSort::@1 -- vbuz1_neq_vbuc1_then_la1
lda #PLEX_COUNT-2+1
cmp m
bne b1_from_b2
//SEG139 [76] phi from plexSort::@2 to plexSort::plexFreePrepare1 [phi:plexSort::@2->plexSort::plexFreePrepare1]
plexFreePrepare1_from_b2:
jmp plexFreePrepare1
//SEG140 plexSort::plexFreePrepare1
plexFreePrepare1:
//SEG141 [77] phi from plexSort::plexFreePrepare1 to plexSort::plexFreePrepare1_@1 [phi:plexSort::plexFreePrepare1->plexSort::plexFreePrepare1_@1]
plexFreePrepare1_b1_from_plexFreePrepare1:
//SEG142 [77] phi (byte) plexSort::plexFreePrepare1_s#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:plexSort::plexFreePrepare1->plexSort::plexFreePrepare1_@1#0] -- vbuxx=vbuc1
ldx #0
jmp plexFreePrepare1_b1
//SEG143 [77] phi from plexSort::plexFreePrepare1_@1 to plexSort::plexFreePrepare1_@1 [phi:plexSort::plexFreePrepare1_@1->plexSort::plexFreePrepare1_@1]
plexFreePrepare1_b1_from_plexFreePrepare1_b1:
//SEG144 [77] phi (byte) plexSort::plexFreePrepare1_s#2 = (byte) plexSort::plexFreePrepare1_s#1 [phi:plexSort::plexFreePrepare1_@1->plexSort::plexFreePrepare1_@1#0] -- register_copy
jmp plexFreePrepare1_b1
//SEG145 plexSort::plexFreePrepare1_@1
plexFreePrepare1_b1:
//SEG146 [78] *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plexSort::plexFreePrepare1_s#2) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- pbuc1_derefidx_vbuxx=vbuc2
lda #0
sta PLEX_FREE_YPOS,x
//SEG147 [79] (byte) plexSort::plexFreePrepare1_s#1 ← ++ (byte) plexSort::plexFreePrepare1_s#2 -- vbuxx=_inc_vbuxx
inx
//SEG148 [80] if((byte) plexSort::plexFreePrepare1_s#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto plexSort::plexFreePrepare1_@1 -- vbuxx_neq_vbuc1_then_la1
cpx #8
bne plexFreePrepare1_b1_from_plexFreePrepare1_b1
jmp breturn
//SEG149 plexSort::@return
breturn:
//SEG150 [81] return
rts
//SEG151 plexSort::@5
b5:
//SEG152 [82] if((byte) plexSort::nxt_y#0<*((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#1))) goto plexSort::@3 -- vbuz1_lt_pbuc1_derefidx_pbuc2_derefidx_vbuxx_then_la1
lda nxt_y
ldy PLEX_SORTED_IDX,x
cmp PLEX_YPOS,y
bcc b3_from_b5
jmp b4
}
//SEG153 init
// Initialize the program
init: {
.label xp = 8
//SEG154 [83] *((const byte*) D011#0) ← (const byte) VIC_DEN#0|(const byte) VIC_RSEL#0|(byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuc1=vbuc2
lda #VIC_DEN|VIC_RSEL|3
sta D011
//SEG155 [84] call plexInit
//SEG156 [98] phi from init to plexInit [phi:init->plexInit]
plexInit_from_init:
jsr plexInit
//SEG157 [85] phi from init to init::@1 [phi:init->init::@1]
b1_from_init:
//SEG158 [85] phi (word) init::xp#2 = (byte/signed byte/word/signed word/dword/signed dword) $20 [phi:init->init::@1#0] -- vwuz1=vbuc1
lda #$20
sta xp
lda #0
sta xp+1
//SEG159 [85] phi (byte) init::sx#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init->init::@1#1] -- vbuxx=vbuc1
ldx #0
jmp b1
//SEG160 [85] phi from init::@1 to init::@1 [phi:init::@1->init::@1]
b1_from_b1:
//SEG161 [85] phi (word) init::xp#2 = (word) init::xp#1 [phi:init::@1->init::@1#0] -- register_copy
//SEG162 [85] phi (byte) init::sx#2 = (byte) init::sx#1 [phi:init::@1->init::@1#1] -- register_copy
jmp b1
//SEG163 init::@1
b1:
//SEG164 [86] *((const byte[PLEX_COUNT#0]) PLEX_PTR#0 + (byte) init::sx#2) ← ((byte))(const byte*) SPRITE#0/(byte/signed byte/word/signed word/dword/signed dword) $40 -- pbuc1_derefidx_vbuxx=vbuc2
lda #$ff&SPRITE/$40
sta PLEX_PTR,x
//SEG165 [87] (byte) init::$8 ← (byte) init::sx#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuxx_rol_1
txa
asl
//SEG166 [88] *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) init::$8) ← (word) init::xp#2 -- pwuc1_derefidx_vbuaa=vwuz1
tay
lda xp
sta PLEX_XPOS,y
lda xp+1
sta PLEX_XPOS+1,y
//SEG167 [89] (word) init::xp#1 ← (word) init::xp#2 + (byte/signed byte/word/signed word/dword/signed dword) 9 -- vwuz1=vwuz1_plus_vbuc1
lda #9
clc
adc xp
sta xp
bcc !+
inc xp+1
!:
//SEG168 [90] (byte) init::sx#1 ← ++ (byte) init::sx#2 -- vbuxx=_inc_vbuxx
inx
//SEG169 [91] if((byte) init::sx#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto init::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #PLEX_COUNT-1+1
bne b1_from_b1
jmp b2
//SEG170 init::@2
b2:
//SEG171 [92] *((const byte*) SPRITES_ENABLE#0) ← (byte/word/signed word/dword/signed dword) $ff -- _deref_pbuc1=vbuc2
// Enable & initialize sprites
lda #$ff
sta SPRITES_ENABLE
//SEG172 [93] phi from init::@2 to init::@3 [phi:init::@2->init::@3]
b3_from_b2:
//SEG173 [93] phi (byte) init::ss#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init::@2->init::@3#0] -- vbuxx=vbuc1
ldx #0
jmp b3
//SEG174 [93] phi from init::@3 to init::@3 [phi:init::@3->init::@3]
b3_from_b3:
//SEG175 [93] phi (byte) init::ss#2 = (byte) init::ss#1 [phi:init::@3->init::@3#0] -- register_copy
jmp b3
//SEG176 init::@3
b3:
//SEG177 [94] *((const byte*) SPRITES_COLS#0 + (byte) init::ss#2) ← (const byte) GREEN#0 -- pbuc1_derefidx_vbuxx=vbuc2
lda #GREEN
sta SPRITES_COLS,x
//SEG178 [95] (byte) init::ss#1 ← ++ (byte) init::ss#2 -- vbuxx=_inc_vbuxx
inx
//SEG179 [96] if((byte) init::ss#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto init::@3 -- vbuxx_neq_vbuc1_then_la1
cpx #8
bne b3_from_b3
jmp breturn
//SEG180 init::@return
breturn:
//SEG181 [97] return
rts
}
//SEG182 plexInit
// Initialize the multiplexer data structures
plexInit: {
//SEG183 [99] phi from plexInit to plexInit::plexSetScreen1 [phi:plexInit->plexInit::plexSetScreen1]
plexSetScreen1_from_plexInit:
jmp plexSetScreen1
//SEG184 plexInit::plexSetScreen1
plexSetScreen1:
//SEG185 [100] phi from plexInit::plexSetScreen1 to plexInit::@1 [phi:plexInit::plexSetScreen1->plexInit::@1]
b1_from_plexSetScreen1:
//SEG186 [100] phi (byte) plexInit::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:plexInit::plexSetScreen1->plexInit::@1#0] -- vbuxx=vbuc1
ldx #0
jmp b1
//SEG187 [100] phi from plexInit::@1 to plexInit::@1 [phi:plexInit::@1->plexInit::@1]
b1_from_b1:
//SEG188 [100] phi (byte) plexInit::i#2 = (byte) plexInit::i#1 [phi:plexInit::@1->plexInit::@1#0] -- register_copy
jmp b1
//SEG189 plexInit::@1
b1:
//SEG190 [101] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexInit::i#2) ← (byte) plexInit::i#2 -- pbuc1_derefidx_vbuxx=vbuxx
txa
sta PLEX_SORTED_IDX,x
//SEG191 [102] (byte) plexInit::i#1 ← ++ (byte) plexInit::i#2 -- vbuxx=_inc_vbuxx
inx
//SEG192 [103] if((byte) plexInit::i#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto plexInit::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #PLEX_COUNT-1+1
bne b1_from_b1
jmp breturn
//SEG193 plexInit::@return
breturn:
//SEG194 [104] return
rts
}
// Contains the Y-position where each sprite is free again. PLEX_FREE_YPOS[s] holds the Y-position where sprite s is free to use again.
PLEX_FREE_YPOS: .fill 8, 0
// The x-positions of the multiplexer sprites ($000-$1ff)
PLEX_XPOS: .fill 2*PLEX_COUNT, 0
// The y-positions of the multiplexer sprites.
PLEX_YPOS: .fill PLEX_COUNT, 0
// The sprite pointers for the multiplexed sprites
PLEX_PTR: .fill PLEX_COUNT, 0
// Indexes of the plex-sprites sorted by sprite y-position. Each call to plexSort() will fix the sorting if changes to the Y-positions have ruined it.
PLEX_SORTED_IDX: .fill PLEX_COUNT, 0
.pc = YSIN "YSIN"
.var min = 50
.var max = 250-21
.var ampl = max-min;
.for(var i=0;i<256;i++)
.byte round(min+(ampl/2)+(ampl/2)*sin(toRadians(360*i/256)))
.pc = SPRITE "SPRITE"
.var pic = LoadPicture("balloon.png", List().add($000000, $ffffff))
.for (var y=0; y<21; y++)
.for (var x=0;x<3; x++)
.byte pic.getSinglecolorByte(x,y)
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp b2
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp breturn
Removing instruction jmp b1
Removing instruction jmp b2
Removing instruction jmp b3
Removing instruction jmp b4
Removing instruction jmp b5
Removing instruction jmp b11
Removing instruction jmp b6
Removing instruction jmp b7
Removing instruction jmp plexFreeNextYpos1
Removing instruction jmp b8
Removing instruction jmp b9
Removing instruction jmp b12
Removing instruction jmp b10
Removing instruction jmp plexFreeAdd1
Removing instruction jmp b4
Removing instruction jmp b3
Removing instruction jmp b2
Removing instruction jmp breturn
Removing instruction jmp b5
Removing instruction jmp b1
Removing instruction jmp b6
Removing instruction jmp b3
Removing instruction jmp b4
Removing instruction jmp b2
Removing instruction jmp plexFreePrepare1
Removing instruction jmp plexFreePrepare1_b1
Removing instruction jmp breturn
Removing instruction jmp b1
Removing instruction jmp b2
Removing instruction jmp b3
Removing instruction jmp breturn
Removing instruction jmp plexSetScreen1
Removing instruction jmp b1
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction lda #0
Removing instruction lda #0
Replacing instruction ldy nxt_idx with TAY
Removing instruction lda nxt_y
Replacing instruction ldx #0 with TAX
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Replacing label b4_from_b4 with b4
Replacing label b7_from_b12 with b7
Replacing label b1 with b2
Replacing label b5_from_b2 with b5
Replacing label b1_from_b2 with b1
Replacing label plexFreePrepare1_b1_from_plexFreePrepare1_b1 with plexFreePrepare1_b1
Replacing label b3_from_b5 with b3
Replacing label b1_from_b1 with b1
Replacing label b3_from_b3 with b3
Replacing label b1_from_b1 with b1
Removing instruction b1:
Removing instruction b2_from_b1:
Removing instruction b2:
Removing instruction bend_from_b2:
Removing instruction b1_from_main:
Removing instruction loop_from_b1:
Removing instruction b1:
Removing instruction b4_from_b4:
Removing instruction b7_from_b12:
Removing instruction b5_from_b2:
Removing instruction breturn_from_b5:
Removing instruction b1_from_b2:
Removing instruction b3_from_b5:
Removing instruction b3_from_b6:
Removing instruction plexFreePrepare1_from_b2:
Removing instruction plexFreePrepare1_b1_from_plexFreePrepare1:
Removing instruction plexFreePrepare1_b1_from_plexFreePrepare1_b1:
Removing instruction b1_from_b1:
Removing instruction b3_from_b3:
Removing instruction plexSetScreen1_from_plexInit:
Removing instruction b1_from_plexSetScreen1:
Removing instruction b1_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b1:
Removing instruction breturn:
Removing instruction b1_from_loop:
Removing instruction b3:
Removing instruction b4_from_b3:
Removing instruction b5:
Removing instruction plexSort_from_b5:
Removing instruction b11:
Removing instruction b7_from_b6:
Removing instruction plexFreeNextYpos1:
Removing instruction b9:
Removing instruction b12:
Removing instruction b10:
Removing instruction b1_from_b10:
Removing instruction plexFreeAdd1:
Removing instruction b4:
Removing instruction b3:
Removing instruction breturn_from_b2:
Removing instruction b1_from_plexSort:
Removing instruction b6:
Removing instruction plexFreePrepare1:
Removing instruction breturn:
Removing instruction plexInit_from_init:
Removing instruction b1_from_init:
Removing instruction b2:
Removing instruction b3_from_b2:
Removing instruction breturn:
Removing instruction plexSetScreen1:
Removing instruction breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Skipping double jump to breturn in bne b5
Replacing jump to rts with rts in jmp breturn
Succesful ASM optimization Pass5DoubleJumpElimination
Removing instruction jmp b4
Removing instruction jmp b7
Removing instruction jmp b1
Removing instruction jmp plexFreePrepare1_b1
Removing instruction jmp b1
Removing instruction jmp b3
Removing instruction jmp b1
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction ldx m
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Removing instruction bbegin:
Removing instruction b5:
Succesful ASM optimization Pass5UnusedLabelElimination
Removing unreachable instruction rts
Succesful ASM optimization Pass5UnreachableCodeElimination
FINAL SYMBOL TABLE
(label) @1
(label) @2
(label) @begin
(label) @end
(byte) BLACK
(const byte) BLACK#0 BLACK = (byte/signed byte/word/signed word/dword/signed dword) 0
(byte*) BORDERCOL
(const byte*) BORDERCOL#0 BORDERCOL = ((byte*))(word/dword/signed dword) $d020
(byte*) D011
(const byte*) D011#0 D011 = ((byte*))(word/dword/signed dword) $d011
(byte) GREEN
(const byte) GREEN#0 GREEN = (byte/signed byte/word/signed word/dword/signed dword) 5
(byte) PLEX_COUNT
(const byte) PLEX_COUNT#0 PLEX_COUNT = (byte/signed byte/word/signed word/dword/signed dword) $20
(byte[8]) PLEX_FREE_YPOS
(const byte[8]) PLEX_FREE_YPOS#0 PLEX_FREE_YPOS = { fill( 8, 0) }
(byte[PLEX_COUNT#0]) PLEX_PTR
(const byte[PLEX_COUNT#0]) PLEX_PTR#0 PLEX_PTR = { fill( PLEX_COUNT#0, 0) }
(byte*) PLEX_SCREEN_PTR
(const byte*) PLEX_SCREEN_PTR#1 PLEX_SCREEN_PTR = (const byte*) SCREEN#0+(word/signed word/dword/signed dword) $3f8
(byte[PLEX_COUNT#0]) PLEX_SORTED_IDX
(const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 PLEX_SORTED_IDX = { fill( PLEX_COUNT#0, 0) }
(word[PLEX_COUNT#0]) PLEX_XPOS
(const word[PLEX_COUNT#0]) PLEX_XPOS#0 PLEX_XPOS = { fill( PLEX_COUNT#0, 0) }
(byte[PLEX_COUNT#0]) PLEX_YPOS
(const byte[PLEX_COUNT#0]) PLEX_YPOS#0 PLEX_YPOS = { fill( PLEX_COUNT#0, 0) }
(byte*) RASTER
(const byte*) RASTER#0 RASTER = ((byte*))(word/dword/signed dword) $d012
(byte*) SCREEN
(const byte*) SCREEN#0 SCREEN = ((byte*))(word/signed word/dword/signed dword) $400
(byte*) SPRITE
(const byte*) SPRITE#0 SPRITE = ((byte*))(word/signed word/dword/signed dword) $2000
(byte*) SPRITES_COLS
(const byte*) SPRITES_COLS#0 SPRITES_COLS = ((byte*))(word/dword/signed dword) $d027
(byte*) SPRITES_ENABLE
(const byte*) SPRITES_ENABLE#0 SPRITES_ENABLE = ((byte*))(word/dword/signed dword) $d015
(byte*) SPRITES_XMSB
(const byte*) SPRITES_XMSB#0 SPRITES_XMSB = ((byte*))(word/dword/signed dword) $d010
(byte*) SPRITES_XPOS
(const byte*) SPRITES_XPOS#0 SPRITES_XPOS = ((byte*))(word/dword/signed dword) $d000
(byte*) SPRITES_YPOS
(const byte*) SPRITES_YPOS#0 SPRITES_YPOS = ((byte*))(word/dword/signed dword) $d001
(byte) VIC_DEN
(const byte) VIC_DEN#0 VIC_DEN = (byte/signed byte/word/signed word/dword/signed dword) $10
(byte) VIC_RSEL
(const byte) VIC_RSEL#0 VIC_RSEL = (byte/signed byte/word/signed word/dword/signed dword) 8
(byte) VIC_RST8
(const byte) VIC_RST8#0 VIC_RST8 = (byte/word/signed word/dword/signed dword) $80
(byte*) YSIN
(const byte*) YSIN#0 YSIN = ((byte*))(word/signed word/dword/signed dword) $2100
(void()) init()
(byte) init::$8 reg byte a 22.0
(label) init::@1
(label) init::@2
(label) init::@3
(label) init::@return
(byte) init::ss
(byte) init::ss#1 reg byte x 16.5
(byte) init::ss#2 reg byte x 16.5
(byte) init::sx
(byte) init::sx#1 reg byte x 16.5
(byte) init::sx#2 reg byte x 8.8
(word) init::xp
(word) init::xp#1 xp zp ZP_WORD:8 7.333333333333333
(word) init::xp#2 xp zp ZP_WORD:8 8.25
(void()) loop()
(byte~) loop::$4 reg byte a 202.0
(label) loop::@1
(label) loop::@10
(label) loop::@11
(label) loop::@12
(label) loop::@2
(label) loop::@3
(label) loop::@4
(label) loop::@5
(label) loop::@6
(label) loop::@7
(label) loop::@8
(label) loop::@9
(label) loop::plexFreeNextYpos1
(byte) loop::plexFreeNextYpos1_return
(byte) loop::plexFreeNextYpos1_return#0 plexFreeNextYpos1_return zp ZP_BYTE:10 551.0
(byte) loop::rasterY
(byte) loop::sin_idx
(byte) loop::sin_idx#1 sin_idx zp ZP_BYTE:2 1.4666666666666666
(byte) loop::sin_idx#6 sin_idx zp ZP_BYTE:2 3.666666666666667
(byte) loop::ss
(byte) loop::ss#1 ss zp ZP_BYTE:7 151.5
(byte) loop::ss#6 ss zp ZP_BYTE:7 33.666666666666664
(byte) loop::sy
(byte) loop::sy#1 reg byte y 151.5
(byte) loop::sy#2 reg byte y 101.0
(byte) loop::y_idx
(byte) loop::y_idx#1 reg byte x 67.33333333333333
(byte) loop::y_idx#2 reg byte x 157.0
(byte~) loop::y_idx#4 reg byte x 22.0
(void()) main()
(label) main::@1
(label) main::@return
(void()) plexInit((byte*) plexInit::screen)
(label) plexInit::@1
(label) plexInit::@return
(byte) plexInit::i
(byte) plexInit::i#1 reg byte x 16.5
(byte) plexInit::i#2 reg byte x 22.0
(label) plexInit::plexSetScreen1
(byte*~) plexInit::plexSetScreen1_$0
(byte*) plexInit::plexSetScreen1_screen
(byte*) plexInit::screen
(void()) plexShowSprite()
(byte) plexShowSprite::$10 reg byte a 4.0
(byte) plexShowSprite::$11 reg byte a 4.0
(byte~) plexShowSprite::$2 reg byte a 4.0
(byte~) plexShowSprite::$3 reg byte a 4.0
(byte/signed word/word/dword/signed dword~) plexShowSprite::$5 reg byte x 4.0
(byte/word/dword~) plexShowSprite::$9 reg byte a 4.0
(label) plexShowSprite::@1
(label) plexShowSprite::@2
(label) plexShowSprite::@3
(label) plexShowSprite::@4
(label) plexShowSprite::@5
(label) plexShowSprite::@return
(label) plexShowSprite::plexFreeAdd1
(byte/signed word/word/dword/signed dword~) plexShowSprite::plexFreeAdd1_$0
(byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0 reg byte a 4.0
(byte/signed word/word/dword/signed dword~) plexShowSprite::plexFreeAdd1_$1
(byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 reg byte x 4.0
(byte/word/dword~) plexShowSprite::plexFreeAdd1_$2
(byte) plexShowSprite::plexFreeAdd1_ypos
(byte) plexShowSprite::plexFreeAdd1_ypos#0 reg byte a 3.0
(byte) plexShowSprite::plex_sprite_idx2
(byte) plexShowSprite::plex_sprite_idx2#0 plex_sprite_idx2 zp ZP_BYTE:10 0.5454545454545454
(byte) plexShowSprite::xpos_idx
(byte) plexShowSprite::xpos_idx#0 reg byte x 1.5
(byte) plexShowSprite::ypos
(void()) plexSort()
(label) plexSort::@1
(label) plexSort::@2
(label) plexSort::@3
(label) plexSort::@4
(label) plexSort::@5
(label) plexSort::@6
(label) plexSort::@return
(byte) plexSort::m
(byte) plexSort::m#1 m zp ZP_BYTE:3 151.5
(byte) plexSort::m#2 m zp ZP_BYTE:3 42.08333333333333
(byte) plexSort::nxt_idx
(byte) plexSort::nxt_idx#0 nxt_idx zp ZP_BYTE:4 30.299999999999997
(byte) plexSort::nxt_y
(byte) plexSort::nxt_y#0 nxt_y zp ZP_BYTE:5 150.375
(label) plexSort::plexFreePrepare1
(bool~) plexSort::plexFreePrepare1_$0
(label) plexSort::plexFreePrepare1_@1
(byte) plexSort::plexFreePrepare1_s
(byte) plexSort::plexFreePrepare1_s#1 reg byte x 151.5
(byte) plexSort::plexFreePrepare1_s#2 reg byte x 151.5
(byte) plexSort::s
(byte) plexSort::s#1 reg byte x 1368.3333333333335
(byte) plexSort::s#2 reg byte x 202.0
(byte) plexSort::s#3 reg byte x 2052.5
(byte~) plexSort::s#6 reg byte x 202.0
(byte) plex_free_next
(byte) plex_free_next#13 plex_free_next zp ZP_BYTE:3 4.478260869565218
(byte) plex_free_next#17 plex_free_next zp ZP_BYTE:3 20.599999999999998
(byte) plex_show_idx
(byte) plex_show_idx#15 plex_show_idx zp ZP_BYTE:5 11.444444444444443
(byte) plex_show_idx#44 plex_show_idx zp ZP_BYTE:5 4.36
(byte) plex_sprite_idx
(byte) plex_sprite_idx#15 plex_sprite_idx zp ZP_BYTE:4 10.299999999999999
(byte) plex_sprite_idx#44 plex_sprite_idx zp ZP_BYTE:4 4.652173913043479
(byte) plex_sprite_msb
(byte) plex_sprite_msb#16 plex_sprite_msb zp ZP_BYTE:6 20.599999999999998
(byte) plex_sprite_msb#25 plex_sprite_msb zp ZP_BYTE:6 2.0
(byte) plex_sprite_msb#44 plex_sprite_msb zp ZP_BYTE:6 4.115384615384615
zp ZP_BYTE:2 [ loop::sin_idx#6 loop::sin_idx#1 ]
reg byte x [ loop::y_idx#2 loop::y_idx#1 loop::y_idx#4 ]
reg byte y [ loop::sy#2 loop::sy#1 ]
zp ZP_BYTE:3 [ plex_free_next#17 plex_free_next#13 plexSort::m#2 plexSort::m#1 ]
zp ZP_BYTE:4 [ plex_sprite_idx#44 plex_sprite_idx#15 plexSort::nxt_idx#0 ]
zp ZP_BYTE:5 [ plex_show_idx#44 plex_show_idx#15 plexSort::nxt_y#0 ]
zp ZP_BYTE:6 [ plex_sprite_msb#44 plex_sprite_msb#16 plex_sprite_msb#25 ]
zp ZP_BYTE:7 [ loop::ss#6 loop::ss#1 ]
reg byte x [ plexSort::s#3 plexSort::s#1 plexSort::s#6 ]
reg byte x [ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ]
reg byte x [ init::sx#2 init::sx#1 ]
zp ZP_WORD:8 [ init::xp#2 init::xp#1 ]
reg byte x [ init::ss#2 init::ss#1 ]
reg byte x [ plexInit::i#2 plexInit::i#1 ]
reg byte a [ loop::$4 ]
zp ZP_BYTE:10 [ loop::plexFreeNextYpos1_return#0 plexShowSprite::plex_sprite_idx2#0 ]
reg byte a [ plexShowSprite::plexFreeAdd1_ypos#0 ]
reg byte a [ plexShowSprite::plexFreeAdd1_$0#0 ]
reg byte x [ plexShowSprite::plexFreeAdd1_$1#0 ]
reg byte x [ plexShowSprite::xpos_idx#0 ]
reg byte a [ plexShowSprite::$10 ]
reg byte a [ plexShowSprite::$2 ]
reg byte a [ plexShowSprite::$11 ]
reg byte a [ plexShowSprite::$3 ]
reg byte a [ plexShowSprite::$9 ]
reg byte x [ plexShowSprite::$5 ]
reg byte x [ plexSort::s#2 ]
reg byte a [ init::$8 ]
FINAL ASSEMBLER
Score: 63158
//SEG0 File Comments
// A simple usage of the flexible sprite multiplexer routine
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG2 Global Constants & labels
.label SPRITES_XPOS = $d000
.label SPRITES_YPOS = $d001
.label SPRITES_XMSB = $d010
.label RASTER = $d012
.label SPRITES_ENABLE = $d015
.label BORDERCOL = $d020
.label SPRITES_COLS = $d027
.label D011 = $d011
.const VIC_RST8 = $80
.const VIC_DEN = $10
.const VIC_RSEL = 8
// The colors of the C64
.const BLACK = 0
.const GREEN = 5
// The number of sprites in the multiplexer
.const PLEX_COUNT = $20
// Location of screen & sprites
.label SCREEN = $400
.label SPRITE = $2000
.label YSIN = $2100
.label PLEX_SCREEN_PTR = SCREEN+$3f8
.label plex_free_next = 3
.label plex_sprite_idx = 4
.label plex_show_idx = 5
.label plex_sprite_msb = 6
//SEG3 @begin
//SEG4 @1
//SEG5 kickasm(location (const byte*) YSIN#0) {{ .var min = 50 .var max = 250-21 .var ampl = max-min; .for(var i=0;i<256;i++) .byte round(min+(ampl/2)+(ampl/2)*sin(toRadians(360*i/256))) }}
//SEG6 kickasm(location (const byte*) SPRITE#0) {{ .var pic = LoadPicture("balloon.png", List().add($000000, $ffffff)) .for (var y=0; y<21; y++) .for (var x=0;x<3; x++) .byte pic.getSinglecolorByte(x,y) }}
//SEG7 [3] phi from @1 to @2 [phi:@1->@2]
//SEG8 @2
//SEG9 [4] call main
//SEG10 [5] phi from @2 to @end [phi:@2->@end]
//SEG11 @end
//SEG12 main
main: {
//SEG13 asm { sei }
sei
//SEG14 [7] call init
jsr init
//SEG15 [8] phi from main to main::@1 [phi:main->main::@1]
//SEG16 main::@1
//SEG17 [9] call loop
//SEG18 [11] phi from main::@1 to loop [phi:main::@1->loop]
jsr loop
//SEG19 main::@return
//SEG20 [10] return
rts
}
//SEG21 loop
// The raster loop
loop: {
.label sin_idx = 2
.label plexFreeNextYpos1_return = $a
.label ss = 7
//SEG22 [12] phi from loop to loop::@1 [phi:loop->loop::@1]
//SEG23 [12] phi (byte) loop::sin_idx#6 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop->loop::@1#0] -- vbuz1=vbuc1
lda #0
sta sin_idx
//SEG24 loop::@1
//SEG25 loop::@2
b2:
//SEG26 [13] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) $ff) goto loop::@2 -- _deref_pbuc1_neq_vbuc2_then_la1
lda #$ff
cmp RASTER
bne b2
//SEG27 loop::@3
//SEG28 [14] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
inc BORDERCOL
//SEG29 [15] (byte~) loop::y_idx#4 ← (byte) loop::sin_idx#6 -- vbuxx=vbuz1
ldx sin_idx
//SEG30 [16] phi from loop::@3 to loop::@4 [phi:loop::@3->loop::@4]
//SEG31 [16] phi (byte) loop::sy#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@3->loop::@4#0] -- vbuyy=vbuc1
ldy #0
//SEG32 [16] phi (byte) loop::y_idx#2 = (byte~) loop::y_idx#4 [phi:loop::@3->loop::@4#1] -- register_copy
//SEG33 [16] phi from loop::@4 to loop::@4 [phi:loop::@4->loop::@4]
//SEG34 [16] phi (byte) loop::sy#2 = (byte) loop::sy#1 [phi:loop::@4->loop::@4#0] -- register_copy
//SEG35 [16] phi (byte) loop::y_idx#2 = (byte) loop::y_idx#1 [phi:loop::@4->loop::@4#1] -- register_copy
//SEG36 loop::@4
b4:
//SEG37 [17] *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + (byte) loop::sy#2) ← *((const byte*) YSIN#0 + (byte) loop::y_idx#2) -- pbuc1_derefidx_vbuyy=pbuc2_derefidx_vbuxx
lda YSIN,x
sta PLEX_YPOS,y
//SEG38 [18] (byte) loop::y_idx#1 ← (byte) loop::y_idx#2 + (byte/signed byte/word/signed word/dword/signed dword) 8 -- vbuxx=vbuxx_plus_vbuc1
txa
axs #-[8]
//SEG39 [19] (byte) loop::sy#1 ← ++ (byte) loop::sy#2 -- vbuyy=_inc_vbuyy
iny
//SEG40 [20] if((byte) loop::sy#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto loop::@4 -- vbuyy_neq_vbuc1_then_la1
cpy #PLEX_COUNT-1+1
bne b4
//SEG41 loop::@5
//SEG42 [21] (byte) loop::sin_idx#1 ← (byte) loop::sin_idx#6 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1
inc sin_idx
//SEG43 [22] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
inc BORDERCOL
//SEG44 [23] call plexSort
//SEG45 [62] phi from loop::@5 to plexSort [phi:loop::@5->plexSort]
jsr plexSort
//SEG46 loop::@11
//SEG47 [24] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2
lda #BLACK
sta BORDERCOL
//SEG48 loop::@6
b6:
//SEG49 [25] (byte~) loop::$4 ← *((const byte*) D011#0) & (const byte) VIC_RST8#0 -- vbuaa=_deref_pbuc1_band_vbuc2
lda #VIC_RST8
and D011
//SEG50 [26] if((byte~) loop::$4!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto loop::@6 -- vbuaa_neq_0_then_la1
cmp #0
bne b6
//SEG51 [27] phi from loop::@6 to loop::@7 [phi:loop::@6->loop::@7]
//SEG52 [27] phi (byte) loop::ss#6 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@6->loop::@7#0] -- vbuz1=vbuc1
lda #0
sta ss
//SEG53 [27] phi (byte) plex_sprite_msb#44 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:loop::@6->loop::@7#1] -- vbuz1=vbuc1
lda #1
sta plex_sprite_msb
//SEG54 [27] phi (byte) plex_show_idx#44 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@6->loop::@7#2] -- vbuz1=vbuc1
lda #0
sta plex_show_idx
//SEG55 [27] phi (byte) plex_sprite_idx#44 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@6->loop::@7#3] -- vbuz1=vbuc1
sta plex_sprite_idx
//SEG56 [27] phi (byte) plex_free_next#17 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@6->loop::@7#4] -- vbuz1=vbuc1
sta plex_free_next
// Show the sprites
//SEG57 [27] phi from loop::@12 to loop::@7 [phi:loop::@12->loop::@7]
//SEG58 [27] phi (byte) loop::ss#6 = (byte) loop::ss#1 [phi:loop::@12->loop::@7#0] -- register_copy
//SEG59 [27] phi (byte) plex_sprite_msb#44 = (byte) plex_sprite_msb#16 [phi:loop::@12->loop::@7#1] -- register_copy
//SEG60 [27] phi (byte) plex_show_idx#44 = (byte) plex_show_idx#15 [phi:loop::@12->loop::@7#2] -- register_copy
//SEG61 [27] phi (byte) plex_sprite_idx#44 = (byte) plex_sprite_idx#15 [phi:loop::@12->loop::@7#3] -- register_copy
//SEG62 [27] phi (byte) plex_free_next#17 = (byte) plex_free_next#13 [phi:loop::@12->loop::@7#4] -- register_copy
//SEG63 loop::@7
b7:
//SEG64 [28] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2
lda #BLACK
sta BORDERCOL
//SEG65 loop::plexFreeNextYpos1
//SEG66 [29] (byte) loop::plexFreeNextYpos1_return#0 ← *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plex_free_next#17) -- vbuz1=pbuc1_derefidx_vbuz2
ldy plex_free_next
lda PLEX_FREE_YPOS,y
sta plexFreeNextYpos1_return
//SEG67 loop::@8
b8:
//SEG68 [30] if(*((const byte*) RASTER#0)<(byte) loop::plexFreeNextYpos1_return#0) goto loop::@8 -- _deref_pbuc1_lt_vbuz1_then_la1
lda RASTER
cmp plexFreeNextYpos1_return
bcc b8
//SEG69 loop::@9
//SEG70 [31] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
inc BORDERCOL
//SEG71 [32] call plexShowSprite
jsr plexShowSprite
//SEG72 loop::@12
//SEG73 [33] (byte) loop::ss#1 ← ++ (byte) loop::ss#6 -- vbuz1=_inc_vbuz1
inc ss
//SEG74 [34] if((byte) loop::ss#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto loop::@7 -- vbuz1_neq_vbuc1_then_la1
lda #PLEX_COUNT-1+1
cmp ss
bne b7
//SEG75 loop::@10
//SEG76 [35] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2
lda #BLACK
sta BORDERCOL
//SEG77 [12] phi from loop::@10 to loop::@1 [phi:loop::@10->loop::@1]
//SEG78 [12] phi (byte) loop::sin_idx#6 = (byte) loop::sin_idx#1 [phi:loop::@10->loop::@1#0] -- register_copy
jmp b2
}
//SEG79 plexShowSprite
// Show the next sprite.
// plexSort() prepares showing the sprites
plexShowSprite: {
.label plex_sprite_idx2 = $a
//SEG80 [36] (byte) plexShowSprite::plex_sprite_idx2#0 ← (byte) plex_sprite_idx#44 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz2_rol_1
lda plex_sprite_idx
asl
sta plex_sprite_idx2
//SEG81 [37] (byte) plexShowSprite::plexFreeAdd1_ypos#0 ← *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44)) -- vbuaa=pbuc1_derefidx_pbuc2_derefidx_vbuz1
ldx plex_show_idx
ldy PLEX_SORTED_IDX,x
lda PLEX_YPOS,y
//SEG82 [38] *((const byte*) SPRITES_YPOS#0 + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte) plexShowSprite::plexFreeAdd1_ypos#0 -- pbuc1_derefidx_vbuz1=vbuaa
ldy plex_sprite_idx2
sta SPRITES_YPOS,y
//SEG83 plexShowSprite::plexFreeAdd1
//SEG84 [39] (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0 ← (byte) plexShowSprite::plexFreeAdd1_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) $15 -- vbuaa=vbuaa_plus_vbuc1
clc
adc #$15
//SEG85 [40] *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plex_free_next#17) ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0 -- pbuc1_derefidx_vbuz1=vbuaa
ldy plex_free_next
sta PLEX_FREE_YPOS,y
//SEG86 [41] (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 ← (byte) plex_free_next#17 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuz1_plus_1
ldx plex_free_next
inx
//SEG87 [42] (byte) plex_free_next#13 ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuz1=vbuxx_band_vbuc1
lda #7
sax plex_free_next
//SEG88 plexShowSprite::@4
//SEG89 [43] *((const byte*) PLEX_SCREEN_PTR#1 + (byte) plex_sprite_idx#44) ← *((const byte[PLEX_COUNT#0]) PLEX_PTR#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44)) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_pbuc3_derefidx_vbuz2
ldx plex_show_idx
ldy PLEX_SORTED_IDX,x
lda PLEX_PTR,y
ldx plex_sprite_idx
sta PLEX_SCREEN_PTR,x
//SEG90 [44] (byte) plexShowSprite::xpos_idx#0 ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44) -- vbuxx=pbuc1_derefidx_vbuz1
ldy plex_show_idx
ldx PLEX_SORTED_IDX,y
//SEG91 [45] (byte) plexShowSprite::$10 ← (byte) plexShowSprite::xpos_idx#0 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuxx_rol_1
txa
asl
//SEG92 [46] (byte~) plexShowSprite::$2 ← < *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::$10) -- vbuaa=_lo_pwuc1_derefidx_vbuaa
tay
lda PLEX_XPOS,y
//SEG93 [47] *((const byte*) SPRITES_XPOS#0 + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte~) plexShowSprite::$2 -- pbuc1_derefidx_vbuz1=vbuaa
ldy plex_sprite_idx2
sta SPRITES_XPOS,y
//SEG94 [48] (byte) plexShowSprite::$11 ← (byte) plexShowSprite::xpos_idx#0 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuxx_rol_1
txa
asl
//SEG95 [49] (byte~) plexShowSprite::$3 ← > *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::$11) -- vbuaa=_hi_pwuc1_derefidx_vbuaa
tay
lda PLEX_XPOS+1,y
//SEG96 [50] if((byte~) plexShowSprite::$3!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto plexShowSprite::@1 -- vbuaa_neq_0_then_la1
cmp #0
bne b1
//SEG97 plexShowSprite::@3
//SEG98 [51] (byte/word/dword~) plexShowSprite::$9 ← (byte/word/signed word/dword/signed dword) $ff ^ (byte) plex_sprite_msb#44 -- vbuaa=vbuc1_bxor_vbuz1
lda #$ff
eor plex_sprite_msb
//SEG99 [52] *((const byte*) SPRITES_XMSB#0) ← *((const byte*) SPRITES_XMSB#0) & (byte/word/dword~) plexShowSprite::$9 -- _deref_pbuc1=_deref_pbuc1_band_vbuaa
and SPRITES_XMSB
sta SPRITES_XMSB
//SEG100 plexShowSprite::@2
b2:
//SEG101 [53] (byte/signed word/word/dword/signed dword~) plexShowSprite::$5 ← (byte) plex_sprite_idx#44 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuz1_plus_1
ldx plex_sprite_idx
inx
//SEG102 [54] (byte) plex_sprite_idx#15 ← (byte/signed word/word/dword/signed dword~) plexShowSprite::$5 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuz1=vbuxx_band_vbuc1
lda #7
sax plex_sprite_idx
//SEG103 [55] (byte) plex_show_idx#15 ← ++ (byte) plex_show_idx#44 -- vbuz1=_inc_vbuz1
inc plex_show_idx
//SEG104 [56] (byte) plex_sprite_msb#25 ← (byte) plex_sprite_msb#44 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_rol_1
asl plex_sprite_msb
//SEG105 [57] if((byte) plex_sprite_msb#25!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto plexShowSprite::@5 -- vbuz1_neq_0_then_la1
lda plex_sprite_msb
cmp #0
bne breturn
//SEG106 [58] phi from plexShowSprite::@2 to plexShowSprite::@return [phi:plexShowSprite::@2->plexShowSprite::@return]
//SEG107 [58] phi (byte) plex_sprite_msb#16 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:plexShowSprite::@2->plexShowSprite::@return#0] -- vbuz1=vbuc1
lda #1
sta plex_sprite_msb
//SEG108 plexShowSprite::@return
breturn:
//SEG109 [59] return
rts
//SEG110 [60] phi from plexShowSprite::@2 to plexShowSprite::@5 [phi:plexShowSprite::@2->plexShowSprite::@5]
//SEG111 plexShowSprite::@5
//SEG112 [58] phi from plexShowSprite::@5 to plexShowSprite::@return [phi:plexShowSprite::@5->plexShowSprite::@return]
//SEG113 [58] phi (byte) plex_sprite_msb#16 = (byte) plex_sprite_msb#25 [phi:plexShowSprite::@5->plexShowSprite::@return#0] -- register_copy
//SEG114 plexShowSprite::@1
b1:
//SEG115 [61] *((const byte*) SPRITES_XMSB#0) ← *((const byte*) SPRITES_XMSB#0) | (byte) plex_sprite_msb#44 -- _deref_pbuc1=_deref_pbuc1_bor_vbuz1
lda SPRITES_XMSB
ora plex_sprite_msb
sta SPRITES_XMSB
jmp b2
}
//SEG116 plexSort
// Ensure that the indices in PLEX_SORTED_IDX is sorted based on the y-positions in PLEX_YPOS
// Assumes that the positions are nearly sorted already (as each sprite just moves a bit)
// Uses an insertion sort:
// 1. Moves a marker (m) from the start to end of the array. Every time the marker moves forward all elements before the marker are sorted correctly.
// 2a. If the next element after the marker is larger that the current element
// the marker can be moved forwards (as the sorting is correct).
// 2b. If the next element after the marker is smaller than the current element:
// elements before the marker are shifted right one at a time until encountering one smaller than the current one.
// It is then inserted at the spot. Now the marker can move forward.
plexSort: {
.label nxt_idx = 4
.label nxt_y = 5
.label m = 3
//SEG117 [63] phi from plexSort to plexSort::@1 [phi:plexSort->plexSort::@1]
//SEG118 [63] phi (byte) plexSort::m#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:plexSort->plexSort::@1#0] -- vbuz1=vbuc1
lda #0
sta m
//SEG119 [63] phi from plexSort::@2 to plexSort::@1 [phi:plexSort::@2->plexSort::@1]
//SEG120 [63] phi (byte) plexSort::m#2 = (byte) plexSort::m#1 [phi:plexSort::@2->plexSort::@1#0] -- register_copy
//SEG121 plexSort::@1
b1:
//SEG122 [64] (byte) plexSort::nxt_idx#0 ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) plexSort::m#2) -- vbuz1=pbuc1_derefidx_vbuz2
ldy m
lda PLEX_SORTED_IDX+1,y
sta nxt_idx
//SEG123 [65] (byte) plexSort::nxt_y#0 ← *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + (byte) plexSort::nxt_idx#0) -- vbuz1=pbuc1_derefidx_vbuz2
tay
lda PLEX_YPOS,y
sta nxt_y
//SEG124 [66] if((byte) plexSort::nxt_y#0>=*((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::m#2))) goto plexSort::@2 -- vbuz1_ge_pbuc1_derefidx_pbuc2_derefidx_vbuz2_then_la1
ldx m
ldy PLEX_SORTED_IDX,x
cmp PLEX_YPOS,y
bcs b2
//SEG125 plexSort::@6
//SEG126 [67] (byte~) plexSort::s#6 ← (byte) plexSort::m#2 -- vbuxx=vbuz1
//SEG127 [68] phi from plexSort::@5 plexSort::@6 to plexSort::@3 [phi:plexSort::@5/plexSort::@6->plexSort::@3]
//SEG128 [68] phi (byte) plexSort::s#3 = (byte) plexSort::s#1 [phi:plexSort::@5/plexSort::@6->plexSort::@3#0] -- register_copy
//SEG129 plexSort::@3
b3:
//SEG130 [69] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) plexSort::s#3) ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#3) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
lda PLEX_SORTED_IDX,x
sta PLEX_SORTED_IDX+1,x
//SEG131 [70] (byte) plexSort::s#1 ← -- (byte) plexSort::s#3 -- vbuxx=_dec_vbuxx
dex
//SEG132 [71] if((byte) plexSort::s#1!=(byte/word/signed word/dword/signed dword) $ff) goto plexSort::@5 -- vbuxx_neq_vbuc1_then_la1
cpx #$ff
bne b5
//SEG133 plexSort::@4
b4:
//SEG134 [72] (byte) plexSort::s#2 ← ++ (byte) plexSort::s#1 -- vbuxx=_inc_vbuxx
inx
//SEG135 [73] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#2) ← (byte) plexSort::nxt_idx#0 -- pbuc1_derefidx_vbuxx=vbuz1
lda nxt_idx
sta PLEX_SORTED_IDX,x
//SEG136 plexSort::@2
b2:
//SEG137 [74] (byte) plexSort::m#1 ← ++ (byte) plexSort::m#2 -- vbuz1=_inc_vbuz1
inc m
//SEG138 [75] if((byte) plexSort::m#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 2+(byte/signed byte/word/signed word/dword/signed dword) 1) goto plexSort::@1 -- vbuz1_neq_vbuc1_then_la1
lda #PLEX_COUNT-2+1
cmp m
bne b1
//SEG139 [76] phi from plexSort::@2 to plexSort::plexFreePrepare1 [phi:plexSort::@2->plexSort::plexFreePrepare1]
//SEG140 plexSort::plexFreePrepare1
//SEG141 [77] phi from plexSort::plexFreePrepare1 to plexSort::plexFreePrepare1_@1 [phi:plexSort::plexFreePrepare1->plexSort::plexFreePrepare1_@1]
//SEG142 [77] phi (byte) plexSort::plexFreePrepare1_s#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:plexSort::plexFreePrepare1->plexSort::plexFreePrepare1_@1#0] -- vbuxx=vbuc1
ldx #0
//SEG143 [77] phi from plexSort::plexFreePrepare1_@1 to plexSort::plexFreePrepare1_@1 [phi:plexSort::plexFreePrepare1_@1->plexSort::plexFreePrepare1_@1]
//SEG144 [77] phi (byte) plexSort::plexFreePrepare1_s#2 = (byte) plexSort::plexFreePrepare1_s#1 [phi:plexSort::plexFreePrepare1_@1->plexSort::plexFreePrepare1_@1#0] -- register_copy
//SEG145 plexSort::plexFreePrepare1_@1
plexFreePrepare1_b1:
//SEG146 [78] *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plexSort::plexFreePrepare1_s#2) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- pbuc1_derefidx_vbuxx=vbuc2
lda #0
sta PLEX_FREE_YPOS,x
//SEG147 [79] (byte) plexSort::plexFreePrepare1_s#1 ← ++ (byte) plexSort::plexFreePrepare1_s#2 -- vbuxx=_inc_vbuxx
inx
//SEG148 [80] if((byte) plexSort::plexFreePrepare1_s#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto plexSort::plexFreePrepare1_@1 -- vbuxx_neq_vbuc1_then_la1
cpx #8
bne plexFreePrepare1_b1
//SEG149 plexSort::@return
//SEG150 [81] return
rts
//SEG151 plexSort::@5
b5:
//SEG152 [82] if((byte) plexSort::nxt_y#0<*((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#1))) goto plexSort::@3 -- vbuz1_lt_pbuc1_derefidx_pbuc2_derefidx_vbuxx_then_la1
lda nxt_y
ldy PLEX_SORTED_IDX,x
cmp PLEX_YPOS,y
bcc b3
jmp b4
}
//SEG153 init
// Initialize the program
init: {
.label xp = 8
//SEG154 [83] *((const byte*) D011#0) ← (const byte) VIC_DEN#0|(const byte) VIC_RSEL#0|(byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuc1=vbuc2
lda #VIC_DEN|VIC_RSEL|3
sta D011
//SEG155 [84] call plexInit
//SEG156 [98] phi from init to plexInit [phi:init->plexInit]
jsr plexInit
//SEG157 [85] phi from init to init::@1 [phi:init->init::@1]
//SEG158 [85] phi (word) init::xp#2 = (byte/signed byte/word/signed word/dword/signed dword) $20 [phi:init->init::@1#0] -- vwuz1=vbuc1
lda #$20
sta xp
lda #0
sta xp+1
//SEG159 [85] phi (byte) init::sx#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init->init::@1#1] -- vbuxx=vbuc1
tax
//SEG160 [85] phi from init::@1 to init::@1 [phi:init::@1->init::@1]
//SEG161 [85] phi (word) init::xp#2 = (word) init::xp#1 [phi:init::@1->init::@1#0] -- register_copy
//SEG162 [85] phi (byte) init::sx#2 = (byte) init::sx#1 [phi:init::@1->init::@1#1] -- register_copy
//SEG163 init::@1
b1:
//SEG164 [86] *((const byte[PLEX_COUNT#0]) PLEX_PTR#0 + (byte) init::sx#2) ← ((byte))(const byte*) SPRITE#0/(byte/signed byte/word/signed word/dword/signed dword) $40 -- pbuc1_derefidx_vbuxx=vbuc2
lda #$ff&SPRITE/$40
sta PLEX_PTR,x
//SEG165 [87] (byte) init::$8 ← (byte) init::sx#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuxx_rol_1
txa
asl
//SEG166 [88] *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) init::$8) ← (word) init::xp#2 -- pwuc1_derefidx_vbuaa=vwuz1
tay
lda xp
sta PLEX_XPOS,y
lda xp+1
sta PLEX_XPOS+1,y
//SEG167 [89] (word) init::xp#1 ← (word) init::xp#2 + (byte/signed byte/word/signed word/dword/signed dword) 9 -- vwuz1=vwuz1_plus_vbuc1
lda #9
clc
adc xp
sta xp
bcc !+
inc xp+1
!:
//SEG168 [90] (byte) init::sx#1 ← ++ (byte) init::sx#2 -- vbuxx=_inc_vbuxx
inx
//SEG169 [91] if((byte) init::sx#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto init::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #PLEX_COUNT-1+1
bne b1
//SEG170 init::@2
//SEG171 [92] *((const byte*) SPRITES_ENABLE#0) ← (byte/word/signed word/dword/signed dword) $ff -- _deref_pbuc1=vbuc2
// Enable & initialize sprites
lda #$ff
sta SPRITES_ENABLE
//SEG172 [93] phi from init::@2 to init::@3 [phi:init::@2->init::@3]
//SEG173 [93] phi (byte) init::ss#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init::@2->init::@3#0] -- vbuxx=vbuc1
ldx #0
//SEG174 [93] phi from init::@3 to init::@3 [phi:init::@3->init::@3]
//SEG175 [93] phi (byte) init::ss#2 = (byte) init::ss#1 [phi:init::@3->init::@3#0] -- register_copy
//SEG176 init::@3
b3:
//SEG177 [94] *((const byte*) SPRITES_COLS#0 + (byte) init::ss#2) ← (const byte) GREEN#0 -- pbuc1_derefidx_vbuxx=vbuc2
lda #GREEN
sta SPRITES_COLS,x
//SEG178 [95] (byte) init::ss#1 ← ++ (byte) init::ss#2 -- vbuxx=_inc_vbuxx
inx
//SEG179 [96] if((byte) init::ss#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto init::@3 -- vbuxx_neq_vbuc1_then_la1
cpx #8
bne b3
//SEG180 init::@return
//SEG181 [97] return
rts
}
//SEG182 plexInit
// Initialize the multiplexer data structures
plexInit: {
//SEG183 [99] phi from plexInit to plexInit::plexSetScreen1 [phi:plexInit->plexInit::plexSetScreen1]
//SEG184 plexInit::plexSetScreen1
//SEG185 [100] phi from plexInit::plexSetScreen1 to plexInit::@1 [phi:plexInit::plexSetScreen1->plexInit::@1]
//SEG186 [100] phi (byte) plexInit::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:plexInit::plexSetScreen1->plexInit::@1#0] -- vbuxx=vbuc1
ldx #0
//SEG187 [100] phi from plexInit::@1 to plexInit::@1 [phi:plexInit::@1->plexInit::@1]
//SEG188 [100] phi (byte) plexInit::i#2 = (byte) plexInit::i#1 [phi:plexInit::@1->plexInit::@1#0] -- register_copy
//SEG189 plexInit::@1
b1:
//SEG190 [101] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexInit::i#2) ← (byte) plexInit::i#2 -- pbuc1_derefidx_vbuxx=vbuxx
txa
sta PLEX_SORTED_IDX,x
//SEG191 [102] (byte) plexInit::i#1 ← ++ (byte) plexInit::i#2 -- vbuxx=_inc_vbuxx
inx
//SEG192 [103] if((byte) plexInit::i#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto plexInit::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #PLEX_COUNT-1+1
bne b1
//SEG193 plexInit::@return
//SEG194 [104] return
rts
}
// Contains the Y-position where each sprite is free again. PLEX_FREE_YPOS[s] holds the Y-position where sprite s is free to use again.
PLEX_FREE_YPOS: .fill 8, 0
// The x-positions of the multiplexer sprites ($000-$1ff)
PLEX_XPOS: .fill 2*PLEX_COUNT, 0
// The y-positions of the multiplexer sprites.
PLEX_YPOS: .fill PLEX_COUNT, 0
// The sprite pointers for the multiplexed sprites
PLEX_PTR: .fill PLEX_COUNT, 0
// Indexes of the plex-sprites sorted by sprite y-position. Each call to plexSort() will fix the sorting if changes to the Y-positions have ruined it.
PLEX_SORTED_IDX: .fill PLEX_COUNT, 0
.pc = YSIN "YSIN"
.var min = 50
.var max = 250-21
.var ampl = max-min;
.for(var i=0;i<256;i++)
.byte round(min+(ampl/2)+(ampl/2)*sin(toRadians(360*i/256)))
.pc = SPRITE "SPRITE"
.var pic = LoadPicture("balloon.png", List().add($000000, $ffffff))
.for (var y=0; y<21; y++)
.for (var x=0;x<3; x++)
.byte pic.getSinglecolorByte(x,y)