From 0da4300069ccfd2e51fae51d7597111d94700787 Mon Sep 17 00:00:00 2001 From: jespergravgaard Date: Sat, 25 Apr 2020 21:25:27 +0200 Subject: [PATCH] Fixed atoi(). --- .../vwsm1=vwsm1_plus_pbuz2_derefidx_vbuyy.asm | 7 ++ .../vwsm1=vwsm2_plus_pbum3_derefidx_vbuxx.asm | 7 -- .../vwsm1=vwsm2_plus_pbum3_derefidx_vbuyy.asm | 7 -- .../vwsm1=vwsm2_plus_pbuz3_derefidx_vbuyy.asm | 7 ++ src/test/ref/atoi-1.asm | 8 +- src/test/ref/atoi-1.log | 117 +++++++----------- 6 files changed, 63 insertions(+), 90 deletions(-) create mode 100644 src/main/fragment/mos6502-common/vwsm1=vwsm1_plus_pbuz2_derefidx_vbuyy.asm delete mode 100644 src/main/fragment/mos6502-common/vwsm1=vwsm2_plus_pbum3_derefidx_vbuxx.asm delete mode 100644 src/main/fragment/mos6502-common/vwsm1=vwsm2_plus_pbum3_derefidx_vbuyy.asm create mode 100644 src/main/fragment/mos6502-common/vwsm1=vwsm2_plus_pbuz3_derefidx_vbuyy.asm diff --git a/src/main/fragment/mos6502-common/vwsm1=vwsm1_plus_pbuz2_derefidx_vbuyy.asm b/src/main/fragment/mos6502-common/vwsm1=vwsm1_plus_pbuz2_derefidx_vbuyy.asm new file mode 100644 index 000000000..b5215c0d0 --- /dev/null +++ b/src/main/fragment/mos6502-common/vwsm1=vwsm1_plus_pbuz2_derefidx_vbuyy.asm @@ -0,0 +1,7 @@ +clc +lda {m1} +adc ({z2}),y +sta {m1} +bcc !+ +inc {m1}+1 +!: \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/vwsm1=vwsm2_plus_pbum3_derefidx_vbuxx.asm b/src/main/fragment/mos6502-common/vwsm1=vwsm2_plus_pbum3_derefidx_vbuxx.asm deleted file mode 100644 index 2454b4272..000000000 --- a/src/main/fragment/mos6502-common/vwsm1=vwsm2_plus_pbum3_derefidx_vbuxx.asm +++ /dev/null @@ -1,7 +0,0 @@ -clc -lda {m2} -adc {m3},x -sta {m1} -lda {m2}+1 -adc {m3}+1,x -sta {m1}+1 diff --git a/src/main/fragment/mos6502-common/vwsm1=vwsm2_plus_pbum3_derefidx_vbuyy.asm b/src/main/fragment/mos6502-common/vwsm1=vwsm2_plus_pbum3_derefidx_vbuyy.asm deleted file mode 100644 index 9bb3d25dc..000000000 --- a/src/main/fragment/mos6502-common/vwsm1=vwsm2_plus_pbum3_derefidx_vbuyy.asm +++ /dev/null @@ -1,7 +0,0 @@ -clc -lda {m2} -adc {m3},y -sta {m1} -lda {m2}+1 -adc {m3}+1,y -sta {m1}+1 diff --git a/src/main/fragment/mos6502-common/vwsm1=vwsm2_plus_pbuz3_derefidx_vbuyy.asm b/src/main/fragment/mos6502-common/vwsm1=vwsm2_plus_pbuz3_derefidx_vbuyy.asm new file mode 100644 index 000000000..f3199f3fc --- /dev/null +++ b/src/main/fragment/mos6502-common/vwsm1=vwsm2_plus_pbuz3_derefidx_vbuyy.asm @@ -0,0 +1,7 @@ +clc +lda {m2} +adc ({z3}),y +sta {m1} +bcc !+ +inc {m2}+1 +!: \ No newline at end of file diff --git a/src/test/ref/atoi-1.asm b/src/test/ref/atoi-1.asm index 7023edaed..545f8653e 100644 --- a/src/test/ref/atoi-1.asm +++ b/src/test/ref/atoi-1.asm @@ -509,7 +509,13 @@ atoi: { asl.z __3 rol.z __3+1 // res * 10 + str[i] - .assert "Missing ASM fragment Fragment not found vwsz1=vwsz1_plus_pbuz2_derefidx_vbuyy. Attempted variations vwsz1=vwsz1_plus_pbuz2_derefidx_vbuyy ", 0, 1 + clc + lda.z __4 + adc (str),y + sta.z __4 + bcc !+ + inc.z __4+1 + !: // res = res * 10 + str[i] - '0' sec lda.z res diff --git a/src/test/ref/atoi-1.log b/src/test/ref/atoi-1.log index eafcbd9c2..29d08548b 100644 --- a/src/test/ref/atoi-1.log +++ b/src/test/ref/atoi-1.log @@ -4277,14 +4277,14 @@ atoi: { rol sta.z __3+1 // [131] (signed word~) atoi::$4 ← (signed word~) atoi::$3 + *((to_nomodify byte*) atoi::str#2 + (byte) atoi::i#4) -- vwsz1=vwsz2_plus_pbuz3_derefidx_vbuz4 - ldx.z i + ldy.z i clc lda.z __3 - adc.z str,x + adc (str),y sta.z __4 - lda.z __3+1 - adc.z str+1,x - sta.z __4+1 + bcc !+ + inc.z __3+1 + !: // [132] (signed word) atoi::res#1 ← (signed word~) atoi::$4 - (byte) '0' -- vwsz1=vwsz2_minus_vbuc1 sec lda.z __4 @@ -4533,29 +4533,29 @@ Uplift Scope [printf_format_string] Uplift Scope [printf_cls] Uplift Scope [main] -Uplifting [memcpy] best 24392 combination zp[2]:12 [ memcpy::src#2 memcpy::src#1 ] zp[2]:14 [ memcpy::dst#2 memcpy::dst#1 ] -Uplifting [memset] best 24286 combination zp[2]:10 [ memset::dst#2 memset::dst#4 memset::dst#1 ] zp[2]:48 [ memset::end#0 ] reg byte x [ memset::c#4 ] zp[2]:5 [ memset::num#2 ] zp[2]:7 [ memset::str#3 ] -Uplifting [utoa_append] best 23683 combination zp[2]:24 [ utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 ] reg byte x [ utoa_append::digit#2 utoa_append::digit#1 ] zp[2]:59 [ utoa_append::sub#0 ] zp[2]:61 [ utoa_append::return#0 ] zp[2]:57 [ utoa_append::buffer#0 ] -Uplifting [printf_ln] best 23683 combination zp[2]:42 [ printf_ln::$0 ] zp[2]:44 [ printf_ln::$1 ] -Uplifting [printf_char] best 23647 combination zp[2]:46 [ printf_char::$6 ] reg byte a [ printf_char::ch#3 printf_char::ch#2 printf_char::ch#1 ] -Uplifting [printf_str] best 23527 combination zp[2]:2 [ printf_str::str#4 printf_str::str#6 printf_str::str#0 ] reg byte a [ printf_str::ch#0 ] -Uplifting [] best 23527 combination zp[2]:35 [ printf_cursor_ptr ] zp[1]:34 [ printf_cursor_y ] zp[1]:33 [ printf_cursor_x ] mem[12] [ printf_buffer ] -Uplifting [utoa] best 23393 combination zp[2]:22 [ utoa::buffer#11 utoa::buffer#14 utoa::buffer#4 ] zp[2]:19 [ utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 ] zp[1]:18 [ utoa::digit#2 utoa::digit#1 ] reg byte a [ utoa::$10 ] reg byte x [ utoa::started#2 utoa::started#4 ] zp[2]:55 [ utoa::digit_value#0 ] reg byte a [ utoa::$11 ] zp[2]:52 [ utoa::buffer#3 ] -Uplifting [atoi] best 23190 combination reg byte y [ atoi::i#4 atoi::i#2 ] zp[2]:31 [ atoi::return#2 atoi::return#0 atoi::res#2 atoi::res#1 ] zp[2]:63 [ atoi::$8 ] zp[2]:65 [ atoi::$9 ] zp[2]:67 [ atoi::$3 ] zp[2]:69 [ atoi::$4 ] reg byte x [ atoi::negative#2 ] zp[2]:27 [ atoi::str#2 ] zp[2]:37 [ atoi::return#3 ] zp[2]:39 [ atoi::return#4 ] -Uplifting [printf_number_buffer] best 23181 combination reg byte a [ printf_number_buffer::buffer_sign#0 ] -Uplifting [printf_sint] best 23181 combination zp[2]:16 [ printf_sint::value#5 printf_sint::value#0 printf_sint::value#3 printf_sint::value#1 printf_sint::value#2 ] -Uplifting [RADIX] best 23181 combination -Uplifting [printf_format_number] best 23181 combination -Uplifting [printf_buffer_number] best 23181 combination -Uplifting [printf_format_string] best 23181 combination -Uplifting [printf_cls] best 23181 combination -Uplifting [main] best 23181 combination +Uplifting [memcpy] best 24382 combination zp[2]:12 [ memcpy::src#2 memcpy::src#1 ] zp[2]:14 [ memcpy::dst#2 memcpy::dst#1 ] +Uplifting [memset] best 24276 combination zp[2]:10 [ memset::dst#2 memset::dst#4 memset::dst#1 ] zp[2]:48 [ memset::end#0 ] reg byte x [ memset::c#4 ] zp[2]:5 [ memset::num#2 ] zp[2]:7 [ memset::str#3 ] +Uplifting [utoa_append] best 23673 combination zp[2]:24 [ utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 ] reg byte x [ utoa_append::digit#2 utoa_append::digit#1 ] zp[2]:59 [ utoa_append::sub#0 ] zp[2]:61 [ utoa_append::return#0 ] zp[2]:57 [ utoa_append::buffer#0 ] +Uplifting [printf_ln] best 23673 combination zp[2]:42 [ printf_ln::$0 ] zp[2]:44 [ printf_ln::$1 ] +Uplifting [printf_char] best 23637 combination zp[2]:46 [ printf_char::$6 ] reg byte a [ printf_char::ch#3 printf_char::ch#2 printf_char::ch#1 ] +Uplifting [printf_str] best 23517 combination zp[2]:2 [ printf_str::str#4 printf_str::str#6 printf_str::str#0 ] reg byte a [ printf_str::ch#0 ] +Uplifting [] best 23517 combination zp[2]:35 [ printf_cursor_ptr ] zp[1]:34 [ printf_cursor_y ] zp[1]:33 [ printf_cursor_x ] mem[12] [ printf_buffer ] +Uplifting [utoa] best 23383 combination zp[2]:22 [ utoa::buffer#11 utoa::buffer#14 utoa::buffer#4 ] zp[2]:19 [ utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 ] zp[1]:18 [ utoa::digit#2 utoa::digit#1 ] reg byte a [ utoa::$10 ] reg byte x [ utoa::started#2 utoa::started#4 ] zp[2]:55 [ utoa::digit_value#0 ] reg byte a [ utoa::$11 ] zp[2]:52 [ utoa::buffer#3 ] +Uplifting [atoi] best 23170 combination reg byte y [ atoi::i#4 atoi::i#2 ] zp[2]:31 [ atoi::return#2 atoi::return#0 atoi::res#2 atoi::res#1 ] zp[2]:63 [ atoi::$8 ] zp[2]:65 [ atoi::$9 ] zp[2]:67 [ atoi::$3 ] zp[2]:69 [ atoi::$4 ] reg byte x [ atoi::negative#2 ] zp[2]:27 [ atoi::str#2 ] zp[2]:37 [ atoi::return#3 ] zp[2]:39 [ atoi::return#4 ] +Uplifting [printf_number_buffer] best 23161 combination reg byte a [ printf_number_buffer::buffer_sign#0 ] +Uplifting [printf_sint] best 23161 combination zp[2]:16 [ printf_sint::value#5 printf_sint::value#0 printf_sint::value#3 printf_sint::value#1 printf_sint::value#2 ] +Uplifting [RADIX] best 23161 combination +Uplifting [printf_format_number] best 23161 combination +Uplifting [printf_buffer_number] best 23161 combination +Uplifting [printf_format_string] best 23161 combination +Uplifting [printf_cls] best 23161 combination +Uplifting [main] best 23161 combination Attempting to uplift remaining variables inzp[1]:34 [ printf_cursor_y ] -Uplifting [] best 23181 combination zp[1]:34 [ printf_cursor_y ] +Uplifting [] best 23161 combination zp[1]:34 [ printf_cursor_y ] Attempting to uplift remaining variables inzp[1]:33 [ printf_cursor_x ] -Uplifting [] best 23181 combination zp[1]:33 [ printf_cursor_x ] +Uplifting [] best 23161 combination zp[1]:33 [ printf_cursor_x ] Attempting to uplift remaining variables inzp[1]:18 [ utoa::digit#2 utoa::digit#1 ] -Uplifting [utoa] best 23181 combination zp[1]:18 [ utoa::digit#2 utoa::digit#1 ] +Uplifting [utoa] best 23161 combination zp[1]:18 [ utoa::digit#2 utoa::digit#1 ] Coalescing zero page register [ zp[2]:35 [ printf_cursor_ptr ] ] with [ zp[2]:46 [ printf_char::$6 ] ] - score: 2 Coalescing zero page register [ zp[2]:5 [ memset::num#2 ] ] with [ zp[2]:48 [ memset::end#0 ] ] - score: 1 Coalescing zero page register [ zp[2]:7 [ memset::str#3 ] ] with [ zp[2]:10 [ memset::dst#2 memset::dst#4 memset::dst#1 ] ] - score: 1 @@ -4572,53 +4572,13 @@ Coalescing zero page register [ zp[2]:35 [ printf_cursor_ptr printf_char::$6 pri Coalescing zero page register [ zp[2]:55 [ utoa::digit_value#0 ] ] with [ zp[2]:59 [ utoa_append::sub#0 ] ] - score: 1 Coalescing zero page register [ zp[2]:16 [ printf_sint::value#5 printf_sint::value#0 printf_sint::value#3 printf_sint::value#1 printf_sint::value#2 utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 atoi::return#3 atoi::return#4 ] ] with [ zp[2]:24 [ utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 utoa_append::return#0 ] ] - score: 2 Coalescing zero page register [ zp[2]:16 [ printf_sint::value#5 printf_sint::value#0 printf_sint::value#3 printf_sint::value#1 printf_sint::value#2 utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 atoi::return#3 atoi::return#4 utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 utoa_append::return#0 ] ] with [ zp[2]:31 [ atoi::return#2 atoi::return#0 atoi::res#2 atoi::res#1 atoi::$9 atoi::$4 ] ] - score: 2 -Warning! Unknown fragment for statement [131] (signed word~) atoi::$4 ← (signed word~) atoi::$3 + *((to_nomodify byte*) atoi::str#2 + (byte) atoi::i#4) -Missing ASM fragment Fragment not found vwsz1=vwsz1_plus_pbuz2_derefidx_vbuyy. Attempted variations vwsz1=vwsz1_plus_pbuz2_derefidx_vbuyy -File /Users/jespergravgaard/c64/kickc/src/main/kc/lib/stdlib.c -Line 264 -res * 10 + str[i] Coalescing zero page register [ zp[2]:16 [ printf_sint::value#5 printf_sint::value#0 printf_sint::value#3 printf_sint::value#1 printf_sint::value#2 utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 atoi::return#3 atoi::return#4 utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 utoa_append::return#0 atoi::return#2 atoi::return#0 atoi::res#2 atoi::res#1 atoi::$9 atoi::$4 ] ] with [ zp[2]:67 [ atoi::$3 ] ] - score: 2 -Warning! Unknown fragment for statement [131] (signed word~) atoi::$4 ← (signed word~) atoi::$3 + *((to_nomodify byte*) atoi::str#2 + (byte) atoi::i#4) -Missing ASM fragment Fragment not found vwsz1=vwsz1_plus_pbuz2_derefidx_vbuyy. Attempted variations vwsz1=vwsz1_plus_pbuz2_derefidx_vbuyy -File /Users/jespergravgaard/c64/kickc/src/main/kc/lib/stdlib.c -Line 264 -res * 10 + str[i] Coalescing zero page register [ zp[2]:12 [ memcpy::src#2 memcpy::src#1 ] ] with [ zp[2]:5 [ memset::num#2 memset::end#0 ] ] -Warning! Unknown fragment for statement [131] (signed word~) atoi::$4 ← (signed word~) atoi::$3 + *((to_nomodify byte*) atoi::str#2 + (byte) atoi::i#4) -Missing ASM fragment Fragment not found vwsz1=vwsz1_plus_pbuz2_derefidx_vbuyy. Attempted variations vwsz1=vwsz1_plus_pbuz2_derefidx_vbuyy -File /Users/jespergravgaard/c64/kickc/src/main/kc/lib/stdlib.c -Line 264 -res * 10 + str[i] Coalescing zero page register [ zp[2]:14 [ memcpy::dst#2 memcpy::dst#1 ] ] with [ zp[2]:7 [ memset::str#3 memset::dst#2 memset::dst#4 memset::dst#1 ] ] -Warning! Unknown fragment for statement [131] (signed word~) atoi::$4 ← (signed word~) atoi::$3 + *((to_nomodify byte*) atoi::str#2 + (byte) atoi::i#4) -Missing ASM fragment Fragment not found vwsz1=vwsz1_plus_pbuz2_derefidx_vbuyy. Attempted variations vwsz1=vwsz1_plus_pbuz2_derefidx_vbuyy -File /Users/jespergravgaard/c64/kickc/src/main/kc/lib/stdlib.c -Line 264 -res * 10 + str[i] Coalescing zero page register [ zp[2]:16 [ printf_sint::value#5 printf_sint::value#0 printf_sint::value#3 printf_sint::value#1 printf_sint::value#2 utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 atoi::return#3 atoi::return#4 utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 utoa_append::return#0 atoi::return#2 atoi::return#0 atoi::res#2 atoi::res#1 atoi::$9 atoi::$4 atoi::$3 ] ] with [ zp[2]:2 [ printf_str::str#4 printf_str::str#6 printf_str::str#0 ] ] -Warning! Unknown fragment for statement [131] (signed word~) atoi::$4 ← (signed word~) atoi::$3 + *((to_nomodify byte*) atoi::str#2 + (byte) atoi::i#4) -Missing ASM fragment Fragment not found vwsz1=vwsz1_plus_pbuz2_derefidx_vbuyy. Attempted variations vwsz1=vwsz1_plus_pbuz2_derefidx_vbuyy -File /Users/jespergravgaard/c64/kickc/src/main/kc/lib/stdlib.c -Line 264 -res * 10 + str[i] Coalescing zero page register [ zp[2]:27 [ atoi::str#2 ] ] with [ zp[2]:22 [ utoa::buffer#11 utoa::buffer#14 utoa::buffer#4 utoa::buffer#3 utoa_append::buffer#0 ] ] -Warning! Unknown fragment for statement [131] (signed word~) atoi::$4 ← (signed word~) atoi::$3 + *((to_nomodify byte*) atoi::str#2 + (byte) atoi::i#4) -Missing ASM fragment Fragment not found vwsz1=vwsz1_plus_pbuz2_derefidx_vbuyy. Attempted variations vwsz1=vwsz1_plus_pbuz2_derefidx_vbuyy -File /Users/jespergravgaard/c64/kickc/src/main/kc/lib/stdlib.c -Line 264 -res * 10 + str[i] Coalescing zero page register [ zp[2]:63 [ atoi::$8 ] ] with [ zp[2]:55 [ utoa::digit_value#0 utoa_append::sub#0 ] ] -Warning! Unknown fragment for statement [131] (signed word~) atoi::$4 ← (signed word~) atoi::$3 + *((to_nomodify byte*) atoi::str#2 + (byte) atoi::i#4) -Missing ASM fragment Fragment not found vwsz1=vwsz1_plus_pbuz2_derefidx_vbuyy. Attempted variations vwsz1=vwsz1_plus_pbuz2_derefidx_vbuyy -File /Users/jespergravgaard/c64/kickc/src/main/kc/lib/stdlib.c -Line 264 -res * 10 + str[i] Coalescing zero page register [ zp[2]:27 [ atoi::str#2 utoa::buffer#11 utoa::buffer#14 utoa::buffer#4 utoa::buffer#3 utoa_append::buffer#0 ] ] with [ zp[2]:12 [ memcpy::src#2 memcpy::src#1 memset::num#2 memset::end#0 ] ] -Warning! Unknown fragment for statement [131] (signed word~) atoi::$4 ← (signed word~) atoi::$3 + *((to_nomodify byte*) atoi::str#2 + (byte) atoi::i#4) -Missing ASM fragment Fragment not found vwsz1=vwsz1_plus_pbuz2_derefidx_vbuyy. Attempted variations vwsz1=vwsz1_plus_pbuz2_derefidx_vbuyy -File /Users/jespergravgaard/c64/kickc/src/main/kc/lib/stdlib.c -Line 264 -res * 10 + str[i] Coalescing zero page register [ zp[2]:63 [ atoi::$8 utoa::digit_value#0 utoa_append::sub#0 ] ] with [ zp[2]:14 [ memcpy::dst#2 memcpy::dst#1 memset::str#3 memset::dst#2 memset::dst#4 memset::dst#1 ] ] Allocated (was zp[2]:16) zp[2]:2 [ printf_sint::value#5 printf_sint::value#0 printf_sint::value#3 printf_sint::value#1 printf_sint::value#2 utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 atoi::return#3 atoi::return#4 utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 utoa_append::return#0 atoi::return#2 atoi::return#0 atoi::res#2 atoi::res#1 atoi::$9 atoi::$4 atoi::$3 printf_str::str#4 printf_str::str#6 printf_str::str#0 ] Allocated (was zp[1]:18) zp[1]:4 [ utoa::digit#2 utoa::digit#1 ] @@ -4627,11 +4587,6 @@ Allocated (was zp[1]:33) zp[1]:7 [ printf_cursor_x ] Allocated (was zp[1]:34) zp[1]:8 [ printf_cursor_y ] Allocated (was zp[2]:35) zp[2]:9 [ printf_cursor_ptr printf_char::$6 printf_ln::$0 printf_ln::$1 ] Allocated (was zp[2]:63) zp[2]:11 [ atoi::$8 utoa::digit_value#0 utoa_append::sub#0 memcpy::dst#2 memcpy::dst#1 memset::str#3 memset::dst#2 memset::dst#4 memset::dst#1 ] -Warning! Unknown fragment for statement [131] (signed word~) atoi::$4 ← (signed word~) atoi::$3 + *((to_nomodify byte*) atoi::str#2 + (byte) atoi::i#4) -Missing ASM fragment Fragment not found vwsz1=vwsz1_plus_pbuz2_derefidx_vbuyy. Attempted variations vwsz1=vwsz1_plus_pbuz2_derefidx_vbuyy -File /Users/jespergravgaard/c64/kickc/src/main/kc/lib/stdlib.c -Line 264 -res * 10 + str[i] ASSEMBLER BEFORE OPTIMIZATION // File Comments @@ -5448,8 +5403,14 @@ atoi: { // [130] (signed word~) atoi::$3 ← (signed word~) atoi::$9 << (byte) 1 -- vwsz1=vwsz1_rol_1 asl.z __3 rol.z __3+1 - // [131] (signed word~) atoi::$4 ← (signed word~) atoi::$3 + *((to_nomodify byte*) atoi::str#2 + (byte) atoi::i#4) - .assert "Missing ASM fragment Fragment not found vwsz1=vwsz1_plus_pbuz2_derefidx_vbuyy. Attempted variations vwsz1=vwsz1_plus_pbuz2_derefidx_vbuyy ", 0, 1 + // [131] (signed word~) atoi::$4 ← (signed word~) atoi::$3 + *((to_nomodify byte*) atoi::str#2 + (byte) atoi::i#4) -- vwsz1=vwsz1_plus_pbuz2_derefidx_vbuyy + clc + lda.z __4 + adc (str),y + sta.z __4 + bcc !+ + inc.z __4+1 + !: // [132] (signed word) atoi::res#1 ← (signed word~) atoi::$4 - (byte) '0' -- vwsz1=vwsz1_minus_vbuc1 sec lda.z res @@ -5925,7 +5886,7 @@ mem[12] [ printf_buffer ] FINAL ASSEMBLER -Score: 19613 +Score: 19823 // File Comments // Test atoi() @@ -6693,8 +6654,14 @@ atoi: { asl.z __3 rol.z __3+1 // res * 10 + str[i] - // [131] (signed word~) atoi::$4 ← (signed word~) atoi::$3 + *((to_nomodify byte*) atoi::str#2 + (byte) atoi::i#4) - .assert "Missing ASM fragment Fragment not found vwsz1=vwsz1_plus_pbuz2_derefidx_vbuyy. Attempted variations vwsz1=vwsz1_plus_pbuz2_derefidx_vbuyy ", 0, 1 + // [131] (signed word~) atoi::$4 ← (signed word~) atoi::$3 + *((to_nomodify byte*) atoi::str#2 + (byte) atoi::i#4) -- vwsz1=vwsz1_plus_pbuz2_derefidx_vbuyy + clc + lda.z __4 + adc (str),y + sta.z __4 + bcc !+ + inc.z __4+1 + !: // res = res * 10 + str[i] - '0' // [132] (signed word) atoi::res#1 ← (signed word~) atoi::$4 - (byte) '0' -- vwsz1=vwsz1_minus_vbuc1 sec