From 557212c84774c2efc89df7145a089763c88e0eea Mon Sep 17 00:00:00 2001 From: jespergravgaard Date: Sat, 16 May 2020 16:28:24 +0200 Subject: [PATCH] Added a VIC 20 target. Added CONIO support for VIC 20. --- src/main/kc/include/conio.h | 2 +- src/main/kc/include/mos6522.h | 39 ++ src/main/kc/include/mos6561.h | 64 +++ src/main/kc/include/vic20.h | 42 ++ src/main/kc/lib/conio.c | 104 +++- src/main/kc/target/vic20.ld | 9 + src/main/kc/target/vic20.tgt | 8 + src/main/kc/target/vic20basic.ld | 3 + src/main/kc/target/vic20basic.tgt | 8 + .../dk/camelot64/kickc/test/TestPrograms.java | 5 + src/test/kc/vic20-simple.c | 12 + src/test/ref/complex/polygon/polygon.asm | 12 +- src/test/ref/complex/polygon/polygon.cfg | 4 +- src/test/ref/complex/polygon/polygon.log | 70 +-- src/test/ref/complex/polygon/polygon.sym | 4 +- src/test/ref/examples/conio/nacht-screen.asm | 20 +- src/test/ref/examples/conio/nacht-screen.cfg | 8 +- src/test/ref/examples/conio/nacht-screen.log | 250 ++++----- src/test/ref/examples/conio/nacht-screen.sym | 8 +- src/test/ref/vic20-simple.asm | 40 ++ src/test/ref/vic20-simple.cfg | 26 + src/test/ref/vic20-simple.log | 505 ++++++++++++++++++ src/test/ref/vic20-simple.sym | 48 ++ 23 files changed, 1075 insertions(+), 216 deletions(-) create mode 100644 src/main/kc/include/mos6522.h create mode 100644 src/main/kc/include/mos6561.h create mode 100644 src/main/kc/include/vic20.h create mode 100644 src/main/kc/target/vic20.ld create mode 100644 src/main/kc/target/vic20.tgt create mode 100644 src/main/kc/target/vic20basic.ld create mode 100644 src/main/kc/target/vic20basic.tgt create mode 100644 src/test/kc/vic20-simple.c create mode 100644 src/test/ref/vic20-simple.asm create mode 100644 src/test/ref/vic20-simple.cfg create mode 100644 src/test/ref/vic20-simple.log create mode 100644 src/test/ref/vic20-simple.sym diff --git a/src/main/kc/include/conio.h b/src/main/kc/include/conio.h index d65bdcd7a..aba963516 100644 --- a/src/main/kc/include/conio.h +++ b/src/main/kc/include/conio.h @@ -2,7 +2,7 @@ // Implements similar functions as conio.h from CC65 for compatibility // See https://github.com/cc65/cc65/blob/master/include/conio.h // -// Currently only the C64 and PLUS4 platform is supported +// Currently C64/PLUS4/VIC20 platforms are supported // clears the screen and moves the cursor to the upper left-hand corner of the screen. diff --git a/src/main/kc/include/mos6522.h b/src/main/kc/include/mos6522.h new file mode 100644 index 000000000..f7006f96f --- /dev/null +++ b/src/main/kc/include/mos6522.h @@ -0,0 +1,39 @@ +// MOS 6522 Versatile Interface Adapter (VIA) +// Used in VIC 20 and 1541 +// https://en.wikipedia.org/wiki/MOS_Technology_6522 +// http://archive.6502.org/datasheets/mos_6522_preliminary_nov_1977.pdf + +struct MOS6522_VIA { + // Port B + char PORT_B; + // Port A + char PORT_A; + // Port B data direction register. + char PORT_B_DDR; + // Port A data direction register. + char PORT_A_DDR; + // Timer 1 low byte + char TIMER1_LOW; + // Timer 1 high byte + char TIMER1_HIGH; + // Timer 1 latch low byte + char TIMER1_LATCH_LOW; + // Timer 1 latch high byte + char TIMER1_LATCH_HIGH; + // Timer 2 low byte + char TIMER2_LOW; + // Timer 2 high byte + char TIMER2_HIGH; + // Shift Register + char SHIFT; + // Auxiliary Control Register + char AUX_CONTROL; + // Peripheral Control Register + char PERIPHERAL_CONTROL; + // Interrupt Flag Register + char INTERRUPT_FLAG; + // Interrupt Enable Register + char INTERRUPT_ENABLE; + // Port A Output (no handshake) + char PORT_A_OUTPUT; +}; \ No newline at end of file diff --git a/src/main/kc/include/mos6561.h b/src/main/kc/include/mos6561.h new file mode 100644 index 000000000..dce704b9f --- /dev/null +++ b/src/main/kc/include/mos6561.h @@ -0,0 +1,64 @@ +// MOS 6560/6561 VIDEO INTERFACE CHIP +// Used in VIC 20 +// http://archive.6502.org/datasheets/mos_6560_6561_vic.pdf + +struct MOS6561_VIC { + // Screen Origin X-coordinate + // bits 0-6: horizontal centering + // bit 7: sets interlace scan + char ORIGIN_X; + // Screen Origin Y-coordinate + // bit 0-7: vertical centering + char ORIGIN_Y; + // Number of Screen Columns + // bits 0-6: Number of columns + // bit 7: Upper bit of video matrix address (also controls address of COLOR RAM) + char MATRIX_COLUMNS; + // Number of Screen Rows + // bits 1-6: set ol rows + // bit 7: sets or 16 chars + char MATRIX_ROWS; + // The Raster Line + // bits 0-7: Current TV raster beam line + char RASTER; + // Character and Screen Address + // bits 0-3: start of character memory (default 0) + // ROM: 0000: 0x8000, 0001: 0x8400, 0010: 0x8800, 0011: 0x8c00 + // RAM: 1000: 0x0000, 1001: unavail, 1010: unavail, 1011: unavail + // RAM: 1100: 0x1000, 1101: 0x1400, 1110: 0x1800, 1111: 0x1c00 + // bits 4-7: is rest of video matrix address (default F) + char MEMORY; + // Lightpen X position + // bits 0-7: horizontal position of light pen + char LIGHTPEN_X; + // Lightpen Y position + // bits 0-7: vertical position of light pen + char LIGHTPEN_Y; + // Paddle X position + // bit 0-7: Digitized value of paddle X + char PADDLE_X; + // Paddle Y position + // bit 0-7: Digitized value oi paddle Y + char PADDLE_Y; + // Sound Voice 1 (low) frequency + // Frequency for oscillator 1 (low) (on: 128-255) + char CH1_FREQ; + // Sound Voice 2 (medium) frequency + // Frequency for oscillator 1 (medium) (on: 128-255) + char CH2_FREQ; + // Sound Voice 3 (high) frequency + // Frequency for oscillator 1 (high) (on: 128-255) + char CH3_FREQ; + // Sound Voice 4 (noise) frequency + // Frequency of noise source + char CH4_FREQ; + // Sound Volume and auxiliary color information + // bit 0-3: sets volume of all sound + // bits 4-7: are auxiliary color information + char VOLUME_COLOR; + // Screen and border color register + // bits 4-7: background color + // bit 3: inverted or normal mode + // bits 0-2: border color + char BORDER_BACKGROUND_COLOR; +}; \ No newline at end of file diff --git a/src/main/kc/include/vic20.h b/src/main/kc/include/vic20.h new file mode 100644 index 000000000..42bf0bf76 --- /dev/null +++ b/src/main/kc/include/vic20.h @@ -0,0 +1,42 @@ +// Commodore VIC 20 registers and memory layout +// http://sleepingelephant.com/denial/wiki/index.php?title=Memory_Map +// http://www.zimmers.net/anonftp/pub/cbm/vic20/manuals/VIC-20_Programmers_Reference_Guide_1st_Edition_6th_Printing.pdf + +#include +#include + +// Default address of screen color matrix +char * const DEFAULT_COLORRAM = 0x9600; +// Address of screen color matrix if bit 7 of $9002 is 1 +char * const ALTERNATIVE_COLORRAM = 0x9400; +// Default address of screen character matrix +char * const DEFAULT_SCREEN = 0x1e00; + +// The address of the CHARGEN character set +char * const CHARGEN = 0x8000; + +// The MOS 6560/6561 VIC Video Interface Chip +struct MOS6561_VIC * const VIC = 0x9000; + +// The VIA#1: User port, RS-232, Joystick, Lightpen, Cassette +struct MOS6522_VIA * const VIA1 = 0x9110; +// The VIA#2: Keyboard, Joystick, Cassette +struct MOS6522_VIA * const VIA2 = 0x9120; + +// The colors of the VIC 20 +const char BLACK = 0x0; +const char WHITE = 0x1; +const char RED = 0x2; +const char CYAN = 0x3; +const char PURPLE = 0x4; +const char GREEN = 0x5; +const char BLUE = 0x6; +const char YELLOW = 0x7; +const char ORANGE = 0x8; +const char LIGHT_ORANGE = 0x9; +const char PINK = 0xa; +const char LIGHT_CYAN= 0xb; +const char LIGHT_PURPLE = 0xc; +const char LIGHT_GREEN = 0xd; +const char LIGHT_BLUE = 0xe; +const char LIGHT_YELLOW = 0xf; diff --git a/src/main/kc/lib/conio.c b/src/main/kc/lib/conio.c index 7ca6d88fe..c1d8f32de 100644 --- a/src/main/kc/lib/conio.c +++ b/src/main/kc/lib/conio.c @@ -2,7 +2,7 @@ // Implements similar functions as conio.h from CC65 for compatibility // See https://github.com/cc65/cc65/blob/master/include/conio.h // -// Currently only the C64/PLUS4 platforms are supported +// Currently C64/PLUS4/VIC20 platforms are supported #include #include @@ -18,21 +18,35 @@ char * const CONIO_SCREEN_TEXT = 0x0400; // The color screen address char * const CONIO_SCREEN_COLORS = 0xd800; - // The background color register address - char * const CONIO_BGCOLOR = 0xd021; - // The border color register address - char * const CONIO_BORDERCOLOR = 0xd020; // The default text color const char CONIO_TEXTCOLOR_DEFAULT = 0xe; // Return true if there's a key waiting, return false if not unsigned char kbhit (void) { // CIA#1 Port A: keyboard matrix columns and joystick #2 - char* const CONIO_CIA1_PORT_A = 0xdc00; + char* const CIA1_PORT_A = 0xdc00; // CIA#1 Port B: keyboard matrix rows and joystick #1. - char* const CONIO_CIA1_PORT_B = 0xdc01; - *CONIO_CIA1_PORT_A = 0; - return ~*CONIO_CIA1_PORT_B; + char* const CIA1_PORT_B = 0xdc01; + *CIA1_PORT_A = 0; + return ~*CIA1_PORT_B; + } + + // Set the color for the background. The old color setting is returned. + unsigned char bgcolor(unsigned char color) { + // The background color register address + char * const CONIO_BGCOLOR = 0xd021; + char old = *CONIO_BGCOLOR; + *CONIO_BGCOLOR = color; + return old; + } + + // Set the color for the border. The old color setting is returned. + unsigned char bordercolor(unsigned char color) { + // The border color register address + char * const CONIO_BORDERCOLOR = 0xd020; + char old = *CONIO_BORDERCOLOR; + *CONIO_BORDERCOLOR = color; + return old; } #elif defined(__PLUS4__) @@ -50,10 +64,6 @@ char * const CONIO_SCREEN_TEXT = DEFAULT_SCREEN; // The color screen address char * const CONIO_SCREEN_COLORS = DEFAULT_COLORRAM; - // The background color register address - char * const CONIO_BGCOLOR = &TED->BG_COLOR; - // The border color register address - char * const CONIO_BORDERCOLOR = &TED->BORDER_COLOR; // The default text color const char CONIO_TEXTCOLOR_DEFAULT = 0; @@ -69,6 +79,60 @@ return ~TED->KEYBOARD_INPUT; } + // Set the color for the background. The old color setting is returned. + unsigned char bgcolor(unsigned char color) { + char old = TED->BG_COLOR; + TED->BG_COLOR = color; + return old; + } + + // Set the color for the border. The old color setting is returned. + unsigned char bordercolor(unsigned char color) { + char old = TED->BORDER_COLOR; + TED->BORDER_COLOR = color; + return old; + } + +#elif defined(__VIC20__) + + #include + + // The screen width + #define CONIO_WIDTH 22 + // The screen height + #define CONIO_HEIGHT 23 + // The screen bytes + #define CONIO_BYTES CONIO_HEIGHT*CONIO_WIDTH + + // The text screen address + char * const CONIO_SCREEN_TEXT = DEFAULT_SCREEN; + // The color screen address + char * const CONIO_SCREEN_COLORS = DEFAULT_COLORRAM; + // The default text color + const char CONIO_TEXTCOLOR_DEFAULT = BLUE; + + // Return true if there's a key waiting, return false if not + unsigned char kbhit (void) { + // Read all keyboard matrix rows + VIA2->PORT_B = 0x00; + // Read the keyboard input + return ~VIA2->PORT_A; + } + + // Set the color for the background. The old color setting is returned. + unsigned char bgcolor(unsigned char color) { + char old = VIC->BORDER_BACKGROUND_COLOR; + VIC->BORDER_BACKGROUND_COLOR = old&0x0f|(color<<4); + return old>>4; + } + + // Set the color for the border. The old color setting is returned. + unsigned char bordercolor(unsigned char color) { + char old = VIC->BORDER_BACKGROUND_COLOR; + VIC->BORDER_BACKGROUND_COLOR = old&0xf8|color; + return old&0x07; + } + #else // #error "Target platform does not support conio.h" #endif @@ -240,20 +304,6 @@ unsigned char textcolor(unsigned char color) { return old; } -// Set the color for the background. The old color setting is returned. -unsigned char bgcolor(unsigned char color) { - char old = *CONIO_BGCOLOR; - *CONIO_BGCOLOR = color; - return old; -} - -// Set the color for the border. The old color setting is returned. -unsigned char bordercolor(unsigned char color) { - char old = *CONIO_BORDERCOLOR; - *CONIO_BORDERCOLOR = color; - return old; -} - // If onoff is 1, a cursor is displayed when waiting for keyboard input. // If onoff is 0, the cursor is hidden when waiting for keyboard input. // The function returns the old cursor setting. diff --git a/src/main/kc/target/vic20.ld b/src/main/kc/target/vic20.ld new file mode 100644 index 000000000..fbb505a15 --- /dev/null +++ b/src/main/kc/target/vic20.ld @@ -0,0 +1,9 @@ +.file [name="%O.prg", type="prg", segments="Program"] +.segmentdef Program [segments="Basic, Code, Data"] +.segmentdef Basic [start=$1001] +.segmentdef Code [start=$100e] +.segmentdef Data [startAfter="Code"] +.segment Basic +:BasicUpstart(%E) +.segment Code + diff --git a/src/main/kc/target/vic20.tgt b/src/main/kc/target/vic20.tgt new file mode 100644 index 000000000..98a9338f3 --- /dev/null +++ b/src/main/kc/target/vic20.tgt @@ -0,0 +1,8 @@ +{ + "link": "vic20.ld", + "cpu": "MOS6502X", + "emulator": "xvic", + "defines": { + "__VIC20__": 1 + } +} \ No newline at end of file diff --git a/src/main/kc/target/vic20basic.ld b/src/main/kc/target/vic20basic.ld new file mode 100644 index 000000000..b97a2730e --- /dev/null +++ b/src/main/kc/target/vic20basic.ld @@ -0,0 +1,3 @@ +.pc = $1001 "Basic" +:BasicUpstart(%E) +.pc = %P "Program" \ No newline at end of file diff --git a/src/main/kc/target/vic20basic.tgt b/src/main/kc/target/vic20basic.tgt new file mode 100644 index 000000000..f5b94113d --- /dev/null +++ b/src/main/kc/target/vic20basic.tgt @@ -0,0 +1,8 @@ +{ + "link": "vic20basic.ld", + "cpu": "MOS6502X", + "emulator": "xvic", + "defines": { + "__VIC20__": 1 + } +} \ No newline at end of file diff --git a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java index 877a3ddb7..4bf633bd4 100644 --- a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java +++ b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java @@ -44,6 +44,11 @@ public class TestPrograms { public TestPrograms() { } + @Test + public void testVic20Simple() throws IOException, URISyntaxException { + compileAndCompare("vic20-simple.c"); + } + @Test public void testPlus4KeyboardTest() throws IOException, URISyntaxException { compileAndCompare("plus4-keyboard-test.c"); diff --git a/src/test/kc/vic20-simple.c b/src/test/kc/vic20-simple.c new file mode 100644 index 000000000..65b3b2003 --- /dev/null +++ b/src/test/kc/vic20-simple.c @@ -0,0 +1,12 @@ +// Trivial VIC 20 program +#pragma target(vic20) +#include + +char MESSAGE[] = "hello world!"; + +void main() { + for(char i=0; MESSAGE[i]; i++) { + DEFAULT_SCREEN[i] = MESSAGE[i]; + DEFAULT_COLORRAM[i] = RED; + } +} \ No newline at end of file diff --git a/src/test/ref/complex/polygon/polygon.asm b/src/test/ref/complex/polygon/polygon.asm index 91e23d382..86dd426c9 100644 --- a/src/test/ref/complex/polygon/polygon.asm +++ b/src/test/ref/complex/polygon/polygon.asm @@ -882,14 +882,14 @@ irq_bottom_2: { // Return true if there's a key waiting, return false if not kbhit: { // CIA#1 Port A: keyboard matrix columns and joystick #2 - .label CONIO_CIA1_PORT_A = $dc00 + .label CIA1_PORT_A = $dc00 // CIA#1 Port B: keyboard matrix rows and joystick #1. - .label CONIO_CIA1_PORT_B = $dc01 - // *CONIO_CIA1_PORT_A = 0 + .label CIA1_PORT_B = $dc01 + // *CIA1_PORT_A = 0 lda #0 - sta CONIO_CIA1_PORT_A - // ~*CONIO_CIA1_PORT_B - lda CONIO_CIA1_PORT_B + sta CIA1_PORT_A + // ~*CIA1_PORT_B + lda CIA1_PORT_B eor #$ff // } rts diff --git a/src/test/ref/complex/polygon/polygon.cfg b/src/test/ref/complex/polygon/polygon.cfg index ec820b532..3789493c1 100644 --- a/src/test/ref/complex/polygon/polygon.cfg +++ b/src/test/ref/complex/polygon/polygon.cfg @@ -448,8 +448,8 @@ irq_bottom_2::@1: scope:[irq_bottom_2] from irq_bottom_2::@4 (byte()) kbhit() kbhit: scope:[kbhit] from irq_bottom_2 - [219] *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_A) ← (byte) 0 - [220] (byte) kbhit::return#0 ← ~ *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_B) + [219] *((const nomodify byte*) kbhit::CIA1_PORT_A) ← (byte) 0 + [220] (byte) kbhit::return#0 ← ~ *((const nomodify byte*) kbhit::CIA1_PORT_B) to:kbhit::@return kbhit::@return: scope:[kbhit] from kbhit [221] return diff --git a/src/test/ref/complex/polygon/polygon.log b/src/test/ref/complex/polygon/polygon.log index 7cdb3420d..47b557029 100644 --- a/src/test/ref/complex/polygon/polygon.log +++ b/src/test/ref/complex/polygon/polygon.log @@ -88,11 +88,11 @@ clock_start: scope:[clock_start] from main::@8 clock_start::@return: scope:[clock_start] from clock_start return to:@return -$$ + (byte()) kbhit() kbhit: scope:[kbhit] from irq_bottom_2 - *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_A) ← (number) 0 - (byte~) kbhit::$0 ← ~ *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_B) + *((const nomodify byte*) kbhit::CIA1_PORT_A) ← (number) 0 + (byte~) kbhit::$0 ← ~ *((const nomodify byte*) kbhit::CIA1_PORT_B) (byte) kbhit::return#0 ← (byte~) kbhit::$0 to:kbhit::@return kbhit::@return: scope:[kbhit] from kbhit @@ -1321,8 +1321,8 @@ interrupt(KERNEL_KEYBOARD)(void()) irq_bottom_2() (byte()) kbhit() (byte~) kbhit::$0 (label) kbhit::@return -(const nomodify byte*) kbhit::CONIO_CIA1_PORT_A = (byte*)(number) $dc00 -(const nomodify byte*) kbhit::CONIO_CIA1_PORT_B = (byte*)(number) $dc01 +(const nomodify byte*) kbhit::CIA1_PORT_A = (byte*)(number) $dc00 +(const nomodify byte*) kbhit::CIA1_PORT_B = (byte*)(number) $dc01 (byte) kbhit::return (byte) kbhit::return#0 (byte) kbhit::return#1 @@ -2073,7 +2073,7 @@ Adding number conversion cast (unumber) 0 in (bool~) memset::$0 ← (word) memse Adding number conversion cast (unumber) $ffffffff in (number~) clock::$0 ← (number) $ffffffff - *((const nomodify dword*) CIA2_TIMER_AB) Adding number conversion cast (unumber) clock::$0 in (number~) clock::$0 ← (unumber)(number) $ffffffff - *((const nomodify dword*) CIA2_TIMER_AB) Adding number conversion cast (unumber) $ffffffff in *((const nomodify dword*) CIA2_TIMER_AB) ← (number) $ffffffff -Adding number conversion cast (unumber) 0 in *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_A) ← (number) 0 +Adding number conversion cast (unumber) 0 in *((const nomodify byte*) kbhit::CIA1_PORT_A) ← (number) 0 Adding number conversion cast (unumber) $3fff in (number~) toD0181_$0 ← (word~) toD0181_$7 & (number) $3fff Adding number conversion cast (unumber) toD0181_$0 in (number~) toD0181_$0 ← (word~) toD0181_$7 & (unumber)(number) $3fff Adding number conversion cast (unumber) 4 in (number~) toD0181_$1 ← (unumber~) toD0181_$0 * (number) 4 @@ -2205,7 +2205,7 @@ Adding number conversion cast (unumber) 1 in (byte) sgn_u8::return#3 ← (number Successful SSA optimization PassNAddNumberTypeConversions Inlining cast (byte*) memset::dst#0 ← (byte*)(void*) memset::str#5 Inlining cast *((const nomodify dword*) CIA2_TIMER_AB) ← (unumber)(number) $ffffffff -Inlining cast *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_A) ← (unumber)(number) 0 +Inlining cast *((const nomodify byte*) kbhit::CIA1_PORT_A) ← (unumber)(number) 0 Inlining cast (word) memset::num#0 ← (unumber)(number) $28*(number) $19 Inlining cast (byte) memset::c#1 ← (unumber)(number) 0 Inlining cast (word) memset::num#1 ← (unumber)(number) $28*(number) $19 @@ -3608,8 +3608,8 @@ irq_bottom_2::@1: scope:[irq_bottom_2] from irq_bottom_2::@4 (byte()) kbhit() kbhit: scope:[kbhit] from irq_bottom_2 - [219] *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_A) ← (byte) 0 - [220] (byte) kbhit::return#0 ← ~ *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_B) + [219] *((const nomodify byte*) kbhit::CIA1_PORT_A) ← (byte) 0 + [220] (byte) kbhit::return#0 ← ~ *((const nomodify byte*) kbhit::CIA1_PORT_B) to:kbhit::@return kbhit::@return: scope:[kbhit] from kbhit [221] return @@ -5638,16 +5638,16 @@ irq_bottom_2: { // Return true if there's a key waiting, return false if not kbhit: { // CIA#1 Port A: keyboard matrix columns and joystick #2 - .label CONIO_CIA1_PORT_A = $dc00 + .label CIA1_PORT_A = $dc00 // CIA#1 Port B: keyboard matrix rows and joystick #1. - .label CONIO_CIA1_PORT_B = $dc01 + .label CIA1_PORT_B = $dc01 .label return = $5d .label return_1 = $5b - // [219] *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_A) ← (byte) 0 -- _deref_pbuc1=vbuc2 + // [219] *((const nomodify byte*) kbhit::CIA1_PORT_A) ← (byte) 0 -- _deref_pbuc1=vbuc2 lda #0 - sta CONIO_CIA1_PORT_A - // [220] (byte) kbhit::return#0 ← ~ *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_B) -- vbuz1=_bnot__deref_pbuc1 - lda CONIO_CIA1_PORT_B + sta CIA1_PORT_A + // [220] (byte) kbhit::return#0 ← ~ *((const nomodify byte*) kbhit::CIA1_PORT_B) -- vbuz1=_bnot__deref_pbuc1 + lda CIA1_PORT_B eor #$ff sta.z return jmp __breturn @@ -5853,8 +5853,8 @@ Statement [214] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byt Statement [215] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_RASTER) ← (const nomodify byte) BORDER_YPOS_BOTTOM-(byte) 8 [ ] ( [ ] { } ) always clobbers reg byte a Statement [216] *((const nomodify void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq_bottom_1() [ ] ( [ ] { } ) always clobbers reg byte a Statement [218] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_MEMORY) ← (volatile byte) canvas_show_memory [ ] ( [ ] { } ) always clobbers reg byte a -Statement [219] *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_A) ← (byte) 0 [ ] ( kbhit:207 [ canvas_show_memory ] { { kbhit::return#0 = kbhit::return#2 } } ) always clobbers reg byte a -Statement [220] (byte) kbhit::return#0 ← ~ *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_B) [ kbhit::return#0 ] ( kbhit:207 [ canvas_show_memory kbhit::return#0 ] { { kbhit::return#0 = kbhit::return#2 } } ) always clobbers reg byte a +Statement [219] *((const nomodify byte*) kbhit::CIA1_PORT_A) ← (byte) 0 [ ] ( kbhit:207 [ canvas_show_memory ] { { kbhit::return#0 = kbhit::return#2 } } ) always clobbers reg byte a +Statement [220] (byte) kbhit::return#0 ← ~ *((const nomodify byte*) kbhit::CIA1_PORT_B) [ kbhit::return#0 ] ( kbhit:207 [ canvas_show_memory kbhit::return#0 ] { { kbhit::return#0 = kbhit::return#2 } } ) always clobbers reg byte a Statement [222] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) ← (const nomodify byte) DARK_GREY [ ] ( [ ] { } ) always clobbers reg byte a Statement [224] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_MEMORY) ← (const byte) irq_bottom_1::toD0181_return#0 [ ] ( [ ] { } ) always clobbers reg byte a Statement [225] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_IRQ_STATUS) ← (const nomodify byte) IRQ_RASTER [ ] ( [ ] { } ) always clobbers reg byte a @@ -5955,8 +5955,8 @@ Statement [214] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byt Statement [215] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_RASTER) ← (const nomodify byte) BORDER_YPOS_BOTTOM-(byte) 8 [ ] ( [ ] { } ) always clobbers reg byte a Statement [216] *((const nomodify void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq_bottom_1() [ ] ( [ ] { } ) always clobbers reg byte a Statement [218] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_MEMORY) ← (volatile byte) canvas_show_memory [ ] ( [ ] { } ) always clobbers reg byte a -Statement [219] *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_A) ← (byte) 0 [ ] ( kbhit:207 [ canvas_show_memory ] { { kbhit::return#0 = kbhit::return#2 } } ) always clobbers reg byte a -Statement [220] (byte) kbhit::return#0 ← ~ *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_B) [ kbhit::return#0 ] ( kbhit:207 [ canvas_show_memory kbhit::return#0 ] { { kbhit::return#0 = kbhit::return#2 } } ) always clobbers reg byte a +Statement [219] *((const nomodify byte*) kbhit::CIA1_PORT_A) ← (byte) 0 [ ] ( kbhit:207 [ canvas_show_memory ] { { kbhit::return#0 = kbhit::return#2 } } ) always clobbers reg byte a +Statement [220] (byte) kbhit::return#0 ← ~ *((const nomodify byte*) kbhit::CIA1_PORT_B) [ kbhit::return#0 ] ( kbhit:207 [ canvas_show_memory kbhit::return#0 ] { { kbhit::return#0 = kbhit::return#2 } } ) always clobbers reg byte a Statement [222] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) ← (const nomodify byte) DARK_GREY [ ] ( [ ] { } ) always clobbers reg byte a Statement [224] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_MEMORY) ← (const byte) irq_bottom_1::toD0181_return#0 [ ] ( [ ] { } ) always clobbers reg byte a Statement [225] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_IRQ_STATUS) ← (const nomodify byte) IRQ_RASTER [ ] ( [ ] { } ) always clobbers reg byte a @@ -7524,14 +7524,14 @@ irq_bottom_2: { // Return true if there's a key waiting, return false if not kbhit: { // CIA#1 Port A: keyboard matrix columns and joystick #2 - .label CONIO_CIA1_PORT_A = $dc00 + .label CIA1_PORT_A = $dc00 // CIA#1 Port B: keyboard matrix rows and joystick #1. - .label CONIO_CIA1_PORT_B = $dc01 - // [219] *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_A) ← (byte) 0 -- _deref_pbuc1=vbuc2 + .label CIA1_PORT_B = $dc01 + // [219] *((const nomodify byte*) kbhit::CIA1_PORT_A) ← (byte) 0 -- _deref_pbuc1=vbuc2 lda #0 - sta CONIO_CIA1_PORT_A - // [220] (byte) kbhit::return#0 ← ~ *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_B) -- vbuaa=_bnot__deref_pbuc1 - lda CONIO_CIA1_PORT_B + sta CIA1_PORT_A + // [220] (byte) kbhit::return#0 ← ~ *((const nomodify byte*) kbhit::CIA1_PORT_B) -- vbuaa=_bnot__deref_pbuc1 + lda CIA1_PORT_B eor #$ff jmp __breturn // kbhit::@return @@ -8017,8 +8017,8 @@ interrupt(KERNEL_KEYBOARD)(void()) irq_bottom_2() (byte*) irq_bottom_2::toD0181_screen (byte()) kbhit() (label) kbhit::@return -(const nomodify byte*) kbhit::CONIO_CIA1_PORT_A = (byte*) 56320 -(const nomodify byte*) kbhit::CONIO_CIA1_PORT_B = (byte*) 56321 +(const nomodify byte*) kbhit::CIA1_PORT_A = (byte*) 56320 +(const nomodify byte*) kbhit::CIA1_PORT_B = (byte*) 56321 (byte) kbhit::return (byte) kbhit::return#0 reg byte a 4.333333333333333 (byte) kbhit::return#2 reg byte a 4.0 @@ -9648,16 +9648,16 @@ irq_bottom_2: { // Return true if there's a key waiting, return false if not kbhit: { // CIA#1 Port A: keyboard matrix columns and joystick #2 - .label CONIO_CIA1_PORT_A = $dc00 + .label CIA1_PORT_A = $dc00 // CIA#1 Port B: keyboard matrix rows and joystick #1. - .label CONIO_CIA1_PORT_B = $dc01 - // *CONIO_CIA1_PORT_A = 0 - // [219] *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_A) ← (byte) 0 -- _deref_pbuc1=vbuc2 + .label CIA1_PORT_B = $dc01 + // *CIA1_PORT_A = 0 + // [219] *((const nomodify byte*) kbhit::CIA1_PORT_A) ← (byte) 0 -- _deref_pbuc1=vbuc2 lda #0 - sta CONIO_CIA1_PORT_A - // ~*CONIO_CIA1_PORT_B - // [220] (byte) kbhit::return#0 ← ~ *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_B) -- vbuaa=_bnot__deref_pbuc1 - lda CONIO_CIA1_PORT_B + sta CIA1_PORT_A + // ~*CIA1_PORT_B + // [220] (byte) kbhit::return#0 ← ~ *((const nomodify byte*) kbhit::CIA1_PORT_B) -- vbuaa=_bnot__deref_pbuc1 + lda CIA1_PORT_B eor #$ff // kbhit::@return // } diff --git a/src/test/ref/complex/polygon/polygon.sym b/src/test/ref/complex/polygon/polygon.sym index 22d4678dd..c41e3b99b 100644 --- a/src/test/ref/complex/polygon/polygon.sym +++ b/src/test/ref/complex/polygon/polygon.sym @@ -192,8 +192,8 @@ interrupt(KERNEL_KEYBOARD)(void()) irq_bottom_2() (byte*) irq_bottom_2::toD0181_screen (byte()) kbhit() (label) kbhit::@return -(const nomodify byte*) kbhit::CONIO_CIA1_PORT_A = (byte*) 56320 -(const nomodify byte*) kbhit::CONIO_CIA1_PORT_B = (byte*) 56321 +(const nomodify byte*) kbhit::CIA1_PORT_A = (byte*) 56320 +(const nomodify byte*) kbhit::CIA1_PORT_B = (byte*) 56321 (byte) kbhit::return (byte) kbhit::return#0 reg byte a 4.333333333333333 (byte) kbhit::return#2 reg byte a 4.0 diff --git a/src/test/ref/examples/conio/nacht-screen.asm b/src/test/ref/examples/conio/nacht-screen.asm index ddfae4c39..00253a1cb 100644 --- a/src/test/ref/examples/conio/nacht-screen.asm +++ b/src/test/ref/examples/conio/nacht-screen.asm @@ -31,10 +31,6 @@ .label CONIO_SCREEN_TEXT = $400 // The color screen address .label CONIO_SCREEN_COLORS = $d800 - // The background color register address - .label CONIO_BGCOLOR = $d021 - // The border color register address - .label CONIO_BORDERCOLOR = $d020 .label VIC_MEMORY = $d018 .label conio_cursor_x = 9 .label conio_cursor_y = $a @@ -172,14 +168,14 @@ clrscr: { // Return true if there's a key waiting, return false if not kbhit: { // CIA#1 Port A: keyboard matrix columns and joystick #2 - .label CONIO_CIA1_PORT_A = $dc00 + .label CIA1_PORT_A = $dc00 // CIA#1 Port B: keyboard matrix rows and joystick #1. - .label CONIO_CIA1_PORT_B = $dc01 - // *CONIO_CIA1_PORT_A = 0 + .label CIA1_PORT_B = $dc01 + // *CIA1_PORT_A = 0 lda #0 - sta CONIO_CIA1_PORT_A - // ~*CONIO_CIA1_PORT_B - lda CONIO_CIA1_PORT_B + sta CIA1_PORT_A + // ~*CIA1_PORT_B + lda CIA1_PORT_B eor #$ff // } rts @@ -839,6 +835,8 @@ cursor: { } // Set the color for the background. The old color setting is returned. bgcolor: { + // The background color register address + .label CONIO_BGCOLOR = $d021 // *CONIO_BGCOLOR = color lda #COLOR_BLACK sta CONIO_BGCOLOR @@ -847,6 +845,8 @@ bgcolor: { } // Set the color for the border. The old color setting is returned. bordercolor: { + // The border color register address + .label CONIO_BORDERCOLOR = $d020 // *CONIO_BORDERCOLOR = color lda #COLOR_BLACK sta CONIO_BORDERCOLOR diff --git a/src/test/ref/examples/conio/nacht-screen.cfg b/src/test/ref/examples/conio/nacht-screen.cfg index 84dc15ce6..b9044ca59 100644 --- a/src/test/ref/examples/conio/nacht-screen.cfg +++ b/src/test/ref/examples/conio/nacht-screen.cfg @@ -82,8 +82,8 @@ clrscr::@4: scope:[clrscr] from clrscr::@3 (byte()) kbhit() kbhit: scope:[kbhit] from main::@1 - [40] *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_A) ← (byte) 0 - [41] (byte) kbhit::return#0 ← ~ *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_B) + [40] *((const nomodify byte*) kbhit::CIA1_PORT_A) ← (byte) 0 + [41] (byte) kbhit::return#0 ← ~ *((const nomodify byte*) kbhit::CIA1_PORT_B) to:kbhit::@return kbhit::@return: scope:[kbhit] from kbhit [42] return @@ -491,7 +491,7 @@ cursor::@return: scope:[cursor] from cursor (byte()) bgcolor((byte) bgcolor::color) bgcolor: scope:[bgcolor] from MakeNiceScreen::@5 - [230] *((const nomodify byte*) CONIO_BGCOLOR) ← (const nomodify byte) COLOR_BLACK + [230] *((const nomodify byte*) bgcolor::CONIO_BGCOLOR) ← (const nomodify byte) COLOR_BLACK to:bgcolor::@return bgcolor::@return: scope:[bgcolor] from bgcolor [231] return @@ -499,7 +499,7 @@ bgcolor::@return: scope:[bgcolor] from bgcolor (byte()) bordercolor((byte) bordercolor::color) bordercolor: scope:[bordercolor] from MakeNiceScreen::@4 - [232] *((const nomodify byte*) CONIO_BORDERCOLOR) ← (const nomodify byte) COLOR_BLACK + [232] *((const nomodify byte*) bordercolor::CONIO_BORDERCOLOR) ← (const nomodify byte) COLOR_BLACK to:bordercolor::@return bordercolor::@return: scope:[bordercolor] from bordercolor [233] return diff --git a/src/test/ref/examples/conio/nacht-screen.log b/src/test/ref/examples/conio/nacht-screen.log index 5bf26472b..7b65ffec3 100644 --- a/src/test/ref/examples/conio/nacht-screen.log +++ b/src/test/ref/examples/conio/nacht-screen.log @@ -119,8 +119,8 @@ strlen::@return: scope:[strlen] from strlen::@3 (byte()) kbhit() kbhit: scope:[kbhit] from main::@1 - *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_A) ← (number) 0 - (byte~) kbhit::$0 ← ~ *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_B) + *((const nomodify byte*) kbhit::CIA1_PORT_A) ← (number) 0 + (byte~) kbhit::$0 ← ~ *((const nomodify byte*) kbhit::CIA1_PORT_B) (byte) kbhit::return#0 ← (byte~) kbhit::$0 to:kbhit::@return kbhit::@return: scope:[kbhit] from kbhit @@ -128,6 +128,32 @@ kbhit::@return: scope:[kbhit] from kbhit (byte) kbhit::return#1 ← (byte) kbhit::return#3 return to:@return + +(byte()) bgcolor((byte) bgcolor::color) +bgcolor: scope:[bgcolor] from MakeNiceScreen::@5 + (byte) bgcolor::color#1 ← phi( MakeNiceScreen::@5/(byte) bgcolor::color#0 ) + (byte) bgcolor::old#0 ← *((const nomodify byte*) bgcolor::CONIO_BGCOLOR) + *((const nomodify byte*) bgcolor::CONIO_BGCOLOR) ← (byte) bgcolor::color#1 + (byte) bgcolor::return#0 ← (byte) bgcolor::old#0 + to:bgcolor::@return +bgcolor::@return: scope:[bgcolor] from bgcolor + (byte) bgcolor::return#3 ← phi( bgcolor/(byte) bgcolor::return#0 ) + (byte) bgcolor::return#1 ← (byte) bgcolor::return#3 + return + to:@return + +(byte()) bordercolor((byte) bordercolor::color) +bordercolor: scope:[bordercolor] from MakeNiceScreen::@4 + (byte) bordercolor::color#1 ← phi( MakeNiceScreen::@4/(byte) bordercolor::color#0 ) + (byte) bordercolor::old#0 ← *((const nomodify byte*) bordercolor::CONIO_BORDERCOLOR) + *((const nomodify byte*) bordercolor::CONIO_BORDERCOLOR) ← (byte) bordercolor::color#1 + (byte) bordercolor::return#0 ← (byte) bordercolor::old#0 + to:bordercolor::@return +bordercolor::@return: scope:[bordercolor] from bordercolor + (byte) bordercolor::return#3 ← phi( bordercolor/(byte) bordercolor::return#0 ) + (byte) bordercolor::return#1 ← (byte) bordercolor::return#3 + return + to:@return @1: scope:[] from @begin (byte) conio_cursor_x ← (byte) 0 (byte) conio_cursor_y ← (byte) 0 @@ -520,32 +546,6 @@ textcolor::@return: scope:[textcolor] from textcolor return to:@return -(byte()) bgcolor((byte) bgcolor::color) -bgcolor: scope:[bgcolor] from MakeNiceScreen::@5 - (byte) bgcolor::color#1 ← phi( MakeNiceScreen::@5/(byte) bgcolor::color#0 ) - (byte) bgcolor::old#0 ← *((const nomodify byte*) CONIO_BGCOLOR) - *((const nomodify byte*) CONIO_BGCOLOR) ← (byte) bgcolor::color#1 - (byte) bgcolor::return#0 ← (byte) bgcolor::old#0 - to:bgcolor::@return -bgcolor::@return: scope:[bgcolor] from bgcolor - (byte) bgcolor::return#3 ← phi( bgcolor/(byte) bgcolor::return#0 ) - (byte) bgcolor::return#1 ← (byte) bgcolor::return#3 - return - to:@return - -(byte()) bordercolor((byte) bordercolor::color) -bordercolor: scope:[bordercolor] from MakeNiceScreen::@4 - (byte) bordercolor::color#1 ← phi( MakeNiceScreen::@4/(byte) bordercolor::color#0 ) - (byte) bordercolor::old#0 ← *((const nomodify byte*) CONIO_BORDERCOLOR) - *((const nomodify byte*) CONIO_BORDERCOLOR) ← (byte) bordercolor::color#1 - (byte) bordercolor::return#0 ← (byte) bordercolor::old#0 - to:bordercolor::@return -bordercolor::@return: scope:[bordercolor] from bordercolor - (byte) bordercolor::return#3 ← phi( bordercolor/(byte) bordercolor::return#0 ) - (byte) bordercolor::return#1 ← (byte) bordercolor::return#3 - return - to:@return - (byte()) cursor((byte) cursor::onoff) cursor: scope:[cursor] from MakeNiceScreen::@7 (byte) cursor::onoff#1 ← phi( MakeNiceScreen::@7/(byte) cursor::onoff#0 ) @@ -786,8 +786,6 @@ SYMBOL TABLE SSA (const nomodify byte) CH_VLINE = (byte) $5d (const nomodify byte) COLOR_BLACK = (byte) 0 (const nomodify byte) COLOR_GRAY3 = (byte) $f -(const nomodify byte*) CONIO_BGCOLOR = (byte*)(number) $d021 -(const nomodify byte*) CONIO_BORDERCOLOR = (byte*)(number) $d020 (const nomodify byte*) CONIO_SCREEN_COLORS = (byte*)(number) $d800 (const nomodify byte*) CONIO_SCREEN_TEXT = (byte*)(number) $400 (const nomodify byte) CONIO_TEXTCOLOR_DEFAULT = (byte) $e @@ -867,6 +865,7 @@ SYMBOL TABLE SSA (volatile byte) YSize loadstore (byte()) bgcolor((byte) bgcolor::color) (label) bgcolor::@return +(const nomodify byte*) bgcolor::CONIO_BGCOLOR = (byte*)(number) $d021 (byte) bgcolor::color (byte) bgcolor::color#0 (byte) bgcolor::color#1 @@ -879,6 +878,7 @@ SYMBOL TABLE SSA (byte) bgcolor::return#3 (byte()) bordercolor((byte) bordercolor::color) (label) bordercolor::@return +(const nomodify byte*) bordercolor::CONIO_BORDERCOLOR = (byte*)(number) $d020 (byte) bordercolor::color (byte) bordercolor::color#0 (byte) bordercolor::color#1 @@ -1152,8 +1152,8 @@ SYMBOL TABLE SSA (byte()) kbhit() (byte~) kbhit::$0 (label) kbhit::@return -(const nomodify byte*) kbhit::CONIO_CIA1_PORT_A = (byte*)(number) $dc00 -(const nomodify byte*) kbhit::CONIO_CIA1_PORT_B = (byte*)(number) $dc01 +(const nomodify byte*) kbhit::CIA1_PORT_A = (byte*)(number) $dc00 +(const nomodify byte*) kbhit::CIA1_PORT_B = (byte*)(number) $dc01 (byte) kbhit::return (byte) kbhit::return#0 (byte) kbhit::return#1 @@ -1319,7 +1319,7 @@ SYMBOL TABLE SSA Adding number conversion cast (unumber) 0 in (bool~) memset::$0 ← (word) memset::num#2 > (number) 0 Adding number conversion cast (unumber) 0 in (bool~) strlen::$0 ← (number) 0 != *((byte*) strlen::str#2) -Adding number conversion cast (unumber) 0 in *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_A) ← (number) 0 +Adding number conversion cast (unumber) 0 in *((const nomodify byte*) kbhit::CIA1_PORT_A) ← (number) 0 Adding number conversion cast (unumber) $19 in (bool~) clrscr::$0 ← (byte) clrscr::l#2 < (number) $19 Adding number conversion cast (unumber) 0 in (byte) conio_cursor_x ← (number) 0 Adding number conversion cast (unumber) 0 in (byte) conio_cursor_y ← (number) 0 @@ -1385,7 +1385,7 @@ Successful SSA optimization PassNAddNumberTypeConversions Inlining cast (byte*) memcpy::src#0 ← (byte*)(void*) memcpy::source#2 Inlining cast (byte*) memcpy::dst#0 ← (byte*)(void*) memcpy::destination#2 Inlining cast (byte*) memset::dst#0 ← (byte*)(void*) memset::str#3 -Inlining cast *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_A) ← (unumber)(number) 0 +Inlining cast *((const nomodify byte*) kbhit::CIA1_PORT_A) ← (unumber)(number) 0 Inlining cast (byte) conio_cursor_x ← (unumber)(number) 0 Inlining cast (byte) conio_cursor_y ← (unumber)(number) 0 Inlining cast (byte) gotoxy::y#0 ← (unumber)(number) 0 @@ -1417,10 +1417,10 @@ Inlining cast (byte) MakeNiceScreen::I#1 ← (unumber)(number) 0 Successful SSA optimization Pass2InlineCast Simplifying constant pointer cast (byte*) 1024 Simplifying constant pointer cast (byte*) 55296 -Simplifying constant pointer cast (byte*) 53281 -Simplifying constant pointer cast (byte*) 53280 Simplifying constant pointer cast (byte*) 56320 Simplifying constant pointer cast (byte*) 56321 +Simplifying constant pointer cast (byte*) 53281 +Simplifying constant pointer cast (byte*) 53280 Simplifying constant pointer cast (byte*) 53272 Simplifying constant integer cast 0 Simplifying constant integer cast 0 @@ -1538,10 +1538,10 @@ Inferred type updated to byte in (unumber~) MakeNiceScreen::$7 ← (volatile byt Inferred type updated to byte in (unumber~) MakeNiceScreen::$12 ← (volatile byte) XSize - (byte) 2 Inferred type updated to byte in (unumber~) MakeNiceScreen::$15 ← (volatile byte) XSize - (byte) 1 Inversing boolean not [20] (bool~) memset::$1 ← (word) memset::num#2 <= (byte) 0 from [19] (bool~) memset::$0 ← (word) memset::num#2 > (byte) 0 -Inversing boolean not [90] (bool~) gotoxy::$1 ← (byte) gotoxy::y#6 <= (byte) $19 from [89] (bool~) gotoxy::$0 ← (byte) gotoxy::y#6 > (byte) $19 -Inversing boolean not [94] (bool~) gotoxy::$3 ← (byte) gotoxy::x#6 < (byte) $28 from [93] (bool~) gotoxy::$2 ← (byte) gotoxy::x#6 >= (byte) $28 -Inversing boolean not [127] (bool~) cputc::$2 ← (byte) conio_cursor_x != (byte) $28 from [126] (bool~) cputc::$1 ← (byte) conio_cursor_x == (byte) $28 -Inversing boolean not [144] (bool~) cscroll::$1 ← (byte) conio_cursor_y != (byte) $19 from [143] (bool~) cscroll::$0 ← (byte) conio_cursor_y == (byte) $19 +Inversing boolean not [104] (bool~) gotoxy::$1 ← (byte) gotoxy::y#6 <= (byte) $19 from [103] (bool~) gotoxy::$0 ← (byte) gotoxy::y#6 > (byte) $19 +Inversing boolean not [108] (bool~) gotoxy::$3 ← (byte) gotoxy::x#6 < (byte) $28 from [107] (bool~) gotoxy::$2 ← (byte) gotoxy::x#6 >= (byte) $28 +Inversing boolean not [141] (bool~) cputc::$2 ← (byte) conio_cursor_x != (byte) $28 from [140] (bool~) cputc::$1 ← (byte) conio_cursor_x == (byte) $28 +Inversing boolean not [158] (bool~) cscroll::$1 ← (byte) conio_cursor_y != (byte) $19 from [157] (bool~) cscroll::$0 ← (byte) conio_cursor_y == (byte) $19 Inversing boolean not [289] (bool~) main::$4 ← (byte) 0 == (byte~) main::$3 from [288] (bool~) main::$5 ← (byte) 0 != (byte~) main::$3 Successful SSA optimization Pass2UnaryNotSimplification Alias candidate removed (volatile)conio_cursor_text = gotoxy::$6 cputln::$1 cscroll::$7 @@ -1563,6 +1563,8 @@ Alias memset::str#5 = memset::str#6 Alias strlen::len#2 = strlen::len#4 strlen::len#3 strlen::return#0 strlen::return#3 strlen::return#1 Alias strlen::str#2 = strlen::str#3 Alias kbhit::return#0 = kbhit::$0 kbhit::return#3 kbhit::return#1 +Alias bgcolor::return#0 = bgcolor::old#0 bgcolor::return#3 bgcolor::return#1 +Alias bordercolor::return#0 = bordercolor::old#0 bordercolor::return#3 bordercolor::return#1 Alias clrscr::line_text#5 = clrscr::line_text#6 Alias clrscr::line_cols#5 = clrscr::line_cols#6 Alias clrscr::l#2 = clrscr::l#5 @@ -1588,8 +1590,6 @@ Alias cvline::length#1 = cvline::length#5 cvline::length#4 cvline::length#3 Alias cvline::y#1 = cvline::y#5 Alias cvlinexy::length#2 = cvlinexy::length#3 Alias textcolor::return#0 = textcolor::old#0 textcolor::return#3 textcolor::return#1 -Alias bgcolor::return#0 = bgcolor::old#0 bgcolor::return#3 bgcolor::return#1 -Alias bordercolor::return#0 = bordercolor::old#0 bordercolor::return#3 bordercolor::return#1 Alias cursor::return#0 = cursor::old#0 cursor::return#3 cursor::return#1 Alias scroll::return#0 = scroll::old#0 scroll::return#3 scroll::return#1 Alias kbhit::return#2 = kbhit::return#4 @@ -1617,6 +1617,8 @@ Identical Phi Values (byte*) memset::end#1 (byte*) memset::end#0 Identical Phi Values (void*) memset::str#5 (void*) memset::str#3 Identical Phi Values (byte) memset::c#2 (byte) memset::c#4 Identical Phi Values (byte*) strlen::str#4 (byte*) strlen::str#1 +Identical Phi Values (byte) bgcolor::color#1 (byte) bgcolor::color#0 +Identical Phi Values (byte) bordercolor::color#1 (byte) bordercolor::color#0 Identical Phi Values (byte*) clrscr::line_text#2 (byte*) clrscr::line_text#5 Identical Phi Values (byte*) clrscr::line_cols#2 (byte*) clrscr::line_cols#5 Identical Phi Values (byte) clrscr::l#3 (byte) clrscr::l#2 @@ -1631,8 +1633,6 @@ Identical Phi Values (byte) cvline::length#2 (byte) cvline::length#0 Identical Phi Values (byte) cvline::length#1 (byte) cvline::length#2 Identical Phi Values (byte) cvline::x#1 (byte) cvline::x#0 Identical Phi Values (byte) textcolor::color#1 (byte) textcolor::color#0 -Identical Phi Values (byte) bgcolor::color#1 (byte) bgcolor::color#0 -Identical Phi Values (byte) bordercolor::color#1 (byte) bordercolor::color#0 Identical Phi Values (byte) cursor::onoff#1 (byte) cursor::onoff#0 Identical Phi Values (byte) scroll::onoff#1 (byte) scroll::onoff#0 Successful SSA optimization Pass2IdenticalPhiElimination @@ -1642,23 +1642,23 @@ Simple Condition (bool~) memcpy::$1 [7] if((byte*) memcpy::src#2!=(byte*) memcpy Simple Condition (bool~) memset::$1 [14] if((word) memset::num#2<=(byte) 0) goto memset::@1 Simple Condition (bool~) memset::$3 [21] if((byte*) memset::dst#2!=(byte*) memset::end#0) goto memset::@4 Simple Condition (bool~) strlen::$0 [29] if((byte) 0!=*((byte*) strlen::str#2)) goto strlen::@2 -Simple Condition (bool~) clrscr::$0 [48] if((byte) clrscr::l#2<(byte) $19) goto clrscr::@2 -Simple Condition (bool~) clrscr::$1 [56] if((byte) clrscr::c#2<(byte) $28) goto clrscr::@5 -Simple Condition (bool~) gotoxy::$1 [66] if((byte) gotoxy::y#6<=(byte) $19) goto gotoxy::@1 -Simple Condition (bool~) gotoxy::$3 [69] if((byte) gotoxy::x#6<(byte) $28) goto gotoxy::@2 -Simple Condition (bool~) cputc::$0 [89] if((byte) cputc::c#8==(byte) ' +Simple Condition (bool~) clrscr::$0 [56] if((byte) clrscr::l#2<(byte) $19) goto clrscr::@2 +Simple Condition (bool~) clrscr::$1 [64] if((byte) clrscr::c#2<(byte) $28) goto clrscr::@5 +Simple Condition (bool~) gotoxy::$1 [74] if((byte) gotoxy::y#6<=(byte) $19) goto gotoxy::@1 +Simple Condition (bool~) gotoxy::$3 [77] if((byte) gotoxy::x#6<(byte) $28) goto gotoxy::@2 +Simple Condition (bool~) cputc::$0 [97] if((byte) cputc::c#8==(byte) ' ') goto cputc::@1 -Simple Condition (bool~) cputc::$2 [97] if((byte) conio_cursor_x!=(byte) $28) goto cputc::@return -Simple Condition (bool~) cscroll::$1 [112] if((byte) conio_cursor_y!=(byte) $19) goto cscroll::@return -Simple Condition (bool~) cscroll::$9 [114] if((byte) 0!=(byte) conio_scroll_enable) goto cscroll::@3 -Simple Condition (bool~) cputs::$1 [150] if((byte) 0!=(byte) cputs::c#1) goto cputs::@2 -Simple Condition (bool~) chline::$0 [172] if((byte) chline::i#2<(byte) chline::length#4) goto chline::@2 -Simple Condition (bool~) cvline::$0 [183] if((byte) cvline::i#2<(byte) cvline::length#0) goto cvline::@2 +Simple Condition (bool~) cputc::$2 [105] if((byte) conio_cursor_x!=(byte) $28) goto cputc::@return +Simple Condition (bool~) cscroll::$1 [120] if((byte) conio_cursor_y!=(byte) $19) goto cscroll::@return +Simple Condition (bool~) cscroll::$9 [122] if((byte) 0!=(byte) conio_scroll_enable) goto cscroll::@3 +Simple Condition (bool~) cputs::$1 [158] if((byte) 0!=(byte) cputs::c#1) goto cputs::@2 +Simple Condition (bool~) chline::$0 [180] if((byte) chline::i#2<(byte) chline::length#4) goto chline::@2 +Simple Condition (bool~) cvline::$0 [191] if((byte) cvline::i#2<(byte) cvline::length#0) goto cvline::@2 Simple Condition (bool~) main::$4 [230] if((byte) 0==(byte~) main::$3) goto main::@1 Simple Condition (bool~) MakeNiceScreen::$21 [294] if((byte) MakeNiceScreen::I#3<(byte~) MakeNiceScreen::$20) goto MakeNiceScreen::@2 Successful SSA optimization Pass2ConditionalJumpSimplification -Constant right-side identified [117] (word) memcpy::num#0 ← (unumber)(number) $19*(number) $28-(number) $28 -Constant right-side identified [122] (word) memcpy::num#1 ← (unumber)(number) $19*(number) $28-(number) $28 +Constant right-side identified [125] (word) memcpy::num#0 ← (unumber)(number) $19*(number) $28-(number) $28 +Constant right-side identified [130] (word) memcpy::num#1 ← (unumber)(number) $19*(number) $28-(number) $28 Constant right-side identified [291] (byte~) MakeNiceScreen::$19 ← sizeof (const struct $0*) MakeNiceScreen::Text Successful SSA optimization Pass2ConstantRValueConsolidation Constant (const word) strlen::len#0 = 0 @@ -1716,16 +1716,16 @@ Constant (const byte) MakeNiceScreen::I#1 = 0 Constant (const to_nomodify struct $0*) MakeNiceScreen::T#1 = MakeNiceScreen::Text Constant (const byte) MakeNiceScreen::$19 = sizeof MakeNiceScreen::Text Successful SSA optimization Pass2ConstantIdentification -Rewriting conditional comparison [66] if((byte) gotoxy::y#6<=(byte) $19) goto gotoxy::@1 +Rewriting conditional comparison [74] if((byte) gotoxy::y#6<=(byte) $19) goto gotoxy::@1 Converting *(pointer+n) to pointer[n] [308] (byte) cputsxy::y#0 ← *((byte*~) MakeNiceScreen::$30) -- *(MakeNiceScreen::$37 + OFFSET_STRUCT_$0_Y) Successful SSA optimization Pass2InlineDerefIdx Simplifying expression containing zero MakeNiceScreen::$37 in [304] (byte*~) MakeNiceScreen::$30 ← (byte*~) MakeNiceScreen::$37 + (const byte) OFFSET_STRUCT_$0_Y Simplifying expression containing zero MakeNiceScreen::$37 in [308] (byte) cputsxy::y#0 ← *((byte*~) MakeNiceScreen::$37 + (const byte) OFFSET_STRUCT_$0_Y) Successful SSA optimization PassNSimplifyExpressionWithZero -Eliminating unused variable (void*) memcpy::return#2 and assignment [94] (void*) memcpy::return#2 ← (void*) memcpy::destination#2 -Eliminating unused variable (void*) memcpy::return#3 and assignment [96] (void*) memcpy::return#3 ← (void*) memcpy::destination#2 -Eliminating unused variable (void*) memset::return#2 and assignment [98] (void*) memset::return#2 ← (void*) memset::str#3 -Eliminating unused variable (void*) memset::return#3 and assignment [101] (void*) memset::return#3 ← (void*) memset::str#3 +Eliminating unused variable (void*) memcpy::return#2 and assignment [100] (void*) memcpy::return#2 ← (void*) memcpy::destination#2 +Eliminating unused variable (void*) memcpy::return#3 and assignment [102] (void*) memcpy::return#3 ← (void*) memcpy::destination#2 +Eliminating unused variable (void*) memset::return#2 and assignment [104] (void*) memset::return#2 ← (void*) memset::str#3 +Eliminating unused variable (void*) memset::return#3 and assignment [107] (void*) memset::return#3 ← (void*) memset::str#3 Eliminating unused variable (byte) scroll::return#2 and assignment [187] (byte) scroll::return#2 ← (byte) scroll::return#0 Eliminating unused variable (byte) textcolor::return#2 and assignment [189] (byte) textcolor::return#2 ← (byte) textcolor::return#0 Eliminating unused variable (byte) bordercolor::return#2 and assignment [191] (byte) bordercolor::return#2 ← (byte) bordercolor::return#0 @@ -1738,13 +1738,13 @@ Eliminating unused constant (const byte) MakeNiceScreen::I#0 Eliminating unused constant (const byte) MakeNiceScreen::X#0 Eliminating unused constant (const byte) OFFSET_STRUCT_$0_Y Successful SSA optimization PassNEliminateUnusedVars -Eliminating unused variable (byte) textcolor::return#0 and assignment [149] (byte) textcolor::return#0 ← (byte) conio_textcolor -Eliminating unused variable (byte) bgcolor::return#0 and assignment [152] (byte) bgcolor::return#0 ← *((const nomodify byte*) CONIO_BGCOLOR) -Eliminating unused variable (byte) bordercolor::return#0 and assignment [155] (byte) bordercolor::return#0 ← *((const nomodify byte*) CONIO_BORDERCOLOR) +Eliminating unused variable (byte) bgcolor::return#0 and assignment [29] (byte) bgcolor::return#0 ← *((const nomodify byte*) bgcolor::CONIO_BGCOLOR) +Eliminating unused variable (byte) bordercolor::return#0 and assignment [32] (byte) bordercolor::return#0 ← *((const nomodify byte*) bordercolor::CONIO_BORDERCOLOR) +Eliminating unused variable (byte) textcolor::return#0 and assignment [155] (byte) textcolor::return#0 ← (byte) conio_textcolor Eliminating unused variable (byte) cursor::return#0 and assignment [158] (byte) cursor::return#0 ← (byte) conio_display_cursor Eliminating unused variable (byte) scroll::return#0 and assignment [161] (byte) scroll::return#0 ← (byte) conio_scroll_enable Successful SSA optimization PassNEliminateUnusedVars -Eliminating unused variable (byte) conio_display_cursor and assignment [34] (byte) conio_display_cursor ← (byte) 0 +Eliminating unused variable (byte) conio_display_cursor and assignment [38] (byte) conio_display_cursor ← (byte) 0 Eliminating unused variable conio_display_cursor(null) and assignment [155] conio_display_cursor(null) ← (const byte) cursor::onoff#0 Successful SSA optimization PassNEliminateUnusedVars Eliminating unused constant (const byte) cursor::onoff#0 @@ -1784,7 +1784,7 @@ Inlining Noop Cast [196] (byte*~) MakeNiceScreen::$33 ← (byte*)(to_nomodify st Inlining Noop Cast [204] (byte*~) MakeNiceScreen::$37 ← (byte*)(to_nomodify struct $0*) MakeNiceScreen::T#3 keeping MakeNiceScreen::T#3 Inlining Noop Cast [205] (byte*~) MakeNiceScreen::$38 ← (byte*)(to_nomodify struct $0*) MakeNiceScreen::T#3 keeping MakeNiceScreen::T#3 Successful SSA optimization Pass2NopCastInlining -Rewriting multiplication to use shift and addition[58] (word~) gotoxy::$4 ← (word~) gotoxy::$8 * (byte) $28 +Rewriting multiplication to use shift and addition[62] (word~) gotoxy::$4 ← (word~) gotoxy::$8 * (byte) $28 Inlining constant with var siblings (const void*) memcpy::destination#0 Inlining constant with var siblings (const void*) memcpy::source#0 Inlining constant with var siblings (const word) memcpy::num#0 @@ -2156,8 +2156,8 @@ clrscr::@4: scope:[clrscr] from clrscr::@3 (byte()) kbhit() kbhit: scope:[kbhit] from main::@1 - [40] *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_A) ← (byte) 0 - [41] (byte) kbhit::return#0 ← ~ *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_B) + [40] *((const nomodify byte*) kbhit::CIA1_PORT_A) ← (byte) 0 + [41] (byte) kbhit::return#0 ← ~ *((const nomodify byte*) kbhit::CIA1_PORT_B) to:kbhit::@return kbhit::@return: scope:[kbhit] from kbhit [42] return @@ -2565,7 +2565,7 @@ cursor::@return: scope:[cursor] from cursor (byte()) bgcolor((byte) bgcolor::color) bgcolor: scope:[bgcolor] from MakeNiceScreen::@5 - [230] *((const nomodify byte*) CONIO_BGCOLOR) ← (const nomodify byte) COLOR_BLACK + [230] *((const nomodify byte*) bgcolor::CONIO_BGCOLOR) ← (const nomodify byte) COLOR_BLACK to:bgcolor::@return bgcolor::@return: scope:[bgcolor] from bgcolor [231] return @@ -2573,7 +2573,7 @@ bgcolor::@return: scope:[bgcolor] from bgcolor (byte()) bordercolor((byte) bordercolor::color) bordercolor: scope:[bordercolor] from MakeNiceScreen::@4 - [232] *((const nomodify byte*) CONIO_BORDERCOLOR) ← (const nomodify byte) COLOR_BLACK + [232] *((const nomodify byte*) bordercolor::CONIO_BORDERCOLOR) ← (const nomodify byte) COLOR_BLACK to:bordercolor::@return bordercolor::@return: scope:[bordercolor] from bordercolor [233] return @@ -3035,10 +3035,6 @@ Target platform is c64basic / MOS6502X .label CONIO_SCREEN_TEXT = $400 // The color screen address .label CONIO_SCREEN_COLORS = $d800 - // The background color register address - .label CONIO_BGCOLOR = $d021 - // The border color register address - .label CONIO_BORDERCOLOR = $d020 .label VIC_MEMORY = $d018 .label conio_cursor_x = $29 .label conio_cursor_y = $2a @@ -3269,16 +3265,16 @@ clrscr: { // Return true if there's a key waiting, return false if not kbhit: { // CIA#1 Port A: keyboard matrix columns and joystick #2 - .label CONIO_CIA1_PORT_A = $dc00 + .label CIA1_PORT_A = $dc00 // CIA#1 Port B: keyboard matrix rows and joystick #1. - .label CONIO_CIA1_PORT_B = $dc01 + .label CIA1_PORT_B = $dc01 .label return = $35 .label return_1 = $33 - // [40] *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_A) ← (byte) 0 -- _deref_pbuc1=vbuc2 + // [40] *((const nomodify byte*) kbhit::CIA1_PORT_A) ← (byte) 0 -- _deref_pbuc1=vbuc2 lda #0 - sta CONIO_CIA1_PORT_A - // [41] (byte) kbhit::return#0 ← ~ *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_B) -- vbuz1=_bnot__deref_pbuc1 - lda CONIO_CIA1_PORT_B + sta CIA1_PORT_A + // [41] (byte) kbhit::return#0 ← ~ *((const nomodify byte*) kbhit::CIA1_PORT_B) -- vbuz1=_bnot__deref_pbuc1 + lda CIA1_PORT_B eor #$ff sta.z return jmp __breturn @@ -4493,7 +4489,9 @@ cursor: { // bgcolor // Set the color for the background. The old color setting is returned. bgcolor: { - // [230] *((const nomodify byte*) CONIO_BGCOLOR) ← (const nomodify byte) COLOR_BLACK -- _deref_pbuc1=vbuc2 + // The background color register address + .label CONIO_BGCOLOR = $d021 + // [230] *((const nomodify byte*) bgcolor::CONIO_BGCOLOR) ← (const nomodify byte) COLOR_BLACK -- _deref_pbuc1=vbuc2 lda #COLOR_BLACK sta CONIO_BGCOLOR jmp __breturn @@ -4505,7 +4503,9 @@ bgcolor: { // bordercolor // Set the color for the border. The old color setting is returned. bordercolor: { - // [232] *((const nomodify byte*) CONIO_BORDERCOLOR) ← (const nomodify byte) COLOR_BLACK -- _deref_pbuc1=vbuc2 + // The border color register address + .label CONIO_BORDERCOLOR = $d020 + // [232] *((const nomodify byte*) bordercolor::CONIO_BORDERCOLOR) ← (const nomodify byte) COLOR_BLACK -- _deref_pbuc1=vbuc2 lda #COLOR_BLACK sta CONIO_BORDERCOLOR jmp __breturn @@ -4580,8 +4580,8 @@ Statement [35] (byte*) clrscr::line_cols#1 ← (byte*) clrscr::line_cols#5 + (by Statement [37] *((byte*) clrscr::line_text#5 + (byte) clrscr::c#2) ← (byte) ' ' [ conio_textcolor clrscr::l#2 clrscr::line_text#5 clrscr::line_cols#5 clrscr::c#2 ] ( main:10::clrscr:22 [ conio_textcolor clrscr::l#2 clrscr::line_text#5 clrscr::line_cols#5 clrscr::c#2 ] { } main:10::MakeNiceScreen:15::clrscr:52 [ conio_scroll_enable XSize conio_textcolor clrscr::l#2 clrscr::line_text#5 clrscr::line_cols#5 clrscr::c#2 ] { } ) always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp[1]:7 [ clrscr::c#2 clrscr::c#1 ] Statement [38] *((byte*) clrscr::line_cols#5 + (byte) clrscr::c#2) ← (byte) conio_textcolor [ conio_textcolor clrscr::l#2 clrscr::line_text#5 clrscr::line_cols#5 clrscr::c#2 ] ( main:10::clrscr:22 [ conio_textcolor clrscr::l#2 clrscr::line_text#5 clrscr::line_cols#5 clrscr::c#2 ] { } main:10::MakeNiceScreen:15::clrscr:52 [ conio_scroll_enable XSize conio_textcolor clrscr::l#2 clrscr::line_text#5 clrscr::line_cols#5 clrscr::c#2 ] { } ) always clobbers reg byte a -Statement [40] *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_A) ← (byte) 0 [ ] ( main:10::kbhit:17 [ conio_textcolor ] { { kbhit::return#0 = kbhit::return#2 } } ) always clobbers reg byte a -Statement [41] (byte) kbhit::return#0 ← ~ *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_B) [ kbhit::return#0 ] ( main:10::kbhit:17 [ conio_textcolor kbhit::return#0 ] { { kbhit::return#0 = kbhit::return#2 } } ) always clobbers reg byte a +Statement [40] *((const nomodify byte*) kbhit::CIA1_PORT_A) ← (byte) 0 [ ] ( main:10::kbhit:17 [ conio_textcolor ] { { kbhit::return#0 = kbhit::return#2 } } ) always clobbers reg byte a +Statement [41] (byte) kbhit::return#0 ← ~ *((const nomodify byte*) kbhit::CIA1_PORT_B) [ kbhit::return#0 ] ( main:10::kbhit:17 [ conio_textcolor kbhit::return#0 ] { { kbhit::return#0 = kbhit::return#2 } } ) always clobbers reg byte a Statement [78] (byte*) strlen::str#1 ← (byte*)(to_nomodify struct $0*) MakeNiceScreen::T#3 + (byte) 1 [ conio_textcolor conio_scroll_enable XSize MakeNiceScreen::I#3 MakeNiceScreen::T#3 strlen::str#1 ] ( main:10::MakeNiceScreen:15 [ conio_textcolor conio_scroll_enable XSize MakeNiceScreen::I#3 MakeNiceScreen::T#3 strlen::str#1 ] { { strlen::return#2 = strlen::len#2 } } ) always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp[1]:8 [ MakeNiceScreen::I#3 MakeNiceScreen::I#2 ] Statement [80] (word) strlen::return#2 ← (word) strlen::len#2 [ conio_textcolor conio_scroll_enable XSize MakeNiceScreen::I#3 MakeNiceScreen::T#3 strlen::return#2 ] ( main:10::MakeNiceScreen:15 [ conio_textcolor conio_scroll_enable XSize MakeNiceScreen::I#3 MakeNiceScreen::T#3 strlen::return#2 ] { { strlen::return#2 = strlen::len#2 } } ) always clobbers reg byte a @@ -4647,8 +4647,8 @@ Statement [179] (byte*) conio_cursor_text ← (byte*~) gotoxy::$6 [ conio_cursor Statement [180] (byte*~) gotoxy::$7 ← (const nomodify byte*) CONIO_SCREEN_COLORS + (word) gotoxy::offset#0 [ conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] ( main:10::MakeNiceScreen:15::cputsxy:88::gotoxy:93 [ XSize MakeNiceScreen::I#3 MakeNiceScreen::T#3 conio_textcolor conio_scroll_enable cputsxy::s#0 conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { gotoxy::y#3 = gotoxy::y#6 cputsxy::y#0 } { gotoxy::x#3 = gotoxy::x#6 cputsxy::x#0 MakeNiceScreen::X#1 } } main:10::MakeNiceScreen:15::cputc:60::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { } main:10::MakeNiceScreen:15::cputc:64::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { } main:10::MakeNiceScreen:15::cputc:68::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { } main:10::MakeNiceScreen:15::cputsxy:88::cputs:95::cputc:104::cscroll:115::gotoxy:131 [ XSize MakeNiceScreen::I#3 MakeNiceScreen::T#3 cputs::s#0 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { cputsxy::x#0 = MakeNiceScreen::X#1 } { cputs::s#1 = cputsxy::s#0 } { cputc::c#0 = cputc::c#8 cputs::c#1 } } main:10::MakeNiceScreen:15::MakeTeeLine:72::cputc:195::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { } main:10::MakeNiceScreen:15::MakeTeeLine:74::cputc:195::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { } main:10::MakeNiceScreen:15::chline:58::cputc:202::cscroll:115::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { chline::length#1 = chline::length#4 } } main:10::MakeNiceScreen:15::chline:66::cputc:202::cscroll:115::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { chline::length#2 = chline::length#4 } } main:10::MakeNiceScreen:15::MakeTeeLine:72::chline:193::cputc:202::cscroll:115::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { chline::length#0 = chline::length#4 } } main:10::MakeNiceScreen:15::MakeTeeLine:74::chline:193::cputc:202::cscroll:115::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { chline::length#0 = chline::length#4 } } main:10::MakeNiceScreen:15::cputcxy:56::cputc:208::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { cputc::c#1 = cputc::c#8 cputcxy::c#2 } } main:10::MakeNiceScreen:15::MakeTeeLine:72::cputcxy:191::cputc:208::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { cputcxy::y#0 = cputcxy::y#2 MakeTeeLine::Y#2 } { cputc::c#1 = cputc::c#8 cputcxy::c#2 } } main:10::MakeNiceScreen:15::MakeTeeLine:74::cputcxy:191::cputc:208::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { cputcxy::y#0 = cputcxy::y#2 MakeTeeLine::Y#2 } { cputc::c#1 = cputc::c#8 cputcxy::c#2 } } main:10::MakeNiceScreen:15::cvlinexy:62::cvline:214::cputc:222::cscroll:115::gotoxy:131 [ XSize cvline::x#0 cvline::i#2 cvline::y#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { } main:10::MakeNiceScreen:15::cvlinexy:70::cvline:214::cputc:222::cscroll:115::gotoxy:131 [ XSize cvline::x#0 cvline::i#2 cvline::y#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { cvlinexy::x#1 = cvlinexy::x#2 } } main:10::MakeNiceScreen:15::cputc:60::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { } main:10::MakeNiceScreen:15::cputc:64::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { } main:10::MakeNiceScreen:15::cputc:68::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { } main:10::MakeNiceScreen:15::cputsxy:88::cputs:95::cputc:104::cputln:118::cscroll:126::gotoxy:131 [ XSize MakeNiceScreen::I#3 MakeNiceScreen::T#3 cputs::s#0 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { cputsxy::x#0 = MakeNiceScreen::X#1 } { cputs::s#1 = cputsxy::s#0 } { cputc::c#0 = cputc::c#8 cputs::c#1 } } main:10::MakeNiceScreen:15::MakeTeeLine:72::cputc:195::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { } main:10::MakeNiceScreen:15::MakeTeeLine:74::cputc:195::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { } main:10::MakeNiceScreen:15::chline:58::cputc:202::cputln:118::cscroll:126::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { chline::length#1 = chline::length#4 } } main:10::MakeNiceScreen:15::chline:66::cputc:202::cputln:118::cscroll:126::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { chline::length#2 = chline::length#4 } } main:10::MakeNiceScreen:15::MakeTeeLine:72::chline:193::cputc:202::cputln:118::cscroll:126::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { chline::length#0 = chline::length#4 } } main:10::MakeNiceScreen:15::MakeTeeLine:74::chline:193::cputc:202::cputln:118::cscroll:126::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { chline::length#0 = chline::length#4 } } main:10::MakeNiceScreen:15::cputcxy:56::cputc:208::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { cputc::c#1 = cputc::c#8 cputcxy::c#2 } } main:10::MakeNiceScreen:15::MakeTeeLine:72::cputcxy:191::cputc:208::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { cputcxy::y#0 = cputcxy::y#2 MakeTeeLine::Y#2 } { cputc::c#1 = cputc::c#8 cputcxy::c#2 } } main:10::MakeNiceScreen:15::MakeTeeLine:74::cputcxy:191::cputc:208::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { cputcxy::y#0 = cputcxy::y#2 MakeTeeLine::Y#2 } { cputc::c#1 = cputc::c#8 cputcxy::c#2 } } main:10::MakeNiceScreen:15::cvlinexy:62::cvline:214::cputc:222::cputln:118::cscroll:126::gotoxy:131 [ XSize cvline::x#0 cvline::i#2 cvline::y#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { } main:10::MakeNiceScreen:15::cvlinexy:70::cvline:214::cputc:222::cputln:118::cscroll:126::gotoxy:131 [ XSize cvline::x#0 cvline::i#2 cvline::y#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { cvlinexy::x#1 = cvlinexy::x#2 } } main:10::MakeNiceScreen:15::cputcxy:56::gotoxy:206 [ XSize conio_textcolor conio_scroll_enable cputcxy::c#2 conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { gotoxy::y#2 = gotoxy::y#6 cputcxy::y#2 } } main:10::MakeNiceScreen:15::MakeTeeLine:72::cputcxy:191::gotoxy:206 [ XSize conio_textcolor conio_scroll_enable cputcxy::c#2 conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { gotoxy::y#2 = gotoxy::y#6 cputcxy::y#2 cputcxy::y#0 MakeTeeLine::Y#2 } } main:10::MakeNiceScreen:15::MakeTeeLine:74::cputcxy:191::gotoxy:206 [ XSize conio_textcolor conio_scroll_enable cputcxy::c#2 conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { gotoxy::y#2 = gotoxy::y#6 cputcxy::y#2 cputcxy::y#0 MakeTeeLine::Y#2 } } main:10::MakeNiceScreen:15::cvlinexy:62::gotoxy:212 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { gotoxy::x#5 = gotoxy::x#6 cvlinexy::x#2 } } main:10::MakeNiceScreen:15::cvlinexy:70::gotoxy:212 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { gotoxy::x#5 = gotoxy::x#6 cvlinexy::x#2 cvlinexy::x#1 } } main:10::MakeNiceScreen:15::cvlinexy:62::cvline:214::gotoxy:226 [ XSize conio_textcolor conio_scroll_enable cvline::x#0 cvline::i#2 cvline::y#1 conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { gotoxy::y#4 = gotoxy::y#6 cvline::y#1 } { gotoxy::x#4 = gotoxy::x#6 cvline::x#0 } } main:10::MakeNiceScreen:15::cvlinexy:70::cvline:214::gotoxy:226 [ XSize conio_textcolor conio_scroll_enable cvline::x#0 cvline::i#2 cvline::y#1 conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { cvlinexy::x#1 = cvlinexy::x#2 } { gotoxy::y#4 = gotoxy::y#6 cvline::y#1 } { gotoxy::x#4 = gotoxy::x#6 cvline::x#0 } } ) always clobbers reg byte a Statement [181] (byte*) conio_cursor_color ← (byte*~) gotoxy::$7 [ conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] ( main:10::MakeNiceScreen:15::cputsxy:88::gotoxy:93 [ XSize MakeNiceScreen::I#3 MakeNiceScreen::T#3 conio_textcolor conio_scroll_enable cputsxy::s#0 conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { gotoxy::y#3 = gotoxy::y#6 cputsxy::y#0 } { gotoxy::x#3 = gotoxy::x#6 cputsxy::x#0 MakeNiceScreen::X#1 } } main:10::MakeNiceScreen:15::cputc:60::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { } main:10::MakeNiceScreen:15::cputc:64::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { } main:10::MakeNiceScreen:15::cputc:68::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { } main:10::MakeNiceScreen:15::cputsxy:88::cputs:95::cputc:104::cscroll:115::gotoxy:131 [ XSize MakeNiceScreen::I#3 MakeNiceScreen::T#3 cputs::s#0 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { cputsxy::x#0 = MakeNiceScreen::X#1 } { cputs::s#1 = cputsxy::s#0 } { cputc::c#0 = cputc::c#8 cputs::c#1 } } main:10::MakeNiceScreen:15::MakeTeeLine:72::cputc:195::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { } main:10::MakeNiceScreen:15::MakeTeeLine:74::cputc:195::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { } main:10::MakeNiceScreen:15::chline:58::cputc:202::cscroll:115::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { chline::length#1 = chline::length#4 } } main:10::MakeNiceScreen:15::chline:66::cputc:202::cscroll:115::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { chline::length#2 = chline::length#4 } } main:10::MakeNiceScreen:15::MakeTeeLine:72::chline:193::cputc:202::cscroll:115::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { chline::length#0 = chline::length#4 } } main:10::MakeNiceScreen:15::MakeTeeLine:74::chline:193::cputc:202::cscroll:115::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { chline::length#0 = chline::length#4 } } main:10::MakeNiceScreen:15::cputcxy:56::cputc:208::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { cputc::c#1 = cputc::c#8 cputcxy::c#2 } } main:10::MakeNiceScreen:15::MakeTeeLine:72::cputcxy:191::cputc:208::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { cputcxy::y#0 = cputcxy::y#2 MakeTeeLine::Y#2 } { cputc::c#1 = cputc::c#8 cputcxy::c#2 } } main:10::MakeNiceScreen:15::MakeTeeLine:74::cputcxy:191::cputc:208::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { cputcxy::y#0 = cputcxy::y#2 MakeTeeLine::Y#2 } { cputc::c#1 = cputc::c#8 cputcxy::c#2 } } main:10::MakeNiceScreen:15::cvlinexy:62::cvline:214::cputc:222::cscroll:115::gotoxy:131 [ XSize cvline::x#0 cvline::i#2 cvline::y#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { } main:10::MakeNiceScreen:15::cvlinexy:70::cvline:214::cputc:222::cscroll:115::gotoxy:131 [ XSize cvline::x#0 cvline::i#2 cvline::y#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { cvlinexy::x#1 = cvlinexy::x#2 } } main:10::MakeNiceScreen:15::cputc:60::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { } main:10::MakeNiceScreen:15::cputc:64::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { } main:10::MakeNiceScreen:15::cputc:68::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { } main:10::MakeNiceScreen:15::cputsxy:88::cputs:95::cputc:104::cputln:118::cscroll:126::gotoxy:131 [ XSize MakeNiceScreen::I#3 MakeNiceScreen::T#3 cputs::s#0 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { cputsxy::x#0 = MakeNiceScreen::X#1 } { cputs::s#1 = cputsxy::s#0 } { cputc::c#0 = cputc::c#8 cputs::c#1 } } main:10::MakeNiceScreen:15::MakeTeeLine:72::cputc:195::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { } main:10::MakeNiceScreen:15::MakeTeeLine:74::cputc:195::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { } main:10::MakeNiceScreen:15::chline:58::cputc:202::cputln:118::cscroll:126::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { chline::length#1 = chline::length#4 } } main:10::MakeNiceScreen:15::chline:66::cputc:202::cputln:118::cscroll:126::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { chline::length#2 = chline::length#4 } } main:10::MakeNiceScreen:15::MakeTeeLine:72::chline:193::cputc:202::cputln:118::cscroll:126::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { chline::length#0 = chline::length#4 } } main:10::MakeNiceScreen:15::MakeTeeLine:74::chline:193::cputc:202::cputln:118::cscroll:126::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { chline::length#0 = chline::length#4 } } main:10::MakeNiceScreen:15::cputcxy:56::cputc:208::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { cputc::c#1 = cputc::c#8 cputcxy::c#2 } } main:10::MakeNiceScreen:15::MakeTeeLine:72::cputcxy:191::cputc:208::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { cputcxy::y#0 = cputcxy::y#2 MakeTeeLine::Y#2 } { cputc::c#1 = cputc::c#8 cputcxy::c#2 } } main:10::MakeNiceScreen:15::MakeTeeLine:74::cputcxy:191::cputc:208::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { cputcxy::y#0 = cputcxy::y#2 MakeTeeLine::Y#2 } { cputc::c#1 = cputc::c#8 cputcxy::c#2 } } main:10::MakeNiceScreen:15::cvlinexy:62::cvline:214::cputc:222::cputln:118::cscroll:126::gotoxy:131 [ XSize cvline::x#0 cvline::i#2 cvline::y#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { } main:10::MakeNiceScreen:15::cvlinexy:70::cvline:214::cputc:222::cputln:118::cscroll:126::gotoxy:131 [ XSize cvline::x#0 cvline::i#2 cvline::y#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { cvlinexy::x#1 = cvlinexy::x#2 } } main:10::MakeNiceScreen:15::cputcxy:56::gotoxy:206 [ XSize conio_textcolor conio_scroll_enable cputcxy::c#2 conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { gotoxy::y#2 = gotoxy::y#6 cputcxy::y#2 } } main:10::MakeNiceScreen:15::MakeTeeLine:72::cputcxy:191::gotoxy:206 [ XSize conio_textcolor conio_scroll_enable cputcxy::c#2 conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { gotoxy::y#2 = gotoxy::y#6 cputcxy::y#2 cputcxy::y#0 MakeTeeLine::Y#2 } } main:10::MakeNiceScreen:15::MakeTeeLine:74::cputcxy:191::gotoxy:206 [ XSize conio_textcolor conio_scroll_enable cputcxy::c#2 conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { gotoxy::y#2 = gotoxy::y#6 cputcxy::y#2 cputcxy::y#0 MakeTeeLine::Y#2 } } main:10::MakeNiceScreen:15::cvlinexy:62::gotoxy:212 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { gotoxy::x#5 = gotoxy::x#6 cvlinexy::x#2 } } main:10::MakeNiceScreen:15::cvlinexy:70::gotoxy:212 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { gotoxy::x#5 = gotoxy::x#6 cvlinexy::x#2 cvlinexy::x#1 } } main:10::MakeNiceScreen:15::cvlinexy:62::cvline:214::gotoxy:226 [ XSize conio_textcolor conio_scroll_enable cvline::x#0 cvline::i#2 cvline::y#1 conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { gotoxy::y#4 = gotoxy::y#6 cvline::y#1 } { gotoxy::x#4 = gotoxy::x#6 cvline::x#0 } } main:10::MakeNiceScreen:15::cvlinexy:70::cvline:214::gotoxy:226 [ XSize conio_textcolor conio_scroll_enable cvline::x#0 cvline::i#2 cvline::y#1 conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { cvlinexy::x#1 = cvlinexy::x#2 } { gotoxy::y#4 = gotoxy::y#6 cvline::y#1 } { gotoxy::x#4 = gotoxy::x#6 cvline::x#0 } } ) always clobbers reg byte a Statement [185] if((byte) 0!=*((byte*) strlen::str#2)) goto strlen::@2 [ strlen::len#2 strlen::str#2 ] ( main:10::MakeNiceScreen:15::strlen:79 [ conio_textcolor conio_scroll_enable XSize MakeNiceScreen::I#3 MakeNiceScreen::T#3 strlen::len#2 strlen::str#2 ] { { strlen::return#2 = strlen::len#2 } } ) always clobbers reg byte a reg byte y -Statement [230] *((const nomodify byte*) CONIO_BGCOLOR) ← (const nomodify byte) COLOR_BLACK [ ] ( main:10::MakeNiceScreen:15::bgcolor:50 [ conio_textcolor conio_scroll_enable XSize ] { } ) always clobbers reg byte a -Statement [232] *((const nomodify byte*) CONIO_BORDERCOLOR) ← (const nomodify byte) COLOR_BLACK [ ] ( main:10::MakeNiceScreen:15::bordercolor:48 [ conio_textcolor conio_scroll_enable XSize ] { } ) always clobbers reg byte a +Statement [230] *((const nomodify byte*) bgcolor::CONIO_BGCOLOR) ← (const nomodify byte) COLOR_BLACK [ ] ( main:10::MakeNiceScreen:15::bgcolor:50 [ conio_textcolor conio_scroll_enable XSize ] { } ) always clobbers reg byte a +Statement [232] *((const nomodify byte*) bordercolor::CONIO_BORDERCOLOR) ← (const nomodify byte) COLOR_BLACK [ ] ( main:10::MakeNiceScreen:15::bordercolor:48 [ conio_textcolor conio_scroll_enable XSize ] { } ) always clobbers reg byte a Statement [234] (byte) conio_textcolor ← (const nomodify byte) COLOR_GRAY3 [ conio_textcolor ] ( main:10::MakeNiceScreen:15::textcolor:46 [ conio_scroll_enable XSize conio_textcolor ] { } ) always clobbers reg byte a Statement [236] (byte) conio_scroll_enable ← (const byte) scroll::onoff#0 [ conio_scroll_enable ] ( main:10::MakeNiceScreen:15::scroll:44 [ XSize conio_scroll_enable ] { } ) always clobbers reg byte a Statement [238] *((const byte*) screensize::x#0) ← (byte) $28 [ ] ( main:10::screensize:13 [ XSize ] { } ) always clobbers reg byte a @@ -4670,8 +4670,8 @@ Statement [34] (byte*) clrscr::line_text#1 ← (byte*) clrscr::line_text#5 + (by Statement [35] (byte*) clrscr::line_cols#1 ← (byte*) clrscr::line_cols#5 + (byte) $28 [ conio_textcolor clrscr::l#2 clrscr::line_text#1 clrscr::line_cols#1 ] ( main:10::clrscr:22 [ conio_textcolor clrscr::l#2 clrscr::line_text#1 clrscr::line_cols#1 ] { } main:10::MakeNiceScreen:15::clrscr:52 [ conio_scroll_enable XSize conio_textcolor clrscr::l#2 clrscr::line_text#1 clrscr::line_cols#1 ] { } ) always clobbers reg byte a Statement [37] *((byte*) clrscr::line_text#5 + (byte) clrscr::c#2) ← (byte) ' ' [ conio_textcolor clrscr::l#2 clrscr::line_text#5 clrscr::line_cols#5 clrscr::c#2 ] ( main:10::clrscr:22 [ conio_textcolor clrscr::l#2 clrscr::line_text#5 clrscr::line_cols#5 clrscr::c#2 ] { } main:10::MakeNiceScreen:15::clrscr:52 [ conio_scroll_enable XSize conio_textcolor clrscr::l#2 clrscr::line_text#5 clrscr::line_cols#5 clrscr::c#2 ] { } ) always clobbers reg byte a Statement [38] *((byte*) clrscr::line_cols#5 + (byte) clrscr::c#2) ← (byte) conio_textcolor [ conio_textcolor clrscr::l#2 clrscr::line_text#5 clrscr::line_cols#5 clrscr::c#2 ] ( main:10::clrscr:22 [ conio_textcolor clrscr::l#2 clrscr::line_text#5 clrscr::line_cols#5 clrscr::c#2 ] { } main:10::MakeNiceScreen:15::clrscr:52 [ conio_scroll_enable XSize conio_textcolor clrscr::l#2 clrscr::line_text#5 clrscr::line_cols#5 clrscr::c#2 ] { } ) always clobbers reg byte a -Statement [40] *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_A) ← (byte) 0 [ ] ( main:10::kbhit:17 [ conio_textcolor ] { { kbhit::return#0 = kbhit::return#2 } } ) always clobbers reg byte a -Statement [41] (byte) kbhit::return#0 ← ~ *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_B) [ kbhit::return#0 ] ( main:10::kbhit:17 [ conio_textcolor kbhit::return#0 ] { { kbhit::return#0 = kbhit::return#2 } } ) always clobbers reg byte a +Statement [40] *((const nomodify byte*) kbhit::CIA1_PORT_A) ← (byte) 0 [ ] ( main:10::kbhit:17 [ conio_textcolor ] { { kbhit::return#0 = kbhit::return#2 } } ) always clobbers reg byte a +Statement [41] (byte) kbhit::return#0 ← ~ *((const nomodify byte*) kbhit::CIA1_PORT_B) [ kbhit::return#0 ] ( main:10::kbhit:17 [ conio_textcolor kbhit::return#0 ] { { kbhit::return#0 = kbhit::return#2 } } ) always clobbers reg byte a Statement [78] (byte*) strlen::str#1 ← (byte*)(to_nomodify struct $0*) MakeNiceScreen::T#3 + (byte) 1 [ conio_textcolor conio_scroll_enable XSize MakeNiceScreen::I#3 MakeNiceScreen::T#3 strlen::str#1 ] ( main:10::MakeNiceScreen:15 [ conio_textcolor conio_scroll_enable XSize MakeNiceScreen::I#3 MakeNiceScreen::T#3 strlen::str#1 ] { { strlen::return#2 = strlen::len#2 } } ) always clobbers reg byte a Statement [80] (word) strlen::return#2 ← (word) strlen::len#2 [ conio_textcolor conio_scroll_enable XSize MakeNiceScreen::I#3 MakeNiceScreen::T#3 strlen::return#2 ] ( main:10::MakeNiceScreen:15 [ conio_textcolor conio_scroll_enable XSize MakeNiceScreen::I#3 MakeNiceScreen::T#3 strlen::return#2 ] { { strlen::return#2 = strlen::len#2 } } ) always clobbers reg byte a Statement [81] (word~) MakeNiceScreen::$22 ← (word) strlen::return#2 [ conio_textcolor conio_scroll_enable XSize MakeNiceScreen::I#3 MakeNiceScreen::T#3 MakeNiceScreen::$22 ] ( main:10::MakeNiceScreen:15 [ conio_textcolor conio_scroll_enable XSize MakeNiceScreen::I#3 MakeNiceScreen::T#3 MakeNiceScreen::$22 ] { { cputsxy::x#0 = MakeNiceScreen::X#1 } } ) always clobbers reg byte a @@ -4718,8 +4718,8 @@ Statement [179] (byte*) conio_cursor_text ← (byte*~) gotoxy::$6 [ conio_cursor Statement [180] (byte*~) gotoxy::$7 ← (const nomodify byte*) CONIO_SCREEN_COLORS + (word) gotoxy::offset#0 [ conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] ( main:10::MakeNiceScreen:15::cputsxy:88::gotoxy:93 [ XSize MakeNiceScreen::I#3 MakeNiceScreen::T#3 conio_textcolor conio_scroll_enable cputsxy::s#0 conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { gotoxy::y#3 = gotoxy::y#6 cputsxy::y#0 } { gotoxy::x#3 = gotoxy::x#6 cputsxy::x#0 MakeNiceScreen::X#1 } } main:10::MakeNiceScreen:15::cputc:60::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { } main:10::MakeNiceScreen:15::cputc:64::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { } main:10::MakeNiceScreen:15::cputc:68::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { } main:10::MakeNiceScreen:15::cputsxy:88::cputs:95::cputc:104::cscroll:115::gotoxy:131 [ XSize MakeNiceScreen::I#3 MakeNiceScreen::T#3 cputs::s#0 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { cputsxy::x#0 = MakeNiceScreen::X#1 } { cputs::s#1 = cputsxy::s#0 } { cputc::c#0 = cputc::c#8 cputs::c#1 } } main:10::MakeNiceScreen:15::MakeTeeLine:72::cputc:195::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { } main:10::MakeNiceScreen:15::MakeTeeLine:74::cputc:195::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { } main:10::MakeNiceScreen:15::chline:58::cputc:202::cscroll:115::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { chline::length#1 = chline::length#4 } } main:10::MakeNiceScreen:15::chline:66::cputc:202::cscroll:115::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { chline::length#2 = chline::length#4 } } main:10::MakeNiceScreen:15::MakeTeeLine:72::chline:193::cputc:202::cscroll:115::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { chline::length#0 = chline::length#4 } } main:10::MakeNiceScreen:15::MakeTeeLine:74::chline:193::cputc:202::cscroll:115::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { chline::length#0 = chline::length#4 } } main:10::MakeNiceScreen:15::cputcxy:56::cputc:208::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { cputc::c#1 = cputc::c#8 cputcxy::c#2 } } main:10::MakeNiceScreen:15::MakeTeeLine:72::cputcxy:191::cputc:208::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { cputcxy::y#0 = cputcxy::y#2 MakeTeeLine::Y#2 } { cputc::c#1 = cputc::c#8 cputcxy::c#2 } } main:10::MakeNiceScreen:15::MakeTeeLine:74::cputcxy:191::cputc:208::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { cputcxy::y#0 = cputcxy::y#2 MakeTeeLine::Y#2 } { cputc::c#1 = cputc::c#8 cputcxy::c#2 } } main:10::MakeNiceScreen:15::cvlinexy:62::cvline:214::cputc:222::cscroll:115::gotoxy:131 [ XSize cvline::x#0 cvline::i#2 cvline::y#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { } main:10::MakeNiceScreen:15::cvlinexy:70::cvline:214::cputc:222::cscroll:115::gotoxy:131 [ XSize cvline::x#0 cvline::i#2 cvline::y#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { cvlinexy::x#1 = cvlinexy::x#2 } } main:10::MakeNiceScreen:15::cputc:60::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { } main:10::MakeNiceScreen:15::cputc:64::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { } main:10::MakeNiceScreen:15::cputc:68::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { } main:10::MakeNiceScreen:15::cputsxy:88::cputs:95::cputc:104::cputln:118::cscroll:126::gotoxy:131 [ XSize MakeNiceScreen::I#3 MakeNiceScreen::T#3 cputs::s#0 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { cputsxy::x#0 = MakeNiceScreen::X#1 } { cputs::s#1 = cputsxy::s#0 } { cputc::c#0 = cputc::c#8 cputs::c#1 } } main:10::MakeNiceScreen:15::MakeTeeLine:72::cputc:195::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { } main:10::MakeNiceScreen:15::MakeTeeLine:74::cputc:195::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { } main:10::MakeNiceScreen:15::chline:58::cputc:202::cputln:118::cscroll:126::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { chline::length#1 = chline::length#4 } } main:10::MakeNiceScreen:15::chline:66::cputc:202::cputln:118::cscroll:126::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { chline::length#2 = chline::length#4 } } main:10::MakeNiceScreen:15::MakeTeeLine:72::chline:193::cputc:202::cputln:118::cscroll:126::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { chline::length#0 = chline::length#4 } } main:10::MakeNiceScreen:15::MakeTeeLine:74::chline:193::cputc:202::cputln:118::cscroll:126::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { chline::length#0 = chline::length#4 } } main:10::MakeNiceScreen:15::cputcxy:56::cputc:208::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { cputc::c#1 = cputc::c#8 cputcxy::c#2 } } main:10::MakeNiceScreen:15::MakeTeeLine:72::cputcxy:191::cputc:208::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { cputcxy::y#0 = cputcxy::y#2 MakeTeeLine::Y#2 } { cputc::c#1 = cputc::c#8 cputcxy::c#2 } } main:10::MakeNiceScreen:15::MakeTeeLine:74::cputcxy:191::cputc:208::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { cputcxy::y#0 = cputcxy::y#2 MakeTeeLine::Y#2 } { cputc::c#1 = cputc::c#8 cputcxy::c#2 } } main:10::MakeNiceScreen:15::cvlinexy:62::cvline:214::cputc:222::cputln:118::cscroll:126::gotoxy:131 [ XSize cvline::x#0 cvline::i#2 cvline::y#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { } main:10::MakeNiceScreen:15::cvlinexy:70::cvline:214::cputc:222::cputln:118::cscroll:126::gotoxy:131 [ XSize cvline::x#0 cvline::i#2 cvline::y#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { cvlinexy::x#1 = cvlinexy::x#2 } } main:10::MakeNiceScreen:15::cputcxy:56::gotoxy:206 [ XSize conio_textcolor conio_scroll_enable cputcxy::c#2 conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { gotoxy::y#2 = gotoxy::y#6 cputcxy::y#2 } } main:10::MakeNiceScreen:15::MakeTeeLine:72::cputcxy:191::gotoxy:206 [ XSize conio_textcolor conio_scroll_enable cputcxy::c#2 conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { gotoxy::y#2 = gotoxy::y#6 cputcxy::y#2 cputcxy::y#0 MakeTeeLine::Y#2 } } main:10::MakeNiceScreen:15::MakeTeeLine:74::cputcxy:191::gotoxy:206 [ XSize conio_textcolor conio_scroll_enable cputcxy::c#2 conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { gotoxy::y#2 = gotoxy::y#6 cputcxy::y#2 cputcxy::y#0 MakeTeeLine::Y#2 } } main:10::MakeNiceScreen:15::cvlinexy:62::gotoxy:212 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { gotoxy::x#5 = gotoxy::x#6 cvlinexy::x#2 } } main:10::MakeNiceScreen:15::cvlinexy:70::gotoxy:212 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { gotoxy::x#5 = gotoxy::x#6 cvlinexy::x#2 cvlinexy::x#1 } } main:10::MakeNiceScreen:15::cvlinexy:62::cvline:214::gotoxy:226 [ XSize conio_textcolor conio_scroll_enable cvline::x#0 cvline::i#2 cvline::y#1 conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { gotoxy::y#4 = gotoxy::y#6 cvline::y#1 } { gotoxy::x#4 = gotoxy::x#6 cvline::x#0 } } main:10::MakeNiceScreen:15::cvlinexy:70::cvline:214::gotoxy:226 [ XSize conio_textcolor conio_scroll_enable cvline::x#0 cvline::i#2 cvline::y#1 conio_cursor_x conio_cursor_y conio_cursor_text gotoxy::$7 ] { { cvlinexy::x#1 = cvlinexy::x#2 } { gotoxy::y#4 = gotoxy::y#6 cvline::y#1 } { gotoxy::x#4 = gotoxy::x#6 cvline::x#0 } } ) always clobbers reg byte a Statement [181] (byte*) conio_cursor_color ← (byte*~) gotoxy::$7 [ conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] ( main:10::MakeNiceScreen:15::cputsxy:88::gotoxy:93 [ XSize MakeNiceScreen::I#3 MakeNiceScreen::T#3 conio_textcolor conio_scroll_enable cputsxy::s#0 conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { gotoxy::y#3 = gotoxy::y#6 cputsxy::y#0 } { gotoxy::x#3 = gotoxy::x#6 cputsxy::x#0 MakeNiceScreen::X#1 } } main:10::MakeNiceScreen:15::cputc:60::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { } main:10::MakeNiceScreen:15::cputc:64::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { } main:10::MakeNiceScreen:15::cputc:68::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { } main:10::MakeNiceScreen:15::cputsxy:88::cputs:95::cputc:104::cscroll:115::gotoxy:131 [ XSize MakeNiceScreen::I#3 MakeNiceScreen::T#3 cputs::s#0 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { cputsxy::x#0 = MakeNiceScreen::X#1 } { cputs::s#1 = cputsxy::s#0 } { cputc::c#0 = cputc::c#8 cputs::c#1 } } main:10::MakeNiceScreen:15::MakeTeeLine:72::cputc:195::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { } main:10::MakeNiceScreen:15::MakeTeeLine:74::cputc:195::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { } main:10::MakeNiceScreen:15::chline:58::cputc:202::cscroll:115::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { chline::length#1 = chline::length#4 } } main:10::MakeNiceScreen:15::chline:66::cputc:202::cscroll:115::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { chline::length#2 = chline::length#4 } } main:10::MakeNiceScreen:15::MakeTeeLine:72::chline:193::cputc:202::cscroll:115::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { chline::length#0 = chline::length#4 } } main:10::MakeNiceScreen:15::MakeTeeLine:74::chline:193::cputc:202::cscroll:115::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { chline::length#0 = chline::length#4 } } main:10::MakeNiceScreen:15::cputcxy:56::cputc:208::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { cputc::c#1 = cputc::c#8 cputcxy::c#2 } } main:10::MakeNiceScreen:15::MakeTeeLine:72::cputcxy:191::cputc:208::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { cputcxy::y#0 = cputcxy::y#2 MakeTeeLine::Y#2 } { cputc::c#1 = cputc::c#8 cputcxy::c#2 } } main:10::MakeNiceScreen:15::MakeTeeLine:74::cputcxy:191::cputc:208::cscroll:115::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { cputcxy::y#0 = cputcxy::y#2 MakeTeeLine::Y#2 } { cputc::c#1 = cputc::c#8 cputcxy::c#2 } } main:10::MakeNiceScreen:15::cvlinexy:62::cvline:214::cputc:222::cscroll:115::gotoxy:131 [ XSize cvline::x#0 cvline::i#2 cvline::y#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { } main:10::MakeNiceScreen:15::cvlinexy:70::cvline:214::cputc:222::cscroll:115::gotoxy:131 [ XSize cvline::x#0 cvline::i#2 cvline::y#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { cvlinexy::x#1 = cvlinexy::x#2 } } main:10::MakeNiceScreen:15::cputc:60::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { } main:10::MakeNiceScreen:15::cputc:64::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { } main:10::MakeNiceScreen:15::cputc:68::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { } main:10::MakeNiceScreen:15::cputsxy:88::cputs:95::cputc:104::cputln:118::cscroll:126::gotoxy:131 [ XSize MakeNiceScreen::I#3 MakeNiceScreen::T#3 cputs::s#0 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { cputsxy::x#0 = MakeNiceScreen::X#1 } { cputs::s#1 = cputsxy::s#0 } { cputc::c#0 = cputc::c#8 cputs::c#1 } } main:10::MakeNiceScreen:15::MakeTeeLine:72::cputc:195::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { } main:10::MakeNiceScreen:15::MakeTeeLine:74::cputc:195::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { } main:10::MakeNiceScreen:15::chline:58::cputc:202::cputln:118::cscroll:126::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { chline::length#1 = chline::length#4 } } main:10::MakeNiceScreen:15::chline:66::cputc:202::cputln:118::cscroll:126::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { chline::length#2 = chline::length#4 } } main:10::MakeNiceScreen:15::MakeTeeLine:72::chline:193::cputc:202::cputln:118::cscroll:126::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { chline::length#0 = chline::length#4 } } main:10::MakeNiceScreen:15::MakeTeeLine:74::chline:193::cputc:202::cputln:118::cscroll:126::gotoxy:131 [ XSize chline::length#4 chline::i#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { chline::length#0 = chline::length#4 } } main:10::MakeNiceScreen:15::cputcxy:56::cputc:208::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { cputc::c#1 = cputc::c#8 cputcxy::c#2 } } main:10::MakeNiceScreen:15::MakeTeeLine:72::cputcxy:191::cputc:208::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { cputcxy::y#0 = cputcxy::y#2 MakeTeeLine::Y#2 } { cputc::c#1 = cputc::c#8 cputcxy::c#2 } } main:10::MakeNiceScreen:15::MakeTeeLine:74::cputcxy:191::cputc:208::cputln:118::cscroll:126::gotoxy:131 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { cputcxy::y#0 = cputcxy::y#2 MakeTeeLine::Y#2 } { cputc::c#1 = cputc::c#8 cputcxy::c#2 } } main:10::MakeNiceScreen:15::cvlinexy:62::cvline:214::cputc:222::cputln:118::cscroll:126::gotoxy:131 [ XSize cvline::x#0 cvline::i#2 cvline::y#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { } main:10::MakeNiceScreen:15::cvlinexy:70::cvline:214::cputc:222::cputln:118::cscroll:126::gotoxy:131 [ XSize cvline::x#0 cvline::i#2 cvline::y#2 conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { cvlinexy::x#1 = cvlinexy::x#2 } } main:10::MakeNiceScreen:15::cputcxy:56::gotoxy:206 [ XSize conio_textcolor conio_scroll_enable cputcxy::c#2 conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { gotoxy::y#2 = gotoxy::y#6 cputcxy::y#2 } } main:10::MakeNiceScreen:15::MakeTeeLine:72::cputcxy:191::gotoxy:206 [ XSize conio_textcolor conio_scroll_enable cputcxy::c#2 conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { gotoxy::y#2 = gotoxy::y#6 cputcxy::y#2 cputcxy::y#0 MakeTeeLine::Y#2 } } main:10::MakeNiceScreen:15::MakeTeeLine:74::cputcxy:191::gotoxy:206 [ XSize conio_textcolor conio_scroll_enable cputcxy::c#2 conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { gotoxy::y#2 = gotoxy::y#6 cputcxy::y#2 cputcxy::y#0 MakeTeeLine::Y#2 } } main:10::MakeNiceScreen:15::cvlinexy:62::gotoxy:212 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { gotoxy::x#5 = gotoxy::x#6 cvlinexy::x#2 } } main:10::MakeNiceScreen:15::cvlinexy:70::gotoxy:212 [ XSize conio_textcolor conio_scroll_enable conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { gotoxy::x#5 = gotoxy::x#6 cvlinexy::x#2 cvlinexy::x#1 } } main:10::MakeNiceScreen:15::cvlinexy:62::cvline:214::gotoxy:226 [ XSize conio_textcolor conio_scroll_enable cvline::x#0 cvline::i#2 cvline::y#1 conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { gotoxy::y#4 = gotoxy::y#6 cvline::y#1 } { gotoxy::x#4 = gotoxy::x#6 cvline::x#0 } } main:10::MakeNiceScreen:15::cvlinexy:70::cvline:214::gotoxy:226 [ XSize conio_textcolor conio_scroll_enable cvline::x#0 cvline::i#2 cvline::y#1 conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color ] { { cvlinexy::x#1 = cvlinexy::x#2 } { gotoxy::y#4 = gotoxy::y#6 cvline::y#1 } { gotoxy::x#4 = gotoxy::x#6 cvline::x#0 } } ) always clobbers reg byte a Statement [185] if((byte) 0!=*((byte*) strlen::str#2)) goto strlen::@2 [ strlen::len#2 strlen::str#2 ] ( main:10::MakeNiceScreen:15::strlen:79 [ conio_textcolor conio_scroll_enable XSize MakeNiceScreen::I#3 MakeNiceScreen::T#3 strlen::len#2 strlen::str#2 ] { { strlen::return#2 = strlen::len#2 } } ) always clobbers reg byte a reg byte y -Statement [230] *((const nomodify byte*) CONIO_BGCOLOR) ← (const nomodify byte) COLOR_BLACK [ ] ( main:10::MakeNiceScreen:15::bgcolor:50 [ conio_textcolor conio_scroll_enable XSize ] { } ) always clobbers reg byte a -Statement [232] *((const nomodify byte*) CONIO_BORDERCOLOR) ← (const nomodify byte) COLOR_BLACK [ ] ( main:10::MakeNiceScreen:15::bordercolor:48 [ conio_textcolor conio_scroll_enable XSize ] { } ) always clobbers reg byte a +Statement [230] *((const nomodify byte*) bgcolor::CONIO_BGCOLOR) ← (const nomodify byte) COLOR_BLACK [ ] ( main:10::MakeNiceScreen:15::bgcolor:50 [ conio_textcolor conio_scroll_enable XSize ] { } ) always clobbers reg byte a +Statement [232] *((const nomodify byte*) bordercolor::CONIO_BORDERCOLOR) ← (const nomodify byte) COLOR_BLACK [ ] ( main:10::MakeNiceScreen:15::bordercolor:48 [ conio_textcolor conio_scroll_enable XSize ] { } ) always clobbers reg byte a Statement [234] (byte) conio_textcolor ← (const nomodify byte) COLOR_GRAY3 [ conio_textcolor ] ( main:10::MakeNiceScreen:15::textcolor:46 [ conio_scroll_enable XSize conio_textcolor ] { } ) always clobbers reg byte a Statement [236] (byte) conio_scroll_enable ← (const byte) scroll::onoff#0 [ conio_scroll_enable ] ( main:10::MakeNiceScreen:15::scroll:44 [ XSize conio_scroll_enable ] { } ) always clobbers reg byte a Statement [238] *((const byte*) screensize::x#0) ← (byte) $28 [ ] ( main:10::screensize:13 [ XSize ] { } ) always clobbers reg byte a @@ -4807,10 +4807,10 @@ Uplift Scope [cvlinexy] 1,304: zp[1]:38 [ cvlinexy::x#2 cvlinexy::x#1 ] Uplift Scope [MakeTeeLine] 1,001: zp[1]:33 [ MakeTeeLine::Y#2 ] Uplift Scope [kbhit] 367.33: zp[1]:53 [ kbhit::return#0 ] 202: zp[1]:51 [ kbhit::return#2 ] Uplift Scope [main] 202: zp[1]:52 [ main::$3 ] -Uplift Scope [screensize] -Uplift Scope [textcolor] Uplift Scope [bgcolor] Uplift Scope [bordercolor] +Uplift Scope [screensize] +Uplift Scope [textcolor] Uplift Scope [cursor] Uplift Scope [scroll] Uplift Scope [$0] @@ -4834,10 +4834,10 @@ Uplifting [cvlinexy] best 131797 combination reg byte x [ cvlinexy::x#2 cvlinexy Uplifting [MakeTeeLine] best 131788 combination reg byte a [ MakeTeeLine::Y#2 ] Uplifting [kbhit] best 131695 combination reg byte a [ kbhit::return#0 ] reg byte a [ kbhit::return#2 ] Uplifting [main] best 131635 combination reg byte a [ main::$3 ] -Uplifting [screensize] best 131635 combination -Uplifting [textcolor] best 131635 combination Uplifting [bgcolor] best 131635 combination Uplifting [bordercolor] best 131635 combination +Uplifting [screensize] best 131635 combination +Uplifting [textcolor] best 131635 combination Uplifting [cursor] best 131635 combination Uplifting [scroll] best 131635 combination Uplifting [$0] best 131635 combination @@ -4946,10 +4946,6 @@ ASSEMBLER BEFORE OPTIMIZATION .label CONIO_SCREEN_TEXT = $400 // The color screen address .label CONIO_SCREEN_COLORS = $d800 - // The background color register address - .label CONIO_BGCOLOR = $d021 - // The border color register address - .label CONIO_BORDERCOLOR = $d020 .label VIC_MEMORY = $d018 .label conio_cursor_x = 9 .label conio_cursor_y = $a @@ -5166,14 +5162,14 @@ clrscr: { // Return true if there's a key waiting, return false if not kbhit: { // CIA#1 Port A: keyboard matrix columns and joystick #2 - .label CONIO_CIA1_PORT_A = $dc00 + .label CIA1_PORT_A = $dc00 // CIA#1 Port B: keyboard matrix rows and joystick #1. - .label CONIO_CIA1_PORT_B = $dc01 - // [40] *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_A) ← (byte) 0 -- _deref_pbuc1=vbuc2 + .label CIA1_PORT_B = $dc01 + // [40] *((const nomodify byte*) kbhit::CIA1_PORT_A) ← (byte) 0 -- _deref_pbuc1=vbuc2 lda #0 - sta CONIO_CIA1_PORT_A - // [41] (byte) kbhit::return#0 ← ~ *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_B) -- vbuaa=_bnot__deref_pbuc1 - lda CONIO_CIA1_PORT_B + sta CIA1_PORT_A + // [41] (byte) kbhit::return#0 ← ~ *((const nomodify byte*) kbhit::CIA1_PORT_B) -- vbuaa=_bnot__deref_pbuc1 + lda CIA1_PORT_B eor #$ff jmp __breturn // kbhit::@return @@ -6270,7 +6266,9 @@ cursor: { // bgcolor // Set the color for the background. The old color setting is returned. bgcolor: { - // [230] *((const nomodify byte*) CONIO_BGCOLOR) ← (const nomodify byte) COLOR_BLACK -- _deref_pbuc1=vbuc2 + // The background color register address + .label CONIO_BGCOLOR = $d021 + // [230] *((const nomodify byte*) bgcolor::CONIO_BGCOLOR) ← (const nomodify byte) COLOR_BLACK -- _deref_pbuc1=vbuc2 lda #COLOR_BLACK sta CONIO_BGCOLOR jmp __breturn @@ -6282,7 +6280,9 @@ bgcolor: { // bordercolor // Set the color for the border. The old color setting is returned. bordercolor: { - // [232] *((const nomodify byte*) CONIO_BORDERCOLOR) ← (const nomodify byte) COLOR_BLACK -- _deref_pbuc1=vbuc2 + // The border color register address + .label CONIO_BORDERCOLOR = $d020 + // [232] *((const nomodify byte*) bordercolor::CONIO_BORDERCOLOR) ← (const nomodify byte) COLOR_BLACK -- _deref_pbuc1=vbuc2 lda #COLOR_BLACK sta CONIO_BORDERCOLOR jmp __breturn @@ -6622,8 +6622,6 @@ FINAL SYMBOL TABLE (const nomodify byte) CH_VLINE = (byte) $5d (const nomodify byte) COLOR_BLACK = (byte) 0 (const nomodify byte) COLOR_GRAY3 = (byte) $f -(const nomodify byte*) CONIO_BGCOLOR = (byte*) 53281 -(const nomodify byte*) CONIO_BORDERCOLOR = (byte*) 53280 (const nomodify byte*) CONIO_SCREEN_COLORS = (byte*) 55296 (const nomodify byte*) CONIO_SCREEN_TEXT = (byte*) 1024 (const nomodify byte) CONIO_TEXTCOLOR_DEFAULT = (byte) $e @@ -6671,11 +6669,13 @@ FINAL SYMBOL TABLE (volatile byte) YSize loadstore zp[1]:18 20.0 (byte()) bgcolor((byte) bgcolor::color) (label) bgcolor::@return +(const nomodify byte*) bgcolor::CONIO_BGCOLOR = (byte*) 53281 (byte) bgcolor::color (byte) bgcolor::old (byte) bgcolor::return (byte()) bordercolor((byte) bordercolor::color) (label) bordercolor::@return +(const nomodify byte*) bordercolor::CONIO_BORDERCOLOR = (byte*) 53280 (byte) bordercolor::color (byte) bordercolor::old (byte) bordercolor::return @@ -6829,8 +6829,8 @@ FINAL SYMBOL TABLE (byte) gotoxy::y#7 reg byte a 3.3333333333666668E10 (byte()) kbhit() (label) kbhit::@return -(const nomodify byte*) kbhit::CONIO_CIA1_PORT_A = (byte*) 56320 -(const nomodify byte*) kbhit::CONIO_CIA1_PORT_B = (byte*) 56321 +(const nomodify byte*) kbhit::CIA1_PORT_A = (byte*) 56320 +(const nomodify byte*) kbhit::CIA1_PORT_B = (byte*) 56321 (byte) kbhit::return (byte) kbhit::return#0 reg byte a 367.33333333333337 (byte) kbhit::return#2 reg byte a 202.0 @@ -6987,10 +6987,6 @@ Score: 114584 .label CONIO_SCREEN_TEXT = $400 // The color screen address .label CONIO_SCREEN_COLORS = $d800 - // The background color register address - .label CONIO_BGCOLOR = $d021 - // The border color register address - .label CONIO_BORDERCOLOR = $d020 .label VIC_MEMORY = $d018 .label conio_cursor_x = 9 .label conio_cursor_y = $a @@ -7197,16 +7193,16 @@ clrscr: { // Return true if there's a key waiting, return false if not kbhit: { // CIA#1 Port A: keyboard matrix columns and joystick #2 - .label CONIO_CIA1_PORT_A = $dc00 + .label CIA1_PORT_A = $dc00 // CIA#1 Port B: keyboard matrix rows and joystick #1. - .label CONIO_CIA1_PORT_B = $dc01 - // *CONIO_CIA1_PORT_A = 0 - // [40] *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_A) ← (byte) 0 -- _deref_pbuc1=vbuc2 + .label CIA1_PORT_B = $dc01 + // *CIA1_PORT_A = 0 + // [40] *((const nomodify byte*) kbhit::CIA1_PORT_A) ← (byte) 0 -- _deref_pbuc1=vbuc2 lda #0 - sta CONIO_CIA1_PORT_A - // ~*CONIO_CIA1_PORT_B - // [41] (byte) kbhit::return#0 ← ~ *((const nomodify byte*) kbhit::CONIO_CIA1_PORT_B) -- vbuaa=_bnot__deref_pbuc1 - lda CONIO_CIA1_PORT_B + sta CIA1_PORT_A + // ~*CIA1_PORT_B + // [41] (byte) kbhit::return#0 ← ~ *((const nomodify byte*) kbhit::CIA1_PORT_B) -- vbuaa=_bnot__deref_pbuc1 + lda CIA1_PORT_B eor #$ff // kbhit::@return // } @@ -8225,8 +8221,10 @@ cursor: { // bgcolor // Set the color for the background. The old color setting is returned. bgcolor: { + // The background color register address + .label CONIO_BGCOLOR = $d021 // *CONIO_BGCOLOR = color - // [230] *((const nomodify byte*) CONIO_BGCOLOR) ← (const nomodify byte) COLOR_BLACK -- _deref_pbuc1=vbuc2 + // [230] *((const nomodify byte*) bgcolor::CONIO_BGCOLOR) ← (const nomodify byte) COLOR_BLACK -- _deref_pbuc1=vbuc2 lda #COLOR_BLACK sta CONIO_BGCOLOR // bgcolor::@return @@ -8237,8 +8235,10 @@ bgcolor: { // bordercolor // Set the color for the border. The old color setting is returned. bordercolor: { + // The border color register address + .label CONIO_BORDERCOLOR = $d020 // *CONIO_BORDERCOLOR = color - // [232] *((const nomodify byte*) CONIO_BORDERCOLOR) ← (const nomodify byte) COLOR_BLACK -- _deref_pbuc1=vbuc2 + // [232] *((const nomodify byte*) bordercolor::CONIO_BORDERCOLOR) ← (const nomodify byte) COLOR_BLACK -- _deref_pbuc1=vbuc2 lda #COLOR_BLACK sta CONIO_BORDERCOLOR // bordercolor::@return diff --git a/src/test/ref/examples/conio/nacht-screen.sym b/src/test/ref/examples/conio/nacht-screen.sym index 808e9a931..ccce8a6ce 100644 --- a/src/test/ref/examples/conio/nacht-screen.sym +++ b/src/test/ref/examples/conio/nacht-screen.sym @@ -15,8 +15,6 @@ (const nomodify byte) CH_VLINE = (byte) $5d (const nomodify byte) COLOR_BLACK = (byte) 0 (const nomodify byte) COLOR_GRAY3 = (byte) $f -(const nomodify byte*) CONIO_BGCOLOR = (byte*) 53281 -(const nomodify byte*) CONIO_BORDERCOLOR = (byte*) 53280 (const nomodify byte*) CONIO_SCREEN_COLORS = (byte*) 55296 (const nomodify byte*) CONIO_SCREEN_TEXT = (byte*) 1024 (const nomodify byte) CONIO_TEXTCOLOR_DEFAULT = (byte) $e @@ -64,11 +62,13 @@ (volatile byte) YSize loadstore zp[1]:18 20.0 (byte()) bgcolor((byte) bgcolor::color) (label) bgcolor::@return +(const nomodify byte*) bgcolor::CONIO_BGCOLOR = (byte*) 53281 (byte) bgcolor::color (byte) bgcolor::old (byte) bgcolor::return (byte()) bordercolor((byte) bordercolor::color) (label) bordercolor::@return +(const nomodify byte*) bordercolor::CONIO_BORDERCOLOR = (byte*) 53280 (byte) bordercolor::color (byte) bordercolor::old (byte) bordercolor::return @@ -222,8 +222,8 @@ (byte) gotoxy::y#7 reg byte a 3.3333333333666668E10 (byte()) kbhit() (label) kbhit::@return -(const nomodify byte*) kbhit::CONIO_CIA1_PORT_A = (byte*) 56320 -(const nomodify byte*) kbhit::CONIO_CIA1_PORT_B = (byte*) 56321 +(const nomodify byte*) kbhit::CIA1_PORT_A = (byte*) 56320 +(const nomodify byte*) kbhit::CIA1_PORT_B = (byte*) 56321 (byte) kbhit::return (byte) kbhit::return#0 reg byte a 367.33333333333337 (byte) kbhit::return#2 reg byte a 202.0 diff --git a/src/test/ref/vic20-simple.asm b/src/test/ref/vic20-simple.asm new file mode 100644 index 000000000..728797d05 --- /dev/null +++ b/src/test/ref/vic20-simple.asm @@ -0,0 +1,40 @@ +// Trivial VIC 20 program + .file [name="vic20-simple.prg", type="prg", segments="Program"] +.segmentdef Program [segments="Basic, Code, Data"] +.segmentdef Basic [start=$1001] +.segmentdef Code [start=$100e] +.segmentdef Data [startAfter="Code"] +.segment Basic +:BasicUpstart(main) +.segment Code + + + .const RED = 2 + // Default address of screen color matrix + .label DEFAULT_COLORRAM = $9600 + // Default address of screen character matrix + .label DEFAULT_SCREEN = $1e00 +.segment Code +main: { + ldx #0 + __b1: + // for(char i=0; MESSAGE[i]; i++) + lda MESSAGE,x + cmp #0 + bne __b2 + // } + rts + __b2: + // DEFAULT_SCREEN[i] = MESSAGE[i] + lda MESSAGE,x + sta DEFAULT_SCREEN,x + // DEFAULT_COLORRAM[i] = RED + lda #RED + sta DEFAULT_COLORRAM,x + // for(char i=0; MESSAGE[i]; i++) + inx + jmp __b1 +} +.segment Data + MESSAGE: .text "hello world!" + .byte 0 diff --git a/src/test/ref/vic20-simple.cfg b/src/test/ref/vic20-simple.cfg new file mode 100644 index 000000000..d5b00d484 --- /dev/null +++ b/src/test/ref/vic20-simple.cfg @@ -0,0 +1,26 @@ +@begin: scope:[] from + [0] phi() + to:@1 +@1: scope:[] from @begin + [1] phi() + [2] call main + to:@end +@end: scope:[] from @1 + [3] phi() + +(void()) main() +main: scope:[main] from @1 + [4] phi() + to:main::@1 +main::@1: scope:[main] from main main::@2 + [5] (byte) main::i#2 ← phi( main/(byte) 0 main::@2/(byte) main::i#1 ) + [6] if((byte) 0!=*((const byte*) MESSAGE + (byte) main::i#2)) goto main::@2 + to:main::@return +main::@return: scope:[main] from main::@1 + [7] return + to:@return +main::@2: scope:[main] from main::@1 + [8] *((const nomodify byte*) DEFAULT_SCREEN + (byte) main::i#2) ← *((const byte*) MESSAGE + (byte) main::i#2) + [9] *((const nomodify byte*) DEFAULT_COLORRAM + (byte) main::i#2) ← (const nomodify byte) RED + [10] (byte) main::i#1 ← ++ (byte) main::i#2 + to:main::@1 diff --git a/src/test/ref/vic20-simple.log b/src/test/ref/vic20-simple.log new file mode 100644 index 000000000..351daa58b --- /dev/null +++ b/src/test/ref/vic20-simple.log @@ -0,0 +1,505 @@ + +CONTROL FLOW GRAPH SSA +@begin: scope:[] from + to:@1 + +(void()) main() +main: scope:[main] from @1 + (byte) main::i#0 ← (byte) 0 + to:main::@1 +main::@1: scope:[main] from main main::@2 + (byte) main::i#2 ← phi( main/(byte) main::i#0 main::@2/(byte) main::i#1 ) + (bool~) main::$0 ← (number) 0 != *((const byte*) MESSAGE + (byte) main::i#2) + if((bool~) main::$0) goto main::@2 + to:main::@return +main::@2: scope:[main] from main::@1 + (byte) main::i#3 ← phi( main::@1/(byte) main::i#2 ) + *((const nomodify byte*) DEFAULT_SCREEN + (byte) main::i#3) ← *((const byte*) MESSAGE + (byte) main::i#3) + *((const nomodify byte*) DEFAULT_COLORRAM + (byte) main::i#3) ← (const nomodify byte) RED + (byte) main::i#1 ← ++ (byte) main::i#3 + to:main::@1 +main::@return: scope:[main] from main::@1 + return + to:@return +@1: scope:[] from @begin + call main + to:@2 +@2: scope:[] from @1 + to:@end +@end: scope:[] from @2 + +SYMBOL TABLE SSA +(label) @1 +(label) @2 +(label) @begin +(label) @end +(const nomodify byte*) DEFAULT_COLORRAM = (byte*)(number) $9600 +(const nomodify byte*) DEFAULT_SCREEN = (byte*)(number) $1e00 +(const byte*) MESSAGE[] = (byte*) "hello world!" +(byte) MOS6522_VIA::AUX_CONTROL +(byte) MOS6522_VIA::INTERRUPT_ENABLE +(byte) MOS6522_VIA::INTERRUPT_FLAG +(byte) MOS6522_VIA::PERIPHERAL_CONTROL +(byte) MOS6522_VIA::PORT_A +(byte) MOS6522_VIA::PORT_A_DDR +(byte) MOS6522_VIA::PORT_A_OUTPUT +(byte) MOS6522_VIA::PORT_B +(byte) MOS6522_VIA::PORT_B_DDR +(byte) MOS6522_VIA::SHIFT +(byte) MOS6522_VIA::TIMER1_HIGH +(byte) MOS6522_VIA::TIMER1_LATCH_HIGH +(byte) MOS6522_VIA::TIMER1_LATCH_LOW +(byte) MOS6522_VIA::TIMER1_LOW +(byte) MOS6522_VIA::TIMER2_HIGH +(byte) MOS6522_VIA::TIMER2_LOW +(byte) MOS6561_VIC::BORDER_BACKGROUND_COLOR +(byte) MOS6561_VIC::CH1_FREQ +(byte) MOS6561_VIC::CH2_FREQ +(byte) MOS6561_VIC::CH3_FREQ +(byte) MOS6561_VIC::CH4_FREQ +(byte) MOS6561_VIC::LIGHTPEN_X +(byte) MOS6561_VIC::LIGHTPEN_Y +(byte) MOS6561_VIC::MATRIX_COLUMNS +(byte) MOS6561_VIC::MATRIX_ROWS +(byte) MOS6561_VIC::MEMORY +(byte) MOS6561_VIC::ORIGIN_X +(byte) MOS6561_VIC::ORIGIN_Y +(byte) MOS6561_VIC::PADDLE_X +(byte) MOS6561_VIC::PADDLE_Y +(byte) MOS6561_VIC::RASTER +(byte) MOS6561_VIC::VOLUME_COLOR +(const nomodify byte) RED = (byte) 2 +(void()) main() +(bool~) main::$0 +(label) main::@1 +(label) main::@2 +(label) main::@return +(byte) main::i +(byte) main::i#0 +(byte) main::i#1 +(byte) main::i#2 +(byte) main::i#3 + +Adding number conversion cast (unumber) 0 in (bool~) main::$0 ← (number) 0 != *((const byte*) MESSAGE + (byte) main::i#2) +Successful SSA optimization PassNAddNumberTypeConversions +Simplifying constant pointer cast (byte*) 38400 +Simplifying constant pointer cast (byte*) 7680 +Simplifying constant integer cast 0 +Successful SSA optimization PassNCastSimplification +Finalized unsigned number type (byte) 0 +Successful SSA optimization PassNFinalizeNumberTypeConversions +Alias main::i#2 = main::i#3 +Successful SSA optimization Pass2AliasElimination +Simple Condition (bool~) main::$0 [3] if((byte) 0!=*((const byte*) MESSAGE + (byte) main::i#2)) goto main::@2 +Successful SSA optimization Pass2ConditionalJumpSimplification +Constant (const byte) main::i#0 = 0 +Successful SSA optimization Pass2ConstantIdentification +Inlining constant with var siblings (const byte) main::i#0 +Constant inlined main::i#0 = (byte) 0 +Successful SSA optimization Pass2ConstantInlining +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @1 +Adding NOP phi() at start of @2 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main +CALL GRAPH +Calls in [] to main:2 + +Created 1 initial phi equivalence classes +Coalesced [12] main::i#4 ← main::i#1 +Coalesced down to 1 phi equivalence classes +Culled Empty Block (label) @2 +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @1 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main + +FINAL CONTROL FLOW GRAPH +@begin: scope:[] from + [0] phi() + to:@1 +@1: scope:[] from @begin + [1] phi() + [2] call main + to:@end +@end: scope:[] from @1 + [3] phi() + +(void()) main() +main: scope:[main] from @1 + [4] phi() + to:main::@1 +main::@1: scope:[main] from main main::@2 + [5] (byte) main::i#2 ← phi( main/(byte) 0 main::@2/(byte) main::i#1 ) + [6] if((byte) 0!=*((const byte*) MESSAGE + (byte) main::i#2)) goto main::@2 + to:main::@return +main::@return: scope:[main] from main::@1 + [7] return + to:@return +main::@2: scope:[main] from main::@1 + [8] *((const nomodify byte*) DEFAULT_SCREEN + (byte) main::i#2) ← *((const byte*) MESSAGE + (byte) main::i#2) + [9] *((const nomodify byte*) DEFAULT_COLORRAM + (byte) main::i#2) ← (const nomodify byte) RED + [10] (byte) main::i#1 ← ++ (byte) main::i#2 + to:main::@1 + + +VARIABLE REGISTER WEIGHTS +(byte) MOS6522_VIA::AUX_CONTROL +(byte) MOS6522_VIA::INTERRUPT_ENABLE +(byte) MOS6522_VIA::INTERRUPT_FLAG +(byte) MOS6522_VIA::PERIPHERAL_CONTROL +(byte) MOS6522_VIA::PORT_A +(byte) MOS6522_VIA::PORT_A_DDR +(byte) MOS6522_VIA::PORT_A_OUTPUT +(byte) MOS6522_VIA::PORT_B +(byte) MOS6522_VIA::PORT_B_DDR +(byte) MOS6522_VIA::SHIFT +(byte) MOS6522_VIA::TIMER1_HIGH +(byte) MOS6522_VIA::TIMER1_LATCH_HIGH +(byte) MOS6522_VIA::TIMER1_LATCH_LOW +(byte) MOS6522_VIA::TIMER1_LOW +(byte) MOS6522_VIA::TIMER2_HIGH +(byte) MOS6522_VIA::TIMER2_LOW +(byte) MOS6561_VIC::BORDER_BACKGROUND_COLOR +(byte) MOS6561_VIC::CH1_FREQ +(byte) MOS6561_VIC::CH2_FREQ +(byte) MOS6561_VIC::CH3_FREQ +(byte) MOS6561_VIC::CH4_FREQ +(byte) MOS6561_VIC::LIGHTPEN_X +(byte) MOS6561_VIC::LIGHTPEN_Y +(byte) MOS6561_VIC::MATRIX_COLUMNS +(byte) MOS6561_VIC::MATRIX_ROWS +(byte) MOS6561_VIC::MEMORY +(byte) MOS6561_VIC::ORIGIN_X +(byte) MOS6561_VIC::ORIGIN_Y +(byte) MOS6561_VIC::PADDLE_X +(byte) MOS6561_VIC::PADDLE_Y +(byte) MOS6561_VIC::RASTER +(byte) MOS6561_VIC::VOLUME_COLOR +(void()) main() +(byte) main::i +(byte) main::i#1 202.0 +(byte) main::i#2 151.5 + +Initial phi equivalence classes +[ main::i#2 main::i#1 ] +Complete equivalence classes +[ main::i#2 main::i#1 ] +Allocated zp[1]:2 [ main::i#2 main::i#1 ] + +INITIAL ASM +Target platform is vic20 / MOS6502X + // File Comments +// Trivial VIC 20 program + // Upstart + .file [name="vic20-simple.prg", type="prg", segments="Program"] +.segmentdef Program [segments="Basic, Code, Data"] +.segmentdef Basic [start=$1001] +.segmentdef Code [start=$100e] +.segmentdef Data [startAfter="Code"] +.segment Basic +:BasicUpstart(main) +.segment Code + + + // Global Constants & labels + .const RED = 2 + // Default address of screen color matrix + .label DEFAULT_COLORRAM = $9600 + // Default address of screen character matrix + .label DEFAULT_SCREEN = $1e00 + // @begin +__bbegin: + // [1] phi from @begin to @1 [phi:@begin->@1] +__b1_from___bbegin: + jmp __b1 + // @1 +__b1: + // [2] call main + // [4] phi from @1 to main [phi:@1->main] +main_from___b1: + jsr main + // [3] phi from @1 to @end [phi:@1->@end] +__bend_from___b1: + jmp __bend + // @end +__bend: +.segment Code + // main +main: { + .label i = 2 + // [5] phi from main to main::@1 [phi:main->main::@1] + __b1_from_main: + // [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 + lda #0 + sta.z i + jmp __b1 + // main::@1 + __b1: + // [6] if((byte) 0!=*((const byte*) MESSAGE + (byte) main::i#2)) goto main::@2 -- vbuc1_neq_pbuc2_derefidx_vbuz1_then_la1 + lda #0 + ldy.z i + cmp MESSAGE,y + bne __b2 + jmp __breturn + // main::@return + __breturn: + // [7] return + rts + // main::@2 + __b2: + // [8] *((const nomodify byte*) DEFAULT_SCREEN + (byte) main::i#2) ← *((const byte*) MESSAGE + (byte) main::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz1 + ldy.z i + lda MESSAGE,y + sta DEFAULT_SCREEN,y + // [9] *((const nomodify byte*) DEFAULT_COLORRAM + (byte) main::i#2) ← (const nomodify byte) RED -- pbuc1_derefidx_vbuz1=vbuc2 + lda #RED + ldy.z i + sta DEFAULT_COLORRAM,y + // [10] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1 + inc.z i + // [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1] + __b1_from___b2: + // [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#0] -- register_copy + jmp __b1 +} + // File Data +.segment Data + MESSAGE: .text "hello world!" + .byte 0 + +REGISTER UPLIFT POTENTIAL REGISTERS +Statement [6] if((byte) 0!=*((const byte*) MESSAGE + (byte) main::i#2)) goto main::@2 [ main::i#2 ] ( main:2 [ main::i#2 ] { } ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:2 [ main::i#2 main::i#1 ] +Statement [8] *((const nomodify byte*) DEFAULT_SCREEN + (byte) main::i#2) ← *((const byte*) MESSAGE + (byte) main::i#2) [ main::i#2 ] ( main:2 [ main::i#2 ] { } ) always clobbers reg byte a +Statement [9] *((const nomodify byte*) DEFAULT_COLORRAM + (byte) main::i#2) ← (const nomodify byte) RED [ main::i#2 ] ( main:2 [ main::i#2 ] { } ) always clobbers reg byte a +Statement [6] if((byte) 0!=*((const byte*) MESSAGE + (byte) main::i#2)) goto main::@2 [ main::i#2 ] ( main:2 [ main::i#2 ] { } ) always clobbers reg byte a +Statement [8] *((const nomodify byte*) DEFAULT_SCREEN + (byte) main::i#2) ← *((const byte*) MESSAGE + (byte) main::i#2) [ main::i#2 ] ( main:2 [ main::i#2 ] { } ) always clobbers reg byte a +Statement [9] *((const nomodify byte*) DEFAULT_COLORRAM + (byte) main::i#2) ← (const nomodify byte) RED [ main::i#2 ] ( main:2 [ main::i#2 ] { } ) always clobbers reg byte a +Potential registers zp[1]:2 [ main::i#2 main::i#1 ] : zp[1]:2 , reg byte x , reg byte y , + +REGISTER UPLIFT SCOPES +Uplift Scope [main] 353.5: zp[1]:2 [ main::i#2 main::i#1 ] +Uplift Scope [MOS6561_VIC] +Uplift Scope [MOS6522_VIA] +Uplift Scope [] + +Uplifting [main] best 403 combination reg byte x [ main::i#2 main::i#1 ] +Uplifting [MOS6561_VIC] best 403 combination +Uplifting [MOS6522_VIA] best 403 combination +Uplifting [] best 403 combination + +ASSEMBLER BEFORE OPTIMIZATION + // File Comments +// Trivial VIC 20 program + // Upstart + .file [name="vic20-simple.prg", type="prg", segments="Program"] +.segmentdef Program [segments="Basic, Code, Data"] +.segmentdef Basic [start=$1001] +.segmentdef Code [start=$100e] +.segmentdef Data [startAfter="Code"] +.segment Basic +:BasicUpstart(main) +.segment Code + + + // Global Constants & labels + .const RED = 2 + // Default address of screen color matrix + .label DEFAULT_COLORRAM = $9600 + // Default address of screen character matrix + .label DEFAULT_SCREEN = $1e00 + // @begin +__bbegin: + // [1] phi from @begin to @1 [phi:@begin->@1] +__b1_from___bbegin: + jmp __b1 + // @1 +__b1: + // [2] call main + // [4] phi from @1 to main [phi:@1->main] +main_from___b1: + jsr main + // [3] phi from @1 to @end [phi:@1->@end] +__bend_from___b1: + jmp __bend + // @end +__bend: +.segment Code + // main +main: { + // [5] phi from main to main::@1 [phi:main->main::@1] + __b1_from_main: + // [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1 + ldx #0 + jmp __b1 + // main::@1 + __b1: + // [6] if((byte) 0!=*((const byte*) MESSAGE + (byte) main::i#2)) goto main::@2 -- vbuc1_neq_pbuc2_derefidx_vbuxx_then_la1 + lda MESSAGE,x + cmp #0 + bne __b2 + jmp __breturn + // main::@return + __breturn: + // [7] return + rts + // main::@2 + __b2: + // [8] *((const nomodify byte*) DEFAULT_SCREEN + (byte) main::i#2) ← *((const byte*) MESSAGE + (byte) main::i#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx + lda MESSAGE,x + sta DEFAULT_SCREEN,x + // [9] *((const nomodify byte*) DEFAULT_COLORRAM + (byte) main::i#2) ← (const nomodify byte) RED -- pbuc1_derefidx_vbuxx=vbuc2 + lda #RED + sta DEFAULT_COLORRAM,x + // [10] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx + inx + // [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1] + __b1_from___b2: + // [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#0] -- register_copy + jmp __b1 +} + // File Data +.segment Data + MESSAGE: .text "hello world!" + .byte 0 + +ASSEMBLER OPTIMIZATIONS +Removing instruction jmp __b1 +Removing instruction jmp __bend +Removing instruction jmp __b1 +Removing instruction jmp __breturn +Succesful ASM optimization Pass5NextJumpElimination +Removing instruction __b1_from___bbegin: +Removing instruction __b1: +Removing instruction main_from___b1: +Removing instruction __bend_from___b1: +Succesful ASM optimization Pass5RedundantLabelElimination +Removing instruction __bbegin: +Removing instruction __bend: +Removing instruction __b1_from_main: +Removing instruction __breturn: +Removing instruction __b1_from___b2: +Succesful ASM optimization Pass5UnusedLabelElimination +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin + +FINAL SYMBOL TABLE +(label) @1 +(label) @begin +(label) @end +(const nomodify byte*) DEFAULT_COLORRAM = (byte*) 38400 +(const nomodify byte*) DEFAULT_SCREEN = (byte*) 7680 +(const byte*) MESSAGE[] = (byte*) "hello world!" +(byte) MOS6522_VIA::AUX_CONTROL +(byte) MOS6522_VIA::INTERRUPT_ENABLE +(byte) MOS6522_VIA::INTERRUPT_FLAG +(byte) MOS6522_VIA::PERIPHERAL_CONTROL +(byte) MOS6522_VIA::PORT_A +(byte) MOS6522_VIA::PORT_A_DDR +(byte) MOS6522_VIA::PORT_A_OUTPUT +(byte) MOS6522_VIA::PORT_B +(byte) MOS6522_VIA::PORT_B_DDR +(byte) MOS6522_VIA::SHIFT +(byte) MOS6522_VIA::TIMER1_HIGH +(byte) MOS6522_VIA::TIMER1_LATCH_HIGH +(byte) MOS6522_VIA::TIMER1_LATCH_LOW +(byte) MOS6522_VIA::TIMER1_LOW +(byte) MOS6522_VIA::TIMER2_HIGH +(byte) MOS6522_VIA::TIMER2_LOW +(byte) MOS6561_VIC::BORDER_BACKGROUND_COLOR +(byte) MOS6561_VIC::CH1_FREQ +(byte) MOS6561_VIC::CH2_FREQ +(byte) MOS6561_VIC::CH3_FREQ +(byte) MOS6561_VIC::CH4_FREQ +(byte) MOS6561_VIC::LIGHTPEN_X +(byte) MOS6561_VIC::LIGHTPEN_Y +(byte) MOS6561_VIC::MATRIX_COLUMNS +(byte) MOS6561_VIC::MATRIX_ROWS +(byte) MOS6561_VIC::MEMORY +(byte) MOS6561_VIC::ORIGIN_X +(byte) MOS6561_VIC::ORIGIN_Y +(byte) MOS6561_VIC::PADDLE_X +(byte) MOS6561_VIC::PADDLE_Y +(byte) MOS6561_VIC::RASTER +(byte) MOS6561_VIC::VOLUME_COLOR +(const nomodify byte) RED = (byte) 2 +(void()) main() +(label) main::@1 +(label) main::@2 +(label) main::@return +(byte) main::i +(byte) main::i#1 reg byte x 202.0 +(byte) main::i#2 reg byte x 151.5 + +reg byte x [ main::i#2 main::i#1 ] + + +FINAL ASSEMBLER +Score: 331 + + // File Comments +// Trivial VIC 20 program + // Upstart + .file [name="vic20-simple.prg", type="prg", segments="Program"] +.segmentdef Program [segments="Basic, Code, Data"] +.segmentdef Basic [start=$1001] +.segmentdef Code [start=$100e] +.segmentdef Data [startAfter="Code"] +.segment Basic +:BasicUpstart(main) +.segment Code + + + // Global Constants & labels + .const RED = 2 + // Default address of screen color matrix + .label DEFAULT_COLORRAM = $9600 + // Default address of screen character matrix + .label DEFAULT_SCREEN = $1e00 + // @begin + // [1] phi from @begin to @1 [phi:@begin->@1] + // @1 + // [2] call main + // [4] phi from @1 to main [phi:@1->main] + // [3] phi from @1 to @end [phi:@1->@end] + // @end +.segment Code + // main +main: { + // [5] phi from main to main::@1 [phi:main->main::@1] + // [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1 + ldx #0 + // main::@1 + __b1: + // for(char i=0; MESSAGE[i]; i++) + // [6] if((byte) 0!=*((const byte*) MESSAGE + (byte) main::i#2)) goto main::@2 -- vbuc1_neq_pbuc2_derefidx_vbuxx_then_la1 + lda MESSAGE,x + cmp #0 + bne __b2 + // main::@return + // } + // [7] return + rts + // main::@2 + __b2: + // DEFAULT_SCREEN[i] = MESSAGE[i] + // [8] *((const nomodify byte*) DEFAULT_SCREEN + (byte) main::i#2) ← *((const byte*) MESSAGE + (byte) main::i#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx + lda MESSAGE,x + sta DEFAULT_SCREEN,x + // DEFAULT_COLORRAM[i] = RED + // [9] *((const nomodify byte*) DEFAULT_COLORRAM + (byte) main::i#2) ← (const nomodify byte) RED -- pbuc1_derefidx_vbuxx=vbuc2 + lda #RED + sta DEFAULT_COLORRAM,x + // for(char i=0; MESSAGE[i]; i++) + // [10] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx + inx + // [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1] + // [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#0] -- register_copy + jmp __b1 +} + // File Data +.segment Data + MESSAGE: .text "hello world!" + .byte 0 + diff --git a/src/test/ref/vic20-simple.sym b/src/test/ref/vic20-simple.sym new file mode 100644 index 000000000..678e35bc3 --- /dev/null +++ b/src/test/ref/vic20-simple.sym @@ -0,0 +1,48 @@ +(label) @1 +(label) @begin +(label) @end +(const nomodify byte*) DEFAULT_COLORRAM = (byte*) 38400 +(const nomodify byte*) DEFAULT_SCREEN = (byte*) 7680 +(const byte*) MESSAGE[] = (byte*) "hello world!" +(byte) MOS6522_VIA::AUX_CONTROL +(byte) MOS6522_VIA::INTERRUPT_ENABLE +(byte) MOS6522_VIA::INTERRUPT_FLAG +(byte) MOS6522_VIA::PERIPHERAL_CONTROL +(byte) MOS6522_VIA::PORT_A +(byte) MOS6522_VIA::PORT_A_DDR +(byte) MOS6522_VIA::PORT_A_OUTPUT +(byte) MOS6522_VIA::PORT_B +(byte) MOS6522_VIA::PORT_B_DDR +(byte) MOS6522_VIA::SHIFT +(byte) MOS6522_VIA::TIMER1_HIGH +(byte) MOS6522_VIA::TIMER1_LATCH_HIGH +(byte) MOS6522_VIA::TIMER1_LATCH_LOW +(byte) MOS6522_VIA::TIMER1_LOW +(byte) MOS6522_VIA::TIMER2_HIGH +(byte) MOS6522_VIA::TIMER2_LOW +(byte) MOS6561_VIC::BORDER_BACKGROUND_COLOR +(byte) MOS6561_VIC::CH1_FREQ +(byte) MOS6561_VIC::CH2_FREQ +(byte) MOS6561_VIC::CH3_FREQ +(byte) MOS6561_VIC::CH4_FREQ +(byte) MOS6561_VIC::LIGHTPEN_X +(byte) MOS6561_VIC::LIGHTPEN_Y +(byte) MOS6561_VIC::MATRIX_COLUMNS +(byte) MOS6561_VIC::MATRIX_ROWS +(byte) MOS6561_VIC::MEMORY +(byte) MOS6561_VIC::ORIGIN_X +(byte) MOS6561_VIC::ORIGIN_Y +(byte) MOS6561_VIC::PADDLE_X +(byte) MOS6561_VIC::PADDLE_Y +(byte) MOS6561_VIC::RASTER +(byte) MOS6561_VIC::VOLUME_COLOR +(const nomodify byte) RED = (byte) 2 +(void()) main() +(label) main::@1 +(label) main::@2 +(label) main::@return +(byte) main::i +(byte) main::i#1 reg byte x 202.0 +(byte) main::i#2 reg byte x 151.5 + +reg byte x [ main::i#2 main::i#1 ]