1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2025-08-08 13:25:12 +00:00

Fixed code for __ma.

This commit is contained in:
jespergravgaard
2020-02-15 09:30:27 +01:00
parent f45ba8eb10
commit 7dacbb2c75
21 changed files with 1575 additions and 1506 deletions

View File

@@ -15,7 +15,7 @@ void init_squares() {
SQUARES = malloc(NUM_SQUARES*sizeof(word)); SQUARES = malloc(NUM_SQUARES*sizeof(word));
word* squares = SQUARES; word* squares = SQUARES;
word sqr = 0; word sqr = 0;
for( byte i: 0..NUM_SQUARES-1) { for(byte i=0;i<NUM_SQUARES;i++) {
*squares++ = sqr; *squares++ = sqr;
sqr += i*2+1; sqr += i*2+1;
} }

View File

@@ -10,7 +10,7 @@ const char* PLAYFIELD_SPRITE_PTRS_1 = (PLAYFIELD_SCREEN_1+SPRITE_PTRS);
// Screen Sprite pointers on screen 2 // Screen Sprite pointers on screen 2
const char* PLAYFIELD_SPRITE_PTRS_2 = (PLAYFIELD_SCREEN_2+SPRITE_PTRS); const char* PLAYFIELD_SPRITE_PTRS_2 = (PLAYFIELD_SCREEN_2+SPRITE_PTRS);
// Address of the original playscreen chars // Address of the original playscreen chars
const char* PLAYFIELD_SCREEN_ORIGINAL = 0x1800; const char* PLAYFIELD_SCREEN_ORIGINAL = 0x3000;
// Address of the original playscreen colors // Address of the original playscreen colors
const char* PLAYFIELD_COLORS_ORIGINAL = 0x1c00; const char* PLAYFIELD_COLORS_ORIGINAL = 0x1c00;
// Address of the sprites covering the playfield // Address of the sprites covering the playfield

View File

@@ -91,7 +91,7 @@
// Screen Sprite pointers on screen 2 // Screen Sprite pointers on screen 2
.label PLAYFIELD_SPRITE_PTRS_2 = PLAYFIELD_SCREEN_2+SPRITE_PTRS .label PLAYFIELD_SPRITE_PTRS_2 = PLAYFIELD_SCREEN_2+SPRITE_PTRS
// Address of the original playscreen chars // Address of the original playscreen chars
.label PLAYFIELD_SCREEN_ORIGINAL = $1800 .label PLAYFIELD_SCREEN_ORIGINAL = $3000
// Address of the original playscreen colors // Address of the original playscreen colors
.label PLAYFIELD_COLORS_ORIGINAL = $1c00 .label PLAYFIELD_COLORS_ORIGINAL = $1c00
// Address of the sprites covering the playfield // Address of the sprites covering the playfield

View File

@@ -3459,7 +3459,7 @@ SYMBOL TABLE SSA
(const byte) PLAYFIELD_LINES = (byte) $16 (const byte) PLAYFIELD_LINES = (byte) $16
(const byte*) PLAYFIELD_SCREEN_1 = (byte*)(number) $400 (const byte*) PLAYFIELD_SCREEN_1 = (byte*)(number) $400
(const byte*) PLAYFIELD_SCREEN_2 = (byte*)(number) $2c00 (const byte*) PLAYFIELD_SCREEN_2 = (byte*)(number) $2c00
(const byte*) PLAYFIELD_SCREEN_ORIGINAL = (byte*)(number) $1800 (const byte*) PLAYFIELD_SCREEN_ORIGINAL = (byte*)(number) $3000
(const byte*) PLAYFIELD_SPRITES = (byte*)(number) $2000 (const byte*) PLAYFIELD_SPRITES = (byte*)(number) $2000
(const byte*) PLAYFIELD_SPRITE_PTRS_1 = (const byte*) PLAYFIELD_SCREEN_1+(const word) SPRITE_PTRS (const byte*) PLAYFIELD_SPRITE_PTRS_1 = (const byte*) PLAYFIELD_SCREEN_1+(const word) SPRITE_PTRS
(const byte*) PLAYFIELD_SPRITE_PTRS_2 = (const byte*) PLAYFIELD_SCREEN_2+(const word) SPRITE_PTRS (const byte*) PLAYFIELD_SPRITE_PTRS_2 = (const byte*) PLAYFIELD_SCREEN_2+(const word) SPRITE_PTRS
@@ -6514,7 +6514,7 @@ Simplifying constant pointer cast (byte*) 54290
Simplifying constant pointer cast (byte*) 54299 Simplifying constant pointer cast (byte*) 54299
Simplifying constant pointer cast (byte*) 1024 Simplifying constant pointer cast (byte*) 1024
Simplifying constant pointer cast (byte*) 11264 Simplifying constant pointer cast (byte*) 11264
Simplifying constant pointer cast (byte*) 6144 Simplifying constant pointer cast (byte*) 12288
Simplifying constant pointer cast (byte*) 7168 Simplifying constant pointer cast (byte*) 7168
Simplifying constant pointer cast (byte*) 8192 Simplifying constant pointer cast (byte*) 8192
Simplifying constant pointer cast (byte*) 10240 Simplifying constant pointer cast (byte*) 10240
@@ -11725,7 +11725,7 @@ Target platform is c64basic / MOS6502X
// Screen Sprite pointers on screen 2 // Screen Sprite pointers on screen 2
.label PLAYFIELD_SPRITE_PTRS_2 = PLAYFIELD_SCREEN_2+SPRITE_PTRS .label PLAYFIELD_SPRITE_PTRS_2 = PLAYFIELD_SCREEN_2+SPRITE_PTRS
// Address of the original playscreen chars // Address of the original playscreen chars
.label PLAYFIELD_SCREEN_ORIGINAL = $1800 .label PLAYFIELD_SCREEN_ORIGINAL = $3000
// Address of the original playscreen colors // Address of the original playscreen colors
.label PLAYFIELD_COLORS_ORIGINAL = $1c00 .label PLAYFIELD_COLORS_ORIGINAL = $1c00
// Address of the sprites covering the playfield // Address of the sprites covering the playfield
@@ -16882,7 +16882,7 @@ ASSEMBLER BEFORE OPTIMIZATION
// Screen Sprite pointers on screen 2 // Screen Sprite pointers on screen 2
.label PLAYFIELD_SPRITE_PTRS_2 = PLAYFIELD_SCREEN_2+SPRITE_PTRS .label PLAYFIELD_SPRITE_PTRS_2 = PLAYFIELD_SCREEN_2+SPRITE_PTRS
// Address of the original playscreen chars // Address of the original playscreen chars
.label PLAYFIELD_SCREEN_ORIGINAL = $1800 .label PLAYFIELD_SCREEN_ORIGINAL = $3000
// Address of the original playscreen colors // Address of the original playscreen colors
.label PLAYFIELD_COLORS_ORIGINAL = $1c00 .label PLAYFIELD_COLORS_ORIGINAL = $1c00
// Address of the sprites covering the playfield // Address of the sprites covering the playfield
@@ -21056,7 +21056,7 @@ FINAL SYMBOL TABLE
(const byte) PLAYFIELD_LINES = (byte) $16 (const byte) PLAYFIELD_LINES = (byte) $16
(const byte*) PLAYFIELD_SCREEN_1 = (byte*) 1024 (const byte*) PLAYFIELD_SCREEN_1 = (byte*) 1024
(const byte*) PLAYFIELD_SCREEN_2 = (byte*) 11264 (const byte*) PLAYFIELD_SCREEN_2 = (byte*) 11264
(const byte*) PLAYFIELD_SCREEN_ORIGINAL = (byte*) 6144 (const byte*) PLAYFIELD_SCREEN_ORIGINAL = (byte*) 12288
(const byte*) PLAYFIELD_SPRITES = (byte*) 8192 (const byte*) PLAYFIELD_SPRITES = (byte*) 8192
(const byte*) PLAYFIELD_SPRITE_PTRS_1 = (const byte*) PLAYFIELD_SCREEN_1+(const word) SPRITE_PTRS (const byte*) PLAYFIELD_SPRITE_PTRS_1 = (const byte*) PLAYFIELD_SCREEN_1+(const word) SPRITE_PTRS
(const byte*) PLAYFIELD_SPRITE_PTRS_2 = (const byte*) PLAYFIELD_SCREEN_2+(const word) SPRITE_PTRS (const byte*) PLAYFIELD_SPRITE_PTRS_2 = (const byte*) PLAYFIELD_SCREEN_2+(const word) SPRITE_PTRS
@@ -22135,7 +22135,7 @@ Score: 3353855
// Screen Sprite pointers on screen 2 // Screen Sprite pointers on screen 2
.label PLAYFIELD_SPRITE_PTRS_2 = PLAYFIELD_SCREEN_2+SPRITE_PTRS .label PLAYFIELD_SPRITE_PTRS_2 = PLAYFIELD_SCREEN_2+SPRITE_PTRS
// Address of the original playscreen chars // Address of the original playscreen chars
.label PLAYFIELD_SCREEN_ORIGINAL = $1800 .label PLAYFIELD_SCREEN_ORIGINAL = $3000
// Address of the original playscreen colors // Address of the original playscreen colors
.label PLAYFIELD_COLORS_ORIGINAL = $1c00 .label PLAYFIELD_COLORS_ORIGINAL = $1c00
// Address of the sprites covering the playfield // Address of the sprites covering the playfield

View File

@@ -69,7 +69,7 @@
(const byte) PLAYFIELD_LINES = (byte) $16 (const byte) PLAYFIELD_LINES = (byte) $16
(const byte*) PLAYFIELD_SCREEN_1 = (byte*) 1024 (const byte*) PLAYFIELD_SCREEN_1 = (byte*) 1024
(const byte*) PLAYFIELD_SCREEN_2 = (byte*) 11264 (const byte*) PLAYFIELD_SCREEN_2 = (byte*) 11264
(const byte*) PLAYFIELD_SCREEN_ORIGINAL = (byte*) 6144 (const byte*) PLAYFIELD_SCREEN_ORIGINAL = (byte*) 12288
(const byte*) PLAYFIELD_SPRITES = (byte*) 8192 (const byte*) PLAYFIELD_SPRITES = (byte*) 8192
(const byte*) PLAYFIELD_SPRITE_PTRS_1 = (const byte*) PLAYFIELD_SCREEN_1+(const word) SPRITE_PTRS (const byte*) PLAYFIELD_SPRITE_PTRS_1 = (const byte*) PLAYFIELD_SCREEN_1+(const word) SPRITE_PTRS
(const byte*) PLAYFIELD_SPRITE_PTRS_2 = (const byte*) PLAYFIELD_SCREEN_2+(const word) SPRITE_PTRS (const byte*) PLAYFIELD_SPRITE_PTRS_2 = (const byte*) PLAYFIELD_SCREEN_2+(const word) SPRITE_PTRS

View File

@@ -886,11 +886,15 @@ init_squares: {
sta.z squares sta.z squares
lda.z SQUARES+1 lda.z SQUARES+1
sta.z squares+1 sta.z squares+1
ldx #0 lda #<0
txa
sta.z sqr sta.z sqr
sta.z sqr+1 sta.z sqr+1
tax
__b1: __b1:
cpx #NUM_SQUARES
bcc __b2
rts
__b2:
ldy #0 ldy #0
lda.z sqr lda.z sqr
sta (squares),y sta (squares),y
@@ -915,9 +919,7 @@ init_squares: {
inc.z sqr+1 inc.z sqr+1
!: !:
inx inx
cpx #NUM_SQUARES-1+1 jmp __b1
bne __b1
rts
} }
// Allocates a block of size bytes of memory, returning a pointer to the beginning of the block. // Allocates a block of size bytes of memory, returning a pointer to the beginning of the block.
// The content of the newly allocated block of memory is not initialized, remaining with indeterminate values. // The content of the newly allocated block of memory is not initialized, remaining with indeterminate values.

View File

@@ -521,26 +521,28 @@ sqr::@return: scope:[sqr] from sqr
init_squares: scope:[init_squares] from init_dist_screen init_squares: scope:[init_squares] from init_dist_screen
[242] phi() [242] phi()
[243] call malloc [243] call malloc
to:init_squares::@2 to:init_squares::@3
init_squares::@2: scope:[init_squares] from init_squares init_squares::@3: scope:[init_squares] from init_squares
[244] (void*) SQUARES#1 ← (void*)(byte*) malloc::mem#0 [244] (void*) SQUARES#1 ← (void*)(byte*) malloc::mem#0
[245] (word*) init_squares::squares#0 ← (word*)(void*) SQUARES#1 [245] (word*) init_squares::squares#0 ← (word*)(void*) SQUARES#1
to:init_squares::@1 to:init_squares::@1
init_squares::@1: scope:[init_squares] from init_squares::@1 init_squares::@2 init_squares::@1: scope:[init_squares] from init_squares::@2 init_squares::@3
[246] (byte) init_squares::i#2 ← phi( init_squares::@1/(byte) init_squares::i#1 init_squares::@2/(byte) 0 ) [246] (word*) init_squares::squares#2 ← phi( init_squares::@2/(word*) init_squares::squares#1 init_squares::@3/(word*) init_squares::squares#0 )
[246] (word*) init_squares::squares#2 ← phi( init_squares::@1/(word*) init_squares::squares#1 init_squares::@2/(word*) init_squares::squares#0 ) [246] (word) init_squares::sqr#2 ← phi( init_squares::@2/(word) init_squares::sqr#1 init_squares::@3/(word) 0 )
[246] (word) init_squares::sqr#2 ← phi( init_squares::@1/(word) init_squares::sqr#1 init_squares::@2/(word) 0 ) [246] (byte) init_squares::i#2 ← phi( init_squares::@2/(byte) init_squares::i#1 init_squares::@3/(byte) 0 )
[247] *((word*) init_squares::squares#2) ← (word) init_squares::sqr#2 [247] if((byte) init_squares::i#2<(const byte) NUM_SQUARES#3) goto init_squares::@2
[248] (word*) init_squares::squares#1 ← (word*) init_squares::squares#2 + (const byte) SIZEOF_WORD
[249] (byte~) init_squares::$3 ← (byte) init_squares::i#2 << (byte) 1
[250] (byte~) init_squares::$4 ← (byte~) init_squares::$3 + (byte) 1
[251] (word) init_squares::sqr#1 ← (word) init_squares::sqr#2 + (byte~) init_squares::$4
[252] (byte) init_squares::i#1 ← ++ (byte) init_squares::i#2
[253] if((byte) init_squares::i#1!=(const byte) NUM_SQUARES#3-(byte) 1+(byte) 1) goto init_squares::@1
to:init_squares::@return to:init_squares::@return
init_squares::@return: scope:[init_squares] from init_squares::@1 init_squares::@return: scope:[init_squares] from init_squares::@1
[254] return [248] return
to:@return to:@return
init_squares::@2: scope:[init_squares] from init_squares::@1
[249] *((word*) init_squares::squares#2) ← (word) init_squares::sqr#2
[250] (word*) init_squares::squares#1 ← (word*) init_squares::squares#2 + (const byte) SIZEOF_WORD
[251] (byte~) init_squares::$3 ← (byte) init_squares::i#2 << (byte) 1
[252] (byte~) init_squares::$4 ← (byte~) init_squares::$3 + (byte) 1
[253] (word) init_squares::sqr#1 ← (word) init_squares::sqr#2 + (byte~) init_squares::$4
[254] (byte) init_squares::i#1 ← ++ (byte) init_squares::i#2
to:init_squares::@1
(void*()) malloc((word) malloc::size) (void*()) malloc((word) malloc::size)
malloc: scope:[malloc] from @1 @3 init_squares malloc: scope:[malloc] from @1 @3 init_squares

File diff suppressed because it is too large Load Diff

View File

@@ -279,17 +279,18 @@
(byte~) init_squares::$4 reg byte a 22.0 (byte~) init_squares::$4 reg byte a 22.0
(label) init_squares::@1 (label) init_squares::@1
(label) init_squares::@2 (label) init_squares::@2
(label) init_squares::@3
(label) init_squares::@return (label) init_squares::@return
(byte) init_squares::i (byte) init_squares::i
(byte) init_squares::i#1 reg byte x 16.5 (byte) init_squares::i#1 reg byte x 22.0
(byte) init_squares::i#2 reg byte x 5.5 (byte) init_squares::i#2 reg byte x 6.285714285714286
(word) init_squares::sqr (word) init_squares::sqr
(word) init_squares::sqr#1 sqr zp[2]:26 7.333333333333333 (word) init_squares::sqr#1 sqr zp[2]:26 11.0
(word) init_squares::sqr#2 sqr zp[2]:26 6.6000000000000005 (word) init_squares::sqr#2 sqr zp[2]:26 5.5
(word*) init_squares::squares (word*) init_squares::squares
(word*) init_squares::squares#0 squares zp[2]:16 4.0 (word*) init_squares::squares#0 squares zp[2]:16 4.0
(word*) init_squares::squares#1 squares zp[2]:16 3.6666666666666665 (word*) init_squares::squares#1 squares zp[2]:16 4.4
(word*) init_squares::squares#2 squares zp[2]:16 17.5 (word*) init_squares::squares#2 squares zp[2]:16 11.666666666666666
(void()) main() (void()) main()
(label) main::@1 (label) main::@1
(label) main::@2 (label) main::@2

View File

@@ -389,15 +389,19 @@ init_squares: {
.label squares = 9 .label squares = 9
.label sqr = 4 .label sqr = 4
jsr malloc jsr malloc
ldx #0
lda #<SQUARES lda #<SQUARES
sta.z squares sta.z squares
lda #>SQUARES lda #>SQUARES
sta.z squares+1 sta.z squares+1
txa lda #<0
sta.z sqr sta.z sqr
sta.z sqr+1 sta.z sqr+1
tax
__b1: __b1:
cpx #NUM_SQUARES
bcc __b2
rts
__b2:
ldy #0 ldy #0
lda.z sqr lda.z sqr
sta (squares),y sta (squares),y
@@ -422,9 +426,7 @@ init_squares: {
inc.z sqr+1 inc.z sqr+1
!: !:
inx inx
cpx #NUM_SQUARES-1+1 jmp __b1
bne __b1
rts
} }
// Allocates a block of size bytes of memory, returning a pointer to the beginning of the block. // Allocates a block of size bytes of memory, returning a pointer to the beginning of the block.
// The content of the newly allocated block of memory is not initialized, remaining with indeterminate values. // The content of the newly allocated block of memory is not initialized, remaining with indeterminate values.

View File

@@ -262,21 +262,23 @@ init_squares: scope:[init_squares] from init_dist_screen
[119] phi() [119] phi()
[120] call malloc [120] call malloc
to:init_squares::@1 to:init_squares::@1
init_squares::@1: scope:[init_squares] from init_squares init_squares::@1 init_squares::@1: scope:[init_squares] from init_squares init_squares::@2
[121] (byte) init_squares::i#2 ← phi( init_squares::@1/(byte) init_squares::i#1 init_squares/(byte) 0 ) [121] (word*) init_squares::squares#2 ← phi( init_squares::@2/(word*) init_squares::squares#1 init_squares/(const word*) SQUARES#1 )
[121] (word*) init_squares::squares#2 ← phi( init_squares::@1/(word*) init_squares::squares#1 init_squares/(const word*) SQUARES#1 ) [121] (word) init_squares::sqr#2 ← phi( init_squares::@2/(word) init_squares::sqr#1 init_squares/(word) 0 )
[121] (word) init_squares::sqr#2 ← phi( init_squares::@1/(word) init_squares::sqr#1 init_squares/(word) 0 ) [121] (byte) init_squares::i#2 ← phi( init_squares::@2/(byte) init_squares::i#1 init_squares/(byte) 0 )
[122] *((word*) init_squares::squares#2) ← (word) init_squares::sqr#2 [122] if((byte) init_squares::i#2<(const byte) NUM_SQUARES#3) goto init_squares::@2
[123] (word*) init_squares::squares#1 ← (word*) init_squares::squares#2 + (const byte) SIZEOF_WORD
[124] (byte~) init_squares::$3 ← (byte) init_squares::i#2 << (byte) 1
[125] (byte~) init_squares::$4 ← (byte~) init_squares::$3 + (byte) 1
[126] (word) init_squares::sqr#1 ← (word) init_squares::sqr#2 + (byte~) init_squares::$4
[127] (byte) init_squares::i#1 ← ++ (byte) init_squares::i#2
[128] if((byte) init_squares::i#1!=(const byte) NUM_SQUARES#3-(byte) 1+(byte) 1) goto init_squares::@1
to:init_squares::@return to:init_squares::@return
init_squares::@return: scope:[init_squares] from init_squares::@1 init_squares::@return: scope:[init_squares] from init_squares::@1
[129] return [123] return
to:@return to:@return
init_squares::@2: scope:[init_squares] from init_squares::@1
[124] *((word*) init_squares::squares#2) ← (word) init_squares::sqr#2
[125] (word*) init_squares::squares#1 ← (word*) init_squares::squares#2 + (const byte) SIZEOF_WORD
[126] (byte~) init_squares::$3 ← (byte) init_squares::i#2 << (byte) 1
[127] (byte~) init_squares::$4 ← (byte~) init_squares::$3 + (byte) 1
[128] (word) init_squares::sqr#1 ← (word) init_squares::sqr#2 + (byte~) init_squares::$4
[129] (byte) init_squares::i#1 ← ++ (byte) init_squares::i#2
to:init_squares::@1
(void*()) malloc((word) malloc::size) (void*()) malloc((word) malloc::size)
malloc: scope:[malloc] from init_squares malloc: scope:[malloc] from init_squares

File diff suppressed because it is too large Load Diff

View File

@@ -151,16 +151,17 @@
(byte~) init_squares::$3 reg byte a 22.0 (byte~) init_squares::$3 reg byte a 22.0
(byte~) init_squares::$4 reg byte a 22.0 (byte~) init_squares::$4 reg byte a 22.0
(label) init_squares::@1 (label) init_squares::@1
(label) init_squares::@2
(label) init_squares::@return (label) init_squares::@return
(byte) init_squares::i (byte) init_squares::i
(byte) init_squares::i#1 reg byte x 16.5 (byte) init_squares::i#1 reg byte x 22.0
(byte) init_squares::i#2 reg byte x 5.5 (byte) init_squares::i#2 reg byte x 6.285714285714286
(word) init_squares::sqr (word) init_squares::sqr
(word) init_squares::sqr#1 sqr zp[2]:4 7.333333333333333 (word) init_squares::sqr#1 sqr zp[2]:4 11.0
(word) init_squares::sqr#2 sqr zp[2]:4 6.6000000000000005 (word) init_squares::sqr#2 sqr zp[2]:4 5.5
(word*) init_squares::squares (word*) init_squares::squares
(word*) init_squares::squares#1 squares zp[2]:9 3.6666666666666665 (word*) init_squares::squares#1 squares zp[2]:9 4.4
(word*) init_squares::squares#2 squares zp[2]:9 16.5 (word*) init_squares::squares#2 squares zp[2]:9 11.0
(void()) main() (void()) main()
(dword~) main::$4 zp[4]:13 4.0 (dword~) main::$4 zp[4]:13 4.0
(label) main::@1 (label) main::@1

View File

@@ -954,11 +954,15 @@ init_squares: {
sta.z squares sta.z squares
lda.z SQUARES+1 lda.z SQUARES+1
sta.z squares+1 sta.z squares+1
ldx #0 lda #<0
txa
sta.z sqr sta.z sqr
sta.z sqr+1 sta.z sqr+1
tax
__b1: __b1:
cpx #NUM_SQUARES
bcc __b2
rts
__b2:
ldy #0 ldy #0
lda.z sqr lda.z sqr
sta (squares),y sta (squares),y
@@ -983,9 +987,7 @@ init_squares: {
inc.z sqr+1 inc.z sqr+1
!: !:
inx inx
cpx #NUM_SQUARES-1+1 jmp __b1
bne __b1
rts
} }
// Angles representing ATAN(0.5), ATAN(0.25), ATAN(0.125), ... // Angles representing ATAN(0.5), ATAN(0.25), ATAN(0.125), ...
CORDIC_ATAN2_ANGLES_16: CORDIC_ATAN2_ANGLES_16:

View File

@@ -488,23 +488,25 @@ sqr::@return: scope:[sqr] from sqr
init_squares: scope:[init_squares] from init_dist_screen init_squares: scope:[init_squares] from init_dist_screen
[242] phi() [242] phi()
[243] call malloc [243] call malloc
to:init_squares::@2 to:init_squares::@3
init_squares::@2: scope:[init_squares] from init_squares init_squares::@3: scope:[init_squares] from init_squares
[244] (void*) SQUARES#1 ← (void*)(byte*) malloc::mem#0 [244] (void*) SQUARES#1 ← (void*)(byte*) malloc::mem#0
[245] (word*) init_squares::squares#0 ← (word*)(void*) SQUARES#1 [245] (word*) init_squares::squares#0 ← (word*)(void*) SQUARES#1
to:init_squares::@1 to:init_squares::@1
init_squares::@1: scope:[init_squares] from init_squares::@1 init_squares::@2 init_squares::@1: scope:[init_squares] from init_squares::@2 init_squares::@3
[246] (byte) init_squares::i#2 ← phi( init_squares::@1/(byte) init_squares::i#1 init_squares::@2/(byte) 0 ) [246] (word*) init_squares::squares#2 ← phi( init_squares::@2/(word*) init_squares::squares#1 init_squares::@3/(word*) init_squares::squares#0 )
[246] (word*) init_squares::squares#2 ← phi( init_squares::@1/(word*) init_squares::squares#1 init_squares::@2/(word*) init_squares::squares#0 ) [246] (word) init_squares::sqr#2 ← phi( init_squares::@2/(word) init_squares::sqr#1 init_squares::@3/(word) 0 )
[246] (word) init_squares::sqr#2 ← phi( init_squares::@1/(word) init_squares::sqr#1 init_squares::@2/(word) 0 ) [246] (byte) init_squares::i#2 ← phi( init_squares::@2/(byte) init_squares::i#1 init_squares::@3/(byte) 0 )
[247] *((word*) init_squares::squares#2) ← (word) init_squares::sqr#2 [247] if((byte) init_squares::i#2<(const byte) NUM_SQUARES#3) goto init_squares::@2
[248] (word*) init_squares::squares#1 ← (word*) init_squares::squares#2 + (const byte) SIZEOF_WORD
[249] (byte~) init_squares::$3 ← (byte) init_squares::i#2 << (byte) 1
[250] (byte~) init_squares::$4 ← (byte~) init_squares::$3 + (byte) 1
[251] (word) init_squares::sqr#1 ← (word) init_squares::sqr#2 + (byte~) init_squares::$4
[252] (byte) init_squares::i#1 ← ++ (byte) init_squares::i#2
[253] if((byte) init_squares::i#1!=(const byte) NUM_SQUARES#3-(byte) 1+(byte) 1) goto init_squares::@1
to:init_squares::@return to:init_squares::@return
init_squares::@return: scope:[init_squares] from init_squares::@1 init_squares::@return: scope:[init_squares] from init_squares::@1
[254] return [248] return
to:@return to:@return
init_squares::@2: scope:[init_squares] from init_squares::@1
[249] *((word*) init_squares::squares#2) ← (word) init_squares::sqr#2
[250] (word*) init_squares::squares#1 ← (word*) init_squares::squares#2 + (const byte) SIZEOF_WORD
[251] (byte~) init_squares::$3 ← (byte) init_squares::i#2 << (byte) 1
[252] (byte~) init_squares::$4 ← (byte~) init_squares::$3 + (byte) 1
[253] (word) init_squares::sqr#1 ← (word) init_squares::sqr#2 + (byte~) init_squares::$4
[254] (byte) init_squares::i#1 ← ++ (byte) init_squares::i#2
to:init_squares::@1

File diff suppressed because it is too large Load Diff

View File

@@ -301,17 +301,18 @@
(byte~) init_squares::$4 reg byte a 22.0 (byte~) init_squares::$4 reg byte a 22.0
(label) init_squares::@1 (label) init_squares::@1
(label) init_squares::@2 (label) init_squares::@2
(label) init_squares::@3
(label) init_squares::@return (label) init_squares::@return
(byte) init_squares::i (byte) init_squares::i
(byte) init_squares::i#1 reg byte x 16.5 (byte) init_squares::i#1 reg byte x 22.0
(byte) init_squares::i#2 reg byte x 5.5 (byte) init_squares::i#2 reg byte x 6.285714285714286
(word) init_squares::sqr (word) init_squares::sqr
(word) init_squares::sqr#1 sqr zp[2]:28 7.333333333333333 (word) init_squares::sqr#1 sqr zp[2]:28 11.0
(word) init_squares::sqr#2 sqr zp[2]:28 6.6000000000000005 (word) init_squares::sqr#2 sqr zp[2]:28 5.5
(word*) init_squares::squares (word*) init_squares::squares
(word*) init_squares::squares#0 squares zp[2]:20 4.0 (word*) init_squares::squares#0 squares zp[2]:20 4.0
(word*) init_squares::squares#1 squares zp[2]:20 3.6666666666666665 (word*) init_squares::squares#1 squares zp[2]:20 4.4
(word*) init_squares::squares#2 squares zp[2]:20 17.5 (word*) init_squares::squares#2 squares zp[2]:20 11.666666666666666
(void()) main() (void()) main()
(byte~) main::$23 reg byte a 22.0 (byte~) main::$23 reg byte a 22.0
(byte~) main::$24 reg byte a 202.0 (byte~) main::$24 reg byte a 202.0

View File

@@ -688,11 +688,15 @@ init_squares: {
sta.z squares sta.z squares
lda.z SQUARES+1 lda.z SQUARES+1
sta.z squares+1 sta.z squares+1
ldx #0 lda #<0
txa
sta.z sqr sta.z sqr
sta.z sqr+1 sta.z sqr+1
tax
__b1: __b1:
cpx #NUM_SQUARES
bcc __b2
rts
__b2:
ldy #0 ldy #0
lda.z sqr lda.z sqr
sta (squares),y sta (squares),y
@@ -717,9 +721,7 @@ init_squares: {
inc.z sqr+1 inc.z sqr+1
!: !:
inx inx
cpx #NUM_SQUARES-1+1 jmp __b1
bne __b1
rts
} }
// Allocates a block of size bytes of memory, returning a pointer to the beginning of the block. // Allocates a block of size bytes of memory, returning a pointer to the beginning of the block.
// The content of the newly allocated block of memory is not initialized, remaining with indeterminate values. // The content of the newly allocated block of memory is not initialized, remaining with indeterminate values.

View File

@@ -376,26 +376,28 @@ sqr::@return: scope:[sqr] from sqr
init_squares: scope:[init_squares] from init_dist_screen init_squares: scope:[init_squares] from init_dist_screen
[177] phi() [177] phi()
[178] call malloc [178] call malloc
to:init_squares::@2 to:init_squares::@3
init_squares::@2: scope:[init_squares] from init_squares init_squares::@3: scope:[init_squares] from init_squares
[179] (void*) SQUARES#1 ← (void*)(byte*) malloc::mem#0 [179] (void*) SQUARES#1 ← (void*)(byte*) malloc::mem#0
[180] (word*) init_squares::squares#0 ← (word*)(void*) SQUARES#1 [180] (word*) init_squares::squares#0 ← (word*)(void*) SQUARES#1
to:init_squares::@1 to:init_squares::@1
init_squares::@1: scope:[init_squares] from init_squares::@1 init_squares::@2 init_squares::@1: scope:[init_squares] from init_squares::@2 init_squares::@3
[181] (byte) init_squares::i#2 ← phi( init_squares::@1/(byte) init_squares::i#1 init_squares::@2/(byte) 0 ) [181] (word*) init_squares::squares#2 ← phi( init_squares::@2/(word*) init_squares::squares#1 init_squares::@3/(word*) init_squares::squares#0 )
[181] (word*) init_squares::squares#2 ← phi( init_squares::@1/(word*) init_squares::squares#1 init_squares::@2/(word*) init_squares::squares#0 ) [181] (word) init_squares::sqr#2 ← phi( init_squares::@2/(word) init_squares::sqr#1 init_squares::@3/(word) 0 )
[181] (word) init_squares::sqr#2 ← phi( init_squares::@1/(word) init_squares::sqr#1 init_squares::@2/(word) 0 ) [181] (byte) init_squares::i#2 ← phi( init_squares::@2/(byte) init_squares::i#1 init_squares::@3/(byte) 0 )
[182] *((word*) init_squares::squares#2) ← (word) init_squares::sqr#2 [182] if((byte) init_squares::i#2<(const byte) NUM_SQUARES#3) goto init_squares::@2
[183] (word*) init_squares::squares#1 ← (word*) init_squares::squares#2 + (const byte) SIZEOF_WORD
[184] (byte~) init_squares::$3 ← (byte) init_squares::i#2 << (byte) 1
[185] (byte~) init_squares::$4 ← (byte~) init_squares::$3 + (byte) 1
[186] (word) init_squares::sqr#1 ← (word) init_squares::sqr#2 + (byte~) init_squares::$4
[187] (byte) init_squares::i#1 ← ++ (byte) init_squares::i#2
[188] if((byte) init_squares::i#1!=(const byte) NUM_SQUARES#3-(byte) 1+(byte) 1) goto init_squares::@1
to:init_squares::@return to:init_squares::@return
init_squares::@return: scope:[init_squares] from init_squares::@1 init_squares::@return: scope:[init_squares] from init_squares::@1
[189] return [183] return
to:@return to:@return
init_squares::@2: scope:[init_squares] from init_squares::@1
[184] *((word*) init_squares::squares#2) ← (word) init_squares::sqr#2
[185] (word*) init_squares::squares#1 ← (word*) init_squares::squares#2 + (const byte) SIZEOF_WORD
[186] (byte~) init_squares::$3 ← (byte) init_squares::i#2 << (byte) 1
[187] (byte~) init_squares::$4 ← (byte~) init_squares::$3 + (byte) 1
[188] (word) init_squares::sqr#1 ← (word) init_squares::sqr#2 + (byte~) init_squares::$4
[189] (byte) init_squares::i#1 ← ++ (byte) init_squares::i#2
to:init_squares::@1
(void*()) malloc((word) malloc::size) (void*()) malloc((word) malloc::size)
malloc: scope:[malloc] from @1 @3 init_squares malloc: scope:[malloc] from @1 @3 init_squares

File diff suppressed because it is too large Load Diff

View File

@@ -239,17 +239,18 @@
(byte~) init_squares::$4 reg byte a 22.0 (byte~) init_squares::$4 reg byte a 22.0
(label) init_squares::@1 (label) init_squares::@1
(label) init_squares::@2 (label) init_squares::@2
(label) init_squares::@3
(label) init_squares::@return (label) init_squares::@return
(byte) init_squares::i (byte) init_squares::i
(byte) init_squares::i#1 reg byte x 16.5 (byte) init_squares::i#1 reg byte x 22.0
(byte) init_squares::i#2 reg byte x 5.5 (byte) init_squares::i#2 reg byte x 6.285714285714286
(word) init_squares::sqr (word) init_squares::sqr
(word) init_squares::sqr#1 sqr zp[2]:7 7.333333333333333 (word) init_squares::sqr#1 sqr zp[2]:7 11.0
(word) init_squares::sqr#2 sqr zp[2]:7 6.6000000000000005 (word) init_squares::sqr#2 sqr zp[2]:7 5.5
(word*) init_squares::squares (word*) init_squares::squares
(word*) init_squares::squares#0 squares zp[2]:9 4.0 (word*) init_squares::squares#0 squares zp[2]:9 4.0
(word*) init_squares::squares#1 squares zp[2]:9 3.6666666666666665 (word*) init_squares::squares#1 squares zp[2]:9 4.4
(word*) init_squares::squares#2 squares zp[2]:9 17.5 (word*) init_squares::squares#2 squares zp[2]:9 11.666666666666666
(void()) main() (void()) main()
(label) main::@1 (label) main::@1
(label) main::@10 (label) main::@10
@@ -328,9 +329,9 @@ zp[1]:6 [ init_dist_screen::xb#2 init_dist_screen::xb#1 init_angle_screen::xb#2
reg byte a [ init_dist_screen::xd#0 init_dist_screen::$16 init_dist_screen::$14 ] reg byte a [ init_dist_screen::xd#0 init_dist_screen::$16 init_dist_screen::$14 ]
reg byte x [ bsearch16u::num#5 bsearch16u::num#1 bsearch16u::num#3 bsearch16u::num#0 ] reg byte x [ bsearch16u::num#5 bsearch16u::num#1 bsearch16u::num#3 bsearch16u::num#0 ]
reg byte a [ sqr::val#2 sqr::val#1 sqr::val#0 ] reg byte a [ sqr::val#2 sqr::val#1 sqr::val#0 ]
reg byte x [ init_squares::i#2 init_squares::i#1 ]
zp[2]:7 [ init_squares::sqr#2 init_squares::sqr#1 init_dist_screen::screen_bottomline#11 init_dist_screen::screen_bottomline#0 init_dist_screen::screen_bottomline#1 init_angle_screen::screen_topline#6 init_angle_screen::screen_topline#0 init_angle_screen::screen_topline#1 main::fill#2 main::fill#1 ] zp[2]:7 [ init_squares::sqr#2 init_squares::sqr#1 init_dist_screen::screen_bottomline#11 init_dist_screen::screen_bottomline#0 init_dist_screen::screen_bottomline#1 init_angle_screen::screen_topline#6 init_angle_screen::screen_topline#0 init_angle_screen::screen_topline#1 main::fill#2 main::fill#1 ]
zp[2]:9 [ init_squares::squares#2 init_squares::squares#1 init_squares::squares#0 bsearch16u::return#1 bsearch16u::return#6 bsearch16u::return#2 bsearch16u::items#2 bsearch16u::items#1 bsearch16u::items#8 bsearch16u::$2 bsearch16u::items#0 bsearch16u::return#3 sqrt::found#0 sqrt::$3 sqrt::$1 init_angle_screen::screen_bottomline#6 init_angle_screen::screen_bottomline#0 init_angle_screen::screen_bottomline#1 init_angle_screen::screen#0 main::dist#2 main::dist#0 main::dist#1 ] zp[2]:9 [ init_squares::squares#2 init_squares::squares#1 init_squares::squares#0 bsearch16u::return#1 bsearch16u::return#6 bsearch16u::return#2 bsearch16u::items#2 bsearch16u::items#1 bsearch16u::items#8 bsearch16u::$2 bsearch16u::items#0 bsearch16u::return#3 sqrt::found#0 sqrt::$3 sqrt::$1 init_angle_screen::screen_bottomline#6 init_angle_screen::screen_bottomline#0 init_angle_screen::screen_bottomline#1 init_angle_screen::screen#0 main::dist#2 main::dist#0 main::dist#1 ]
reg byte x [ init_squares::i#2 init_squares::i#1 ]
zp[2]:11 [ SCREEN_DIST#0 ] zp[2]:11 [ SCREEN_DIST#0 ]
zp[2]:13 [ SCREEN_ANGLE#0 ] zp[2]:13 [ SCREEN_ANGLE#0 ]
reg byte a [ init_angle_screen::$3 ] reg byte a [ init_angle_screen::$3 ]