From c1e7d37ac74520af0bca1a2c83f75d35721f936f Mon Sep 17 00:00:00 2001 From: jespergravgaard Date: Mon, 27 Sep 2021 23:37:44 +0200 Subject: [PATCH] Updated too kickasm 5.22. Fixed tests. --- .../cache/fragment-cache-mos6502x.asm | 46 + .../cpufamily6502/CpuAddressingMode.java | 10 +- src/test/ref/cbm-keyboard.asm | 245 +- src/test/ref/cbm-keyboard.cfg | 460 ++- src/test/ref/cbm-keyboard.log | 3534 ++++++++--------- src/test/ref/cbm-keyboard.sym | 116 +- src/test/ref/cpu-45gs02-addressing-modes.asm | 8 +- src/test/ref/cpu-45gs02-addressing-modes.log | 16 +- src/test/ref/cpu-65c02-addressing-modes.asm | 2 +- src/test/ref/cpu-65c02-addressing-modes.log | 6 +- src/test/ref/cpu-65ce02-addressing-modes.asm | 4 +- src/test/ref/cpu-65ce02-addressing-modes.log | 8 +- .../mega65/32bit-addressing-mega65.asm | 4 +- .../mega65/32bit-addressing-mega65.log | 8 +- .../ref/examples/mega65/helloworld-mega65.asm | 4 +- .../ref/examples/mega65/helloworld-mega65.log | 8 +- 16 files changed, 2116 insertions(+), 2363 deletions(-) diff --git a/src/main/fragment/cache/fragment-cache-mos6502x.asm b/src/main/fragment/cache/fragment-cache-mos6502x.asm index 58cd2797f..5e006d677 100644 --- a/src/main/fragment/cache/fragment-cache-mos6502x.asm +++ b/src/main/fragment/cache/fragment-cache-mos6502x.asm @@ -16511,3 +16511,49 @@ sta {c1},x lda #{c2} ora {c1},y sta {c1},y +//FRAGMENT call__deref_(qprc1_derefidx_vbuz1) +ldy {z1} +lda {c1},y +sta !+ +1 +lda {c1}+1,y +sta !+ +2 +!: +jsr $0000 +//FRAGMENT call__deref_(qprc1_derefidx_vbuaa) +tay +lda {c1},y +sta !+ +1 +lda {c1}+1,y +sta !+ +2 +!: +jsr $0000 +//FRAGMENT call__deref_(qprc1_derefidx_vbuxx) +txa +tay +lda {c1},y +sta !+ +1 +lda {c1}+1,y +sta !+ +2 +!: +jsr $0000 +//FRAGMENT call__deref_(qprc1_derefidx_vbuyy) +lda {c1},y +sta !+ +1 +lda {c1}+1,y +sta !+ +2 +!: +jsr $0000 +//FRAGMENT vbsaa=vbsc1_minus_vbsz1 +lda #{c1} +sec +sbc {z1} +//FRAGMENT vbsxx=vbsc1_minus_vbsz1 +lda #{c1} +sec +sbc {z1} +tax +//FRAGMENT vbsyy=vbsc1_minus_vbsz1 +lda #{c1} +sec +sbc {z1} +tay diff --git a/src/main/java/dk/camelot64/cpufamily6502/CpuAddressingMode.java b/src/main/java/dk/camelot64/cpufamily6502/CpuAddressingMode.java index f602f8dc0..befa6f19b 100644 --- a/src/main/java/dk/camelot64/cpufamily6502/CpuAddressingMode.java +++ b/src/main/java/dk/camelot64/cpufamily6502/CpuAddressingMode.java @@ -115,7 +115,7 @@ public enum CpuAddressingMode { * address. The carry from this addition is added to the contents of the next page zero memory location, the result * being the high order eight bits of the effective address." */ - IZZ("(zp),z", "%i.z (%p),z", 1), + IZZ("(zp),z", "%i (%p),z", 1), /** * (abs) Indirect Absolute
@@ -132,7 +132,7 @@ public enum CpuAddressingMode { * ZEROPAGE INDIRECT * The second byte of the instruction contains address of a zeropage memory location. */ - INZ("(zp)", "%i.z (%p)", 1), + INZ("(zp)", "%i (%p)", 1), /** * ((zp)) 32-bit Indirect Zeropage
@@ -140,7 +140,7 @@ public enum CpuAddressingMode { * In indirect addressing the second byte of the instruction points to a memory location in page zero. This mode is * formed by preceding a Base Page Indirect Mode instruction with NEG NEG NOP instructions. */ - LIN("((zp))", "%i.z ((%p))", 1), + LIN("((zp))", "%i ((%p))", 1), /** * ((zp)),z 32-bit Indirect Zeropage Z
@@ -148,7 +148,7 @@ public enum CpuAddressingMode { * In indirect indexed addressing the second byte of the instruction points to a memory location in page zero. This * mode is formed by preceding a Base Page Indirect Z-Indexed Mode instruction with the NOP instruction (opcode $EA). */ - LIZ("((zp)),z", "%i.z ((%p)),z", 1), + LIZ("((zp)),z", "%i ((%p)),z", 1), /** * (zp,sp),y Stack Pointer Indirect Indexed
@@ -159,7 +159,7 @@ public enum CpuAddressingMode { * addition is added to the contents of the next (D -1) stack location the result being the high order eight bits of * the effective address." STA ($12,SP),Y */ - ISY("(zp,sp),y", "%i.z (%p,sp),y", 1), + ISY("(zp,sp),y", "%i (%p,sp),y", 1), /** * Relative
diff --git a/src/test/ref/cbm-keyboard.asm b/src/test/ref/cbm-keyboard.asm index 40af46b70..8d289a739 100644 --- a/src/test/ref/cbm-keyboard.asm +++ b/src/test/ref/cbm-keyboard.asm @@ -19,12 +19,22 @@ .label DEFAULT_SCREEN = $400 /// Default address of the chargen font (mixed case) .label DEFAULT_FONT_MIXED = $1800 + // The number of bytes on the screen + // The current cursor x-position + .label conio_cursor_x = $13 + // The current cursor y-position + .label conio_cursor_y = 9 // The current text cursor line start - .label conio_line_text = $e + .label conio_line_text = $c // The current color cursor line start - .label conio_line_color = $c + .label conio_line_color = $a .segment Code __start: { + // __ma char conio_cursor_x = 0 + lda #0 + sta.z conio_cursor_x + // __ma char conio_cursor_y = 0 + sta.z conio_cursor_y // __ma char *conio_line_text = CONIO_SCREEN_TEXT lda #(DEFAULT_SCREEN&$3fff)*4)|(>DEFAULT_FONT_MIXED)/4&$f + .label __6 = $14 + .label ch = $17 + .label current = $16 // VICII->MEMORY = toD018(DEFAULT_SCREEN, DEFAULT_FONT_MIXED) lda #toD0181_return sta VICII+OFFSET_STRUCT_MOS6569_VICII_MEMORY // clrscr() jsr clrscr lda #0 - sta current + sta.z current __b1: // char ch = GETIN() jsr GETIN - sta ch + sta.z ch // if(ch && ch!=current) beq __b1 - cmp current + cmp.z current bne __b2 jmp __b1 __b2: // petscii_to_screencode(ch) - lda ch + lda.z ch jsr petscii_to_screencode - sta __6 + sta.z __6 // printf("'%c'($%2x) ", petscii_to_screencode(ch), ch) lda #s2 sta.z printf_str.s+1 jsr printf_str - lda ch - sta current + lda.z ch + sta.z current jmp __b1 .segment Data s: .text "'" @@ -158,58 +171,60 @@ main: { .byte 0 s2: .text ") " .byte 0 - __6: .byte 0 - ch: .byte 0 - current: .byte 0 } .segment Code // Set the cursor to the specified position // void gotoxy(char x, __register(X) char y) gotoxy: { - .label __5 = 8 - .label __6 = $a + .const x = 0 + .label __5 = $1c + .label __6 = $18 + .label __7 = $18 + .label line_offset = $18 + .label __8 = $1a + .label __9 = $18 // if(y>CONIO_HEIGHT) cpx #$19+1 bcc __b2 ldx #0 __b2: // conio_cursor_x = x - lda #0 - sta conio_cursor_x + lda #x + sta.z conio_cursor_x // conio_cursor_y = y - stx conio_cursor_y + stx.z conio_cursor_y // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH txa - sta __7 + sta.z __7 lda #0 - sta __7+1 - lda __7 + sta.z __7+1 + lda.z __7 asl - sta __8 - lda __7+1 + sta.z __8 + lda.z __7+1 rol - sta __8+1 - asl __8 - rol __8+1 + sta.z __8+1 + asl.z __8 + rol.z __8+1 clc - lda __9 - adc __8 - sta __9 - lda __9+1 - adc __8+1 - sta __9+1 - asl line_offset - rol line_offset+1 - asl line_offset - rol line_offset+1 - asl line_offset - rol line_offset+1 + lda.z __9 + adc.z __8 + sta.z __9 + lda.z __9+1 + adc.z __8+1 + sta.z __9+1 + asl.z line_offset + rol.z line_offset+1 + asl.z line_offset + rol.z line_offset+1 + asl.z line_offset + rol.z line_offset+1 // CONIO_SCREEN_TEXT + line_offset - lda line_offset + lda.z line_offset clc adc #DEFAULT_SCREEN sta.z __5+1 // conio_line_text = CONIO_SCREEN_TEXT + line_offset @@ -218,11 +233,11 @@ gotoxy: { lda.z __5+1 sta.z conio_line_text+1 // CONIO_SCREEN_COLORS + line_offset - lda line_offset + lda.z __6 clc adc #COLORRAM sta.z __6+1 // conio_line_color = CONIO_SCREEN_COLORS + line_offset @@ -232,13 +247,7 @@ gotoxy: { sta.z conio_line_color+1 // } rts - .segment Data - __7: .word 0 - .label line_offset = __7 - __8: .word 0 - .label __9 = __7 } -.segment Code // Print a newline cputln: { // conio_line_text += CONIO_WIDTH @@ -259,9 +268,9 @@ cputln: { !: // conio_cursor_x = 0 lda #0 - sta conio_cursor_x + sta.z conio_cursor_x // conio_cursor_y++; - inc conio_cursor_y + inc.z conio_cursor_y // cscroll() jsr cscroll // } @@ -270,7 +279,7 @@ cputln: { // clears the screen and moves the cursor to the upper left-hand corner of the screen. clrscr: { .label line_text = $10 - .label line_cols = $12 + .label line_cols = $e lda #COLORRAM @@ -286,9 +295,9 @@ clrscr: { bcc __b2 // conio_cursor_x = 0 lda #0 - sta conio_cursor_x + sta.z conio_cursor_x // conio_cursor_y = 0 - sta conio_cursor_y + sta.z conio_cursor_y // conio_line_text = CONIO_SCREEN_TEXT lda #COLORRAM+$19*$28-$28 @@ -512,7 +511,9 @@ cscroll: { sbc #0 sta.z conio_line_color+1 // conio_cursor_y--; - dec conio_cursor_y + dec.z conio_cursor_y + __breturn: + // } rts } // Converts unsigned number value to a string representing it in RADIX format. @@ -523,17 +524,20 @@ cscroll: { // void uctoa(__register(X) char value, __zp($10) char *buffer, char radix) uctoa: { .const max_digits = 2 + .label digit_value = 8 .label buffer = $10 + .label digit = $12 + .label started = $14 lda #printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS sta.z buffer+1 lda #0 - sta started - sta digit + sta.z started + sta.z digit __b1: // for( char digit=0; digit= digit_value) - lda started + lda.z started bne __b5 - cpx digit_value + cpx.z digit_value bcs __b5 __b4: // for( char digit=0; digit= sub) - cpx sub + cpx.z sub bcs __b2 // *buffer = DIGITS[digit] lda DIGITS,y @@ -752,20 +750,19 @@ uctoa_append: { // value -= sub txa sec - sbc sub + sbc.z sub tax jmp __b1 - .segment Data - .label sub = uctoa.digit_value } -.segment Code // Computes the length of the string str up to but not including the terminating null character. -// __mem() unsigned int strlen(__zp($10) char *str) +// __zp($e) unsigned int strlen(__zp($10) char *str) strlen: { + .label len = $e .label str = $10 + .label return = $e lda #<0 - sta len - sta len+1 + sta.z len + sta.z len+1 lda #printf_number_buffer.buffer_digits @@ -780,9 +777,9 @@ strlen: { rts __b2: // len++; - inc len + inc.z len bne !+ - inc len+1 + inc.z len+1 !: // str++; inc.z str @@ -790,21 +787,19 @@ strlen: { inc.z str+1 !: jmp __b1 - .segment Data - len: .word 0 - .label return = len } -.segment Code // Print a padding char a number of times -// void printf_padding(void (*putc)(char), char pad, __mem() char length) +// void printf_padding(void (*putc)(char), char pad, __zp($15) char length) printf_padding: { .const pad = ' ' + .label i = $12 + .label length = $15 lda #0 - sta i + sta.z i __b1: // for(char i=0;i=uctoa::digit_value#0) goto uctoa::@5 + [141] if(uctoa::value#2>=uctoa::digit_value#0) goto uctoa::@5 to:uctoa::@4 uctoa::@4: scope:[uctoa] from uctoa::@6 uctoa::@7 - [144] uctoa::buffer#14 = phi( uctoa::@7/uctoa::buffer#11, uctoa::@6/uctoa::buffer#4 ) - [144] uctoa::started#4 = phi( uctoa::@7/uctoa::started#2, uctoa::@6/1 ) - [144] uctoa::value#6 = phi( uctoa::@7/uctoa::value#2, uctoa::@6/uctoa::value#0 ) - [145] uctoa::digit#1 = ++ uctoa::digit#2 + [142] uctoa::buffer#14 = phi( uctoa::@7/uctoa::buffer#11, uctoa::@6/uctoa::buffer#4 ) + [142] uctoa::started#4 = phi( uctoa::@7/uctoa::started#2, uctoa::@6/1 ) + [142] uctoa::value#6 = phi( uctoa::@7/uctoa::value#2, uctoa::@6/uctoa::value#0 ) + [143] uctoa::digit#1 = ++ uctoa::digit#2 to:uctoa::@1 uctoa::@5: scope:[uctoa] from uctoa::@2 uctoa::@7 - [146] uctoa_append::buffer#0 = uctoa::buffer#11 - [147] uctoa_append::value#0 = uctoa::value#2 - [148] uctoa_append::sub#0 = uctoa::digit_value#0 - [149] call uctoa_append - [150] uctoa_append::return#0 = uctoa_append::value#2 + [144] uctoa_append::buffer#0 = uctoa::buffer#11 + [145] uctoa_append::value#0 = uctoa::value#2 + [146] uctoa_append::sub#0 = uctoa::digit_value#0 + [147] call uctoa_append + [148] uctoa_append::return#0 = uctoa_append::value#2 to:uctoa::@6 uctoa::@6: scope:[uctoa] from uctoa::@5 - [151] uctoa::value#0 = uctoa_append::return#0 - [152] uctoa::buffer#4 = ++ uctoa::buffer#11 + [149] uctoa::value#0 = uctoa_append::return#0 + [150] uctoa::buffer#4 = ++ uctoa::buffer#11 to:uctoa::@4 void printf_number_buffer(void (*putc)(char) , char buffer_sign , char *buffer_digits , char format_min_length , char format_justify_left , char format_sign_always , char format_zero_padding , char format_upper_case , char format_radix) printf_number_buffer: scope:[printf_number_buffer] from printf_uchar::@2 - [153] phi() + [151] phi() to:printf_number_buffer::@4 printf_number_buffer::@4: scope:[printf_number_buffer] from printf_number_buffer - [154] phi() - [155] call strlen - [156] strlen::return#2 = strlen::len#2 + [152] phi() + [153] call strlen + [154] strlen::return#2 = strlen::len#2 to:printf_number_buffer::@9 printf_number_buffer::@9: scope:[printf_number_buffer] from printf_number_buffer::@4 - [157] printf_number_buffer::$19 = strlen::return#2 - [158] printf_number_buffer::len#0 = (signed char)printf_number_buffer::$19 - [159] if(0==printf_number_buffer::buffer_sign#0) goto printf_number_buffer::@8 + [155] printf_number_buffer::$19 = strlen::return#2 + [156] printf_number_buffer::len#0 = (signed char)printf_number_buffer::$19 + [157] if(0==printf_number_buffer::buffer_sign#0) goto printf_number_buffer::@8 to:printf_number_buffer::@5 printf_number_buffer::@5: scope:[printf_number_buffer] from printf_number_buffer::@9 - [160] printf_number_buffer::len#1 = ++ printf_number_buffer::len#0 + [158] printf_number_buffer::len#1 = ++ printf_number_buffer::len#0 to:printf_number_buffer::@8 printf_number_buffer::@8: scope:[printf_number_buffer] from printf_number_buffer::@5 printf_number_buffer::@9 - [161] printf_number_buffer::len#2 = phi( printf_number_buffer::@9/printf_number_buffer::len#0, printf_number_buffer::@5/printf_number_buffer::len#1 ) - [162] printf_number_buffer::padding#1 = (signed char)printf_uchar::format_min_length#0 - printf_number_buffer::len#2 - [163] if(printf_number_buffer::padding#1>=0) goto printf_number_buffer::@11 + [159] printf_number_buffer::len#2 = phi( printf_number_buffer::@9/printf_number_buffer::len#0, printf_number_buffer::@5/printf_number_buffer::len#1 ) + [160] printf_number_buffer::padding#1 = (signed char)printf_uchar::format_min_length#0 - printf_number_buffer::len#2 + [161] if(printf_number_buffer::padding#1>=0) goto printf_number_buffer::@11 to:printf_number_buffer::@1 printf_number_buffer::@11: scope:[printf_number_buffer] from printf_number_buffer::@8 - [164] phi() + [162] phi() to:printf_number_buffer::@1 printf_number_buffer::@1: scope:[printf_number_buffer] from printf_number_buffer::@11 printf_number_buffer::@8 - [165] printf_number_buffer::padding#10 = phi( printf_number_buffer::@11/printf_number_buffer::padding#1, printf_number_buffer::@8/0 ) + [163] printf_number_buffer::padding#10 = phi( printf_number_buffer::@11/printf_number_buffer::padding#1, printf_number_buffer::@8/0 ) to:printf_number_buffer::@10 printf_number_buffer::@10: scope:[printf_number_buffer] from printf_number_buffer::@1 - [166] if(0!=printf_number_buffer::padding#10) goto printf_number_buffer::@6 + [164] if(0!=printf_number_buffer::padding#10) goto printf_number_buffer::@6 to:printf_number_buffer::@2 printf_number_buffer::@6: scope:[printf_number_buffer] from printf_number_buffer::@10 - [167] printf_padding::length#0 = (char)printf_number_buffer::padding#10 - [168] call printf_padding + [165] printf_padding::length#0 = (char)printf_number_buffer::padding#10 + [166] call printf_padding to:printf_number_buffer::@2 printf_number_buffer::@2: scope:[printf_number_buffer] from printf_number_buffer::@10 printf_number_buffer::@6 - [169] if(0==printf_number_buffer::buffer_sign#0) goto printf_number_buffer::@3 + [167] if(0==printf_number_buffer::buffer_sign#0) goto printf_number_buffer::@3 to:printf_number_buffer::@7 printf_number_buffer::@7: scope:[printf_number_buffer] from printf_number_buffer::@2 - [170] stackpush(char) = printf_number_buffer::buffer_sign#0 - [171] callexecute cputc + [168] stackpush(char) = printf_number_buffer::buffer_sign#0 + [169] callexecute cputc sideeffect stackpullbytes(1) to:printf_number_buffer::@3 printf_number_buffer::@3: scope:[printf_number_buffer] from printf_number_buffer::@2 printf_number_buffer::@7 - [173] phi() - [174] call printf_str + [171] phi() + [172] call printf_str to:printf_number_buffer::@return printf_number_buffer::@return: scope:[printf_number_buffer] from printf_number_buffer::@3 - [175] return + [173] return to:@return void * memcpy(void *destination , void *source , unsigned int num) -memcpy: scope:[memcpy] from cscroll::@3 cscroll::@4 - [176] memcpy::destination#2 = phi( cscroll::@3/(void *)DEFAULT_SCREEN, cscroll::@4/(void *)COLORRAM ) - [176] memcpy::source#2 = phi( cscroll::@3/(void *)DEFAULT_SCREEN+$28, cscroll::@4/(void *)COLORRAM+$28 ) - [177] memcpy::src_end#0 = (char *)memcpy::source#2 + (unsigned int)$19*$28-$28 - [178] memcpy::src#4 = (char *)memcpy::source#2 - [179] memcpy::dst#4 = (char *)memcpy::destination#2 +memcpy: scope:[memcpy] from cscroll::@1 cscroll::@2 + [174] memcpy::destination#2 = phi( cscroll::@1/(void *)DEFAULT_SCREEN, cscroll::@2/(void *)COLORRAM ) + [174] memcpy::source#2 = phi( cscroll::@1/(void *)DEFAULT_SCREEN+$28, cscroll::@2/(void *)COLORRAM+$28 ) + [175] memcpy::src_end#0 = (char *)memcpy::source#2 + (unsigned int)$19*$28-$28 + [176] memcpy::src#4 = (char *)memcpy::source#2 + [177] memcpy::dst#4 = (char *)memcpy::destination#2 to:memcpy::@1 memcpy::@1: scope:[memcpy] from memcpy memcpy::@2 - [180] memcpy::dst#2 = phi( memcpy/memcpy::dst#4, memcpy::@2/memcpy::dst#1 ) - [180] memcpy::src#2 = phi( memcpy/memcpy::src#4, memcpy::@2/memcpy::src#1 ) - [181] if(memcpy::src#2!=memcpy::src_end#0) goto memcpy::@2 + [178] memcpy::dst#2 = phi( memcpy/memcpy::dst#4, memcpy::@2/memcpy::dst#1 ) + [178] memcpy::src#2 = phi( memcpy/memcpy::src#4, memcpy::@2/memcpy::src#1 ) + [179] if(memcpy::src#2!=memcpy::src_end#0) goto memcpy::@2 to:memcpy::@return memcpy::@return: scope:[memcpy] from memcpy::@1 - [182] return + [180] return to:@return memcpy::@2: scope:[memcpy] from memcpy::@1 - [183] *memcpy::dst#2 = *memcpy::src#2 - [184] memcpy::dst#1 = ++ memcpy::dst#2 - [185] memcpy::src#1 = ++ memcpy::src#2 + [181] *memcpy::dst#2 = *memcpy::src#2 + [182] memcpy::dst#1 = ++ memcpy::dst#2 + [183] memcpy::src#1 = ++ memcpy::src#2 to:memcpy::@1 void * memset(void *str , char c , unsigned int num) -memset: scope:[memset] from cscroll::@5 cscroll::@6 - [186] memset::c#4 = phi( cscroll::@5/' ', cscroll::@6/memset::c#1 ) - [186] memset::str#3 = phi( cscroll::@5/(void *)DEFAULT_SCREEN+(unsigned int)$19*$28-$28, cscroll::@6/(void *)COLORRAM+(unsigned int)$19*$28-$28 ) +memset: scope:[memset] from cscroll::@3 cscroll::@4 + [184] memset::c#4 = phi( cscroll::@3/' ', cscroll::@4/LIGHT_BLUE ) + [184] memset::str#3 = phi( cscroll::@3/(void *)DEFAULT_SCREEN+(unsigned int)$19*$28-$28, cscroll::@4/(void *)COLORRAM+(unsigned int)$19*$28-$28 ) to:memset::@1 memset::@1: scope:[memset] from memset - [187] memset::end#0 = (char *)memset::str#3 + $28 - [188] memset::dst#4 = (char *)memset::str#3 + [185] memset::end#0 = (char *)memset::str#3 + $28 + [186] memset::dst#4 = (char *)memset::str#3 to:memset::@2 memset::@2: scope:[memset] from memset::@1 memset::@3 - [189] memset::dst#2 = phi( memset::@1/memset::dst#4, memset::@3/memset::dst#1 ) - [190] if(memset::dst#2!=memset::end#0) goto memset::@3 + [187] memset::dst#2 = phi( memset::@1/memset::dst#4, memset::@3/memset::dst#1 ) + [188] if(memset::dst#2!=memset::end#0) goto memset::@3 to:memset::@return memset::@return: scope:[memset] from memset::@2 - [191] return + [189] return to:@return memset::@3: scope:[memset] from memset::@2 - [192] *memset::dst#2 = memset::c#4 - [193] memset::dst#1 = ++ memset::dst#2 + [190] *memset::dst#2 = memset::c#4 + [191] memset::dst#1 = ++ memset::dst#2 to:memset::@2 char uctoa_append(char *buffer , char value , char sub) uctoa_append: scope:[uctoa_append] from uctoa::@5 - [194] phi() + [192] phi() to:uctoa_append::@1 uctoa_append::@1: scope:[uctoa_append] from uctoa_append uctoa_append::@2 - [195] uctoa_append::digit#2 = phi( uctoa_append/0, uctoa_append::@2/uctoa_append::digit#1 ) - [195] uctoa_append::value#2 = phi( uctoa_append/uctoa_append::value#0, uctoa_append::@2/uctoa_append::value#1 ) - [196] if(uctoa_append::value#2>=uctoa_append::sub#0) goto uctoa_append::@2 + [193] uctoa_append::digit#2 = phi( uctoa_append/0, uctoa_append::@2/uctoa_append::digit#1 ) + [193] uctoa_append::value#2 = phi( uctoa_append/uctoa_append::value#0, uctoa_append::@2/uctoa_append::value#1 ) + [194] if(uctoa_append::value#2>=uctoa_append::sub#0) goto uctoa_append::@2 to:uctoa_append::@3 uctoa_append::@3: scope:[uctoa_append] from uctoa_append::@1 - [197] *uctoa_append::buffer#0 = DIGITS[uctoa_append::digit#2] + [195] *uctoa_append::buffer#0 = DIGITS[uctoa_append::digit#2] to:uctoa_append::@return uctoa_append::@return: scope:[uctoa_append] from uctoa_append::@3 - [198] return + [196] return to:@return uctoa_append::@2: scope:[uctoa_append] from uctoa_append::@1 - [199] uctoa_append::digit#1 = ++ uctoa_append::digit#2 - [200] uctoa_append::value#1 = uctoa_append::value#2 - uctoa_append::sub#0 + [197] uctoa_append::digit#1 = ++ uctoa_append::digit#2 + [198] uctoa_append::value#1 = uctoa_append::value#2 - uctoa_append::sub#0 to:uctoa_append::@1 unsigned int strlen(char *str) strlen: scope:[strlen] from printf_number_buffer::@4 - [201] phi() + [199] phi() to:strlen::@1 strlen::@1: scope:[strlen] from strlen strlen::@2 - [202] strlen::len#2 = phi( strlen/0, strlen::@2/strlen::len#1 ) - [202] strlen::str#2 = phi( strlen/printf_number_buffer::buffer_digits#0, strlen::@2/strlen::str#0 ) - [203] if(0!=*strlen::str#2) goto strlen::@2 + [200] strlen::len#2 = phi( strlen/0, strlen::@2/strlen::len#1 ) + [200] strlen::str#2 = phi( strlen/printf_number_buffer::buffer_digits#0, strlen::@2/strlen::str#0 ) + [201] if(0!=*strlen::str#2) goto strlen::@2 to:strlen::@return strlen::@return: scope:[strlen] from strlen::@1 - [204] return + [202] return to:@return strlen::@2: scope:[strlen] from strlen::@1 - [205] strlen::len#1 = ++ strlen::len#2 - [206] strlen::str#0 = ++ strlen::str#2 + [203] strlen::len#1 = ++ strlen::len#2 + [204] strlen::str#0 = ++ strlen::str#2 to:strlen::@1 void printf_padding(void (*putc)(char) , char pad , char length) printf_padding: scope:[printf_padding] from printf_number_buffer::@6 - [207] phi() + [205] phi() to:printf_padding::@1 printf_padding::@1: scope:[printf_padding] from printf_padding printf_padding::@3 - [208] printf_padding::i#2 = phi( printf_padding/0, printf_padding::@3/printf_padding::i#1 ) - [209] if(printf_padding::i#2=uctoa::digit_value#0) goto uctoa::@14 -Simple Condition printf_number_buffer::$35 [220] if(0!=printf_number_buffer::padding#10) goto printf_number_buffer::@8 -Simple Condition printf_number_buffer::$2 [221] if(0==printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@21 -Simple Condition printf_number_buffer::$36 [223] if(0!=printf_number_buffer::padding#10) goto printf_number_buffer::@10 -Simple Condition printf_number_buffer::$37 [225] if(0!=printf_number_buffer::padding#10) goto printf_number_buffer::@12 -Simple Condition printf_number_buffer::$14 [226] if(0==printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@24 -Simple Condition main::$3 [227] if(main::ch#0!=main::current#2) goto main::@2 +Simple Condition printf_number_buffer::$1 [139] if(0==printf_number_buffer::format_justify_left#0) goto printf_number_buffer::@22 +Simple Condition printf_number_buffer::$33 [153] if(0!=printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@23 +Simple Condition printf_number_buffer::$34 [162] if(0!=printf_number_buffer::format_justify_left#0) goto printf_number_buffer::@25 +Simple Condition main::$8 [181] if(0!=main::ch#0) goto main::@11 +Simple Condition uctoa::$6 [217] if(uctoa::value#2>=uctoa::digit_value#0) goto uctoa::@14 +Simple Condition printf_number_buffer::$35 [219] if(0!=printf_number_buffer::padding#10) goto printf_number_buffer::@8 +Simple Condition printf_number_buffer::$2 [220] if(0==printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@21 +Simple Condition printf_number_buffer::$36 [222] if(0!=printf_number_buffer::padding#10) goto printf_number_buffer::@10 +Simple Condition printf_number_buffer::$37 [224] if(0!=printf_number_buffer::padding#10) goto printf_number_buffer::@12 +Simple Condition printf_number_buffer::$14 [225] if(0==printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@24 +Simple Condition main::$3 [226] if(main::ch#0!=main::current#2) goto main::@2 Successful SSA optimization Pass2ConditionalJumpSimplification -Negating conditional jump and destination [142] if(0!=printf_number_buffer::format_justify_left#0) goto printf_number_buffer::@2 -Negating conditional jump and destination [156] if(0==printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@4 -Negating conditional jump and destination [165] if(0==printf_number_buffer::format_justify_left#0) goto printf_number_buffer::@return -Negating conditional jump and destination [184] if(0==main::ch#0) goto main::@1 -Negating conditional jump and destination [221] if(0!=printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@2 -Negating conditional jump and destination [226] if(0!=printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@return +Negating conditional jump and destination [139] if(0!=printf_number_buffer::format_justify_left#0) goto printf_number_buffer::@2 +Negating conditional jump and destination [153] if(0==printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@4 +Negating conditional jump and destination [162] if(0==printf_number_buffer::format_justify_left#0) goto printf_number_buffer::@return +Negating conditional jump and destination [181] if(0==main::ch#0) goto main::@1 +Negating conditional jump and destination [220] if(0!=printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@2 +Negating conditional jump and destination [225] if(0!=printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@return Successful SSA optimization Pass2ConditionalJumpSequenceImprovement Constant right-side identified [29] uctoa::$4 = uctoa::max_digits#2 - 1 -Constant right-side identified [169] main::toD0181_$0 = main::toD0181_$7 & $3fff -Constant right-side identified [172] main::toD0181_$3 = byte1 (unsigned int)main::toD0181_gfx#0 +Constant right-side identified [166] main::toD0181_$0 = main::toD0181_$7 & $3fff +Constant right-side identified [169] main::toD0181_$3 = byte1 (unsigned int)main::toD0181_gfx#0 Successful SSA optimization Pass2ConstantRValueConsolidation Constant uctoa::$4 = uctoa::max_digits#2-1 Constant main::toD0181_$0 = main::toD0181_$7&$3fff Constant main::toD0181_$3 = byte1 (unsigned int)main::toD0181_gfx#0 Successful SSA optimization Pass2ConstantIdentification -if() condition always false - eliminating [142] if(0!=printf_number_buffer::format_justify_left#0) goto printf_number_buffer::@2 -if() condition always true - replacing block destination [156] if(0==printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@4 -if() condition always true - replacing block destination [165] if(0==printf_number_buffer::format_justify_left#0) goto printf_number_buffer::@return -if() condition always false - eliminating [221] if(0!=printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@2 -if() condition always false - eliminating [226] if(0!=printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@return +if() condition always true - replacing block destination [71] if(gotoxy::x#2<$28) goto gotoxy::@2 +if() condition always false - eliminating [139] if(0!=printf_number_buffer::format_justify_left#0) goto printf_number_buffer::@2 +if() condition always true - replacing block destination [153] if(0==printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@4 +if() condition always true - replacing block destination [162] if(0==printf_number_buffer::format_justify_left#0) goto printf_number_buffer::@return +if() condition always false - eliminating [220] if(0!=printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@2 +if() condition always false - eliminating [225] if(0!=printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@return Successful SSA optimization Pass2ConstantIfs Eliminating variable printf_padding::length#1 from unused block printf_number_buffer::@10 Eliminating variable printf_padding::length#2 from unused block printf_number_buffer::@12 +Removing PHI-reference to removed block (gotoxy::@4) in block gotoxy::@2 +Removing unused block gotoxy::@4 Removing PHI-reference to removed block (printf_number_buffer::@10) in block printf_padding Removing PHI-reference to removed block (printf_number_buffer::@10) in block printf_padding Removing PHI-reference to removed block (printf_number_buffer::@10) in block printf_padding @@ -2965,6 +2796,7 @@ Removing unused block printf_number_buffer::@23 Removing unused block printf_number_buffer::@24 Removing unused block printf_number_buffer::@25 Successful SSA optimization Pass2EliminateUnusedBlocks +Eliminating unused constant gotoxy::x#0 Eliminating unused constant printf_padding::pad#1 Eliminating unused constant printf_padding::pad#2 Eliminating unused constant printf_padding::putc#1 @@ -2977,47 +2809,44 @@ Eliminating unused constant printf_uchar::format_zero_padding#0 Successful SSA optimization PassNEliminateUnusedVars Alias candidate removed (volatile)conio_line_text = gotoxy::$5 Alias candidate removed (volatile)conio_line_color = gotoxy::$6 -Alias candidate removed (volatile)memset::c#1 = conio_textcolor +Identical Phi Values gotoxy::x#4 gotoxy::x#2 Identical Phi Values printf_padding::length#4 printf_padding::length#0 Identical Phi Values printf_padding::pad#5 printf_padding::pad#0 Identical Phi Values printf_padding::putc#5 printf_padding::putc#0 Successful SSA optimization Pass2IdenticalPhiElimination -Constant right-side identified [152] main::toD0181_$1 = main::toD0181_$0 * 4 -Constant right-side identified [154] main::toD0181_$4 = main::toD0181_$3 / 4 +Constant right-side identified [147] main::toD0181_$1 = main::toD0181_$0 * 4 +Constant right-side identified [149] main::toD0181_$4 = main::toD0181_$3 / 4 Successful SSA optimization Pass2ConstantRValueConsolidation Constant main::toD0181_$1 = main::toD0181_$0*4 Constant main::toD0181_$4 = main::toD0181_$3/4 Successful SSA optimization Pass2ConstantIdentification -Replacing constant pointer function [124] callexecute cputc +Replacing constant pointer function [119] callexecute cputc Successful SSA optimization Pass2ConstantCallPointerIdentification Eliminating unused constant printf_padding::putc#0 Successful SSA optimization PassNEliminateUnusedVars Alias candidate removed (volatile)conio_line_text = gotoxy::$5 Alias candidate removed (volatile)conio_line_color = gotoxy::$6 -Alias candidate removed (volatile)memset::c#1 = conio_textcolor -Constant right-side identified [151] main::toD0181_$2 = byte1 main::toD0181_$1 -Constant right-side identified [152] main::toD0181_$5 = main::toD0181_$4 & $f +Constant right-side identified [145] main::toD0181_$2 = byte1 main::toD0181_$1 +Constant right-side identified [146] main::toD0181_$5 = main::toD0181_$4 & $f Successful SSA optimization Pass2ConstantRValueConsolidation Constant main::toD0181_$2 = byte1 main::toD0181_$1 Constant main::toD0181_$5 = main::toD0181_$4&$f Successful SSA optimization Pass2ConstantIdentification Alias candidate removed (volatile)conio_line_text = gotoxy::$5 Alias candidate removed (volatile)conio_line_color = gotoxy::$6 -Alias candidate removed (volatile)memset::c#1 = conio_textcolor -Constant right-side identified [151] main::toD0181_return#0 = main::toD0181_$2 | main::toD0181_$5 +Constant right-side identified [145] main::toD0181_return#0 = main::toD0181_$2 | main::toD0181_$5 Successful SSA optimization Pass2ConstantRValueConsolidation Constant main::toD0181_return#0 = main::toD0181_$2|main::toD0181_$5 Successful SSA optimization Pass2ConstantIdentification Alias candidate removed (volatile)conio_line_text = gotoxy::$5 Alias candidate removed (volatile)conio_line_color = gotoxy::$6 -Alias candidate removed (volatile)memset::c#1 = conio_textcolor Inlining Noop Cast [1] memcpy::src#0 = (char *)memcpy::source#2 keeping memcpy::source#2 Inlining Noop Cast [2] memcpy::dst#0 = (char *)memcpy::destination#2 keeping memcpy::destination#2 Inlining Noop Cast [3] memcpy::$2 = (char *)memcpy::source#2 keeping memcpy::source#2 Inlining Noop Cast [13] memset::$4 = (char *)memset::str#3 keeping memset::str#3 Inlining Noop Cast [15] memset::dst#0 = (char *)memset::str#3 keeping memset::str#3 Successful SSA optimization Pass2NopCastInlining -Rewriting multiplication to use shift and addition[72] gotoxy::line_offset#0 = gotoxy::$7 * $28 +Rewriting multiplication to use shift and addition[69] gotoxy::line_offset#0 = gotoxy::$7 * $28 Inlining constant with var siblings memcpy::destination#0 Inlining constant with var siblings memcpy::source#0 Inlining constant with var siblings memcpy::num#0 @@ -3029,6 +2858,7 @@ Inlining constant with var siblings memset::c#0 Inlining constant with var siblings memset::num#0 Inlining constant with var siblings memset::str#1 Inlining constant with var siblings memset::num#1 +Inlining constant with var siblings memset::c#1 Inlining constant with var siblings strlen::len#0 Inlining constant with var siblings strlen::str#1 Inlining constant with var siblings uctoa::started#0 @@ -3041,10 +2871,6 @@ Inlining constant with var siblings clrscr::line_cols#0 Inlining constant with var siblings clrscr::l#0 Inlining constant with var siblings clrscr::c#0 Inlining constant with var siblings gotoxy::y#0 -Inlining constant with var siblings gotoxy::x#0 -Inlining constant with var siblings gotoxy::x#1 -Inlining constant with var siblings gotoxy::y#1 -Inlining constant with var siblings gotoxy::x#2 Inlining constant with var siblings conio_c64_init::line#1 Inlining constant with var siblings printf_str::putc#1 Inlining constant with var siblings printf_str::s#2 @@ -3060,6 +2886,7 @@ Inlining constant with var siblings main::current#0 Inlining constant with var siblings petscii_to_screencode::return#7 Constant inlined uctoa_append::digit#0 = 0 Constant inlined printf_str::putc#0 = printf_uchar::putc#0 +Constant inlined conio_textcolor = LIGHT_BLUE Constant inlined printf_str::putc#1 = &cputc Constant inlined memset::num#1 = $28 Constant inlined printf_str::putc#2 = &cputc @@ -3086,10 +2913,8 @@ Constant inlined memcpy::source#0 = (void *)DEFAULT_SCREEN+$28 Constant inlined main::toD0181_$5 = byte1 (unsigned int)DEFAULT_FONT_MIXED/4&$f Constant inlined main::toD0181_$4 = byte1 (unsigned int)DEFAULT_FONT_MIXED/4 Constant inlined main::toD0181_$3 = byte1 (unsigned int)DEFAULT_FONT_MIXED -Constant inlined gotoxy::x#0 = 0 -Constant inlined gotoxy::x#1 = 0 -Constant inlined gotoxy::x#2 = 0 Constant inlined memset::c#0 = ' ' +Constant inlined memset::c#1 = LIGHT_BLUE Constant inlined main::toD0181_screen#0 = DEFAULT_SCREEN Constant inlined main::toD0181_gfx#0 = DEFAULT_FONT_MIXED Constant inlined uctoa::$4 = uctoa::max_digits#2-1 @@ -3113,32 +2938,22 @@ Constant inlined uctoa::buffer#5 = (char *)&printf_buffer+OFFSET_STRUCT_PRINTF_B Constant inlined memcpy::num#1 = (unsigned int)$19*$28-$28 Constant inlined memcpy::num#0 = (unsigned int)$19*$28-$28 Constant inlined gotoxy::y#0 = 0 -Constant inlined gotoxy::y#1 = 0 Constant inlined clrscr::c#0 = 0 Constant inlined clrscr::line_cols#0 = COLORRAM Successful SSA optimization Pass2ConstantInlining Alias candidate removed (volatile)conio_line_text = gotoxy::$5 Alias candidate removed (volatile)conio_line_color = gotoxy::$6 -Alias candidate removed (volatile)memset::c#1 = conio_textcolor Alias gotoxy::line_offset#0 = gotoxy::$10 Successful SSA optimization Pass2AliasElimination Alias candidate removed (volatile)conio_line_text = gotoxy::$5 Alias candidate removed (volatile)conio_line_color = gotoxy::$6 -Alias candidate removed (volatile)memset::c#1 = conio_textcolor Identical Phi Values memcpy::num#2 (unsigned int)$19*$28-$28 Identical Phi Values memset::num#2 $28 -Identical Phi Values gotoxy::x#3 0 -Successful SSA optimization Pass2IdenticalPhiElimination -Identical Phi Values gotoxy::x#4 0 Successful SSA optimization Pass2IdenticalPhiElimination if() condition always false - eliminating [9] if($28<=0) goto memset::@1 -if() condition always true - replacing block destination [62] if(0<$28) goto gotoxy::@2 Successful SSA optimization Pass2ConstantIfs -Removing unused block gotoxy::@4 -Successful SSA optimization Pass2EliminateUnusedBlocks Alias candidate removed (volatile)conio_line_text = gotoxy::$5 Alias candidate removed (volatile)conio_line_color = gotoxy::$6 -Alias candidate removed (volatile)memset::c#1 = conio_textcolor Finalized unsigned number type (char) 2 Finalized unsigned number type (char) 8 Finalized unsigned number type (char) $a @@ -3163,10 +2978,8 @@ Simplifying constant integer cast $19-1 Successful SSA optimization PassNCastSimplification Alias candidate removed (volatile)conio_line_text = gotoxy::$5 Alias candidate removed (volatile)conio_line_color = gotoxy::$6 -Alias candidate removed (volatile)memset::c#1 = conio_textcolor Alias candidate removed (volatile)conio_line_text = gotoxy::$5 Alias candidate removed (volatile)conio_line_color = gotoxy::$6 -Alias candidate removed (volatile)memset::c#1 = conio_textcolor Added new block during phi lifting uctoa::@17(between uctoa::@16 and uctoa::@13) Added new block during phi lifting gotoxy::@5(between gotoxy and gotoxy::@1) Added new block during phi lifting conio_c64_init::@4(between conio_c64_init and conio_c64_init::@1) @@ -3196,11 +3009,11 @@ Adding NOP phi() at start of petscii_to_screencode::@12 Adding NOP phi() at start of printf_uchar Adding NOP phi() at start of printf_uchar::@2 Adding NOP phi() at start of printf_uchar::@5 -Adding NOP phi() at start of cscroll::@2 -Adding NOP phi() at start of cscroll::@8 +Adding NOP phi() at start of cscroll::@1 Adding NOP phi() at start of cscroll::@3 Adding NOP phi() at start of cscroll::@4 Adding NOP phi() at start of cscroll::@5 +Adding NOP phi() at start of cscroll::@6 Adding NOP phi() at start of uctoa Adding NOP phi() at start of uctoa::@6 Adding NOP phi() at start of uctoa::@2 @@ -3219,24 +3032,23 @@ Adding NOP phi() at start of strlen Adding NOP phi() at start of strlen::@3 Adding NOP phi() at start of printf_padding CALL GRAPH -Calls in [__start] to conio_c64_init:3 main:6 -Calls in [conio_c64_init] to gotoxy:15 -Calls in [cputc] to cputln:26 cputln:30 -Calls in [main] to clrscr:36 GETIN:39 petscii_to_screencode:45 printf_str:48 cputc:50 printf_str:52 printf_uchar:54 printf_str:56 +Calls in [__start] to conio_c64_init:5 main:8 +Calls in [conio_c64_init] to gotoxy:16 +Calls in [cputc] to cputln:27 cputln:31 +Calls in [main] to clrscr:37 GETIN:40 petscii_to_screencode:46 printf_str:49 cputc:51 printf_str:53 printf_uchar:55 printf_str:57 Calls in [cputln] to cscroll:79 Calls in [printf_str] to null:134 Calls in [printf_uchar] to uctoa:141 printf_number_buffer:143 -Calls in [cscroll] to gotoxy:149 memcpy:153 memcpy:155 memset:157 memset:160 -Calls in [uctoa] to uctoa_append:189 -Calls in [printf_number_buffer] to strlen:197 cputc:213 printf_str:218 printf_padding:222 -Calls in [printf_padding] to cputc:272 +Calls in [cscroll] to memcpy:149 memcpy:151 memset:153 memset:155 +Calls in [uctoa] to uctoa_append:185 +Calls in [printf_number_buffer] to strlen:193 cputc:209 printf_str:214 printf_padding:218 +Calls in [printf_padding] to cputc:268 -Created 33 initial phi equivalence classes -Coalesced [14] gotoxy::y#7 = gotoxy::y#2 -Coalesced [18] conio_c64_init::line#3 = conio_c64_init::line#0 -Not coalescing [57] main::current#4 = main::ch#0 -Coalesced (already) [58] main::current#5 = main::current#2 -Coalesced [74] gotoxy::y#8 = gotoxy::y#3 +Created 32 initial phi equivalence classes +Coalesced [19] conio_c64_init::line#3 = conio_c64_init::line#0 +Not coalescing [58] main::current#4 = main::ch#0 +Coalesced (already) [59] main::current#5 = main::current#2 +Coalesced [74] gotoxy::y#7 = gotoxy::y#2 Coalesced [96] clrscr::l#7 = clrscr::l#1 Coalesced [97] clrscr::line_text#7 = clrscr::line_text#1 Coalesced [98] clrscr::line_cols#7 = clrscr::line_cols#1 @@ -3249,29 +3061,28 @@ Coalesced [123] petscii_to_screencode::return#12 = petscii_to_screencode::petsci Coalesced [125] petscii_to_screencode::return#11 = petscii_to_screencode::return#1 Coalesced [127] printf_str::s#8 = printf_str::s#6 Coalesced [136] printf_str::s#9 = printf_str::s#0 -Coalesced [159] memset::c#6 = memset::c#1 -Coalesced [167] uctoa::value#17 = uctoa::value#1 -Coalesced [177] uctoa::value#18 = uctoa::value#2 -Coalesced [178] uctoa::started#6 = uctoa::started#2 -Coalesced [179] uctoa::buffer#23 = uctoa::buffer#11 -Coalesced [182] uctoa::digit#7 = uctoa::digit#1 -Coalesced (already) [183] uctoa::value#16 = uctoa::value#6 -Coalesced (already) [184] uctoa::started#5 = uctoa::started#4 -Coalesced (already) [185] uctoa::buffer#22 = uctoa::buffer#14 -Coalesced [193] uctoa::value#19 = uctoa::value#0 -Coalesced [194] uctoa::buffer#24 = uctoa::buffer#4 -Coalesced [203] printf_number_buffer::len#5 = printf_number_buffer::len#1 -Coalesced [224] printf_number_buffer::padding#17 = printf_number_buffer::padding#1 -Coalesced [225] printf_number_buffer::len#4 = printf_number_buffer::len#0 -Coalesced [237] memcpy::src#5 = memcpy::src#1 -Coalesced [238] memcpy::dst#5 = memcpy::dst#1 -Coalesced [248] memset::dst#5 = memset::dst#1 -Coalesced [249] uctoa_append::value#6 = uctoa_append::value#0 -Coalesced [256] uctoa_append::value#7 = uctoa_append::value#1 -Coalesced [257] uctoa_append::digit#5 = uctoa_append::digit#1 -Coalesced [265] strlen::str#5 = strlen::str#0 -Coalesced [266] strlen::len#5 = strlen::len#1 -Coalesced [275] printf_padding::i#5 = printf_padding::i#1 +Coalesced [163] uctoa::value#17 = uctoa::value#1 +Coalesced [173] uctoa::value#18 = uctoa::value#2 +Coalesced [174] uctoa::started#6 = uctoa::started#2 +Coalesced [175] uctoa::buffer#23 = uctoa::buffer#11 +Coalesced [178] uctoa::digit#7 = uctoa::digit#1 +Coalesced (already) [179] uctoa::value#16 = uctoa::value#6 +Coalesced (already) [180] uctoa::started#5 = uctoa::started#4 +Coalesced (already) [181] uctoa::buffer#22 = uctoa::buffer#14 +Coalesced [189] uctoa::value#19 = uctoa::value#0 +Coalesced [190] uctoa::buffer#24 = uctoa::buffer#4 +Coalesced [199] printf_number_buffer::len#5 = printf_number_buffer::len#1 +Coalesced [220] printf_number_buffer::padding#17 = printf_number_buffer::padding#1 +Coalesced [221] printf_number_buffer::len#4 = printf_number_buffer::len#0 +Coalesced [233] memcpy::src#5 = memcpy::src#1 +Coalesced [234] memcpy::dst#5 = memcpy::dst#1 +Coalesced [244] memset::dst#5 = memset::dst#1 +Coalesced [245] uctoa_append::value#6 = uctoa_append::value#0 +Coalesced [252] uctoa_append::value#7 = uctoa_append::value#1 +Coalesced [253] uctoa_append::digit#5 = uctoa_append::digit#1 +Coalesced [261] strlen::str#5 = strlen::str#0 +Coalesced [262] strlen::len#5 = strlen::len#1 +Coalesced [271] printf_padding::i#5 = printf_padding::i#1 Coalesced down to 29 phi equivalence classes Culled Empty Block label __start::@2 Culled Empty Block label __start::@3 @@ -3289,7 +3100,7 @@ Culled Empty Block label petscii_to_screencode::@12 Culled Empty Block label petscii_to_screencode::@2 Culled Empty Block label printf_uchar::@2 Culled Empty Block label printf_uchar::@5 -Culled Empty Block label cscroll::@8 +Culled Empty Block label cscroll::@1 Culled Empty Block label uctoa::@6 Culled Empty Block label uctoa::@2 Culled Empty Block label uctoa::@5 @@ -3319,6 +3130,11 @@ Renumbering block clrscr::@4 to clrscr::@3 Renumbering block clrscr::@5 to clrscr::@4 Renumbering block clrscr::@6 to clrscr::@5 Renumbering block gotoxy::@5 to gotoxy::@3 +Renumbering block cscroll::@3 to cscroll::@1 +Renumbering block cscroll::@4 to cscroll::@2 +Renumbering block cscroll::@5 to cscroll::@3 +Renumbering block cscroll::@6 to cscroll::@4 +Renumbering block cscroll::@7 to cscroll::@5 Renumbering block conio_c64_init::@4 to conio_c64_init::@2 Renumbering block printf_uchar::@3 to printf_uchar::@1 Renumbering block printf_uchar::@4 to printf_uchar::@2 @@ -3358,10 +3174,10 @@ Adding NOP phi() at start of main::@8 Adding NOP phi() at start of gotoxy::@3 Adding NOP phi() at start of clrscr Adding NOP phi() at start of printf_uchar +Adding NOP phi() at start of cscroll::@1 Adding NOP phi() at start of cscroll::@2 Adding NOP phi() at start of cscroll::@3 Adding NOP phi() at start of cscroll::@4 -Adding NOP phi() at start of cscroll::@5 Adding NOP phi() at start of uctoa Adding NOP phi() at start of printf_number_buffer Adding NOP phi() at start of printf_number_buffer::@4 @@ -3378,496 +3194,490 @@ __start: scope:[__start] from [0] phi() to:__start::__init1 __start::__init1: scope:[__start] from __start - [1] conio_line_text = DEFAULT_SCREEN - [2] conio_line_color = COLORRAM - [3] call conio_c64_init + [1] conio_cursor_x = 0 + [2] conio_cursor_y = 0 + [3] conio_line_text = DEFAULT_SCREEN + [4] conio_line_color = COLORRAM + [5] call conio_c64_init to:__start::@1 __start::@1: scope:[__start] from __start::__init1 - [4] phi() - [5] call main + [6] phi() + [7] call main to:__start::@return __start::@return: scope:[__start] from __start::@1 - [6] return + [8] return to:@return void conio_c64_init() conio_c64_init: scope:[conio_c64_init] from __start::__init1 - [7] conio_c64_init::line#0 = *conio_c64_init::BASIC_CURSOR_LINE - [8] if(conio_c64_init::line#0<$19) goto conio_c64_init::@2 + [9] conio_c64_init::line#0 = *conio_c64_init::BASIC_CURSOR_LINE + [10] if(conio_c64_init::line#0<$19) goto conio_c64_init::@2 to:conio_c64_init::@1 conio_c64_init::@2: scope:[conio_c64_init] from conio_c64_init - [9] phi() + [11] phi() to:conio_c64_init::@1 conio_c64_init::@1: scope:[conio_c64_init] from conio_c64_init conio_c64_init::@2 - [10] conio_c64_init::line#2 = phi( conio_c64_init::@2/conio_c64_init::line#0, conio_c64_init/$19-1 ) - [11] gotoxy::y#2 = conio_c64_init::line#2 - [12] call gotoxy + [12] conio_c64_init::line#2 = phi( conio_c64_init::@2/conio_c64_init::line#0, conio_c64_init/$19-1 ) + [13] gotoxy::y#2 = conio_c64_init::line#2 + [14] call gotoxy to:conio_c64_init::@return conio_c64_init::@return: scope:[conio_c64_init] from conio_c64_init::@1 - [13] return + [15] return to:@return __stackcall void cputc(char c) cputc: scope:[cputc] from printf_number_buffer::@7 printf_padding::@2 - [14] cputc::c#0 = stackidx(char,cputc::OFFSET_STACK_C) - [15] if(cputc::c#0==' + [16] cputc::c#0 = stackidx(char,cputc::OFFSET_STACK_C) + [17] if(cputc::c#0==' ') goto cputc::@1 to:cputc::@2 cputc::@2: scope:[cputc] from cputc - [16] conio_line_text[conio_cursor_x] = cputc::c#0 - [17] conio_line_color[conio_cursor_x] = conio_textcolor - [18] conio_cursor_x = ++ conio_cursor_x - [19] if(conio_cursor_x!=$28) goto cputc::@return + [18] conio_line_text[conio_cursor_x] = cputc::c#0 + [19] conio_line_color[conio_cursor_x] = LIGHT_BLUE + [20] conio_cursor_x = ++ conio_cursor_x + [21] if(conio_cursor_x!=$28) goto cputc::@return to:cputc::@3 cputc::@3: scope:[cputc] from cputc::@2 - [20] phi() - [21] call cputln + [22] phi() + [23] call cputln to:cputc::@return cputc::@return: scope:[cputc] from cputc::@1 cputc::@2 cputc::@3 - [22] return + [24] return to:@return cputc::@1: scope:[cputc] from cputc - [23] phi() - [24] call cputln + [25] phi() + [26] call cputln to:cputc::@return int main() main: scope:[main] from __start::@1 - [25] phi() + [27] phi() to:main::toD0181 main::toD0181: scope:[main] from main - [26] phi() + [28] phi() to:main::@3 main::@3: scope:[main] from main::toD0181 - [27] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_MEMORY) = main::toD0181_return#0 - [28] call clrscr + [29] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_MEMORY) = main::toD0181_return#0 + [30] call clrscr to:main::@1 main::@1: scope:[main] from main::@10 main::@3 main::@4 main::@9 - [29] main::current#2 = phi( main::@9/main::current#4, main::@3/0, main::@4/main::current#2 ) - [30] call GETIN - [31] GETIN::return#0 = GETIN::return#1 + [31] main::current#2 = phi( main::@9/main::current#4, main::@3/0, main::@4/main::current#2 ) + [32] call GETIN + [33] GETIN::return#0 = GETIN::return#1 to:main::@4 main::@4: scope:[main] from main::@1 - [32] main::ch#0 = GETIN::return#0 - [33] if(0==main::ch#0) goto main::@1 + [34] main::ch#0 = GETIN::return#0 + [35] if(0==main::ch#0) goto main::@1 to:main::@10 main::@10: scope:[main] from main::@4 - [34] if(main::ch#0!=main::current#2) goto main::@2 + [36] if(main::ch#0!=main::current#2) goto main::@2 to:main::@1 main::@2: scope:[main] from main::@10 - [35] petscii_to_screencode::petscii#0 = main::ch#0 - [36] call petscii_to_screencode - [37] petscii_to_screencode::return#0 = petscii_to_screencode::return#10 + [37] petscii_to_screencode::petscii#0 = main::ch#0 + [38] call petscii_to_screencode + [39] petscii_to_screencode::return#0 = petscii_to_screencode::return#10 to:main::@5 main::@5: scope:[main] from main::@2 - [38] main::$6 = petscii_to_screencode::return#0 - [39] call printf_str + [40] main::$6 = petscii_to_screencode::return#0 + [41] call printf_str to:main::@6 main::@6: scope:[main] from main::@5 - [40] stackpush(char) = main::$6 - [41] callexecute cputc + [42] stackpush(char) = main::$6 + [43] callexecute cputc sideeffect stackpullbytes(1) - [43] call printf_str + [45] call printf_str to:main::@7 main::@7: scope:[main] from main::@6 - [44] printf_uchar::uvalue#0 = main::ch#0 - [45] call printf_uchar + [46] printf_uchar::uvalue#0 = main::ch#0 + [47] call printf_uchar to:main::@8 main::@8: scope:[main] from main::@7 - [46] phi() - [47] call printf_str + [48] phi() + [49] call printf_str to:main::@9 main::@9: scope:[main] from main::@8 - [48] main::current#4 = main::ch#0 + [50] main::current#4 = main::ch#0 to:main::@1 void gotoxy(char x , char y) -gotoxy: scope:[gotoxy] from conio_c64_init::@1 cscroll::@2 - [49] gotoxy::y#3 = phi( conio_c64_init::@1/gotoxy::y#2, cscroll::@2/0 ) - [50] if(gotoxy::y#3<$19+1) goto gotoxy::@3 +gotoxy: scope:[gotoxy] from conio_c64_init::@1 + [51] if(gotoxy::y#2<$19+1) goto gotoxy::@3 to:gotoxy::@1 gotoxy::@3: scope:[gotoxy] from gotoxy - [51] phi() + [52] phi() to:gotoxy::@1 gotoxy::@1: scope:[gotoxy] from gotoxy gotoxy::@3 - [52] gotoxy::y#4 = phi( gotoxy::@3/gotoxy::y#3, gotoxy/0 ) + [53] gotoxy::y#4 = phi( gotoxy::@3/gotoxy::y#2, gotoxy/0 ) to:gotoxy::@2 gotoxy::@2: scope:[gotoxy] from gotoxy::@1 - [53] conio_cursor_x = 0 - [54] conio_cursor_y = gotoxy::y#4 - [55] gotoxy::$7 = (unsigned int)gotoxy::y#4 - [56] gotoxy::$8 = gotoxy::$7 << 2 - [57] gotoxy::$9 = gotoxy::$8 + gotoxy::$7 - [58] gotoxy::line_offset#0 = gotoxy::$9 << 3 - [59] gotoxy::$5 = DEFAULT_SCREEN + gotoxy::line_offset#0 - [60] conio_line_text = gotoxy::$5 - [61] gotoxy::$6 = COLORRAM + gotoxy::line_offset#0 - [62] conio_line_color = gotoxy::$6 + [54] conio_cursor_x = gotoxy::x#2 + [55] conio_cursor_y = gotoxy::y#4 + [56] gotoxy::$7 = (unsigned int)gotoxy::y#4 + [57] gotoxy::$8 = gotoxy::$7 << 2 + [58] gotoxy::$9 = gotoxy::$8 + gotoxy::$7 + [59] gotoxy::line_offset#0 = gotoxy::$9 << 3 + [60] gotoxy::$5 = DEFAULT_SCREEN + gotoxy::line_offset#0 + [61] conio_line_text = gotoxy::$5 + [62] gotoxy::$6 = COLORRAM + gotoxy::line_offset#0 + [63] conio_line_color = gotoxy::$6 to:gotoxy::@return gotoxy::@return: scope:[gotoxy] from gotoxy::@2 - [63] return + [64] return to:@return void cputln() cputln: scope:[cputln] from cputc::@1 cputc::@3 - [64] conio_line_text = conio_line_text + $28 - [65] conio_line_color = conio_line_color + $28 - [66] conio_cursor_x = 0 - [67] conio_cursor_y = ++ conio_cursor_y - [68] call cscroll + [65] conio_line_text = conio_line_text + $28 + [66] conio_line_color = conio_line_color + $28 + [67] conio_cursor_x = 0 + [68] conio_cursor_y = ++ conio_cursor_y + [69] call cscroll to:cputln::@return cputln::@return: scope:[cputln] from cputln - [69] return + [70] return to:@return void clrscr() clrscr: scope:[clrscr] from main::@3 - [70] phi() + [71] phi() to:clrscr::@1 clrscr::@1: scope:[clrscr] from clrscr clrscr::@5 - [71] clrscr::line_cols#5 = phi( clrscr/COLORRAM, clrscr::@5/clrscr::line_cols#1 ) - [71] clrscr::line_text#5 = phi( clrscr/DEFAULT_SCREEN, clrscr::@5/clrscr::line_text#1 ) - [71] clrscr::l#2 = phi( clrscr/0, clrscr::@5/clrscr::l#1 ) - [72] if(clrscr::l#2<$19) goto clrscr::@3 + [72] clrscr::line_cols#5 = phi( clrscr/COLORRAM, clrscr::@5/clrscr::line_cols#1 ) + [72] clrscr::line_text#5 = phi( clrscr/DEFAULT_SCREEN, clrscr::@5/clrscr::line_text#1 ) + [72] clrscr::l#2 = phi( clrscr/0, clrscr::@5/clrscr::l#1 ) + [73] if(clrscr::l#2<$19) goto clrscr::@3 to:clrscr::@2 clrscr::@2: scope:[clrscr] from clrscr::@1 - [73] conio_cursor_x = 0 - [74] conio_cursor_y = 0 - [75] conio_line_text = DEFAULT_SCREEN - [76] conio_line_color = COLORRAM + [74] conio_cursor_x = 0 + [75] conio_cursor_y = 0 + [76] conio_line_text = DEFAULT_SCREEN + [77] conio_line_color = COLORRAM to:clrscr::@return clrscr::@return: scope:[clrscr] from clrscr::@2 - [77] return + [78] return to:@return clrscr::@3: scope:[clrscr] from clrscr::@1 clrscr::@4 - [78] clrscr::c#2 = phi( clrscr::@1/0, clrscr::@4/clrscr::c#1 ) - [79] if(clrscr::c#2<$28) goto clrscr::@4 + [79] clrscr::c#2 = phi( clrscr::@1/0, clrscr::@4/clrscr::c#1 ) + [80] if(clrscr::c#2<$28) goto clrscr::@4 to:clrscr::@5 clrscr::@5: scope:[clrscr] from clrscr::@3 - [80] clrscr::line_text#1 = clrscr::line_text#5 + $28 - [81] clrscr::line_cols#1 = clrscr::line_cols#5 + $28 - [82] clrscr::l#1 = ++ clrscr::l#2 + [81] clrscr::line_text#1 = clrscr::line_text#5 + $28 + [82] clrscr::line_cols#1 = clrscr::line_cols#5 + $28 + [83] clrscr::l#1 = ++ clrscr::l#2 to:clrscr::@1 clrscr::@4: scope:[clrscr] from clrscr::@3 - [83] clrscr::line_text#5[clrscr::c#2] = ' ' - [84] clrscr::line_cols#5[clrscr::c#2] = conio_textcolor - [85] clrscr::c#1 = ++ clrscr::c#2 + [84] clrscr::line_text#5[clrscr::c#2] = ' ' + [85] clrscr::line_cols#5[clrscr::c#2] = LIGHT_BLUE + [86] clrscr::c#1 = ++ clrscr::c#2 to:clrscr::@3 char GETIN() GETIN: scope:[GETIN] from main::@1 asm { jsr$ffe4 stach } - [87] GETIN::return#1 = *GETIN::ch + [88] GETIN::return#1 = *GETIN::ch to:GETIN::@return GETIN::@return: scope:[GETIN] from GETIN - [88] return + [89] return to:@return char petscii_to_screencode(char petscii) petscii_to_screencode: scope:[petscii_to_screencode] from main::@2 - [89] if(petscii_to_screencode::petscii#0<$20) goto petscii_to_screencode::@1 + [90] if(petscii_to_screencode::petscii#0<$20) goto petscii_to_screencode::@1 to:petscii_to_screencode::@6 petscii_to_screencode::@6: scope:[petscii_to_screencode] from petscii_to_screencode - [90] if(petscii_to_screencode::petscii#0<$40) goto petscii_to_screencode::@return + [91] if(petscii_to_screencode::petscii#0<$40) goto petscii_to_screencode::@return to:petscii_to_screencode::@7 petscii_to_screencode::@7: scope:[petscii_to_screencode] from petscii_to_screencode::@6 - [91] if(petscii_to_screencode::petscii#0<$60) goto petscii_to_screencode::@2 + [92] if(petscii_to_screencode::petscii#0<$60) goto petscii_to_screencode::@2 to:petscii_to_screencode::@8 petscii_to_screencode::@8: scope:[petscii_to_screencode] from petscii_to_screencode::@7 - [92] if(petscii_to_screencode::petscii#0<$80) goto petscii_to_screencode::@3 + [93] if(petscii_to_screencode::petscii#0<$80) goto petscii_to_screencode::@3 to:petscii_to_screencode::@9 petscii_to_screencode::@9: scope:[petscii_to_screencode] from petscii_to_screencode::@8 - [93] if(petscii_to_screencode::petscii#0<$a0) goto petscii_to_screencode::@4 + [94] if(petscii_to_screencode::petscii#0<$a0) goto petscii_to_screencode::@4 to:petscii_to_screencode::@10 petscii_to_screencode::@10: scope:[petscii_to_screencode] from petscii_to_screencode::@9 - [94] if(petscii_to_screencode::petscii#0<$ff) goto petscii_to_screencode::@5 + [95] if(petscii_to_screencode::petscii#0<$ff) goto petscii_to_screencode::@5 to:petscii_to_screencode::@return petscii_to_screencode::@5: scope:[petscii_to_screencode] from petscii_to_screencode::@10 - [95] petscii_to_screencode::return#6 = petscii_to_screencode::petscii#0 - $80 + [96] petscii_to_screencode::return#6 = petscii_to_screencode::petscii#0 - $80 to:petscii_to_screencode::@return petscii_to_screencode::@return: scope:[petscii_to_screencode] from petscii_to_screencode::@1 petscii_to_screencode::@10 petscii_to_screencode::@2 petscii_to_screencode::@3 petscii_to_screencode::@4 petscii_to_screencode::@5 petscii_to_screencode::@6 - [96] petscii_to_screencode::return#10 = phi( petscii_to_screencode::@1/petscii_to_screencode::return#1, petscii_to_screencode::@10/$5e, petscii_to_screencode::@6/petscii_to_screencode::petscii#0, petscii_to_screencode::@2/petscii_to_screencode::return#3, petscii_to_screencode::@3/petscii_to_screencode::return#4, petscii_to_screencode::@4/petscii_to_screencode::return#5, petscii_to_screencode::@5/petscii_to_screencode::return#6 ) - [97] return + [97] petscii_to_screencode::return#10 = phi( petscii_to_screencode::@1/petscii_to_screencode::return#1, petscii_to_screencode::@10/$5e, petscii_to_screencode::@6/petscii_to_screencode::petscii#0, petscii_to_screencode::@2/petscii_to_screencode::return#3, petscii_to_screencode::@3/petscii_to_screencode::return#4, petscii_to_screencode::@4/petscii_to_screencode::return#5, petscii_to_screencode::@5/petscii_to_screencode::return#6 ) + [98] return to:@return petscii_to_screencode::@4: scope:[petscii_to_screencode] from petscii_to_screencode::@9 - [98] petscii_to_screencode::return#5 = petscii_to_screencode::petscii#0 + $40 + [99] petscii_to_screencode::return#5 = petscii_to_screencode::petscii#0 + $40 to:petscii_to_screencode::@return petscii_to_screencode::@3: scope:[petscii_to_screencode] from petscii_to_screencode::@8 - [99] petscii_to_screencode::return#4 = petscii_to_screencode::petscii#0 - $20 + [100] petscii_to_screencode::return#4 = petscii_to_screencode::petscii#0 - $20 to:petscii_to_screencode::@return petscii_to_screencode::@2: scope:[petscii_to_screencode] from petscii_to_screencode::@7 - [100] petscii_to_screencode::return#3 = petscii_to_screencode::petscii#0 - $40 + [101] petscii_to_screencode::return#3 = petscii_to_screencode::petscii#0 - $40 to:petscii_to_screencode::@return petscii_to_screencode::@1: scope:[petscii_to_screencode] from petscii_to_screencode - [101] petscii_to_screencode::return#1 = petscii_to_screencode::petscii#0 + $80 + [102] petscii_to_screencode::return#1 = petscii_to_screencode::petscii#0 + $80 to:petscii_to_screencode::@return void printf_str(void (*putc)(char) , const char *s) printf_str: scope:[printf_str] from main::@5 main::@6 main::@8 printf_number_buffer::@3 - [102] printf_str::putc#6 = phi( main::@5/&cputc, main::@6/&cputc, main::@8/&cputc, printf_number_buffer::@3/printf_uchar::putc#0 ) - [102] printf_str::s#6 = phi( main::@5/main::s, main::@6/main::s1, main::@8/main::s2, printf_number_buffer::@3/printf_number_buffer::buffer_digits#0 ) + [103] printf_str::putc#6 = phi( main::@5/&cputc, main::@6/&cputc, main::@8/&cputc, printf_number_buffer::@3/printf_uchar::putc#0 ) + [103] printf_str::s#6 = phi( main::@5/main::s, main::@6/main::s1, main::@8/main::s2, printf_number_buffer::@3/printf_number_buffer::buffer_digits#0 ) to:printf_str::@1 printf_str::@1: scope:[printf_str] from printf_str printf_str::@2 - [103] printf_str::s#5 = phi( printf_str/printf_str::s#6, printf_str::@2/printf_str::s#0 ) - [104] printf_str::c#1 = *printf_str::s#5 - [105] printf_str::s#0 = ++ printf_str::s#5 - [106] if(0!=printf_str::c#1) goto printf_str::@2 + [104] printf_str::s#5 = phi( printf_str/printf_str::s#6, printf_str::@2/printf_str::s#0 ) + [105] printf_str::c#1 = *printf_str::s#5 + [106] printf_str::s#0 = ++ printf_str::s#5 + [107] if(0!=printf_str::c#1) goto printf_str::@2 to:printf_str::@return printf_str::@return: scope:[printf_str] from printf_str::@1 - [107] return + [108] return to:@return printf_str::@2: scope:[printf_str] from printf_str::@1 - [108] stackpush(char) = printf_str::c#1 - [109] callexecute *printf_str::putc#6 + [109] stackpush(char) = printf_str::c#1 + [110] callexecute *printf_str::putc#6 sideeffect stackpullbytes(1) to:printf_str::@1 void printf_uchar(void (*putc)(char) , char uvalue , char format_min_length , char format_justify_left , char format_sign_always , char format_zero_padding , char format_upper_case , char format_radix) printf_uchar: scope:[printf_uchar] from main::@7 - [111] phi() + [112] phi() to:printf_uchar::@1 printf_uchar::@1: scope:[printf_uchar] from printf_uchar - [112] *((char *)&printf_buffer) = 0 - [113] uctoa::value#1 = printf_uchar::uvalue#0 - [114] call uctoa + [113] *((char *)&printf_buffer) = 0 + [114] uctoa::value#1 = printf_uchar::uvalue#0 + [115] call uctoa to:printf_uchar::@2 printf_uchar::@2: scope:[printf_uchar] from printf_uchar::@1 - [115] printf_number_buffer::buffer_sign#0 = *((char *)&printf_buffer) - [116] call printf_number_buffer + [116] printf_number_buffer::buffer_sign#0 = *((char *)&printf_buffer) + [117] call printf_number_buffer to:printf_uchar::@return printf_uchar::@return: scope:[printf_uchar] from printf_uchar::@2 - [117] return + [118] return to:@return void cscroll() cscroll: scope:[cscroll] from cputln - [118] if(conio_cursor_y!=$19) goto cscroll::@return + [119] if(conio_cursor_y!=$19) goto cscroll::@return to:cscroll::@1 cscroll::@1: scope:[cscroll] from cscroll - [119] if(0!=conio_scroll_enable) goto cscroll::@3 + [120] phi() + [121] call memcpy to:cscroll::@2 cscroll::@2: scope:[cscroll] from cscroll::@1 - [120] phi() - [121] call gotoxy - to:cscroll::@return -cscroll::@return: scope:[cscroll] from cscroll cscroll::@2 cscroll::@7 - [122] return - to:@return -cscroll::@3: scope:[cscroll] from cscroll::@1 - [123] phi() - [124] call memcpy + [122] phi() + [123] call memcpy + to:cscroll::@3 +cscroll::@3: scope:[cscroll] from cscroll::@2 + [124] phi() + [125] call memset to:cscroll::@4 cscroll::@4: scope:[cscroll] from cscroll::@3 - [125] phi() - [126] call memcpy + [126] phi() + [127] call memset to:cscroll::@5 cscroll::@5: scope:[cscroll] from cscroll::@4 - [127] phi() - [128] call memset - to:cscroll::@6 -cscroll::@6: scope:[cscroll] from cscroll::@5 - [129] memset::c#1 = conio_textcolor - [130] call memset - to:cscroll::@7 -cscroll::@7: scope:[cscroll] from cscroll::@6 - [131] conio_line_text = conio_line_text - $28 - [132] conio_line_color = conio_line_color - $28 - [133] conio_cursor_y = -- conio_cursor_y + [128] conio_line_text = conio_line_text - $28 + [129] conio_line_color = conio_line_color - $28 + [130] conio_cursor_y = -- conio_cursor_y to:cscroll::@return +cscroll::@return: scope:[cscroll] from cscroll cscroll::@5 + [131] return + to:@return void uctoa(char value , char *buffer , char radix) uctoa: scope:[uctoa] from printf_uchar::@1 - [134] phi() + [132] phi() to:uctoa::@1 uctoa::@1: scope:[uctoa] from uctoa uctoa::@4 - [135] uctoa::buffer#11 = phi( uctoa::@4/uctoa::buffer#14, uctoa/(char *)&printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS ) - [135] uctoa::started#2 = phi( uctoa::@4/uctoa::started#4, uctoa/0 ) - [135] uctoa::value#2 = phi( uctoa::@4/uctoa::value#6, uctoa/uctoa::value#1 ) - [135] uctoa::digit#2 = phi( uctoa::@4/uctoa::digit#1, uctoa/0 ) - [136] if(uctoa::digit#2=uctoa::digit_value#0) goto uctoa::@5 + [141] if(uctoa::value#2>=uctoa::digit_value#0) goto uctoa::@5 to:uctoa::@4 uctoa::@4: scope:[uctoa] from uctoa::@6 uctoa::@7 - [144] uctoa::buffer#14 = phi( uctoa::@7/uctoa::buffer#11, uctoa::@6/uctoa::buffer#4 ) - [144] uctoa::started#4 = phi( uctoa::@7/uctoa::started#2, uctoa::@6/1 ) - [144] uctoa::value#6 = phi( uctoa::@7/uctoa::value#2, uctoa::@6/uctoa::value#0 ) - [145] uctoa::digit#1 = ++ uctoa::digit#2 + [142] uctoa::buffer#14 = phi( uctoa::@7/uctoa::buffer#11, uctoa::@6/uctoa::buffer#4 ) + [142] uctoa::started#4 = phi( uctoa::@7/uctoa::started#2, uctoa::@6/1 ) + [142] uctoa::value#6 = phi( uctoa::@7/uctoa::value#2, uctoa::@6/uctoa::value#0 ) + [143] uctoa::digit#1 = ++ uctoa::digit#2 to:uctoa::@1 uctoa::@5: scope:[uctoa] from uctoa::@2 uctoa::@7 - [146] uctoa_append::buffer#0 = uctoa::buffer#11 - [147] uctoa_append::value#0 = uctoa::value#2 - [148] uctoa_append::sub#0 = uctoa::digit_value#0 - [149] call uctoa_append - [150] uctoa_append::return#0 = uctoa_append::value#2 + [144] uctoa_append::buffer#0 = uctoa::buffer#11 + [145] uctoa_append::value#0 = uctoa::value#2 + [146] uctoa_append::sub#0 = uctoa::digit_value#0 + [147] call uctoa_append + [148] uctoa_append::return#0 = uctoa_append::value#2 to:uctoa::@6 uctoa::@6: scope:[uctoa] from uctoa::@5 - [151] uctoa::value#0 = uctoa_append::return#0 - [152] uctoa::buffer#4 = ++ uctoa::buffer#11 + [149] uctoa::value#0 = uctoa_append::return#0 + [150] uctoa::buffer#4 = ++ uctoa::buffer#11 to:uctoa::@4 void printf_number_buffer(void (*putc)(char) , char buffer_sign , char *buffer_digits , char format_min_length , char format_justify_left , char format_sign_always , char format_zero_padding , char format_upper_case , char format_radix) printf_number_buffer: scope:[printf_number_buffer] from printf_uchar::@2 - [153] phi() + [151] phi() to:printf_number_buffer::@4 printf_number_buffer::@4: scope:[printf_number_buffer] from printf_number_buffer - [154] phi() - [155] call strlen - [156] strlen::return#2 = strlen::len#2 + [152] phi() + [153] call strlen + [154] strlen::return#2 = strlen::len#2 to:printf_number_buffer::@9 printf_number_buffer::@9: scope:[printf_number_buffer] from printf_number_buffer::@4 - [157] printf_number_buffer::$19 = strlen::return#2 - [158] printf_number_buffer::len#0 = (signed char)printf_number_buffer::$19 - [159] if(0==printf_number_buffer::buffer_sign#0) goto printf_number_buffer::@8 + [155] printf_number_buffer::$19 = strlen::return#2 + [156] printf_number_buffer::len#0 = (signed char)printf_number_buffer::$19 + [157] if(0==printf_number_buffer::buffer_sign#0) goto printf_number_buffer::@8 to:printf_number_buffer::@5 printf_number_buffer::@5: scope:[printf_number_buffer] from printf_number_buffer::@9 - [160] printf_number_buffer::len#1 = ++ printf_number_buffer::len#0 + [158] printf_number_buffer::len#1 = ++ printf_number_buffer::len#0 to:printf_number_buffer::@8 printf_number_buffer::@8: scope:[printf_number_buffer] from printf_number_buffer::@5 printf_number_buffer::@9 - [161] printf_number_buffer::len#2 = phi( printf_number_buffer::@9/printf_number_buffer::len#0, printf_number_buffer::@5/printf_number_buffer::len#1 ) - [162] printf_number_buffer::padding#1 = (signed char)printf_uchar::format_min_length#0 - printf_number_buffer::len#2 - [163] if(printf_number_buffer::padding#1>=0) goto printf_number_buffer::@11 + [159] printf_number_buffer::len#2 = phi( printf_number_buffer::@9/printf_number_buffer::len#0, printf_number_buffer::@5/printf_number_buffer::len#1 ) + [160] printf_number_buffer::padding#1 = (signed char)printf_uchar::format_min_length#0 - printf_number_buffer::len#2 + [161] if(printf_number_buffer::padding#1>=0) goto printf_number_buffer::@11 to:printf_number_buffer::@1 printf_number_buffer::@11: scope:[printf_number_buffer] from printf_number_buffer::@8 - [164] phi() + [162] phi() to:printf_number_buffer::@1 printf_number_buffer::@1: scope:[printf_number_buffer] from printf_number_buffer::@11 printf_number_buffer::@8 - [165] printf_number_buffer::padding#10 = phi( printf_number_buffer::@11/printf_number_buffer::padding#1, printf_number_buffer::@8/0 ) + [163] printf_number_buffer::padding#10 = phi( printf_number_buffer::@11/printf_number_buffer::padding#1, printf_number_buffer::@8/0 ) to:printf_number_buffer::@10 printf_number_buffer::@10: scope:[printf_number_buffer] from printf_number_buffer::@1 - [166] if(0!=printf_number_buffer::padding#10) goto printf_number_buffer::@6 + [164] if(0!=printf_number_buffer::padding#10) goto printf_number_buffer::@6 to:printf_number_buffer::@2 printf_number_buffer::@6: scope:[printf_number_buffer] from printf_number_buffer::@10 - [167] printf_padding::length#0 = (char)printf_number_buffer::padding#10 - [168] call printf_padding + [165] printf_padding::length#0 = (char)printf_number_buffer::padding#10 + [166] call printf_padding to:printf_number_buffer::@2 printf_number_buffer::@2: scope:[printf_number_buffer] from printf_number_buffer::@10 printf_number_buffer::@6 - [169] if(0==printf_number_buffer::buffer_sign#0) goto printf_number_buffer::@3 + [167] if(0==printf_number_buffer::buffer_sign#0) goto printf_number_buffer::@3 to:printf_number_buffer::@7 printf_number_buffer::@7: scope:[printf_number_buffer] from printf_number_buffer::@2 - [170] stackpush(char) = printf_number_buffer::buffer_sign#0 - [171] callexecute cputc + [168] stackpush(char) = printf_number_buffer::buffer_sign#0 + [169] callexecute cputc sideeffect stackpullbytes(1) to:printf_number_buffer::@3 printf_number_buffer::@3: scope:[printf_number_buffer] from printf_number_buffer::@2 printf_number_buffer::@7 - [173] phi() - [174] call printf_str + [171] phi() + [172] call printf_str to:printf_number_buffer::@return printf_number_buffer::@return: scope:[printf_number_buffer] from printf_number_buffer::@3 - [175] return + [173] return to:@return void * memcpy(void *destination , void *source , unsigned int num) -memcpy: scope:[memcpy] from cscroll::@3 cscroll::@4 - [176] memcpy::destination#2 = phi( cscroll::@3/(void *)DEFAULT_SCREEN, cscroll::@4/(void *)COLORRAM ) - [176] memcpy::source#2 = phi( cscroll::@3/(void *)DEFAULT_SCREEN+$28, cscroll::@4/(void *)COLORRAM+$28 ) - [177] memcpy::src_end#0 = (char *)memcpy::source#2 + (unsigned int)$19*$28-$28 - [178] memcpy::src#4 = (char *)memcpy::source#2 - [179] memcpy::dst#4 = (char *)memcpy::destination#2 +memcpy: scope:[memcpy] from cscroll::@1 cscroll::@2 + [174] memcpy::destination#2 = phi( cscroll::@1/(void *)DEFAULT_SCREEN, cscroll::@2/(void *)COLORRAM ) + [174] memcpy::source#2 = phi( cscroll::@1/(void *)DEFAULT_SCREEN+$28, cscroll::@2/(void *)COLORRAM+$28 ) + [175] memcpy::src_end#0 = (char *)memcpy::source#2 + (unsigned int)$19*$28-$28 + [176] memcpy::src#4 = (char *)memcpy::source#2 + [177] memcpy::dst#4 = (char *)memcpy::destination#2 to:memcpy::@1 memcpy::@1: scope:[memcpy] from memcpy memcpy::@2 - [180] memcpy::dst#2 = phi( memcpy/memcpy::dst#4, memcpy::@2/memcpy::dst#1 ) - [180] memcpy::src#2 = phi( memcpy/memcpy::src#4, memcpy::@2/memcpy::src#1 ) - [181] if(memcpy::src#2!=memcpy::src_end#0) goto memcpy::@2 + [178] memcpy::dst#2 = phi( memcpy/memcpy::dst#4, memcpy::@2/memcpy::dst#1 ) + [178] memcpy::src#2 = phi( memcpy/memcpy::src#4, memcpy::@2/memcpy::src#1 ) + [179] if(memcpy::src#2!=memcpy::src_end#0) goto memcpy::@2 to:memcpy::@return memcpy::@return: scope:[memcpy] from memcpy::@1 - [182] return + [180] return to:@return memcpy::@2: scope:[memcpy] from memcpy::@1 - [183] *memcpy::dst#2 = *memcpy::src#2 - [184] memcpy::dst#1 = ++ memcpy::dst#2 - [185] memcpy::src#1 = ++ memcpy::src#2 + [181] *memcpy::dst#2 = *memcpy::src#2 + [182] memcpy::dst#1 = ++ memcpy::dst#2 + [183] memcpy::src#1 = ++ memcpy::src#2 to:memcpy::@1 void * memset(void *str , char c , unsigned int num) -memset: scope:[memset] from cscroll::@5 cscroll::@6 - [186] memset::c#4 = phi( cscroll::@5/' ', cscroll::@6/memset::c#1 ) - [186] memset::str#3 = phi( cscroll::@5/(void *)DEFAULT_SCREEN+(unsigned int)$19*$28-$28, cscroll::@6/(void *)COLORRAM+(unsigned int)$19*$28-$28 ) +memset: scope:[memset] from cscroll::@3 cscroll::@4 + [184] memset::c#4 = phi( cscroll::@3/' ', cscroll::@4/LIGHT_BLUE ) + [184] memset::str#3 = phi( cscroll::@3/(void *)DEFAULT_SCREEN+(unsigned int)$19*$28-$28, cscroll::@4/(void *)COLORRAM+(unsigned int)$19*$28-$28 ) to:memset::@1 memset::@1: scope:[memset] from memset - [187] memset::end#0 = (char *)memset::str#3 + $28 - [188] memset::dst#4 = (char *)memset::str#3 + [185] memset::end#0 = (char *)memset::str#3 + $28 + [186] memset::dst#4 = (char *)memset::str#3 to:memset::@2 memset::@2: scope:[memset] from memset::@1 memset::@3 - [189] memset::dst#2 = phi( memset::@1/memset::dst#4, memset::@3/memset::dst#1 ) - [190] if(memset::dst#2!=memset::end#0) goto memset::@3 + [187] memset::dst#2 = phi( memset::@1/memset::dst#4, memset::@3/memset::dst#1 ) + [188] if(memset::dst#2!=memset::end#0) goto memset::@3 to:memset::@return memset::@return: scope:[memset] from memset::@2 - [191] return + [189] return to:@return memset::@3: scope:[memset] from memset::@2 - [192] *memset::dst#2 = memset::c#4 - [193] memset::dst#1 = ++ memset::dst#2 + [190] *memset::dst#2 = memset::c#4 + [191] memset::dst#1 = ++ memset::dst#2 to:memset::@2 char uctoa_append(char *buffer , char value , char sub) uctoa_append: scope:[uctoa_append] from uctoa::@5 - [194] phi() + [192] phi() to:uctoa_append::@1 uctoa_append::@1: scope:[uctoa_append] from uctoa_append uctoa_append::@2 - [195] uctoa_append::digit#2 = phi( uctoa_append/0, uctoa_append::@2/uctoa_append::digit#1 ) - [195] uctoa_append::value#2 = phi( uctoa_append/uctoa_append::value#0, uctoa_append::@2/uctoa_append::value#1 ) - [196] if(uctoa_append::value#2>=uctoa_append::sub#0) goto uctoa_append::@2 + [193] uctoa_append::digit#2 = phi( uctoa_append/0, uctoa_append::@2/uctoa_append::digit#1 ) + [193] uctoa_append::value#2 = phi( uctoa_append/uctoa_append::value#0, uctoa_append::@2/uctoa_append::value#1 ) + [194] if(uctoa_append::value#2>=uctoa_append::sub#0) goto uctoa_append::@2 to:uctoa_append::@3 uctoa_append::@3: scope:[uctoa_append] from uctoa_append::@1 - [197] *uctoa_append::buffer#0 = DIGITS[uctoa_append::digit#2] + [195] *uctoa_append::buffer#0 = DIGITS[uctoa_append::digit#2] to:uctoa_append::@return uctoa_append::@return: scope:[uctoa_append] from uctoa_append::@3 - [198] return + [196] return to:@return uctoa_append::@2: scope:[uctoa_append] from uctoa_append::@1 - [199] uctoa_append::digit#1 = ++ uctoa_append::digit#2 - [200] uctoa_append::value#1 = uctoa_append::value#2 - uctoa_append::sub#0 + [197] uctoa_append::digit#1 = ++ uctoa_append::digit#2 + [198] uctoa_append::value#1 = uctoa_append::value#2 - uctoa_append::sub#0 to:uctoa_append::@1 unsigned int strlen(char *str) strlen: scope:[strlen] from printf_number_buffer::@4 - [201] phi() + [199] phi() to:strlen::@1 strlen::@1: scope:[strlen] from strlen strlen::@2 - [202] strlen::len#2 = phi( strlen/0, strlen::@2/strlen::len#1 ) - [202] strlen::str#2 = phi( strlen/printf_number_buffer::buffer_digits#0, strlen::@2/strlen::str#0 ) - [203] if(0!=*strlen::str#2) goto strlen::@2 + [200] strlen::len#2 = phi( strlen/0, strlen::@2/strlen::len#1 ) + [200] strlen::str#2 = phi( strlen/printf_number_buffer::buffer_digits#0, strlen::@2/strlen::str#0 ) + [201] if(0!=*strlen::str#2) goto strlen::@2 to:strlen::@return strlen::@return: scope:[strlen] from strlen::@1 - [204] return + [202] return to:@return strlen::@2: scope:[strlen] from strlen::@1 - [205] strlen::len#1 = ++ strlen::len#2 - [206] strlen::str#0 = ++ strlen::str#2 + [203] strlen::len#1 = ++ strlen::len#2 + [204] strlen::str#0 = ++ strlen::str#2 to:strlen::@1 void printf_padding(void (*putc)(char) , char pad , char length) printf_padding: scope:[printf_padding] from printf_number_buffer::@6 - [207] phi() + [205] phi() to:printf_padding::@1 printf_padding::@1: scope:[printf_padding] from printf_padding printf_padding::@3 - [208] printf_padding::i#2 = phi( printf_padding/0, printf_padding::@3/printf_padding::i#1 ) - [209] if(printf_padding::i#2DEFAULT_SCREEN sta.z conio_line_text+1 - // [2] conio_line_color = COLORRAM -- pbuz1=pbuc1 + // [4] conio_line_color = COLORRAM -- pbuz1=pbuc1 lda #COLORRAM sta.z conio_line_color+1 - // [3] call conio_c64_init + // [5] call conio_c64_init jsr conio_c64_init - // [4] phi from __start::__init1 to __start::@1 [phi:__start::__init1->__start::@1] + // [6] phi from __start::__init1 to __start::@1 [phi:__start::__init1->__start::@1] __b1_from___init1: jmp __b1 // __start::@1 __b1: - // [5] call main - // [25] phi from __start::@1 to main [phi:__start::@1->main] + // [7] call main + // [27] phi from __start::@1 to main [phi:__start::@1->main] main_from___b1: jsr main jmp __breturn // __start::@return __breturn: - // [6] return + // [8] return rts } // conio_c64_init @@ -4682,37 +4501,34 @@ __start: { conio_c64_init: { // Position cursor at current line .label BASIC_CURSOR_LINE = $d6 - // [7] conio_c64_init::line#0 = *conio_c64_init::BASIC_CURSOR_LINE -- vbuxx=_deref_pbuc1 + // [9] conio_c64_init::line#0 = *conio_c64_init::BASIC_CURSOR_LINE -- vbuxx=_deref_pbuc1 ldx BASIC_CURSOR_LINE - // [8] if(conio_c64_init::line#0<$19) goto conio_c64_init::@2 -- vbuxx_lt_vbuc1_then_la1 + // [10] if(conio_c64_init::line#0<$19) goto conio_c64_init::@2 -- vbuxx_lt_vbuc1_then_la1 cpx #$19 bcc __b2_from_conio_c64_init - // [10] phi from conio_c64_init to conio_c64_init::@1 [phi:conio_c64_init->conio_c64_init::@1] + // [12] phi from conio_c64_init to conio_c64_init::@1 [phi:conio_c64_init->conio_c64_init::@1] __b1_from_conio_c64_init: - // [10] phi conio_c64_init::line#2 = $19-1 [phi:conio_c64_init->conio_c64_init::@1#0] -- vbuxx=vbuc1 + // [12] phi conio_c64_init::line#2 = $19-1 [phi:conio_c64_init->conio_c64_init::@1#0] -- vbuxx=vbuc1 ldx #$19-1 jmp __b1 - // [9] phi from conio_c64_init to conio_c64_init::@2 [phi:conio_c64_init->conio_c64_init::@2] + // [11] phi from conio_c64_init to conio_c64_init::@2 [phi:conio_c64_init->conio_c64_init::@2] __b2_from_conio_c64_init: jmp __b2 // conio_c64_init::@2 __b2: - // [10] phi from conio_c64_init::@2 to conio_c64_init::@1 [phi:conio_c64_init::@2->conio_c64_init::@1] + // [12] phi from conio_c64_init::@2 to conio_c64_init::@1 [phi:conio_c64_init::@2->conio_c64_init::@1] __b1_from___b2: - // [10] phi conio_c64_init::line#2 = conio_c64_init::line#0 [phi:conio_c64_init::@2->conio_c64_init::@1#0] -- register_copy + // [12] phi conio_c64_init::line#2 = conio_c64_init::line#0 [phi:conio_c64_init::@2->conio_c64_init::@1#0] -- register_copy jmp __b1 // conio_c64_init::@1 __b1: - // [11] gotoxy::y#2 = conio_c64_init::line#2 - // [12] call gotoxy - // [49] phi from conio_c64_init::@1 to gotoxy [phi:conio_c64_init::@1->gotoxy] - gotoxy_from___b1: - // [49] phi gotoxy::y#3 = gotoxy::y#2 [phi:conio_c64_init::@1->gotoxy#0] -- register_copy + // [13] gotoxy::y#2 = conio_c64_init::line#2 + // [14] call gotoxy jsr gotoxy jmp __breturn // conio_c64_init::@return __breturn: - // [13] return + // [15] return rts } // cputc @@ -4721,46 +4537,46 @@ conio_c64_init: { // void cputc(__register(A) char c) cputc: { .const OFFSET_STACK_C = 0 - // [14] cputc::c#0 = stackidx(char,cputc::OFFSET_STACK_C) -- vbuaa=_stackidxbyte_vbuc1 + // [16] cputc::c#0 = stackidx(char,cputc::OFFSET_STACK_C) -- vbuaa=_stackidxbyte_vbuc1 tsx lda STACK_BASE+OFFSET_STACK_C,x - // [15] if(cputc::c#0==' ') goto cputc::@1 -- vbuaa_eq_vbuc1_then_la1 + // [17] if(cputc::c#0==' ') goto cputc::@1 -- vbuaa_eq_vbuc1_then_la1 cmp #'\n' beq __b1_from_cputc jmp __b2 // cputc::@2 __b2: - // [16] conio_line_text[conio_cursor_x] = cputc::c#0 -- pbuz1_derefidx_vbum2=vbuaa - ldy conio_cursor_x + // [18] conio_line_text[conio_cursor_x] = cputc::c#0 -- pbuz1_derefidx_vbuz2=vbuaa + ldy.z conio_cursor_x sta (conio_line_text),y - // [17] conio_line_color[conio_cursor_x] = conio_textcolor -- pbuz1_derefidx_vbum2=vbum3 - lda conio_textcolor - ldy conio_cursor_x + // [19] conio_line_color[conio_cursor_x] = LIGHT_BLUE -- pbuz1_derefidx_vbuz2=vbuc1 + lda #LIGHT_BLUE + ldy.z conio_cursor_x sta (conio_line_color),y - // [18] conio_cursor_x = ++ conio_cursor_x -- vbum1=_inc_vbum1 - inc conio_cursor_x - // [19] if(conio_cursor_x!=$28) goto cputc::@return -- vbum1_neq_vbuc1_then_la1 + // [20] conio_cursor_x = ++ conio_cursor_x -- vbuz1=_inc_vbuz1 + inc.z conio_cursor_x + // [21] if(conio_cursor_x!=$28) goto cputc::@return -- vbuz1_neq_vbuc1_then_la1 lda #$28 - cmp conio_cursor_x + cmp.z conio_cursor_x bne __breturn - // [20] phi from cputc::@2 to cputc::@3 [phi:cputc::@2->cputc::@3] + // [22] phi from cputc::@2 to cputc::@3 [phi:cputc::@2->cputc::@3] __b3_from___b2: jmp __b3 // cputc::@3 __b3: - // [21] call cputln + // [23] call cputln jsr cputln jmp __breturn // cputc::@return __breturn: - // [22] return + // [24] return rts - // [23] phi from cputc to cputc::@1 [phi:cputc->cputc::@1] + // [25] phi from cputc to cputc::@1 [phi:cputc->cputc::@1] __b1_from_cputc: jmp __b1 // cputc::@1 __b1: - // [24] call cputln + // [26] call cputln jsr cputln jmp __breturn } @@ -4768,7 +4584,10 @@ cputc: { // Show the currently pressed key main: { .const toD0181_return = (>(DEFAULT_SCREEN&$3fff)*4)|(>DEFAULT_FONT_MIXED)/4&$f - // [26] phi from main to main::toD0181 [phi:main->main::toD0181] + .label __6 = $14 + .label ch = $17 + .label current = $16 + // [28] phi from main to main::toD0181 [phi:main->main::toD0181] toD0181_from_main: jmp toD0181 // main::toD0181 @@ -4776,68 +4595,68 @@ main: { jmp __b3 // main::@3 __b3: - // [27] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_MEMORY) = main::toD0181_return#0 -- _deref_pbuc1=vbuc2 + // [29] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_MEMORY) = main::toD0181_return#0 -- _deref_pbuc1=vbuc2 lda #toD0181_return sta VICII+OFFSET_STRUCT_MOS6569_VICII_MEMORY - // [28] call clrscr - // [70] phi from main::@3 to clrscr [phi:main::@3->clrscr] + // [30] call clrscr + // [71] phi from main::@3 to clrscr [phi:main::@3->clrscr] clrscr_from___b3: jsr clrscr - // [29] phi from main::@3 to main::@1 [phi:main::@3->main::@1] + // [31] phi from main::@3 to main::@1 [phi:main::@3->main::@1] __b1_from___b3: - // [29] phi main::current#2 = 0 [phi:main::@3->main::@1#0] -- vbum1=vbuc1 + // [31] phi main::current#2 = 0 [phi:main::@3->main::@1#0] -- vbuz1=vbuc1 lda #0 - sta current + sta.z current jmp __b1 - // [29] phi from main::@4 main::@9 to main::@1 [phi:main::@4/main::@9->main::@1] + // [31] phi from main::@4 main::@9 to main::@1 [phi:main::@4/main::@9->main::@1] __b1_from___b4: __b1_from___b9: - // [29] phi main::current#2 = main::current#2 [phi:main::@4/main::@9->main::@1#0] -- register_copy + // [31] phi main::current#2 = main::current#2 [phi:main::@4/main::@9->main::@1#0] -- register_copy jmp __b1 // main::@1 __b1: - // [30] call GETIN + // [32] call GETIN jsr GETIN - // [31] GETIN::return#0 = GETIN::return#1 + // [33] GETIN::return#0 = GETIN::return#1 jmp __b4 // main::@4 __b4: - // [32] main::ch#0 = GETIN::return#0 -- vbum1=vbuaa - sta ch - // [33] if(0==main::ch#0) goto main::@1 -- 0_eq_vbum1_then_la1 - lda ch + // [34] main::ch#0 = GETIN::return#0 -- vbuz1=vbuaa + sta.z ch + // [35] if(0==main::ch#0) goto main::@1 -- 0_eq_vbuz1_then_la1 + lda.z ch beq __b1_from___b4 jmp __b10 // main::@10 __b10: - // [34] if(main::ch#0!=main::current#2) goto main::@2 -- vbum1_neq_vbum2_then_la1 - lda ch - cmp current + // [36] if(main::ch#0!=main::current#2) goto main::@2 -- vbuz1_neq_vbuz2_then_la1 + lda.z ch + cmp.z current bne __b2 - // [29] phi from main::@10 to main::@1 [phi:main::@10->main::@1] + // [31] phi from main::@10 to main::@1 [phi:main::@10->main::@1] __b1_from___b10: jmp __b1 // main::@2 __b2: - // [35] petscii_to_screencode::petscii#0 = main::ch#0 -- vbuaa=vbum1 - lda ch - // [36] call petscii_to_screencode + // [37] petscii_to_screencode::petscii#0 = main::ch#0 -- vbuaa=vbuz1 + lda.z ch + // [38] call petscii_to_screencode jsr petscii_to_screencode - // [37] petscii_to_screencode::return#0 = petscii_to_screencode::return#10 + // [39] petscii_to_screencode::return#0 = petscii_to_screencode::return#10 jmp __b5 // main::@5 __b5: - // [38] main::$6 = petscii_to_screencode::return#0 -- vbum1=vbuaa - sta __6 - // [39] call printf_str - // [102] phi from main::@5 to printf_str [phi:main::@5->printf_str] + // [40] main::$6 = petscii_to_screencode::return#0 -- vbuz1=vbuaa + sta.z __6 + // [41] call printf_str + // [103] phi from main::@5 to printf_str [phi:main::@5->printf_str] printf_str_from___b5: - // [102] phi printf_str::putc#6 = &cputc [phi:main::@5->printf_str#0] -- pprz1=pprc1 + // [103] phi printf_str::putc#6 = &cputc [phi:main::@5->printf_str#0] -- pprz1=pprc1 lda #cputc sta.z printf_str.putc+1 - // [102] phi printf_str::s#6 = main::s [phi:main::@5->printf_str#1] -- pbuz1=pbuc1 + // [103] phi printf_str::s#6 = main::s [phi:main::@5->printf_str#1] -- pbuz1=pbuc1 lda #s @@ -4846,22 +4665,22 @@ main: { jmp __b6 // main::@6 __b6: - // [40] stackpush(char) = main::$6 -- _stackpushbyte_=vbum1 - lda __6 + // [42] stackpush(char) = main::$6 -- _stackpushbyte_=vbuz1 + lda.z __6 pha - // [41] callexecute cputc -- call_vprc1 + // [43] callexecute cputc -- call_vprc1 jsr cputc // sideeffect stackpullbytes(1) -- _stackpullbyte_1 pla - // [43] call printf_str - // [102] phi from main::@6 to printf_str [phi:main::@6->printf_str] + // [45] call printf_str + // [103] phi from main::@6 to printf_str [phi:main::@6->printf_str] printf_str_from___b6: - // [102] phi printf_str::putc#6 = &cputc [phi:main::@6->printf_str#0] -- pprz1=pprc1 + // [103] phi printf_str::putc#6 = &cputc [phi:main::@6->printf_str#0] -- pprz1=pprc1 lda #cputc sta.z printf_str.putc+1 - // [102] phi printf_str::s#6 = main::s1 [phi:main::@6->printf_str#1] -- pbuz1=pbuc1 + // [103] phi printf_str::s#6 = main::s1 [phi:main::@6->printf_str#1] -- pbuz1=pbuc1 lda #s1 @@ -4870,26 +4689,26 @@ main: { jmp __b7 // main::@7 __b7: - // [44] printf_uchar::uvalue#0 = main::ch#0 -- vbuxx=vbum1 - ldx ch - // [45] call printf_uchar - // [111] phi from main::@7 to printf_uchar [phi:main::@7->printf_uchar] + // [46] printf_uchar::uvalue#0 = main::ch#0 -- vbuxx=vbuz1 + ldx.z ch + // [47] call printf_uchar + // [112] phi from main::@7 to printf_uchar [phi:main::@7->printf_uchar] printf_uchar_from___b7: jsr printf_uchar - // [46] phi from main::@7 to main::@8 [phi:main::@7->main::@8] + // [48] phi from main::@7 to main::@8 [phi:main::@7->main::@8] __b8_from___b7: jmp __b8 // main::@8 __b8: - // [47] call printf_str - // [102] phi from main::@8 to printf_str [phi:main::@8->printf_str] + // [49] call printf_str + // [103] phi from main::@8 to printf_str [phi:main::@8->printf_str] printf_str_from___b8: - // [102] phi printf_str::putc#6 = &cputc [phi:main::@8->printf_str#0] -- pprz1=pprc1 + // [103] phi printf_str::putc#6 = &cputc [phi:main::@8->printf_str#0] -- pprz1=pprc1 lda #cputc sta.z printf_str.putc+1 - // [102] phi printf_str::s#6 = main::s2 [phi:main::@8->printf_str#1] -- pbuz1=pbuc1 + // [103] phi printf_str::s#6 = main::s2 [phi:main::@8->printf_str#1] -- pbuz1=pbuc1 lda #s2 @@ -4898,9 +4717,9 @@ main: { jmp __b9 // main::@9 __b9: - // [48] main::current#4 = main::ch#0 -- vbum1=vbum2 - lda ch - sta current + // [50] main::current#4 = main::ch#0 -- vbuz1=vbuz2 + lda.z ch + sta.z current jmp __b1_from___b9 .segment Data s: .text "'" @@ -4909,95 +4728,97 @@ main: { .byte 0 s2: .text ") " .byte 0 - __6: .byte 0 - ch: .byte 0 - current: .byte 0 } .segment Code // gotoxy // Set the cursor to the specified position // void gotoxy(char x, __register(X) char y) gotoxy: { - .label __5 = 8 - .label __6 = $a - // [50] if(gotoxy::y#3<$19+1) goto gotoxy::@3 -- vbuxx_lt_vbuc1_then_la1 + .const x = 0 + .label __5 = $1c + .label __6 = $18 + .label __7 = $18 + .label line_offset = $18 + .label __8 = $1a + .label __9 = $18 + // [51] if(gotoxy::y#2<$19+1) goto gotoxy::@3 -- vbuxx_lt_vbuc1_then_la1 cpx #$19+1 bcc __b3_from_gotoxy - // [52] phi from gotoxy to gotoxy::@1 [phi:gotoxy->gotoxy::@1] + // [53] phi from gotoxy to gotoxy::@1 [phi:gotoxy->gotoxy::@1] __b1_from_gotoxy: - // [52] phi gotoxy::y#4 = 0 [phi:gotoxy->gotoxy::@1#0] -- vbuxx=vbuc1 + // [53] phi gotoxy::y#4 = 0 [phi:gotoxy->gotoxy::@1#0] -- vbuxx=vbuc1 ldx #0 jmp __b1 - // [51] phi from gotoxy to gotoxy::@3 [phi:gotoxy->gotoxy::@3] + // [52] phi from gotoxy to gotoxy::@3 [phi:gotoxy->gotoxy::@3] __b3_from_gotoxy: jmp __b3 // gotoxy::@3 __b3: - // [52] phi from gotoxy::@3 to gotoxy::@1 [phi:gotoxy::@3->gotoxy::@1] + // [53] phi from gotoxy::@3 to gotoxy::@1 [phi:gotoxy::@3->gotoxy::@1] __b1_from___b3: - // [52] phi gotoxy::y#4 = gotoxy::y#3 [phi:gotoxy::@3->gotoxy::@1#0] -- register_copy + // [53] phi gotoxy::y#4 = gotoxy::y#2 [phi:gotoxy::@3->gotoxy::@1#0] -- register_copy jmp __b1 // gotoxy::@1 __b1: jmp __b2 // gotoxy::@2 __b2: - // [53] conio_cursor_x = 0 -- vbum1=vbuc1 - lda #0 - sta conio_cursor_x - // [54] conio_cursor_y = gotoxy::y#4 -- vbum1=vbuxx - stx conio_cursor_y - // [55] gotoxy::$7 = (unsigned int)gotoxy::y#4 -- vwum1=_word_vbuxx + // [54] conio_cursor_x = gotoxy::x#2 -- vbuz1=vbuc1 + lda #x + sta.z conio_cursor_x + // [55] conio_cursor_y = gotoxy::y#4 -- vbuz1=vbuxx + stx.z conio_cursor_y + // [56] gotoxy::$7 = (unsigned int)gotoxy::y#4 -- vwuz1=_word_vbuxx txa - sta __7 + sta.z __7 lda #0 - sta __7+1 - // [56] gotoxy::$8 = gotoxy::$7 << 2 -- vwum1=vwum2_rol_2 - lda __7 + sta.z __7+1 + // [57] gotoxy::$8 = gotoxy::$7 << 2 -- vwuz1=vwuz2_rol_2 + lda.z __7 asl - sta __8 - lda __7+1 + sta.z __8 + lda.z __7+1 rol - sta __8+1 - asl __8 - rol __8+1 - // [57] gotoxy::$9 = gotoxy::$8 + gotoxy::$7 -- vwum1=vwum2_plus_vwum1 + sta.z __8+1 + asl.z __8 + rol.z __8+1 + // [58] gotoxy::$9 = gotoxy::$8 + gotoxy::$7 -- vwuz1=vwuz2_plus_vwuz1 clc - lda __9 - adc __8 - sta __9 - lda __9+1 - adc __8+1 - sta __9+1 - // [58] gotoxy::line_offset#0 = gotoxy::$9 << 3 -- vwum1=vwum1_rol_3 - asl line_offset - rol line_offset+1 - asl line_offset - rol line_offset+1 - asl line_offset - rol line_offset+1 - // [59] gotoxy::$5 = DEFAULT_SCREEN + gotoxy::line_offset#0 -- pbuz1=pbuc1_plus_vwum2 - lda line_offset + lda.z __9 + adc.z __8 + sta.z __9 + lda.z __9+1 + adc.z __8+1 + sta.z __9+1 + // [59] gotoxy::line_offset#0 = gotoxy::$9 << 3 -- vwuz1=vwuz1_rol_3 + asl.z line_offset + rol.z line_offset+1 + asl.z line_offset + rol.z line_offset+1 + asl.z line_offset + rol.z line_offset+1 + // [60] gotoxy::$5 = DEFAULT_SCREEN + gotoxy::line_offset#0 -- pbuz1=pbuc1_plus_vwuz2 + lda.z line_offset clc adc #DEFAULT_SCREEN sta.z __5+1 - // [60] conio_line_text = gotoxy::$5 -- pbuz1=pbuz2 + // [61] conio_line_text = gotoxy::$5 -- pbuz1=pbuz2 lda.z __5 sta.z conio_line_text lda.z __5+1 sta.z conio_line_text+1 - // [61] gotoxy::$6 = COLORRAM + gotoxy::line_offset#0 -- pbuz1=pbuc1_plus_vwum2 - lda line_offset + // [62] gotoxy::$6 = COLORRAM + gotoxy::line_offset#0 -- pbuz1=pbuc1_plus_vwuz1 + lda.z __6 clc adc #COLORRAM sta.z __6+1 - // [62] conio_line_color = gotoxy::$6 -- pbuz1=pbuz2 + // [63] conio_line_color = gotoxy::$6 -- pbuz1=pbuz2 lda.z __6 sta.z conio_line_color lda.z __6+1 @@ -5005,19 +4826,13 @@ gotoxy: { jmp __breturn // gotoxy::@return __breturn: - // [63] return + // [64] return rts - .segment Data - __7: .word 0 - .label line_offset = __7 - __8: .word 0 - .label __9 = __7 } -.segment Code // cputln // Print a newline cputln: { - // [64] conio_line_text = conio_line_text + $28 -- pbuz1=pbuz1_plus_vbuc1 + // [65] conio_line_text = conio_line_text + $28 -- pbuz1=pbuz1_plus_vbuc1 lda #$28 clc adc.z conio_line_text @@ -5025,7 +4840,7 @@ cputln: { bcc !+ inc.z conio_line_text+1 !: - // [65] conio_line_color = conio_line_color + $28 -- pbuz1=pbuz1_plus_vbuc1 + // [66] conio_line_color = conio_line_color + $28 -- pbuz1=pbuz1_plus_vbuc1 lda #$28 clc adc.z conio_line_color @@ -5033,59 +4848,59 @@ cputln: { bcc !+ inc.z conio_line_color+1 !: - // [66] conio_cursor_x = 0 -- vbum1=vbuc1 + // [67] conio_cursor_x = 0 -- vbuz1=vbuc1 lda #0 - sta conio_cursor_x - // [67] conio_cursor_y = ++ conio_cursor_y -- vbum1=_inc_vbum1 - inc conio_cursor_y - // [68] call cscroll + sta.z conio_cursor_x + // [68] conio_cursor_y = ++ conio_cursor_y -- vbuz1=_inc_vbuz1 + inc.z conio_cursor_y + // [69] call cscroll jsr cscroll jmp __breturn // cputln::@return __breturn: - // [69] return + // [70] return rts } // clrscr // clears the screen and moves the cursor to the upper left-hand corner of the screen. clrscr: { .label line_text = $10 - .label line_cols = $12 - // [71] phi from clrscr to clrscr::@1 [phi:clrscr->clrscr::@1] + .label line_cols = $e + // [72] phi from clrscr to clrscr::@1 [phi:clrscr->clrscr::@1] __b1_from_clrscr: - // [71] phi clrscr::line_cols#5 = COLORRAM [phi:clrscr->clrscr::@1#0] -- pbuz1=pbuc1 + // [72] phi clrscr::line_cols#5 = COLORRAM [phi:clrscr->clrscr::@1#0] -- pbuz1=pbuc1 lda #COLORRAM sta.z line_cols+1 - // [71] phi clrscr::line_text#5 = DEFAULT_SCREEN [phi:clrscr->clrscr::@1#1] -- pbuz1=pbuc1 + // [72] phi clrscr::line_text#5 = DEFAULT_SCREEN [phi:clrscr->clrscr::@1#1] -- pbuz1=pbuc1 lda #DEFAULT_SCREEN sta.z line_text+1 - // [71] phi clrscr::l#2 = 0 [phi:clrscr->clrscr::@1#2] -- vbuxx=vbuc1 + // [72] phi clrscr::l#2 = 0 [phi:clrscr->clrscr::@1#2] -- vbuxx=vbuc1 ldx #0 jmp __b1 // clrscr::@1 __b1: - // [72] if(clrscr::l#2<$19) goto clrscr::@3 -- vbuxx_lt_vbuc1_then_la1 + // [73] if(clrscr::l#2<$19) goto clrscr::@3 -- vbuxx_lt_vbuc1_then_la1 cpx #$19 bcc __b3_from___b1 jmp __b2 // clrscr::@2 __b2: - // [73] conio_cursor_x = 0 -- vbum1=vbuc1 + // [74] conio_cursor_x = 0 -- vbuz1=vbuc1 lda #0 - sta conio_cursor_x - // [74] conio_cursor_y = 0 -- vbum1=vbuc1 + sta.z conio_cursor_x + // [75] conio_cursor_y = 0 -- vbuz1=vbuc1 lda #0 - sta conio_cursor_y - // [75] conio_line_text = DEFAULT_SCREEN -- pbuz1=pbuc1 + sta.z conio_cursor_y + // [76] conio_line_text = DEFAULT_SCREEN -- pbuz1=pbuc1 lda #DEFAULT_SCREEN sta.z conio_line_text+1 - // [76] conio_line_color = COLORRAM -- pbuz1=pbuc1 + // [77] conio_line_color = COLORRAM -- pbuz1=pbuc1 lda #COLORRAM @@ -5093,22 +4908,22 @@ clrscr: { jmp __breturn // clrscr::@return __breturn: - // [77] return + // [78] return rts - // [78] phi from clrscr::@1 to clrscr::@3 [phi:clrscr::@1->clrscr::@3] + // [79] phi from clrscr::@1 to clrscr::@3 [phi:clrscr::@1->clrscr::@3] __b3_from___b1: - // [78] phi clrscr::c#2 = 0 [phi:clrscr::@1->clrscr::@3#0] -- vbuyy=vbuc1 + // [79] phi clrscr::c#2 = 0 [phi:clrscr::@1->clrscr::@3#0] -- vbuyy=vbuc1 ldy #0 jmp __b3 // clrscr::@3 __b3: - // [79] if(clrscr::c#2<$28) goto clrscr::@4 -- vbuyy_lt_vbuc1_then_la1 + // [80] if(clrscr::c#2<$28) goto clrscr::@4 -- vbuyy_lt_vbuc1_then_la1 cpy #$28 bcc __b4 jmp __b5 // clrscr::@5 __b5: - // [80] clrscr::line_text#1 = clrscr::line_text#5 + $28 -- pbuz1=pbuz1_plus_vbuc1 + // [81] clrscr::line_text#1 = clrscr::line_text#5 + $28 -- pbuz1=pbuz1_plus_vbuc1 lda #$28 clc adc.z line_text @@ -5116,7 +4931,7 @@ clrscr: { bcc !+ inc.z line_text+1 !: - // [81] clrscr::line_cols#1 = clrscr::line_cols#5 + $28 -- pbuz1=pbuz1_plus_vbuc1 + // [82] clrscr::line_cols#1 = clrscr::line_cols#5 + $28 -- pbuz1=pbuz1_plus_vbuc1 lda #$28 clc adc.z line_cols @@ -5124,27 +4939,27 @@ clrscr: { bcc !+ inc.z line_cols+1 !: - // [82] clrscr::l#1 = ++ clrscr::l#2 -- vbuxx=_inc_vbuxx + // [83] clrscr::l#1 = ++ clrscr::l#2 -- vbuxx=_inc_vbuxx inx - // [71] phi from clrscr::@5 to clrscr::@1 [phi:clrscr::@5->clrscr::@1] + // [72] phi from clrscr::@5 to clrscr::@1 [phi:clrscr::@5->clrscr::@1] __b1_from___b5: - // [71] phi clrscr::line_cols#5 = clrscr::line_cols#1 [phi:clrscr::@5->clrscr::@1#0] -- register_copy - // [71] phi clrscr::line_text#5 = clrscr::line_text#1 [phi:clrscr::@5->clrscr::@1#1] -- register_copy - // [71] phi clrscr::l#2 = clrscr::l#1 [phi:clrscr::@5->clrscr::@1#2] -- register_copy + // [72] phi clrscr::line_cols#5 = clrscr::line_cols#1 [phi:clrscr::@5->clrscr::@1#0] -- register_copy + // [72] phi clrscr::line_text#5 = clrscr::line_text#1 [phi:clrscr::@5->clrscr::@1#1] -- register_copy + // [72] phi clrscr::l#2 = clrscr::l#1 [phi:clrscr::@5->clrscr::@1#2] -- register_copy jmp __b1 // clrscr::@4 __b4: - // [83] clrscr::line_text#5[clrscr::c#2] = ' ' -- pbuz1_derefidx_vbuyy=vbuc1 + // [84] clrscr::line_text#5[clrscr::c#2] = ' ' -- pbuz1_derefidx_vbuyy=vbuc1 lda #' ' sta (line_text),y - // [84] clrscr::line_cols#5[clrscr::c#2] = conio_textcolor -- pbuz1_derefidx_vbuyy=vbum2 - lda conio_textcolor + // [85] clrscr::line_cols#5[clrscr::c#2] = LIGHT_BLUE -- pbuz1_derefidx_vbuyy=vbuc1 + lda #LIGHT_BLUE sta (line_cols),y - // [85] clrscr::c#1 = ++ clrscr::c#2 -- vbuyy=_inc_vbuyy + // [86] clrscr::c#1 = ++ clrscr::c#2 -- vbuyy=_inc_vbuyy iny - // [78] phi from clrscr::@4 to clrscr::@3 [phi:clrscr::@4->clrscr::@3] + // [79] phi from clrscr::@4 to clrscr::@3 [phi:clrscr::@4->clrscr::@3] __b3_from___b4: - // [78] phi clrscr::c#2 = clrscr::c#1 [phi:clrscr::@4->clrscr::@3#0] -- register_copy + // [79] phi clrscr::c#2 = clrscr::c#1 [phi:clrscr::@4->clrscr::@3#0] -- register_copy jmp __b3 } // GETIN @@ -5155,133 +4970,133 @@ GETIN: { // asm { jsr$ffe4 stach } jsr $ffe4 sta ch - // [87] GETIN::return#1 = *GETIN::ch -- vbuaa=_deref_pbuc1 + // [88] GETIN::return#1 = *GETIN::ch -- vbuaa=_deref_pbuc1 lda ch jmp __breturn // GETIN::@return __breturn: - // [88] return + // [89] return rts } // petscii_to_screencode // Convert a PETSCII char to screencode // __register(A) char petscii_to_screencode(__register(A) char petscii) petscii_to_screencode: { - // [89] if(petscii_to_screencode::petscii#0<$20) goto petscii_to_screencode::@1 -- vbuaa_lt_vbuc1_then_la1 + // [90] if(petscii_to_screencode::petscii#0<$20) goto petscii_to_screencode::@1 -- vbuaa_lt_vbuc1_then_la1 cmp #$20 bcc __b1 jmp __b6 // petscii_to_screencode::@6 __b6: - // [90] if(petscii_to_screencode::petscii#0<$40) goto petscii_to_screencode::@return -- vbuaa_lt_vbuc1_then_la1 + // [91] if(petscii_to_screencode::petscii#0<$40) goto petscii_to_screencode::@return -- vbuaa_lt_vbuc1_then_la1 cmp #$40 bcc __breturn_from___b6 jmp __b7 // petscii_to_screencode::@7 __b7: - // [91] if(petscii_to_screencode::petscii#0<$60) goto petscii_to_screencode::@2 -- vbuaa_lt_vbuc1_then_la1 + // [92] if(petscii_to_screencode::petscii#0<$60) goto petscii_to_screencode::@2 -- vbuaa_lt_vbuc1_then_la1 cmp #$60 bcc __b2 jmp __b8 // petscii_to_screencode::@8 __b8: - // [92] if(petscii_to_screencode::petscii#0<$80) goto petscii_to_screencode::@3 -- vbuaa_lt_vbuc1_then_la1 + // [93] if(petscii_to_screencode::petscii#0<$80) goto petscii_to_screencode::@3 -- vbuaa_lt_vbuc1_then_la1 cmp #$80 bcc __b3 jmp __b9 // petscii_to_screencode::@9 __b9: - // [93] if(petscii_to_screencode::petscii#0<$a0) goto petscii_to_screencode::@4 -- vbuaa_lt_vbuc1_then_la1 + // [94] if(petscii_to_screencode::petscii#0<$a0) goto petscii_to_screencode::@4 -- vbuaa_lt_vbuc1_then_la1 cmp #$a0 bcc __b4 jmp __b10 // petscii_to_screencode::@10 __b10: - // [94] if(petscii_to_screencode::petscii#0<$ff) goto petscii_to_screencode::@5 -- vbuaa_lt_vbuc1_then_la1 + // [95] if(petscii_to_screencode::petscii#0<$ff) goto petscii_to_screencode::@5 -- vbuaa_lt_vbuc1_then_la1 cmp #$ff bcc __b5 - // [96] phi from petscii_to_screencode::@10 to petscii_to_screencode::@return [phi:petscii_to_screencode::@10->petscii_to_screencode::@return] + // [97] phi from petscii_to_screencode::@10 to petscii_to_screencode::@return [phi:petscii_to_screencode::@10->petscii_to_screencode::@return] __breturn_from___b10: - // [96] phi petscii_to_screencode::return#10 = $5e [phi:petscii_to_screencode::@10->petscii_to_screencode::@return#0] -- vbuaa=vbuc1 + // [97] phi petscii_to_screencode::return#10 = $5e [phi:petscii_to_screencode::@10->petscii_to_screencode::@return#0] -- vbuaa=vbuc1 lda #$5e jmp __breturn // petscii_to_screencode::@5 __b5: - // [95] petscii_to_screencode::return#6 = petscii_to_screencode::petscii#0 - $80 -- vbuaa=vbuaa_minus_vbuc1 + // [96] petscii_to_screencode::return#6 = petscii_to_screencode::petscii#0 - $80 -- vbuaa=vbuaa_minus_vbuc1 sec sbc #$80 - // [96] phi from petscii_to_screencode::@1 petscii_to_screencode::@2 petscii_to_screencode::@3 petscii_to_screencode::@4 petscii_to_screencode::@5 petscii_to_screencode::@6 to petscii_to_screencode::@return [phi:petscii_to_screencode::@1/petscii_to_screencode::@2/petscii_to_screencode::@3/petscii_to_screencode::@4/petscii_to_screencode::@5/petscii_to_screencode::@6->petscii_to_screencode::@return] + // [97] phi from petscii_to_screencode::@1 petscii_to_screencode::@2 petscii_to_screencode::@3 petscii_to_screencode::@4 petscii_to_screencode::@5 petscii_to_screencode::@6 to petscii_to_screencode::@return [phi:petscii_to_screencode::@1/petscii_to_screencode::@2/petscii_to_screencode::@3/petscii_to_screencode::@4/petscii_to_screencode::@5/petscii_to_screencode::@6->petscii_to_screencode::@return] __breturn_from___b1: __breturn_from___b2: __breturn_from___b3: __breturn_from___b4: __breturn_from___b5: __breturn_from___b6: - // [96] phi petscii_to_screencode::return#10 = petscii_to_screencode::return#1 [phi:petscii_to_screencode::@1/petscii_to_screencode::@2/petscii_to_screencode::@3/petscii_to_screencode::@4/petscii_to_screencode::@5/petscii_to_screencode::@6->petscii_to_screencode::@return#0] -- register_copy + // [97] phi petscii_to_screencode::return#10 = petscii_to_screencode::return#1 [phi:petscii_to_screencode::@1/petscii_to_screencode::@2/petscii_to_screencode::@3/petscii_to_screencode::@4/petscii_to_screencode::@5/petscii_to_screencode::@6->petscii_to_screencode::@return#0] -- register_copy jmp __breturn // petscii_to_screencode::@return __breturn: - // [97] return + // [98] return rts // petscii_to_screencode::@4 __b4: - // [98] petscii_to_screencode::return#5 = petscii_to_screencode::petscii#0 + $40 -- vbuaa=vbuaa_plus_vbuc1 + // [99] petscii_to_screencode::return#5 = petscii_to_screencode::petscii#0 + $40 -- vbuaa=vbuaa_plus_vbuc1 clc adc #$40 jmp __breturn_from___b4 // petscii_to_screencode::@3 __b3: - // [99] petscii_to_screencode::return#4 = petscii_to_screencode::petscii#0 - $20 -- vbuaa=vbuaa_minus_vbuc1 + // [100] petscii_to_screencode::return#4 = petscii_to_screencode::petscii#0 - $20 -- vbuaa=vbuaa_minus_vbuc1 sec sbc #$20 jmp __breturn_from___b3 // petscii_to_screencode::@2 __b2: - // [100] petscii_to_screencode::return#3 = petscii_to_screencode::petscii#0 - $40 -- vbuaa=vbuaa_minus_vbuc1 + // [101] petscii_to_screencode::return#3 = petscii_to_screencode::petscii#0 - $40 -- vbuaa=vbuaa_minus_vbuc1 sec sbc #$40 jmp __breturn_from___b2 // petscii_to_screencode::@1 __b1: - // [101] petscii_to_screencode::return#1 = petscii_to_screencode::petscii#0 + $80 -- vbuaa=vbuaa_plus_vbuc1 + // [102] petscii_to_screencode::return#1 = petscii_to_screencode::petscii#0 + $80 -- vbuaa=vbuaa_plus_vbuc1 clc adc #$80 jmp __breturn_from___b1 } // printf_str /// Print a NUL-terminated string -// void printf_str(__zp($10) void (*putc)(char), __zp($12) const char *s) +// void printf_str(__zp($10) void (*putc)(char), __zp($e) const char *s) printf_str: { - .label s = $12 + .label s = $e .label putc = $10 - // [103] phi from printf_str printf_str::@2 to printf_str::@1 [phi:printf_str/printf_str::@2->printf_str::@1] + // [104] phi from printf_str printf_str::@2 to printf_str::@1 [phi:printf_str/printf_str::@2->printf_str::@1] __b1_from_printf_str: __b1_from___b2: - // [103] phi printf_str::s#5 = printf_str::s#6 [phi:printf_str/printf_str::@2->printf_str::@1#0] -- register_copy + // [104] phi printf_str::s#5 = printf_str::s#6 [phi:printf_str/printf_str::@2->printf_str::@1#0] -- register_copy jmp __b1 // printf_str::@1 __b1: - // [104] printf_str::c#1 = *printf_str::s#5 -- vbuaa=_deref_pbuz1 + // [105] printf_str::c#1 = *printf_str::s#5 -- vbuaa=_deref_pbuz1 ldy #0 lda (s),y - // [105] printf_str::s#0 = ++ printf_str::s#5 -- pbuz1=_inc_pbuz1 + // [106] printf_str::s#0 = ++ printf_str::s#5 -- pbuz1=_inc_pbuz1 inc.z s bne !+ inc.z s+1 !: - // [106] if(0!=printf_str::c#1) goto printf_str::@2 -- 0_neq_vbuaa_then_la1 + // [107] if(0!=printf_str::c#1) goto printf_str::@2 -- 0_neq_vbuaa_then_la1 cmp #0 bne __b2 jmp __breturn // printf_str::@return __breturn: - // [107] return + // [108] return rts // printf_str::@2 __b2: - // [108] stackpush(char) = printf_str::c#1 -- _stackpushbyte_=vbuaa + // [109] stackpush(char) = printf_str::c#1 -- _stackpushbyte_=vbuaa pha - // [109] callexecute *printf_str::putc#6 -- call__deref_pprz1 + // [110] callexecute *printf_str::putc#6 -- call__deref_pprz1 jsr icall2 // sideeffect stackpullbytes(1) -- _stackpullbyte_1 pla @@ -5299,135 +5114,114 @@ printf_uchar: { jmp __b1 // printf_uchar::@1 __b1: - // [112] *((char *)&printf_buffer) = 0 -- _deref_pbuc1=vbuc2 + // [113] *((char *)&printf_buffer) = 0 -- _deref_pbuc1=vbuc2 // Handle any sign lda #0 sta printf_buffer - // [113] uctoa::value#1 = printf_uchar::uvalue#0 - // [114] call uctoa + // [114] uctoa::value#1 = printf_uchar::uvalue#0 + // [115] call uctoa // Format number into buffer - // [134] phi from printf_uchar::@1 to uctoa [phi:printf_uchar::@1->uctoa] + // [132] phi from printf_uchar::@1 to uctoa [phi:printf_uchar::@1->uctoa] uctoa_from___b1: jsr uctoa jmp __b2 // printf_uchar::@2 __b2: - // [115] printf_number_buffer::buffer_sign#0 = *((char *)&printf_buffer) -- vbum1=_deref_pbuc1 + // [116] printf_number_buffer::buffer_sign#0 = *((char *)&printf_buffer) -- vbuz1=_deref_pbuc1 lda printf_buffer - sta printf_number_buffer.buffer_sign - // [116] call printf_number_buffer + sta.z printf_number_buffer.buffer_sign + // [117] call printf_number_buffer // Print using format - // [153] phi from printf_uchar::@2 to printf_number_buffer [phi:printf_uchar::@2->printf_number_buffer] + // [151] phi from printf_uchar::@2 to printf_number_buffer [phi:printf_uchar::@2->printf_number_buffer] printf_number_buffer_from___b2: jsr printf_number_buffer jmp __breturn // printf_uchar::@return __breturn: - // [117] return + // [118] return rts } // cscroll // Scroll the entire screen if the cursor is beyond the last line cscroll: { - // [118] if(conio_cursor_y!=$19) goto cscroll::@return -- vbum1_neq_vbuc1_then_la1 + // [119] if(conio_cursor_y!=$19) goto cscroll::@return -- vbuz1_neq_vbuc1_then_la1 lda #$19 - cmp conio_cursor_y + cmp.z conio_cursor_y bne __breturn + // [120] phi from cscroll to cscroll::@1 [phi:cscroll->cscroll::@1] + __b1_from_cscroll: jmp __b1 // cscroll::@1 __b1: - // [119] if(0!=conio_scroll_enable) goto cscroll::@3 -- 0_neq_vbum1_then_la1 - lda conio_scroll_enable - bne __b3_from___b1 - // [120] phi from cscroll::@1 to cscroll::@2 [phi:cscroll::@1->cscroll::@2] - __b2_from___b1: - jmp __b2 - // cscroll::@2 - __b2: - // [121] call gotoxy - // [49] phi from cscroll::@2 to gotoxy [phi:cscroll::@2->gotoxy] - gotoxy_from___b2: - // [49] phi gotoxy::y#3 = 0 [phi:cscroll::@2->gotoxy#0] -- vbuxx=vbuc1 - ldx #0 - jsr gotoxy - jmp __breturn - // cscroll::@return - __breturn: - // [122] return - rts - // [123] phi from cscroll::@1 to cscroll::@3 [phi:cscroll::@1->cscroll::@3] - __b3_from___b1: - jmp __b3 - // cscroll::@3 - __b3: - // [124] call memcpy - // [176] phi from cscroll::@3 to memcpy [phi:cscroll::@3->memcpy] - memcpy_from___b3: - // [176] phi memcpy::destination#2 = (void *)DEFAULT_SCREEN [phi:cscroll::@3->memcpy#0] -- pvoz1=pvoc1 + // [121] call memcpy + // [174] phi from cscroll::@1 to memcpy [phi:cscroll::@1->memcpy] + memcpy_from___b1: + // [174] phi memcpy::destination#2 = (void *)DEFAULT_SCREEN [phi:cscroll::@1->memcpy#0] -- pvoz1=pvoc1 lda #DEFAULT_SCREEN sta.z memcpy.destination+1 - // [176] phi memcpy::source#2 = (void *)DEFAULT_SCREEN+$28 [phi:cscroll::@3->memcpy#1] -- pvoz1=pvoc1 + // [174] phi memcpy::source#2 = (void *)DEFAULT_SCREEN+$28 [phi:cscroll::@1->memcpy#1] -- pvoz1=pvoc1 lda #DEFAULT_SCREEN+$28 sta.z memcpy.source+1 jsr memcpy - // [125] phi from cscroll::@3 to cscroll::@4 [phi:cscroll::@3->cscroll::@4] - __b4_from___b3: - jmp __b4 - // cscroll::@4 - __b4: - // [126] call memcpy - // [176] phi from cscroll::@4 to memcpy [phi:cscroll::@4->memcpy] - memcpy_from___b4: - // [176] phi memcpy::destination#2 = (void *)COLORRAM [phi:cscroll::@4->memcpy#0] -- pvoz1=pvoc1 + // [122] phi from cscroll::@1 to cscroll::@2 [phi:cscroll::@1->cscroll::@2] + __b2_from___b1: + jmp __b2 + // cscroll::@2 + __b2: + // [123] call memcpy + // [174] phi from cscroll::@2 to memcpy [phi:cscroll::@2->memcpy] + memcpy_from___b2: + // [174] phi memcpy::destination#2 = (void *)COLORRAM [phi:cscroll::@2->memcpy#0] -- pvoz1=pvoc1 lda #COLORRAM sta.z memcpy.destination+1 - // [176] phi memcpy::source#2 = (void *)COLORRAM+$28 [phi:cscroll::@4->memcpy#1] -- pvoz1=pvoc1 + // [174] phi memcpy::source#2 = (void *)COLORRAM+$28 [phi:cscroll::@2->memcpy#1] -- pvoz1=pvoc1 lda #COLORRAM+$28 sta.z memcpy.source+1 jsr memcpy - // [127] phi from cscroll::@4 to cscroll::@5 [phi:cscroll::@4->cscroll::@5] - __b5_from___b4: - jmp __b5 - // cscroll::@5 - __b5: - // [128] call memset - // [186] phi from cscroll::@5 to memset [phi:cscroll::@5->memset] - memset_from___b5: - // [186] phi memset::c#4 = ' ' [phi:cscroll::@5->memset#0] -- vbuxx=vbuc1 + // [124] phi from cscroll::@2 to cscroll::@3 [phi:cscroll::@2->cscroll::@3] + __b3_from___b2: + jmp __b3 + // cscroll::@3 + __b3: + // [125] call memset + // [184] phi from cscroll::@3 to memset [phi:cscroll::@3->memset] + memset_from___b3: + // [184] phi memset::c#4 = ' ' [phi:cscroll::@3->memset#0] -- vbuxx=vbuc1 ldx #' ' - // [186] phi memset::str#3 = (void *)DEFAULT_SCREEN+(unsigned int)$19*$28-$28 [phi:cscroll::@5->memset#1] -- pvoz1=pvoc1 + // [184] phi memset::str#3 = (void *)DEFAULT_SCREEN+(unsigned int)$19*$28-$28 [phi:cscroll::@3->memset#1] -- pvoz1=pvoc1 lda #DEFAULT_SCREEN+$19*$28-$28 sta.z memset.str+1 jsr memset - jmp __b6 - // cscroll::@6 - __b6: - // [129] memset::c#1 = conio_textcolor -- vbuxx=vbum1 - ldx conio_textcolor - // [130] call memset - // [186] phi from cscroll::@6 to memset [phi:cscroll::@6->memset] - memset_from___b6: - // [186] phi memset::c#4 = memset::c#1 [phi:cscroll::@6->memset#0] -- register_copy - // [186] phi memset::str#3 = (void *)COLORRAM+(unsigned int)$19*$28-$28 [phi:cscroll::@6->memset#1] -- pvoz1=pvoc1 + // [126] phi from cscroll::@3 to cscroll::@4 [phi:cscroll::@3->cscroll::@4] + __b4_from___b3: + jmp __b4 + // cscroll::@4 + __b4: + // [127] call memset + // [184] phi from cscroll::@4 to memset [phi:cscroll::@4->memset] + memset_from___b4: + // [184] phi memset::c#4 = LIGHT_BLUE [phi:cscroll::@4->memset#0] -- vbuxx=vbuc1 + ldx #LIGHT_BLUE + // [184] phi memset::str#3 = (void *)COLORRAM+(unsigned int)$19*$28-$28 [phi:cscroll::@4->memset#1] -- pvoz1=pvoc1 lda #COLORRAM+$19*$28-$28 sta.z memset.str+1 jsr memset - jmp __b7 - // cscroll::@7 - __b7: - // [131] conio_line_text = conio_line_text - $28 -- pbuz1=pbuz1_minus_vbuc1 + jmp __b5 + // cscroll::@5 + __b5: + // [128] conio_line_text = conio_line_text - $28 -- pbuz1=pbuz1_minus_vbuc1 sec lda.z conio_line_text sbc #$28 @@ -5435,7 +5229,7 @@ cscroll: { lda.z conio_line_text+1 sbc #0 sta.z conio_line_text+1 - // [132] conio_line_color = conio_line_color - $28 -- pbuz1=pbuz1_minus_vbuc1 + // [129] conio_line_color = conio_line_color - $28 -- pbuz1=pbuz1_minus_vbuc1 sec lda.z conio_line_color sbc #$28 @@ -5443,9 +5237,13 @@ cscroll: { lda.z conio_line_color+1 sbc #0 sta.z conio_line_color+1 - // [133] conio_cursor_y = -- conio_cursor_y -- vbum1=_dec_vbum1 - dec conio_cursor_y + // [130] conio_cursor_y = -- conio_cursor_y -- vbuz1=_dec_vbuz1 + dec.z conio_cursor_y jmp __breturn + // cscroll::@return + __breturn: + // [131] return + rts } // uctoa // Converts unsigned number value to a string representing it in RADIX format. @@ -5456,222 +5254,222 @@ cscroll: { // void uctoa(__register(X) char value, __zp($10) char *buffer, char radix) uctoa: { .const max_digits = 2 + .label digit_value = 8 .label buffer = $10 - // [135] phi from uctoa to uctoa::@1 [phi:uctoa->uctoa::@1] + .label digit = $12 + .label started = $14 + // [133] phi from uctoa to uctoa::@1 [phi:uctoa->uctoa::@1] __b1_from_uctoa: - // [135] phi uctoa::buffer#11 = (char *)&printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS [phi:uctoa->uctoa::@1#0] -- pbuz1=pbuc1 + // [133] phi uctoa::buffer#11 = (char *)&printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS [phi:uctoa->uctoa::@1#0] -- pbuz1=pbuc1 lda #printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS sta.z buffer+1 - // [135] phi uctoa::started#2 = 0 [phi:uctoa->uctoa::@1#1] -- vbum1=vbuc1 + // [133] phi uctoa::started#2 = 0 [phi:uctoa->uctoa::@1#1] -- vbuz1=vbuc1 lda #0 - sta started - // [135] phi uctoa::value#2 = uctoa::value#1 [phi:uctoa->uctoa::@1#2] -- register_copy - // [135] phi uctoa::digit#2 = 0 [phi:uctoa->uctoa::@1#3] -- vbum1=vbuc1 + sta.z started + // [133] phi uctoa::value#2 = uctoa::value#1 [phi:uctoa->uctoa::@1#2] -- register_copy + // [133] phi uctoa::digit#2 = 0 [phi:uctoa->uctoa::@1#3] -- vbuz1=vbuc1 lda #0 - sta digit + sta.z digit jmp __b1 // uctoa::@1 __b1: - // [136] if(uctoa::digit#2=uctoa::digit_value#0) goto uctoa::@5 -- vbuxx_ge_vbum1_then_la1 - cpx digit_value + // [141] if(uctoa::value#2>=uctoa::digit_value#0) goto uctoa::@5 -- vbuxx_ge_vbuz1_then_la1 + cpx.z digit_value bcs __b5 - // [144] phi from uctoa::@7 to uctoa::@4 [phi:uctoa::@7->uctoa::@4] + // [142] phi from uctoa::@7 to uctoa::@4 [phi:uctoa::@7->uctoa::@4] __b4_from___b7: - // [144] phi uctoa::buffer#14 = uctoa::buffer#11 [phi:uctoa::@7->uctoa::@4#0] -- register_copy - // [144] phi uctoa::started#4 = uctoa::started#2 [phi:uctoa::@7->uctoa::@4#1] -- register_copy - // [144] phi uctoa::value#6 = uctoa::value#2 [phi:uctoa::@7->uctoa::@4#2] -- register_copy + // [142] phi uctoa::buffer#14 = uctoa::buffer#11 [phi:uctoa::@7->uctoa::@4#0] -- register_copy + // [142] phi uctoa::started#4 = uctoa::started#2 [phi:uctoa::@7->uctoa::@4#1] -- register_copy + // [142] phi uctoa::value#6 = uctoa::value#2 [phi:uctoa::@7->uctoa::@4#2] -- register_copy jmp __b4 // uctoa::@4 __b4: - // [145] uctoa::digit#1 = ++ uctoa::digit#2 -- vbum1=_inc_vbum1 - inc digit - // [135] phi from uctoa::@4 to uctoa::@1 [phi:uctoa::@4->uctoa::@1] + // [143] uctoa::digit#1 = ++ uctoa::digit#2 -- vbuz1=_inc_vbuz1 + inc.z digit + // [133] phi from uctoa::@4 to uctoa::@1 [phi:uctoa::@4->uctoa::@1] __b1_from___b4: - // [135] phi uctoa::buffer#11 = uctoa::buffer#14 [phi:uctoa::@4->uctoa::@1#0] -- register_copy - // [135] phi uctoa::started#2 = uctoa::started#4 [phi:uctoa::@4->uctoa::@1#1] -- register_copy - // [135] phi uctoa::value#2 = uctoa::value#6 [phi:uctoa::@4->uctoa::@1#2] -- register_copy - // [135] phi uctoa::digit#2 = uctoa::digit#1 [phi:uctoa::@4->uctoa::@1#3] -- register_copy + // [133] phi uctoa::buffer#11 = uctoa::buffer#14 [phi:uctoa::@4->uctoa::@1#0] -- register_copy + // [133] phi uctoa::started#2 = uctoa::started#4 [phi:uctoa::@4->uctoa::@1#1] -- register_copy + // [133] phi uctoa::value#2 = uctoa::value#6 [phi:uctoa::@4->uctoa::@1#2] -- register_copy + // [133] phi uctoa::digit#2 = uctoa::digit#1 [phi:uctoa::@4->uctoa::@1#3] -- register_copy jmp __b1 // uctoa::@5 __b5: - // [146] uctoa_append::buffer#0 = uctoa::buffer#11 - // [147] uctoa_append::value#0 = uctoa::value#2 - // [148] uctoa_append::sub#0 = uctoa::digit_value#0 - // [149] call uctoa_append - // [194] phi from uctoa::@5 to uctoa_append [phi:uctoa::@5->uctoa_append] + // [144] uctoa_append::buffer#0 = uctoa::buffer#11 + // [145] uctoa_append::value#0 = uctoa::value#2 + // [146] uctoa_append::sub#0 = uctoa::digit_value#0 + // [147] call uctoa_append + // [192] phi from uctoa::@5 to uctoa_append [phi:uctoa::@5->uctoa_append] uctoa_append_from___b5: jsr uctoa_append - // [150] uctoa_append::return#0 = uctoa_append::value#2 + // [148] uctoa_append::return#0 = uctoa_append::value#2 jmp __b6 // uctoa::@6 __b6: - // [151] uctoa::value#0 = uctoa_append::return#0 - // [152] uctoa::buffer#4 = ++ uctoa::buffer#11 -- pbuz1=_inc_pbuz1 + // [149] uctoa::value#0 = uctoa_append::return#0 + // [150] uctoa::buffer#4 = ++ uctoa::buffer#11 -- pbuz1=_inc_pbuz1 inc.z buffer bne !+ inc.z buffer+1 !: - // [144] phi from uctoa::@6 to uctoa::@4 [phi:uctoa::@6->uctoa::@4] + // [142] phi from uctoa::@6 to uctoa::@4 [phi:uctoa::@6->uctoa::@4] __b4_from___b6: - // [144] phi uctoa::buffer#14 = uctoa::buffer#4 [phi:uctoa::@6->uctoa::@4#0] -- register_copy - // [144] phi uctoa::started#4 = 1 [phi:uctoa::@6->uctoa::@4#1] -- vbum1=vbuc1 + // [142] phi uctoa::buffer#14 = uctoa::buffer#4 [phi:uctoa::@6->uctoa::@4#0] -- register_copy + // [142] phi uctoa::started#4 = 1 [phi:uctoa::@6->uctoa::@4#1] -- vbuz1=vbuc1 lda #1 - sta started - // [144] phi uctoa::value#6 = uctoa::value#0 [phi:uctoa::@6->uctoa::@4#2] -- register_copy + sta.z started + // [142] phi uctoa::value#6 = uctoa::value#0 [phi:uctoa::@6->uctoa::@4#2] -- register_copy jmp __b4 - .segment Data - digit_value: .byte 0 - digit: .byte 0 - started: .byte 0 } -.segment Code // printf_number_buffer // Print the contents of the number buffer using a specific format. // This handles minimum length, zero-filling, and left/right justification from the format -// void printf_number_buffer(void (*putc)(char), __mem() char buffer_sign, char *buffer_digits, char format_min_length, char format_justify_left, char format_sign_always, char format_zero_padding, char format_upper_case, char format_radix) +// void printf_number_buffer(void (*putc)(char), __zp(8) char buffer_sign, char *buffer_digits, char format_min_length, char format_justify_left, char format_sign_always, char format_zero_padding, char format_upper_case, char format_radix) printf_number_buffer: { .label buffer_digits = printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS - // [154] phi from printf_number_buffer to printf_number_buffer::@4 [phi:printf_number_buffer->printf_number_buffer::@4] + .label __19 = $e + .label buffer_sign = 8 + // [152] phi from printf_number_buffer to printf_number_buffer::@4 [phi:printf_number_buffer->printf_number_buffer::@4] __b4_from_printf_number_buffer: jmp __b4 // printf_number_buffer::@4 __b4: - // [155] call strlen - // [201] phi from printf_number_buffer::@4 to strlen [phi:printf_number_buffer::@4->strlen] + // [153] call strlen + // [199] phi from printf_number_buffer::@4 to strlen [phi:printf_number_buffer::@4->strlen] strlen_from___b4: jsr strlen - // [156] strlen::return#2 = strlen::len#2 + // [154] strlen::return#2 = strlen::len#2 jmp __b9 // printf_number_buffer::@9 __b9: - // [157] printf_number_buffer::$19 = strlen::return#2 - // [158] printf_number_buffer::len#0 = (signed char)printf_number_buffer::$19 -- vbsxx=_sbyte_vwum1 + // [155] printf_number_buffer::$19 = strlen::return#2 + // [156] printf_number_buffer::len#0 = (signed char)printf_number_buffer::$19 -- vbsxx=_sbyte_vwuz1 // There is a minimum length - work out the padding - ldx __19 - // [159] if(0==printf_number_buffer::buffer_sign#0) goto printf_number_buffer::@8 -- 0_eq_vbum1_then_la1 - lda buffer_sign + ldx.z __19 + // [157] if(0==printf_number_buffer::buffer_sign#0) goto printf_number_buffer::@8 -- 0_eq_vbuz1_then_la1 + lda.z buffer_sign beq __b8_from___b9 jmp __b5 // printf_number_buffer::@5 __b5: - // [160] printf_number_buffer::len#1 = ++ printf_number_buffer::len#0 -- vbsxx=_inc_vbsxx + // [158] printf_number_buffer::len#1 = ++ printf_number_buffer::len#0 -- vbsxx=_inc_vbsxx inx - // [161] phi from printf_number_buffer::@5 printf_number_buffer::@9 to printf_number_buffer::@8 [phi:printf_number_buffer::@5/printf_number_buffer::@9->printf_number_buffer::@8] + // [159] phi from printf_number_buffer::@5 printf_number_buffer::@9 to printf_number_buffer::@8 [phi:printf_number_buffer::@5/printf_number_buffer::@9->printf_number_buffer::@8] __b8_from___b5: __b8_from___b9: - // [161] phi printf_number_buffer::len#2 = printf_number_buffer::len#1 [phi:printf_number_buffer::@5/printf_number_buffer::@9->printf_number_buffer::@8#0] -- register_copy + // [159] phi printf_number_buffer::len#2 = printf_number_buffer::len#1 [phi:printf_number_buffer::@5/printf_number_buffer::@9->printf_number_buffer::@8#0] -- register_copy jmp __b8 // printf_number_buffer::@8 __b8: - // [162] printf_number_buffer::padding#1 = (signed char)printf_uchar::format_min_length#0 - printf_number_buffer::len#2 -- vbsaa=vbsc1_minus_vbsxx + // [160] printf_number_buffer::padding#1 = (signed char)printf_uchar::format_min_length#0 - printf_number_buffer::len#2 -- vbsaa=vbsc1_minus_vbsxx txa eor #$ff sec adc #printf_uchar.format_min_length - // [163] if(printf_number_buffer::padding#1>=0) goto printf_number_buffer::@11 -- vbsaa_ge_0_then_la1 + // [161] if(printf_number_buffer::padding#1>=0) goto printf_number_buffer::@11 -- vbsaa_ge_0_then_la1 cmp #0 bpl __b11_from___b8 - // [165] phi from printf_number_buffer::@8 to printf_number_buffer::@1 [phi:printf_number_buffer::@8->printf_number_buffer::@1] + // [163] phi from printf_number_buffer::@8 to printf_number_buffer::@1 [phi:printf_number_buffer::@8->printf_number_buffer::@1] __b1_from___b8: - // [165] phi printf_number_buffer::padding#10 = 0 [phi:printf_number_buffer::@8->printf_number_buffer::@1#0] -- vbsaa=vbsc1 + // [163] phi printf_number_buffer::padding#10 = 0 [phi:printf_number_buffer::@8->printf_number_buffer::@1#0] -- vbsaa=vbsc1 lda #0 jmp __b1 - // [164] phi from printf_number_buffer::@8 to printf_number_buffer::@11 [phi:printf_number_buffer::@8->printf_number_buffer::@11] + // [162] phi from printf_number_buffer::@8 to printf_number_buffer::@11 [phi:printf_number_buffer::@8->printf_number_buffer::@11] __b11_from___b8: jmp __b11 // printf_number_buffer::@11 __b11: - // [165] phi from printf_number_buffer::@11 to printf_number_buffer::@1 [phi:printf_number_buffer::@11->printf_number_buffer::@1] + // [163] phi from printf_number_buffer::@11 to printf_number_buffer::@1 [phi:printf_number_buffer::@11->printf_number_buffer::@1] __b1_from___b11: - // [165] phi printf_number_buffer::padding#10 = printf_number_buffer::padding#1 [phi:printf_number_buffer::@11->printf_number_buffer::@1#0] -- register_copy + // [163] phi printf_number_buffer::padding#10 = printf_number_buffer::padding#1 [phi:printf_number_buffer::@11->printf_number_buffer::@1#0] -- register_copy jmp __b1 // printf_number_buffer::@1 __b1: jmp __b10 // printf_number_buffer::@10 __b10: - // [166] if(0!=printf_number_buffer::padding#10) goto printf_number_buffer::@6 -- 0_neq_vbsaa_then_la1 + // [164] if(0!=printf_number_buffer::padding#10) goto printf_number_buffer::@6 -- 0_neq_vbsaa_then_la1 cmp #0 bne __b6 jmp __b2 // printf_number_buffer::@6 __b6: - // [167] printf_padding::length#0 = (char)printf_number_buffer::padding#10 -- vbum1=vbuaa - sta printf_padding.length - // [168] call printf_padding - // [207] phi from printf_number_buffer::@6 to printf_padding [phi:printf_number_buffer::@6->printf_padding] + // [165] printf_padding::length#0 = (char)printf_number_buffer::padding#10 -- vbuz1=vbuaa + sta.z printf_padding.length + // [166] call printf_padding + // [205] phi from printf_number_buffer::@6 to printf_padding [phi:printf_number_buffer::@6->printf_padding] printf_padding_from___b6: jsr printf_padding jmp __b2 // printf_number_buffer::@2 __b2: - // [169] if(0==printf_number_buffer::buffer_sign#0) goto printf_number_buffer::@3 -- 0_eq_vbum1_then_la1 - lda buffer_sign + // [167] if(0==printf_number_buffer::buffer_sign#0) goto printf_number_buffer::@3 -- 0_eq_vbuz1_then_la1 + lda.z buffer_sign beq __b3_from___b2 jmp __b7 // printf_number_buffer::@7 __b7: - // [170] stackpush(char) = printf_number_buffer::buffer_sign#0 -- _stackpushbyte_=vbum1 - lda buffer_sign + // [168] stackpush(char) = printf_number_buffer::buffer_sign#0 -- _stackpushbyte_=vbuz1 + lda.z buffer_sign pha - // [171] callexecute cputc -- call_vprc1 + // [169] callexecute cputc -- call_vprc1 jsr cputc // sideeffect stackpullbytes(1) -- _stackpullbyte_1 pla - // [173] phi from printf_number_buffer::@2 printf_number_buffer::@7 to printf_number_buffer::@3 [phi:printf_number_buffer::@2/printf_number_buffer::@7->printf_number_buffer::@3] + // [171] phi from printf_number_buffer::@2 printf_number_buffer::@7 to printf_number_buffer::@3 [phi:printf_number_buffer::@2/printf_number_buffer::@7->printf_number_buffer::@3] __b3_from___b2: __b3_from___b7: jmp __b3 // printf_number_buffer::@3 __b3: - // [174] call printf_str - // [102] phi from printf_number_buffer::@3 to printf_str [phi:printf_number_buffer::@3->printf_str] + // [172] call printf_str + // [103] phi from printf_number_buffer::@3 to printf_str [phi:printf_number_buffer::@3->printf_str] printf_str_from___b3: - // [102] phi printf_str::putc#6 = printf_uchar::putc#0 [phi:printf_number_buffer::@3->printf_str#0] -- pprz1=pprc1 + // [103] phi printf_str::putc#6 = printf_uchar::putc#0 [phi:printf_number_buffer::@3->printf_str#0] -- pprz1=pprc1 lda #printf_uchar.putc sta.z printf_str.putc+1 - // [102] phi printf_str::s#6 = printf_number_buffer::buffer_digits#0 [phi:printf_number_buffer::@3->printf_str#1] -- pbuz1=pbuc1 + // [103] phi printf_str::s#6 = printf_number_buffer::buffer_digits#0 [phi:printf_number_buffer::@3->printf_str#1] -- pbuz1=pbuc1 lda #buffer_digits @@ -5680,13 +5478,9 @@ printf_number_buffer: { jmp __breturn // printf_number_buffer::@return __breturn: - // [175] return + // [173] return rts - .segment Data - .label __19 = strlen.len - buffer_sign: .byte 0 } -.segment Code // memcpy // Copy block of memory (forwards) // Copies the values of num bytes from the location pointed to by source directly to the memory block pointed to by destination. @@ -5697,7 +5491,7 @@ memcpy: { .label src = 2 .label source = 2 .label destination = 4 - // [177] memcpy::src_end#0 = (char *)memcpy::source#2 + (unsigned int)$19*$28-$28 -- pbuz1=pbuz2_plus_vwuc1 + // [175] memcpy::src_end#0 = (char *)memcpy::source#2 + (unsigned int)$19*$28-$28 -- pbuz1=pbuz2_plus_vwuc1 lda.z source clc adc #<$19*$28-$28 @@ -5705,17 +5499,17 @@ memcpy: { lda.z source+1 adc #>$19*$28-$28 sta.z src_end+1 - // [178] memcpy::src#4 = (char *)memcpy::source#2 - // [179] memcpy::dst#4 = (char *)memcpy::destination#2 - // [180] phi from memcpy memcpy::@2 to memcpy::@1 [phi:memcpy/memcpy::@2->memcpy::@1] + // [176] memcpy::src#4 = (char *)memcpy::source#2 + // [177] memcpy::dst#4 = (char *)memcpy::destination#2 + // [178] phi from memcpy memcpy::@2 to memcpy::@1 [phi:memcpy/memcpy::@2->memcpy::@1] __b1_from_memcpy: __b1_from___b2: - // [180] phi memcpy::dst#2 = memcpy::dst#4 [phi:memcpy/memcpy::@2->memcpy::@1#0] -- register_copy - // [180] phi memcpy::src#2 = memcpy::src#4 [phi:memcpy/memcpy::@2->memcpy::@1#1] -- register_copy + // [178] phi memcpy::dst#2 = memcpy::dst#4 [phi:memcpy/memcpy::@2->memcpy::@1#0] -- register_copy + // [178] phi memcpy::src#2 = memcpy::src#4 [phi:memcpy/memcpy::@2->memcpy::@1#1] -- register_copy jmp __b1 // memcpy::@1 __b1: - // [181] if(memcpy::src#2!=memcpy::src_end#0) goto memcpy::@2 -- pbuz1_neq_pbuz2_then_la1 + // [179] if(memcpy::src#2!=memcpy::src_end#0) goto memcpy::@2 -- pbuz1_neq_pbuz2_then_la1 lda.z src+1 cmp.z src_end+1 bne __b2 @@ -5725,21 +5519,21 @@ memcpy: { jmp __breturn // memcpy::@return __breturn: - // [182] return + // [180] return rts // memcpy::@2 __b2: - // [183] *memcpy::dst#2 = *memcpy::src#2 -- _deref_pbuz1=_deref_pbuz2 + // [181] *memcpy::dst#2 = *memcpy::src#2 -- _deref_pbuz1=_deref_pbuz2 ldy #0 lda (src),y ldy #0 sta (dst),y - // [184] memcpy::dst#1 = ++ memcpy::dst#2 -- pbuz1=_inc_pbuz1 + // [182] memcpy::dst#1 = ++ memcpy::dst#2 -- pbuz1=_inc_pbuz1 inc.z dst bne !+ inc.z dst+1 !: - // [185] memcpy::src#1 = ++ memcpy::src#2 -- pbuz1=_inc_pbuz1 + // [183] memcpy::src#1 = ++ memcpy::src#2 -- pbuz1=_inc_pbuz1 inc.z src bne !+ inc.z src+1 @@ -5756,7 +5550,7 @@ memset: { jmp __b1 // memset::@1 __b1: - // [187] memset::end#0 = (char *)memset::str#3 + $28 -- pbuz1=pbuz2_plus_vbuc1 + // [185] memset::end#0 = (char *)memset::str#3 + $28 -- pbuz1=pbuz2_plus_vbuc1 lda #$28 clc adc.z str @@ -5764,15 +5558,15 @@ memset: { lda #0 adc.z str+1 sta.z end+1 - // [188] memset::dst#4 = (char *)memset::str#3 - // [189] phi from memset::@1 memset::@3 to memset::@2 [phi:memset::@1/memset::@3->memset::@2] + // [186] memset::dst#4 = (char *)memset::str#3 + // [187] phi from memset::@1 memset::@3 to memset::@2 [phi:memset::@1/memset::@3->memset::@2] __b2_from___b1: __b2_from___b3: - // [189] phi memset::dst#2 = memset::dst#4 [phi:memset::@1/memset::@3->memset::@2#0] -- register_copy + // [187] phi memset::dst#2 = memset::dst#4 [phi:memset::@1/memset::@3->memset::@2#0] -- register_copy jmp __b2 // memset::@2 __b2: - // [190] if(memset::dst#2!=memset::end#0) goto memset::@3 -- pbuz1_neq_pbuz2_then_la1 + // [188] if(memset::dst#2!=memset::end#0) goto memset::@3 -- pbuz1_neq_pbuz2_then_la1 lda.z dst+1 cmp.z end+1 bne __b3 @@ -5782,15 +5576,15 @@ memset: { jmp __breturn // memset::@return __breturn: - // [191] return + // [189] return rts // memset::@3 __b3: - // [192] *memset::dst#2 = memset::c#4 -- _deref_pbuz1=vbuxx + // [190] *memset::dst#2 = memset::c#4 -- _deref_pbuz1=vbuxx txa ldy #0 sta (dst),y - // [193] memset::dst#1 = ++ memset::dst#2 -- pbuz1=_inc_pbuz1 + // [191] memset::dst#1 = ++ memset::dst#2 -- pbuz1=_inc_pbuz1 inc.z dst bne !+ inc.z dst+1 @@ -5806,63 +5600,63 @@ memset: { // - sub : the value of a '1' in the digit. Subtracted continually while the digit is increased. // (For decimal the subs used are 10000, 1000, 100, 10, 1) // returns : the value reduced by sub * digit so that it is less than sub. -// __register(X) char uctoa_append(__zp($10) char *buffer, __register(X) char value, __mem() char sub) +// __register(X) char uctoa_append(__zp($10) char *buffer, __register(X) char value, __zp(8) char sub) uctoa_append: { .label buffer = $10 - // [195] phi from uctoa_append to uctoa_append::@1 [phi:uctoa_append->uctoa_append::@1] + .label sub = 8 + // [193] phi from uctoa_append to uctoa_append::@1 [phi:uctoa_append->uctoa_append::@1] __b1_from_uctoa_append: - // [195] phi uctoa_append::digit#2 = 0 [phi:uctoa_append->uctoa_append::@1#0] -- vbuyy=vbuc1 + // [193] phi uctoa_append::digit#2 = 0 [phi:uctoa_append->uctoa_append::@1#0] -- vbuyy=vbuc1 ldy #0 - // [195] phi uctoa_append::value#2 = uctoa_append::value#0 [phi:uctoa_append->uctoa_append::@1#1] -- register_copy + // [193] phi uctoa_append::value#2 = uctoa_append::value#0 [phi:uctoa_append->uctoa_append::@1#1] -- register_copy jmp __b1 // uctoa_append::@1 __b1: - // [196] if(uctoa_append::value#2>=uctoa_append::sub#0) goto uctoa_append::@2 -- vbuxx_ge_vbum1_then_la1 - cpx sub + // [194] if(uctoa_append::value#2>=uctoa_append::sub#0) goto uctoa_append::@2 -- vbuxx_ge_vbuz1_then_la1 + cpx.z sub bcs __b2 jmp __b3 // uctoa_append::@3 __b3: - // [197] *uctoa_append::buffer#0 = DIGITS[uctoa_append::digit#2] -- _deref_pbuz1=pbuc1_derefidx_vbuyy + // [195] *uctoa_append::buffer#0 = DIGITS[uctoa_append::digit#2] -- _deref_pbuz1=pbuc1_derefidx_vbuyy lda DIGITS,y ldy #0 sta (buffer),y jmp __breturn // uctoa_append::@return __breturn: - // [198] return + // [196] return rts // uctoa_append::@2 __b2: - // [199] uctoa_append::digit#1 = ++ uctoa_append::digit#2 -- vbuyy=_inc_vbuyy + // [197] uctoa_append::digit#1 = ++ uctoa_append::digit#2 -- vbuyy=_inc_vbuyy iny - // [200] uctoa_append::value#1 = uctoa_append::value#2 - uctoa_append::sub#0 -- vbuxx=vbuxx_minus_vbum1 + // [198] uctoa_append::value#1 = uctoa_append::value#2 - uctoa_append::sub#0 -- vbuxx=vbuxx_minus_vbuz1 txa sec - sbc sub + sbc.z sub tax - // [195] phi from uctoa_append::@2 to uctoa_append::@1 [phi:uctoa_append::@2->uctoa_append::@1] + // [193] phi from uctoa_append::@2 to uctoa_append::@1 [phi:uctoa_append::@2->uctoa_append::@1] __b1_from___b2: - // [195] phi uctoa_append::digit#2 = uctoa_append::digit#1 [phi:uctoa_append::@2->uctoa_append::@1#0] -- register_copy - // [195] phi uctoa_append::value#2 = uctoa_append::value#1 [phi:uctoa_append::@2->uctoa_append::@1#1] -- register_copy + // [193] phi uctoa_append::digit#2 = uctoa_append::digit#1 [phi:uctoa_append::@2->uctoa_append::@1#0] -- register_copy + // [193] phi uctoa_append::value#2 = uctoa_append::value#1 [phi:uctoa_append::@2->uctoa_append::@1#1] -- register_copy jmp __b1 - .segment Data - .label sub = uctoa.digit_value } -.segment Code // strlen // Computes the length of the string str up to but not including the terminating null character. -// __mem() unsigned int strlen(__zp($10) char *str) +// __zp($e) unsigned int strlen(__zp($10) char *str) strlen: { + .label len = $e .label str = $10 - // [202] phi from strlen to strlen::@1 [phi:strlen->strlen::@1] + .label return = $e + // [200] phi from strlen to strlen::@1 [phi:strlen->strlen::@1] __b1_from_strlen: - // [202] phi strlen::len#2 = 0 [phi:strlen->strlen::@1#0] -- vwum1=vwuc1 + // [200] phi strlen::len#2 = 0 [phi:strlen->strlen::@1#0] -- vwuz1=vwuc1 lda #<0 - sta len + sta.z len lda #>0 - sta len+1 - // [202] phi strlen::str#2 = printf_number_buffer::buffer_digits#0 [phi:strlen->strlen::@1#1] -- pbuz1=pbuc1 + sta.z len+1 + // [200] phi strlen::str#2 = printf_number_buffer::buffer_digits#0 [phi:strlen->strlen::@1#1] -- pbuz1=pbuc1 lda #printf_number_buffer.buffer_digits @@ -5870,7 +5664,7 @@ strlen: { jmp __b1 // strlen::@1 __b1: - // [203] if(0!=*strlen::str#2) goto strlen::@2 -- 0_neq__deref_pbuz1_then_la1 + // [201] if(0!=*strlen::str#2) goto strlen::@2 -- 0_neq__deref_pbuz1_then_la1 ldy #0 lda (str),y cmp #0 @@ -5878,89 +5672,75 @@ strlen: { jmp __breturn // strlen::@return __breturn: - // [204] return + // [202] return rts // strlen::@2 __b2: - // [205] strlen::len#1 = ++ strlen::len#2 -- vwum1=_inc_vwum1 - inc len + // [203] strlen::len#1 = ++ strlen::len#2 -- vwuz1=_inc_vwuz1 + inc.z len bne !+ - inc len+1 + inc.z len+1 !: - // [206] strlen::str#0 = ++ strlen::str#2 -- pbuz1=_inc_pbuz1 + // [204] strlen::str#0 = ++ strlen::str#2 -- pbuz1=_inc_pbuz1 inc.z str bne !+ inc.z str+1 !: - // [202] phi from strlen::@2 to strlen::@1 [phi:strlen::@2->strlen::@1] + // [200] phi from strlen::@2 to strlen::@1 [phi:strlen::@2->strlen::@1] __b1_from___b2: - // [202] phi strlen::len#2 = strlen::len#1 [phi:strlen::@2->strlen::@1#0] -- register_copy - // [202] phi strlen::str#2 = strlen::str#0 [phi:strlen::@2->strlen::@1#1] -- register_copy + // [200] phi strlen::len#2 = strlen::len#1 [phi:strlen::@2->strlen::@1#0] -- register_copy + // [200] phi strlen::str#2 = strlen::str#0 [phi:strlen::@2->strlen::@1#1] -- register_copy jmp __b1 - .segment Data - len: .word 0 - .label return = len } -.segment Code // printf_padding // Print a padding char a number of times -// void printf_padding(void (*putc)(char), char pad, __mem() char length) +// void printf_padding(void (*putc)(char), char pad, __zp($15) char length) printf_padding: { .const pad = ' ' - // [208] phi from printf_padding to printf_padding::@1 [phi:printf_padding->printf_padding::@1] + .label i = $12 + .label length = $15 + // [206] phi from printf_padding to printf_padding::@1 [phi:printf_padding->printf_padding::@1] __b1_from_printf_padding: - // [208] phi printf_padding::i#2 = 0 [phi:printf_padding->printf_padding::@1#0] -- vbum1=vbuc1 + // [206] phi printf_padding::i#2 = 0 [phi:printf_padding->printf_padding::@1#0] -- vbuz1=vbuc1 lda #0 - sta i + sta.z i jmp __b1 // printf_padding::@1 __b1: - // [209] if(printf_padding::i#2printf_padding::@1] + // [212] printf_padding::i#1 = ++ printf_padding::i#2 -- vbuz1=_inc_vbuz1 + inc.z i + // [206] phi from printf_padding::@3 to printf_padding::@1 [phi:printf_padding::@3->printf_padding::@1] __b1_from___b3: - // [208] phi printf_padding::i#2 = printf_padding::i#1 [phi:printf_padding::@3->printf_padding::@1#0] -- register_copy + // [206] phi printf_padding::i#2 = printf_padding::i#1 [phi:printf_padding::@3->printf_padding::@1#0] -- register_copy jmp __b1 - .segment Data - i: .byte 0 - length: .byte 0 } // File Data +.segment Data // The digits used for numbers DIGITS: .text "0123456789abcdef" // Values of hexadecimal digits RADIX_HEXADECIMAL_VALUES_CHAR: .byte $10 - // The number of bytes on the screen - // The current cursor x-position - conio_cursor_x: .byte 0 - // The current cursor y-position - conio_cursor_y: .byte 0 - // The current text color - conio_textcolor: .byte LIGHT_BLUE - // Is scrolling enabled when outputting beyond the end of the screen (1: yes, 0: no). - // If disabled the cursor just moves back to (0,0) instead - conio_scroll_enable: .byte 1 // Buffer used for stringified number being printed printf_buffer: .fill SIZEOF_STRUCT_PRINTF_BUFFER_NUMBER, 0 @@ -6009,12 +5789,10 @@ Removing instruction jmp __b2 Removing instruction jmp __breturn Removing instruction jmp __b1 Removing instruction jmp __b2 -Removing instruction jmp __breturn Removing instruction jmp __b3 Removing instruction jmp __b4 Removing instruction jmp __b5 -Removing instruction jmp __b6 -Removing instruction jmp __b7 +Removing instruction jmp __breturn Removing instruction jmp __b1 Removing instruction jmp __b3 Removing instruction jmp __breturn @@ -6046,8 +5824,9 @@ Removing instruction jmp __b1 Removing instruction jmp __breturn Removing instruction jmp __b3 Succesful ASM optimization Pass5NextJumpElimination -Removing instruction ldy conio_cursor_x -Removing instruction lda ch +Removing instruction lda #0 +Removing instruction ldy.z conio_cursor_x +Removing instruction lda.z ch Removing instruction lda #0 Removing instruction lda ch Removing instruction lda #0 @@ -6067,7 +5846,6 @@ Replacing label __breturn_from___b3 with __breturn Replacing label __breturn_from___b2 with __breturn Replacing label __breturn_from___b1 with __breturn Replacing label __b1_from___b2 with __b1 -Replacing label __b3_from___b1 with __b3 Replacing label __b8_from___b9 with __b8 Replacing label __b11_from___b8 with __b1 Replacing label __b3_from___b2 with __b3 @@ -6078,7 +5856,6 @@ Removing instruction main_from___b1: Removing instruction __b2_from_conio_c64_init: Removing instruction __b2: Removing instruction __b1_from___b2: -Removing instruction gotoxy_from___b1: Removing instruction __b3_from___b2: Removing instruction __b1_from_cputc: Removing instruction toD0181_from_main: @@ -6099,14 +5876,14 @@ Removing instruction __breturn_from___b5: Removing instruction __breturn_from___b6: Removing instruction __b1_from_printf_str: Removing instruction __b1_from___b2: +Removing instruction __b1_from_cscroll: +Removing instruction memcpy_from___b1: Removing instruction __b2_from___b1: -Removing instruction gotoxy_from___b2: -Removing instruction __b3_from___b1: -Removing instruction memcpy_from___b3: +Removing instruction memcpy_from___b2: +Removing instruction __b3_from___b2: +Removing instruction memset_from___b3: Removing instruction __b4_from___b3: -Removing instruction memcpy_from___b4: -Removing instruction __b5_from___b4: -Removing instruction memset_from___b5: +Removing instruction memset_from___b4: Removing instruction __b4_from___b7: Removing instruction uctoa_append_from___b5: Removing instruction __b4_from_printf_number_buffer: @@ -6170,11 +5947,9 @@ Removing instruction printf_number_buffer_from___b2: Removing instruction __breturn: Removing instruction __b1: Removing instruction __b2: +Removing instruction __b3: Removing instruction __b4: Removing instruction __b5: -Removing instruction __b6: -Removing instruction memset_from___b6: -Removing instruction __b7: Removing instruction __b1_from_uctoa: Removing instruction __b3: Removing instruction __breturn: @@ -6210,7 +5985,6 @@ Replacing jump to rts with rts in jmp __breturn Replacing jump to rts with rts in jmp __breturn Replacing jump to rts with rts in jmp __breturn Replacing jump to rts with rts in jmp __breturn -Replacing jump to rts with rts in jmp __breturn Succesful ASM optimization Pass5DoubleJumpElimination Relabelling long label __b3_from___b1 to __b2 Succesful ASM optimization Pass5RelabelLongLabels @@ -6219,8 +5993,8 @@ Removing instruction jmp __b1 Removing instruction jmp __b2 Removing instruction jmp __b1 Succesful ASM optimization Pass5NextJumpElimination -Removing instruction lda ch -Removing instruction lda buffer_sign +Removing instruction lda.z ch +Removing instruction lda.z buffer_sign Succesful ASM optimization Pass5UnnecesaryLoadElimination FINAL SYMBOL TABLE @@ -6253,8 +6027,8 @@ char clrscr::l char clrscr::l#1 // reg byte x 2002.0 char clrscr::l#2 // reg byte x 333.6666666666667 char *clrscr::line_cols -char *clrscr::line_cols#1 // line_cols zp[2]:18 1001.0 -char *clrscr::line_cols#5 // line_cols zp[2]:18 1500.375 +char *clrscr::line_cols#1 // line_cols zp[2]:14 1001.0 +char *clrscr::line_cols#5 // line_cols zp[2]:14 1500.375 char *clrscr::line_text char *clrscr::line_text#1 // line_text zp[2]:16 667.3333333333334 char *clrscr::line_text#5 // line_text zp[2]:16 1714.7142857142858 @@ -6263,12 +6037,10 @@ __constant char * const conio_c64_init::BASIC_CURSOR_LINE = (char *) 214 char conio_c64_init::line char conio_c64_init::line#0 // reg byte x 11.0 char conio_c64_init::line#2 // reg byte x 22.0 -__loadstore char conio_cursor_x = 0 // mem[1] 9.854368942524271E8 -__loadstore char conio_cursor_y = 0 // mem[1] 1.2571428581619048E9 -__loadstore char *conio_line_color // zp[2]:12 1.2852631590421052E9 -__loadstore char *conio_line_text // zp[2]:14 1.245918368459184E9 -__loadstore char conio_scroll_enable = 1 // mem[1] 1.0000000001E8 -__loadstore char conio_textcolor = LIGHT_BLUE // mem[1] 8.706905175E7 +__loadstore char conio_cursor_x // zp[1]:19 1.9480522207792208E7 +__loadstore char conio_cursor_y // zp[1]:9 3.4408602375268817E8 +__loadstore char *conio_line_color // zp[2]:10 2.4285714515384617E8 +__loadstore char *conio_line_text // zp[2]:12 2.4021739357608694E8 __stackcall void cputc(char c) __constant char cputc::OFFSET_STACK_C = 0 char cputc::c @@ -6276,25 +6048,25 @@ char cputc::c#0 // reg byte a 1.500000015E8 void cputln() void cscroll() void gotoxy(char x , char y) -char *gotoxy::$5 // zp[2]:8 2.00000000002E11 -char *gotoxy::$6 // zp[2]:10 2.00000000002E11 -unsigned int gotoxy::$7 // mem[2] 1.500000000015E11 -unsigned int gotoxy::$8 // mem[2] 2.00000000002E11 -unsigned int gotoxy::$9 // mem[2] 2.00000000002E11 +char *gotoxy::$5 // zp[2]:28 202.0 +char *gotoxy::$6 // zp[2]:24 202.0 +unsigned int gotoxy::$7 // zp[2]:24 151.5 +unsigned int gotoxy::$8 // zp[2]:26 202.0 +unsigned int gotoxy::$9 // zp[2]:24 202.0 unsigned int gotoxy::line_offset -unsigned int gotoxy::line_offset#0 // line_offset mem[2] 1.00000000001E11 +unsigned int gotoxy::line_offset#0 // line_offset zp[2]:24 101.0 char gotoxy::x +__constant char gotoxy::x#2 = 0 // x char gotoxy::y -char gotoxy::y#2 // reg byte x 22.0 -char gotoxy::y#3 // reg byte x 6.6666666671E10 -char gotoxy::y#4 // reg byte x 6.6666666667333336E10 +char gotoxy::y#2 // reg byte x 71.0 +char gotoxy::y#4 // reg byte x 67.33333333333333 int main() -char main::$6 // mem[1] 101.0 +char main::$6 // zp[1]:20 101.0 char main::ch -char main::ch#0 // ch mem[1] 1331.625 +char main::ch#0 // ch zp[1]:23 1331.625 char main::current -char main::current#2 // current mem[1] 4220.8 -char main::current#4 // current mem[1] 202.0 +char main::current#2 // current zp[1]:22 4220.8 +char main::current#4 // current zp[1]:22 202.0 int main::return __constant char main::s[2] = "'" __constant char main::s1[4] = "'($" @@ -6322,8 +6094,7 @@ char *memcpy::src_end char *memcpy::src_end#0 // src_end zp[2]:6 1.26250000000025E12 void * memset(void *str , char c , unsigned int num) char memset::c -char memset::c#1 // reg byte x 2.0000000002E10 -char memset::c#4 // reg byte x 1.430000000000286E12 +char memset::c#4 // reg byte x 1.4285714285715715E12 char *memset::dst char *memset::dst#1 // dst zp[2]:2 2.0000000000002E13 char *memset::dst#2 // dst zp[2]:2 1.3366666666668332E13 @@ -6347,12 +6118,12 @@ char petscii_to_screencode::return#5 // reg byte a 2002.0 char petscii_to_screencode::return#6 // reg byte a 2002.0 __loadstore struct printf_buffer_number printf_buffer = {} // mem[12] void printf_number_buffer(void (*putc)(char) , char buffer_sign , char *buffer_digits , char format_min_length , char format_justify_left , char format_sign_always , char format_zero_padding , char format_upper_case , char format_radix) -unsigned int printf_number_buffer::$19 // mem[2] 10001.0 +unsigned int printf_number_buffer::$19 // zp[2]:14 10001.0 struct printf_buffer_number printf_number_buffer::buffer char *printf_number_buffer::buffer_digits __constant char *printf_number_buffer::buffer_digits#0 = (char *)&printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS // buffer_digits char printf_number_buffer::buffer_sign -char printf_number_buffer::buffer_sign#0 // buffer_sign mem[1] 1722.4444444444443 +char printf_number_buffer::buffer_sign#0 // buffer_sign zp[1]:8 1722.4444444444443 struct printf_format_number printf_number_buffer::format char printf_number_buffer::format_justify_left char printf_number_buffer::format_min_length @@ -6370,10 +6141,10 @@ signed char printf_number_buffer::padding#10 // reg byte a 10001.0 void (*printf_number_buffer::putc)(char) void printf_padding(void (*putc)(char) , char pad , char length) char printf_padding::i -char printf_padding::i#1 // i mem[1] 2.0000002E7 -char printf_padding::i#2 // i mem[1] 6000000.6 +char printf_padding::i#1 // i zp[1]:18 2.0000002E7 +char printf_padding::i#2 // i zp[1]:18 6000000.6 char printf_padding::length -char printf_padding::length#0 // length mem[1] 1251250.25 +char printf_padding::length#0 // length zp[1]:21 1251250.25 char printf_padding::pad __constant char printf_padding::pad#0 = ' ' // pad void (*printf_padding::putc)(char) @@ -6383,9 +6154,9 @@ char printf_str::c#1 // reg byte a 1.0000001E7 void (*printf_str::putc)(char) void (*printf_str::putc#6)(char) // putc zp[2]:16 const char *printf_str::s -const char *printf_str::s#0 // s zp[2]:18 1.0000001E7 -const char *printf_str::s#5 // s zp[2]:18 1.5050002E7 -const char *printf_str::s#6 // s zp[2]:18 100001.0 +const char *printf_str::s#0 // s zp[2]:14 1.0000001E7 +const char *printf_str::s#5 // s zp[2]:14 1.5050002E7 +const char *printf_str::s#6 // s zp[2]:14 100001.0 void printf_uchar(void (*putc)(char) , char uvalue , char format_min_length , char format_justify_left , char format_sign_always , char format_zero_padding , char format_upper_case , char format_radix) struct printf_format_number printf_uchar::format char printf_uchar::format_justify_left @@ -6401,10 +6172,10 @@ char printf_uchar::uvalue char printf_uchar::uvalue#0 // reg byte x 367.33333333333337 unsigned int strlen(char *str) unsigned int strlen::len -unsigned int strlen::len#1 // len mem[2] 1.0000001E7 -unsigned int strlen::len#2 // len mem[2] 5002500.75 +unsigned int strlen::len#1 // len zp[2]:14 1.0000001E7 +unsigned int strlen::len#2 // len zp[2]:14 5002500.75 unsigned int strlen::return -unsigned int strlen::return#2 // return mem[2] 20002.0 +unsigned int strlen::return#2 // return zp[2]:14 20002.0 char *strlen::str char *strlen::str#0 // str zp[2]:16 2.0000002E7 char *strlen::str#2 // str zp[2]:16 1.0000001E7 @@ -6415,17 +6186,17 @@ char *uctoa::buffer#14 // buffer zp[2]:16 1500001.5 char *uctoa::buffer#3 // buffer zp[2]:16 20002.0 char *uctoa::buffer#4 // buffer zp[2]:16 2000002.0 char uctoa::digit -char uctoa::digit#1 // digit mem[1] 2000002.0 -char uctoa::digit#2 // digit mem[1] 307692.6153846154 +char uctoa::digit#1 // digit zp[1]:18 2000002.0 +char uctoa::digit#2 // digit zp[1]:18 307692.6153846154 char uctoa::digit_value -char uctoa::digit_value#0 // digit_value mem[1] 600000.6000000001 +char uctoa::digit_value#0 // digit_value zp[1]:8 600000.6000000001 char *uctoa::digit_values char uctoa::max_digits __constant char uctoa::max_digits#2 = 2 // max_digits char uctoa::radix char uctoa::started -char uctoa::started#2 // started mem[1] 600000.6000000001 -char uctoa::started#4 // started mem[1] 1000001.0 +char uctoa::started#2 // started zp[1]:20 600000.6000000001 +char uctoa::started#4 // started zp[1]:20 1000001.0 char uctoa::value char uctoa::value#0 // reg byte x 1000001.0 char uctoa::value#1 // reg byte x 5501.0 @@ -6440,60 +6211,53 @@ char uctoa_append::digit#2 // reg byte y 1.00050000015E10 char uctoa_append::return char uctoa_append::return#0 // reg byte x 2000002.0 char uctoa_append::sub -char uctoa_append::sub#0 // sub mem[1] 3.3335000005E9 +char uctoa_append::sub#0 // sub zp[1]:8 3.3335000005E9 char uctoa_append::value char uctoa_append::value#0 // reg byte x 3666667.333333333 char uctoa_append::value#1 // reg byte x 2.0000000002E10 char uctoa_append::value#2 // reg byte x 5.001833334166666E9 reg byte x [ conio_c64_init::line#2 conio_c64_init::line#0 ] -mem[1] [ main::current#2 main::current#4 ] -reg byte x [ gotoxy::y#4 gotoxy::y#3 gotoxy::y#2 ] +zp[1]:22 [ main::current#2 main::current#4 ] +reg byte x [ gotoxy::y#4 gotoxy::y#2 ] reg byte x [ clrscr::l#2 clrscr::l#1 ] reg byte y [ clrscr::c#2 clrscr::c#1 ] reg byte a [ petscii_to_screencode::return#10 petscii_to_screencode::return#1 petscii_to_screencode::petscii#0 petscii_to_screencode::return#3 petscii_to_screencode::return#4 petscii_to_screencode::return#5 petscii_to_screencode::return#6 ] -zp[2]:18 [ printf_str::s#5 printf_str::s#6 printf_str::s#0 clrscr::line_cols#5 clrscr::line_cols#1 ] -mem[1] [ uctoa::digit#2 uctoa::digit#1 ] reg byte x [ uctoa::value#2 uctoa::value#6 uctoa::value#1 uctoa::value#0 ] -mem[1] [ uctoa::started#2 uctoa::started#4 ] reg byte x [ printf_number_buffer::len#2 printf_number_buffer::len#0 printf_number_buffer::len#1 ] reg byte a [ printf_number_buffer::padding#10 printf_number_buffer::padding#1 ] zp[2]:2 [ memset::str#3 memset::dst#2 memset::dst#4 memset::dst#1 memcpy::source#2 memcpy::src#2 memcpy::src#4 memcpy::src#1 ] -reg byte x [ memset::c#4 memset::c#1 ] +reg byte x [ memset::c#4 ] reg byte x [ uctoa_append::value#2 uctoa_append::value#0 uctoa_append::value#1 ] reg byte y [ uctoa_append::digit#2 uctoa_append::digit#1 ] zp[2]:16 [ strlen::str#2 strlen::str#0 uctoa::buffer#11 uctoa::buffer#14 uctoa::buffer#4 uctoa::buffer#3 uctoa_append::buffer#0 printf_str::putc#6 clrscr::line_text#5 clrscr::line_text#1 ] -mem[2] [ strlen::len#2 strlen::len#1 strlen::return#2 printf_number_buffer::$19 ] -mem[1] [ printf_padding::i#2 printf_padding::i#1 ] -zp[2]:14 [ conio_line_text ] -zp[2]:12 [ conio_line_color ] +zp[2]:14 [ strlen::len#2 strlen::len#1 strlen::return#2 printf_number_buffer::$19 printf_str::s#5 printf_str::s#6 printf_str::s#0 clrscr::line_cols#5 clrscr::line_cols#1 ] +zp[1]:18 [ printf_padding::i#2 printf_padding::i#1 uctoa::digit#2 uctoa::digit#1 ] +zp[1]:19 [ conio_cursor_x ] +zp[1]:9 [ conio_cursor_y ] +zp[2]:12 [ conio_line_text ] +zp[2]:10 [ conio_line_color ] reg byte a [ cputc::c#0 ] -mem[1] [ conio_cursor_x ] reg byte a [ GETIN::return#0 ] -mem[1] [ main::ch#0 ] +zp[1]:23 [ main::ch#0 ] reg byte a [ petscii_to_screencode::return#0 ] -mem[1] [ main::$6 ] +zp[1]:20 [ main::$6 uctoa::started#2 uctoa::started#4 ] reg byte x [ printf_uchar::uvalue#0 ] -mem[1] [ conio_cursor_y ] -mem[2] [ gotoxy::$7 gotoxy::$9 gotoxy::line_offset#0 ] -mem[2] [ gotoxy::$8 ] -zp[2]:8 [ gotoxy::$5 ] -zp[2]:10 [ gotoxy::$6 ] +zp[2]:24 [ gotoxy::$7 gotoxy::$9 gotoxy::line_offset#0 gotoxy::$6 ] +zp[2]:26 [ gotoxy::$8 ] +zp[2]:28 [ gotoxy::$5 ] reg byte a [ GETIN::return#1 ] reg byte a [ printf_str::c#1 ] -mem[1] [ printf_number_buffer::buffer_sign#0 ] -mem[1] [ uctoa::digit_value#0 uctoa_append::sub#0 ] +zp[1]:8 [ uctoa::digit_value#0 uctoa_append::sub#0 printf_number_buffer::buffer_sign#0 ] reg byte x [ uctoa_append::return#0 ] -mem[1] [ printf_padding::length#0 ] +zp[1]:21 [ printf_padding::length#0 ] zp[2]:6 [ memcpy::src_end#0 ] zp[2]:4 [ memset::end#0 memcpy::destination#2 memcpy::dst#2 memcpy::dst#4 memcpy::dst#1 ] -mem[1] [ conio_textcolor ] -mem[1] [ conio_scroll_enable ] mem[12] [ printf_buffer ] FINAL ASSEMBLER -Score: 83661 +Score: 77545 // File Comments // Upstart @@ -6519,36 +6283,48 @@ Score: 83661 .label DEFAULT_SCREEN = $400 /// Default address of the chargen font (mixed case) .label DEFAULT_FONT_MIXED = $1800 + // The number of bytes on the screen + // The current cursor x-position + .label conio_cursor_x = $13 + // The current cursor y-position + .label conio_cursor_y = 9 // The current text cursor line start - .label conio_line_text = $e + .label conio_line_text = $c // The current color cursor line start - .label conio_line_color = $c + .label conio_line_color = $a .segment Code // __start __start: { // __start::__init1 + // __ma char conio_cursor_x = 0 + // [1] conio_cursor_x = 0 -- vbuz1=vbuc1 + lda #0 + sta.z conio_cursor_x + // __ma char conio_cursor_y = 0 + // [2] conio_cursor_y = 0 -- vbuz1=vbuc1 + sta.z conio_cursor_y // __ma char *conio_line_text = CONIO_SCREEN_TEXT - // [1] conio_line_text = DEFAULT_SCREEN -- pbuz1=pbuc1 + // [3] conio_line_text = DEFAULT_SCREEN -- pbuz1=pbuc1 lda #DEFAULT_SCREEN sta.z conio_line_text+1 // __ma char *conio_line_color = CONIO_SCREEN_COLORS - // [2] conio_line_color = COLORRAM -- pbuz1=pbuc1 + // [4] conio_line_color = COLORRAM -- pbuz1=pbuc1 lda #COLORRAM sta.z conio_line_color+1 // #pragma constructor_for(conio_c64_init, cputc, clrscr, cscroll) - // [3] call conio_c64_init + // [5] call conio_c64_init jsr conio_c64_init - // [4] phi from __start::__init1 to __start::@1 [phi:__start::__init1->__start::@1] + // [6] phi from __start::__init1 to __start::@1 [phi:__start::__init1->__start::@1] // __start::@1 - // [5] call main - // [25] phi from __start::@1 to main [phi:__start::@1->main] + // [7] call main + // [27] phi from __start::@1 to main [phi:__start::@1->main] jsr main // __start::@return - // [6] return + // [8] return rts } // conio_c64_init @@ -6557,30 +6333,28 @@ conio_c64_init: { // Position cursor at current line .label BASIC_CURSOR_LINE = $d6 // char line = *BASIC_CURSOR_LINE - // [7] conio_c64_init::line#0 = *conio_c64_init::BASIC_CURSOR_LINE -- vbuxx=_deref_pbuc1 + // [9] conio_c64_init::line#0 = *conio_c64_init::BASIC_CURSOR_LINE -- vbuxx=_deref_pbuc1 ldx BASIC_CURSOR_LINE // if(line>=CONIO_HEIGHT) - // [8] if(conio_c64_init::line#0<$19) goto conio_c64_init::@2 -- vbuxx_lt_vbuc1_then_la1 + // [10] if(conio_c64_init::line#0<$19) goto conio_c64_init::@2 -- vbuxx_lt_vbuc1_then_la1 cpx #$19 bcc __b1 - // [10] phi from conio_c64_init to conio_c64_init::@1 [phi:conio_c64_init->conio_c64_init::@1] - // [10] phi conio_c64_init::line#2 = $19-1 [phi:conio_c64_init->conio_c64_init::@1#0] -- vbuxx=vbuc1 + // [12] phi from conio_c64_init to conio_c64_init::@1 [phi:conio_c64_init->conio_c64_init::@1] + // [12] phi conio_c64_init::line#2 = $19-1 [phi:conio_c64_init->conio_c64_init::@1#0] -- vbuxx=vbuc1 ldx #$19-1 - // [9] phi from conio_c64_init to conio_c64_init::@2 [phi:conio_c64_init->conio_c64_init::@2] + // [11] phi from conio_c64_init to conio_c64_init::@2 [phi:conio_c64_init->conio_c64_init::@2] // conio_c64_init::@2 - // [10] phi from conio_c64_init::@2 to conio_c64_init::@1 [phi:conio_c64_init::@2->conio_c64_init::@1] - // [10] phi conio_c64_init::line#2 = conio_c64_init::line#0 [phi:conio_c64_init::@2->conio_c64_init::@1#0] -- register_copy + // [12] phi from conio_c64_init::@2 to conio_c64_init::@1 [phi:conio_c64_init::@2->conio_c64_init::@1] + // [12] phi conio_c64_init::line#2 = conio_c64_init::line#0 [phi:conio_c64_init::@2->conio_c64_init::@1#0] -- register_copy // conio_c64_init::@1 __b1: // gotoxy(0, line) - // [11] gotoxy::y#2 = conio_c64_init::line#2 - // [12] call gotoxy - // [49] phi from conio_c64_init::@1 to gotoxy [phi:conio_c64_init::@1->gotoxy] - // [49] phi gotoxy::y#3 = gotoxy::y#2 [phi:conio_c64_init::@1->gotoxy#0] -- register_copy + // [13] gotoxy::y#2 = conio_c64_init::line#2 + // [14] call gotoxy jsr gotoxy // conio_c64_init::@return // } - // [13] return + // [15] return rts } // cputc @@ -6589,44 +6363,44 @@ conio_c64_init: { // void cputc(__register(A) char c) cputc: { .const OFFSET_STACK_C = 0 - // [14] cputc::c#0 = stackidx(char,cputc::OFFSET_STACK_C) -- vbuaa=_stackidxbyte_vbuc1 + // [16] cputc::c#0 = stackidx(char,cputc::OFFSET_STACK_C) -- vbuaa=_stackidxbyte_vbuc1 tsx lda STACK_BASE+OFFSET_STACK_C,x // if(c=='\n') - // [15] if(cputc::c#0==' ') goto cputc::@1 -- vbuaa_eq_vbuc1_then_la1 + // [17] if(cputc::c#0==' ') goto cputc::@1 -- vbuaa_eq_vbuc1_then_la1 cmp #'\n' beq __b1 // cputc::@2 // conio_line_text[conio_cursor_x] = c - // [16] conio_line_text[conio_cursor_x] = cputc::c#0 -- pbuz1_derefidx_vbum2=vbuaa - ldy conio_cursor_x + // [18] conio_line_text[conio_cursor_x] = cputc::c#0 -- pbuz1_derefidx_vbuz2=vbuaa + ldy.z conio_cursor_x sta (conio_line_text),y // conio_line_color[conio_cursor_x] = conio_textcolor - // [17] conio_line_color[conio_cursor_x] = conio_textcolor -- pbuz1_derefidx_vbum2=vbum3 - lda conio_textcolor + // [19] conio_line_color[conio_cursor_x] = LIGHT_BLUE -- pbuz1_derefidx_vbuz2=vbuc1 + lda #LIGHT_BLUE sta (conio_line_color),y // if(++conio_cursor_x==CONIO_WIDTH) - // [18] conio_cursor_x = ++ conio_cursor_x -- vbum1=_inc_vbum1 - inc conio_cursor_x - // [19] if(conio_cursor_x!=$28) goto cputc::@return -- vbum1_neq_vbuc1_then_la1 + // [20] conio_cursor_x = ++ conio_cursor_x -- vbuz1=_inc_vbuz1 + inc.z conio_cursor_x + // [21] if(conio_cursor_x!=$28) goto cputc::@return -- vbuz1_neq_vbuc1_then_la1 lda #$28 - cmp conio_cursor_x + cmp.z conio_cursor_x bne __breturn - // [20] phi from cputc::@2 to cputc::@3 [phi:cputc::@2->cputc::@3] + // [22] phi from cputc::@2 to cputc::@3 [phi:cputc::@2->cputc::@3] // cputc::@3 // cputln() - // [21] call cputln + // [23] call cputln jsr cputln // cputc::@return __breturn: // } - // [22] return + // [24] return rts - // [23] phi from cputc to cputc::@1 [phi:cputc->cputc::@1] + // [25] phi from cputc to cputc::@1 [phi:cputc->cputc::@1] // cputc::@1 __b1: // cputln() - // [24] call cputln + // [26] call cputln jsr cputln rts } @@ -6634,61 +6408,64 @@ cputc: { // Show the currently pressed key main: { .const toD0181_return = (>(DEFAULT_SCREEN&$3fff)*4)|(>DEFAULT_FONT_MIXED)/4&$f - // [26] phi from main to main::toD0181 [phi:main->main::toD0181] + .label __6 = $14 + .label ch = $17 + .label current = $16 + // [28] phi from main to main::toD0181 [phi:main->main::toD0181] // main::toD0181 // main::@3 // VICII->MEMORY = toD018(DEFAULT_SCREEN, DEFAULT_FONT_MIXED) - // [27] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_MEMORY) = main::toD0181_return#0 -- _deref_pbuc1=vbuc2 + // [29] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_MEMORY) = main::toD0181_return#0 -- _deref_pbuc1=vbuc2 lda #toD0181_return sta VICII+OFFSET_STRUCT_MOS6569_VICII_MEMORY // clrscr() - // [28] call clrscr - // [70] phi from main::@3 to clrscr [phi:main::@3->clrscr] + // [30] call clrscr + // [71] phi from main::@3 to clrscr [phi:main::@3->clrscr] jsr clrscr - // [29] phi from main::@3 to main::@1 [phi:main::@3->main::@1] - // [29] phi main::current#2 = 0 [phi:main::@3->main::@1#0] -- vbum1=vbuc1 + // [31] phi from main::@3 to main::@1 [phi:main::@3->main::@1] + // [31] phi main::current#2 = 0 [phi:main::@3->main::@1#0] -- vbuz1=vbuc1 lda #0 - sta current - // [29] phi from main::@4 main::@9 to main::@1 [phi:main::@4/main::@9->main::@1] - // [29] phi main::current#2 = main::current#2 [phi:main::@4/main::@9->main::@1#0] -- register_copy + sta.z current + // [31] phi from main::@4 main::@9 to main::@1 [phi:main::@4/main::@9->main::@1] + // [31] phi main::current#2 = main::current#2 [phi:main::@4/main::@9->main::@1#0] -- register_copy // main::@1 __b1: // char ch = GETIN() - // [30] call GETIN + // [32] call GETIN jsr GETIN - // [31] GETIN::return#0 = GETIN::return#1 + // [33] GETIN::return#0 = GETIN::return#1 // main::@4 - // [32] main::ch#0 = GETIN::return#0 -- vbum1=vbuaa - sta ch + // [34] main::ch#0 = GETIN::return#0 -- vbuz1=vbuaa + sta.z ch // if(ch && ch!=current) - // [33] if(0==main::ch#0) goto main::@1 -- 0_eq_vbum1_then_la1 + // [35] if(0==main::ch#0) goto main::@1 -- 0_eq_vbuz1_then_la1 beq __b1 // main::@10 - // [34] if(main::ch#0!=main::current#2) goto main::@2 -- vbum1_neq_vbum2_then_la1 - cmp current + // [36] if(main::ch#0!=main::current#2) goto main::@2 -- vbuz1_neq_vbuz2_then_la1 + cmp.z current bne __b2 - // [29] phi from main::@10 to main::@1 [phi:main::@10->main::@1] + // [31] phi from main::@10 to main::@1 [phi:main::@10->main::@1] jmp __b1 // main::@2 __b2: // petscii_to_screencode(ch) - // [35] petscii_to_screencode::petscii#0 = main::ch#0 -- vbuaa=vbum1 - lda ch - // [36] call petscii_to_screencode + // [37] petscii_to_screencode::petscii#0 = main::ch#0 -- vbuaa=vbuz1 + lda.z ch + // [38] call petscii_to_screencode jsr petscii_to_screencode - // [37] petscii_to_screencode::return#0 = petscii_to_screencode::return#10 + // [39] petscii_to_screencode::return#0 = petscii_to_screencode::return#10 // main::@5 - // [38] main::$6 = petscii_to_screencode::return#0 -- vbum1=vbuaa - sta __6 + // [40] main::$6 = petscii_to_screencode::return#0 -- vbuz1=vbuaa + sta.z __6 // printf("'%c'($%2x) ", petscii_to_screencode(ch), ch) - // [39] call printf_str - // [102] phi from main::@5 to printf_str [phi:main::@5->printf_str] - // [102] phi printf_str::putc#6 = &cputc [phi:main::@5->printf_str#0] -- pprz1=pprc1 + // [41] call printf_str + // [103] phi from main::@5 to printf_str [phi:main::@5->printf_str] + // [103] phi printf_str::putc#6 = &cputc [phi:main::@5->printf_str#0] -- pprz1=pprc1 lda #cputc sta.z printf_str.putc+1 - // [102] phi printf_str::s#6 = main::s [phi:main::@5->printf_str#1] -- pbuz1=pbuc1 + // [103] phi printf_str::s#6 = main::s [phi:main::@5->printf_str#1] -- pbuz1=pbuc1 lda #s @@ -6696,21 +6473,21 @@ main: { jsr printf_str // main::@6 // printf("'%c'($%2x) ", petscii_to_screencode(ch), ch) - // [40] stackpush(char) = main::$6 -- _stackpushbyte_=vbum1 - lda __6 + // [42] stackpush(char) = main::$6 -- _stackpushbyte_=vbuz1 + lda.z __6 pha - // [41] callexecute cputc -- call_vprc1 + // [43] callexecute cputc -- call_vprc1 jsr cputc // sideeffect stackpullbytes(1) -- _stackpullbyte_1 pla - // [43] call printf_str - // [102] phi from main::@6 to printf_str [phi:main::@6->printf_str] - // [102] phi printf_str::putc#6 = &cputc [phi:main::@6->printf_str#0] -- pprz1=pprc1 + // [45] call printf_str + // [103] phi from main::@6 to printf_str [phi:main::@6->printf_str] + // [103] phi printf_str::putc#6 = &cputc [phi:main::@6->printf_str#0] -- pprz1=pprc1 lda #cputc sta.z printf_str.putc+1 - // [102] phi printf_str::s#6 = main::s1 [phi:main::@6->printf_str#1] -- pbuz1=pbuc1 + // [103] phi printf_str::s#6 = main::s1 [phi:main::@6->printf_str#1] -- pbuz1=pbuc1 lda #s1 @@ -6718,31 +6495,31 @@ main: { jsr printf_str // main::@7 // printf("'%c'($%2x) ", petscii_to_screencode(ch), ch) - // [44] printf_uchar::uvalue#0 = main::ch#0 -- vbuxx=vbum1 - ldx ch - // [45] call printf_uchar - // [111] phi from main::@7 to printf_uchar [phi:main::@7->printf_uchar] + // [46] printf_uchar::uvalue#0 = main::ch#0 -- vbuxx=vbuz1 + ldx.z ch + // [47] call printf_uchar + // [112] phi from main::@7 to printf_uchar [phi:main::@7->printf_uchar] jsr printf_uchar - // [46] phi from main::@7 to main::@8 [phi:main::@7->main::@8] + // [48] phi from main::@7 to main::@8 [phi:main::@7->main::@8] // main::@8 // printf("'%c'($%2x) ", petscii_to_screencode(ch), ch) - // [47] call printf_str - // [102] phi from main::@8 to printf_str [phi:main::@8->printf_str] - // [102] phi printf_str::putc#6 = &cputc [phi:main::@8->printf_str#0] -- pprz1=pprc1 + // [49] call printf_str + // [103] phi from main::@8 to printf_str [phi:main::@8->printf_str] + // [103] phi printf_str::putc#6 = &cputc [phi:main::@8->printf_str#0] -- pprz1=pprc1 lda #cputc sta.z printf_str.putc+1 - // [102] phi printf_str::s#6 = main::s2 [phi:main::@8->printf_str#1] -- pbuz1=pbuc1 + // [103] phi printf_str::s#6 = main::s2 [phi:main::@8->printf_str#1] -- pbuz1=pbuc1 lda #s2 sta.z printf_str.s+1 jsr printf_str // main::@9 - // [48] main::current#4 = main::ch#0 -- vbum1=vbum2 - lda ch - sta current + // [50] main::current#4 = main::ch#0 -- vbuz1=vbuz2 + lda.z ch + sta.z current jmp __b1 .segment Data s: .text "'" @@ -6751,114 +6528,110 @@ main: { .byte 0 s2: .text ") " .byte 0 - __6: .byte 0 - ch: .byte 0 - current: .byte 0 } .segment Code // gotoxy // Set the cursor to the specified position // void gotoxy(char x, __register(X) char y) gotoxy: { - .label __5 = 8 - .label __6 = $a + .const x = 0 + .label __5 = $1c + .label __6 = $18 + .label __7 = $18 + .label line_offset = $18 + .label __8 = $1a + .label __9 = $18 // if(y>CONIO_HEIGHT) - // [50] if(gotoxy::y#3<$19+1) goto gotoxy::@3 -- vbuxx_lt_vbuc1_then_la1 + // [51] if(gotoxy::y#2<$19+1) goto gotoxy::@3 -- vbuxx_lt_vbuc1_then_la1 cpx #$19+1 bcc __b2 - // [52] phi from gotoxy to gotoxy::@1 [phi:gotoxy->gotoxy::@1] - // [52] phi gotoxy::y#4 = 0 [phi:gotoxy->gotoxy::@1#0] -- vbuxx=vbuc1 + // [53] phi from gotoxy to gotoxy::@1 [phi:gotoxy->gotoxy::@1] + // [53] phi gotoxy::y#4 = 0 [phi:gotoxy->gotoxy::@1#0] -- vbuxx=vbuc1 ldx #0 - // [51] phi from gotoxy to gotoxy::@3 [phi:gotoxy->gotoxy::@3] + // [52] phi from gotoxy to gotoxy::@3 [phi:gotoxy->gotoxy::@3] // gotoxy::@3 - // [52] phi from gotoxy::@3 to gotoxy::@1 [phi:gotoxy::@3->gotoxy::@1] - // [52] phi gotoxy::y#4 = gotoxy::y#3 [phi:gotoxy::@3->gotoxy::@1#0] -- register_copy + // [53] phi from gotoxy::@3 to gotoxy::@1 [phi:gotoxy::@3->gotoxy::@1] + // [53] phi gotoxy::y#4 = gotoxy::y#2 [phi:gotoxy::@3->gotoxy::@1#0] -- register_copy // gotoxy::@1 // gotoxy::@2 __b2: // conio_cursor_x = x - // [53] conio_cursor_x = 0 -- vbum1=vbuc1 - lda #0 - sta conio_cursor_x + // [54] conio_cursor_x = gotoxy::x#2 -- vbuz1=vbuc1 + lda #x + sta.z conio_cursor_x // conio_cursor_y = y - // [54] conio_cursor_y = gotoxy::y#4 -- vbum1=vbuxx - stx conio_cursor_y + // [55] conio_cursor_y = gotoxy::y#4 -- vbuz1=vbuxx + stx.z conio_cursor_y // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH - // [55] gotoxy::$7 = (unsigned int)gotoxy::y#4 -- vwum1=_word_vbuxx + // [56] gotoxy::$7 = (unsigned int)gotoxy::y#4 -- vwuz1=_word_vbuxx txa - sta __7 + sta.z __7 lda #0 - sta __7+1 - // [56] gotoxy::$8 = gotoxy::$7 << 2 -- vwum1=vwum2_rol_2 - lda __7 + sta.z __7+1 + // [57] gotoxy::$8 = gotoxy::$7 << 2 -- vwuz1=vwuz2_rol_2 + lda.z __7 asl - sta __8 - lda __7+1 + sta.z __8 + lda.z __7+1 rol - sta __8+1 - asl __8 - rol __8+1 - // [57] gotoxy::$9 = gotoxy::$8 + gotoxy::$7 -- vwum1=vwum2_plus_vwum1 + sta.z __8+1 + asl.z __8 + rol.z __8+1 + // [58] gotoxy::$9 = gotoxy::$8 + gotoxy::$7 -- vwuz1=vwuz2_plus_vwuz1 clc - lda __9 - adc __8 - sta __9 - lda __9+1 - adc __8+1 - sta __9+1 - // [58] gotoxy::line_offset#0 = gotoxy::$9 << 3 -- vwum1=vwum1_rol_3 - asl line_offset - rol line_offset+1 - asl line_offset - rol line_offset+1 - asl line_offset - rol line_offset+1 + lda.z __9 + adc.z __8 + sta.z __9 + lda.z __9+1 + adc.z __8+1 + sta.z __9+1 + // [59] gotoxy::line_offset#0 = gotoxy::$9 << 3 -- vwuz1=vwuz1_rol_3 + asl.z line_offset + rol.z line_offset+1 + asl.z line_offset + rol.z line_offset+1 + asl.z line_offset + rol.z line_offset+1 // CONIO_SCREEN_TEXT + line_offset - // [59] gotoxy::$5 = DEFAULT_SCREEN + gotoxy::line_offset#0 -- pbuz1=pbuc1_plus_vwum2 - lda line_offset + // [60] gotoxy::$5 = DEFAULT_SCREEN + gotoxy::line_offset#0 -- pbuz1=pbuc1_plus_vwuz2 + lda.z line_offset clc adc #DEFAULT_SCREEN sta.z __5+1 // conio_line_text = CONIO_SCREEN_TEXT + line_offset - // [60] conio_line_text = gotoxy::$5 -- pbuz1=pbuz2 + // [61] conio_line_text = gotoxy::$5 -- pbuz1=pbuz2 lda.z __5 sta.z conio_line_text lda.z __5+1 sta.z conio_line_text+1 // CONIO_SCREEN_COLORS + line_offset - // [61] gotoxy::$6 = COLORRAM + gotoxy::line_offset#0 -- pbuz1=pbuc1_plus_vwum2 - lda line_offset + // [62] gotoxy::$6 = COLORRAM + gotoxy::line_offset#0 -- pbuz1=pbuc1_plus_vwuz1 + lda.z __6 clc adc #COLORRAM sta.z __6+1 // conio_line_color = CONIO_SCREEN_COLORS + line_offset - // [62] conio_line_color = gotoxy::$6 -- pbuz1=pbuz2 + // [63] conio_line_color = gotoxy::$6 -- pbuz1=pbuz2 lda.z __6 sta.z conio_line_color lda.z __6+1 sta.z conio_line_color+1 // gotoxy::@return // } - // [63] return + // [64] return rts - .segment Data - __7: .word 0 - .label line_offset = __7 - __8: .word 0 - .label __9 = __7 } -.segment Code // cputln // Print a newline cputln: { // conio_line_text += CONIO_WIDTH - // [64] conio_line_text = conio_line_text + $28 -- pbuz1=pbuz1_plus_vbuc1 + // [65] conio_line_text = conio_line_text + $28 -- pbuz1=pbuz1_plus_vbuc1 lda #$28 clc adc.z conio_line_text @@ -6867,7 +6640,7 @@ cputln: { inc.z conio_line_text+1 !: // conio_line_color += CONIO_WIDTH - // [65] conio_line_color = conio_line_color + $28 -- pbuz1=pbuz1_plus_vbuc1 + // [66] conio_line_color = conio_line_color + $28 -- pbuz1=pbuz1_plus_vbuc1 lda #$28 clc adc.z conio_line_color @@ -6876,81 +6649,81 @@ cputln: { inc.z conio_line_color+1 !: // conio_cursor_x = 0 - // [66] conio_cursor_x = 0 -- vbum1=vbuc1 + // [67] conio_cursor_x = 0 -- vbuz1=vbuc1 lda #0 - sta conio_cursor_x + sta.z conio_cursor_x // conio_cursor_y++; - // [67] conio_cursor_y = ++ conio_cursor_y -- vbum1=_inc_vbum1 - inc conio_cursor_y + // [68] conio_cursor_y = ++ conio_cursor_y -- vbuz1=_inc_vbuz1 + inc.z conio_cursor_y // cscroll() - // [68] call cscroll + // [69] call cscroll jsr cscroll // cputln::@return // } - // [69] return + // [70] return rts } // clrscr // clears the screen and moves the cursor to the upper left-hand corner of the screen. clrscr: { .label line_text = $10 - .label line_cols = $12 - // [71] phi from clrscr to clrscr::@1 [phi:clrscr->clrscr::@1] - // [71] phi clrscr::line_cols#5 = COLORRAM [phi:clrscr->clrscr::@1#0] -- pbuz1=pbuc1 + .label line_cols = $e + // [72] phi from clrscr to clrscr::@1 [phi:clrscr->clrscr::@1] + // [72] phi clrscr::line_cols#5 = COLORRAM [phi:clrscr->clrscr::@1#0] -- pbuz1=pbuc1 lda #COLORRAM sta.z line_cols+1 - // [71] phi clrscr::line_text#5 = DEFAULT_SCREEN [phi:clrscr->clrscr::@1#1] -- pbuz1=pbuc1 + // [72] phi clrscr::line_text#5 = DEFAULT_SCREEN [phi:clrscr->clrscr::@1#1] -- pbuz1=pbuc1 lda #DEFAULT_SCREEN sta.z line_text+1 - // [71] phi clrscr::l#2 = 0 [phi:clrscr->clrscr::@1#2] -- vbuxx=vbuc1 + // [72] phi clrscr::l#2 = 0 [phi:clrscr->clrscr::@1#2] -- vbuxx=vbuc1 ldx #0 // clrscr::@1 __b1: // for( char l=0;lDEFAULT_SCREEN sta.z conio_line_text+1 // conio_line_color = CONIO_SCREEN_COLORS - // [76] conio_line_color = COLORRAM -- pbuz1=pbuc1 + // [77] conio_line_color = COLORRAM -- pbuz1=pbuc1 lda #COLORRAM sta.z conio_line_color+1 // clrscr::@return // } - // [77] return + // [78] return rts - // [78] phi from clrscr::@1 to clrscr::@3 [phi:clrscr::@1->clrscr::@3] + // [79] phi from clrscr::@1 to clrscr::@3 [phi:clrscr::@1->clrscr::@3] __b2: - // [78] phi clrscr::c#2 = 0 [phi:clrscr::@1->clrscr::@3#0] -- vbuyy=vbuc1 + // [79] phi clrscr::c#2 = 0 [phi:clrscr::@1->clrscr::@3#0] -- vbuyy=vbuc1 ldy #0 // clrscr::@3 __b3: // for( char c=0;cclrscr::@1] - // [71] phi clrscr::line_cols#5 = clrscr::line_cols#1 [phi:clrscr::@5->clrscr::@1#0] -- register_copy - // [71] phi clrscr::line_text#5 = clrscr::line_text#1 [phi:clrscr::@5->clrscr::@1#1] -- register_copy - // [71] phi clrscr::l#2 = clrscr::l#1 [phi:clrscr::@5->clrscr::@1#2] -- register_copy + // [72] phi from clrscr::@5 to clrscr::@1 [phi:clrscr::@5->clrscr::@1] + // [72] phi clrscr::line_cols#5 = clrscr::line_cols#1 [phi:clrscr::@5->clrscr::@1#0] -- register_copy + // [72] phi clrscr::line_text#5 = clrscr::line_text#1 [phi:clrscr::@5->clrscr::@1#1] -- register_copy + // [72] phi clrscr::l#2 = clrscr::l#1 [phi:clrscr::@5->clrscr::@1#2] -- register_copy jmp __b1 // clrscr::@4 __b4: // line_text[c] = ' ' - // [83] clrscr::line_text#5[clrscr::c#2] = ' ' -- pbuz1_derefidx_vbuyy=vbuc1 + // [84] clrscr::line_text#5[clrscr::c#2] = ' ' -- pbuz1_derefidx_vbuyy=vbuc1 lda #' ' sta (line_text),y // line_cols[c] = conio_textcolor - // [84] clrscr::line_cols#5[clrscr::c#2] = conio_textcolor -- pbuz1_derefidx_vbuyy=vbum2 - lda conio_textcolor + // [85] clrscr::line_cols#5[clrscr::c#2] = LIGHT_BLUE -- pbuz1_derefidx_vbuyy=vbuc1 + lda #LIGHT_BLUE sta (line_cols),y // for( char c=0;cclrscr::@3] - // [78] phi clrscr::c#2 = clrscr::c#1 [phi:clrscr::@4->clrscr::@3#0] -- register_copy + // [79] phi from clrscr::@4 to clrscr::@3 [phi:clrscr::@4->clrscr::@3] + // [79] phi clrscr::c#2 = clrscr::c#1 [phi:clrscr::@4->clrscr::@3#0] -- register_copy jmp __b3 } // GETIN @@ -7002,10 +6775,10 @@ GETIN: { jsr $ffe4 sta ch // return *ch; - // [87] GETIN::return#1 = *GETIN::ch -- vbuaa=_deref_pbuc1 + // [88] GETIN::return#1 = *GETIN::ch -- vbuaa=_deref_pbuc1 // GETIN::@return // } - // [88] return + // [89] return rts } // petscii_to_screencode @@ -7013,112 +6786,112 @@ GETIN: { // __register(A) char petscii_to_screencode(__register(A) char petscii) petscii_to_screencode: { // if(petscii<32) - // [89] if(petscii_to_screencode::petscii#0<$20) goto petscii_to_screencode::@1 -- vbuaa_lt_vbuc1_then_la1 + // [90] if(petscii_to_screencode::petscii#0<$20) goto petscii_to_screencode::@1 -- vbuaa_lt_vbuc1_then_la1 cmp #$20 bcc __b1 // petscii_to_screencode::@6 // if(petscii<64) - // [90] if(petscii_to_screencode::petscii#0<$40) goto petscii_to_screencode::@return -- vbuaa_lt_vbuc1_then_la1 + // [91] if(petscii_to_screencode::petscii#0<$40) goto petscii_to_screencode::@return -- vbuaa_lt_vbuc1_then_la1 cmp #$40 bcc __breturn // petscii_to_screencode::@7 // if(petscii<96) - // [91] if(petscii_to_screencode::petscii#0<$60) goto petscii_to_screencode::@2 -- vbuaa_lt_vbuc1_then_la1 + // [92] if(petscii_to_screencode::petscii#0<$60) goto petscii_to_screencode::@2 -- vbuaa_lt_vbuc1_then_la1 cmp #$60 bcc __b2 // petscii_to_screencode::@8 // if(petscii<128) - // [92] if(petscii_to_screencode::petscii#0<$80) goto petscii_to_screencode::@3 -- vbuaa_lt_vbuc1_then_la1 + // [93] if(petscii_to_screencode::petscii#0<$80) goto petscii_to_screencode::@3 -- vbuaa_lt_vbuc1_then_la1 cmp #$80 bcc __b3 // petscii_to_screencode::@9 // if(petscii<160) - // [93] if(petscii_to_screencode::petscii#0<$a0) goto petscii_to_screencode::@4 -- vbuaa_lt_vbuc1_then_la1 + // [94] if(petscii_to_screencode::petscii#0<$a0) goto petscii_to_screencode::@4 -- vbuaa_lt_vbuc1_then_la1 cmp #$a0 bcc __b4 // petscii_to_screencode::@10 // if(petscii<255) - // [94] if(petscii_to_screencode::petscii#0<$ff) goto petscii_to_screencode::@5 -- vbuaa_lt_vbuc1_then_la1 + // [95] if(petscii_to_screencode::petscii#0<$ff) goto petscii_to_screencode::@5 -- vbuaa_lt_vbuc1_then_la1 cmp #$ff bcc __b5 - // [96] phi from petscii_to_screencode::@10 to petscii_to_screencode::@return [phi:petscii_to_screencode::@10->petscii_to_screencode::@return] - // [96] phi petscii_to_screencode::return#10 = $5e [phi:petscii_to_screencode::@10->petscii_to_screencode::@return#0] -- vbuaa=vbuc1 + // [97] phi from petscii_to_screencode::@10 to petscii_to_screencode::@return [phi:petscii_to_screencode::@10->petscii_to_screencode::@return] + // [97] phi petscii_to_screencode::return#10 = $5e [phi:petscii_to_screencode::@10->petscii_to_screencode::@return#0] -- vbuaa=vbuc1 lda #$5e rts // petscii_to_screencode::@5 __b5: // return petscii-128; - // [95] petscii_to_screencode::return#6 = petscii_to_screencode::petscii#0 - $80 -- vbuaa=vbuaa_minus_vbuc1 + // [96] petscii_to_screencode::return#6 = petscii_to_screencode::petscii#0 - $80 -- vbuaa=vbuaa_minus_vbuc1 sec sbc #$80 - // [96] phi from petscii_to_screencode::@1 petscii_to_screencode::@2 petscii_to_screencode::@3 petscii_to_screencode::@4 petscii_to_screencode::@5 petscii_to_screencode::@6 to petscii_to_screencode::@return [phi:petscii_to_screencode::@1/petscii_to_screencode::@2/petscii_to_screencode::@3/petscii_to_screencode::@4/petscii_to_screencode::@5/petscii_to_screencode::@6->petscii_to_screencode::@return] - // [96] phi petscii_to_screencode::return#10 = petscii_to_screencode::return#1 [phi:petscii_to_screencode::@1/petscii_to_screencode::@2/petscii_to_screencode::@3/petscii_to_screencode::@4/petscii_to_screencode::@5/petscii_to_screencode::@6->petscii_to_screencode::@return#0] -- register_copy + // [97] phi from petscii_to_screencode::@1 petscii_to_screencode::@2 petscii_to_screencode::@3 petscii_to_screencode::@4 petscii_to_screencode::@5 petscii_to_screencode::@6 to petscii_to_screencode::@return [phi:petscii_to_screencode::@1/petscii_to_screencode::@2/petscii_to_screencode::@3/petscii_to_screencode::@4/petscii_to_screencode::@5/petscii_to_screencode::@6->petscii_to_screencode::@return] + // [97] phi petscii_to_screencode::return#10 = petscii_to_screencode::return#1 [phi:petscii_to_screencode::@1/petscii_to_screencode::@2/petscii_to_screencode::@3/petscii_to_screencode::@4/petscii_to_screencode::@5/petscii_to_screencode::@6->petscii_to_screencode::@return#0] -- register_copy // petscii_to_screencode::@return __breturn: // } - // [97] return + // [98] return rts // petscii_to_screencode::@4 __b4: // return petscii+64; - // [98] petscii_to_screencode::return#5 = petscii_to_screencode::petscii#0 + $40 -- vbuaa=vbuaa_plus_vbuc1 + // [99] petscii_to_screencode::return#5 = petscii_to_screencode::petscii#0 + $40 -- vbuaa=vbuaa_plus_vbuc1 clc adc #$40 rts // petscii_to_screencode::@3 __b3: // return petscii-32; - // [99] petscii_to_screencode::return#4 = petscii_to_screencode::petscii#0 - $20 -- vbuaa=vbuaa_minus_vbuc1 + // [100] petscii_to_screencode::return#4 = petscii_to_screencode::petscii#0 - $20 -- vbuaa=vbuaa_minus_vbuc1 sec sbc #$20 rts // petscii_to_screencode::@2 __b2: // return petscii-64; - // [100] petscii_to_screencode::return#3 = petscii_to_screencode::petscii#0 - $40 -- vbuaa=vbuaa_minus_vbuc1 + // [101] petscii_to_screencode::return#3 = petscii_to_screencode::petscii#0 - $40 -- vbuaa=vbuaa_minus_vbuc1 sec sbc #$40 rts // petscii_to_screencode::@1 __b1: // return petscii+128; - // [101] petscii_to_screencode::return#1 = petscii_to_screencode::petscii#0 + $80 -- vbuaa=vbuaa_plus_vbuc1 + // [102] petscii_to_screencode::return#1 = petscii_to_screencode::petscii#0 + $80 -- vbuaa=vbuaa_plus_vbuc1 clc adc #$80 rts } // printf_str /// Print a NUL-terminated string -// void printf_str(__zp($10) void (*putc)(char), __zp($12) const char *s) +// void printf_str(__zp($10) void (*putc)(char), __zp($e) const char *s) printf_str: { - .label s = $12 + .label s = $e .label putc = $10 - // [103] phi from printf_str printf_str::@2 to printf_str::@1 [phi:printf_str/printf_str::@2->printf_str::@1] - // [103] phi printf_str::s#5 = printf_str::s#6 [phi:printf_str/printf_str::@2->printf_str::@1#0] -- register_copy + // [104] phi from printf_str printf_str::@2 to printf_str::@1 [phi:printf_str/printf_str::@2->printf_str::@1] + // [104] phi printf_str::s#5 = printf_str::s#6 [phi:printf_str/printf_str::@2->printf_str::@1#0] -- register_copy // printf_str::@1 __b1: // while(c=*s++) - // [104] printf_str::c#1 = *printf_str::s#5 -- vbuaa=_deref_pbuz1 + // [105] printf_str::c#1 = *printf_str::s#5 -- vbuaa=_deref_pbuz1 ldy #0 lda (s),y - // [105] printf_str::s#0 = ++ printf_str::s#5 -- pbuz1=_inc_pbuz1 + // [106] printf_str::s#0 = ++ printf_str::s#5 -- pbuz1=_inc_pbuz1 inc.z s bne !+ inc.z s+1 !: - // [106] if(0!=printf_str::c#1) goto printf_str::@2 -- 0_neq_vbuaa_then_la1 + // [107] if(0!=printf_str::c#1) goto printf_str::@2 -- 0_neq_vbuaa_then_la1 cmp #0 bne __b2 // printf_str::@return // } - // [107] return + // [108] return rts // printf_str::@2 __b2: // putc(c) - // [108] stackpush(char) = printf_str::c#1 -- _stackpushbyte_=vbuaa + // [109] stackpush(char) = printf_str::c#1 -- _stackpushbyte_=vbuaa pha - // [109] callexecute *printf_str::putc#6 -- call__deref_pprz1 + // [110] callexecute *printf_str::putc#6 -- call__deref_pprz1 jsr icall2 // sideeffect stackpullbytes(1) -- _stackpullbyte_1 pla @@ -7135,118 +6908,99 @@ printf_uchar: { .label format_min_length = 2 // printf_uchar::@1 // printf_buffer.sign = format.sign_always?'+':0 - // [112] *((char *)&printf_buffer) = 0 -- _deref_pbuc1=vbuc2 + // [113] *((char *)&printf_buffer) = 0 -- _deref_pbuc1=vbuc2 // Handle any sign lda #0 sta printf_buffer // uctoa(uvalue, printf_buffer.digits, format.radix) - // [113] uctoa::value#1 = printf_uchar::uvalue#0 - // [114] call uctoa + // [114] uctoa::value#1 = printf_uchar::uvalue#0 + // [115] call uctoa // Format number into buffer - // [134] phi from printf_uchar::@1 to uctoa [phi:printf_uchar::@1->uctoa] + // [132] phi from printf_uchar::@1 to uctoa [phi:printf_uchar::@1->uctoa] jsr uctoa // printf_uchar::@2 // printf_number_buffer(putc, printf_buffer, format) - // [115] printf_number_buffer::buffer_sign#0 = *((char *)&printf_buffer) -- vbum1=_deref_pbuc1 + // [116] printf_number_buffer::buffer_sign#0 = *((char *)&printf_buffer) -- vbuz1=_deref_pbuc1 lda printf_buffer - sta printf_number_buffer.buffer_sign - // [116] call printf_number_buffer + sta.z printf_number_buffer.buffer_sign + // [117] call printf_number_buffer // Print using format - // [153] phi from printf_uchar::@2 to printf_number_buffer [phi:printf_uchar::@2->printf_number_buffer] + // [151] phi from printf_uchar::@2 to printf_number_buffer [phi:printf_uchar::@2->printf_number_buffer] jsr printf_number_buffer // printf_uchar::@return // } - // [117] return + // [118] return rts } // cscroll // Scroll the entire screen if the cursor is beyond the last line cscroll: { // if(conio_cursor_y==CONIO_HEIGHT) - // [118] if(conio_cursor_y!=$19) goto cscroll::@return -- vbum1_neq_vbuc1_then_la1 + // [119] if(conio_cursor_y!=$19) goto cscroll::@return -- vbuz1_neq_vbuc1_then_la1 lda #$19 - cmp conio_cursor_y + cmp.z conio_cursor_y bne __breturn + // [120] phi from cscroll to cscroll::@1 [phi:cscroll->cscroll::@1] // cscroll::@1 - // if(conio_scroll_enable) - // [119] if(0!=conio_scroll_enable) goto cscroll::@3 -- 0_neq_vbum1_then_la1 - lda conio_scroll_enable - bne __b3 - // [120] phi from cscroll::@1 to cscroll::@2 [phi:cscroll::@1->cscroll::@2] - // cscroll::@2 - // gotoxy(0,0) - // [121] call gotoxy - // [49] phi from cscroll::@2 to gotoxy [phi:cscroll::@2->gotoxy] - // [49] phi gotoxy::y#3 = 0 [phi:cscroll::@2->gotoxy#0] -- vbuxx=vbuc1 - ldx #0 - jsr gotoxy - // cscroll::@return - __breturn: - // } - // [122] return - rts - // [123] phi from cscroll::@1 to cscroll::@3 [phi:cscroll::@1->cscroll::@3] - // cscroll::@3 - __b3: // memcpy(CONIO_SCREEN_TEXT, CONIO_SCREEN_TEXT+CONIO_WIDTH, CONIO_BYTES-CONIO_WIDTH) - // [124] call memcpy - // [176] phi from cscroll::@3 to memcpy [phi:cscroll::@3->memcpy] - // [176] phi memcpy::destination#2 = (void *)DEFAULT_SCREEN [phi:cscroll::@3->memcpy#0] -- pvoz1=pvoc1 + // [121] call memcpy + // [174] phi from cscroll::@1 to memcpy [phi:cscroll::@1->memcpy] + // [174] phi memcpy::destination#2 = (void *)DEFAULT_SCREEN [phi:cscroll::@1->memcpy#0] -- pvoz1=pvoc1 lda #DEFAULT_SCREEN sta.z memcpy.destination+1 - // [176] phi memcpy::source#2 = (void *)DEFAULT_SCREEN+$28 [phi:cscroll::@3->memcpy#1] -- pvoz1=pvoc1 + // [174] phi memcpy::source#2 = (void *)DEFAULT_SCREEN+$28 [phi:cscroll::@1->memcpy#1] -- pvoz1=pvoc1 lda #DEFAULT_SCREEN+$28 sta.z memcpy.source+1 jsr memcpy - // [125] phi from cscroll::@3 to cscroll::@4 [phi:cscroll::@3->cscroll::@4] - // cscroll::@4 + // [122] phi from cscroll::@1 to cscroll::@2 [phi:cscroll::@1->cscroll::@2] + // cscroll::@2 // memcpy(CONIO_SCREEN_COLORS, CONIO_SCREEN_COLORS+CONIO_WIDTH, CONIO_BYTES-CONIO_WIDTH) - // [126] call memcpy - // [176] phi from cscroll::@4 to memcpy [phi:cscroll::@4->memcpy] - // [176] phi memcpy::destination#2 = (void *)COLORRAM [phi:cscroll::@4->memcpy#0] -- pvoz1=pvoc1 + // [123] call memcpy + // [174] phi from cscroll::@2 to memcpy [phi:cscroll::@2->memcpy] + // [174] phi memcpy::destination#2 = (void *)COLORRAM [phi:cscroll::@2->memcpy#0] -- pvoz1=pvoc1 lda #COLORRAM sta.z memcpy.destination+1 - // [176] phi memcpy::source#2 = (void *)COLORRAM+$28 [phi:cscroll::@4->memcpy#1] -- pvoz1=pvoc1 + // [174] phi memcpy::source#2 = (void *)COLORRAM+$28 [phi:cscroll::@2->memcpy#1] -- pvoz1=pvoc1 lda #COLORRAM+$28 sta.z memcpy.source+1 jsr memcpy - // [127] phi from cscroll::@4 to cscroll::@5 [phi:cscroll::@4->cscroll::@5] - // cscroll::@5 + // [124] phi from cscroll::@2 to cscroll::@3 [phi:cscroll::@2->cscroll::@3] + // cscroll::@3 // memset(CONIO_SCREEN_TEXT+CONIO_BYTES-CONIO_WIDTH, ' ', CONIO_WIDTH) - // [128] call memset - // [186] phi from cscroll::@5 to memset [phi:cscroll::@5->memset] - // [186] phi memset::c#4 = ' ' [phi:cscroll::@5->memset#0] -- vbuxx=vbuc1 + // [125] call memset + // [184] phi from cscroll::@3 to memset [phi:cscroll::@3->memset] + // [184] phi memset::c#4 = ' ' [phi:cscroll::@3->memset#0] -- vbuxx=vbuc1 ldx #' ' - // [186] phi memset::str#3 = (void *)DEFAULT_SCREEN+(unsigned int)$19*$28-$28 [phi:cscroll::@5->memset#1] -- pvoz1=pvoc1 + // [184] phi memset::str#3 = (void *)DEFAULT_SCREEN+(unsigned int)$19*$28-$28 [phi:cscroll::@3->memset#1] -- pvoz1=pvoc1 lda #DEFAULT_SCREEN+$19*$28-$28 sta.z memset.str+1 jsr memset - // cscroll::@6 + // [126] phi from cscroll::@3 to cscroll::@4 [phi:cscroll::@3->cscroll::@4] + // cscroll::@4 // memset(CONIO_SCREEN_COLORS+CONIO_BYTES-CONIO_WIDTH, conio_textcolor, CONIO_WIDTH) - // [129] memset::c#1 = conio_textcolor -- vbuxx=vbum1 - ldx conio_textcolor - // [130] call memset - // [186] phi from cscroll::@6 to memset [phi:cscroll::@6->memset] - // [186] phi memset::c#4 = memset::c#1 [phi:cscroll::@6->memset#0] -- register_copy - // [186] phi memset::str#3 = (void *)COLORRAM+(unsigned int)$19*$28-$28 [phi:cscroll::@6->memset#1] -- pvoz1=pvoc1 + // [127] call memset + // [184] phi from cscroll::@4 to memset [phi:cscroll::@4->memset] + // [184] phi memset::c#4 = LIGHT_BLUE [phi:cscroll::@4->memset#0] -- vbuxx=vbuc1 + ldx #LIGHT_BLUE + // [184] phi memset::str#3 = (void *)COLORRAM+(unsigned int)$19*$28-$28 [phi:cscroll::@4->memset#1] -- pvoz1=pvoc1 lda #COLORRAM+$19*$28-$28 sta.z memset.str+1 jsr memset - // cscroll::@7 + // cscroll::@5 // conio_line_text -= CONIO_WIDTH - // [131] conio_line_text = conio_line_text - $28 -- pbuz1=pbuz1_minus_vbuc1 + // [128] conio_line_text = conio_line_text - $28 -- pbuz1=pbuz1_minus_vbuc1 sec lda.z conio_line_text sbc #$28 @@ -7255,7 +7009,7 @@ cscroll: { sbc #0 sta.z conio_line_text+1 // conio_line_color -= CONIO_WIDTH - // [132] conio_line_color = conio_line_color - $28 -- pbuz1=pbuz1_minus_vbuc1 + // [129] conio_line_color = conio_line_color - $28 -- pbuz1=pbuz1_minus_vbuc1 sec lda.z conio_line_color sbc #$28 @@ -7264,8 +7018,12 @@ cscroll: { sbc #0 sta.z conio_line_color+1 // conio_cursor_y--; - // [133] conio_cursor_y = -- conio_cursor_y -- vbum1=_dec_vbum1 - dec conio_cursor_y + // [130] conio_cursor_y = -- conio_cursor_y -- vbuz1=_dec_vbuz1 + dec.z conio_cursor_y + // cscroll::@return + __breturn: + // } + // [131] return rts } // uctoa @@ -7277,201 +7035,201 @@ cscroll: { // void uctoa(__register(X) char value, __zp($10) char *buffer, char radix) uctoa: { .const max_digits = 2 + .label digit_value = 8 .label buffer = $10 - // [135] phi from uctoa to uctoa::@1 [phi:uctoa->uctoa::@1] - // [135] phi uctoa::buffer#11 = (char *)&printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS [phi:uctoa->uctoa::@1#0] -- pbuz1=pbuc1 + .label digit = $12 + .label started = $14 + // [133] phi from uctoa to uctoa::@1 [phi:uctoa->uctoa::@1] + // [133] phi uctoa::buffer#11 = (char *)&printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS [phi:uctoa->uctoa::@1#0] -- pbuz1=pbuc1 lda #printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS sta.z buffer+1 - // [135] phi uctoa::started#2 = 0 [phi:uctoa->uctoa::@1#1] -- vbum1=vbuc1 + // [133] phi uctoa::started#2 = 0 [phi:uctoa->uctoa::@1#1] -- vbuz1=vbuc1 lda #0 - sta started - // [135] phi uctoa::value#2 = uctoa::value#1 [phi:uctoa->uctoa::@1#2] -- register_copy - // [135] phi uctoa::digit#2 = 0 [phi:uctoa->uctoa::@1#3] -- vbum1=vbuc1 - sta digit + sta.z started + // [133] phi uctoa::value#2 = uctoa::value#1 [phi:uctoa->uctoa::@1#2] -- register_copy + // [133] phi uctoa::digit#2 = 0 [phi:uctoa->uctoa::@1#3] -- vbuz1=vbuc1 + sta.z digit // uctoa::@1 __b1: // for( char digit=0; digit= digit_value) - // [142] if(0!=uctoa::started#2) goto uctoa::@5 -- 0_neq_vbum1_then_la1 - lda started + // [140] if(0!=uctoa::started#2) goto uctoa::@5 -- 0_neq_vbuz1_then_la1 + lda.z started bne __b5 // uctoa::@7 - // [143] if(uctoa::value#2>=uctoa::digit_value#0) goto uctoa::@5 -- vbuxx_ge_vbum1_then_la1 - cpx digit_value + // [141] if(uctoa::value#2>=uctoa::digit_value#0) goto uctoa::@5 -- vbuxx_ge_vbuz1_then_la1 + cpx.z digit_value bcs __b5 - // [144] phi from uctoa::@7 to uctoa::@4 [phi:uctoa::@7->uctoa::@4] - // [144] phi uctoa::buffer#14 = uctoa::buffer#11 [phi:uctoa::@7->uctoa::@4#0] -- register_copy - // [144] phi uctoa::started#4 = uctoa::started#2 [phi:uctoa::@7->uctoa::@4#1] -- register_copy - // [144] phi uctoa::value#6 = uctoa::value#2 [phi:uctoa::@7->uctoa::@4#2] -- register_copy + // [142] phi from uctoa::@7 to uctoa::@4 [phi:uctoa::@7->uctoa::@4] + // [142] phi uctoa::buffer#14 = uctoa::buffer#11 [phi:uctoa::@7->uctoa::@4#0] -- register_copy + // [142] phi uctoa::started#4 = uctoa::started#2 [phi:uctoa::@7->uctoa::@4#1] -- register_copy + // [142] phi uctoa::value#6 = uctoa::value#2 [phi:uctoa::@7->uctoa::@4#2] -- register_copy // uctoa::@4 __b4: // for( char digit=0; digituctoa::@1] - // [135] phi uctoa::buffer#11 = uctoa::buffer#14 [phi:uctoa::@4->uctoa::@1#0] -- register_copy - // [135] phi uctoa::started#2 = uctoa::started#4 [phi:uctoa::@4->uctoa::@1#1] -- register_copy - // [135] phi uctoa::value#2 = uctoa::value#6 [phi:uctoa::@4->uctoa::@1#2] -- register_copy - // [135] phi uctoa::digit#2 = uctoa::digit#1 [phi:uctoa::@4->uctoa::@1#3] -- register_copy + // [143] uctoa::digit#1 = ++ uctoa::digit#2 -- vbuz1=_inc_vbuz1 + inc.z digit + // [133] phi from uctoa::@4 to uctoa::@1 [phi:uctoa::@4->uctoa::@1] + // [133] phi uctoa::buffer#11 = uctoa::buffer#14 [phi:uctoa::@4->uctoa::@1#0] -- register_copy + // [133] phi uctoa::started#2 = uctoa::started#4 [phi:uctoa::@4->uctoa::@1#1] -- register_copy + // [133] phi uctoa::value#2 = uctoa::value#6 [phi:uctoa::@4->uctoa::@1#2] -- register_copy + // [133] phi uctoa::digit#2 = uctoa::digit#1 [phi:uctoa::@4->uctoa::@1#3] -- register_copy jmp __b1 // uctoa::@5 __b5: // uctoa_append(buffer++, value, digit_value) - // [146] uctoa_append::buffer#0 = uctoa::buffer#11 - // [147] uctoa_append::value#0 = uctoa::value#2 - // [148] uctoa_append::sub#0 = uctoa::digit_value#0 - // [149] call uctoa_append - // [194] phi from uctoa::@5 to uctoa_append [phi:uctoa::@5->uctoa_append] + // [144] uctoa_append::buffer#0 = uctoa::buffer#11 + // [145] uctoa_append::value#0 = uctoa::value#2 + // [146] uctoa_append::sub#0 = uctoa::digit_value#0 + // [147] call uctoa_append + // [192] phi from uctoa::@5 to uctoa_append [phi:uctoa::@5->uctoa_append] jsr uctoa_append // uctoa_append(buffer++, value, digit_value) - // [150] uctoa_append::return#0 = uctoa_append::value#2 + // [148] uctoa_append::return#0 = uctoa_append::value#2 // uctoa::@6 // value = uctoa_append(buffer++, value, digit_value) - // [151] uctoa::value#0 = uctoa_append::return#0 + // [149] uctoa::value#0 = uctoa_append::return#0 // value = uctoa_append(buffer++, value, digit_value); - // [152] uctoa::buffer#4 = ++ uctoa::buffer#11 -- pbuz1=_inc_pbuz1 + // [150] uctoa::buffer#4 = ++ uctoa::buffer#11 -- pbuz1=_inc_pbuz1 inc.z buffer bne !+ inc.z buffer+1 !: - // [144] phi from uctoa::@6 to uctoa::@4 [phi:uctoa::@6->uctoa::@4] - // [144] phi uctoa::buffer#14 = uctoa::buffer#4 [phi:uctoa::@6->uctoa::@4#0] -- register_copy - // [144] phi uctoa::started#4 = 1 [phi:uctoa::@6->uctoa::@4#1] -- vbum1=vbuc1 + // [142] phi from uctoa::@6 to uctoa::@4 [phi:uctoa::@6->uctoa::@4] + // [142] phi uctoa::buffer#14 = uctoa::buffer#4 [phi:uctoa::@6->uctoa::@4#0] -- register_copy + // [142] phi uctoa::started#4 = 1 [phi:uctoa::@6->uctoa::@4#1] -- vbuz1=vbuc1 lda #1 - sta started - // [144] phi uctoa::value#6 = uctoa::value#0 [phi:uctoa::@6->uctoa::@4#2] -- register_copy + sta.z started + // [142] phi uctoa::value#6 = uctoa::value#0 [phi:uctoa::@6->uctoa::@4#2] -- register_copy jmp __b4 - .segment Data - digit_value: .byte 0 - digit: .byte 0 - started: .byte 0 } -.segment Code // printf_number_buffer // Print the contents of the number buffer using a specific format. // This handles minimum length, zero-filling, and left/right justification from the format -// void printf_number_buffer(void (*putc)(char), __mem() char buffer_sign, char *buffer_digits, char format_min_length, char format_justify_left, char format_sign_always, char format_zero_padding, char format_upper_case, char format_radix) +// void printf_number_buffer(void (*putc)(char), __zp(8) char buffer_sign, char *buffer_digits, char format_min_length, char format_justify_left, char format_sign_always, char format_zero_padding, char format_upper_case, char format_radix) printf_number_buffer: { .label buffer_digits = printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS - // [154] phi from printf_number_buffer to printf_number_buffer::@4 [phi:printf_number_buffer->printf_number_buffer::@4] + .label __19 = $e + .label buffer_sign = 8 + // [152] phi from printf_number_buffer to printf_number_buffer::@4 [phi:printf_number_buffer->printf_number_buffer::@4] // printf_number_buffer::@4 // strlen(buffer.digits) - // [155] call strlen - // [201] phi from printf_number_buffer::@4 to strlen [phi:printf_number_buffer::@4->strlen] + // [153] call strlen + // [199] phi from printf_number_buffer::@4 to strlen [phi:printf_number_buffer::@4->strlen] jsr strlen // strlen(buffer.digits) - // [156] strlen::return#2 = strlen::len#2 + // [154] strlen::return#2 = strlen::len#2 // printf_number_buffer::@9 - // [157] printf_number_buffer::$19 = strlen::return#2 + // [155] printf_number_buffer::$19 = strlen::return#2 // signed char len = (signed char)strlen(buffer.digits) - // [158] printf_number_buffer::len#0 = (signed char)printf_number_buffer::$19 -- vbsxx=_sbyte_vwum1 + // [156] printf_number_buffer::len#0 = (signed char)printf_number_buffer::$19 -- vbsxx=_sbyte_vwuz1 // There is a minimum length - work out the padding - ldx __19 + ldx.z __19 // if(buffer.sign) - // [159] if(0==printf_number_buffer::buffer_sign#0) goto printf_number_buffer::@8 -- 0_eq_vbum1_then_la1 - lda buffer_sign + // [157] if(0==printf_number_buffer::buffer_sign#0) goto printf_number_buffer::@8 -- 0_eq_vbuz1_then_la1 + lda.z buffer_sign beq __b8 // printf_number_buffer::@5 // len++; - // [160] printf_number_buffer::len#1 = ++ printf_number_buffer::len#0 -- vbsxx=_inc_vbsxx + // [158] printf_number_buffer::len#1 = ++ printf_number_buffer::len#0 -- vbsxx=_inc_vbsxx inx - // [161] phi from printf_number_buffer::@5 printf_number_buffer::@9 to printf_number_buffer::@8 [phi:printf_number_buffer::@5/printf_number_buffer::@9->printf_number_buffer::@8] - // [161] phi printf_number_buffer::len#2 = printf_number_buffer::len#1 [phi:printf_number_buffer::@5/printf_number_buffer::@9->printf_number_buffer::@8#0] -- register_copy + // [159] phi from printf_number_buffer::@5 printf_number_buffer::@9 to printf_number_buffer::@8 [phi:printf_number_buffer::@5/printf_number_buffer::@9->printf_number_buffer::@8] + // [159] phi printf_number_buffer::len#2 = printf_number_buffer::len#1 [phi:printf_number_buffer::@5/printf_number_buffer::@9->printf_number_buffer::@8#0] -- register_copy // printf_number_buffer::@8 __b8: // padding = (signed char)format.min_length - len - // [162] printf_number_buffer::padding#1 = (signed char)printf_uchar::format_min_length#0 - printf_number_buffer::len#2 -- vbsaa=vbsc1_minus_vbsxx + // [160] printf_number_buffer::padding#1 = (signed char)printf_uchar::format_min_length#0 - printf_number_buffer::len#2 -- vbsaa=vbsc1_minus_vbsxx txa eor #$ff sec adc #printf_uchar.format_min_length // if(padding<0) - // [163] if(printf_number_buffer::padding#1>=0) goto printf_number_buffer::@11 -- vbsaa_ge_0_then_la1 + // [161] if(printf_number_buffer::padding#1>=0) goto printf_number_buffer::@11 -- vbsaa_ge_0_then_la1 cmp #0 bpl __b1 - // [165] phi from printf_number_buffer::@8 to printf_number_buffer::@1 [phi:printf_number_buffer::@8->printf_number_buffer::@1] - // [165] phi printf_number_buffer::padding#10 = 0 [phi:printf_number_buffer::@8->printf_number_buffer::@1#0] -- vbsaa=vbsc1 + // [163] phi from printf_number_buffer::@8 to printf_number_buffer::@1 [phi:printf_number_buffer::@8->printf_number_buffer::@1] + // [163] phi printf_number_buffer::padding#10 = 0 [phi:printf_number_buffer::@8->printf_number_buffer::@1#0] -- vbsaa=vbsc1 lda #0 - // [164] phi from printf_number_buffer::@8 to printf_number_buffer::@11 [phi:printf_number_buffer::@8->printf_number_buffer::@11] + // [162] phi from printf_number_buffer::@8 to printf_number_buffer::@11 [phi:printf_number_buffer::@8->printf_number_buffer::@11] // printf_number_buffer::@11 - // [165] phi from printf_number_buffer::@11 to printf_number_buffer::@1 [phi:printf_number_buffer::@11->printf_number_buffer::@1] - // [165] phi printf_number_buffer::padding#10 = printf_number_buffer::padding#1 [phi:printf_number_buffer::@11->printf_number_buffer::@1#0] -- register_copy + // [163] phi from printf_number_buffer::@11 to printf_number_buffer::@1 [phi:printf_number_buffer::@11->printf_number_buffer::@1] + // [163] phi printf_number_buffer::padding#10 = printf_number_buffer::padding#1 [phi:printf_number_buffer::@11->printf_number_buffer::@1#0] -- register_copy // printf_number_buffer::@1 __b1: // printf_number_buffer::@10 // if(!format.justify_left && !format.zero_padding && padding) - // [166] if(0!=printf_number_buffer::padding#10) goto printf_number_buffer::@6 -- 0_neq_vbsaa_then_la1 + // [164] if(0!=printf_number_buffer::padding#10) goto printf_number_buffer::@6 -- 0_neq_vbsaa_then_la1 cmp #0 bne __b6 jmp __b2 // printf_number_buffer::@6 __b6: // printf_padding(putc, ' ',(char)padding) - // [167] printf_padding::length#0 = (char)printf_number_buffer::padding#10 -- vbum1=vbuaa - sta printf_padding.length - // [168] call printf_padding - // [207] phi from printf_number_buffer::@6 to printf_padding [phi:printf_number_buffer::@6->printf_padding] + // [165] printf_padding::length#0 = (char)printf_number_buffer::padding#10 -- vbuz1=vbuaa + sta.z printf_padding.length + // [166] call printf_padding + // [205] phi from printf_number_buffer::@6 to printf_padding [phi:printf_number_buffer::@6->printf_padding] jsr printf_padding // printf_number_buffer::@2 __b2: // if(buffer.sign) - // [169] if(0==printf_number_buffer::buffer_sign#0) goto printf_number_buffer::@3 -- 0_eq_vbum1_then_la1 - lda buffer_sign + // [167] if(0==printf_number_buffer::buffer_sign#0) goto printf_number_buffer::@3 -- 0_eq_vbuz1_then_la1 + lda.z buffer_sign beq __b3 // printf_number_buffer::@7 // putc(buffer.sign) - // [170] stackpush(char) = printf_number_buffer::buffer_sign#0 -- _stackpushbyte_=vbum1 + // [168] stackpush(char) = printf_number_buffer::buffer_sign#0 -- _stackpushbyte_=vbuz1 pha - // [171] callexecute cputc -- call_vprc1 + // [169] callexecute cputc -- call_vprc1 jsr cputc // sideeffect stackpullbytes(1) -- _stackpullbyte_1 pla - // [173] phi from printf_number_buffer::@2 printf_number_buffer::@7 to printf_number_buffer::@3 [phi:printf_number_buffer::@2/printf_number_buffer::@7->printf_number_buffer::@3] + // [171] phi from printf_number_buffer::@2 printf_number_buffer::@7 to printf_number_buffer::@3 [phi:printf_number_buffer::@2/printf_number_buffer::@7->printf_number_buffer::@3] // printf_number_buffer::@3 __b3: // printf_str(putc, buffer.digits) - // [174] call printf_str - // [102] phi from printf_number_buffer::@3 to printf_str [phi:printf_number_buffer::@3->printf_str] - // [102] phi printf_str::putc#6 = printf_uchar::putc#0 [phi:printf_number_buffer::@3->printf_str#0] -- pprz1=pprc1 + // [172] call printf_str + // [103] phi from printf_number_buffer::@3 to printf_str [phi:printf_number_buffer::@3->printf_str] + // [103] phi printf_str::putc#6 = printf_uchar::putc#0 [phi:printf_number_buffer::@3->printf_str#0] -- pprz1=pprc1 lda #printf_uchar.putc sta.z printf_str.putc+1 - // [102] phi printf_str::s#6 = printf_number_buffer::buffer_digits#0 [phi:printf_number_buffer::@3->printf_str#1] -- pbuz1=pbuc1 + // [103] phi printf_str::s#6 = printf_number_buffer::buffer_digits#0 [phi:printf_number_buffer::@3->printf_str#1] -- pbuz1=pbuc1 lda #buffer_digits @@ -7479,13 +7237,9 @@ printf_number_buffer: { jsr printf_str // printf_number_buffer::@return // } - // [175] return + // [173] return rts - .segment Data - .label __19 = strlen.len - buffer_sign: .byte 0 } -.segment Code // memcpy // Copy block of memory (forwards) // Copies the values of num bytes from the location pointed to by source directly to the memory block pointed to by destination. @@ -7497,7 +7251,7 @@ memcpy: { .label source = 2 .label destination = 4 // char* src_end = (char*)source+num - // [177] memcpy::src_end#0 = (char *)memcpy::source#2 + (unsigned int)$19*$28-$28 -- pbuz1=pbuz2_plus_vwuc1 + // [175] memcpy::src_end#0 = (char *)memcpy::source#2 + (unsigned int)$19*$28-$28 -- pbuz1=pbuz2_plus_vwuc1 lda.z source clc adc #<$19*$28-$28 @@ -7505,15 +7259,15 @@ memcpy: { lda.z source+1 adc #>$19*$28-$28 sta.z src_end+1 - // [178] memcpy::src#4 = (char *)memcpy::source#2 - // [179] memcpy::dst#4 = (char *)memcpy::destination#2 - // [180] phi from memcpy memcpy::@2 to memcpy::@1 [phi:memcpy/memcpy::@2->memcpy::@1] - // [180] phi memcpy::dst#2 = memcpy::dst#4 [phi:memcpy/memcpy::@2->memcpy::@1#0] -- register_copy - // [180] phi memcpy::src#2 = memcpy::src#4 [phi:memcpy/memcpy::@2->memcpy::@1#1] -- register_copy + // [176] memcpy::src#4 = (char *)memcpy::source#2 + // [177] memcpy::dst#4 = (char *)memcpy::destination#2 + // [178] phi from memcpy memcpy::@2 to memcpy::@1 [phi:memcpy/memcpy::@2->memcpy::@1] + // [178] phi memcpy::dst#2 = memcpy::dst#4 [phi:memcpy/memcpy::@2->memcpy::@1#0] -- register_copy + // [178] phi memcpy::src#2 = memcpy::src#4 [phi:memcpy/memcpy::@2->memcpy::@1#1] -- register_copy // memcpy::@1 __b1: // while(src!=src_end) - // [181] if(memcpy::src#2!=memcpy::src_end#0) goto memcpy::@2 -- pbuz1_neq_pbuz2_then_la1 + // [179] if(memcpy::src#2!=memcpy::src_end#0) goto memcpy::@2 -- pbuz1_neq_pbuz2_then_la1 lda.z src+1 cmp.z src_end+1 bne __b2 @@ -7522,22 +7276,22 @@ memcpy: { bne __b2 // memcpy::@return // } - // [182] return + // [180] return rts // memcpy::@2 __b2: // *dst++ = *src++ - // [183] *memcpy::dst#2 = *memcpy::src#2 -- _deref_pbuz1=_deref_pbuz2 + // [181] *memcpy::dst#2 = *memcpy::src#2 -- _deref_pbuz1=_deref_pbuz2 ldy #0 lda (src),y sta (dst),y // *dst++ = *src++; - // [184] memcpy::dst#1 = ++ memcpy::dst#2 -- pbuz1=_inc_pbuz1 + // [182] memcpy::dst#1 = ++ memcpy::dst#2 -- pbuz1=_inc_pbuz1 inc.z dst bne !+ inc.z dst+1 !: - // [185] memcpy::src#1 = ++ memcpy::src#2 -- pbuz1=_inc_pbuz1 + // [183] memcpy::src#1 = ++ memcpy::src#2 -- pbuz1=_inc_pbuz1 inc.z src bne !+ inc.z src+1 @@ -7553,7 +7307,7 @@ memset: { .label str = 2 // memset::@1 // char* end = (char*)str + num - // [187] memset::end#0 = (char *)memset::str#3 + $28 -- pbuz1=pbuz2_plus_vbuc1 + // [185] memset::end#0 = (char *)memset::str#3 + $28 -- pbuz1=pbuz2_plus_vbuc1 lda #$28 clc adc.z str @@ -7561,13 +7315,13 @@ memset: { lda #0 adc.z str+1 sta.z end+1 - // [188] memset::dst#4 = (char *)memset::str#3 - // [189] phi from memset::@1 memset::@3 to memset::@2 [phi:memset::@1/memset::@3->memset::@2] - // [189] phi memset::dst#2 = memset::dst#4 [phi:memset::@1/memset::@3->memset::@2#0] -- register_copy + // [186] memset::dst#4 = (char *)memset::str#3 + // [187] phi from memset::@1 memset::@3 to memset::@2 [phi:memset::@1/memset::@3->memset::@2] + // [187] phi memset::dst#2 = memset::dst#4 [phi:memset::@1/memset::@3->memset::@2#0] -- register_copy // memset::@2 __b2: // for(char* dst = str; dst!=end; dst++) - // [190] if(memset::dst#2!=memset::end#0) goto memset::@3 -- pbuz1_neq_pbuz2_then_la1 + // [188] if(memset::dst#2!=memset::end#0) goto memset::@3 -- pbuz1_neq_pbuz2_then_la1 lda.z dst+1 cmp.z end+1 bne __b3 @@ -7576,17 +7330,17 @@ memset: { bne __b3 // memset::@return // } - // [191] return + // [189] return rts // memset::@3 __b3: // *dst = c - // [192] *memset::dst#2 = memset::c#4 -- _deref_pbuz1=vbuxx + // [190] *memset::dst#2 = memset::c#4 -- _deref_pbuz1=vbuxx txa ldy #0 sta (dst),y // for(char* dst = str; dst!=end; dst++) - // [193] memset::dst#1 = ++ memset::dst#2 -- pbuz1=_inc_pbuz1 + // [191] memset::dst#1 = ++ memset::dst#2 -- pbuz1=_inc_pbuz1 inc.z dst bne !+ inc.z dst+1 @@ -7602,59 +7356,59 @@ memset: { // - sub : the value of a '1' in the digit. Subtracted continually while the digit is increased. // (For decimal the subs used are 10000, 1000, 100, 10, 1) // returns : the value reduced by sub * digit so that it is less than sub. -// __register(X) char uctoa_append(__zp($10) char *buffer, __register(X) char value, __mem() char sub) +// __register(X) char uctoa_append(__zp($10) char *buffer, __register(X) char value, __zp(8) char sub) uctoa_append: { .label buffer = $10 - // [195] phi from uctoa_append to uctoa_append::@1 [phi:uctoa_append->uctoa_append::@1] - // [195] phi uctoa_append::digit#2 = 0 [phi:uctoa_append->uctoa_append::@1#0] -- vbuyy=vbuc1 + .label sub = 8 + // [193] phi from uctoa_append to uctoa_append::@1 [phi:uctoa_append->uctoa_append::@1] + // [193] phi uctoa_append::digit#2 = 0 [phi:uctoa_append->uctoa_append::@1#0] -- vbuyy=vbuc1 ldy #0 - // [195] phi uctoa_append::value#2 = uctoa_append::value#0 [phi:uctoa_append->uctoa_append::@1#1] -- register_copy + // [193] phi uctoa_append::value#2 = uctoa_append::value#0 [phi:uctoa_append->uctoa_append::@1#1] -- register_copy // uctoa_append::@1 __b1: // while (value >= sub) - // [196] if(uctoa_append::value#2>=uctoa_append::sub#0) goto uctoa_append::@2 -- vbuxx_ge_vbum1_then_la1 - cpx sub + // [194] if(uctoa_append::value#2>=uctoa_append::sub#0) goto uctoa_append::@2 -- vbuxx_ge_vbuz1_then_la1 + cpx.z sub bcs __b2 // uctoa_append::@3 // *buffer = DIGITS[digit] - // [197] *uctoa_append::buffer#0 = DIGITS[uctoa_append::digit#2] -- _deref_pbuz1=pbuc1_derefidx_vbuyy + // [195] *uctoa_append::buffer#0 = DIGITS[uctoa_append::digit#2] -- _deref_pbuz1=pbuc1_derefidx_vbuyy lda DIGITS,y ldy #0 sta (buffer),y // uctoa_append::@return // } - // [198] return + // [196] return rts // uctoa_append::@2 __b2: // digit++; - // [199] uctoa_append::digit#1 = ++ uctoa_append::digit#2 -- vbuyy=_inc_vbuyy + // [197] uctoa_append::digit#1 = ++ uctoa_append::digit#2 -- vbuyy=_inc_vbuyy iny // value -= sub - // [200] uctoa_append::value#1 = uctoa_append::value#2 - uctoa_append::sub#0 -- vbuxx=vbuxx_minus_vbum1 + // [198] uctoa_append::value#1 = uctoa_append::value#2 - uctoa_append::sub#0 -- vbuxx=vbuxx_minus_vbuz1 txa sec - sbc sub + sbc.z sub tax - // [195] phi from uctoa_append::@2 to uctoa_append::@1 [phi:uctoa_append::@2->uctoa_append::@1] - // [195] phi uctoa_append::digit#2 = uctoa_append::digit#1 [phi:uctoa_append::@2->uctoa_append::@1#0] -- register_copy - // [195] phi uctoa_append::value#2 = uctoa_append::value#1 [phi:uctoa_append::@2->uctoa_append::@1#1] -- register_copy + // [193] phi from uctoa_append::@2 to uctoa_append::@1 [phi:uctoa_append::@2->uctoa_append::@1] + // [193] phi uctoa_append::digit#2 = uctoa_append::digit#1 [phi:uctoa_append::@2->uctoa_append::@1#0] -- register_copy + // [193] phi uctoa_append::value#2 = uctoa_append::value#1 [phi:uctoa_append::@2->uctoa_append::@1#1] -- register_copy jmp __b1 - .segment Data - .label sub = uctoa.digit_value } -.segment Code // strlen // Computes the length of the string str up to but not including the terminating null character. -// __mem() unsigned int strlen(__zp($10) char *str) +// __zp($e) unsigned int strlen(__zp($10) char *str) strlen: { + .label len = $e .label str = $10 - // [202] phi from strlen to strlen::@1 [phi:strlen->strlen::@1] - // [202] phi strlen::len#2 = 0 [phi:strlen->strlen::@1#0] -- vwum1=vwuc1 + .label return = $e + // [200] phi from strlen to strlen::@1 [phi:strlen->strlen::@1] + // [200] phi strlen::len#2 = 0 [phi:strlen->strlen::@1#0] -- vwuz1=vwuc1 lda #<0 - sta len - sta len+1 - // [202] phi strlen::str#2 = printf_number_buffer::buffer_digits#0 [phi:strlen->strlen::@1#1] -- pbuz1=pbuc1 + sta.z len + sta.z len+1 + // [200] phi strlen::str#2 = printf_number_buffer::buffer_digits#0 [phi:strlen->strlen::@1#1] -- pbuz1=pbuc1 lda #printf_number_buffer.buffer_digits @@ -7662,94 +7416,80 @@ strlen: { // strlen::@1 __b1: // while(*str) - // [203] if(0!=*strlen::str#2) goto strlen::@2 -- 0_neq__deref_pbuz1_then_la1 + // [201] if(0!=*strlen::str#2) goto strlen::@2 -- 0_neq__deref_pbuz1_then_la1 ldy #0 lda (str),y cmp #0 bne __b2 // strlen::@return // } - // [204] return + // [202] return rts // strlen::@2 __b2: // len++; - // [205] strlen::len#1 = ++ strlen::len#2 -- vwum1=_inc_vwum1 - inc len + // [203] strlen::len#1 = ++ strlen::len#2 -- vwuz1=_inc_vwuz1 + inc.z len bne !+ - inc len+1 + inc.z len+1 !: // str++; - // [206] strlen::str#0 = ++ strlen::str#2 -- pbuz1=_inc_pbuz1 + // [204] strlen::str#0 = ++ strlen::str#2 -- pbuz1=_inc_pbuz1 inc.z str bne !+ inc.z str+1 !: - // [202] phi from strlen::@2 to strlen::@1 [phi:strlen::@2->strlen::@1] - // [202] phi strlen::len#2 = strlen::len#1 [phi:strlen::@2->strlen::@1#0] -- register_copy - // [202] phi strlen::str#2 = strlen::str#0 [phi:strlen::@2->strlen::@1#1] -- register_copy + // [200] phi from strlen::@2 to strlen::@1 [phi:strlen::@2->strlen::@1] + // [200] phi strlen::len#2 = strlen::len#1 [phi:strlen::@2->strlen::@1#0] -- register_copy + // [200] phi strlen::str#2 = strlen::str#0 [phi:strlen::@2->strlen::@1#1] -- register_copy jmp __b1 - .segment Data - len: .word 0 - .label return = len } -.segment Code // printf_padding // Print a padding char a number of times -// void printf_padding(void (*putc)(char), char pad, __mem() char length) +// void printf_padding(void (*putc)(char), char pad, __zp($15) char length) printf_padding: { .const pad = ' ' - // [208] phi from printf_padding to printf_padding::@1 [phi:printf_padding->printf_padding::@1] - // [208] phi printf_padding::i#2 = 0 [phi:printf_padding->printf_padding::@1#0] -- vbum1=vbuc1 + .label i = $12 + .label length = $15 + // [206] phi from printf_padding to printf_padding::@1 [phi:printf_padding->printf_padding::@1] + // [206] phi printf_padding::i#2 = 0 [phi:printf_padding->printf_padding::@1#0] -- vbuz1=vbuc1 lda #0 - sta i + sta.z i // printf_padding::@1 __b1: // for(char i=0;iprintf_padding::@1] - // [208] phi printf_padding::i#2 = printf_padding::i#1 [phi:printf_padding::@3->printf_padding::@1#0] -- register_copy + // [212] printf_padding::i#1 = ++ printf_padding::i#2 -- vbuz1=_inc_vbuz1 + inc.z i + // [206] phi from printf_padding::@3 to printf_padding::@1 [phi:printf_padding::@3->printf_padding::@1] + // [206] phi printf_padding::i#2 = printf_padding::i#1 [phi:printf_padding::@3->printf_padding::@1#0] -- register_copy jmp __b1 - .segment Data - i: .byte 0 - length: .byte 0 } // File Data +.segment Data // The digits used for numbers DIGITS: .text "0123456789abcdef" // Values of hexadecimal digits RADIX_HEXADECIMAL_VALUES_CHAR: .byte $10 - // The number of bytes on the screen - // The current cursor x-position - conio_cursor_x: .byte 0 - // The current cursor y-position - conio_cursor_y: .byte 0 - // The current text color - conio_textcolor: .byte LIGHT_BLUE - // Is scrolling enabled when outputting beyond the end of the screen (1: yes, 0: no). - // If disabled the cursor just moves back to (0,0) instead - conio_scroll_enable: .byte 1 // Buffer used for stringified number being printed printf_buffer: .fill SIZEOF_STRUCT_PRINTF_BUFFER_NUMBER, 0 diff --git a/src/test/ref/cbm-keyboard.sym b/src/test/ref/cbm-keyboard.sym index 90eec2b0d..130ef4af2 100644 --- a/src/test/ref/cbm-keyboard.sym +++ b/src/test/ref/cbm-keyboard.sym @@ -27,8 +27,8 @@ char clrscr::l char clrscr::l#1 // reg byte x 2002.0 char clrscr::l#2 // reg byte x 333.6666666666667 char *clrscr::line_cols -char *clrscr::line_cols#1 // line_cols zp[2]:18 1001.0 -char *clrscr::line_cols#5 // line_cols zp[2]:18 1500.375 +char *clrscr::line_cols#1 // line_cols zp[2]:14 1001.0 +char *clrscr::line_cols#5 // line_cols zp[2]:14 1500.375 char *clrscr::line_text char *clrscr::line_text#1 // line_text zp[2]:16 667.3333333333334 char *clrscr::line_text#5 // line_text zp[2]:16 1714.7142857142858 @@ -37,12 +37,10 @@ __constant char * const conio_c64_init::BASIC_CURSOR_LINE = (char *) 214 char conio_c64_init::line char conio_c64_init::line#0 // reg byte x 11.0 char conio_c64_init::line#2 // reg byte x 22.0 -__loadstore char conio_cursor_x = 0 // mem[1] 9.854368942524271E8 -__loadstore char conio_cursor_y = 0 // mem[1] 1.2571428581619048E9 -__loadstore char *conio_line_color // zp[2]:12 1.2852631590421052E9 -__loadstore char *conio_line_text // zp[2]:14 1.245918368459184E9 -__loadstore char conio_scroll_enable = 1 // mem[1] 1.0000000001E8 -__loadstore char conio_textcolor = LIGHT_BLUE // mem[1] 8.706905175E7 +__loadstore char conio_cursor_x // zp[1]:19 1.9480522207792208E7 +__loadstore char conio_cursor_y // zp[1]:9 3.4408602375268817E8 +__loadstore char *conio_line_color // zp[2]:10 2.4285714515384617E8 +__loadstore char *conio_line_text // zp[2]:12 2.4021739357608694E8 __stackcall void cputc(char c) __constant char cputc::OFFSET_STACK_C = 0 char cputc::c @@ -50,25 +48,25 @@ char cputc::c#0 // reg byte a 1.500000015E8 void cputln() void cscroll() void gotoxy(char x , char y) -char *gotoxy::$5 // zp[2]:8 2.00000000002E11 -char *gotoxy::$6 // zp[2]:10 2.00000000002E11 -unsigned int gotoxy::$7 // mem[2] 1.500000000015E11 -unsigned int gotoxy::$8 // mem[2] 2.00000000002E11 -unsigned int gotoxy::$9 // mem[2] 2.00000000002E11 +char *gotoxy::$5 // zp[2]:28 202.0 +char *gotoxy::$6 // zp[2]:24 202.0 +unsigned int gotoxy::$7 // zp[2]:24 151.5 +unsigned int gotoxy::$8 // zp[2]:26 202.0 +unsigned int gotoxy::$9 // zp[2]:24 202.0 unsigned int gotoxy::line_offset -unsigned int gotoxy::line_offset#0 // line_offset mem[2] 1.00000000001E11 +unsigned int gotoxy::line_offset#0 // line_offset zp[2]:24 101.0 char gotoxy::x +__constant char gotoxy::x#2 = 0 // x char gotoxy::y -char gotoxy::y#2 // reg byte x 22.0 -char gotoxy::y#3 // reg byte x 6.6666666671E10 -char gotoxy::y#4 // reg byte x 6.6666666667333336E10 +char gotoxy::y#2 // reg byte x 71.0 +char gotoxy::y#4 // reg byte x 67.33333333333333 int main() -char main::$6 // mem[1] 101.0 +char main::$6 // zp[1]:20 101.0 char main::ch -char main::ch#0 // ch mem[1] 1331.625 +char main::ch#0 // ch zp[1]:23 1331.625 char main::current -char main::current#2 // current mem[1] 4220.8 -char main::current#4 // current mem[1] 202.0 +char main::current#2 // current zp[1]:22 4220.8 +char main::current#4 // current zp[1]:22 202.0 int main::return __constant char main::s[2] = "'" __constant char main::s1[4] = "'($" @@ -96,8 +94,7 @@ char *memcpy::src_end char *memcpy::src_end#0 // src_end zp[2]:6 1.26250000000025E12 void * memset(void *str , char c , unsigned int num) char memset::c -char memset::c#1 // reg byte x 2.0000000002E10 -char memset::c#4 // reg byte x 1.430000000000286E12 +char memset::c#4 // reg byte x 1.4285714285715715E12 char *memset::dst char *memset::dst#1 // dst zp[2]:2 2.0000000000002E13 char *memset::dst#2 // dst zp[2]:2 1.3366666666668332E13 @@ -121,12 +118,12 @@ char petscii_to_screencode::return#5 // reg byte a 2002.0 char petscii_to_screencode::return#6 // reg byte a 2002.0 __loadstore struct printf_buffer_number printf_buffer = {} // mem[12] void printf_number_buffer(void (*putc)(char) , char buffer_sign , char *buffer_digits , char format_min_length , char format_justify_left , char format_sign_always , char format_zero_padding , char format_upper_case , char format_radix) -unsigned int printf_number_buffer::$19 // mem[2] 10001.0 +unsigned int printf_number_buffer::$19 // zp[2]:14 10001.0 struct printf_buffer_number printf_number_buffer::buffer char *printf_number_buffer::buffer_digits __constant char *printf_number_buffer::buffer_digits#0 = (char *)&printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS // buffer_digits char printf_number_buffer::buffer_sign -char printf_number_buffer::buffer_sign#0 // buffer_sign mem[1] 1722.4444444444443 +char printf_number_buffer::buffer_sign#0 // buffer_sign zp[1]:8 1722.4444444444443 struct printf_format_number printf_number_buffer::format char printf_number_buffer::format_justify_left char printf_number_buffer::format_min_length @@ -144,10 +141,10 @@ signed char printf_number_buffer::padding#10 // reg byte a 10001.0 void (*printf_number_buffer::putc)(char) void printf_padding(void (*putc)(char) , char pad , char length) char printf_padding::i -char printf_padding::i#1 // i mem[1] 2.0000002E7 -char printf_padding::i#2 // i mem[1] 6000000.6 +char printf_padding::i#1 // i zp[1]:18 2.0000002E7 +char printf_padding::i#2 // i zp[1]:18 6000000.6 char printf_padding::length -char printf_padding::length#0 // length mem[1] 1251250.25 +char printf_padding::length#0 // length zp[1]:21 1251250.25 char printf_padding::pad __constant char printf_padding::pad#0 = ' ' // pad void (*printf_padding::putc)(char) @@ -157,9 +154,9 @@ char printf_str::c#1 // reg byte a 1.0000001E7 void (*printf_str::putc)(char) void (*printf_str::putc#6)(char) // putc zp[2]:16 const char *printf_str::s -const char *printf_str::s#0 // s zp[2]:18 1.0000001E7 -const char *printf_str::s#5 // s zp[2]:18 1.5050002E7 -const char *printf_str::s#6 // s zp[2]:18 100001.0 +const char *printf_str::s#0 // s zp[2]:14 1.0000001E7 +const char *printf_str::s#5 // s zp[2]:14 1.5050002E7 +const char *printf_str::s#6 // s zp[2]:14 100001.0 void printf_uchar(void (*putc)(char) , char uvalue , char format_min_length , char format_justify_left , char format_sign_always , char format_zero_padding , char format_upper_case , char format_radix) struct printf_format_number printf_uchar::format char printf_uchar::format_justify_left @@ -175,10 +172,10 @@ char printf_uchar::uvalue char printf_uchar::uvalue#0 // reg byte x 367.33333333333337 unsigned int strlen(char *str) unsigned int strlen::len -unsigned int strlen::len#1 // len mem[2] 1.0000001E7 -unsigned int strlen::len#2 // len mem[2] 5002500.75 +unsigned int strlen::len#1 // len zp[2]:14 1.0000001E7 +unsigned int strlen::len#2 // len zp[2]:14 5002500.75 unsigned int strlen::return -unsigned int strlen::return#2 // return mem[2] 20002.0 +unsigned int strlen::return#2 // return zp[2]:14 20002.0 char *strlen::str char *strlen::str#0 // str zp[2]:16 2.0000002E7 char *strlen::str#2 // str zp[2]:16 1.0000001E7 @@ -189,17 +186,17 @@ char *uctoa::buffer#14 // buffer zp[2]:16 1500001.5 char *uctoa::buffer#3 // buffer zp[2]:16 20002.0 char *uctoa::buffer#4 // buffer zp[2]:16 2000002.0 char uctoa::digit -char uctoa::digit#1 // digit mem[1] 2000002.0 -char uctoa::digit#2 // digit mem[1] 307692.6153846154 +char uctoa::digit#1 // digit zp[1]:18 2000002.0 +char uctoa::digit#2 // digit zp[1]:18 307692.6153846154 char uctoa::digit_value -char uctoa::digit_value#0 // digit_value mem[1] 600000.6000000001 +char uctoa::digit_value#0 // digit_value zp[1]:8 600000.6000000001 char *uctoa::digit_values char uctoa::max_digits __constant char uctoa::max_digits#2 = 2 // max_digits char uctoa::radix char uctoa::started -char uctoa::started#2 // started mem[1] 600000.6000000001 -char uctoa::started#4 // started mem[1] 1000001.0 +char uctoa::started#2 // started zp[1]:20 600000.6000000001 +char uctoa::started#4 // started zp[1]:20 1000001.0 char uctoa::value char uctoa::value#0 // reg byte x 1000001.0 char uctoa::value#1 // reg byte x 5501.0 @@ -214,53 +211,46 @@ char uctoa_append::digit#2 // reg byte y 1.00050000015E10 char uctoa_append::return char uctoa_append::return#0 // reg byte x 2000002.0 char uctoa_append::sub -char uctoa_append::sub#0 // sub mem[1] 3.3335000005E9 +char uctoa_append::sub#0 // sub zp[1]:8 3.3335000005E9 char uctoa_append::value char uctoa_append::value#0 // reg byte x 3666667.333333333 char uctoa_append::value#1 // reg byte x 2.0000000002E10 char uctoa_append::value#2 // reg byte x 5.001833334166666E9 reg byte x [ conio_c64_init::line#2 conio_c64_init::line#0 ] -mem[1] [ main::current#2 main::current#4 ] -reg byte x [ gotoxy::y#4 gotoxy::y#3 gotoxy::y#2 ] +zp[1]:22 [ main::current#2 main::current#4 ] +reg byte x [ gotoxy::y#4 gotoxy::y#2 ] reg byte x [ clrscr::l#2 clrscr::l#1 ] reg byte y [ clrscr::c#2 clrscr::c#1 ] reg byte a [ petscii_to_screencode::return#10 petscii_to_screencode::return#1 petscii_to_screencode::petscii#0 petscii_to_screencode::return#3 petscii_to_screencode::return#4 petscii_to_screencode::return#5 petscii_to_screencode::return#6 ] -zp[2]:18 [ printf_str::s#5 printf_str::s#6 printf_str::s#0 clrscr::line_cols#5 clrscr::line_cols#1 ] -mem[1] [ uctoa::digit#2 uctoa::digit#1 ] reg byte x [ uctoa::value#2 uctoa::value#6 uctoa::value#1 uctoa::value#0 ] -mem[1] [ uctoa::started#2 uctoa::started#4 ] reg byte x [ printf_number_buffer::len#2 printf_number_buffer::len#0 printf_number_buffer::len#1 ] reg byte a [ printf_number_buffer::padding#10 printf_number_buffer::padding#1 ] zp[2]:2 [ memset::str#3 memset::dst#2 memset::dst#4 memset::dst#1 memcpy::source#2 memcpy::src#2 memcpy::src#4 memcpy::src#1 ] -reg byte x [ memset::c#4 memset::c#1 ] +reg byte x [ memset::c#4 ] reg byte x [ uctoa_append::value#2 uctoa_append::value#0 uctoa_append::value#1 ] reg byte y [ uctoa_append::digit#2 uctoa_append::digit#1 ] zp[2]:16 [ strlen::str#2 strlen::str#0 uctoa::buffer#11 uctoa::buffer#14 uctoa::buffer#4 uctoa::buffer#3 uctoa_append::buffer#0 printf_str::putc#6 clrscr::line_text#5 clrscr::line_text#1 ] -mem[2] [ strlen::len#2 strlen::len#1 strlen::return#2 printf_number_buffer::$19 ] -mem[1] [ printf_padding::i#2 printf_padding::i#1 ] -zp[2]:14 [ conio_line_text ] -zp[2]:12 [ conio_line_color ] +zp[2]:14 [ strlen::len#2 strlen::len#1 strlen::return#2 printf_number_buffer::$19 printf_str::s#5 printf_str::s#6 printf_str::s#0 clrscr::line_cols#5 clrscr::line_cols#1 ] +zp[1]:18 [ printf_padding::i#2 printf_padding::i#1 uctoa::digit#2 uctoa::digit#1 ] +zp[1]:19 [ conio_cursor_x ] +zp[1]:9 [ conio_cursor_y ] +zp[2]:12 [ conio_line_text ] +zp[2]:10 [ conio_line_color ] reg byte a [ cputc::c#0 ] -mem[1] [ conio_cursor_x ] reg byte a [ GETIN::return#0 ] -mem[1] [ main::ch#0 ] +zp[1]:23 [ main::ch#0 ] reg byte a [ petscii_to_screencode::return#0 ] -mem[1] [ main::$6 ] +zp[1]:20 [ main::$6 uctoa::started#2 uctoa::started#4 ] reg byte x [ printf_uchar::uvalue#0 ] -mem[1] [ conio_cursor_y ] -mem[2] [ gotoxy::$7 gotoxy::$9 gotoxy::line_offset#0 ] -mem[2] [ gotoxy::$8 ] -zp[2]:8 [ gotoxy::$5 ] -zp[2]:10 [ gotoxy::$6 ] +zp[2]:24 [ gotoxy::$7 gotoxy::$9 gotoxy::line_offset#0 gotoxy::$6 ] +zp[2]:26 [ gotoxy::$8 ] +zp[2]:28 [ gotoxy::$5 ] reg byte a [ GETIN::return#1 ] reg byte a [ printf_str::c#1 ] -mem[1] [ printf_number_buffer::buffer_sign#0 ] -mem[1] [ uctoa::digit_value#0 uctoa_append::sub#0 ] +zp[1]:8 [ uctoa::digit_value#0 uctoa_append::sub#0 printf_number_buffer::buffer_sign#0 ] reg byte x [ uctoa_append::return#0 ] -mem[1] [ printf_padding::length#0 ] +zp[1]:21 [ printf_padding::length#0 ] zp[2]:6 [ memcpy::src_end#0 ] zp[2]:4 [ memset::end#0 memcpy::destination#2 memcpy::dst#2 memcpy::dst#4 memcpy::dst#1 ] -mem[1] [ conio_textcolor ] -mem[1] [ conio_scroll_enable ] mem[12] [ printf_buffer ] diff --git a/src/test/ref/cpu-45gs02-addressing-modes.asm b/src/test/ref/cpu-45gs02-addressing-modes.asm index 418e9b18e..29afcd238 100644 --- a/src/test/ref/cpu-45gs02-addressing-modes.asm +++ b/src/test/ref/cpu-45gs02-addressing-modes.asm @@ -19,8 +19,8 @@ main: { ldx.z $12,y lda ($12,x) lda ($12),y - ora.z ($12),z - lda.z ($12,sp),y + ora ($12),z + lda ($12,sp),y lda $1234 lda $1234,x lda $1234,y @@ -32,8 +32,8 @@ main: { lbl2: jmp ($1234,x) lbl3: - lda.z (($12)),z - ldq.z (($12)) + lda (($12)),z + ldq (($12)) // } rts } diff --git a/src/test/ref/cpu-45gs02-addressing-modes.log b/src/test/ref/cpu-45gs02-addressing-modes.log index d74662c1d..b264e2de9 100644 --- a/src/test/ref/cpu-45gs02-addressing-modes.log +++ b/src/test/ref/cpu-45gs02-addressing-modes.log @@ -89,8 +89,8 @@ main: { ldx.z $12,y lda ($12,x) lda ($12),y - ora.z ($12),z - lda.z ($12,sp),y + ora ($12),z + lda ($12,sp),y lda $1234 lda $1234,x lda $1234,y @@ -102,8 +102,8 @@ main: { lbl2: jmp ($1234,x) lbl3: - lda.z (($12)),z - ldq.z (($12)) + lda (($12)),z + ldq (($12)) jmp __breturn // main::@return __breturn: @@ -156,8 +156,8 @@ main: { ldx.z $12,y lda ($12,x) lda ($12),y - ora.z ($12),z - lda.z ($12,sp),y + ora ($12),z + lda ($12,sp),y lda $1234 lda $1234,x lda $1234,y @@ -169,8 +169,8 @@ main: { lbl2: jmp ($1234,x) lbl3: - lda.z (($12)),z - ldq.z (($12)) + lda (($12)),z + ldq (($12)) // main::@return // } // [1] return diff --git a/src/test/ref/cpu-65c02-addressing-modes.asm b/src/test/ref/cpu-65c02-addressing-modes.asm index 861334bad..75347fcf4 100644 --- a/src/test/ref/cpu-65c02-addressing-modes.asm +++ b/src/test/ref/cpu-65c02-addressing-modes.asm @@ -16,7 +16,7 @@ main: { lda.z $12 lda.z $12,x ldx.z $12,y - ora.z ($12) + ora ($12) lda ($12,x) lda ($12),y lda $1234 diff --git a/src/test/ref/cpu-65c02-addressing-modes.log b/src/test/ref/cpu-65c02-addressing-modes.log index 77a0147fb..c8471fed7 100644 --- a/src/test/ref/cpu-65c02-addressing-modes.log +++ b/src/test/ref/cpu-65c02-addressing-modes.log @@ -11,7 +11,7 @@ main::@return: scope:[main] from main void __start() __start: scope:[__start] from - call main + call main to:__start::@1 __start::@1: scope:[__start] from __start to:__start::@return @@ -82,7 +82,7 @@ main: { lda.z $12 lda.z $12,x ldx.z $12,y - ora.z ($12) + ora ($12) lda ($12,x) lda ($12),y lda $1234 @@ -141,7 +141,7 @@ main: { lda.z $12 lda.z $12,x ldx.z $12,y - ora.z ($12) + ora ($12) lda ($12,x) lda ($12),y lda $1234 diff --git a/src/test/ref/cpu-65ce02-addressing-modes.asm b/src/test/ref/cpu-65ce02-addressing-modes.asm index 9d39c44cb..5f8a7c41c 100644 --- a/src/test/ref/cpu-65ce02-addressing-modes.asm +++ b/src/test/ref/cpu-65ce02-addressing-modes.asm @@ -19,8 +19,8 @@ main: { ldx.z $12,y lda ($12,x) lda ($12),y - ora.z ($12),z - lda.z ($12,sp),y + ora ($12),z + lda ($12,sp),y lda $1234 lda $1234,x lda $1234,y diff --git a/src/test/ref/cpu-65ce02-addressing-modes.log b/src/test/ref/cpu-65ce02-addressing-modes.log index 912b909d1..4aa5b9469 100644 --- a/src/test/ref/cpu-65ce02-addressing-modes.log +++ b/src/test/ref/cpu-65ce02-addressing-modes.log @@ -89,8 +89,8 @@ main: { ldx.z $12,y lda ($12,x) lda ($12),y - ora.z ($12),z - lda.z ($12,sp),y + ora ($12),z + lda ($12,sp),y lda $1234 lda $1234,x lda $1234,y @@ -155,8 +155,8 @@ main: { ldx.z $12,y lda ($12,x) lda ($12),y - ora.z ($12),z - lda.z ($12,sp),y + ora ($12),z + lda ($12,sp),y lda $1234 lda $1234,x lda $1234,y diff --git a/src/test/ref/examples/mega65/32bit-addressing-mega65.asm b/src/test/ref/examples/mega65/32bit-addressing-mega65.asm index 81e5a5324..1bd22cfa2 100644 --- a/src/test/ref/examples/mega65/32bit-addressing-mega65.asm +++ b/src/test/ref/examples/mega65/32bit-addressing-mega65.asm @@ -43,7 +43,7 @@ main: { ldz #0 !: tza - sta.z ((ADDR32)),z + sta ((ADDR32)),z inz cpz #$50 bne !- @@ -61,7 +61,7 @@ main: { lda #'*' ldz #$4f !: - sta.z ((ADDR32)),z + sta ((ADDR32)),z dez bpl !- // } diff --git a/src/test/ref/examples/mega65/32bit-addressing-mega65.log b/src/test/ref/examples/mega65/32bit-addressing-mega65.log index 335880ec1..f50f22628 100644 --- a/src/test/ref/examples/mega65/32bit-addressing-mega65.log +++ b/src/test/ref/examples/mega65/32bit-addressing-mega65.log @@ -175,7 +175,7 @@ main: { ldz #0 !: tza - sta.z ((ADDR32)),z + sta ((ADDR32)),z inz cpz #$50 bne !- @@ -193,7 +193,7 @@ main: { lda #'*' ldz #$4f !: - sta.z ((ADDR32)),z + sta ((ADDR32)),z dez bpl !- jmp __breturn @@ -291,7 +291,7 @@ main: { ldz #0 !: tza - sta.z ((ADDR32)),z + sta ((ADDR32)),z inz cpz #$50 bne !- @@ -311,7 +311,7 @@ main: { lda #'*' ldz #$4f !: - sta.z ((ADDR32)),z + sta ((ADDR32)),z dez bpl !- // main::@return diff --git a/src/test/ref/examples/mega65/helloworld-mega65.asm b/src/test/ref/examples/mega65/helloworld-mega65.asm index 429d7e9ea..0fb6ecc1b 100644 --- a/src/test/ref/examples/mega65/helloworld-mega65.asm +++ b/src/test/ref/examples/mega65/helloworld-mega65.asm @@ -102,11 +102,11 @@ cputc: { beq __b1 // conio_line_text[conio_cursor_x] = c ldz conio_cursor_x - sta.z (conio_line_text),z + sta (conio_line_text),z // conio_line_color[conio_cursor_x] = conio_textcolor lda #LIGHT_BLUE ldz conio_cursor_x - sta.z (conio_line_color),z + sta (conio_line_color),z // if(++conio_cursor_x==CONIO_WIDTH) inc.z conio_cursor_x lda #$50 diff --git a/src/test/ref/examples/mega65/helloworld-mega65.log b/src/test/ref/examples/mega65/helloworld-mega65.log index a7bc3421e..b8c3c0369 100644 --- a/src/test/ref/examples/mega65/helloworld-mega65.log +++ b/src/test/ref/examples/mega65/helloworld-mega65.log @@ -1804,11 +1804,11 @@ cputc: { __b2: // [25] conio_line_text[conio_cursor_x] = cputc::c#0 -- pbuz1_derefidx_vbuz2=vbuaa ldz conio_cursor_x - sta.z (conio_line_text),z + sta (conio_line_text),z // [26] conio_line_color[conio_cursor_x] = LIGHT_BLUE -- pbuz1_derefidx_vbuz2=vbuc1 lda #LIGHT_BLUE ldz conio_cursor_x - sta.z (conio_line_color),z + sta (conio_line_color),z // [27] conio_cursor_x = ++ conio_cursor_x -- vbuz1=_inc_vbuz1 inc.z conio_cursor_x // [28] if(conio_cursor_x!=$50) goto cputc::@return -- vbuz1_neq_vbuc1_then_la1 @@ -2659,12 +2659,12 @@ cputc: { // conio_line_text[conio_cursor_x] = c // [25] conio_line_text[conio_cursor_x] = cputc::c#0 -- pbuz1_derefidx_vbuz2=vbuaa ldz conio_cursor_x - sta.z (conio_line_text),z + sta (conio_line_text),z // conio_line_color[conio_cursor_x] = conio_textcolor // [26] conio_line_color[conio_cursor_x] = LIGHT_BLUE -- pbuz1_derefidx_vbuz2=vbuc1 lda #LIGHT_BLUE ldz conio_cursor_x - sta.z (conio_line_color),z + sta (conio_line_color),z // if(++conio_cursor_x==CONIO_WIDTH) // [27] conio_cursor_x = ++ conio_cursor_x -- vbuz1=_inc_vbuz1 inc.z conio_cursor_x