diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/pbuz1_derefidx_vbuc1=vbuc2.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/pbuz1_derefidx_vbuc1=vbuc2.asm new file mode 100644 index 000000000..5744d488c --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/pbuz1_derefidx_vbuc1=vbuc2.asm @@ -0,0 +1,3 @@ +lda #{c2} +ldy #{c1} +sta ({z1}),y \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/vbuaa=vbuaa_ror_3.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/vbuaa=vbuaa_ror_3.asm new file mode 100644 index 000000000..e36100473 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/vbuaa=vbuaa_ror_3.asm @@ -0,0 +1,3 @@ +lsr +lsr +lsr \ No newline at end of file diff --git a/src/test/java/dk/camelot64/kickc/test/kc/c64.kc b/src/test/java/dk/camelot64/kickc/test/kc/c64.kc index 13d2d7679..efc0648d0 100644 --- a/src/test/java/dk/camelot64/kickc/test/kc/c64.kc +++ b/src/test/java/dk/camelot64/kickc/test/kc/c64.kc @@ -21,6 +21,14 @@ const byte* SPRITES_COLS = $d027; const byte* COLS = $d800; +// CIA#1 Port A: keyboard matrix columns and joystick #2 +const byte* CIA1_PORT_A = $dc00; +// CIA#1 Port B: keyboard matrix rows and joystick #1. +const byte* CIA1_PORT_B = $dc01; +// CIA #1 Port A data direction register. +const byte* CIA1_PORT_A_DDR = $dc02; +// CIA #1 Port B data direction register. +const byte* CIA1_PORT_B_DDR = $dc03; const byte BLACK = $0; const byte WHITE = $1; diff --git a/src/test/java/dk/camelot64/kickc/test/kc/keyboard.kc b/src/test/java/dk/camelot64/kickc/test/kc/keyboard.kc new file mode 100644 index 000000000..68b487c4a --- /dev/null +++ b/src/test/java/dk/camelot64/kickc/test/kc/keyboard.kc @@ -0,0 +1,138 @@ +// Simple Keyboard Input Library +// C64 Keyboard Matrix Reference - from http://codebase64.org/doku.php?id=base:reading_the_keyboard +// Keyboard Codes are %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7) +// +----+----------------------+-------------------------------------------------------------------------------------------------------+ +// | | Write | Read $dc01 (C64 screen code in parenthesis): | +// |row:| $dc00: row bits +------------+------------+------------+------------+------------+------------+------------+------------+ +// | | | BIT 7 | BIT 6 | BIT 5 | BIT 4 | BIT 3 | BIT 2 | BIT 1 | BIT 0 | +// +----+----------------------+------------+------------+------------+------------+------------+------------+------------+------------+ +// |0. | #%11111110 (254/$fe) | DOWN ($ )| F5 ($ )| F3 ($ )| F1 ($ )| F7 ($ )| RIGHT ($ )| RETURN($ )|DELETE ($ )| +// |1. | #%11111101 (253/$fd) |LEFT-SH($ )| e ($05)| s ($13)| z ($1a)| 4 ($34)| a ($01)| w ($17)| 3 ($33)| +// |2. | #%11111011 (251/$fb) | x ($18)| t ($14)| f ($06)| c ($03)| 6 ($36)| d ($04)| r ($12)| 5 ($35)| +// |3. | #%11110111 (247/$f7) | v ($16)| u ($15)| h ($08)| b ($02)| 8 ($38)| g ($07)| y ($19)| 7 ($37)| +// |4. | #%11101111 (239/$ef) | n ($0e)| o ($0f)| k ($0b)| m ($0d)| 0 ($30)| j ($0a)| i ($09)| 9 ($39)| +// |5. | #%11011111 (223/$df) | , ($2c)| @ ($00)| : ($3a)| . ($2e)| - ($2d)| l ($0c)| p ($10)| + ($2b)| +// |6. | #%10111111 (191/$bf) | / ($2f)| ^ ($1e)| = ($3d)|RGHT-SH($ )| HOME ($ )| ; ($3b)| * ($2a)| £ ($1c)| +// |7. | #%01111111 (127/$7f) | STOP ($ )| q ($11)|COMMODR($ )| SPACE ($20)| 2 ($32)|CONTROL($ )| <- ($1f)| 1 ($31)| +// +----+----------------------+------------+------------+------------+------------+------------+------------+------------+------------+ + +import "c64.kc" + +// Keyboard Codes for all 63 keys. +// Keyboard Codes are %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7). +// See C64 Keyboard Matrix Reference http://codebase64.org/doku.php?id=base:reading_the_keyboard +const byte KEY_DEL = $00; +const byte KEY_RETURN = $01; +const byte KEY_CRSR_RIGHT = $02; +const byte KEY_F7 = $03; +const byte KEY_F5 = $04; +const byte KEY_F3 = $05; +const byte KEY_F1 = $06; +const byte KEY_CRSR_DOWN = $07; +const byte KEY_3 = $08; +const byte KEY_W = $09; +const byte KEY_A = $0a; +const byte KEY_4 = $0b; +const byte KEY_Z = $0c; +const byte KEY_S = $0d; +const byte KEY_E = $0e; +const byte KEY_LSHIFT = $0f; +const byte KEY_5 = $10; +const byte KEY_R = $11; +const byte KEY_D = $12; +const byte KEY_6 = $13; +const byte KEY_C = $14; +const byte KEY_F = $15; +const byte KEY_T = $16; +const byte KEY_X = $17; +const byte KEY_7 = $18; +const byte KEY_Y = $19; +const byte KEY_G = $1a; +const byte KEY_8 = $1b; +const byte KEY_B = $1c; +const byte KEY_H = $1d; +const byte KEY_U = $1e; +const byte KEY_V = $1f; +const byte KEY_9 = $20; +const byte KEY_I = $21; +const byte KEY_J = $22; +const byte KEY_0 = $23; +const byte KEY_M = $24; +const byte KEY_K = $25; +const byte KEY_O = $26; +const byte KEY_N = $27; +const byte KEY_PLUS = $28; +const byte KEY_P = $29; +const byte KEY_L = $2a; +const byte KEY_MINUS = $2b; +const byte KEY_DOT = $2c; +const byte KEY_COLON = $2d; +const byte KEY_AT = $2e; +const byte KEY_COMMA = $2f; +const byte KEY_POUND = $30; +const byte KEY_ASTERISK = $31; +const byte KEY_SEMICOLON = $32; +const byte KEY_HOME = $33; +const byte KEY_RSHIFT = $34; +const byte KEY_EQUALS = $35; +const byte KEY_ARROW_UP = $36; +const byte KEY_SLASH = $37; +const byte KEY_1 = $38; +const byte KEY_ARROW_LEFT = $39; +const byte KEY_CTRL = $3a; +const byte KEY_2 = $3b; +const byte KEY_SPACE = $3c; +const byte KEY_COMMODORE = $3d; +const byte KEY_Q = $3e; +const byte KEY_RUNSTOP = $3f; + +// Keycodes for each screen code character from $00-$3f. +// Chars that do not have an unmodified keycode return $3f (representing RUN/STOP). +const byte[] keyboard_char_keycodes = { + /*@*/KEY_AT, /*a*/KEY_A, /*b*/KEY_B, /*c*/KEY_C, /*d*/KEY_D, /*e*/KEY_E, /*f*/KEY_F, /*g*/KEY_G, + /*h*/KEY_H, /*i*/KEY_I, /*j*/KEY_J, /*k*/KEY_K, /*l*/KEY_L, /*m*/KEY_M, /*n*/KEY_N, /*o*/KEY_O, + /*p*/KEY_O, /*q*/KEY_Q, /*r*/KEY_R, /*s*/KEY_S, /*t*/KEY_T, /*u*/KEY_U, /*v*/KEY_V, /*w*/KEY_W, + /*x*/KEY_X, /*y*/KEY_Y, /*z*/KEY_Z, /*[*/$3f, /*£*/KEY_POUND, /*]*/$3f, /*^*/KEY_ARROW_UP, /*<-*/KEY_ARROW_LEFT, + /* */KEY_SPACE, /*!*/$3f, /*"*/$3f, /*#*/$3f, /*$*/$3f, /*%*/$3f, /*&*/$3f, /*´*/$3f, + /*(*/$3f, /*)*/$3f, /***/KEY_ASTERISK, /*+*/KEY_PLUS, /*,*/KEY_COMMA, /*-*/KEY_MINUS, /*.*/KEY_DOT, /*/*/KEY_SLASH, + /*0*/KEY_0, /*1*/KEY_1, /*2*/KEY_2, /*3*/KEY_3, /*4*/KEY_4, /*5*/KEY_5, /*6*/KEY_6, /*7*/KEY_7, + /*8*/KEY_8, /*9*/KEY_9, /*:*/KEY_COLON, /*;*/KEY_SEMICOLON, /*<*/$3f, /*=*/KEY_EQUALS, /*>*/$3f, /*?*/$3f +}; + +// Keyboard row bitmask as expected by CIA#1 Port A when reading a specific keyboard matrix row (rows are numbered 0-7) +byte[8] keyboard_matrix_row_bitmask = { %11111110, %11111101, %11111011, %11110111, %11101111, %11011111, %10111111, %01111111 }; + +// Keyboard matrix column bitmasks for a specific keybooard matrix column when reading the keyboard. (columns are numbered 0-7) +byte[] keyboard_matrix_col_bitmask = { %00000001, %00000010, %00000100, %00001000, %00010000, %00100000, %01000000, %10000000 }; + +// Initialize keyboard reading by setting CIA#$ Data Direction Registers +void keyboard_init() { + // Keyboard Matrix Columns Write Mode + *CIA1_PORT_A_DDR = $ff; + // Keyboard Matrix Columns Read Mode + *CIA1_PORT_B_DDR = $00; +} +// Read a single row of the keyboard matrix +// The row ID (0-7) of the keyboard matrix row to read. See the C64 key matrix for row IDs. +// Returns the keys pressed on the row as bits according to the C64 key matrix. +byte keyboard_matrix_read(byte rowid) { + *CIA1_PORT_A = keyboard_matrix_row_bitmask[rowid]; + byte row_pressed_bits = ~*CIA1_PORT_B; + return row_pressed_bits; +} + +// Determines whether a specific key is currently pressed +// The key is a keyboard code defined from the keyboard matrix by %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7) +// All keys exist as as KEY_XXX constants. +// Returns zero if the key is not pressed and a non-zero value if the key is currently pressed +byte keyboard_key_pressed(byte key) { + return keyboard_matrix_read(key>>3)&keyboard_matrix_col_bitmask[key&7]; +} + +// Get the keycode corresponding to a specific screen code character +// ch is the character to get the key code for ($00-$3f) +// Returns the key code corresponding to the passed character. Only characters with a non-shifted key are handled. +// If there is no non-shifted key representing the char $3f is returned (representing RUN/STOP) . +byte keyboard_get_keycode(byte ch) { + return keyboard_char_keycodes[ch]; +} \ No newline at end of file diff --git a/src/test/java/dk/camelot64/kickc/test/kc/test-keyboard.kc b/src/test/java/dk/camelot64/kickc/test/kc/test-keyboard.kc index 77cc7ad5f..c2b6565e4 100644 --- a/src/test/java/dk/camelot64/kickc/test/kc/test-keyboard.kc +++ b/src/test/java/dk/camelot64/kickc/test/kc/test-keyboard.kc @@ -1,13 +1,6 @@ -import "c64.kc" +// Test keyboard input - in the keyboard matrix and mapping screen codes to key codes -// CIA#1 Port A: keyboard matrix columns and joystick #2 -const byte* CIA1_PORT_A = $dc00; -// CIA#1 Port B: keyboard matrix rows and joystick #1. -const byte* CIA1_PORT_B = $dc01; -// CIA #1 Port A data direction register. -const byte* CIA1_PORT_A_DDR = $dc02; -// CIA #1 Port B data direction register. -const byte* CIA1_PORT_B_DDR = $dc03; +import "keyboard.kc" void main() { // Clear screen @@ -16,6 +9,7 @@ void main() { } // Init keyboard keyboard_init(); + // Loop while(true) { do {} while (*RASTER!=$ff); byte* screen = $400; @@ -33,87 +27,19 @@ void main() { screen = screen + 40; } screen = screen + 40; - // Checks specific chars - byte[] chars = { '@', 'a', 'b', 'c', 'd', 'e' }; - for( byte i : 0..5 ) { - byte ch = chars[i]; - if(keyboard_char_pressed(ch)!=0) { - screen[i] = ch; - } else { - screen[i] = ' '; + // Checks all specific chars $00-$3f + byte i = 0; + for( byte ch : 0..$3f ) { + byte key = keyboard_get_keycode(ch); + if(key!=$3f) { + if(keyboard_key_pressed(key)!=0) { + screen[i++] = ch; + } } } + // Add some spaces + do { + screen[i++] = ' '; + } while (i<5); } } - -// Initialize keyboard reading by setting CIA#$ Data Direction Registers -void keyboard_init() { - // Keyboard Matrix Columns Write Mode - *CIA1_PORT_A_DDR = $ff; - // Keyboard Matrix Columns Read Mode - *CIA1_PORT_B_DDR = $00; -} - -// Determines whether a specific key representing a PETSCII char is currently pressed -// Returns zero if the key is not pressed and a non-zero value if the key is currently pressed -byte keyboard_char_pressed(byte ch) { - return keyboard_matrix_read(keyboard_matrix_row(ch)) & keyboard_matrix_col(ch); -} - -// Keyboard row bits as expected by CIA#1 Port A when reading a specific keyboard matrix row (rows are numbered 0-7) -byte[8] keyboard_row_bits = { %11111110, %11111101, %11111011, %11110111, %11101111, %11011111, %10111111, %01111111 }; - -// Read a single row of the keyboard matrix -// The row ID (0-7) of the keyboard matrix row to read. See the C64 key matrix for row IDs. -// Returns the keys pressed on the row as bits according to the C64 key matrix. -byte keyboard_matrix_read(byte rowid) { - *CIA1_PORT_A = keyboard_row_bits[rowid]; - byte row_pressed_bits = ~*CIA1_PORT_B; - return row_pressed_bits; -} - -// Keyboard matrix column bitmasks for a specific keybooard matrix column when reading the keyboard. (columns are numbered 0-7) -byte[] keyboard_matrix_col_bitmask = { %00000001, %00000010, %00000100, %00001000, %00010000, %00100000, %01000000, %10000000 }; - -// The keyboard matrix position of each PETSCII char between $00 and $3f (lower case) -// Matrix positions are encoded as column ID (0-7) in the high nibble and row ID (0-7) in the low nibble %ccccrrrr -byte[] keyboard_matrix_chars = { -// CR Char - $65, // ($00) @ - $21, // ($01) a - $43, // ($02) b - $42, // ($03) c - $22, // ($04) d - $61 // ($05) e -}; - -// Get the row ID of the keyboard matrix row containing a specific PETSCII char -// Returns the row ID (0-7) of the keyboard matrix row containing the passed char -// The row ID is suitable for passing to keyboard_matrix_read(rowid) -byte keyboard_matrix_row(byte ch) { - return keyboard_matrix_chars[ch] & $f; -} - -// Get the column bit mask of the keyboard matrix column containing a specific PETSCII char. -// Returns the keyboard matrix column bit mask of the passed char. -// The returned bit is suitable for ANDing with the result of keyboard_matrix_read(rowid) to determine if the corresponding key is pressed. -byte keyboard_matrix_col(byte ch) { - byte col_id = keyboard_matrix_chars[ch] >>4; - return keyboard_matrix_col_bitmask[col_id]; -} - -// C64 Keyboard Matrix Reference - from http://codebase64.org/doku.php?id=base:reading_the_keyboard -// +----+----------------------+-------------------------------------------------------------------------------------------------------+ -// | | Write | Read $dc01 (PETSCII code in parenthesis): | -// |row:| $dc00: row bits +------------+------------+------------+------------+------------+------------+------------+------------+ -// | | | BIT 7 | BIT 6 | BIT 5 | BIT 4 | BIT 3 | BIT 2 | BIT 1 | BIT 0 | -// +----+----------------------+------------+------------+------------+------------+------------+------------+------------+------------+ -// |0. | #%11111110 (254/$fe) | DOWN ($ )| F5 ($ )| F3 ($ )| F1 ($ )| F7 ($ )| RIGHT ($ )| RETURN($ )|DELETE ($ )| -// |1. | #%11111101 (253/$fd) |LEFT-SH($ )| e ($05)| s ($13)| z ($1a)| 4 ($34)| a ($01)| w ($17)| 3 ($33)| -// |2. | #%11111011 (251/$fb) | x ($18)| t ($14)| f ($06)| c ($03)| 6 ($36)| d ($04)| r ($12)| 5 ($35)| -// |3. | #%11110111 (247/$f7) | v ($16)| u ($15)| h ($08)| b ($02)| 8 ($38)| g ($07)| y ($19)| 7 ($37)| -// |4. | #%11101111 (239/$ef) | n ($0e)| o ($0f)| k ($0b)| m ($0d)| 0 ($30)| j ($0a)| i ($09)| 9 ($39)| -// |5. | #%11011111 (223/$df) | , ($2c)| @ ($00)| : ($3a)| . ($2e)| - ($2d)| l ($0c)| p ($10)| + ($2b)| -// |6. | #%10111111 (191/$bf) | / ($2f)| ^ ($1e)| = ($3d)|RGHT-SH($ )| HOME ($ )| ; ($3b)| * ($2a)| £ ($1c)| -// |7. | #%01111111 (127/$7f) | STOP ($ )| q ($11)|COMMODR($ )| SPACE ($20)| 2 ($32)|CONTROL($ )| <- ($1f)| 1 ($31)| -// +----+----------------------+------------+------------+------------+------------+------------+------------+------------+------------+ \ No newline at end of file diff --git a/src/test/java/dk/camelot64/kickc/test/ref/c64dtv-color.log b/src/test/java/dk/camelot64/kickc/test/ref/c64dtv-color.log index be6b99ad0..837e6a534 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/c64dtv-color.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/c64dtv-color.log @@ -73,6 +73,14 @@ const byte* SPRITES_COLS = $d027; const byte* COLS = $d800; +// CIA#1 Port A: keyboard matrix columns and joystick #2 +const byte* CIA1_PORT_A = $dc00; +// CIA#1 Port B: keyboard matrix rows and joystick #1. +const byte* CIA1_PORT_B = $dc01; +// CIA #1 Port A data direction register. +const byte* CIA1_PORT_A_DDR = $dc02; +// CIA #1 Port B data direction register. +const byte* CIA1_PORT_B_DDR = $dc03; const byte BLACK = $0; const byte WHITE = $1; @@ -112,6 +120,10 @@ STATEMENTS (byte*) SPRITES_MC2 ← (word/dword/signed dword) 53286 (byte*) SPRITES_COLS ← (word/dword/signed dword) 53287 (byte*) COLS ← (word/dword/signed dword) 55296 + (byte*) CIA1_PORT_A ← (word/dword/signed dword) 56320 + (byte*) CIA1_PORT_B ← (word/dword/signed dword) 56321 + (byte*) CIA1_PORT_A_DDR ← (word/dword/signed dword) 56322 + (byte*) CIA1_PORT_B_DDR ← (word/dword/signed dword) 56323 (byte) BLACK ← (byte/signed byte/word/signed word/dword/signed dword) 0 (byte) WHITE ← (byte/signed byte/word/signed word/dword/signed dword) 1 (byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2 @@ -187,6 +199,10 @@ SYMBOLS (byte*) BORDERCOL (byte) BROWN (byte*) CHARGEN +(byte*) CIA1_PORT_A +(byte*) CIA1_PORT_A_DDR +(byte*) CIA1_PORT_B +(byte*) CIA1_PORT_B_DDR (byte*) COLS (byte) CYAN (byte) DARK_GREY @@ -262,6 +278,10 @@ Promoting word/dword/signed dword to byte* in SPRITES_MC1 ← ((byte*)) 53285 Promoting word/dword/signed dword to byte* in SPRITES_MC2 ← ((byte*)) 53286 Promoting word/dword/signed dword to byte* in SPRITES_COLS ← ((byte*)) 53287 Promoting word/dword/signed dword to byte* in COLS ← ((byte*)) 55296 +Promoting word/dword/signed dword to byte* in CIA1_PORT_A ← ((byte*)) 56320 +Promoting word/dword/signed dword to byte* in CIA1_PORT_B ← ((byte*)) 56321 +Promoting word/dword/signed dword to byte* in CIA1_PORT_A_DDR ← ((byte*)) 56322 +Promoting word/dword/signed dword to byte* in CIA1_PORT_B_DDR ← ((byte*)) 56323 Promoting word/dword/signed dword to byte* in DTV_CONTROL ← ((byte*)) 53308 Promoting word/dword/signed dword to byte* in DTV_FEATURE ← ((byte*)) 53311 Promoting word/dword/signed dword to byte* in DTV_PALETTE ← ((byte*)) 53760 @@ -284,6 +304,10 @@ INITIAL CONTROL FLOW GRAPH (byte*) SPRITES_MC2 ← ((byte*)) (word/dword/signed dword) 53286 (byte*) SPRITES_COLS ← ((byte*)) (word/dword/signed dword) 53287 (byte*) COLS ← ((byte*)) (word/dword/signed dword) 55296 + (byte*) CIA1_PORT_A ← ((byte*)) (word/dword/signed dword) 56320 + (byte*) CIA1_PORT_B ← ((byte*)) (word/dword/signed dword) 56321 + (byte*) CIA1_PORT_A_DDR ← ((byte*)) (word/dword/signed dword) 56322 + (byte*) CIA1_PORT_B_DDR ← ((byte*)) (word/dword/signed dword) 56323 (byte) BLACK ← (byte/signed byte/word/signed word/dword/signed dword) 0 (byte) WHITE ← (byte/signed byte/word/signed word/dword/signed dword) 1 (byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2 @@ -392,27 +416,31 @@ Eliminating unused variable (byte*) SPRITES_MC1 and assignment [13] (byte*) SPRI Eliminating unused variable (byte*) SPRITES_MC2 and assignment [14] (byte*) SPRITES_MC2 ← ((byte*)) (word/dword/signed dword) 53286 Eliminating unused variable (byte*) SPRITES_COLS and assignment [15] (byte*) SPRITES_COLS ← ((byte*)) (word/dword/signed dword) 53287 Eliminating unused variable (byte*) COLS and assignment [16] (byte*) COLS ← ((byte*)) (word/dword/signed dword) 55296 -Eliminating unused variable (byte) BLACK and assignment [17] (byte) BLACK ← (byte/signed byte/word/signed word/dword/signed dword) 0 -Eliminating unused variable (byte) WHITE and assignment [18] (byte) WHITE ← (byte/signed byte/word/signed word/dword/signed dword) 1 -Eliminating unused variable (byte) RED and assignment [19] (byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2 -Eliminating unused variable (byte) CYAN and assignment [20] (byte) CYAN ← (byte/signed byte/word/signed word/dword/signed dword) 3 -Eliminating unused variable (byte) PURPLE and assignment [21] (byte) PURPLE ← (byte/signed byte/word/signed word/dword/signed dword) 4 -Eliminating unused variable (byte) GREEN and assignment [22] (byte) GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 5 -Eliminating unused variable (byte) BLUE and assignment [23] (byte) BLUE ← (byte/signed byte/word/signed word/dword/signed dword) 6 -Eliminating unused variable (byte) YELLOW and assignment [24] (byte) YELLOW ← (byte/signed byte/word/signed word/dword/signed dword) 7 -Eliminating unused variable (byte) ORANGE and assignment [25] (byte) ORANGE ← (byte/signed byte/word/signed word/dword/signed dword) 8 -Eliminating unused variable (byte) BROWN and assignment [26] (byte) BROWN ← (byte/signed byte/word/signed word/dword/signed dword) 9 -Eliminating unused variable (byte) PINK and assignment [27] (byte) PINK ← (byte/signed byte/word/signed word/dword/signed dword) 10 -Eliminating unused variable (byte) DARK_GREY and assignment [28] (byte) DARK_GREY ← (byte/signed byte/word/signed word/dword/signed dword) 11 -Eliminating unused variable (byte) GREY and assignment [29] (byte) GREY ← (byte/signed byte/word/signed word/dword/signed dword) 12 -Eliminating unused variable (byte) LIGHT_GREEN and assignment [30] (byte) LIGHT_GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 13 -Eliminating unused variable (byte) LIGHT_BLUE and assignment [31] (byte) LIGHT_BLUE ← (byte/signed byte/word/signed word/dword/signed dword) 14 -Eliminating unused variable (byte) LIGHT_GREY and assignment [32] (byte) LIGHT_GREY ← (byte/signed byte/word/signed word/dword/signed dword) 15 -Eliminating unused variable (byte) DTV_CONTROL_LINEAR_ADDRESSING_ON and assignment [34] (byte) DTV_CONTROL_LINEAR_ADDRESSING_ON ← (byte/signed byte/word/signed word/dword/signed dword) 1 -Eliminating unused variable (byte) DTV_CONTROL_OVERSCAN_ON and assignment [37] (byte) DTV_CONTROL_OVERSCAN_ON ← (byte/signed byte/word/signed word/dword/signed dword) 8 -Eliminating unused variable (byte) DTV_CONTROL_COLORRAM_OFF and assignment [38] (byte) DTV_CONTROL_COLORRAM_OFF ← (byte/signed byte/word/signed word/dword/signed dword) 16 -Eliminating unused variable (byte) DTV_CONTROL_CHUNKY_ON and assignment [40] (byte) DTV_CONTROL_CHUNKY_ON ← (byte/signed byte/word/signed word/dword/signed dword) 64 -Eliminating unused variable (byte) DTV_FEATURE_DISABLE_TIL_RESET and assignment [43] (byte) DTV_FEATURE_DISABLE_TIL_RESET ← (byte/signed byte/word/signed word/dword/signed dword) 2 +Eliminating unused variable (byte*) CIA1_PORT_A and assignment [17] (byte*) CIA1_PORT_A ← ((byte*)) (word/dword/signed dword) 56320 +Eliminating unused variable (byte*) CIA1_PORT_B and assignment [18] (byte*) CIA1_PORT_B ← ((byte*)) (word/dword/signed dword) 56321 +Eliminating unused variable (byte*) CIA1_PORT_A_DDR and assignment [19] (byte*) CIA1_PORT_A_DDR ← ((byte*)) (word/dword/signed dword) 56322 +Eliminating unused variable (byte*) CIA1_PORT_B_DDR and assignment [20] (byte*) CIA1_PORT_B_DDR ← ((byte*)) (word/dword/signed dword) 56323 +Eliminating unused variable (byte) BLACK and assignment [21] (byte) BLACK ← (byte/signed byte/word/signed word/dword/signed dword) 0 +Eliminating unused variable (byte) WHITE and assignment [22] (byte) WHITE ← (byte/signed byte/word/signed word/dword/signed dword) 1 +Eliminating unused variable (byte) RED and assignment [23] (byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2 +Eliminating unused variable (byte) CYAN and assignment [24] (byte) CYAN ← (byte/signed byte/word/signed word/dword/signed dword) 3 +Eliminating unused variable (byte) PURPLE and assignment [25] (byte) PURPLE ← (byte/signed byte/word/signed word/dword/signed dword) 4 +Eliminating unused variable (byte) GREEN and assignment [26] (byte) GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 5 +Eliminating unused variable (byte) BLUE and assignment [27] (byte) BLUE ← (byte/signed byte/word/signed word/dword/signed dword) 6 +Eliminating unused variable (byte) YELLOW and assignment [28] (byte) YELLOW ← (byte/signed byte/word/signed word/dword/signed dword) 7 +Eliminating unused variable (byte) ORANGE and assignment [29] (byte) ORANGE ← (byte/signed byte/word/signed word/dword/signed dword) 8 +Eliminating unused variable (byte) BROWN and assignment [30] (byte) BROWN ← (byte/signed byte/word/signed word/dword/signed dword) 9 +Eliminating unused variable (byte) PINK and assignment [31] (byte) PINK ← (byte/signed byte/word/signed word/dword/signed dword) 10 +Eliminating unused variable (byte) DARK_GREY and assignment [32] (byte) DARK_GREY ← (byte/signed byte/word/signed word/dword/signed dword) 11 +Eliminating unused variable (byte) GREY and assignment [33] (byte) GREY ← (byte/signed byte/word/signed word/dword/signed dword) 12 +Eliminating unused variable (byte) LIGHT_GREEN and assignment [34] (byte) LIGHT_GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 13 +Eliminating unused variable (byte) LIGHT_BLUE and assignment [35] (byte) LIGHT_BLUE ← (byte/signed byte/word/signed word/dword/signed dword) 14 +Eliminating unused variable (byte) LIGHT_GREY and assignment [36] (byte) LIGHT_GREY ← (byte/signed byte/word/signed word/dword/signed dword) 15 +Eliminating unused variable (byte) DTV_CONTROL_LINEAR_ADDRESSING_ON and assignment [38] (byte) DTV_CONTROL_LINEAR_ADDRESSING_ON ← (byte/signed byte/word/signed word/dword/signed dword) 1 +Eliminating unused variable (byte) DTV_CONTROL_OVERSCAN_ON and assignment [41] (byte) DTV_CONTROL_OVERSCAN_ON ← (byte/signed byte/word/signed word/dword/signed dword) 8 +Eliminating unused variable (byte) DTV_CONTROL_COLORRAM_OFF and assignment [42] (byte) DTV_CONTROL_COLORRAM_OFF ← (byte/signed byte/word/signed word/dword/signed dword) 16 +Eliminating unused variable (byte) DTV_CONTROL_CHUNKY_ON and assignment [44] (byte) DTV_CONTROL_CHUNKY_ON ← (byte/signed byte/word/signed word/dword/signed dword) 64 +Eliminating unused variable (byte) DTV_FEATURE_DISABLE_TIL_RESET and assignment [47] (byte) DTV_FEATURE_DISABLE_TIL_RESET ← (byte/signed byte/word/signed word/dword/signed dword) 2 Removing empty block main::@9 Removing empty block main::@3 Removing empty block main::@10 diff --git a/src/test/java/dk/camelot64/kickc/test/ref/raster-bars.log b/src/test/java/dk/camelot64/kickc/test/ref/raster-bars.log index 88f00d507..3dcd8eecd 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/raster-bars.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/raster-bars.log @@ -95,6 +95,14 @@ const byte* SPRITES_COLS = $d027; const byte* COLS = $d800; +// CIA#1 Port A: keyboard matrix columns and joystick #2 +const byte* CIA1_PORT_A = $dc00; +// CIA#1 Port B: keyboard matrix rows and joystick #1. +const byte* CIA1_PORT_B = $dc01; +// CIA #1 Port A data direction register. +const byte* CIA1_PORT_A_DDR = $dc02; +// CIA #1 Port B data direction register. +const byte* CIA1_PORT_B_DDR = $dc03; const byte BLACK = $0; const byte WHITE = $1; @@ -133,6 +141,10 @@ STATEMENTS (byte*) SPRITES_MC2 ← (word/dword/signed dword) 53286 (byte*) SPRITES_COLS ← (word/dword/signed dword) 53287 (byte*) COLS ← (word/dword/signed dword) 55296 + (byte*) CIA1_PORT_A ← (word/dword/signed dword) 56320 + (byte*) CIA1_PORT_B ← (word/dword/signed dword) 56321 + (byte*) CIA1_PORT_A_DDR ← (word/dword/signed dword) 56322 + (byte*) CIA1_PORT_B_DDR ← (word/dword/signed dword) 56323 (byte) BLACK ← (byte/signed byte/word/signed word/dword/signed dword) 0 (byte) WHITE ← (byte/signed byte/word/signed word/dword/signed dword) 1 (byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2 @@ -188,6 +200,10 @@ SYMBOLS (byte*) BORDERCOL (byte) BROWN (byte*) CHARGEN +(byte*) CIA1_PORT_A +(byte*) CIA1_PORT_A_DDR +(byte*) CIA1_PORT_B +(byte*) CIA1_PORT_B_DDR (byte*) COLS (byte) CYAN (byte) DARK_GREY @@ -248,6 +264,10 @@ Promoting word/dword/signed dword to byte* in SPRITES_MC1 ← ((byte*)) 53285 Promoting word/dword/signed dword to byte* in SPRITES_MC2 ← ((byte*)) 53286 Promoting word/dword/signed dword to byte* in SPRITES_COLS ← ((byte*)) 53287 Promoting word/dword/signed dword to byte* in COLS ← ((byte*)) 55296 +Promoting word/dword/signed dword to byte* in CIA1_PORT_A ← ((byte*)) 56320 +Promoting word/dword/signed dword to byte* in CIA1_PORT_B ← ((byte*)) 56321 +Promoting word/dword/signed dword to byte* in CIA1_PORT_A_DDR ← ((byte*)) 56322 +Promoting word/dword/signed dword to byte* in CIA1_PORT_B_DDR ← ((byte*)) 56323 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte*) PROCPORT ← ((byte*)) (byte/signed byte/word/signed word/dword/signed dword) 1 @@ -267,6 +287,10 @@ INITIAL CONTROL FLOW GRAPH (byte*) SPRITES_MC2 ← ((byte*)) (word/dword/signed dword) 53286 (byte*) SPRITES_COLS ← ((byte*)) (word/dword/signed dword) 53287 (byte*) COLS ← ((byte*)) (word/dword/signed dword) 55296 + (byte*) CIA1_PORT_A ← ((byte*)) (word/dword/signed dword) 56320 + (byte*) CIA1_PORT_B ← ((byte*)) (word/dword/signed dword) 56321 + (byte*) CIA1_PORT_A_DDR ← ((byte*)) (word/dword/signed dword) 56322 + (byte*) CIA1_PORT_B_DDR ← ((byte*)) (word/dword/signed dword) 56323 (byte) BLACK ← (byte/signed byte/word/signed word/dword/signed dword) 0 (byte) WHITE ← (byte/signed byte/word/signed word/dword/signed dword) 1 (byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2 @@ -349,22 +373,26 @@ Eliminating unused variable (byte*) SPRITES_MC1 and assignment [13] (byte*) SPRI Eliminating unused variable (byte*) SPRITES_MC2 and assignment [14] (byte*) SPRITES_MC2 ← ((byte*)) (word/dword/signed dword) 53286 Eliminating unused variable (byte*) SPRITES_COLS and assignment [15] (byte*) SPRITES_COLS ← ((byte*)) (word/dword/signed dword) 53287 Eliminating unused variable (byte*) COLS and assignment [16] (byte*) COLS ← ((byte*)) (word/dword/signed dword) 55296 -Eliminating unused variable (byte) BLACK and assignment [17] (byte) BLACK ← (byte/signed byte/word/signed word/dword/signed dword) 0 -Eliminating unused variable (byte) WHITE and assignment [18] (byte) WHITE ← (byte/signed byte/word/signed word/dword/signed dword) 1 -Eliminating unused variable (byte) RED and assignment [19] (byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2 -Eliminating unused variable (byte) CYAN and assignment [20] (byte) CYAN ← (byte/signed byte/word/signed word/dword/signed dword) 3 -Eliminating unused variable (byte) PURPLE and assignment [21] (byte) PURPLE ← (byte/signed byte/word/signed word/dword/signed dword) 4 -Eliminating unused variable (byte) GREEN and assignment [22] (byte) GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 5 -Eliminating unused variable (byte) BLUE and assignment [23] (byte) BLUE ← (byte/signed byte/word/signed word/dword/signed dword) 6 -Eliminating unused variable (byte) YELLOW and assignment [24] (byte) YELLOW ← (byte/signed byte/word/signed word/dword/signed dword) 7 -Eliminating unused variable (byte) ORANGE and assignment [25] (byte) ORANGE ← (byte/signed byte/word/signed word/dword/signed dword) 8 -Eliminating unused variable (byte) BROWN and assignment [26] (byte) BROWN ← (byte/signed byte/word/signed word/dword/signed dword) 9 -Eliminating unused variable (byte) PINK and assignment [27] (byte) PINK ← (byte/signed byte/word/signed word/dword/signed dword) 10 -Eliminating unused variable (byte) DARK_GREY and assignment [28] (byte) DARK_GREY ← (byte/signed byte/word/signed word/dword/signed dword) 11 -Eliminating unused variable (byte) GREY and assignment [29] (byte) GREY ← (byte/signed byte/word/signed word/dword/signed dword) 12 -Eliminating unused variable (byte) LIGHT_GREEN and assignment [30] (byte) LIGHT_GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 13 -Eliminating unused variable (byte) LIGHT_BLUE and assignment [31] (byte) LIGHT_BLUE ← (byte/signed byte/word/signed word/dword/signed dword) 14 -Eliminating unused variable (byte) LIGHT_GREY and assignment [32] (byte) LIGHT_GREY ← (byte/signed byte/word/signed word/dword/signed dword) 15 +Eliminating unused variable (byte*) CIA1_PORT_A and assignment [17] (byte*) CIA1_PORT_A ← ((byte*)) (word/dword/signed dword) 56320 +Eliminating unused variable (byte*) CIA1_PORT_B and assignment [18] (byte*) CIA1_PORT_B ← ((byte*)) (word/dword/signed dword) 56321 +Eliminating unused variable (byte*) CIA1_PORT_A_DDR and assignment [19] (byte*) CIA1_PORT_A_DDR ← ((byte*)) (word/dword/signed dword) 56322 +Eliminating unused variable (byte*) CIA1_PORT_B_DDR and assignment [20] (byte*) CIA1_PORT_B_DDR ← ((byte*)) (word/dword/signed dword) 56323 +Eliminating unused variable (byte) BLACK and assignment [21] (byte) BLACK ← (byte/signed byte/word/signed word/dword/signed dword) 0 +Eliminating unused variable (byte) WHITE and assignment [22] (byte) WHITE ← (byte/signed byte/word/signed word/dword/signed dword) 1 +Eliminating unused variable (byte) RED and assignment [23] (byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2 +Eliminating unused variable (byte) CYAN and assignment [24] (byte) CYAN ← (byte/signed byte/word/signed word/dword/signed dword) 3 +Eliminating unused variable (byte) PURPLE and assignment [25] (byte) PURPLE ← (byte/signed byte/word/signed word/dword/signed dword) 4 +Eliminating unused variable (byte) GREEN and assignment [26] (byte) GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 5 +Eliminating unused variable (byte) BLUE and assignment [27] (byte) BLUE ← (byte/signed byte/word/signed word/dword/signed dword) 6 +Eliminating unused variable (byte) YELLOW and assignment [28] (byte) YELLOW ← (byte/signed byte/word/signed word/dword/signed dword) 7 +Eliminating unused variable (byte) ORANGE and assignment [29] (byte) ORANGE ← (byte/signed byte/word/signed word/dword/signed dword) 8 +Eliminating unused variable (byte) BROWN and assignment [30] (byte) BROWN ← (byte/signed byte/word/signed word/dword/signed dword) 9 +Eliminating unused variable (byte) PINK and assignment [31] (byte) PINK ← (byte/signed byte/word/signed word/dword/signed dword) 10 +Eliminating unused variable (byte) DARK_GREY and assignment [32] (byte) DARK_GREY ← (byte/signed byte/word/signed word/dword/signed dword) 11 +Eliminating unused variable (byte) GREY and assignment [33] (byte) GREY ← (byte/signed byte/word/signed word/dword/signed dword) 12 +Eliminating unused variable (byte) LIGHT_GREEN and assignment [34] (byte) LIGHT_GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 13 +Eliminating unused variable (byte) LIGHT_BLUE and assignment [35] (byte) LIGHT_BLUE ← (byte/signed byte/word/signed word/dword/signed dword) 14 +Eliminating unused variable (byte) LIGHT_GREY and assignment [36] (byte) LIGHT_GREY ← (byte/signed byte/word/signed word/dword/signed dword) 15 Eliminating unused variable - keeping the call (void~) main::$2 Removing empty block main::@4 Removing empty block main::@6 diff --git a/src/test/java/dk/camelot64/kickc/test/ref/signed-words.log b/src/test/java/dk/camelot64/kickc/test/ref/signed-words.log index 19b068220..02be798b2 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/signed-words.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/signed-words.log @@ -97,6 +97,14 @@ const byte* SPRITES_COLS = $d027; const byte* COLS = $d800; +// CIA#1 Port A: keyboard matrix columns and joystick #2 +const byte* CIA1_PORT_A = $dc00; +// CIA#1 Port B: keyboard matrix rows and joystick #1. +const byte* CIA1_PORT_B = $dc01; +// CIA #1 Port A data direction register. +const byte* CIA1_PORT_A_DDR = $dc02; +// CIA #1 Port B data direction register. +const byte* CIA1_PORT_B_DDR = $dc03; const byte BLACK = $0; const byte WHITE = $1; @@ -135,6 +143,10 @@ STATEMENTS (byte*) SPRITES_MC2 ← (word/dword/signed dword) 53286 (byte*) SPRITES_COLS ← (word/dword/signed dword) 53287 (byte*) COLS ← (word/dword/signed dword) 55296 + (byte*) CIA1_PORT_A ← (word/dword/signed dword) 56320 + (byte*) CIA1_PORT_B ← (word/dword/signed dword) 56321 + (byte*) CIA1_PORT_A_DDR ← (word/dword/signed dword) 56322 + (byte*) CIA1_PORT_B_DDR ← (word/dword/signed dword) 56323 (byte) BLACK ← (byte/signed byte/word/signed word/dword/signed dword) 0 (byte) WHITE ← (byte/signed byte/word/signed word/dword/signed dword) 1 (byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2 @@ -249,6 +261,10 @@ SYMBOLS (byte*) BORDERCOL (byte) BROWN (byte*) CHARGEN +(byte*) CIA1_PORT_A +(byte*) CIA1_PORT_A_DDR +(byte*) CIA1_PORT_B +(byte*) CIA1_PORT_B_DDR (byte*) COLS (byte) CYAN (byte) DARK_GREY @@ -344,6 +360,10 @@ Promoting word/dword/signed dword to byte* in SPRITES_MC1 ← ((byte*)) 53285 Promoting word/dword/signed dword to byte* in SPRITES_MC2 ← ((byte*)) 53286 Promoting word/dword/signed dword to byte* in SPRITES_COLS ← ((byte*)) 53287 Promoting word/dword/signed dword to byte* in COLS ← ((byte*)) 55296 +Promoting word/dword/signed dword to byte* in CIA1_PORT_A ← ((byte*)) 56320 +Promoting word/dword/signed dword to byte* in CIA1_PORT_B ← ((byte*)) 56321 +Promoting word/dword/signed dword to byte* in CIA1_PORT_A_DDR ← ((byte*)) 56322 +Promoting word/dword/signed dword to byte* in CIA1_PORT_B_DDR ← ((byte*)) 56323 Promoting word/signed word/dword/signed dword to byte* in SCREEN ← ((byte*)) 1024 Promoting word/signed word/dword/signed dword to byte* in SPRITE ← ((byte*)) 8192 INITIAL CONTROL FLOW GRAPH @@ -365,6 +385,10 @@ INITIAL CONTROL FLOW GRAPH (byte*) SPRITES_MC2 ← ((byte*)) (word/dword/signed dword) 53286 (byte*) SPRITES_COLS ← ((byte*)) (word/dword/signed dword) 53287 (byte*) COLS ← ((byte*)) (word/dword/signed dword) 55296 + (byte*) CIA1_PORT_A ← ((byte*)) (word/dword/signed dword) 56320 + (byte*) CIA1_PORT_B ← ((byte*)) (word/dword/signed dword) 56321 + (byte*) CIA1_PORT_A_DDR ← ((byte*)) (word/dword/signed dword) 56322 + (byte*) CIA1_PORT_B_DDR ← ((byte*)) (word/dword/signed dword) 56323 (byte) BLACK ← (byte/signed byte/word/signed word/dword/signed dword) 0 (byte) WHITE ← (byte/signed byte/word/signed word/dword/signed dword) 1 (byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2 @@ -508,21 +532,25 @@ Eliminating unused variable (byte*) BGCOL and assignment [12] (byte*) BGCOL ← Eliminating unused variable (byte*) SPRITES_MC1 and assignment [13] (byte*) SPRITES_MC1 ← ((byte*)) (word/dword/signed dword) 53285 Eliminating unused variable (byte*) SPRITES_MC2 and assignment [14] (byte*) SPRITES_MC2 ← ((byte*)) (word/dword/signed dword) 53286 Eliminating unused variable (byte*) COLS and assignment [16] (byte*) COLS ← ((byte*)) (word/dword/signed dword) 55296 -Eliminating unused variable (byte) BLACK and assignment [17] (byte) BLACK ← (byte/signed byte/word/signed word/dword/signed dword) 0 -Eliminating unused variable (byte) RED and assignment [19] (byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2 -Eliminating unused variable (byte) CYAN and assignment [20] (byte) CYAN ← (byte/signed byte/word/signed word/dword/signed dword) 3 -Eliminating unused variable (byte) PURPLE and assignment [21] (byte) PURPLE ← (byte/signed byte/word/signed word/dword/signed dword) 4 -Eliminating unused variable (byte) GREEN and assignment [22] (byte) GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 5 -Eliminating unused variable (byte) BLUE and assignment [23] (byte) BLUE ← (byte/signed byte/word/signed word/dword/signed dword) 6 -Eliminating unused variable (byte) YELLOW and assignment [24] (byte) YELLOW ← (byte/signed byte/word/signed word/dword/signed dword) 7 -Eliminating unused variable (byte) ORANGE and assignment [25] (byte) ORANGE ← (byte/signed byte/word/signed word/dword/signed dword) 8 -Eliminating unused variable (byte) BROWN and assignment [26] (byte) BROWN ← (byte/signed byte/word/signed word/dword/signed dword) 9 -Eliminating unused variable (byte) PINK and assignment [27] (byte) PINK ← (byte/signed byte/word/signed word/dword/signed dword) 10 -Eliminating unused variable (byte) DARK_GREY and assignment [28] (byte) DARK_GREY ← (byte/signed byte/word/signed word/dword/signed dword) 11 -Eliminating unused variable (byte) GREY and assignment [29] (byte) GREY ← (byte/signed byte/word/signed word/dword/signed dword) 12 -Eliminating unused variable (byte) LIGHT_GREEN and assignment [30] (byte) LIGHT_GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 13 -Eliminating unused variable (byte) LIGHT_BLUE and assignment [31] (byte) LIGHT_BLUE ← (byte/signed byte/word/signed word/dword/signed dword) 14 -Eliminating unused variable (byte) LIGHT_GREY and assignment [32] (byte) LIGHT_GREY ← (byte/signed byte/word/signed word/dword/signed dword) 15 +Eliminating unused variable (byte*) CIA1_PORT_A and assignment [17] (byte*) CIA1_PORT_A ← ((byte*)) (word/dword/signed dword) 56320 +Eliminating unused variable (byte*) CIA1_PORT_B and assignment [18] (byte*) CIA1_PORT_B ← ((byte*)) (word/dword/signed dword) 56321 +Eliminating unused variable (byte*) CIA1_PORT_A_DDR and assignment [19] (byte*) CIA1_PORT_A_DDR ← ((byte*)) (word/dword/signed dword) 56322 +Eliminating unused variable (byte*) CIA1_PORT_B_DDR and assignment [20] (byte*) CIA1_PORT_B_DDR ← ((byte*)) (word/dword/signed dword) 56323 +Eliminating unused variable (byte) BLACK and assignment [21] (byte) BLACK ← (byte/signed byte/word/signed word/dword/signed dword) 0 +Eliminating unused variable (byte) RED and assignment [23] (byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2 +Eliminating unused variable (byte) CYAN and assignment [24] (byte) CYAN ← (byte/signed byte/word/signed word/dword/signed dword) 3 +Eliminating unused variable (byte) PURPLE and assignment [25] (byte) PURPLE ← (byte/signed byte/word/signed word/dword/signed dword) 4 +Eliminating unused variable (byte) GREEN and assignment [26] (byte) GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 5 +Eliminating unused variable (byte) BLUE and assignment [27] (byte) BLUE ← (byte/signed byte/word/signed word/dword/signed dword) 6 +Eliminating unused variable (byte) YELLOW and assignment [28] (byte) YELLOW ← (byte/signed byte/word/signed word/dword/signed dword) 7 +Eliminating unused variable (byte) ORANGE and assignment [29] (byte) ORANGE ← (byte/signed byte/word/signed word/dword/signed dword) 8 +Eliminating unused variable (byte) BROWN and assignment [30] (byte) BROWN ← (byte/signed byte/word/signed word/dword/signed dword) 9 +Eliminating unused variable (byte) PINK and assignment [31] (byte) PINK ← (byte/signed byte/word/signed word/dword/signed dword) 10 +Eliminating unused variable (byte) DARK_GREY and assignment [32] (byte) DARK_GREY ← (byte/signed byte/word/signed word/dword/signed dword) 11 +Eliminating unused variable (byte) GREY and assignment [33] (byte) GREY ← (byte/signed byte/word/signed word/dword/signed dword) 12 +Eliminating unused variable (byte) LIGHT_GREEN and assignment [34] (byte) LIGHT_GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 13 +Eliminating unused variable (byte) LIGHT_BLUE and assignment [35] (byte) LIGHT_BLUE ← (byte/signed byte/word/signed word/dword/signed dword) 14 +Eliminating unused variable (byte) LIGHT_GREY and assignment [36] (byte) LIGHT_GREY ← (byte/signed byte/word/signed word/dword/signed dword) 15 Eliminating unused variable - keeping the call (void~) main::$0 Eliminating unused variable - keeping the call (void~) main::$2 Removing empty block main::@4 diff --git a/src/test/java/dk/camelot64/kickc/test/ref/sinus-sprites.log b/src/test/java/dk/camelot64/kickc/test/ref/sinus-sprites.log index 406fdeadb..3e918b44f 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/sinus-sprites.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/sinus-sprites.log @@ -238,6 +238,14 @@ const byte* SPRITES_COLS = $d027; const byte* COLS = $d800; +// CIA#1 Port A: keyboard matrix columns and joystick #2 +const byte* CIA1_PORT_A = $dc00; +// CIA#1 Port B: keyboard matrix rows and joystick #1. +const byte* CIA1_PORT_B = $dc01; +// CIA #1 Port A data direction register. +const byte* CIA1_PORT_A_DDR = $dc02; +// CIA #1 Port B data direction register. +const byte* CIA1_PORT_B_DDR = $dc03; const byte BLACK = $0; const byte WHITE = $1; @@ -657,6 +665,10 @@ STATEMENTS (byte*) SPRITES_MC2 ← (word/dword/signed dword) 53286 (byte*) SPRITES_COLS ← (word/dword/signed dword) 53287 (byte*) COLS ← (word/dword/signed dword) 55296 + (byte*) CIA1_PORT_A ← (word/dword/signed dword) 56320 + (byte*) CIA1_PORT_B ← (word/dword/signed dword) 56321 + (byte*) CIA1_PORT_A_DDR ← (word/dword/signed dword) 56322 + (byte*) CIA1_PORT_B_DDR ← (word/dword/signed dword) 56323 (byte) BLACK ← (byte/signed byte/word/signed word/dword/signed dword) 0 (byte) WHITE ← (byte/signed byte/word/signed word/dword/signed dword) 1 (byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2 @@ -1216,6 +1228,10 @@ SYMBOLS (byte*) BORDERCOL (byte) BROWN (byte*) CHARGEN +(byte*) CIA1_PORT_A +(byte*) CIA1_PORT_A_DDR +(byte*) CIA1_PORT_B +(byte*) CIA1_PORT_B_DDR (byte*) COLS (byte) CYAN (byte) DARK_GREY @@ -1592,6 +1608,10 @@ Promoting word/dword/signed dword to byte* in SPRITES_MC1 ← ((byte*)) 53285 Promoting word/dword/signed dword to byte* in SPRITES_MC2 ← ((byte*)) 53286 Promoting word/dword/signed dword to byte* in SPRITES_COLS ← ((byte*)) 53287 Promoting word/dword/signed dword to byte* in COLS ← ((byte*)) 55296 +Promoting word/dword/signed dword to byte* in CIA1_PORT_A ← ((byte*)) 56320 +Promoting word/dword/signed dword to byte* in CIA1_PORT_B ← ((byte*)) 56321 +Promoting word/dword/signed dword to byte* in CIA1_PORT_A_DDR ← ((byte*)) 56322 +Promoting word/dword/signed dword to byte* in CIA1_PORT_B_DDR ← ((byte*)) 56323 Promoting byte/word/signed word/dword/signed dword to byte* in memLo ← ((byte*)) 254 Promoting byte/word/signed word/dword/signed dword to byte* in memHi ← ((byte*)) 255 Promoting word/signed word/dword/signed dword to byte* in SCREEN ← ((byte*)) 1024 @@ -1616,6 +1636,10 @@ INITIAL CONTROL FLOW GRAPH (byte*) SPRITES_MC2 ← ((byte*)) (word/dword/signed dword) 53286 (byte*) SPRITES_COLS ← ((byte*)) (word/dword/signed dword) 53287 (byte*) COLS ← ((byte*)) (word/dword/signed dword) 55296 + (byte*) CIA1_PORT_A ← ((byte*)) (word/dword/signed dword) 56320 + (byte*) CIA1_PORT_B ← ((byte*)) (word/dword/signed dword) 56321 + (byte*) CIA1_PORT_A_DDR ← ((byte*)) (word/dword/signed dword) 56322 + (byte*) CIA1_PORT_B_DDR ← ((byte*)) (word/dword/signed dword) 56323 (byte) BLACK ← (byte/signed byte/word/signed word/dword/signed dword) 0 (byte) WHITE ← (byte/signed byte/word/signed word/dword/signed dword) 1 (byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2 @@ -2420,28 +2444,32 @@ Eliminating unused variable (byte*) SPRITES_MC and assignment [9] (byte*) SPRITE Eliminating unused variable (byte*) BGCOL and assignment [12] (byte*) BGCOL ← ((byte*)) (word/dword/signed dword) 53281 Eliminating unused variable (byte*) SPRITES_MC1 and assignment [13] (byte*) SPRITES_MC1 ← ((byte*)) (word/dword/signed dword) 53285 Eliminating unused variable (byte*) SPRITES_MC2 and assignment [14] (byte*) SPRITES_MC2 ← ((byte*)) (word/dword/signed dword) 53286 -Eliminating unused variable (byte) BLACK and assignment [17] (byte) BLACK ← (byte/signed byte/word/signed word/dword/signed dword) 0 -Eliminating unused variable (byte) WHITE and assignment [18] (byte) WHITE ← (byte/signed byte/word/signed word/dword/signed dword) 1 -Eliminating unused variable (byte) RED and assignment [19] (byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2 -Eliminating unused variable (byte) CYAN and assignment [20] (byte) CYAN ← (byte/signed byte/word/signed word/dword/signed dword) 3 -Eliminating unused variable (byte) PURPLE and assignment [21] (byte) PURPLE ← (byte/signed byte/word/signed word/dword/signed dword) 4 -Eliminating unused variable (byte) GREEN and assignment [22] (byte) GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 5 -Eliminating unused variable (byte) BLUE and assignment [23] (byte) BLUE ← (byte/signed byte/word/signed word/dword/signed dword) 6 -Eliminating unused variable (byte) YELLOW and assignment [24] (byte) YELLOW ← (byte/signed byte/word/signed word/dword/signed dword) 7 -Eliminating unused variable (byte) ORANGE and assignment [25] (byte) ORANGE ← (byte/signed byte/word/signed word/dword/signed dword) 8 -Eliminating unused variable (byte) BROWN and assignment [26] (byte) BROWN ← (byte/signed byte/word/signed word/dword/signed dword) 9 -Eliminating unused variable (byte) PINK and assignment [27] (byte) PINK ← (byte/signed byte/word/signed word/dword/signed dword) 10 -Eliminating unused variable (byte) DARK_GREY and assignment [28] (byte) DARK_GREY ← (byte/signed byte/word/signed word/dword/signed dword) 11 -Eliminating unused variable (byte) GREY and assignment [29] (byte) GREY ← (byte/signed byte/word/signed word/dword/signed dword) 12 -Eliminating unused variable (byte) LIGHT_GREEN and assignment [30] (byte) LIGHT_GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 13 -Eliminating unused variable (byte) LIGHT_BLUE and assignment [31] (byte) LIGHT_BLUE ← (byte/signed byte/word/signed word/dword/signed dword) 14 -Eliminating unused variable (byte) LIGHT_GREY and assignment [32] (byte) LIGHT_GREY ← (byte/signed byte/word/signed word/dword/signed dword) 15 +Eliminating unused variable (byte*) CIA1_PORT_A and assignment [17] (byte*) CIA1_PORT_A ← ((byte*)) (word/dword/signed dword) 56320 +Eliminating unused variable (byte*) CIA1_PORT_B and assignment [18] (byte*) CIA1_PORT_B ← ((byte*)) (word/dword/signed dword) 56321 +Eliminating unused variable (byte*) CIA1_PORT_A_DDR and assignment [19] (byte*) CIA1_PORT_A_DDR ← ((byte*)) (word/dword/signed dword) 56322 +Eliminating unused variable (byte*) CIA1_PORT_B_DDR and assignment [20] (byte*) CIA1_PORT_B_DDR ← ((byte*)) (word/dword/signed dword) 56323 +Eliminating unused variable (byte) BLACK and assignment [21] (byte) BLACK ← (byte/signed byte/word/signed word/dword/signed dword) 0 +Eliminating unused variable (byte) WHITE and assignment [22] (byte) WHITE ← (byte/signed byte/word/signed word/dword/signed dword) 1 +Eliminating unused variable (byte) RED and assignment [23] (byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2 +Eliminating unused variable (byte) CYAN and assignment [24] (byte) CYAN ← (byte/signed byte/word/signed word/dword/signed dword) 3 +Eliminating unused variable (byte) PURPLE and assignment [25] (byte) PURPLE ← (byte/signed byte/word/signed word/dword/signed dword) 4 +Eliminating unused variable (byte) GREEN and assignment [26] (byte) GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 5 +Eliminating unused variable (byte) BLUE and assignment [27] (byte) BLUE ← (byte/signed byte/word/signed word/dword/signed dword) 6 +Eliminating unused variable (byte) YELLOW and assignment [28] (byte) YELLOW ← (byte/signed byte/word/signed word/dword/signed dword) 7 +Eliminating unused variable (byte) ORANGE and assignment [29] (byte) ORANGE ← (byte/signed byte/word/signed word/dword/signed dword) 8 +Eliminating unused variable (byte) BROWN and assignment [30] (byte) BROWN ← (byte/signed byte/word/signed word/dword/signed dword) 9 +Eliminating unused variable (byte) PINK and assignment [31] (byte) PINK ← (byte/signed byte/word/signed word/dword/signed dword) 10 +Eliminating unused variable (byte) DARK_GREY and assignment [32] (byte) DARK_GREY ← (byte/signed byte/word/signed word/dword/signed dword) 11 +Eliminating unused variable (byte) GREY and assignment [33] (byte) GREY ← (byte/signed byte/word/signed word/dword/signed dword) 12 +Eliminating unused variable (byte) LIGHT_GREEN and assignment [34] (byte) LIGHT_GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 13 +Eliminating unused variable (byte) LIGHT_BLUE and assignment [35] (byte) LIGHT_BLUE ← (byte/signed byte/word/signed word/dword/signed dword) 14 +Eliminating unused variable (byte) LIGHT_GREY and assignment [36] (byte) LIGHT_GREY ← (byte/signed byte/word/signed word/dword/signed dword) 15 Eliminating unused variable - keeping the call (void~) setFAC::$1 Eliminating unused variable - keeping the call (void~) setMEMtoFAC::$0 Eliminating unused variable - keeping the call (void~) addMEMtoFAC::$0 Eliminating unused variable - keeping the call (void~) divMEMbyFAC::$0 Eliminating unused variable - keeping the call (void~) mulFACbyMEM::$0 -Eliminating unused variable (byte*) char_cursor and assignment [69] (byte*) char_cursor ← (byte*) line_cursor +Eliminating unused variable (byte*) char_cursor and assignment [73] (byte*) char_cursor ← (byte*) line_cursor Eliminating unused variable - keeping the call (void~) main::$0 Eliminating unused variable - keeping the call (void~) main::$2 Eliminating unused variable - keeping the call (void~) init::$0 diff --git a/src/test/java/dk/camelot64/kickc/test/ref/test-keyboard.asm b/src/test/java/dk/camelot64/kickc/test/ref/test-keyboard.asm index 2961ba5a4..f2d4dfc03 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/test-keyboard.asm +++ b/src/test/java/dk/camelot64/kickc/test/ref/test-keyboard.asm @@ -6,12 +6,61 @@ .label CIA1_PORT_B = $dc01 .label CIA1_PORT_A_DDR = $dc02 .label CIA1_PORT_B_DDR = $dc03 + .const KEY_3 = 8 + .const KEY_W = 9 + .const KEY_A = $a + .const KEY_4 = $b + .const KEY_Z = $c + .const KEY_S = $d + .const KEY_E = $e + .const KEY_5 = $10 + .const KEY_R = $11 + .const KEY_D = $12 + .const KEY_6 = $13 + .const KEY_C = $14 + .const KEY_F = $15 + .const KEY_T = $16 + .const KEY_X = $17 + .const KEY_7 = $18 + .const KEY_Y = $19 + .const KEY_G = $1a + .const KEY_8 = $1b + .const KEY_B = $1c + .const KEY_H = $1d + .const KEY_U = $1e + .const KEY_V = $1f + .const KEY_9 = $20 + .const KEY_I = $21 + .const KEY_J = $22 + .const KEY_0 = $23 + .const KEY_M = $24 + .const KEY_K = $25 + .const KEY_O = $26 + .const KEY_N = $27 + .const KEY_PLUS = $28 + .const KEY_L = $2a + .const KEY_MINUS = $2b + .const KEY_DOT = $2c + .const KEY_COLON = $2d + .const KEY_AT = $2e + .const KEY_COMMA = $2f + .const KEY_POUND = $30 + .const KEY_ASTERISK = $31 + .const KEY_SEMICOLON = $32 + .const KEY_EQUALS = $35 + .const KEY_ARROW_UP = $36 + .const KEY_SLASH = $37 + .const KEY_1 = $38 + .const KEY_ARROW_LEFT = $39 + .const KEY_2 = $3b + .const KEY_SPACE = $3c + .const KEY_Q = $3e jsr main main: { .label sc = 2 .label row_pressed_bits = 4 .label screen = 2 - .label ch = 4 + .label i = 4 lda #<$400 sta sc lda #>$400 @@ -76,67 +125,65 @@ main: { bcc !+ inc screen+1 !: - ldx #0 + lda #0 + sta i + tax b10: - lda chars,x - sta ch - jsr keyboard_char_pressed + jsr keyboard_get_keycode + cmp #$3f + beq b11 + sta keyboard_key_pressed.key + jsr keyboard_key_pressed cmp #0 beq b11 + ldy i txa - tay - lda ch sta (screen),y - b12: - inx - cpx #6 - bne b10 - jmp b5 + inc i b11: - txa - tay + inx + cpx #$40 + bne b10 + b13: lda #' ' + ldy i sta (screen),y - jmp b12 + inc i + lda i + cmp #5 + bcc b13 + jmp b5 b8: lda #'0' sta (screen),y jmp b9 - chars: .byte '@', 'a', 'b', 'c', 'd', 'e' } -keyboard_char_pressed: { - .label _1 = 5 - .label ch = 4 - ldy ch - jsr keyboard_matrix_row +keyboard_key_pressed: { + .label _1 = 6 + .label key = 5 + lda key + lsr + lsr + lsr jsr keyboard_matrix_read sta _1 - ldy ch - jsr keyboard_matrix_col - and _1 - rts -} -keyboard_matrix_col: { - lda keyboard_matrix_chars,y - lsr - lsr - lsr - lsr + lda #7 + and key tay lda keyboard_matrix_col_bitmask,y + and _1 rts } keyboard_matrix_read: { tay - lda keyboard_row_bits,y + lda keyboard_matrix_row_bitmask,y sta CIA1_PORT_A lda CIA1_PORT_B eor #$ff rts } -keyboard_matrix_row: { - lda keyboard_matrix_chars,y - and #$f +keyboard_get_keycode: { + lda keyboard_char_keycodes,x rts } keyboard_init: { @@ -146,6 +193,6 @@ keyboard_init: { sta CIA1_PORT_B_DDR rts } - keyboard_row_bits: .byte $fe, $fd, $fb, $f7, $ef, $df, $bf, $7f + keyboard_matrix_row_bitmask: .byte $fe, $fd, $fb, $f7, $ef, $df, $bf, $7f keyboard_matrix_col_bitmask: .byte 1, 2, 4, 8, $10, $20, $40, $80 - keyboard_matrix_chars: .byte $65, $21, $43, $42, $22, $61 + keyboard_char_keycodes: .byte KEY_AT, KEY_A, KEY_B, KEY_C, KEY_D, KEY_E, KEY_F, KEY_G, KEY_H, KEY_I, KEY_J, KEY_K, KEY_L, KEY_M, KEY_N, KEY_O, KEY_O, KEY_Q, KEY_R, KEY_S, KEY_T, KEY_U, KEY_V, KEY_W, KEY_X, KEY_Y, KEY_Z, $3f, KEY_POUND, $3f, KEY_ARROW_UP, KEY_ARROW_LEFT, KEY_SPACE, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, KEY_ASTERISK, KEY_PLUS, KEY_COMMA, KEY_MINUS, KEY_DOT, KEY_SLASH, KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_COLON, KEY_SEMICOLON, $3f, KEY_EQUALS, $3f, $3f diff --git a/src/test/java/dk/camelot64/kickc/test/ref/test-keyboard.cfg b/src/test/java/dk/camelot64/kickc/test/ref/test-keyboard.cfg index 30a47aefc..018823303 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/test-keyboard.cfg +++ b/src/test/java/dk/camelot64/kickc/test/ref/test-keyboard.cfg @@ -1,13 +1,13 @@ @begin: scope:[] from [0] phi() [ ] ( ) - to:@6 -@6: scope:[] from @begin + to:@5 +@5: scope:[] from @begin [1] phi() [ ] ( ) [2] call main param-assignment [ ] ( ) to:@end -@end: scope:[] from @6 +@end: scope:[] from @5 [3] phi() [ ] ( ) -main: scope:[main] from @6 +main: scope:[main] from @5 [4] phi() [ ] ( main:2 [ ] ) to:main::@1 main::@1: scope:[main] from main main::@1 @@ -15,12 +15,12 @@ main::@1: scope:[main] from main main::@1 [6] *((byte*) main::sc#2) ← (byte) ' ' [ main::sc#2 ] ( main:2 [ main::sc#2 ] ) [7] (byte*) main::sc#1 ← ++ (byte*) main::sc#2 [ main::sc#1 ] ( main:2 [ main::sc#1 ] ) [8] if((byte*) main::sc#1<(word/signed word/dword/signed dword) 1024+(word/signed word/dword/signed dword) 1000) goto main::@1 [ main::sc#1 ] ( main:2 [ main::sc#1 ] ) - to:main::@13 -main::@13: scope:[main] from main::@1 + to:main::@14 +main::@14: scope:[main] from main::@1 [9] phi() [ ] ( main:2 [ ] ) [10] call keyboard_init param-assignment [ ] ( main:2 [ ] ) to:main::@2 -main::@2: scope:[main] from main::@12 main::@13 +main::@2: scope:[main] from main::@13 main::@14 [11] if(true) goto main::@5 [ ] ( main:2 [ ] ) to:main::@return main::@return: scope:[main] from main::@2 @@ -29,107 +29,104 @@ main::@return: scope:[main] from main::@2 main::@5: scope:[main] from main::@2 main::@5 [13] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) 255) goto main::@5 [ ] ( main:2 [ ] ) to:main::@6 -main::@6: scope:[main] from main::@19 main::@5 - [14] (byte*) main::screen#12 ← phi( main::@5/((byte*))(word/signed word/dword/signed dword) 1024 main::@19/(byte*) main::screen#1 ) [ main::row#2 main::screen#12 ] ( main:2 [ main::row#2 main::screen#12 ] ) - [14] (byte) main::row#2 ← phi( main::@5/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@19/(byte) main::row#1 ) [ main::row#2 main::screen#12 ] ( main:2 [ main::row#2 main::screen#12 ] ) - [15] (byte) keyboard_matrix_read::rowid#0 ← (byte) main::row#2 [ main::row#2 main::screen#12 keyboard_matrix_read::rowid#0 ] ( main:2 [ main::row#2 main::screen#12 keyboard_matrix_read::rowid#0 ] ) - [16] call keyboard_matrix_read param-assignment [ main::row#2 main::screen#12 keyboard_matrix_read::return#2 ] ( main:2 [ main::row#2 main::screen#12 keyboard_matrix_read::return#2 ] ) - [17] (byte) keyboard_matrix_read::return#0 ← (byte) keyboard_matrix_read::return#2 [ main::row#2 main::screen#12 keyboard_matrix_read::return#0 ] ( main:2 [ main::row#2 main::screen#12 keyboard_matrix_read::return#0 ] ) - to:main::@26 -main::@26: scope:[main] from main::@6 - [18] (byte) main::row_pressed_bits#0 ← (byte) keyboard_matrix_read::return#0 [ main::row#2 main::screen#12 main::row_pressed_bits#0 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#0 ] ) +main::@6: scope:[main] from main::@20 main::@5 + [14] (byte*) main::screen#13 ← phi( main::@5/((byte*))(word/signed word/dword/signed dword) 1024 main::@20/(byte*) main::screen#1 ) [ main::row#2 main::screen#13 ] ( main:2 [ main::row#2 main::screen#13 ] ) + [14] (byte) main::row#2 ← phi( main::@5/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@20/(byte) main::row#1 ) [ main::row#2 main::screen#13 ] ( main:2 [ main::row#2 main::screen#13 ] ) + [15] (byte) keyboard_matrix_read::rowid#1 ← (byte) main::row#2 [ main::row#2 main::screen#13 keyboard_matrix_read::rowid#1 ] ( main:2 [ main::row#2 main::screen#13 keyboard_matrix_read::rowid#1 ] ) + [16] call keyboard_matrix_read param-assignment [ main::row#2 main::screen#13 keyboard_matrix_read::return#0 ] ( main:2 [ main::row#2 main::screen#13 keyboard_matrix_read::return#0 ] ) + [17] (byte) keyboard_matrix_read::return#3 ← (byte) keyboard_matrix_read::return#0 [ main::row#2 main::screen#13 keyboard_matrix_read::return#3 ] ( main:2 [ main::row#2 main::screen#13 keyboard_matrix_read::return#3 ] ) + to:main::@28 +main::@28: scope:[main] from main::@6 + [18] (byte) main::row_pressed_bits#0 ← (byte) keyboard_matrix_read::return#3 [ main::row#2 main::screen#13 main::row_pressed_bits#0 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#0 ] ) to:main::@7 -main::@7: scope:[main] from main::@26 main::@9 - [19] (byte) main::col#2 ← phi( main::@26/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@9/(byte) main::col#1 ) [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ) - [19] (byte) main::row_pressed_bits#2 ← phi( main::@26/(byte) main::row_pressed_bits#0 main::@9/(byte) main::row_pressed_bits#1 ) [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ) - [20] (byte~) main::$5 ← (byte) main::row_pressed_bits#2 & (byte/word/signed word/dword/signed dword) 128 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 main::$5 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 main::$5 ] ) - [21] if((byte~) main::$5==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@8 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ) - to:main::@17 -main::@17: scope:[main] from main::@7 - [22] *((byte*) main::screen#12 + (byte) main::col#2) ← (byte) '1' [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ) +main::@7: scope:[main] from main::@28 main::@9 + [19] (byte) main::col#2 ← phi( main::@28/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@9/(byte) main::col#1 ) [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ) + [19] (byte) main::row_pressed_bits#2 ← phi( main::@28/(byte) main::row_pressed_bits#0 main::@9/(byte) main::row_pressed_bits#1 ) [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ) + [20] (byte~) main::$5 ← (byte) main::row_pressed_bits#2 & (byte/word/signed word/dword/signed dword) 128 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 main::$5 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 main::$5 ] ) + [21] if((byte~) main::$5==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@8 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ) + to:main::@18 +main::@18: scope:[main] from main::@7 + [22] *((byte*) main::screen#13 + (byte) main::col#2) ← (byte) '1' [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ) to:main::@9 -main::@9: scope:[main] from main::@17 main::@8 - [23] (byte) main::row_pressed_bits#1 ← (byte) main::row_pressed_bits#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ main::row#2 main::screen#12 main::col#2 main::row_pressed_bits#1 ] ( main:2 [ main::row#2 main::screen#12 main::col#2 main::row_pressed_bits#1 ] ) - [24] (byte) main::col#1 ← ++ (byte) main::col#2 [ main::row#2 main::screen#12 main::row_pressed_bits#1 main::col#1 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#1 main::col#1 ] ) - [25] if((byte) main::col#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@7 [ main::row#2 main::screen#12 main::row_pressed_bits#1 main::col#1 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#1 main::col#1 ] ) - to:main::@19 -main::@19: scope:[main] from main::@9 - [26] (byte*) main::screen#1 ← (byte*) main::screen#12 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::row#2 main::screen#1 ] ( main:2 [ main::row#2 main::screen#1 ] ) +main::@9: scope:[main] from main::@18 main::@8 + [23] (byte) main::row_pressed_bits#1 ← (byte) main::row_pressed_bits#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ main::row#2 main::screen#13 main::col#2 main::row_pressed_bits#1 ] ( main:2 [ main::row#2 main::screen#13 main::col#2 main::row_pressed_bits#1 ] ) + [24] (byte) main::col#1 ← ++ (byte) main::col#2 [ main::row#2 main::screen#13 main::row_pressed_bits#1 main::col#1 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#1 main::col#1 ] ) + [25] if((byte) main::col#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@7 [ main::row#2 main::screen#13 main::row_pressed_bits#1 main::col#1 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#1 main::col#1 ] ) + to:main::@20 +main::@20: scope:[main] from main::@9 + [26] (byte*) main::screen#1 ← (byte*) main::screen#13 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::row#2 main::screen#1 ] ( main:2 [ main::row#2 main::screen#1 ] ) [27] (byte) main::row#1 ← ++ (byte) main::row#2 [ main::row#1 main::screen#1 ] ( main:2 [ main::row#1 main::screen#1 ] ) [28] if((byte) main::row#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@6 [ main::row#1 main::screen#1 ] ( main:2 [ main::row#1 main::screen#1 ] ) - to:main::@20 -main::@20: scope:[main] from main::@19 + to:main::@21 +main::@21: scope:[main] from main::@20 [29] (byte*) main::screen#2 ← (byte*) main::screen#1 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::screen#2 ] ( main:2 [ main::screen#2 ] ) to:main::@10 -main::@10: scope:[main] from main::@12 main::@20 - [30] (byte) main::i#2 ← phi( main::@12/(byte) main::i#1 main::@20/(byte/signed byte/word/signed word/dword/signed dword) 0 ) [ main::screen#2 main::i#2 ] ( main:2 [ main::screen#2 main::i#2 ] ) - [31] (byte) main::ch#0 ← *((const byte[]) main::chars#0 + (byte) main::i#2) [ main::screen#2 main::i#2 main::ch#0 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 ] ) - [32] (byte) keyboard_char_pressed::ch#0 ← (byte) main::ch#0 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 ] ) - [33] call keyboard_char_pressed param-assignment [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#1 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#1 ] ) - [34] (byte) keyboard_char_pressed::return#0 ← (byte) keyboard_char_pressed::return#1 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#0 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#0 ] ) - to:main::@27 -main::@27: scope:[main] from main::@10 - [35] (byte~) main::$13 ← (byte) keyboard_char_pressed::return#0 [ main::screen#2 main::i#2 main::ch#0 main::$13 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 main::$13 ] ) - [36] if((byte~) main::$13==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@11 [ main::screen#2 main::i#2 main::ch#0 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 ] ) - to:main::@21 -main::@21: scope:[main] from main::@27 - [37] *((byte*) main::screen#2 + (byte) main::i#2) ← (byte) main::ch#0 [ main::screen#2 main::i#2 ] ( main:2 [ main::screen#2 main::i#2 ] ) - to:main::@12 -main::@12: scope:[main] from main::@11 main::@21 - [38] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::screen#2 main::i#1 ] ( main:2 [ main::screen#2 main::i#1 ] ) - [39] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 6) goto main::@10 [ main::screen#2 main::i#1 ] ( main:2 [ main::screen#2 main::i#1 ] ) +main::@10: scope:[main] from main::@11 main::@21 + [30] (byte) main::i#10 ← phi( main::@11/(byte) main::i#6 main::@21/(byte/signed byte/word/signed word/dword/signed dword) 0 ) [ main::screen#2 main::ch#2 main::i#10 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 ] ) + [30] (byte) main::ch#2 ← phi( main::@11/(byte) main::ch#1 main::@21/(byte/signed byte/word/signed word/dword/signed dword) 0 ) [ main::screen#2 main::ch#2 main::i#10 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 ] ) + [31] (byte) keyboard_get_keycode::ch#0 ← (byte) main::ch#2 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::ch#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::ch#0 ] ) + [32] call keyboard_get_keycode param-assignment [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#0 ] ) + [33] (byte) keyboard_get_keycode::return#2 ← (byte) keyboard_get_keycode::return#0 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#2 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#2 ] ) + to:main::@29 +main::@29: scope:[main] from main::@10 + [34] (byte) main::key#0 ← (byte) keyboard_get_keycode::return#2 [ main::screen#2 main::ch#2 main::i#10 main::key#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 main::key#0 ] ) + [35] if((byte) main::key#0==(byte/signed byte/word/signed word/dword/signed dword) 63) goto main::@11 [ main::screen#2 main::ch#2 main::i#10 main::key#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 main::key#0 ] ) + to:main::@22 +main::@22: scope:[main] from main::@29 + [36] (byte) keyboard_key_pressed::key#0 ← (byte) main::key#0 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 ] ) + [37] call keyboard_key_pressed param-assignment [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#0 ] ) + [38] (byte) keyboard_key_pressed::return#2 ← (byte) keyboard_key_pressed::return#0 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#2 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#2 ] ) + to:main::@30 +main::@30: scope:[main] from main::@22 + [39] (byte~) main::$16 ← (byte) keyboard_key_pressed::return#2 [ main::screen#2 main::ch#2 main::i#10 main::$16 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 main::$16 ] ) + [40] if((byte~) main::$16==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@11 [ main::screen#2 main::ch#2 main::i#10 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 ] ) + to:main::@23 +main::@23: scope:[main] from main::@30 + [41] *((byte*) main::screen#2 + (byte) main::i#10) ← (byte) main::ch#2 [ main::screen#2 main::ch#2 main::i#10 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 ] ) + [42] (byte) main::i#1 ← ++ (byte) main::i#10 [ main::screen#2 main::ch#2 main::i#1 ] ( main:2 [ main::screen#2 main::ch#2 main::i#1 ] ) + to:main::@11 +main::@11: scope:[main] from main::@23 main::@29 main::@30 + [43] (byte) main::i#6 ← phi( main::@30/(byte) main::i#10 main::@23/(byte) main::i#1 main::@29/(byte) main::i#10 ) [ main::screen#2 main::ch#2 main::i#6 ] ( main:2 [ main::screen#2 main::ch#2 main::i#6 ] ) + [44] (byte) main::ch#1 ← ++ (byte) main::ch#2 [ main::screen#2 main::ch#1 main::i#6 ] ( main:2 [ main::screen#2 main::ch#1 main::i#6 ] ) + [45] if((byte) main::ch#1!=(byte/signed byte/word/signed word/dword/signed dword) 64) goto main::@10 [ main::screen#2 main::ch#1 main::i#6 ] ( main:2 [ main::screen#2 main::ch#1 main::i#6 ] ) + to:main::@13 +main::@13: scope:[main] from main::@11 main::@13 + [46] (byte) main::i#4 ← phi( main::@11/(byte) main::i#6 main::@13/(byte) main::i#2 ) [ main::screen#2 main::i#4 ] ( main:2 [ main::screen#2 main::i#4 ] ) + [47] *((byte*) main::screen#2 + (byte) main::i#4) ← (byte) ' ' [ main::screen#2 main::i#4 ] ( main:2 [ main::screen#2 main::i#4 ] ) + [48] (byte) main::i#2 ← ++ (byte) main::i#4 [ main::screen#2 main::i#2 ] ( main:2 [ main::screen#2 main::i#2 ] ) + [49] if((byte) main::i#2<(byte/signed byte/word/signed word/dword/signed dword) 5) goto main::@13 [ main::screen#2 main::i#2 ] ( main:2 [ main::screen#2 main::i#2 ] ) to:main::@2 -main::@11: scope:[main] from main::@27 - [40] *((byte*) main::screen#2 + (byte) main::i#2) ← (byte) ' ' [ main::screen#2 main::i#2 ] ( main:2 [ main::screen#2 main::i#2 ] ) - to:main::@12 main::@8: scope:[main] from main::@7 - [41] *((byte*) main::screen#12 + (byte) main::col#2) ← (byte) '0' [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ) + [50] *((byte*) main::screen#13 + (byte) main::col#2) ← (byte) '0' [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ) to:main::@9 -keyboard_char_pressed: scope:[keyboard_char_pressed] from main::@10 - [42] (byte) keyboard_matrix_row::ch#0 ← (byte) keyboard_char_pressed::ch#0 [ keyboard_char_pressed::ch#0 keyboard_matrix_row::ch#0 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_row::ch#0 ] ) - [43] call keyboard_matrix_row param-assignment [ keyboard_char_pressed::ch#0 keyboard_matrix_row::return#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_row::return#1 ] ) - [44] (byte) keyboard_matrix_row::return#0 ← (byte) keyboard_matrix_row::return#1 [ keyboard_char_pressed::ch#0 keyboard_matrix_row::return#0 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_row::return#0 ] ) - to:keyboard_char_pressed::@2 -keyboard_char_pressed::@2: scope:[keyboard_char_pressed] from keyboard_char_pressed - [45] (byte) keyboard_matrix_read::rowid#1 ← (byte) keyboard_matrix_row::return#0 [ keyboard_char_pressed::ch#0 keyboard_matrix_read::rowid#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_read::rowid#1 ] ) - [46] call keyboard_matrix_read param-assignment [ keyboard_matrix_read::return#2 keyboard_char_pressed::ch#0 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_matrix_read::return#2 keyboard_char_pressed::ch#0 ] ) - [47] (byte) keyboard_matrix_read::return#1 ← (byte) keyboard_matrix_read::return#2 [ keyboard_char_pressed::ch#0 keyboard_matrix_read::return#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_read::return#1 ] ) - to:keyboard_char_pressed::@3 -keyboard_char_pressed::@3: scope:[keyboard_char_pressed] from keyboard_char_pressed::@2 - [48] (byte~) keyboard_char_pressed::$1 ← (byte) keyboard_matrix_read::return#1 [ keyboard_char_pressed::ch#0 keyboard_char_pressed::$1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_char_pressed::$1 ] ) - [49] (byte) keyboard_matrix_col::ch#0 ← (byte) keyboard_char_pressed::ch#0 [ keyboard_char_pressed::$1 keyboard_matrix_col::ch#0 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::ch#0 ] ) - [50] call keyboard_matrix_col param-assignment [ keyboard_char_pressed::$1 keyboard_matrix_col::return#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::return#1 ] ) - [51] (byte) keyboard_matrix_col::return#0 ← (byte) keyboard_matrix_col::return#1 [ keyboard_char_pressed::$1 keyboard_matrix_col::return#0 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::return#0 ] ) - to:keyboard_char_pressed::@4 -keyboard_char_pressed::@4: scope:[keyboard_char_pressed] from keyboard_char_pressed::@3 - [52] (byte~) keyboard_char_pressed::$2 ← (byte) keyboard_matrix_col::return#0 [ keyboard_char_pressed::$1 keyboard_char_pressed::$2 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_char_pressed::$2 ] ) - [53] (byte) keyboard_char_pressed::return#1 ← (byte~) keyboard_char_pressed::$1 & (byte~) keyboard_char_pressed::$2 [ keyboard_char_pressed::return#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#1 ] ) - to:keyboard_char_pressed::@return -keyboard_char_pressed::@return: scope:[keyboard_char_pressed] from keyboard_char_pressed::@4 - [54] return [ keyboard_char_pressed::return#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#1 ] ) +keyboard_key_pressed: scope:[keyboard_key_pressed] from main::@22 + [51] (byte) keyboard_matrix_read::rowid#0 ← (byte) keyboard_key_pressed::key#0 >> (byte/signed byte/word/signed word/dword/signed dword) 3 [ keyboard_key_pressed::key#0 keyboard_matrix_read::rowid#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_matrix_read::rowid#0 ] ) + [52] call keyboard_matrix_read param-assignment [ keyboard_matrix_read::return#0 keyboard_key_pressed::key#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_matrix_read::return#0 keyboard_key_pressed::key#0 ] ) + [53] (byte) keyboard_matrix_read::return#2 ← (byte) keyboard_matrix_read::return#0 [ keyboard_key_pressed::key#0 keyboard_matrix_read::return#2 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_matrix_read::return#2 ] ) + to:keyboard_key_pressed::@2 +keyboard_key_pressed::@2: scope:[keyboard_key_pressed] from keyboard_key_pressed + [54] (byte~) keyboard_key_pressed::$1 ← (byte) keyboard_matrix_read::return#2 [ keyboard_key_pressed::key#0 keyboard_key_pressed::$1 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_key_pressed::$1 ] ) + [55] (byte~) keyboard_key_pressed::$2 ← (byte) keyboard_key_pressed::key#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ keyboard_key_pressed::$1 keyboard_key_pressed::$2 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::$1 keyboard_key_pressed::$2 ] ) + [56] (byte) keyboard_key_pressed::return#0 ← (byte~) keyboard_key_pressed::$1 & *((const byte[]) keyboard_matrix_col_bitmask#0 + (byte~) keyboard_key_pressed::$2) [ keyboard_key_pressed::return#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#0 ] ) + to:keyboard_key_pressed::@return +keyboard_key_pressed::@return: scope:[keyboard_key_pressed] from keyboard_key_pressed::@2 + [57] return [ keyboard_key_pressed::return#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#0 ] ) to:@return -keyboard_matrix_col: scope:[keyboard_matrix_col] from keyboard_char_pressed::@3 - [55] (byte) keyboard_matrix_col::col_id#0 ← *((const byte[]) keyboard_matrix_chars#0 + (byte) keyboard_matrix_col::ch#0) >> (byte/signed byte/word/signed word/dword/signed dword) 4 [ keyboard_matrix_col::col_id#0 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_col:50 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::col_id#0 ] ) - [56] (byte) keyboard_matrix_col::return#1 ← *((const byte[]) keyboard_matrix_col_bitmask#0 + (byte) keyboard_matrix_col::col_id#0) [ keyboard_matrix_col::return#1 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_col:50 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::return#1 ] ) - to:keyboard_matrix_col::@return -keyboard_matrix_col::@return: scope:[keyboard_matrix_col] from keyboard_matrix_col - [57] return [ keyboard_matrix_col::return#1 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_col:50 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::return#1 ] ) - to:@return -keyboard_matrix_read: scope:[keyboard_matrix_read] from keyboard_char_pressed::@2 main::@6 - [58] (byte) keyboard_matrix_read::rowid#2 ← phi( keyboard_char_pressed::@2/(byte) keyboard_matrix_read::rowid#1 main::@6/(byte) keyboard_matrix_read::rowid#0 ) [ keyboard_matrix_read::rowid#2 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#12 keyboard_matrix_read::rowid#2 ] main:2::keyboard_char_pressed:33::keyboard_matrix_read:46 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_read::rowid#2 ] ) - [59] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_row_bits#0 + (byte) keyboard_matrix_read::rowid#2) [ ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#12 ] main:2::keyboard_char_pressed:33::keyboard_matrix_read:46 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 ] ) - [60] (byte) keyboard_matrix_read::return#2 ← ~ *((const byte*) CIA1_PORT_B#0) [ keyboard_matrix_read::return#2 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#12 keyboard_matrix_read::return#2 ] main:2::keyboard_char_pressed:33::keyboard_matrix_read:46 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_read::return#2 ] ) +keyboard_matrix_read: scope:[keyboard_matrix_read] from keyboard_key_pressed main::@6 + [58] (byte) keyboard_matrix_read::rowid#2 ← phi( keyboard_key_pressed/(byte) keyboard_matrix_read::rowid#0 main::@6/(byte) keyboard_matrix_read::rowid#1 ) [ keyboard_matrix_read::rowid#2 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#13 keyboard_matrix_read::rowid#2 ] main:2::keyboard_key_pressed:37::keyboard_matrix_read:52 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_matrix_read::rowid#2 ] ) + [59] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#2) [ ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#13 ] main:2::keyboard_key_pressed:37::keyboard_matrix_read:52 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 ] ) + [60] (byte) keyboard_matrix_read::return#0 ← ~ *((const byte*) CIA1_PORT_B#0) [ keyboard_matrix_read::return#0 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#13 keyboard_matrix_read::return#0 ] main:2::keyboard_key_pressed:37::keyboard_matrix_read:52 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_matrix_read::return#0 ] ) to:keyboard_matrix_read::@return keyboard_matrix_read::@return: scope:[keyboard_matrix_read] from keyboard_matrix_read - [61] return [ keyboard_matrix_read::return#2 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#12 keyboard_matrix_read::return#2 ] main:2::keyboard_char_pressed:33::keyboard_matrix_read:46 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_read::return#2 ] ) + [61] return [ keyboard_matrix_read::return#0 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#13 keyboard_matrix_read::return#0 ] main:2::keyboard_key_pressed:37::keyboard_matrix_read:52 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_matrix_read::return#0 ] ) to:@return -keyboard_matrix_row: scope:[keyboard_matrix_row] from keyboard_char_pressed - [62] (byte) keyboard_matrix_row::return#1 ← *((const byte[]) keyboard_matrix_chars#0 + (byte) keyboard_matrix_row::ch#0) & (byte/signed byte/word/signed word/dword/signed dword) 15 [ keyboard_matrix_row::return#1 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_row:43 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_row::return#1 ] ) - to:keyboard_matrix_row::@return -keyboard_matrix_row::@return: scope:[keyboard_matrix_row] from keyboard_matrix_row - [63] return [ keyboard_matrix_row::return#1 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_row:43 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_row::return#1 ] ) +keyboard_get_keycode: scope:[keyboard_get_keycode] from main::@10 + [62] (byte) keyboard_get_keycode::return#0 ← *((const byte[]) keyboard_char_keycodes#0 + (byte) keyboard_get_keycode::ch#0) [ keyboard_get_keycode::return#0 ] ( main:2::keyboard_get_keycode:32 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#0 ] ) + to:keyboard_get_keycode::@return +keyboard_get_keycode::@return: scope:[keyboard_get_keycode] from keyboard_get_keycode + [63] return [ keyboard_get_keycode::return#0 ] ( main:2::keyboard_get_keycode:32 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#0 ] ) to:@return -keyboard_init: scope:[keyboard_init] from main::@13 +keyboard_init: scope:[keyboard_init] from main::@14 [64] *((const byte*) CIA1_PORT_A_DDR#0) ← (byte/word/signed word/dword/signed dword) 255 [ ] ( main:2::keyboard_init:10 [ ] ) [65] *((const byte*) CIA1_PORT_B_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::keyboard_init:10 [ ] ) to:keyboard_init::@return diff --git a/src/test/java/dk/camelot64/kickc/test/ref/test-keyboard.log b/src/test/java/dk/camelot64/kickc/test/ref/test-keyboard.log index b26fd4fb0..ba822cfa8 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/test-keyboard.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/test-keyboard.log @@ -1,14 +1,7 @@ PARSING src/test/java/dk/camelot64/kickc/test/kc/test-keyboard.kc -import "c64.kc" +// Test keyboard input - in the keyboard matrix and mapping screen codes to key codes -// CIA#1 Port A: keyboard matrix columns and joystick #2 -const byte* CIA1_PORT_A = $dc00; -// CIA#1 Port B: keyboard matrix rows and joystick #1. -const byte* CIA1_PORT_B = $dc01; -// CIA #1 Port A data direction register. -const byte* CIA1_PORT_A_DDR = $dc02; -// CIA #1 Port B data direction register. -const byte* CIA1_PORT_B_DDR = $dc03; +import "keyboard.kc" void main() { // Clear screen @@ -17,6 +10,7 @@ void main() { } // Init keyboard keyboard_init(); + // Loop while(true) { do {} while (*RASTER!=$ff); byte* screen = $400; @@ -34,78 +28,30 @@ void main() { screen = screen + 40; } screen = screen + 40; - // Checks specific chars - byte[] chars = { '@', 'a', 'b', 'c', 'd', 'e' }; - for( byte i : 0..5 ) { - byte ch = chars[i]; - if(keyboard_char_pressed(ch)!=0) { - screen[i] = ch; - } else { - screen[i] = ' '; + // Checks all specific chars $00-$3f + byte i = 0; + for( byte ch : 0..$3f ) { + byte key = keyboard_get_keycode(ch); + if(key!=$3f) { + if(keyboard_key_pressed(key)!=0) { + screen[i++] = ch; + } } } + // Add some spaces + do { + screen[i++] = ' '; + } while (i<5); } } -// Initialize keyboard reading by setting CIA#$ Data Direction Registers -void keyboard_init() { - // Keyboard Matrix Columns Write Mode - *CIA1_PORT_A_DDR = $ff; - // Keyboard Matrix Columns Read Mode - *CIA1_PORT_B_DDR = $00; -} - -// Determines whether a specific key representing a PETSCII char is currently pressed -// Returns zero if the key is not pressed and a non-zero value if the key is currently pressed -byte keyboard_char_pressed(byte ch) { - return keyboard_matrix_read(keyboard_matrix_row(ch)) & keyboard_matrix_col(ch); -} - -// Keyboard row bits as expected by CIA#1 Port A when reading a specific keyboard matrix row (rows are numbered 0-7) -byte[8] keyboard_row_bits = { %11111110, %11111101, %11111011, %11110111, %11101111, %11011111, %10111111, %01111111 }; - -// Read a single row of the keyboard matrix -// The row ID (0-7) of the keyboard matrix row to read. See the C64 key matrix for row IDs. -// Returns the keys pressed on the row as bits according to the C64 key matrix. -byte keyboard_matrix_read(byte rowid) { - *CIA1_PORT_A = keyboard_row_bits[rowid]; - byte row_pressed_bits = ~*CIA1_PORT_B; - return row_pressed_bits; -} - -// Keyboard matrix column bitmasks for a specific keybooard matrix column when reading the keyboard. (columns are numbered 0-7) -byte[] keyboard_matrix_col_bitmask = { %00000001, %00000010, %00000100, %00001000, %00010000, %00100000, %01000000, %10000000 }; - -// The keyboard matrix position of each PETSCII char between $00 and $3f (lower case) -// Matrix positions are encoded as column ID (0-7) in the high nibble and row ID (0-7) in the low nibble %ccccrrrr -byte[] keyboard_matrix_chars = { -// CR Char - $65, // ($00) @ - $21, // ($01) a - $43, // ($02) b - $42, // ($03) c - $22, // ($04) d - $61 // ($05) e -}; - -// Get the row ID of the keyboard matrix row containing a specific PETSCII char -// Returns the row ID (0-7) of the keyboard matrix row containing the passed char -// The row ID is suitable for passing to keyboard_matrix_read(rowid) -byte keyboard_matrix_row(byte ch) { - return keyboard_matrix_chars[ch] & $f; -} - -// Get the column bit mask of the keyboard matrix column containing a specific PETSCII char. -// Returns the keyboard matrix column bit mask of the passed char. -// The returned bit is suitable for ANDing with the result of keyboard_matrix_read(rowid) to determine if the corresponding key is pressed. -byte keyboard_matrix_col(byte ch) { - byte col_id = keyboard_matrix_chars[ch] >>4; - return keyboard_matrix_col_bitmask[col_id]; -} - +Importing keyboard.kc +PARSING src/test/java/dk/camelot64/kickc/test/kc/keyboard.kc +// Simple Keyboard Input Library // C64 Keyboard Matrix Reference - from http://codebase64.org/doku.php?id=base:reading_the_keyboard +// Keyboard Codes are %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7) // +----+----------------------+-------------------------------------------------------------------------------------------------------+ -// | | Write | Read $dc01 (PETSCII code in parenthesis): | +// | | Write | Read $dc01 (C64 screen code in parenthesis): | // |row:| $dc00: row bits +------------+------------+------------+------------+------------+------------+------------+------------+ // | | | BIT 7 | BIT 6 | BIT 5 | BIT 4 | BIT 3 | BIT 2 | BIT 1 | BIT 0 | // +----+----------------------+------------+------------+------------+------------+------------+------------+------------+------------+ @@ -118,6 +64,127 @@ byte keyboard_matrix_col(byte ch) { // |6. | #%10111111 (191/$bf) | / ($2f)| ^ ($1e)| = ($3d)|RGHT-SH($ )| HOME ($ )| ; ($3b)| * ($2a)| £ ($1c)| // |7. | #%01111111 (127/$7f) | STOP ($ )| q ($11)|COMMODR($ )| SPACE ($20)| 2 ($32)|CONTROL($ )| <- ($1f)| 1 ($31)| // +----+----------------------+------------+------------+------------+------------+------------+------------+------------+------------+ + +import "c64.kc" + +// Keyboard Codes for all 63 keys. +// Keyboard Codes are %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7). +// See C64 Keyboard Matrix Reference http://codebase64.org/doku.php?id=base:reading_the_keyboard +const byte KEY_DEL = $00; +const byte KEY_RETURN = $01; +const byte KEY_CRSR_RIGHT = $02; +const byte KEY_F7 = $03; +const byte KEY_F5 = $04; +const byte KEY_F3 = $05; +const byte KEY_F1 = $06; +const byte KEY_CRSR_DOWN = $07; +const byte KEY_3 = $08; +const byte KEY_W = $09; +const byte KEY_A = $0a; +const byte KEY_4 = $0b; +const byte KEY_Z = $0c; +const byte KEY_S = $0d; +const byte KEY_E = $0e; +const byte KEY_LSHIFT = $0f; +const byte KEY_5 = $10; +const byte KEY_R = $11; +const byte KEY_D = $12; +const byte KEY_6 = $13; +const byte KEY_C = $14; +const byte KEY_F = $15; +const byte KEY_T = $16; +const byte KEY_X = $17; +const byte KEY_7 = $18; +const byte KEY_Y = $19; +const byte KEY_G = $1a; +const byte KEY_8 = $1b; +const byte KEY_B = $1c; +const byte KEY_H = $1d; +const byte KEY_U = $1e; +const byte KEY_V = $1f; +const byte KEY_9 = $20; +const byte KEY_I = $21; +const byte KEY_J = $22; +const byte KEY_0 = $23; +const byte KEY_M = $24; +const byte KEY_K = $25; +const byte KEY_O = $26; +const byte KEY_N = $27; +const byte KEY_PLUS = $28; +const byte KEY_P = $29; +const byte KEY_L = $2a; +const byte KEY_MINUS = $2b; +const byte KEY_DOT = $2c; +const byte KEY_COLON = $2d; +const byte KEY_AT = $2e; +const byte KEY_COMMA = $2f; +const byte KEY_POUND = $30; +const byte KEY_ASTERISK = $31; +const byte KEY_SEMICOLON = $32; +const byte KEY_HOME = $33; +const byte KEY_RSHIFT = $34; +const byte KEY_EQUALS = $35; +const byte KEY_ARROW_UP = $36; +const byte KEY_SLASH = $37; +const byte KEY_1 = $38; +const byte KEY_ARROW_LEFT = $39; +const byte KEY_CTRL = $3a; +const byte KEY_2 = $3b; +const byte KEY_SPACE = $3c; +const byte KEY_COMMODORE = $3d; +const byte KEY_Q = $3e; +const byte KEY_RUNSTOP = $3f; + +// Keycodes for each screen code character from $00-$3f. +// Chars that do not have an unmodified keycode return $3f (representing RUN/STOP). +const byte[] keyboard_char_keycodes = { + /*@*/KEY_AT, /*a*/KEY_A, /*b*/KEY_B, /*c*/KEY_C, /*d*/KEY_D, /*e*/KEY_E, /*f*/KEY_F, /*g*/KEY_G, + /*h*/KEY_H, /*i*/KEY_I, /*j*/KEY_J, /*k*/KEY_K, /*l*/KEY_L, /*m*/KEY_M, /*n*/KEY_N, /*o*/KEY_O, + /*p*/KEY_O, /*q*/KEY_Q, /*r*/KEY_R, /*s*/KEY_S, /*t*/KEY_T, /*u*/KEY_U, /*v*/KEY_V, /*w*/KEY_W, + /*x*/KEY_X, /*y*/KEY_Y, /*z*/KEY_Z, /*[*/$3f, /*£*/KEY_POUND, /*]*/$3f, /*^*/KEY_ARROW_UP, /*<-*/KEY_ARROW_LEFT, + /* */KEY_SPACE, /*!*/$3f, /*"*/$3f, /*#*/$3f, /*$*/$3f, /*%*/$3f, /*&*/$3f, /*´*/$3f, + /*(*/$3f, /*)*/$3f, /***/KEY_ASTERISK, /*+*/KEY_PLUS, /*,*/KEY_COMMA, /*-*/KEY_MINUS, /*.*/KEY_DOT, /*/*/KEY_SLASH, + /*0*/KEY_0, /*1*/KEY_1, /*2*/KEY_2, /*3*/KEY_3, /*4*/KEY_4, /*5*/KEY_5, /*6*/KEY_6, /*7*/KEY_7, + /*8*/KEY_8, /*9*/KEY_9, /*:*/KEY_COLON, /*;*/KEY_SEMICOLON, /*<*/$3f, /*=*/KEY_EQUALS, /*>*/$3f, /*?*/$3f +}; + +// Keyboard row bitmask as expected by CIA#1 Port A when reading a specific keyboard matrix row (rows are numbered 0-7) +byte[8] keyboard_matrix_row_bitmask = { %11111110, %11111101, %11111011, %11110111, %11101111, %11011111, %10111111, %01111111 }; + +// Keyboard matrix column bitmasks for a specific keybooard matrix column when reading the keyboard. (columns are numbered 0-7) +byte[] keyboard_matrix_col_bitmask = { %00000001, %00000010, %00000100, %00001000, %00010000, %00100000, %01000000, %10000000 }; + +// Initialize keyboard reading by setting CIA#$ Data Direction Registers +void keyboard_init() { + // Keyboard Matrix Columns Write Mode + *CIA1_PORT_A_DDR = $ff; + // Keyboard Matrix Columns Read Mode + *CIA1_PORT_B_DDR = $00; +} +// Read a single row of the keyboard matrix +// The row ID (0-7) of the keyboard matrix row to read. See the C64 key matrix for row IDs. +// Returns the keys pressed on the row as bits according to the C64 key matrix. +byte keyboard_matrix_read(byte rowid) { + *CIA1_PORT_A = keyboard_matrix_row_bitmask[rowid]; + byte row_pressed_bits = ~*CIA1_PORT_B; + return row_pressed_bits; +} + +// Determines whether a specific key is currently pressed +// The key is a keyboard code defined from the keyboard matrix by %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7) +// All keys exist as as KEY_XXX constants. +// Returns zero if the key is not pressed and a non-zero value if the key is currently pressed +byte keyboard_key_pressed(byte key) { + return keyboard_matrix_read(key>>3)&keyboard_matrix_col_bitmask[key&7]; +} + +// Get the keycode corresponding to a specific screen code character +// ch is the character to get the key code for ($00-$3f) +// Returns the key code corresponding to the passed character. Only characters with a non-shifted key are handled. +// If there is no non-shifted key representing the char $3f is returned (representing RUN/STOP) . +byte keyboard_get_keycode(byte ch) { + return keyboard_char_keycodes[ch]; +} Importing c64.kc PARSING src/test/java/dk/camelot64/kickc/test/kc/c64.kc // Commodore 64 Registers and Constants @@ -143,6 +210,14 @@ const byte* SPRITES_COLS = $d027; const byte* COLS = $d800; +// CIA#1 Port A: keyboard matrix columns and joystick #2 +const byte* CIA1_PORT_A = $dc00; +// CIA#1 Port B: keyboard matrix rows and joystick #1. +const byte* CIA1_PORT_B = $dc01; +// CIA #1 Port A data direction register. +const byte* CIA1_PORT_A_DDR = $dc02; +// CIA #1 Port B data direction register. +const byte* CIA1_PORT_B_DDR = $dc03; const byte BLACK = $0; const byte WHITE = $1; @@ -162,6 +237,8 @@ const byte LIGHT_BLUE = $e; const byte LIGHT_GREY = $f; Adding pre/post-modifier (byte*) main::sc ← ++ (byte*) main::sc +Adding pre/post-modifier (byte) main::i ← ++ (byte) main::i +Adding pre/post-modifier (byte) main::i ← ++ (byte) main::i STATEMENTS (byte*) PROCPORT ← (byte/signed byte/word/signed word/dword/signed dword) 1 @@ -181,6 +258,10 @@ STATEMENTS (byte*) SPRITES_MC2 ← (word/dword/signed dword) 53286 (byte*) SPRITES_COLS ← (word/dword/signed dword) 53287 (byte*) COLS ← (word/dword/signed dword) 55296 + (byte*) CIA1_PORT_A ← (word/dword/signed dword) 56320 + (byte*) CIA1_PORT_B ← (word/dword/signed dword) 56321 + (byte*) CIA1_PORT_A_DDR ← (word/dword/signed dword) 56322 + (byte*) CIA1_PORT_B_DDR ← (word/dword/signed dword) 56323 (byte) BLACK ← (byte/signed byte/word/signed word/dword/signed dword) 0 (byte) WHITE ← (byte/signed byte/word/signed word/dword/signed dword) 1 (byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2 @@ -197,10 +278,107 @@ STATEMENTS (byte) LIGHT_GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 13 (byte) LIGHT_BLUE ← (byte/signed byte/word/signed word/dword/signed dword) 14 (byte) LIGHT_GREY ← (byte/signed byte/word/signed word/dword/signed dword) 15 - (byte*) CIA1_PORT_A ← (word/dword/signed dword) 56320 - (byte*) CIA1_PORT_B ← (word/dword/signed dword) 56321 - (byte*) CIA1_PORT_A_DDR ← (word/dword/signed dword) 56322 - (byte*) CIA1_PORT_B_DDR ← (word/dword/signed dword) 56323 + (byte) KEY_DEL ← (byte/signed byte/word/signed word/dword/signed dword) 0 + (byte) KEY_RETURN ← (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) KEY_CRSR_RIGHT ← (byte/signed byte/word/signed word/dword/signed dword) 2 + (byte) KEY_F7 ← (byte/signed byte/word/signed word/dword/signed dword) 3 + (byte) KEY_F5 ← (byte/signed byte/word/signed word/dword/signed dword) 4 + (byte) KEY_F3 ← (byte/signed byte/word/signed word/dword/signed dword) 5 + (byte) KEY_F1 ← (byte/signed byte/word/signed word/dword/signed dword) 6 + (byte) KEY_CRSR_DOWN ← (byte/signed byte/word/signed word/dword/signed dword) 7 + (byte) KEY_3 ← (byte/signed byte/word/signed word/dword/signed dword) 8 + (byte) KEY_W ← (byte/signed byte/word/signed word/dword/signed dword) 9 + (byte) KEY_A ← (byte/signed byte/word/signed word/dword/signed dword) 10 + (byte) KEY_4 ← (byte/signed byte/word/signed word/dword/signed dword) 11 + (byte) KEY_Z ← (byte/signed byte/word/signed word/dword/signed dword) 12 + (byte) KEY_S ← (byte/signed byte/word/signed word/dword/signed dword) 13 + (byte) KEY_E ← (byte/signed byte/word/signed word/dword/signed dword) 14 + (byte) KEY_LSHIFT ← (byte/signed byte/word/signed word/dword/signed dword) 15 + (byte) KEY_5 ← (byte/signed byte/word/signed word/dword/signed dword) 16 + (byte) KEY_R ← (byte/signed byte/word/signed word/dword/signed dword) 17 + (byte) KEY_D ← (byte/signed byte/word/signed word/dword/signed dword) 18 + (byte) KEY_6 ← (byte/signed byte/word/signed word/dword/signed dword) 19 + (byte) KEY_C ← (byte/signed byte/word/signed word/dword/signed dword) 20 + (byte) KEY_F ← (byte/signed byte/word/signed word/dword/signed dword) 21 + (byte) KEY_T ← (byte/signed byte/word/signed word/dword/signed dword) 22 + (byte) KEY_X ← (byte/signed byte/word/signed word/dword/signed dword) 23 + (byte) KEY_7 ← (byte/signed byte/word/signed word/dword/signed dword) 24 + (byte) KEY_Y ← (byte/signed byte/word/signed word/dword/signed dword) 25 + (byte) KEY_G ← (byte/signed byte/word/signed word/dword/signed dword) 26 + (byte) KEY_8 ← (byte/signed byte/word/signed word/dword/signed dword) 27 + (byte) KEY_B ← (byte/signed byte/word/signed word/dword/signed dword) 28 + (byte) KEY_H ← (byte/signed byte/word/signed word/dword/signed dword) 29 + (byte) KEY_U ← (byte/signed byte/word/signed word/dword/signed dword) 30 + (byte) KEY_V ← (byte/signed byte/word/signed word/dword/signed dword) 31 + (byte) KEY_9 ← (byte/signed byte/word/signed word/dword/signed dword) 32 + (byte) KEY_I ← (byte/signed byte/word/signed word/dword/signed dword) 33 + (byte) KEY_J ← (byte/signed byte/word/signed word/dword/signed dword) 34 + (byte) KEY_0 ← (byte/signed byte/word/signed word/dword/signed dword) 35 + (byte) KEY_M ← (byte/signed byte/word/signed word/dword/signed dword) 36 + (byte) KEY_K ← (byte/signed byte/word/signed word/dword/signed dword) 37 + (byte) KEY_O ← (byte/signed byte/word/signed word/dword/signed dword) 38 + (byte) KEY_N ← (byte/signed byte/word/signed word/dword/signed dword) 39 + (byte) KEY_PLUS ← (byte/signed byte/word/signed word/dword/signed dword) 40 + (byte) KEY_P ← (byte/signed byte/word/signed word/dword/signed dword) 41 + (byte) KEY_L ← (byte/signed byte/word/signed word/dword/signed dword) 42 + (byte) KEY_MINUS ← (byte/signed byte/word/signed word/dword/signed dword) 43 + (byte) KEY_DOT ← (byte/signed byte/word/signed word/dword/signed dword) 44 + (byte) KEY_COLON ← (byte/signed byte/word/signed word/dword/signed dword) 45 + (byte) KEY_AT ← (byte/signed byte/word/signed word/dword/signed dword) 46 + (byte) KEY_COMMA ← (byte/signed byte/word/signed word/dword/signed dword) 47 + (byte) KEY_POUND ← (byte/signed byte/word/signed word/dword/signed dword) 48 + (byte) KEY_ASTERISK ← (byte/signed byte/word/signed word/dword/signed dword) 49 + (byte) KEY_SEMICOLON ← (byte/signed byte/word/signed word/dword/signed dword) 50 + (byte) KEY_HOME ← (byte/signed byte/word/signed word/dword/signed dword) 51 + (byte) KEY_RSHIFT ← (byte/signed byte/word/signed word/dword/signed dword) 52 + (byte) KEY_EQUALS ← (byte/signed byte/word/signed word/dword/signed dword) 53 + (byte) KEY_ARROW_UP ← (byte/signed byte/word/signed word/dword/signed dword) 54 + (byte) KEY_SLASH ← (byte/signed byte/word/signed word/dword/signed dword) 55 + (byte) KEY_1 ← (byte/signed byte/word/signed word/dword/signed dword) 56 + (byte) KEY_ARROW_LEFT ← (byte/signed byte/word/signed word/dword/signed dword) 57 + (byte) KEY_CTRL ← (byte/signed byte/word/signed word/dword/signed dword) 58 + (byte) KEY_2 ← (byte/signed byte/word/signed word/dword/signed dword) 59 + (byte) KEY_SPACE ← (byte/signed byte/word/signed word/dword/signed dword) 60 + (byte) KEY_COMMODORE ← (byte/signed byte/word/signed word/dword/signed dword) 61 + (byte) KEY_Q ← (byte/signed byte/word/signed word/dword/signed dword) 62 + (byte) KEY_RUNSTOP ← (byte/signed byte/word/signed word/dword/signed dword) 63 + (byte[]) keyboard_char_keycodes ← { (byte) KEY_AT, (byte) KEY_A, (byte) KEY_B, (byte) KEY_C, (byte) KEY_D, (byte) KEY_E, (byte) KEY_F, (byte) KEY_G, (byte) KEY_H, (byte) KEY_I, (byte) KEY_J, (byte) KEY_K, (byte) KEY_L, (byte) KEY_M, (byte) KEY_N, (byte) KEY_O, (byte) KEY_O, (byte) KEY_Q, (byte) KEY_R, (byte) KEY_S, (byte) KEY_T, (byte) KEY_U, (byte) KEY_V, (byte) KEY_W, (byte) KEY_X, (byte) KEY_Y, (byte) KEY_Z, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte) KEY_POUND, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte) KEY_ARROW_UP, (byte) KEY_ARROW_LEFT, (byte) KEY_SPACE, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte) KEY_ASTERISK, (byte) KEY_PLUS, (byte) KEY_COMMA, (byte) KEY_MINUS, (byte) KEY_DOT, (byte) KEY_SLASH, (byte) KEY_0, (byte) KEY_1, (byte) KEY_2, (byte) KEY_3, (byte) KEY_4, (byte) KEY_5, (byte) KEY_6, (byte) KEY_7, (byte) KEY_8, (byte) KEY_9, (byte) KEY_COLON, (byte) KEY_SEMICOLON, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte) KEY_EQUALS, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63 } + (byte[8]) keyboard_matrix_row_bitmask ← { (byte/word/signed word/dword/signed dword) 254, (byte/word/signed word/dword/signed dword) 253, (byte/word/signed word/dword/signed dword) 251, (byte/word/signed word/dword/signed dword) 247, (byte/word/signed word/dword/signed dword) 239, (byte/word/signed word/dword/signed dword) 223, (byte/word/signed word/dword/signed dword) 191, (byte/signed byte/word/signed word/dword/signed dword) 127 } + (byte[]) keyboard_matrix_col_bitmask ← { (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 4, (byte/signed byte/word/signed word/dword/signed dword) 8, (byte/signed byte/word/signed word/dword/signed dword) 16, (byte/signed byte/word/signed word/dword/signed dword) 32, (byte/signed byte/word/signed word/dword/signed dword) 64, (byte/word/signed word/dword/signed dword) 128 } +proc (void()) keyboard_init() + *((byte*) CIA1_PORT_A_DDR) ← (byte/word/signed word/dword/signed dword) 255 + *((byte*) CIA1_PORT_B_DDR) ← (byte/signed byte/word/signed word/dword/signed dword) 0 +keyboard_init::@return: + return +endproc // keyboard_init() +proc (byte()) keyboard_matrix_read((byte) keyboard_matrix_read::rowid) + *((byte*) CIA1_PORT_A) ← *((byte[8]) keyboard_matrix_row_bitmask + (byte) keyboard_matrix_read::rowid) + (byte~) keyboard_matrix_read::$0 ← ~ *((byte*) CIA1_PORT_B) + (byte) keyboard_matrix_read::row_pressed_bits ← (byte~) keyboard_matrix_read::$0 + (byte) keyboard_matrix_read::return ← (byte) keyboard_matrix_read::row_pressed_bits + goto keyboard_matrix_read::@return +keyboard_matrix_read::@return: + (byte) keyboard_matrix_read::return ← (byte) keyboard_matrix_read::return + return (byte) keyboard_matrix_read::return +endproc // keyboard_matrix_read() +proc (byte()) keyboard_key_pressed((byte) keyboard_key_pressed::key) + (byte~) keyboard_key_pressed::$0 ← (byte) keyboard_key_pressed::key >> (byte/signed byte/word/signed word/dword/signed dword) 3 + (byte~) keyboard_key_pressed::$1 ← call keyboard_matrix_read (byte~) keyboard_key_pressed::$0 + (byte~) keyboard_key_pressed::$2 ← (byte) keyboard_key_pressed::key & (byte/signed byte/word/signed word/dword/signed dword) 7 + (byte~) keyboard_key_pressed::$3 ← (byte~) keyboard_key_pressed::$1 & *((byte[]) keyboard_matrix_col_bitmask + (byte~) keyboard_key_pressed::$2) + (byte) keyboard_key_pressed::return ← (byte~) keyboard_key_pressed::$3 + goto keyboard_key_pressed::@return +keyboard_key_pressed::@return: + (byte) keyboard_key_pressed::return ← (byte) keyboard_key_pressed::return + return (byte) keyboard_key_pressed::return +endproc // keyboard_key_pressed() +proc (byte()) keyboard_get_keycode((byte) keyboard_get_keycode::ch) + (byte) keyboard_get_keycode::return ← *((byte[]) keyboard_char_keycodes + (byte) keyboard_get_keycode::ch) + goto keyboard_get_keycode::@return +keyboard_get_keycode::@return: + (byte) keyboard_get_keycode::return ← (byte) keyboard_get_keycode::return + return (byte) keyboard_get_keycode::return +endproc // keyboard_get_keycode() proc (void()) main() (byte*) main::sc ← (word/signed word/dword/signed dword) 1024 main::@1: @@ -245,74 +423,35 @@ main::@9: if((boolean~) main::$11) goto main::@6 (byte*~) main::$12 ← (byte*) main::screen + (byte/signed byte/word/signed word/dword/signed dword) 40 (byte*) main::screen ← (byte*~) main::$12 - (byte[]) main::chars ← { (byte) '@', (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e' } (byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0 + (byte) main::ch ← (byte/signed byte/word/signed word/dword/signed dword) 0 main::@10: - (byte) main::ch ← *((byte[]) main::chars + (byte) main::i) - (byte~) main::$13 ← call keyboard_char_pressed (byte) main::ch - (boolean~) main::$14 ← (byte~) main::$13 != (byte/signed byte/word/signed word/dword/signed dword) 0 + (byte~) main::$13 ← call keyboard_get_keycode (byte) main::ch + (byte) main::key ← (byte~) main::$13 + (boolean~) main::$14 ← (byte) main::key != (byte/signed byte/word/signed word/dword/signed dword) 63 (boolean~) main::$15 ← ! (boolean~) main::$14 if((boolean~) main::$15) goto main::@11 + (byte~) main::$16 ← call keyboard_key_pressed (byte) main::key + (boolean~) main::$17 ← (byte~) main::$16 != (byte/signed byte/word/signed word/dword/signed dword) 0 + (boolean~) main::$18 ← ! (boolean~) main::$17 + if((boolean~) main::$18) goto main::@12 *((byte*) main::screen + (byte) main::i) ← (byte) main::ch - goto main::@12 -main::@11: - *((byte*) main::screen + (byte) main::i) ← (byte) ' ' -main::@12: (byte) main::i ← ++ (byte) main::i - (boolean~) main::$16 ← (byte) main::i != (byte/signed byte/word/signed word/dword/signed dword) 6 - if((boolean~) main::$16) goto main::@10 +main::@12: +main::@11: + (byte) main::ch ← ++ (byte) main::ch + (boolean~) main::$19 ← (byte) main::ch != (byte/signed byte/word/signed word/dword/signed dword) 64 + if((boolean~) main::$19) goto main::@10 +main::@13: + *((byte*) main::screen + (byte) main::i) ← (byte) ' ' + (byte) main::i ← ++ (byte) main::i + (boolean~) main::$20 ← (byte) main::i < (byte/signed byte/word/signed word/dword/signed dword) 5 + if((boolean~) main::$20) goto main::@13 goto main::@2 main::@4: main::@return: return endproc // main() -proc (void()) keyboard_init() - *((byte*) CIA1_PORT_A_DDR) ← (byte/word/signed word/dword/signed dword) 255 - *((byte*) CIA1_PORT_B_DDR) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -keyboard_init::@return: - return -endproc // keyboard_init() -proc (byte()) keyboard_char_pressed((byte) keyboard_char_pressed::ch) - (byte~) keyboard_char_pressed::$0 ← call keyboard_matrix_row (byte) keyboard_char_pressed::ch - (byte~) keyboard_char_pressed::$1 ← call keyboard_matrix_read (byte~) keyboard_char_pressed::$0 - (byte~) keyboard_char_pressed::$2 ← call keyboard_matrix_col (byte) keyboard_char_pressed::ch - (byte~) keyboard_char_pressed::$3 ← (byte~) keyboard_char_pressed::$1 & (byte~) keyboard_char_pressed::$2 - (byte) keyboard_char_pressed::return ← (byte~) keyboard_char_pressed::$3 - goto keyboard_char_pressed::@return -keyboard_char_pressed::@return: - (byte) keyboard_char_pressed::return ← (byte) keyboard_char_pressed::return - return (byte) keyboard_char_pressed::return -endproc // keyboard_char_pressed() - (byte[8]) keyboard_row_bits ← { (byte/word/signed word/dword/signed dword) 254, (byte/word/signed word/dword/signed dword) 253, (byte/word/signed word/dword/signed dword) 251, (byte/word/signed word/dword/signed dword) 247, (byte/word/signed word/dword/signed dword) 239, (byte/word/signed word/dword/signed dword) 223, (byte/word/signed word/dword/signed dword) 191, (byte/signed byte/word/signed word/dword/signed dword) 127 } -proc (byte()) keyboard_matrix_read((byte) keyboard_matrix_read::rowid) - *((byte*) CIA1_PORT_A) ← *((byte[8]) keyboard_row_bits + (byte) keyboard_matrix_read::rowid) - (byte~) keyboard_matrix_read::$0 ← ~ *((byte*) CIA1_PORT_B) - (byte) keyboard_matrix_read::row_pressed_bits ← (byte~) keyboard_matrix_read::$0 - (byte) keyboard_matrix_read::return ← (byte) keyboard_matrix_read::row_pressed_bits - goto keyboard_matrix_read::@return -keyboard_matrix_read::@return: - (byte) keyboard_matrix_read::return ← (byte) keyboard_matrix_read::return - return (byte) keyboard_matrix_read::return -endproc // keyboard_matrix_read() - (byte[]) keyboard_matrix_col_bitmask ← { (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 4, (byte/signed byte/word/signed word/dword/signed dword) 8, (byte/signed byte/word/signed word/dword/signed dword) 16, (byte/signed byte/word/signed word/dword/signed dword) 32, (byte/signed byte/word/signed word/dword/signed dword) 64, (byte/word/signed word/dword/signed dword) 128 } - (byte[]) keyboard_matrix_chars ← { (byte/signed byte/word/signed word/dword/signed dword) 101, (byte/signed byte/word/signed word/dword/signed dword) 33, (byte/signed byte/word/signed word/dword/signed dword) 67, (byte/signed byte/word/signed word/dword/signed dword) 66, (byte/signed byte/word/signed word/dword/signed dword) 34, (byte/signed byte/word/signed word/dword/signed dword) 97 } -proc (byte()) keyboard_matrix_row((byte) keyboard_matrix_row::ch) - (byte~) keyboard_matrix_row::$0 ← *((byte[]) keyboard_matrix_chars + (byte) keyboard_matrix_row::ch) & (byte/signed byte/word/signed word/dword/signed dword) 15 - (byte) keyboard_matrix_row::return ← (byte~) keyboard_matrix_row::$0 - goto keyboard_matrix_row::@return -keyboard_matrix_row::@return: - (byte) keyboard_matrix_row::return ← (byte) keyboard_matrix_row::return - return (byte) keyboard_matrix_row::return -endproc // keyboard_matrix_row() -proc (byte()) keyboard_matrix_col((byte) keyboard_matrix_col::ch) - (byte~) keyboard_matrix_col::$0 ← *((byte[]) keyboard_matrix_chars + (byte) keyboard_matrix_col::ch) >> (byte/signed byte/word/signed word/dword/signed dword) 4 - (byte) keyboard_matrix_col::col_id ← (byte~) keyboard_matrix_col::$0 - (byte) keyboard_matrix_col::return ← *((byte[]) keyboard_matrix_col_bitmask + (byte) keyboard_matrix_col::col_id) - goto keyboard_matrix_col::@return -keyboard_matrix_col::@return: - (byte) keyboard_matrix_col::return ← (byte) keyboard_matrix_col::return - return (byte) keyboard_matrix_col::return -endproc // keyboard_matrix_col() call main SYMBOLS @@ -331,6 +470,70 @@ SYMBOLS (byte) DARK_GREY (byte) GREEN (byte) GREY +(byte) KEY_0 +(byte) KEY_1 +(byte) KEY_2 +(byte) KEY_3 +(byte) KEY_4 +(byte) KEY_5 +(byte) KEY_6 +(byte) KEY_7 +(byte) KEY_8 +(byte) KEY_9 +(byte) KEY_A +(byte) KEY_ARROW_LEFT +(byte) KEY_ARROW_UP +(byte) KEY_ASTERISK +(byte) KEY_AT +(byte) KEY_B +(byte) KEY_C +(byte) KEY_COLON +(byte) KEY_COMMA +(byte) KEY_COMMODORE +(byte) KEY_CRSR_DOWN +(byte) KEY_CRSR_RIGHT +(byte) KEY_CTRL +(byte) KEY_D +(byte) KEY_DEL +(byte) KEY_DOT +(byte) KEY_E +(byte) KEY_EQUALS +(byte) KEY_F +(byte) KEY_F1 +(byte) KEY_F3 +(byte) KEY_F5 +(byte) KEY_F7 +(byte) KEY_G +(byte) KEY_H +(byte) KEY_HOME +(byte) KEY_I +(byte) KEY_J +(byte) KEY_K +(byte) KEY_L +(byte) KEY_LSHIFT +(byte) KEY_M +(byte) KEY_MINUS +(byte) KEY_N +(byte) KEY_O +(byte) KEY_P +(byte) KEY_PLUS +(byte) KEY_POUND +(byte) KEY_Q +(byte) KEY_R +(byte) KEY_RETURN +(byte) KEY_RSHIFT +(byte) KEY_RUNSTOP +(byte) KEY_S +(byte) KEY_SEMICOLON +(byte) KEY_SLASH +(byte) KEY_SPACE +(byte) KEY_T +(byte) KEY_U +(byte) KEY_V +(byte) KEY_W +(byte) KEY_X +(byte) KEY_Y +(byte) KEY_Z (byte) LIGHT_BLUE (byte) LIGHT_GREEN (byte) LIGHT_GREY @@ -353,23 +556,21 @@ SYMBOLS (byte*) SPRITES_YPOS (byte) WHITE (byte) YELLOW -(byte()) keyboard_char_pressed((byte) keyboard_char_pressed::ch) -(byte~) keyboard_char_pressed::$0 -(byte~) keyboard_char_pressed::$1 -(byte~) keyboard_char_pressed::$2 -(byte~) keyboard_char_pressed::$3 -(label) keyboard_char_pressed::@return -(byte) keyboard_char_pressed::ch -(byte) keyboard_char_pressed::return +(byte[]) keyboard_char_keycodes +(byte()) keyboard_get_keycode((byte) keyboard_get_keycode::ch) +(label) keyboard_get_keycode::@return +(byte) keyboard_get_keycode::ch +(byte) keyboard_get_keycode::return (void()) keyboard_init() (label) keyboard_init::@return -(byte[]) keyboard_matrix_chars -(byte()) keyboard_matrix_col((byte) keyboard_matrix_col::ch) -(byte~) keyboard_matrix_col::$0 -(label) keyboard_matrix_col::@return -(byte) keyboard_matrix_col::ch -(byte) keyboard_matrix_col::col_id -(byte) keyboard_matrix_col::return +(byte()) keyboard_key_pressed((byte) keyboard_key_pressed::key) +(byte~) keyboard_key_pressed::$0 +(byte~) keyboard_key_pressed::$1 +(byte~) keyboard_key_pressed::$2 +(byte~) keyboard_key_pressed::$3 +(label) keyboard_key_pressed::@return +(byte) keyboard_key_pressed::key +(byte) keyboard_key_pressed::return (byte[]) keyboard_matrix_col_bitmask (byte()) keyboard_matrix_read((byte) keyboard_matrix_read::rowid) (byte~) keyboard_matrix_read::$0 @@ -377,12 +578,7 @@ SYMBOLS (byte) keyboard_matrix_read::return (byte) keyboard_matrix_read::row_pressed_bits (byte) keyboard_matrix_read::rowid -(byte()) keyboard_matrix_row((byte) keyboard_matrix_row::ch) -(byte~) keyboard_matrix_row::$0 -(label) keyboard_matrix_row::@return -(byte) keyboard_matrix_row::ch -(byte) keyboard_matrix_row::return -(byte[8]) keyboard_row_bits +(byte[8]) keyboard_matrix_row_bitmask (void()) main() (word/signed word/dword/signed dword~) main::$0 (boolean~) main::$1 @@ -392,8 +588,12 @@ SYMBOLS (byte~) main::$13 (boolean~) main::$14 (boolean~) main::$15 -(boolean~) main::$16 +(byte~) main::$16 +(boolean~) main::$17 +(boolean~) main::$18 +(boolean~) main::$19 (void~) main::$2 +(boolean~) main::$20 (boolean~) main::$3 (byte~) main::$4 (byte~) main::$5 @@ -405,6 +605,7 @@ SYMBOLS (label) main::@10 (label) main::@11 (label) main::@12 +(label) main::@13 (label) main::@2 (label) main::@3 (label) main::@4 @@ -415,9 +616,9 @@ SYMBOLS (label) main::@9 (label) main::@return (byte) main::ch -(byte[]) main::chars (byte) main::col (byte) main::i +(byte) main::key (byte) main::row (byte) main::row_pressed_bits (byte*) main::sc @@ -465,6 +666,10 @@ INITIAL CONTROL FLOW GRAPH (byte*) SPRITES_MC2 ← ((byte*)) (word/dword/signed dword) 53286 (byte*) SPRITES_COLS ← ((byte*)) (word/dword/signed dword) 53287 (byte*) COLS ← ((byte*)) (word/dword/signed dword) 55296 + (byte*) CIA1_PORT_A ← ((byte*)) (word/dword/signed dword) 56320 + (byte*) CIA1_PORT_B ← ((byte*)) (word/dword/signed dword) 56321 + (byte*) CIA1_PORT_A_DDR ← ((byte*)) (word/dword/signed dword) 56322 + (byte*) CIA1_PORT_B_DDR ← ((byte*)) (word/dword/signed dword) 56323 (byte) BLACK ← (byte/signed byte/word/signed word/dword/signed dword) 0 (byte) WHITE ← (byte/signed byte/word/signed word/dword/signed dword) 1 (byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2 @@ -481,111 +686,74 @@ INITIAL CONTROL FLOW GRAPH (byte) LIGHT_GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 13 (byte) LIGHT_BLUE ← (byte/signed byte/word/signed word/dword/signed dword) 14 (byte) LIGHT_GREY ← (byte/signed byte/word/signed word/dword/signed dword) 15 - (byte*) CIA1_PORT_A ← ((byte*)) (word/dword/signed dword) 56320 - (byte*) CIA1_PORT_B ← ((byte*)) (word/dword/signed dword) 56321 - (byte*) CIA1_PORT_A_DDR ← ((byte*)) (word/dword/signed dword) 56322 - (byte*) CIA1_PORT_B_DDR ← ((byte*)) (word/dword/signed dword) 56323 + (byte) KEY_DEL ← (byte/signed byte/word/signed word/dword/signed dword) 0 + (byte) KEY_RETURN ← (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) KEY_CRSR_RIGHT ← (byte/signed byte/word/signed word/dword/signed dword) 2 + (byte) KEY_F7 ← (byte/signed byte/word/signed word/dword/signed dword) 3 + (byte) KEY_F5 ← (byte/signed byte/word/signed word/dword/signed dword) 4 + (byte) KEY_F3 ← (byte/signed byte/word/signed word/dword/signed dword) 5 + (byte) KEY_F1 ← (byte/signed byte/word/signed word/dword/signed dword) 6 + (byte) KEY_CRSR_DOWN ← (byte/signed byte/word/signed word/dword/signed dword) 7 + (byte) KEY_3 ← (byte/signed byte/word/signed word/dword/signed dword) 8 + (byte) KEY_W ← (byte/signed byte/word/signed word/dword/signed dword) 9 + (byte) KEY_A ← (byte/signed byte/word/signed word/dword/signed dword) 10 + (byte) KEY_4 ← (byte/signed byte/word/signed word/dword/signed dword) 11 + (byte) KEY_Z ← (byte/signed byte/word/signed word/dword/signed dword) 12 + (byte) KEY_S ← (byte/signed byte/word/signed word/dword/signed dword) 13 + (byte) KEY_E ← (byte/signed byte/word/signed word/dword/signed dword) 14 + (byte) KEY_LSHIFT ← (byte/signed byte/word/signed word/dword/signed dword) 15 + (byte) KEY_5 ← (byte/signed byte/word/signed word/dword/signed dword) 16 + (byte) KEY_R ← (byte/signed byte/word/signed word/dword/signed dword) 17 + (byte) KEY_D ← (byte/signed byte/word/signed word/dword/signed dword) 18 + (byte) KEY_6 ← (byte/signed byte/word/signed word/dword/signed dword) 19 + (byte) KEY_C ← (byte/signed byte/word/signed word/dword/signed dword) 20 + (byte) KEY_F ← (byte/signed byte/word/signed word/dword/signed dword) 21 + (byte) KEY_T ← (byte/signed byte/word/signed word/dword/signed dword) 22 + (byte) KEY_X ← (byte/signed byte/word/signed word/dword/signed dword) 23 + (byte) KEY_7 ← (byte/signed byte/word/signed word/dword/signed dword) 24 + (byte) KEY_Y ← (byte/signed byte/word/signed word/dword/signed dword) 25 + (byte) KEY_G ← (byte/signed byte/word/signed word/dword/signed dword) 26 + (byte) KEY_8 ← (byte/signed byte/word/signed word/dword/signed dword) 27 + (byte) KEY_B ← (byte/signed byte/word/signed word/dword/signed dword) 28 + (byte) KEY_H ← (byte/signed byte/word/signed word/dword/signed dword) 29 + (byte) KEY_U ← (byte/signed byte/word/signed word/dword/signed dword) 30 + (byte) KEY_V ← (byte/signed byte/word/signed word/dword/signed dword) 31 + (byte) KEY_9 ← (byte/signed byte/word/signed word/dword/signed dword) 32 + (byte) KEY_I ← (byte/signed byte/word/signed word/dword/signed dword) 33 + (byte) KEY_J ← (byte/signed byte/word/signed word/dword/signed dword) 34 + (byte) KEY_0 ← (byte/signed byte/word/signed word/dword/signed dword) 35 + (byte) KEY_M ← (byte/signed byte/word/signed word/dword/signed dword) 36 + (byte) KEY_K ← (byte/signed byte/word/signed word/dword/signed dword) 37 + (byte) KEY_O ← (byte/signed byte/word/signed word/dword/signed dword) 38 + (byte) KEY_N ← (byte/signed byte/word/signed word/dword/signed dword) 39 + (byte) KEY_PLUS ← (byte/signed byte/word/signed word/dword/signed dword) 40 + (byte) KEY_P ← (byte/signed byte/word/signed word/dword/signed dword) 41 + (byte) KEY_L ← (byte/signed byte/word/signed word/dword/signed dword) 42 + (byte) KEY_MINUS ← (byte/signed byte/word/signed word/dword/signed dword) 43 + (byte) KEY_DOT ← (byte/signed byte/word/signed word/dword/signed dword) 44 + (byte) KEY_COLON ← (byte/signed byte/word/signed word/dword/signed dword) 45 + (byte) KEY_AT ← (byte/signed byte/word/signed word/dword/signed dword) 46 + (byte) KEY_COMMA ← (byte/signed byte/word/signed word/dword/signed dword) 47 + (byte) KEY_POUND ← (byte/signed byte/word/signed word/dword/signed dword) 48 + (byte) KEY_ASTERISK ← (byte/signed byte/word/signed word/dword/signed dword) 49 + (byte) KEY_SEMICOLON ← (byte/signed byte/word/signed word/dword/signed dword) 50 + (byte) KEY_HOME ← (byte/signed byte/word/signed word/dword/signed dword) 51 + (byte) KEY_RSHIFT ← (byte/signed byte/word/signed word/dword/signed dword) 52 + (byte) KEY_EQUALS ← (byte/signed byte/word/signed word/dword/signed dword) 53 + (byte) KEY_ARROW_UP ← (byte/signed byte/word/signed word/dword/signed dword) 54 + (byte) KEY_SLASH ← (byte/signed byte/word/signed word/dword/signed dword) 55 + (byte) KEY_1 ← (byte/signed byte/word/signed word/dword/signed dword) 56 + (byte) KEY_ARROW_LEFT ← (byte/signed byte/word/signed word/dword/signed dword) 57 + (byte) KEY_CTRL ← (byte/signed byte/word/signed word/dword/signed dword) 58 + (byte) KEY_2 ← (byte/signed byte/word/signed word/dword/signed dword) 59 + (byte) KEY_SPACE ← (byte/signed byte/word/signed word/dword/signed dword) 60 + (byte) KEY_COMMODORE ← (byte/signed byte/word/signed word/dword/signed dword) 61 + (byte) KEY_Q ← (byte/signed byte/word/signed word/dword/signed dword) 62 + (byte) KEY_RUNSTOP ← (byte/signed byte/word/signed word/dword/signed dword) 63 + (byte[]) keyboard_char_keycodes ← { (byte) KEY_AT, (byte) KEY_A, (byte) KEY_B, (byte) KEY_C, (byte) KEY_D, (byte) KEY_E, (byte) KEY_F, (byte) KEY_G, (byte) KEY_H, (byte) KEY_I, (byte) KEY_J, (byte) KEY_K, (byte) KEY_L, (byte) KEY_M, (byte) KEY_N, (byte) KEY_O, (byte) KEY_O, (byte) KEY_Q, (byte) KEY_R, (byte) KEY_S, (byte) KEY_T, (byte) KEY_U, (byte) KEY_V, (byte) KEY_W, (byte) KEY_X, (byte) KEY_Y, (byte) KEY_Z, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte) KEY_POUND, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte) KEY_ARROW_UP, (byte) KEY_ARROW_LEFT, (byte) KEY_SPACE, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte) KEY_ASTERISK, (byte) KEY_PLUS, (byte) KEY_COMMA, (byte) KEY_MINUS, (byte) KEY_DOT, (byte) KEY_SLASH, (byte) KEY_0, (byte) KEY_1, (byte) KEY_2, (byte) KEY_3, (byte) KEY_4, (byte) KEY_5, (byte) KEY_6, (byte) KEY_7, (byte) KEY_8, (byte) KEY_9, (byte) KEY_COLON, (byte) KEY_SEMICOLON, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte) KEY_EQUALS, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63 } + (byte[8]) keyboard_matrix_row_bitmask ← { (byte/word/signed word/dword/signed dword) 254, (byte/word/signed word/dword/signed dword) 253, (byte/word/signed word/dword/signed dword) 251, (byte/word/signed word/dword/signed dword) 247, (byte/word/signed word/dword/signed dword) 239, (byte/word/signed word/dword/signed dword) 223, (byte/word/signed word/dword/signed dword) 191, (byte/signed byte/word/signed word/dword/signed dword) 127 } + (byte[]) keyboard_matrix_col_bitmask ← { (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 4, (byte/signed byte/word/signed word/dword/signed dword) 8, (byte/signed byte/word/signed word/dword/signed dword) 16, (byte/signed byte/word/signed word/dword/signed dword) 32, (byte/signed byte/word/signed word/dword/signed dword) 64, (byte/word/signed word/dword/signed dword) 128 } to:@1 -main: scope:[main] from - (byte*) main::sc ← ((byte*)) (word/signed word/dword/signed dword) 1024 - to:main::@1 -main::@1: scope:[main] from main main::@1 - *((byte*) main::sc) ← (byte) ' ' - (byte*) main::sc ← ++ (byte*) main::sc - (word/signed word/dword/signed dword~) main::$0 ← (word/signed word/dword/signed dword) 1024 + (word/signed word/dword/signed dword) 1000 - (boolean~) main::$1 ← (byte*) main::sc < (word/signed word/dword/signed dword~) main::$0 - if((boolean~) main::$1) goto main::@1 - to:main::@13 -main::@13: scope:[main] from main::@1 - (void~) main::$2 ← call keyboard_init - to:main::@2 -main::@2: scope:[main] from main::@13 main::@23 - if(true) goto main::@3 - to:main::@14 -main::@3: scope:[main] from main::@15 main::@2 - to:main::@5 -main::@14: scope:[main] from main::@2 - to:main::@4 -main::@4: scope:[main] from main::@14 main::@24 - to:main::@return -main::@15: scope:[main] from - to:main::@3 -main::@5: scope:[main] from main::@3 main::@5 - (boolean~) main::$3 ← *((byte*) RASTER) != (byte/word/signed word/dword/signed dword) 255 - if((boolean~) main::$3) goto main::@5 - to:main::@16 -main::@16: scope:[main] from main::@5 - (byte*) main::screen ← ((byte*)) (word/signed word/dword/signed dword) 1024 - (byte) main::row ← (byte/signed byte/word/signed word/dword/signed dword) 0 - to:main::@6 -main::@6: scope:[main] from main::@16 main::@19 - (byte~) main::$4 ← call keyboard_matrix_read (byte) main::row - (byte) main::row_pressed_bits ← (byte~) main::$4 - (byte) main::col ← (byte/signed byte/word/signed word/dword/signed dword) 0 - to:main::@7 -main::@7: scope:[main] from main::@6 main::@9 - (byte~) main::$5 ← (byte) main::row_pressed_bits & (byte/word/signed word/dword/signed dword) 128 - (boolean~) main::$6 ← (byte~) main::$5 != (byte/signed byte/word/signed word/dword/signed dword) 0 - (boolean~) main::$7 ← ! (boolean~) main::$6 - if((boolean~) main::$7) goto main::@8 - to:main::@17 -main::@8: scope:[main] from main::@18 main::@7 - *((byte*) main::screen + (byte) main::col) ← (byte) '0' - to:main::@9 -main::@17: scope:[main] from main::@7 - *((byte*) main::screen + (byte) main::col) ← (byte) '1' - to:main::@9 -main::@9: scope:[main] from main::@17 main::@8 - (byte~) main::$8 ← (byte) main::row_pressed_bits << (byte/signed byte/word/signed word/dword/signed dword) 1 - (byte) main::row_pressed_bits ← (byte~) main::$8 - (byte) main::col ← ++ (byte) main::col - (boolean~) main::$9 ← (byte) main::col != (byte/signed byte/word/signed word/dword/signed dword) 8 - if((boolean~) main::$9) goto main::@7 - to:main::@19 -main::@18: scope:[main] from - to:main::@8 -main::@19: scope:[main] from main::@9 - (byte*~) main::$10 ← (byte*) main::screen + (byte/signed byte/word/signed word/dword/signed dword) 40 - (byte*) main::screen ← (byte*~) main::$10 - (byte) main::row ← ++ (byte) main::row - (boolean~) main::$11 ← (byte) main::row != (byte/signed byte/word/signed word/dword/signed dword) 8 - if((boolean~) main::$11) goto main::@6 - to:main::@20 -main::@20: scope:[main] from main::@19 - (byte*~) main::$12 ← (byte*) main::screen + (byte/signed byte/word/signed word/dword/signed dword) 40 - (byte*) main::screen ← (byte*~) main::$12 - (byte[]) main::chars ← { (byte) '@', (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e' } - (byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0 - to:main::@10 -main::@10: scope:[main] from main::@12 main::@20 - (byte) main::ch ← *((byte[]) main::chars + (byte) main::i) - (byte~) main::$13 ← call keyboard_char_pressed (byte) main::ch - (boolean~) main::$14 ← (byte~) main::$13 != (byte/signed byte/word/signed word/dword/signed dword) 0 - (boolean~) main::$15 ← ! (boolean~) main::$14 - if((boolean~) main::$15) goto main::@11 - to:main::@21 -main::@11: scope:[main] from main::@10 main::@22 - *((byte*) main::screen + (byte) main::i) ← (byte) ' ' - to:main::@12 -main::@21: scope:[main] from main::@10 - *((byte*) main::screen + (byte) main::i) ← (byte) main::ch - to:main::@12 -main::@12: scope:[main] from main::@11 main::@21 - (byte) main::i ← ++ (byte) main::i - (boolean~) main::$16 ← (byte) main::i != (byte/signed byte/word/signed word/dword/signed dword) 6 - if((boolean~) main::$16) goto main::@10 - to:main::@23 -main::@22: scope:[main] from - to:main::@11 -main::@23: scope:[main] from main::@12 - to:main::@2 -main::@24: scope:[main] from - to:main::@4 -main::@return: scope:[main] from main::@4 - return - to:@return -@1: scope:[] from @begin - to:@2 keyboard_init: scope:[keyboard_init] from *((byte*) CIA1_PORT_A_DDR) ← (byte/word/signed word/dword/signed dword) 255 *((byte*) CIA1_PORT_B_DDR) ← (byte/signed byte/word/signed word/dword/signed dword) 0 @@ -593,26 +761,10 @@ keyboard_init: scope:[keyboard_init] from keyboard_init::@return: scope:[keyboard_init] from keyboard_init return to:@return -@2: scope:[] from @1 - to:@3 -keyboard_char_pressed: scope:[keyboard_char_pressed] from - (byte~) keyboard_char_pressed::$0 ← call keyboard_matrix_row (byte) keyboard_char_pressed::ch - (byte~) keyboard_char_pressed::$1 ← call keyboard_matrix_read (byte~) keyboard_char_pressed::$0 - (byte~) keyboard_char_pressed::$2 ← call keyboard_matrix_col (byte) keyboard_char_pressed::ch - (byte~) keyboard_char_pressed::$3 ← (byte~) keyboard_char_pressed::$1 & (byte~) keyboard_char_pressed::$2 - (byte) keyboard_char_pressed::return ← (byte~) keyboard_char_pressed::$3 - to:keyboard_char_pressed::@return -keyboard_char_pressed::@return: scope:[keyboard_char_pressed] from keyboard_char_pressed keyboard_char_pressed::@1 - (byte) keyboard_char_pressed::return ← (byte) keyboard_char_pressed::return - return (byte) keyboard_char_pressed::return - to:@return -keyboard_char_pressed::@1: scope:[keyboard_char_pressed] from - to:keyboard_char_pressed::@return -@3: scope:[] from @2 - (byte[8]) keyboard_row_bits ← { (byte/word/signed word/dword/signed dword) 254, (byte/word/signed word/dword/signed dword) 253, (byte/word/signed word/dword/signed dword) 251, (byte/word/signed word/dword/signed dword) 247, (byte/word/signed word/dword/signed dword) 239, (byte/word/signed word/dword/signed dword) 223, (byte/word/signed word/dword/signed dword) 191, (byte/signed byte/word/signed word/dword/signed dword) 127 } - to:@4 +@1: scope:[] from @begin + to:@2 keyboard_matrix_read: scope:[keyboard_matrix_read] from - *((byte*) CIA1_PORT_A) ← *((byte[8]) keyboard_row_bits + (byte) keyboard_matrix_read::rowid) + *((byte*) CIA1_PORT_A) ← *((byte[8]) keyboard_matrix_row_bitmask + (byte) keyboard_matrix_read::rowid) (byte~) keyboard_matrix_read::$0 ← ~ *((byte*) CIA1_PORT_B) (byte) keyboard_matrix_read::row_pressed_bits ← (byte~) keyboard_matrix_read::$0 (byte) keyboard_matrix_read::return ← (byte) keyboard_matrix_read::row_pressed_bits @@ -623,37 +775,148 @@ keyboard_matrix_read::@return: scope:[keyboard_matrix_read] from keyboard_matri to:@return keyboard_matrix_read::@1: scope:[keyboard_matrix_read] from to:keyboard_matrix_read::@return +@2: scope:[] from @1 + to:@3 +keyboard_key_pressed: scope:[keyboard_key_pressed] from + (byte~) keyboard_key_pressed::$0 ← (byte) keyboard_key_pressed::key >> (byte/signed byte/word/signed word/dword/signed dword) 3 + (byte~) keyboard_key_pressed::$1 ← call keyboard_matrix_read (byte~) keyboard_key_pressed::$0 + (byte~) keyboard_key_pressed::$2 ← (byte) keyboard_key_pressed::key & (byte/signed byte/word/signed word/dword/signed dword) 7 + (byte~) keyboard_key_pressed::$3 ← (byte~) keyboard_key_pressed::$1 & *((byte[]) keyboard_matrix_col_bitmask + (byte~) keyboard_key_pressed::$2) + (byte) keyboard_key_pressed::return ← (byte~) keyboard_key_pressed::$3 + to:keyboard_key_pressed::@return +keyboard_key_pressed::@return: scope:[keyboard_key_pressed] from keyboard_key_pressed keyboard_key_pressed::@1 + (byte) keyboard_key_pressed::return ← (byte) keyboard_key_pressed::return + return (byte) keyboard_key_pressed::return + to:@return +keyboard_key_pressed::@1: scope:[keyboard_key_pressed] from + to:keyboard_key_pressed::@return +@3: scope:[] from @2 + to:@4 +keyboard_get_keycode: scope:[keyboard_get_keycode] from + (byte) keyboard_get_keycode::return ← *((byte[]) keyboard_char_keycodes + (byte) keyboard_get_keycode::ch) + to:keyboard_get_keycode::@return +keyboard_get_keycode::@return: scope:[keyboard_get_keycode] from keyboard_get_keycode keyboard_get_keycode::@1 + (byte) keyboard_get_keycode::return ← (byte) keyboard_get_keycode::return + return (byte) keyboard_get_keycode::return + to:@return +keyboard_get_keycode::@1: scope:[keyboard_get_keycode] from + to:keyboard_get_keycode::@return @4: scope:[] from @3 - (byte[]) keyboard_matrix_col_bitmask ← { (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 4, (byte/signed byte/word/signed word/dword/signed dword) 8, (byte/signed byte/word/signed word/dword/signed dword) 16, (byte/signed byte/word/signed word/dword/signed dword) 32, (byte/signed byte/word/signed word/dword/signed dword) 64, (byte/word/signed word/dword/signed dword) 128 } - (byte[]) keyboard_matrix_chars ← { (byte/signed byte/word/signed word/dword/signed dword) 101, (byte/signed byte/word/signed word/dword/signed dword) 33, (byte/signed byte/word/signed word/dword/signed dword) 67, (byte/signed byte/word/signed word/dword/signed dword) 66, (byte/signed byte/word/signed word/dword/signed dword) 34, (byte/signed byte/word/signed word/dword/signed dword) 97 } to:@5 -keyboard_matrix_row: scope:[keyboard_matrix_row] from - (byte~) keyboard_matrix_row::$0 ← *((byte[]) keyboard_matrix_chars + (byte) keyboard_matrix_row::ch) & (byte/signed byte/word/signed word/dword/signed dword) 15 - (byte) keyboard_matrix_row::return ← (byte~) keyboard_matrix_row::$0 - to:keyboard_matrix_row::@return -keyboard_matrix_row::@return: scope:[keyboard_matrix_row] from keyboard_matrix_row keyboard_matrix_row::@1 - (byte) keyboard_matrix_row::return ← (byte) keyboard_matrix_row::return - return (byte) keyboard_matrix_row::return +main: scope:[main] from + (byte*) main::sc ← ((byte*)) (word/signed word/dword/signed dword) 1024 + to:main::@1 +main::@1: scope:[main] from main main::@1 + *((byte*) main::sc) ← (byte) ' ' + (byte*) main::sc ← ++ (byte*) main::sc + (word/signed word/dword/signed dword~) main::$0 ← (word/signed word/dword/signed dword) 1024 + (word/signed word/dword/signed dword) 1000 + (boolean~) main::$1 ← (byte*) main::sc < (word/signed word/dword/signed dword~) main::$0 + if((boolean~) main::$1) goto main::@1 + to:main::@14 +main::@14: scope:[main] from main::@1 + (void~) main::$2 ← call keyboard_init + to:main::@2 +main::@2: scope:[main] from main::@14 main::@25 + if(true) goto main::@3 + to:main::@15 +main::@3: scope:[main] from main::@16 main::@2 + to:main::@5 +main::@15: scope:[main] from main::@2 + to:main::@4 +main::@4: scope:[main] from main::@15 main::@26 + to:main::@return +main::@16: scope:[main] from + to:main::@3 +main::@5: scope:[main] from main::@3 main::@5 + (boolean~) main::$3 ← *((byte*) RASTER) != (byte/word/signed word/dword/signed dword) 255 + if((boolean~) main::$3) goto main::@5 + to:main::@17 +main::@17: scope:[main] from main::@5 + (byte*) main::screen ← ((byte*)) (word/signed word/dword/signed dword) 1024 + (byte) main::row ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:main::@6 +main::@6: scope:[main] from main::@17 main::@20 + (byte~) main::$4 ← call keyboard_matrix_read (byte) main::row + (byte) main::row_pressed_bits ← (byte~) main::$4 + (byte) main::col ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:main::@7 +main::@7: scope:[main] from main::@6 main::@9 + (byte~) main::$5 ← (byte) main::row_pressed_bits & (byte/word/signed word/dword/signed dword) 128 + (boolean~) main::$6 ← (byte~) main::$5 != (byte/signed byte/word/signed word/dword/signed dword) 0 + (boolean~) main::$7 ← ! (boolean~) main::$6 + if((boolean~) main::$7) goto main::@8 + to:main::@18 +main::@8: scope:[main] from main::@19 main::@7 + *((byte*) main::screen + (byte) main::col) ← (byte) '0' + to:main::@9 +main::@18: scope:[main] from main::@7 + *((byte*) main::screen + (byte) main::col) ← (byte) '1' + to:main::@9 +main::@9: scope:[main] from main::@18 main::@8 + (byte~) main::$8 ← (byte) main::row_pressed_bits << (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) main::row_pressed_bits ← (byte~) main::$8 + (byte) main::col ← ++ (byte) main::col + (boolean~) main::$9 ← (byte) main::col != (byte/signed byte/word/signed word/dword/signed dword) 8 + if((boolean~) main::$9) goto main::@7 + to:main::@20 +main::@19: scope:[main] from + to:main::@8 +main::@20: scope:[main] from main::@9 + (byte*~) main::$10 ← (byte*) main::screen + (byte/signed byte/word/signed word/dword/signed dword) 40 + (byte*) main::screen ← (byte*~) main::$10 + (byte) main::row ← ++ (byte) main::row + (boolean~) main::$11 ← (byte) main::row != (byte/signed byte/word/signed word/dword/signed dword) 8 + if((boolean~) main::$11) goto main::@6 + to:main::@21 +main::@21: scope:[main] from main::@20 + (byte*~) main::$12 ← (byte*) main::screen + (byte/signed byte/word/signed word/dword/signed dword) 40 + (byte*) main::screen ← (byte*~) main::$12 + (byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0 + (byte) main::ch ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:main::@10 +main::@10: scope:[main] from main::@11 main::@21 + (byte~) main::$13 ← call keyboard_get_keycode (byte) main::ch + (byte) main::key ← (byte~) main::$13 + (boolean~) main::$14 ← (byte) main::key != (byte/signed byte/word/signed word/dword/signed dword) 63 + (boolean~) main::$15 ← ! (boolean~) main::$14 + if((boolean~) main::$15) goto main::@11 + to:main::@22 +main::@11: scope:[main] from main::@10 main::@12 + (byte) main::ch ← ++ (byte) main::ch + (boolean~) main::$19 ← (byte) main::ch != (byte/signed byte/word/signed word/dword/signed dword) 64 + if((boolean~) main::$19) goto main::@10 + to:main::@24 +main::@22: scope:[main] from main::@10 + (byte~) main::$16 ← call keyboard_key_pressed (byte) main::key + (boolean~) main::$17 ← (byte~) main::$16 != (byte/signed byte/word/signed word/dword/signed dword) 0 + (boolean~) main::$18 ← ! (boolean~) main::$17 + if((boolean~) main::$18) goto main::@12 + to:main::@23 +main::@12: scope:[main] from main::@22 main::@23 + to:main::@11 +main::@23: scope:[main] from main::@22 + *((byte*) main::screen + (byte) main::i) ← (byte) main::ch + (byte) main::i ← ++ (byte) main::i + to:main::@12 +main::@24: scope:[main] from main::@11 + to:main::@13 +main::@13: scope:[main] from main::@13 main::@24 + *((byte*) main::screen + (byte) main::i) ← (byte) ' ' + (byte) main::i ← ++ (byte) main::i + (boolean~) main::$20 ← (byte) main::i < (byte/signed byte/word/signed word/dword/signed dword) 5 + if((boolean~) main::$20) goto main::@13 + to:main::@25 +main::@25: scope:[main] from main::@13 + to:main::@2 +main::@26: scope:[main] from + to:main::@4 +main::@return: scope:[main] from main::@4 + return to:@return -keyboard_matrix_row::@1: scope:[keyboard_matrix_row] from - to:keyboard_matrix_row::@return @5: scope:[] from @4 - to:@6 -keyboard_matrix_col: scope:[keyboard_matrix_col] from - (byte~) keyboard_matrix_col::$0 ← *((byte[]) keyboard_matrix_chars + (byte) keyboard_matrix_col::ch) >> (byte/signed byte/word/signed word/dword/signed dword) 4 - (byte) keyboard_matrix_col::col_id ← (byte~) keyboard_matrix_col::$0 - (byte) keyboard_matrix_col::return ← *((byte[]) keyboard_matrix_col_bitmask + (byte) keyboard_matrix_col::col_id) - to:keyboard_matrix_col::@return -keyboard_matrix_col::@return: scope:[keyboard_matrix_col] from keyboard_matrix_col keyboard_matrix_col::@1 - (byte) keyboard_matrix_col::return ← (byte) keyboard_matrix_col::return - return (byte) keyboard_matrix_col::return - to:@return -keyboard_matrix_col::@1: scope:[keyboard_matrix_col] from - to:keyboard_matrix_col::@return -@6: scope:[] from @5 call main to:@end -@end: scope:[] from @6 +@end: scope:[] from @5 Eliminating unused variable (byte*) PROCPORT and assignment [0] (byte*) PROCPORT ← ((byte*)) (byte/signed byte/word/signed word/dword/signed dword) 1 Eliminating unused variable (byte*) CHARGEN and assignment [1] (byte*) CHARGEN ← ((byte*)) (word/dword/signed dword) 53248 @@ -671,37 +934,52 @@ Eliminating unused variable (byte*) SPRITES_MC1 and assignment [13] (byte*) SPRI Eliminating unused variable (byte*) SPRITES_MC2 and assignment [14] (byte*) SPRITES_MC2 ← ((byte*)) (word/dword/signed dword) 53286 Eliminating unused variable (byte*) SPRITES_COLS and assignment [15] (byte*) SPRITES_COLS ← ((byte*)) (word/dword/signed dword) 53287 Eliminating unused variable (byte*) COLS and assignment [16] (byte*) COLS ← ((byte*)) (word/dword/signed dword) 55296 -Eliminating unused variable (byte) BLACK and assignment [17] (byte) BLACK ← (byte/signed byte/word/signed word/dword/signed dword) 0 -Eliminating unused variable (byte) WHITE and assignment [18] (byte) WHITE ← (byte/signed byte/word/signed word/dword/signed dword) 1 -Eliminating unused variable (byte) RED and assignment [19] (byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2 -Eliminating unused variable (byte) CYAN and assignment [20] (byte) CYAN ← (byte/signed byte/word/signed word/dword/signed dword) 3 -Eliminating unused variable (byte) PURPLE and assignment [21] (byte) PURPLE ← (byte/signed byte/word/signed word/dword/signed dword) 4 -Eliminating unused variable (byte) GREEN and assignment [22] (byte) GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 5 -Eliminating unused variable (byte) BLUE and assignment [23] (byte) BLUE ← (byte/signed byte/word/signed word/dword/signed dword) 6 -Eliminating unused variable (byte) YELLOW and assignment [24] (byte) YELLOW ← (byte/signed byte/word/signed word/dword/signed dword) 7 -Eliminating unused variable (byte) ORANGE and assignment [25] (byte) ORANGE ← (byte/signed byte/word/signed word/dword/signed dword) 8 -Eliminating unused variable (byte) BROWN and assignment [26] (byte) BROWN ← (byte/signed byte/word/signed word/dword/signed dword) 9 -Eliminating unused variable (byte) PINK and assignment [27] (byte) PINK ← (byte/signed byte/word/signed word/dword/signed dword) 10 -Eliminating unused variable (byte) DARK_GREY and assignment [28] (byte) DARK_GREY ← (byte/signed byte/word/signed word/dword/signed dword) 11 -Eliminating unused variable (byte) GREY and assignment [29] (byte) GREY ← (byte/signed byte/word/signed word/dword/signed dword) 12 -Eliminating unused variable (byte) LIGHT_GREEN and assignment [30] (byte) LIGHT_GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 13 -Eliminating unused variable (byte) LIGHT_BLUE and assignment [31] (byte) LIGHT_BLUE ← (byte/signed byte/word/signed word/dword/signed dword) 14 -Eliminating unused variable (byte) LIGHT_GREY and assignment [32] (byte) LIGHT_GREY ← (byte/signed byte/word/signed word/dword/signed dword) 15 +Eliminating unused variable (byte) BLACK and assignment [21] (byte) BLACK ← (byte/signed byte/word/signed word/dword/signed dword) 0 +Eliminating unused variable (byte) WHITE and assignment [22] (byte) WHITE ← (byte/signed byte/word/signed word/dword/signed dword) 1 +Eliminating unused variable (byte) RED and assignment [23] (byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2 +Eliminating unused variable (byte) CYAN and assignment [24] (byte) CYAN ← (byte/signed byte/word/signed word/dword/signed dword) 3 +Eliminating unused variable (byte) PURPLE and assignment [25] (byte) PURPLE ← (byte/signed byte/word/signed word/dword/signed dword) 4 +Eliminating unused variable (byte) GREEN and assignment [26] (byte) GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 5 +Eliminating unused variable (byte) BLUE and assignment [27] (byte) BLUE ← (byte/signed byte/word/signed word/dword/signed dword) 6 +Eliminating unused variable (byte) YELLOW and assignment [28] (byte) YELLOW ← (byte/signed byte/word/signed word/dword/signed dword) 7 +Eliminating unused variable (byte) ORANGE and assignment [29] (byte) ORANGE ← (byte/signed byte/word/signed word/dword/signed dword) 8 +Eliminating unused variable (byte) BROWN and assignment [30] (byte) BROWN ← (byte/signed byte/word/signed word/dword/signed dword) 9 +Eliminating unused variable (byte) PINK and assignment [31] (byte) PINK ← (byte/signed byte/word/signed word/dword/signed dword) 10 +Eliminating unused variable (byte) DARK_GREY and assignment [32] (byte) DARK_GREY ← (byte/signed byte/word/signed word/dword/signed dword) 11 +Eliminating unused variable (byte) GREY and assignment [33] (byte) GREY ← (byte/signed byte/word/signed word/dword/signed dword) 12 +Eliminating unused variable (byte) LIGHT_GREEN and assignment [34] (byte) LIGHT_GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 13 +Eliminating unused variable (byte) LIGHT_BLUE and assignment [35] (byte) LIGHT_BLUE ← (byte/signed byte/word/signed word/dword/signed dword) 14 +Eliminating unused variable (byte) LIGHT_GREY and assignment [36] (byte) LIGHT_GREY ← (byte/signed byte/word/signed word/dword/signed dword) 15 +Eliminating unused variable (byte) KEY_DEL and assignment [37] (byte) KEY_DEL ← (byte/signed byte/word/signed word/dword/signed dword) 0 +Eliminating unused variable (byte) KEY_RETURN and assignment [38] (byte) KEY_RETURN ← (byte/signed byte/word/signed word/dword/signed dword) 1 +Eliminating unused variable (byte) KEY_CRSR_RIGHT and assignment [39] (byte) KEY_CRSR_RIGHT ← (byte/signed byte/word/signed word/dword/signed dword) 2 +Eliminating unused variable (byte) KEY_F7 and assignment [40] (byte) KEY_F7 ← (byte/signed byte/word/signed word/dword/signed dword) 3 +Eliminating unused variable (byte) KEY_F5 and assignment [41] (byte) KEY_F5 ← (byte/signed byte/word/signed word/dword/signed dword) 4 +Eliminating unused variable (byte) KEY_F3 and assignment [42] (byte) KEY_F3 ← (byte/signed byte/word/signed word/dword/signed dword) 5 +Eliminating unused variable (byte) KEY_F1 and assignment [43] (byte) KEY_F1 ← (byte/signed byte/word/signed word/dword/signed dword) 6 +Eliminating unused variable (byte) KEY_CRSR_DOWN and assignment [44] (byte) KEY_CRSR_DOWN ← (byte/signed byte/word/signed word/dword/signed dword) 7 +Eliminating unused variable (byte) KEY_LSHIFT and assignment [52] (byte) KEY_LSHIFT ← (byte/signed byte/word/signed word/dword/signed dword) 15 +Eliminating unused variable (byte) KEY_P and assignment [78] (byte) KEY_P ← (byte/signed byte/word/signed word/dword/signed dword) 41 +Eliminating unused variable (byte) KEY_HOME and assignment [88] (byte) KEY_HOME ← (byte/signed byte/word/signed word/dword/signed dword) 51 +Eliminating unused variable (byte) KEY_RSHIFT and assignment [89] (byte) KEY_RSHIFT ← (byte/signed byte/word/signed word/dword/signed dword) 52 +Eliminating unused variable (byte) KEY_CTRL and assignment [95] (byte) KEY_CTRL ← (byte/signed byte/word/signed word/dword/signed dword) 58 +Eliminating unused variable (byte) KEY_COMMODORE and assignment [98] (byte) KEY_COMMODORE ← (byte/signed byte/word/signed word/dword/signed dword) 61 +Eliminating unused variable (byte) KEY_RUNSTOP and assignment [100] (byte) KEY_RUNSTOP ← (byte/signed byte/word/signed word/dword/signed dword) 63 Eliminating unused variable - keeping the call (void~) main::$2 -Removing empty block main::@14 -Removing empty block main::@4 -Removing empty block main::@15 -Removing empty block main::@18 -Removing empty block main::@22 -Removing empty block main::@23 -Removing empty block main::@24 Removing empty block @1 -Removing empty block @2 -Removing empty block keyboard_char_pressed::@1 Removing empty block keyboard_matrix_read::@1 -Removing empty block keyboard_matrix_row::@1 -Removing empty block @5 -Removing empty block keyboard_matrix_col::@1 +Removing empty block @2 +Removing empty block keyboard_key_pressed::@1 +Removing empty block @3 +Removing empty block keyboard_get_keycode::@1 +Removing empty block @4 +Removing empty block main::@15 +Removing empty block main::@4 +Removing empty block main::@16 +Removing empty block main::@19 +Removing empty block main::@24 +Removing empty block main::@25 +Removing empty block main::@26 PROCEDURE MODIFY VARIABLE ANALYSIS Completing Phi functions... @@ -717,8 +995,108 @@ CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN (byte*) CIA1_PORT_B#0 ← ((byte*)) (word/dword/signed dword) 56321 (byte*) CIA1_PORT_A_DDR#0 ← ((byte*)) (word/dword/signed dword) 56322 (byte*) CIA1_PORT_B_DDR#0 ← ((byte*)) (word/dword/signed dword) 56323 - to:@3 -main: scope:[main] from @6 + (byte) KEY_3#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8 + (byte) KEY_W#0 ← (byte/signed byte/word/signed word/dword/signed dword) 9 + (byte) KEY_A#0 ← (byte/signed byte/word/signed word/dword/signed dword) 10 + (byte) KEY_4#0 ← (byte/signed byte/word/signed word/dword/signed dword) 11 + (byte) KEY_Z#0 ← (byte/signed byte/word/signed word/dword/signed dword) 12 + (byte) KEY_S#0 ← (byte/signed byte/word/signed word/dword/signed dword) 13 + (byte) KEY_E#0 ← (byte/signed byte/word/signed word/dword/signed dword) 14 + (byte) KEY_5#0 ← (byte/signed byte/word/signed word/dword/signed dword) 16 + (byte) KEY_R#0 ← (byte/signed byte/word/signed word/dword/signed dword) 17 + (byte) KEY_D#0 ← (byte/signed byte/word/signed word/dword/signed dword) 18 + (byte) KEY_6#0 ← (byte/signed byte/word/signed word/dword/signed dword) 19 + (byte) KEY_C#0 ← (byte/signed byte/word/signed word/dword/signed dword) 20 + (byte) KEY_F#0 ← (byte/signed byte/word/signed word/dword/signed dword) 21 + (byte) KEY_T#0 ← (byte/signed byte/word/signed word/dword/signed dword) 22 + (byte) KEY_X#0 ← (byte/signed byte/word/signed word/dword/signed dword) 23 + (byte) KEY_7#0 ← (byte/signed byte/word/signed word/dword/signed dword) 24 + (byte) KEY_Y#0 ← (byte/signed byte/word/signed word/dword/signed dword) 25 + (byte) KEY_G#0 ← (byte/signed byte/word/signed word/dword/signed dword) 26 + (byte) KEY_8#0 ← (byte/signed byte/word/signed word/dword/signed dword) 27 + (byte) KEY_B#0 ← (byte/signed byte/word/signed word/dword/signed dword) 28 + (byte) KEY_H#0 ← (byte/signed byte/word/signed word/dword/signed dword) 29 + (byte) KEY_U#0 ← (byte/signed byte/word/signed word/dword/signed dword) 30 + (byte) KEY_V#0 ← (byte/signed byte/word/signed word/dword/signed dword) 31 + (byte) KEY_9#0 ← (byte/signed byte/word/signed word/dword/signed dword) 32 + (byte) KEY_I#0 ← (byte/signed byte/word/signed word/dword/signed dword) 33 + (byte) KEY_J#0 ← (byte/signed byte/word/signed word/dword/signed dword) 34 + (byte) KEY_0#0 ← (byte/signed byte/word/signed word/dword/signed dword) 35 + (byte) KEY_M#0 ← (byte/signed byte/word/signed word/dword/signed dword) 36 + (byte) KEY_K#0 ← (byte/signed byte/word/signed word/dword/signed dword) 37 + (byte) KEY_O#0 ← (byte/signed byte/word/signed word/dword/signed dword) 38 + (byte) KEY_N#0 ← (byte/signed byte/word/signed word/dword/signed dword) 39 + (byte) KEY_PLUS#0 ← (byte/signed byte/word/signed word/dword/signed dword) 40 + (byte) KEY_L#0 ← (byte/signed byte/word/signed word/dword/signed dword) 42 + (byte) KEY_MINUS#0 ← (byte/signed byte/word/signed word/dword/signed dword) 43 + (byte) KEY_DOT#0 ← (byte/signed byte/word/signed word/dword/signed dword) 44 + (byte) KEY_COLON#0 ← (byte/signed byte/word/signed word/dword/signed dword) 45 + (byte) KEY_AT#0 ← (byte/signed byte/word/signed word/dword/signed dword) 46 + (byte) KEY_COMMA#0 ← (byte/signed byte/word/signed word/dword/signed dword) 47 + (byte) KEY_POUND#0 ← (byte/signed byte/word/signed word/dword/signed dword) 48 + (byte) KEY_ASTERISK#0 ← (byte/signed byte/word/signed word/dword/signed dword) 49 + (byte) KEY_SEMICOLON#0 ← (byte/signed byte/word/signed word/dword/signed dword) 50 + (byte) KEY_EQUALS#0 ← (byte/signed byte/word/signed word/dword/signed dword) 53 + (byte) KEY_ARROW_UP#0 ← (byte/signed byte/word/signed word/dword/signed dword) 54 + (byte) KEY_SLASH#0 ← (byte/signed byte/word/signed word/dword/signed dword) 55 + (byte) KEY_1#0 ← (byte/signed byte/word/signed word/dword/signed dword) 56 + (byte) KEY_ARROW_LEFT#0 ← (byte/signed byte/word/signed word/dword/signed dword) 57 + (byte) KEY_2#0 ← (byte/signed byte/word/signed word/dword/signed dword) 59 + (byte) KEY_SPACE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 60 + (byte) KEY_Q#0 ← (byte/signed byte/word/signed word/dword/signed dword) 62 + (byte[]) keyboard_char_keycodes#0 ← { (byte) KEY_AT#0, (byte) KEY_A#0, (byte) KEY_B#0, (byte) KEY_C#0, (byte) KEY_D#0, (byte) KEY_E#0, (byte) KEY_F#0, (byte) KEY_G#0, (byte) KEY_H#0, (byte) KEY_I#0, (byte) KEY_J#0, (byte) KEY_K#0, (byte) KEY_L#0, (byte) KEY_M#0, (byte) KEY_N#0, (byte) KEY_O#0, (byte) KEY_O#0, (byte) KEY_Q#0, (byte) KEY_R#0, (byte) KEY_S#0, (byte) KEY_T#0, (byte) KEY_U#0, (byte) KEY_V#0, (byte) KEY_W#0, (byte) KEY_X#0, (byte) KEY_Y#0, (byte) KEY_Z#0, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte) KEY_POUND#0, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte) KEY_ARROW_UP#0, (byte) KEY_ARROW_LEFT#0, (byte) KEY_SPACE#0, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte) KEY_ASTERISK#0, (byte) KEY_PLUS#0, (byte) KEY_COMMA#0, (byte) KEY_MINUS#0, (byte) KEY_DOT#0, (byte) KEY_SLASH#0, (byte) KEY_0#0, (byte) KEY_1#0, (byte) KEY_2#0, (byte) KEY_3#0, (byte) KEY_4#0, (byte) KEY_5#0, (byte) KEY_6#0, (byte) KEY_7#0, (byte) KEY_8#0, (byte) KEY_9#0, (byte) KEY_COLON#0, (byte) KEY_SEMICOLON#0, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte) KEY_EQUALS#0, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63 } + (byte[8]) keyboard_matrix_row_bitmask#0 ← { (byte/word/signed word/dword/signed dword) 254, (byte/word/signed word/dword/signed dword) 253, (byte/word/signed word/dword/signed dword) 251, (byte/word/signed word/dword/signed dword) 247, (byte/word/signed word/dword/signed dword) 239, (byte/word/signed word/dword/signed dword) 223, (byte/word/signed word/dword/signed dword) 191, (byte/signed byte/word/signed word/dword/signed dword) 127 } + (byte[]) keyboard_matrix_col_bitmask#0 ← { (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 4, (byte/signed byte/word/signed word/dword/signed dword) 8, (byte/signed byte/word/signed word/dword/signed dword) 16, (byte/signed byte/word/signed word/dword/signed dword) 32, (byte/signed byte/word/signed word/dword/signed dword) 64, (byte/word/signed word/dword/signed dword) 128 } + to:@5 +keyboard_init: scope:[keyboard_init] from main::@14 + *((byte*) CIA1_PORT_A_DDR#0) ← (byte/word/signed word/dword/signed dword) 255 + *((byte*) CIA1_PORT_B_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:keyboard_init::@return +keyboard_init::@return: scope:[keyboard_init] from keyboard_init + return + to:@return +keyboard_matrix_read: scope:[keyboard_matrix_read] from keyboard_key_pressed main::@6 + (byte) keyboard_matrix_read::rowid#2 ← phi( keyboard_key_pressed/(byte) keyboard_matrix_read::rowid#0 main::@6/(byte) keyboard_matrix_read::rowid#1 ) + *((byte*) CIA1_PORT_A#0) ← *((byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#2) + (byte~) keyboard_matrix_read::$0 ← ~ *((byte*) CIA1_PORT_B#0) + (byte) keyboard_matrix_read::row_pressed_bits#0 ← (byte~) keyboard_matrix_read::$0 + (byte) keyboard_matrix_read::return#0 ← (byte) keyboard_matrix_read::row_pressed_bits#0 + to:keyboard_matrix_read::@return +keyboard_matrix_read::@return: scope:[keyboard_matrix_read] from keyboard_matrix_read + (byte) keyboard_matrix_read::return#4 ← phi( keyboard_matrix_read/(byte) keyboard_matrix_read::return#0 ) + (byte) keyboard_matrix_read::return#1 ← (byte) keyboard_matrix_read::return#4 + return + to:@return +keyboard_key_pressed: scope:[keyboard_key_pressed] from main::@22 + (byte) keyboard_key_pressed::key#1 ← phi( main::@22/(byte) keyboard_key_pressed::key#0 ) + (byte~) keyboard_key_pressed::$0 ← (byte) keyboard_key_pressed::key#1 >> (byte/signed byte/word/signed word/dword/signed dword) 3 + (byte) keyboard_matrix_read::rowid#0 ← (byte~) keyboard_key_pressed::$0 + call keyboard_matrix_read param-assignment + (byte) keyboard_matrix_read::return#2 ← (byte) keyboard_matrix_read::return#1 + to:keyboard_key_pressed::@2 +keyboard_key_pressed::@2: scope:[keyboard_key_pressed] from keyboard_key_pressed + (byte) keyboard_key_pressed::key#2 ← phi( keyboard_key_pressed/(byte) keyboard_key_pressed::key#1 ) + (byte) keyboard_matrix_read::return#5 ← phi( keyboard_key_pressed/(byte) keyboard_matrix_read::return#2 ) + (byte~) keyboard_key_pressed::$1 ← (byte) keyboard_matrix_read::return#5 + (byte~) keyboard_key_pressed::$2 ← (byte) keyboard_key_pressed::key#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 + (byte~) keyboard_key_pressed::$3 ← (byte~) keyboard_key_pressed::$1 & *((byte[]) keyboard_matrix_col_bitmask#0 + (byte~) keyboard_key_pressed::$2) + (byte) keyboard_key_pressed::return#0 ← (byte~) keyboard_key_pressed::$3 + to:keyboard_key_pressed::@return +keyboard_key_pressed::@return: scope:[keyboard_key_pressed] from keyboard_key_pressed::@2 + (byte) keyboard_key_pressed::return#3 ← phi( keyboard_key_pressed::@2/(byte) keyboard_key_pressed::return#0 ) + (byte) keyboard_key_pressed::return#1 ← (byte) keyboard_key_pressed::return#3 + return + to:@return +keyboard_get_keycode: scope:[keyboard_get_keycode] from main::@10 + (byte) keyboard_get_keycode::ch#1 ← phi( main::@10/(byte) keyboard_get_keycode::ch#0 ) + (byte) keyboard_get_keycode::return#0 ← *((byte[]) keyboard_char_keycodes#0 + (byte) keyboard_get_keycode::ch#1) + to:keyboard_get_keycode::@return +keyboard_get_keycode::@return: scope:[keyboard_get_keycode] from keyboard_get_keycode + (byte) keyboard_get_keycode::return#3 ← phi( keyboard_get_keycode/(byte) keyboard_get_keycode::return#0 ) + (byte) keyboard_get_keycode::return#1 ← (byte) keyboard_get_keycode::return#3 + return + to:@return +main: scope:[main] from @5 (byte*) main::sc#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 to:main::@1 main::@1: scope:[main] from main main::@1 @@ -728,13 +1106,13 @@ main::@1: scope:[main] from main main::@1 (word/signed word/dword/signed dword~) main::$0 ← (word/signed word/dword/signed dword) 1024 + (word/signed word/dword/signed dword) 1000 (boolean~) main::$1 ← (byte*) main::sc#1 < (word/signed word/dword/signed dword~) main::$0 if((boolean~) main::$1) goto main::@1 - to:main::@13 -main::@13: scope:[main] from main::@1 + to:main::@14 +main::@14: scope:[main] from main::@1 call keyboard_init param-assignment - to:main::@25 -main::@25: scope:[main] from main::@13 + to:main::@27 +main::@27: scope:[main] from main::@14 to:main::@2 -main::@2: scope:[main] from main::@12 main::@25 +main::@2: scope:[main] from main::@13 main::@27 if(true) goto main::@3 to:main::@return main::@3: scope:[main] from main::@2 @@ -742,36 +1120,36 @@ main::@3: scope:[main] from main::@2 main::@5: scope:[main] from main::@3 main::@5 (boolean~) main::$3 ← *((byte*) RASTER#0) != (byte/word/signed word/dword/signed dword) 255 if((boolean~) main::$3) goto main::@5 - to:main::@16 -main::@16: scope:[main] from main::@5 + to:main::@17 +main::@17: scope:[main] from main::@5 (byte*) main::screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 (byte) main::row#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 to:main::@6 -main::@6: scope:[main] from main::@16 main::@19 - (byte*) main::screen#14 ← phi( main::@16/(byte*) main::screen#0 main::@19/(byte*) main::screen#1 ) - (byte) main::row#2 ← phi( main::@16/(byte) main::row#0 main::@19/(byte) main::row#1 ) - (byte) keyboard_matrix_read::rowid#0 ← (byte) main::row#2 +main::@6: scope:[main] from main::@17 main::@20 + (byte*) main::screen#17 ← phi( main::@17/(byte*) main::screen#0 main::@20/(byte*) main::screen#1 ) + (byte) main::row#2 ← phi( main::@17/(byte) main::row#0 main::@20/(byte) main::row#1 ) + (byte) keyboard_matrix_read::rowid#1 ← (byte) main::row#2 call keyboard_matrix_read param-assignment - (byte) keyboard_matrix_read::return#0 ← (byte) keyboard_matrix_read::return#3 - to:main::@26 -main::@26: scope:[main] from main::@6 + (byte) keyboard_matrix_read::return#3 ← (byte) keyboard_matrix_read::return#1 + to:main::@28 +main::@28: scope:[main] from main::@6 (byte) main::row#8 ← phi( main::@6/(byte) main::row#2 ) - (byte*) main::screen#12 ← phi( main::@6/(byte*) main::screen#14 ) - (byte) keyboard_matrix_read::return#4 ← phi( main::@6/(byte) keyboard_matrix_read::return#0 ) - (byte~) main::$4 ← (byte) keyboard_matrix_read::return#4 + (byte*) main::screen#13 ← phi( main::@6/(byte*) main::screen#17 ) + (byte) keyboard_matrix_read::return#6 ← phi( main::@6/(byte) keyboard_matrix_read::return#3 ) + (byte~) main::$4 ← (byte) keyboard_matrix_read::return#6 (byte) main::row_pressed_bits#0 ← (byte~) main::$4 (byte) main::col#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 to:main::@7 -main::@7: scope:[main] from main::@26 main::@9 - (byte) main::row#7 ← phi( main::@26/(byte) main::row#8 main::@9/(byte) main::row#4 ) - (byte) main::col#5 ← phi( main::@26/(byte) main::col#0 main::@9/(byte) main::col#1 ) - (byte*) main::screen#9 ← phi( main::@26/(byte*) main::screen#12 main::@9/(byte*) main::screen#10 ) - (byte) main::row_pressed_bits#2 ← phi( main::@26/(byte) main::row_pressed_bits#0 main::@9/(byte) main::row_pressed_bits#1 ) +main::@7: scope:[main] from main::@28 main::@9 + (byte) main::row#7 ← phi( main::@28/(byte) main::row#8 main::@9/(byte) main::row#4 ) + (byte) main::col#5 ← phi( main::@28/(byte) main::col#0 main::@9/(byte) main::col#1 ) + (byte*) main::screen#9 ← phi( main::@28/(byte*) main::screen#13 main::@9/(byte*) main::screen#10 ) + (byte) main::row_pressed_bits#2 ← phi( main::@28/(byte) main::row_pressed_bits#0 main::@9/(byte) main::row_pressed_bits#1 ) (byte~) main::$5 ← (byte) main::row_pressed_bits#2 & (byte/word/signed word/dword/signed dword) 128 (boolean~) main::$6 ← (byte~) main::$5 != (byte/signed byte/word/signed word/dword/signed dword) 0 (boolean~) main::$7 ← ! (boolean~) main::$6 if((boolean~) main::$7) goto main::@8 - to:main::@17 + to:main::@18 main::@8: scope:[main] from main::@7 (byte) main::row#6 ← phi( main::@7/(byte) main::row#7 ) (byte) main::row_pressed_bits#5 ← phi( main::@7/(byte) main::row_pressed_bits#2 ) @@ -779,25 +1157,25 @@ main::@8: scope:[main] from main::@7 (byte*) main::screen#3 ← phi( main::@7/(byte*) main::screen#9 ) *((byte*) main::screen#3 + (byte) main::col#2) ← (byte) '0' to:main::@9 -main::@17: scope:[main] from main::@7 +main::@18: scope:[main] from main::@7 (byte) main::row#5 ← phi( main::@7/(byte) main::row#7 ) (byte) main::row_pressed_bits#4 ← phi( main::@7/(byte) main::row_pressed_bits#2 ) (byte) main::col#3 ← phi( main::@7/(byte) main::col#5 ) (byte*) main::screen#4 ← phi( main::@7/(byte*) main::screen#9 ) *((byte*) main::screen#4 + (byte) main::col#3) ← (byte) '1' to:main::@9 -main::@9: scope:[main] from main::@17 main::@8 - (byte) main::row#4 ← phi( main::@17/(byte) main::row#5 main::@8/(byte) main::row#6 ) - (byte*) main::screen#10 ← phi( main::@17/(byte*) main::screen#4 main::@8/(byte*) main::screen#3 ) - (byte) main::col#4 ← phi( main::@17/(byte) main::col#3 main::@8/(byte) main::col#2 ) - (byte) main::row_pressed_bits#3 ← phi( main::@17/(byte) main::row_pressed_bits#4 main::@8/(byte) main::row_pressed_bits#5 ) +main::@9: scope:[main] from main::@18 main::@8 + (byte) main::row#4 ← phi( main::@18/(byte) main::row#5 main::@8/(byte) main::row#6 ) + (byte*) main::screen#10 ← phi( main::@18/(byte*) main::screen#4 main::@8/(byte*) main::screen#3 ) + (byte) main::col#4 ← phi( main::@18/(byte) main::col#3 main::@8/(byte) main::col#2 ) + (byte) main::row_pressed_bits#3 ← phi( main::@18/(byte) main::row_pressed_bits#4 main::@8/(byte) main::row_pressed_bits#5 ) (byte~) main::$8 ← (byte) main::row_pressed_bits#3 << (byte/signed byte/word/signed word/dword/signed dword) 1 (byte) main::row_pressed_bits#1 ← (byte~) main::$8 (byte) main::col#1 ← ++ (byte) main::col#4 (boolean~) main::$9 ← (byte) main::col#1 != (byte/signed byte/word/signed word/dword/signed dword) 8 if((boolean~) main::$9) goto main::@7 - to:main::@19 -main::@19: scope:[main] from main::@9 + to:main::@20 +main::@20: scope:[main] from main::@9 (byte) main::row#3 ← phi( main::@9/(byte) main::row#4 ) (byte*) main::screen#5 ← phi( main::@9/(byte*) main::screen#10 ) (byte*~) main::$10 ← (byte*) main::screen#5 + (byte/signed byte/word/signed word/dword/signed dword) 40 @@ -805,145 +1183,93 @@ main::@19: scope:[main] from main::@9 (byte) main::row#1 ← ++ (byte) main::row#3 (boolean~) main::$11 ← (byte) main::row#1 != (byte/signed byte/word/signed word/dword/signed dword) 8 if((boolean~) main::$11) goto main::@6 - to:main::@20 -main::@20: scope:[main] from main::@19 - (byte*) main::screen#6 ← phi( main::@19/(byte*) main::screen#1 ) + to:main::@21 +main::@21: scope:[main] from main::@20 + (byte*) main::screen#6 ← phi( main::@20/(byte*) main::screen#1 ) (byte*~) main::$12 ← (byte*) main::screen#6 + (byte/signed byte/word/signed word/dword/signed dword) 40 (byte*) main::screen#2 ← (byte*~) main::$12 - (byte[]) main::chars#0 ← { (byte) '@', (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e' } (byte) main::i#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + (byte) main::ch#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 to:main::@10 -main::@10: scope:[main] from main::@12 main::@20 - (byte*) main::screen#13 ← phi( main::@12/(byte*) main::screen#15 main::@20/(byte*) main::screen#2 ) - (byte) main::i#2 ← phi( main::@12/(byte) main::i#1 main::@20/(byte) main::i#0 ) - (byte) main::ch#0 ← *((byte[]) main::chars#0 + (byte) main::i#2) - (byte) keyboard_char_pressed::ch#0 ← (byte) main::ch#0 - call keyboard_char_pressed param-assignment - (byte) keyboard_char_pressed::return#0 ← (byte) keyboard_char_pressed::return#2 - to:main::@27 -main::@27: scope:[main] from main::@10 - (byte) main::ch#2 ← phi( main::@10/(byte) main::ch#0 ) - (byte) main::i#6 ← phi( main::@10/(byte) main::i#2 ) - (byte*) main::screen#11 ← phi( main::@10/(byte*) main::screen#13 ) - (byte) keyboard_char_pressed::return#3 ← phi( main::@10/(byte) keyboard_char_pressed::return#0 ) - (byte~) main::$13 ← (byte) keyboard_char_pressed::return#3 - (boolean~) main::$14 ← (byte~) main::$13 != (byte/signed byte/word/signed word/dword/signed dword) 0 +main::@10: scope:[main] from main::@11 main::@21 + (byte) main::i#10 ← phi( main::@11/(byte) main::i#6 main::@21/(byte) main::i#0 ) + (byte*) main::screen#18 ← phi( main::@11/(byte*) main::screen#12 main::@21/(byte*) main::screen#2 ) + (byte) main::ch#2 ← phi( main::@11/(byte) main::ch#1 main::@21/(byte) main::ch#0 ) + (byte) keyboard_get_keycode::ch#0 ← (byte) main::ch#2 + call keyboard_get_keycode param-assignment + (byte) keyboard_get_keycode::return#2 ← (byte) keyboard_get_keycode::return#1 + to:main::@29 +main::@29: scope:[main] from main::@10 + (byte) main::i#8 ← phi( main::@10/(byte) main::i#10 ) + (byte*) main::screen#15 ← phi( main::@10/(byte*) main::screen#18 ) + (byte) main::ch#6 ← phi( main::@10/(byte) main::ch#2 ) + (byte) keyboard_get_keycode::return#4 ← phi( main::@10/(byte) keyboard_get_keycode::return#2 ) + (byte~) main::$13 ← (byte) keyboard_get_keycode::return#4 + (byte) main::key#0 ← (byte~) main::$13 + (boolean~) main::$14 ← (byte) main::key#0 != (byte/signed byte/word/signed word/dword/signed dword) 63 (boolean~) main::$15 ← ! (boolean~) main::$14 if((boolean~) main::$15) goto main::@11 - to:main::@21 -main::@11: scope:[main] from main::@27 - (byte) main::i#3 ← phi( main::@27/(byte) main::i#6 ) - (byte*) main::screen#7 ← phi( main::@27/(byte*) main::screen#11 ) - *((byte*) main::screen#7 + (byte) main::i#3) ← (byte) ' ' - to:main::@12 -main::@21: scope:[main] from main::@27 - (byte) main::i#4 ← phi( main::@27/(byte) main::i#6 ) - (byte*) main::screen#8 ← phi( main::@27/(byte*) main::screen#11 ) - (byte) main::ch#1 ← phi( main::@27/(byte) main::ch#2 ) - *((byte*) main::screen#8 + (byte) main::i#4) ← (byte) main::ch#1 - to:main::@12 -main::@12: scope:[main] from main::@11 main::@21 - (byte*) main::screen#15 ← phi( main::@11/(byte*) main::screen#7 main::@21/(byte*) main::screen#8 ) - (byte) main::i#5 ← phi( main::@11/(byte) main::i#3 main::@21/(byte) main::i#4 ) - (byte) main::i#1 ← ++ (byte) main::i#5 - (boolean~) main::$16 ← (byte) main::i#1 != (byte/signed byte/word/signed word/dword/signed dword) 6 - if((boolean~) main::$16) goto main::@10 + to:main::@22 +main::@11: scope:[main] from main::@12 main::@23 main::@29 + (byte) main::i#6 ← phi( main::@12/(byte) main::i#7 main::@23/(byte) main::i#1 main::@29/(byte) main::i#8 ) + (byte*) main::screen#12 ← phi( main::@12/(byte*) main::screen#14 main::@23/(byte*) main::screen#7 main::@29/(byte*) main::screen#15 ) + (byte) main::ch#3 ← phi( main::@12/(byte) main::ch#5 main::@23/(byte) main::ch#4 main::@29/(byte) main::ch#6 ) + (byte) main::ch#1 ← ++ (byte) main::ch#3 + (boolean~) main::$19 ← (byte) main::ch#1 != (byte/signed byte/word/signed word/dword/signed dword) 64 + if((boolean~) main::$19) goto main::@10 + to:main::@13 +main::@22: scope:[main] from main::@29 + (byte) main::i#9 ← phi( main::@29/(byte) main::i#8 ) + (byte*) main::screen#16 ← phi( main::@29/(byte*) main::screen#15 ) + (byte) main::ch#8 ← phi( main::@29/(byte) main::ch#6 ) + (byte) main::key#1 ← phi( main::@29/(byte) main::key#0 ) + (byte) keyboard_key_pressed::key#0 ← (byte) main::key#1 + call keyboard_key_pressed param-assignment + (byte) keyboard_key_pressed::return#2 ← (byte) keyboard_key_pressed::return#1 + to:main::@30 +main::@30: scope:[main] from main::@22 + (byte) main::i#5 ← phi( main::@22/(byte) main::i#9 ) + (byte*) main::screen#11 ← phi( main::@22/(byte*) main::screen#16 ) + (byte) main::ch#7 ← phi( main::@22/(byte) main::ch#8 ) + (byte) keyboard_key_pressed::return#4 ← phi( main::@22/(byte) keyboard_key_pressed::return#2 ) + (byte~) main::$16 ← (byte) keyboard_key_pressed::return#4 + (boolean~) main::$17 ← (byte~) main::$16 != (byte/signed byte/word/signed word/dword/signed dword) 0 + (boolean~) main::$18 ← ! (boolean~) main::$17 + if((boolean~) main::$18) goto main::@12 + to:main::@23 +main::@12: scope:[main] from main::@30 + (byte) main::i#7 ← phi( main::@30/(byte) main::i#5 ) + (byte*) main::screen#14 ← phi( main::@30/(byte*) main::screen#11 ) + (byte) main::ch#5 ← phi( main::@30/(byte) main::ch#7 ) + to:main::@11 +main::@23: scope:[main] from main::@30 + (byte) main::i#3 ← phi( main::@30/(byte) main::i#5 ) + (byte*) main::screen#7 ← phi( main::@30/(byte*) main::screen#11 ) + (byte) main::ch#4 ← phi( main::@30/(byte) main::ch#7 ) + *((byte*) main::screen#7 + (byte) main::i#3) ← (byte) main::ch#4 + (byte) main::i#1 ← ++ (byte) main::i#3 + to:main::@11 +main::@13: scope:[main] from main::@11 main::@13 + (byte) main::i#4 ← phi( main::@11/(byte) main::i#6 main::@13/(byte) main::i#2 ) + (byte*) main::screen#8 ← phi( main::@11/(byte*) main::screen#12 main::@13/(byte*) main::screen#8 ) + *((byte*) main::screen#8 + (byte) main::i#4) ← (byte) ' ' + (byte) main::i#2 ← ++ (byte) main::i#4 + (boolean~) main::$20 ← (byte) main::i#2 < (byte/signed byte/word/signed word/dword/signed dword) 5 + if((boolean~) main::$20) goto main::@13 to:main::@2 main::@return: scope:[main] from main::@2 return to:@return -keyboard_init: scope:[keyboard_init] from main::@13 - *((byte*) CIA1_PORT_A_DDR#0) ← (byte/word/signed word/dword/signed dword) 255 - *((byte*) CIA1_PORT_B_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 - to:keyboard_init::@return -keyboard_init::@return: scope:[keyboard_init] from keyboard_init - return - to:@return -keyboard_char_pressed: scope:[keyboard_char_pressed] from main::@10 - (byte) keyboard_char_pressed::ch#1 ← phi( main::@10/(byte) keyboard_char_pressed::ch#0 ) - (byte) keyboard_matrix_row::ch#0 ← (byte) keyboard_char_pressed::ch#1 - call keyboard_matrix_row param-assignment - (byte) keyboard_matrix_row::return#0 ← (byte) keyboard_matrix_row::return#2 - to:keyboard_char_pressed::@2 -keyboard_char_pressed::@2: scope:[keyboard_char_pressed] from keyboard_char_pressed - (byte) keyboard_char_pressed::ch#3 ← phi( keyboard_char_pressed/(byte) keyboard_char_pressed::ch#1 ) - (byte) keyboard_matrix_row::return#3 ← phi( keyboard_char_pressed/(byte) keyboard_matrix_row::return#0 ) - (byte~) keyboard_char_pressed::$0 ← (byte) keyboard_matrix_row::return#3 - (byte) keyboard_matrix_read::rowid#1 ← (byte~) keyboard_char_pressed::$0 - call keyboard_matrix_read param-assignment - (byte) keyboard_matrix_read::return#1 ← (byte) keyboard_matrix_read::return#3 - to:keyboard_char_pressed::@3 -keyboard_char_pressed::@3: scope:[keyboard_char_pressed] from keyboard_char_pressed::@2 - (byte) keyboard_char_pressed::ch#2 ← phi( keyboard_char_pressed::@2/(byte) keyboard_char_pressed::ch#3 ) - (byte) keyboard_matrix_read::return#5 ← phi( keyboard_char_pressed::@2/(byte) keyboard_matrix_read::return#1 ) - (byte~) keyboard_char_pressed::$1 ← (byte) keyboard_matrix_read::return#5 - (byte) keyboard_matrix_col::ch#0 ← (byte) keyboard_char_pressed::ch#2 - call keyboard_matrix_col param-assignment - (byte) keyboard_matrix_col::return#0 ← (byte) keyboard_matrix_col::return#2 - to:keyboard_char_pressed::@4 -keyboard_char_pressed::@4: scope:[keyboard_char_pressed] from keyboard_char_pressed::@3 - (byte) keyboard_matrix_col::return#3 ← phi( keyboard_char_pressed::@3/(byte) keyboard_matrix_col::return#0 ) - (byte~) keyboard_char_pressed::$2 ← (byte) keyboard_matrix_col::return#3 - (byte~) keyboard_char_pressed::$3 ← (byte~) keyboard_char_pressed::$1 & (byte~) keyboard_char_pressed::$2 - (byte) keyboard_char_pressed::return#1 ← (byte~) keyboard_char_pressed::$3 - to:keyboard_char_pressed::@return -keyboard_char_pressed::@return: scope:[keyboard_char_pressed] from keyboard_char_pressed::@4 - (byte) keyboard_char_pressed::return#4 ← phi( keyboard_char_pressed::@4/(byte) keyboard_char_pressed::return#1 ) - (byte) keyboard_char_pressed::return#2 ← (byte) keyboard_char_pressed::return#4 - return - to:@return -@3: scope:[] from @begin - (byte[8]) keyboard_row_bits#0 ← { (byte/word/signed word/dword/signed dword) 254, (byte/word/signed word/dword/signed dword) 253, (byte/word/signed word/dword/signed dword) 251, (byte/word/signed word/dword/signed dword) 247, (byte/word/signed word/dword/signed dword) 239, (byte/word/signed word/dword/signed dword) 223, (byte/word/signed word/dword/signed dword) 191, (byte/signed byte/word/signed word/dword/signed dword) 127 } - to:@4 -keyboard_matrix_read: scope:[keyboard_matrix_read] from keyboard_char_pressed::@2 main::@6 - (byte) keyboard_matrix_read::rowid#2 ← phi( keyboard_char_pressed::@2/(byte) keyboard_matrix_read::rowid#1 main::@6/(byte) keyboard_matrix_read::rowid#0 ) - *((byte*) CIA1_PORT_A#0) ← *((byte[8]) keyboard_row_bits#0 + (byte) keyboard_matrix_read::rowid#2) - (byte~) keyboard_matrix_read::$0 ← ~ *((byte*) CIA1_PORT_B#0) - (byte) keyboard_matrix_read::row_pressed_bits#0 ← (byte~) keyboard_matrix_read::$0 - (byte) keyboard_matrix_read::return#2 ← (byte) keyboard_matrix_read::row_pressed_bits#0 - to:keyboard_matrix_read::@return -keyboard_matrix_read::@return: scope:[keyboard_matrix_read] from keyboard_matrix_read - (byte) keyboard_matrix_read::return#6 ← phi( keyboard_matrix_read/(byte) keyboard_matrix_read::return#2 ) - (byte) keyboard_matrix_read::return#3 ← (byte) keyboard_matrix_read::return#6 - return - to:@return -@4: scope:[] from @3 - (byte[]) keyboard_matrix_col_bitmask#0 ← { (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 4, (byte/signed byte/word/signed word/dword/signed dword) 8, (byte/signed byte/word/signed word/dword/signed dword) 16, (byte/signed byte/word/signed word/dword/signed dword) 32, (byte/signed byte/word/signed word/dword/signed dword) 64, (byte/word/signed word/dword/signed dword) 128 } - (byte[]) keyboard_matrix_chars#0 ← { (byte/signed byte/word/signed word/dword/signed dword) 101, (byte/signed byte/word/signed word/dword/signed dword) 33, (byte/signed byte/word/signed word/dword/signed dword) 67, (byte/signed byte/word/signed word/dword/signed dword) 66, (byte/signed byte/word/signed word/dword/signed dword) 34, (byte/signed byte/word/signed word/dword/signed dword) 97 } - to:@6 -keyboard_matrix_row: scope:[keyboard_matrix_row] from keyboard_char_pressed - (byte) keyboard_matrix_row::ch#1 ← phi( keyboard_char_pressed/(byte) keyboard_matrix_row::ch#0 ) - (byte~) keyboard_matrix_row::$0 ← *((byte[]) keyboard_matrix_chars#0 + (byte) keyboard_matrix_row::ch#1) & (byte/signed byte/word/signed word/dword/signed dword) 15 - (byte) keyboard_matrix_row::return#1 ← (byte~) keyboard_matrix_row::$0 - to:keyboard_matrix_row::@return -keyboard_matrix_row::@return: scope:[keyboard_matrix_row] from keyboard_matrix_row - (byte) keyboard_matrix_row::return#4 ← phi( keyboard_matrix_row/(byte) keyboard_matrix_row::return#1 ) - (byte) keyboard_matrix_row::return#2 ← (byte) keyboard_matrix_row::return#4 - return - to:@return -keyboard_matrix_col: scope:[keyboard_matrix_col] from keyboard_char_pressed::@3 - (byte) keyboard_matrix_col::ch#1 ← phi( keyboard_char_pressed::@3/(byte) keyboard_matrix_col::ch#0 ) - (byte~) keyboard_matrix_col::$0 ← *((byte[]) keyboard_matrix_chars#0 + (byte) keyboard_matrix_col::ch#1) >> (byte/signed byte/word/signed word/dword/signed dword) 4 - (byte) keyboard_matrix_col::col_id#0 ← (byte~) keyboard_matrix_col::$0 - (byte) keyboard_matrix_col::return#1 ← *((byte[]) keyboard_matrix_col_bitmask#0 + (byte) keyboard_matrix_col::col_id#0) - to:keyboard_matrix_col::@return -keyboard_matrix_col::@return: scope:[keyboard_matrix_col] from keyboard_matrix_col - (byte) keyboard_matrix_col::return#4 ← phi( keyboard_matrix_col/(byte) keyboard_matrix_col::return#1 ) - (byte) keyboard_matrix_col::return#2 ← (byte) keyboard_matrix_col::return#4 - return - to:@return -@6: scope:[] from @4 +@5: scope:[] from @begin call main param-assignment - to:@7 -@7: scope:[] from @6 + to:@6 +@6: scope:[] from @5 to:@end -@end: scope:[] from @7 +@end: scope:[] from @6 SYMBOL TABLE SSA -(label) @3 -(label) @4 +(label) @5 (label) @6 -(label) @7 (label) @begin (label) @end (byte*) CIA1_PORT_A @@ -954,46 +1280,138 @@ SYMBOL TABLE SSA (byte*) CIA1_PORT_B#0 (byte*) CIA1_PORT_B_DDR (byte*) CIA1_PORT_B_DDR#0 +(byte) KEY_0 +(byte) KEY_0#0 +(byte) KEY_1 +(byte) KEY_1#0 +(byte) KEY_2 +(byte) KEY_2#0 +(byte) KEY_3 +(byte) KEY_3#0 +(byte) KEY_4 +(byte) KEY_4#0 +(byte) KEY_5 +(byte) KEY_5#0 +(byte) KEY_6 +(byte) KEY_6#0 +(byte) KEY_7 +(byte) KEY_7#0 +(byte) KEY_8 +(byte) KEY_8#0 +(byte) KEY_9 +(byte) KEY_9#0 +(byte) KEY_A +(byte) KEY_A#0 +(byte) KEY_ARROW_LEFT +(byte) KEY_ARROW_LEFT#0 +(byte) KEY_ARROW_UP +(byte) KEY_ARROW_UP#0 +(byte) KEY_ASTERISK +(byte) KEY_ASTERISK#0 +(byte) KEY_AT +(byte) KEY_AT#0 +(byte) KEY_B +(byte) KEY_B#0 +(byte) KEY_C +(byte) KEY_C#0 +(byte) KEY_COLON +(byte) KEY_COLON#0 +(byte) KEY_COMMA +(byte) KEY_COMMA#0 +(byte) KEY_D +(byte) KEY_D#0 +(byte) KEY_DOT +(byte) KEY_DOT#0 +(byte) KEY_E +(byte) KEY_E#0 +(byte) KEY_EQUALS +(byte) KEY_EQUALS#0 +(byte) KEY_F +(byte) KEY_F#0 +(byte) KEY_G +(byte) KEY_G#0 +(byte) KEY_H +(byte) KEY_H#0 +(byte) KEY_I +(byte) KEY_I#0 +(byte) KEY_J +(byte) KEY_J#0 +(byte) KEY_K +(byte) KEY_K#0 +(byte) KEY_L +(byte) KEY_L#0 +(byte) KEY_M +(byte) KEY_M#0 +(byte) KEY_MINUS +(byte) KEY_MINUS#0 +(byte) KEY_N +(byte) KEY_N#0 +(byte) KEY_O +(byte) KEY_O#0 +(byte) KEY_PLUS +(byte) KEY_PLUS#0 +(byte) KEY_POUND +(byte) KEY_POUND#0 +(byte) KEY_Q +(byte) KEY_Q#0 +(byte) KEY_R +(byte) KEY_R#0 +(byte) KEY_S +(byte) KEY_S#0 +(byte) KEY_SEMICOLON +(byte) KEY_SEMICOLON#0 +(byte) KEY_SLASH +(byte) KEY_SLASH#0 +(byte) KEY_SPACE +(byte) KEY_SPACE#0 +(byte) KEY_T +(byte) KEY_T#0 +(byte) KEY_U +(byte) KEY_U#0 +(byte) KEY_V +(byte) KEY_V#0 +(byte) KEY_W +(byte) KEY_W#0 +(byte) KEY_X +(byte) KEY_X#0 +(byte) KEY_Y +(byte) KEY_Y#0 +(byte) KEY_Z +(byte) KEY_Z#0 (byte*) RASTER (byte*) RASTER#0 -(byte()) keyboard_char_pressed((byte) keyboard_char_pressed::ch) -(byte~) keyboard_char_pressed::$0 -(byte~) keyboard_char_pressed::$1 -(byte~) keyboard_char_pressed::$2 -(byte~) keyboard_char_pressed::$3 -(label) keyboard_char_pressed::@2 -(label) keyboard_char_pressed::@3 -(label) keyboard_char_pressed::@4 -(label) keyboard_char_pressed::@return -(byte) keyboard_char_pressed::ch -(byte) keyboard_char_pressed::ch#0 -(byte) keyboard_char_pressed::ch#1 -(byte) keyboard_char_pressed::ch#2 -(byte) keyboard_char_pressed::ch#3 -(byte) keyboard_char_pressed::return -(byte) keyboard_char_pressed::return#0 -(byte) keyboard_char_pressed::return#1 -(byte) keyboard_char_pressed::return#2 -(byte) keyboard_char_pressed::return#3 -(byte) keyboard_char_pressed::return#4 +(byte[]) keyboard_char_keycodes +(byte[]) keyboard_char_keycodes#0 +(byte()) keyboard_get_keycode((byte) keyboard_get_keycode::ch) +(label) keyboard_get_keycode::@return +(byte) keyboard_get_keycode::ch +(byte) keyboard_get_keycode::ch#0 +(byte) keyboard_get_keycode::ch#1 +(byte) keyboard_get_keycode::return +(byte) keyboard_get_keycode::return#0 +(byte) keyboard_get_keycode::return#1 +(byte) keyboard_get_keycode::return#2 +(byte) keyboard_get_keycode::return#3 +(byte) keyboard_get_keycode::return#4 (void()) keyboard_init() (label) keyboard_init::@return -(byte[]) keyboard_matrix_chars -(byte[]) keyboard_matrix_chars#0 -(byte()) keyboard_matrix_col((byte) keyboard_matrix_col::ch) -(byte~) keyboard_matrix_col::$0 -(label) keyboard_matrix_col::@return -(byte) keyboard_matrix_col::ch -(byte) keyboard_matrix_col::ch#0 -(byte) keyboard_matrix_col::ch#1 -(byte) keyboard_matrix_col::col_id -(byte) keyboard_matrix_col::col_id#0 -(byte) keyboard_matrix_col::return -(byte) keyboard_matrix_col::return#0 -(byte) keyboard_matrix_col::return#1 -(byte) keyboard_matrix_col::return#2 -(byte) keyboard_matrix_col::return#3 -(byte) keyboard_matrix_col::return#4 +(byte()) keyboard_key_pressed((byte) keyboard_key_pressed::key) +(byte~) keyboard_key_pressed::$0 +(byte~) keyboard_key_pressed::$1 +(byte~) keyboard_key_pressed::$2 +(byte~) keyboard_key_pressed::$3 +(label) keyboard_key_pressed::@2 +(label) keyboard_key_pressed::@return +(byte) keyboard_key_pressed::key +(byte) keyboard_key_pressed::key#0 +(byte) keyboard_key_pressed::key#1 +(byte) keyboard_key_pressed::key#2 +(byte) keyboard_key_pressed::return +(byte) keyboard_key_pressed::return#0 +(byte) keyboard_key_pressed::return#1 +(byte) keyboard_key_pressed::return#2 +(byte) keyboard_key_pressed::return#3 +(byte) keyboard_key_pressed::return#4 (byte[]) keyboard_matrix_col_bitmask (byte[]) keyboard_matrix_col_bitmask#0 (byte()) keyboard_matrix_read((byte) keyboard_matrix_read::rowid) @@ -1013,20 +1431,8 @@ SYMBOL TABLE SSA (byte) keyboard_matrix_read::rowid#0 (byte) keyboard_matrix_read::rowid#1 (byte) keyboard_matrix_read::rowid#2 -(byte()) keyboard_matrix_row((byte) keyboard_matrix_row::ch) -(byte~) keyboard_matrix_row::$0 -(label) keyboard_matrix_row::@return -(byte) keyboard_matrix_row::ch -(byte) keyboard_matrix_row::ch#0 -(byte) keyboard_matrix_row::ch#1 -(byte) keyboard_matrix_row::return -(byte) keyboard_matrix_row::return#0 -(byte) keyboard_matrix_row::return#1 -(byte) keyboard_matrix_row::return#2 -(byte) keyboard_matrix_row::return#3 -(byte) keyboard_matrix_row::return#4 -(byte[8]) keyboard_row_bits -(byte[8]) keyboard_row_bits#0 +(byte[8]) keyboard_matrix_row_bitmask +(byte[8]) keyboard_matrix_row_bitmask#0 (void()) main() (word/signed word/dword/signed dword~) main::$0 (boolean~) main::$1 @@ -1036,7 +1442,11 @@ SYMBOL TABLE SSA (byte~) main::$13 (boolean~) main::$14 (boolean~) main::$15 -(boolean~) main::$16 +(byte~) main::$16 +(boolean~) main::$17 +(boolean~) main::$18 +(boolean~) main::$19 +(boolean~) main::$20 (boolean~) main::$3 (byte~) main::$4 (byte~) main::$5 @@ -1049,16 +1459,19 @@ SYMBOL TABLE SSA (label) main::@11 (label) main::@12 (label) main::@13 -(label) main::@16 +(label) main::@14 (label) main::@17 -(label) main::@19 +(label) main::@18 (label) main::@2 (label) main::@20 (label) main::@21 -(label) main::@25 -(label) main::@26 +(label) main::@22 +(label) main::@23 (label) main::@27 +(label) main::@28 +(label) main::@29 (label) main::@3 +(label) main::@30 (label) main::@5 (label) main::@6 (label) main::@7 @@ -1069,8 +1482,12 @@ SYMBOL TABLE SSA (byte) main::ch#0 (byte) main::ch#1 (byte) main::ch#2 -(byte[]) main::chars -(byte[]) main::chars#0 +(byte) main::ch#3 +(byte) main::ch#4 +(byte) main::ch#5 +(byte) main::ch#6 +(byte) main::ch#7 +(byte) main::ch#8 (byte) main::col (byte) main::col#0 (byte) main::col#1 @@ -1081,11 +1498,18 @@ SYMBOL TABLE SSA (byte) main::i (byte) main::i#0 (byte) main::i#1 +(byte) main::i#10 (byte) main::i#2 (byte) main::i#3 (byte) main::i#4 (byte) main::i#5 (byte) main::i#6 +(byte) main::i#7 +(byte) main::i#8 +(byte) main::i#9 +(byte) main::key +(byte) main::key#0 +(byte) main::key#1 (byte) main::row (byte) main::row#0 (byte) main::row#1 @@ -1116,6 +1540,9 @@ SYMBOL TABLE SSA (byte*) main::screen#13 (byte*) main::screen#14 (byte*) main::screen#15 +(byte*) main::screen#16 +(byte*) main::screen#17 +(byte*) main::screen#18 (byte*) main::screen#2 (byte*) main::screen#3 (byte*) main::screen#4 @@ -1126,33 +1553,36 @@ SYMBOL TABLE SSA (byte*) main::screen#9 OPTIMIZING CONTROL FLOW GRAPH -Culled Empty Block (label) main::@25 +Culled Empty Block (label) main::@27 Culled Empty Block (label) main::@3 -Culled Empty Block (label) @7 +Culled Empty Block (label) @6 Succesful SSA optimization Pass2CullEmptyBlocks Inversing boolean not (boolean~) main::$7 ← (byte~) main::$5 == (byte/signed byte/word/signed word/dword/signed dword) 0 from (boolean~) main::$6 ← (byte~) main::$5 != (byte/signed byte/word/signed word/dword/signed dword) 0 -Inversing boolean not (boolean~) main::$15 ← (byte~) main::$13 == (byte/signed byte/word/signed word/dword/signed dword) 0 from (boolean~) main::$14 ← (byte~) main::$13 != (byte/signed byte/word/signed word/dword/signed dword) 0 +Inversing boolean not (boolean~) main::$15 ← (byte) main::key#0 == (byte/signed byte/word/signed word/dword/signed dword) 63 from (boolean~) main::$14 ← (byte) main::key#0 != (byte/signed byte/word/signed word/dword/signed dword) 63 +Inversing boolean not (boolean~) main::$18 ← (byte~) main::$16 == (byte/signed byte/word/signed word/dword/signed dword) 0 from (boolean~) main::$17 ← (byte~) main::$16 != (byte/signed byte/word/signed word/dword/signed dword) 0 Succesful SSA optimization Pass2UnaryNotSimplification -Not aliassing across scopes: keyboard_matrix_read::rowid#0 main::row#2 -Not aliassing across scopes: keyboard_matrix_read::return#0 keyboard_matrix_read::return#3 -Not aliassing across scopes: main::$4 keyboard_matrix_read::return#4 -Not aliassing across scopes: keyboard_char_pressed::ch#0 main::ch#0 -Not aliassing across scopes: keyboard_char_pressed::return#0 keyboard_char_pressed::return#2 -Not aliassing across scopes: main::$13 keyboard_char_pressed::return#3 -Not aliassing across scopes: keyboard_char_pressed::ch#1 keyboard_char_pressed::ch#0 -Not aliassing across scopes: keyboard_matrix_row::ch#0 keyboard_char_pressed::ch#1 -Not aliassing across scopes: keyboard_matrix_row::return#0 keyboard_matrix_row::return#2 -Not aliassing across scopes: keyboard_char_pressed::$0 keyboard_matrix_row::return#3 -Not aliassing across scopes: keyboard_matrix_read::return#1 keyboard_matrix_read::return#3 -Not aliassing across scopes: keyboard_char_pressed::$1 keyboard_matrix_read::return#5 -Not aliassing across scopes: keyboard_matrix_col::ch#0 keyboard_char_pressed::ch#2 -Not aliassing across scopes: keyboard_matrix_col::return#0 keyboard_matrix_col::return#2 -Not aliassing across scopes: keyboard_char_pressed::$2 keyboard_matrix_col::return#3 -Not aliassing across scopes: keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#1 -Not aliassing across scopes: keyboard_matrix_row::ch#1 keyboard_matrix_row::ch#0 -Not aliassing across scopes: keyboard_matrix_col::ch#1 keyboard_matrix_col::ch#0 -Alias (byte) keyboard_matrix_read::return#0 = (byte) keyboard_matrix_read::return#4 -Alias (byte*) main::screen#12 = (byte*) main::screen#14 +Not aliassing across scopes: keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#0 +Not aliassing across scopes: keyboard_key_pressed::key#1 keyboard_key_pressed::key#0 +Not aliassing across scopes: keyboard_matrix_read::return#2 keyboard_matrix_read::return#1 +Not aliassing across scopes: keyboard_key_pressed::$1 keyboard_matrix_read::return#5 +Not aliassing across scopes: keyboard_get_keycode::ch#1 keyboard_get_keycode::ch#0 +Not aliassing across scopes: keyboard_matrix_read::rowid#1 main::row#2 +Not aliassing across scopes: keyboard_matrix_read::return#3 keyboard_matrix_read::return#1 +Not aliassing across scopes: main::$4 keyboard_matrix_read::return#6 +Not aliassing across scopes: keyboard_get_keycode::ch#0 main::ch#2 +Not aliassing across scopes: keyboard_get_keycode::return#2 keyboard_get_keycode::return#1 +Not aliassing across scopes: main::$13 keyboard_get_keycode::return#4 +Not aliassing across scopes: keyboard_key_pressed::key#0 main::key#1 +Not aliassing across scopes: keyboard_key_pressed::return#2 keyboard_key_pressed::return#1 +Not aliassing across scopes: main::$16 keyboard_key_pressed::return#4 +Alias (byte) keyboard_matrix_read::return#0 = (byte) keyboard_matrix_read::row_pressed_bits#0 (byte~) keyboard_matrix_read::$0 (byte) keyboard_matrix_read::return#4 (byte) keyboard_matrix_read::return#1 +Alias (byte) keyboard_matrix_read::rowid#0 = (byte~) keyboard_key_pressed::$0 +Alias (byte) keyboard_matrix_read::return#2 = (byte) keyboard_matrix_read::return#5 +Alias (byte) keyboard_key_pressed::key#1 = (byte) keyboard_key_pressed::key#2 +Alias (byte) keyboard_key_pressed::return#0 = (byte~) keyboard_key_pressed::$3 (byte) keyboard_key_pressed::return#3 (byte) keyboard_key_pressed::return#1 +Alias (byte) keyboard_get_keycode::return#0 = (byte) keyboard_get_keycode::return#3 (byte) keyboard_get_keycode::return#1 +Alias (byte) keyboard_matrix_read::return#3 = (byte) keyboard_matrix_read::return#6 +Alias (byte*) main::screen#13 = (byte*) main::screen#17 Alias (byte) main::row#2 = (byte) main::row#8 Alias (byte) main::row_pressed_bits#0 = (byte~) main::$4 Alias (byte*) main::screen#3 = (byte*) main::screen#9 (byte*) main::screen#4 @@ -1164,136 +1594,166 @@ Alias (byte*) main::screen#10 = (byte*) main::screen#5 Alias (byte) main::row#3 = (byte) main::row#4 Alias (byte*) main::screen#1 = (byte*~) main::$10 (byte*) main::screen#6 Alias (byte*) main::screen#2 = (byte*~) main::$12 -Alias (byte) keyboard_char_pressed::return#0 = (byte) keyboard_char_pressed::return#3 -Alias (byte*) main::screen#11 = (byte*) main::screen#13 (byte*) main::screen#7 (byte*) main::screen#8 -Alias (byte) main::i#2 = (byte) main::i#6 (byte) main::i#3 (byte) main::i#4 -Alias (byte) main::ch#0 = (byte) main::ch#2 (byte) main::ch#1 -Alias (byte) keyboard_matrix_row::return#0 = (byte) keyboard_matrix_row::return#3 -Alias (byte) keyboard_char_pressed::ch#1 = (byte) keyboard_char_pressed::ch#3 (byte) keyboard_char_pressed::ch#2 -Alias (byte) keyboard_matrix_read::rowid#1 = (byte~) keyboard_char_pressed::$0 -Alias (byte) keyboard_matrix_read::return#1 = (byte) keyboard_matrix_read::return#5 -Alias (byte) keyboard_matrix_col::return#0 = (byte) keyboard_matrix_col::return#3 -Alias (byte) keyboard_char_pressed::return#1 = (byte~) keyboard_char_pressed::$3 (byte) keyboard_char_pressed::return#4 (byte) keyboard_char_pressed::return#2 -Alias (byte) keyboard_matrix_read::return#2 = (byte) keyboard_matrix_read::row_pressed_bits#0 (byte~) keyboard_matrix_read::$0 (byte) keyboard_matrix_read::return#6 (byte) keyboard_matrix_read::return#3 -Alias (byte) keyboard_matrix_row::return#1 = (byte~) keyboard_matrix_row::$0 (byte) keyboard_matrix_row::return#4 (byte) keyboard_matrix_row::return#2 -Alias (byte) keyboard_matrix_col::col_id#0 = (byte~) keyboard_matrix_col::$0 -Alias (byte) keyboard_matrix_col::return#1 = (byte) keyboard_matrix_col::return#4 (byte) keyboard_matrix_col::return#2 +Alias (byte) keyboard_get_keycode::return#2 = (byte) keyboard_get_keycode::return#4 +Alias (byte) main::ch#2 = (byte) main::ch#6 (byte) main::ch#8 (byte) main::ch#7 (byte) main::ch#5 (byte) main::ch#4 +Alias (byte*) main::screen#11 = (byte*) main::screen#15 (byte*) main::screen#18 (byte*) main::screen#16 (byte*) main::screen#14 (byte*) main::screen#7 +Alias (byte) main::i#10 = (byte) main::i#8 (byte) main::i#9 (byte) main::i#5 (byte) main::i#7 (byte) main::i#3 +Alias (byte) main::key#0 = (byte~) main::$13 (byte) main::key#1 +Alias (byte) keyboard_key_pressed::return#2 = (byte) keyboard_key_pressed::return#4 Succesful SSA optimization Pass2AliasElimination -Not aliassing across scopes: keyboard_matrix_read::rowid#0 main::row#2 -Not aliassing across scopes: keyboard_matrix_read::return#0 keyboard_matrix_read::return#2 -Not aliassing across scopes: main::row_pressed_bits#0 keyboard_matrix_read::return#0 -Not aliassing across scopes: keyboard_char_pressed::ch#0 main::ch#0 -Not aliassing across scopes: keyboard_char_pressed::return#0 keyboard_char_pressed::return#1 -Not aliassing across scopes: main::$13 keyboard_char_pressed::return#0 -Not aliassing across scopes: keyboard_char_pressed::ch#1 keyboard_char_pressed::ch#0 -Not aliassing across scopes: keyboard_matrix_row::ch#0 keyboard_char_pressed::ch#1 -Not aliassing across scopes: keyboard_matrix_row::return#0 keyboard_matrix_row::return#1 -Not aliassing across scopes: keyboard_matrix_read::rowid#1 keyboard_matrix_row::return#0 -Not aliassing across scopes: keyboard_matrix_read::return#1 keyboard_matrix_read::return#2 -Not aliassing across scopes: keyboard_char_pressed::$1 keyboard_matrix_read::return#1 -Not aliassing across scopes: keyboard_matrix_col::ch#0 keyboard_char_pressed::ch#1 -Not aliassing across scopes: keyboard_matrix_col::return#0 keyboard_matrix_col::return#1 -Not aliassing across scopes: keyboard_char_pressed::$2 keyboard_matrix_col::return#0 -Not aliassing across scopes: keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#1 -Not aliassing across scopes: keyboard_matrix_row::ch#1 keyboard_matrix_row::ch#0 -Not aliassing across scopes: keyboard_matrix_col::ch#1 keyboard_matrix_col::ch#0 +Not aliassing across scopes: keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#0 +Not aliassing across scopes: keyboard_key_pressed::key#1 keyboard_key_pressed::key#0 +Not aliassing across scopes: keyboard_matrix_read::return#2 keyboard_matrix_read::return#0 +Not aliassing across scopes: keyboard_key_pressed::$1 keyboard_matrix_read::return#2 +Not aliassing across scopes: keyboard_get_keycode::ch#1 keyboard_get_keycode::ch#0 +Not aliassing across scopes: keyboard_matrix_read::rowid#1 main::row#2 +Not aliassing across scopes: keyboard_matrix_read::return#3 keyboard_matrix_read::return#0 +Not aliassing across scopes: main::row_pressed_bits#0 keyboard_matrix_read::return#3 +Not aliassing across scopes: keyboard_get_keycode::ch#0 main::ch#2 +Not aliassing across scopes: keyboard_get_keycode::return#2 keyboard_get_keycode::return#0 +Not aliassing across scopes: main::key#0 keyboard_get_keycode::return#2 +Not aliassing across scopes: keyboard_key_pressed::key#0 main::key#0 +Not aliassing across scopes: keyboard_key_pressed::return#2 keyboard_key_pressed::return#0 +Not aliassing across scopes: main::$16 keyboard_key_pressed::return#2 Alias (byte) main::row_pressed_bits#2 = (byte) main::row_pressed_bits#3 Alias (byte) main::col#2 = (byte) main::col#4 Alias (byte*) main::screen#10 = (byte*) main::screen#3 Alias (byte) main::row#3 = (byte) main::row#5 -Alias (byte) main::i#2 = (byte) main::i#5 -Alias (byte*) main::screen#11 = (byte*) main::screen#15 +Alias (byte) main::ch#2 = (byte) main::ch#3 +Alias (byte*) main::screen#11 = (byte*) main::screen#12 Succesful SSA optimization Pass2AliasElimination -Not aliassing across scopes: keyboard_matrix_read::rowid#0 main::row#2 -Not aliassing across scopes: keyboard_matrix_read::return#0 keyboard_matrix_read::return#2 -Not aliassing across scopes: main::row_pressed_bits#0 keyboard_matrix_read::return#0 +Not aliassing across scopes: keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#0 +Not aliassing across scopes: keyboard_key_pressed::key#1 keyboard_key_pressed::key#0 +Not aliassing across scopes: keyboard_matrix_read::return#2 keyboard_matrix_read::return#0 +Not aliassing across scopes: keyboard_key_pressed::$1 keyboard_matrix_read::return#2 +Not aliassing across scopes: keyboard_get_keycode::ch#1 keyboard_get_keycode::ch#0 +Not aliassing across scopes: keyboard_matrix_read::rowid#1 main::row#2 +Not aliassing across scopes: keyboard_matrix_read::return#3 keyboard_matrix_read::return#0 +Not aliassing across scopes: main::row_pressed_bits#0 keyboard_matrix_read::return#3 Not aliassing identity: main::screen#11 main::screen#11 -Not aliassing across scopes: keyboard_char_pressed::ch#0 main::ch#0 -Not aliassing across scopes: keyboard_char_pressed::return#0 keyboard_char_pressed::return#1 -Not aliassing across scopes: main::$13 keyboard_char_pressed::return#0 -Not aliassing across scopes: keyboard_char_pressed::ch#1 keyboard_char_pressed::ch#0 -Not aliassing across scopes: keyboard_matrix_row::ch#0 keyboard_char_pressed::ch#1 -Not aliassing across scopes: keyboard_matrix_row::return#0 keyboard_matrix_row::return#1 -Not aliassing across scopes: keyboard_matrix_read::rowid#1 keyboard_matrix_row::return#0 -Not aliassing across scopes: keyboard_matrix_read::return#1 keyboard_matrix_read::return#2 -Not aliassing across scopes: keyboard_char_pressed::$1 keyboard_matrix_read::return#1 -Not aliassing across scopes: keyboard_matrix_col::ch#0 keyboard_char_pressed::ch#1 -Not aliassing across scopes: keyboard_matrix_col::return#0 keyboard_matrix_col::return#1 -Not aliassing across scopes: keyboard_char_pressed::$2 keyboard_matrix_col::return#0 -Not aliassing across scopes: keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#1 -Not aliassing across scopes: keyboard_matrix_row::ch#1 keyboard_matrix_row::ch#0 -Not aliassing across scopes: keyboard_matrix_col::ch#1 keyboard_matrix_col::ch#0 +Not aliassing across scopes: keyboard_get_keycode::ch#0 main::ch#2 +Not aliassing across scopes: keyboard_get_keycode::return#2 keyboard_get_keycode::return#0 +Not aliassing across scopes: main::key#0 keyboard_get_keycode::return#2 +Not aliassing across scopes: keyboard_key_pressed::key#0 main::key#0 +Not aliassing across scopes: keyboard_key_pressed::return#2 keyboard_key_pressed::return#0 +Not aliassing across scopes: main::$16 keyboard_key_pressed::return#2 Self Phi Eliminated (byte*) main::screen#10 Self Phi Eliminated (byte) main::row#3 Self Phi Eliminated (byte*) main::screen#11 +Self Phi Eliminated (byte*) main::screen#8 Succesful SSA optimization Pass2SelfPhiElimination -Redundant Phi (byte*) main::screen#10 (byte*) main::screen#12 +Redundant Phi (byte) keyboard_key_pressed::key#1 (byte) keyboard_key_pressed::key#0 +Redundant Phi (byte) keyboard_get_keycode::ch#1 (byte) keyboard_get_keycode::ch#0 +Redundant Phi (byte*) main::screen#10 (byte*) main::screen#13 Redundant Phi (byte) main::row#3 (byte) main::row#2 Redundant Phi (byte*) main::screen#11 (byte*) main::screen#2 -Redundant Phi (byte) keyboard_char_pressed::ch#1 (byte) keyboard_char_pressed::ch#0 -Redundant Phi (byte) keyboard_matrix_row::ch#1 (byte) keyboard_matrix_row::ch#0 -Redundant Phi (byte) keyboard_matrix_col::ch#1 (byte) keyboard_matrix_col::ch#0 +Redundant Phi (byte*) main::screen#8 (byte*) main::screen#11 Succesful SSA optimization Pass2RedundantPhiElimination Simple Condition (boolean~) main::$1 if((byte*) main::sc#1<(word/signed word/dword/signed dword~) main::$0) goto main::@1 Simple Condition (boolean~) main::$3 if(*((byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) 255) goto main::@5 Simple Condition (boolean~) main::$7 if((byte~) main::$5==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@8 Simple Condition (boolean~) main::$9 if((byte) main::col#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@7 Simple Condition (boolean~) main::$11 if((byte) main::row#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@6 -Simple Condition (boolean~) main::$15 if((byte~) main::$13==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@11 -Simple Condition (boolean~) main::$16 if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 6) goto main::@10 +Simple Condition (boolean~) main::$15 if((byte) main::key#0==(byte/signed byte/word/signed word/dword/signed dword) 63) goto main::@11 +Simple Condition (boolean~) main::$19 if((byte) main::ch#1!=(byte/signed byte/word/signed word/dword/signed dword) 64) goto main::@10 +Simple Condition (boolean~) main::$18 if((byte~) main::$16==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@12 +Simple Condition (boolean~) main::$20 if((byte) main::i#2<(byte/signed byte/word/signed word/dword/signed dword) 5) goto main::@13 Succesful SSA optimization Pass2ConditionalJumpSimplification Constant (const byte*) RASTER#0 = ((byte*))53266 Constant (const byte*) CIA1_PORT_A#0 = ((byte*))56320 Constant (const byte*) CIA1_PORT_B#0 = ((byte*))56321 Constant (const byte*) CIA1_PORT_A_DDR#0 = ((byte*))56322 Constant (const byte*) CIA1_PORT_B_DDR#0 = ((byte*))56323 +Constant (const byte) KEY_3#0 = 8 +Constant (const byte) KEY_W#0 = 9 +Constant (const byte) KEY_A#0 = 10 +Constant (const byte) KEY_4#0 = 11 +Constant (const byte) KEY_Z#0 = 12 +Constant (const byte) KEY_S#0 = 13 +Constant (const byte) KEY_E#0 = 14 +Constant (const byte) KEY_5#0 = 16 +Constant (const byte) KEY_R#0 = 17 +Constant (const byte) KEY_D#0 = 18 +Constant (const byte) KEY_6#0 = 19 +Constant (const byte) KEY_C#0 = 20 +Constant (const byte) KEY_F#0 = 21 +Constant (const byte) KEY_T#0 = 22 +Constant (const byte) KEY_X#0 = 23 +Constant (const byte) KEY_7#0 = 24 +Constant (const byte) KEY_Y#0 = 25 +Constant (const byte) KEY_G#0 = 26 +Constant (const byte) KEY_8#0 = 27 +Constant (const byte) KEY_B#0 = 28 +Constant (const byte) KEY_H#0 = 29 +Constant (const byte) KEY_U#0 = 30 +Constant (const byte) KEY_V#0 = 31 +Constant (const byte) KEY_9#0 = 32 +Constant (const byte) KEY_I#0 = 33 +Constant (const byte) KEY_J#0 = 34 +Constant (const byte) KEY_0#0 = 35 +Constant (const byte) KEY_M#0 = 36 +Constant (const byte) KEY_K#0 = 37 +Constant (const byte) KEY_O#0 = 38 +Constant (const byte) KEY_N#0 = 39 +Constant (const byte) KEY_PLUS#0 = 40 +Constant (const byte) KEY_L#0 = 42 +Constant (const byte) KEY_MINUS#0 = 43 +Constant (const byte) KEY_DOT#0 = 44 +Constant (const byte) KEY_COLON#0 = 45 +Constant (const byte) KEY_AT#0 = 46 +Constant (const byte) KEY_COMMA#0 = 47 +Constant (const byte) KEY_POUND#0 = 48 +Constant (const byte) KEY_ASTERISK#0 = 49 +Constant (const byte) KEY_SEMICOLON#0 = 50 +Constant (const byte) KEY_EQUALS#0 = 53 +Constant (const byte) KEY_ARROW_UP#0 = 54 +Constant (const byte) KEY_SLASH#0 = 55 +Constant (const byte) KEY_1#0 = 56 +Constant (const byte) KEY_ARROW_LEFT#0 = 57 +Constant (const byte) KEY_2#0 = 59 +Constant (const byte) KEY_SPACE#0 = 60 +Constant (const byte) KEY_Q#0 = 62 +Constant (const byte[8]) keyboard_matrix_row_bitmask#0 = { 254, 253, 251, 247, 239, 223, 191, 127 } +Constant (const byte[]) keyboard_matrix_col_bitmask#0 = { 1, 2, 4, 8, 16, 32, 64, 128 } Constant (const byte*) main::sc#0 = ((byte*))1024 Constant (const word/signed word/dword/signed dword) main::$0 = 1024+1000 Constant (const byte*) main::screen#0 = ((byte*))1024 Constant (const byte) main::row#0 = 0 Constant (const byte) main::col#0 = 0 -Constant (const byte[]) main::chars#0 = { '@', 'a', 'b', 'c', 'd', 'e' } Constant (const byte) main::i#0 = 0 -Constant (const byte[8]) keyboard_row_bits#0 = { 254, 253, 251, 247, 239, 223, 191, 127 } -Constant (const byte[]) keyboard_matrix_col_bitmask#0 = { 1, 2, 4, 8, 16, 32, 64, 128 } -Constant (const byte[]) keyboard_matrix_chars#0 = { 101, 33, 67, 66, 34, 97 } +Constant (const byte) main::ch#0 = 0 +Succesful SSA optimization Pass2ConstantIdentification +Constant (const byte[]) keyboard_char_keycodes#0 = { KEY_AT#0, KEY_A#0, KEY_B#0, KEY_C#0, KEY_D#0, KEY_E#0, KEY_F#0, KEY_G#0, KEY_H#0, KEY_I#0, KEY_J#0, KEY_K#0, KEY_L#0, KEY_M#0, KEY_N#0, KEY_O#0, KEY_O#0, KEY_Q#0, KEY_R#0, KEY_S#0, KEY_T#0, KEY_U#0, KEY_V#0, KEY_W#0, KEY_X#0, KEY_Y#0, KEY_Z#0, 63, KEY_POUND#0, 63, KEY_ARROW_UP#0, KEY_ARROW_LEFT#0, KEY_SPACE#0, 63, 63, 63, 63, 63, 63, 63, 63, 63, KEY_ASTERISK#0, KEY_PLUS#0, KEY_COMMA#0, KEY_MINUS#0, KEY_DOT#0, KEY_SLASH#0, KEY_0#0, KEY_1#0, KEY_2#0, KEY_3#0, KEY_4#0, KEY_5#0, KEY_6#0, KEY_7#0, KEY_8#0, KEY_9#0, KEY_COLON#0, KEY_SEMICOLON#0, 63, KEY_EQUALS#0, 63, 63 } Succesful SSA optimization Pass2ConstantIdentification Multiple usages for variable. Not optimizing sub-constant (byte*) main::screen#1 -Culled Empty Block (label) main::@16 -Culled Empty Block (label) @3 -Culled Empty Block (label) @4 +Culled Empty Block (label) main::@17 +Culled Empty Block (label) main::@12 Succesful SSA optimization Pass2CullEmptyBlocks -Not aliassing across scopes: keyboard_matrix_read::rowid#0 main::row#2 -Not aliassing across scopes: keyboard_matrix_read::return#0 keyboard_matrix_read::return#2 -Not aliassing across scopes: main::row_pressed_bits#0 keyboard_matrix_read::return#0 -Not aliassing across scopes: keyboard_char_pressed::ch#0 main::ch#0 -Not aliassing across scopes: keyboard_char_pressed::return#0 keyboard_char_pressed::return#1 -Not aliassing across scopes: main::$13 keyboard_char_pressed::return#0 -Not aliassing across scopes: keyboard_matrix_row::ch#0 keyboard_char_pressed::ch#0 -Not aliassing across scopes: keyboard_matrix_row::return#0 keyboard_matrix_row::return#1 -Not aliassing across scopes: keyboard_matrix_read::rowid#1 keyboard_matrix_row::return#0 -Not aliassing across scopes: keyboard_matrix_read::return#1 keyboard_matrix_read::return#2 -Not aliassing across scopes: keyboard_char_pressed::$1 keyboard_matrix_read::return#1 -Not aliassing across scopes: keyboard_matrix_col::ch#0 keyboard_char_pressed::ch#0 -Not aliassing across scopes: keyboard_matrix_col::return#0 keyboard_matrix_col::return#1 -Not aliassing across scopes: keyboard_char_pressed::$2 keyboard_matrix_col::return#0 -Not aliassing across scopes: keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#1 +Not aliassing across scopes: keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#0 +Not aliassing across scopes: keyboard_matrix_read::return#2 keyboard_matrix_read::return#0 +Not aliassing across scopes: keyboard_key_pressed::$1 keyboard_matrix_read::return#2 +Not aliassing across scopes: keyboard_matrix_read::rowid#1 main::row#2 +Not aliassing across scopes: keyboard_matrix_read::return#3 keyboard_matrix_read::return#0 +Not aliassing across scopes: main::row_pressed_bits#0 keyboard_matrix_read::return#3 +Not aliassing across scopes: keyboard_get_keycode::ch#0 main::ch#2 +Not aliassing across scopes: keyboard_get_keycode::return#2 keyboard_get_keycode::return#0 +Not aliassing across scopes: main::key#0 keyboard_get_keycode::return#2 +Not aliassing across scopes: keyboard_key_pressed::key#0 main::key#0 +Not aliassing across scopes: keyboard_key_pressed::return#2 keyboard_key_pressed::return#0 +Not aliassing across scopes: main::$16 keyboard_key_pressed::return#2 Multiple usages for variable. Not optimizing sub-constant (byte*) main::screen#1 -Not aliassing across scopes: keyboard_matrix_read::rowid#0 main::row#2 -Not aliassing across scopes: keyboard_matrix_read::return#0 keyboard_matrix_read::return#2 -Not aliassing across scopes: main::row_pressed_bits#0 keyboard_matrix_read::return#0 -Not aliassing across scopes: keyboard_char_pressed::ch#0 main::ch#0 -Not aliassing across scopes: keyboard_char_pressed::return#0 keyboard_char_pressed::return#1 -Not aliassing across scopes: main::$13 keyboard_char_pressed::return#0 -Not aliassing across scopes: keyboard_matrix_row::ch#0 keyboard_char_pressed::ch#0 -Not aliassing across scopes: keyboard_matrix_row::return#0 keyboard_matrix_row::return#1 -Not aliassing across scopes: keyboard_matrix_read::rowid#1 keyboard_matrix_row::return#0 -Not aliassing across scopes: keyboard_matrix_read::return#1 keyboard_matrix_read::return#2 -Not aliassing across scopes: keyboard_char_pressed::$1 keyboard_matrix_read::return#1 -Not aliassing across scopes: keyboard_matrix_col::ch#0 keyboard_char_pressed::ch#0 -Not aliassing across scopes: keyboard_matrix_col::return#0 keyboard_matrix_col::return#1 -Not aliassing across scopes: keyboard_char_pressed::$2 keyboard_matrix_col::return#0 -Not aliassing across scopes: keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#1 +Not aliassing across scopes: keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#0 +Not aliassing across scopes: keyboard_matrix_read::return#2 keyboard_matrix_read::return#0 +Not aliassing across scopes: keyboard_key_pressed::$1 keyboard_matrix_read::return#2 +Not aliassing across scopes: keyboard_matrix_read::rowid#1 main::row#2 +Not aliassing across scopes: keyboard_matrix_read::return#3 keyboard_matrix_read::return#0 +Not aliassing across scopes: main::row_pressed_bits#0 keyboard_matrix_read::return#3 +Not aliassing across scopes: keyboard_get_keycode::ch#0 main::ch#2 +Not aliassing across scopes: keyboard_get_keycode::return#2 keyboard_get_keycode::return#0 +Not aliassing across scopes: main::key#0 keyboard_get_keycode::return#2 +Not aliassing across scopes: keyboard_key_pressed::key#0 main::key#0 +Not aliassing across scopes: keyboard_key_pressed::return#2 keyboard_key_pressed::return#0 +Not aliassing across scopes: main::$16 keyboard_key_pressed::return#2 Multiple usages for variable. Not optimizing sub-constant (byte*) main::screen#1 OPTIMIZING CONTROL FLOW GRAPH Inlining constant with var siblings (const byte*) main::sc#0 @@ -1307,28 +1767,38 @@ Inlining constant with var siblings (const byte) main::col#0 Inlining constant with var siblings (const byte) main::col#0 Inlining constant with var siblings (const byte) main::i#0 Inlining constant with var siblings (const byte) main::i#0 +Inlining constant with var siblings (const byte) main::i#0 +Inlining constant with var siblings (const byte) main::i#0 +Inlining constant with var siblings (const byte) main::i#0 +Inlining constant with var siblings (const byte) main::ch#0 +Inlining constant with var siblings (const byte) main::ch#0 Constant inlined main::screen#0 = ((byte*))(word/signed word/dword/signed dword) 1024 +Constant inlined main::col#0 = (byte/signed byte/word/signed word/dword/signed dword) 0 +Constant inlined main::$0 = (word/signed word/dword/signed dword) 1024+(word/signed word/dword/signed dword) 1000 Constant inlined main::i#0 = (byte/signed byte/word/signed word/dword/signed dword) 0 Constant inlined main::sc#0 = ((byte*))(word/signed word/dword/signed dword) 1024 -Constant inlined main::col#0 = (byte/signed byte/word/signed word/dword/signed dword) 0 Constant inlined main::row#0 = (byte/signed byte/word/signed word/dword/signed dword) 0 -Constant inlined main::$0 = (word/signed word/dword/signed dword) 1024+(word/signed word/dword/signed dword) 1000 +Constant inlined main::ch#0 = (byte/signed byte/word/signed word/dword/signed dword) 0 Succesful SSA optimization Pass2ConstantInlining -Block Sequence Planned @begin @6 @end main main::@1 main::@13 main::@2 main::@return main::@5 main::@6 main::@26 main::@7 main::@17 main::@9 main::@19 main::@20 main::@10 main::@27 main::@21 main::@12 main::@11 main::@8 keyboard_char_pressed keyboard_char_pressed::@2 keyboard_char_pressed::@3 keyboard_char_pressed::@4 keyboard_char_pressed::@return keyboard_matrix_col keyboard_matrix_col::@return keyboard_matrix_read keyboard_matrix_read::@return keyboard_matrix_row keyboard_matrix_row::@return keyboard_init keyboard_init::@return -Added new block during phi lifting main::@28(between main::@1 and main::@1) -Added new block during phi lifting main::@29(between main::@19 and main::@6) -Added new block during phi lifting main::@30(between main::@9 and main::@7) -Added new block during phi lifting main::@31(between main::@12 and main::@10) -Block Sequence Planned @begin @6 @end main main::@1 main::@13 main::@2 main::@return main::@5 main::@6 main::@26 main::@7 main::@17 main::@9 main::@19 main::@20 main::@10 main::@27 main::@21 main::@12 main::@31 main::@11 main::@29 main::@30 main::@8 main::@28 keyboard_char_pressed keyboard_char_pressed::@2 keyboard_char_pressed::@3 keyboard_char_pressed::@4 keyboard_char_pressed::@return keyboard_matrix_col keyboard_matrix_col::@return keyboard_matrix_read keyboard_matrix_read::@return keyboard_matrix_row keyboard_matrix_row::@return keyboard_init keyboard_init::@return +Block Sequence Planned @begin @5 @end main main::@1 main::@14 main::@2 main::@return main::@5 main::@6 main::@28 main::@7 main::@18 main::@9 main::@20 main::@21 main::@10 main::@29 main::@22 main::@30 main::@23 main::@11 main::@13 main::@8 keyboard_key_pressed keyboard_key_pressed::@2 keyboard_key_pressed::@return keyboard_matrix_read keyboard_matrix_read::@return keyboard_get_keycode keyboard_get_keycode::@return keyboard_init keyboard_init::@return +Added new block during phi lifting main::@31(between main::@1 and main::@1) +Added new block during phi lifting main::@32(between main::@20 and main::@6) +Added new block during phi lifting main::@33(between main::@9 and main::@7) +Added new block during phi lifting main::@34(between main::@11 and main::@10) +Added new block during phi lifting main::@35(between main::@30 and main::@11) +Added new block during phi lifting main::@36(between main::@29 and main::@11) +Added new block during phi lifting main::@37(between main::@11 and main::@13) +Added new block during phi lifting main::@38(between main::@13 and main::@13) +Block Sequence Planned @begin @5 @end main main::@1 main::@14 main::@2 main::@return main::@5 main::@6 main::@28 main::@7 main::@18 main::@9 main::@20 main::@21 main::@10 main::@29 main::@22 main::@30 main::@23 main::@11 main::@37 main::@13 main::@38 main::@34 main::@35 main::@36 main::@32 main::@33 main::@8 main::@31 keyboard_key_pressed keyboard_key_pressed::@2 keyboard_key_pressed::@return keyboard_matrix_read keyboard_matrix_read::@return keyboard_get_keycode keyboard_get_keycode::@return keyboard_init keyboard_init::@return Adding NOP phi() at start of @begin -Adding NOP phi() at start of @6 +Adding NOP phi() at start of @5 Adding NOP phi() at start of @end Adding NOP phi() at start of main -Adding NOP phi() at start of main::@13 +Adding NOP phi() at start of main::@14 CALL GRAPH Calls in [] to main:2 -Calls in [main] to keyboard_init:10 keyboard_matrix_read:17 keyboard_char_pressed:35 -Calls in [keyboard_char_pressed] to keyboard_matrix_row:51 keyboard_matrix_read:55 keyboard_matrix_col:59 +Calls in [main] to keyboard_init:10 keyboard_matrix_read:17 keyboard_get_keycode:34 keyboard_key_pressed:39 +Calls in [keyboard_key_pressed] to keyboard_matrix_read:67 Propagating live ranges... Propagating live ranges... @@ -1344,27 +1814,37 @@ Propagating live ranges... Propagating live ranges... Propagating live ranges... Propagating live ranges... -Created 7 initial phi equivalence classes -Coalesced [16] keyboard_matrix_read::rowid#4 ← keyboard_matrix_read::rowid#0 +Created 10 initial phi equivalence classes +Coalesced [16] keyboard_matrix_read::rowid#4 ← keyboard_matrix_read::rowid#1 Coalesced [20] main::row_pressed_bits#6 ← main::row_pressed_bits#0 -Coalesced [42] main::i#7 ← main::i#1 -Coalesced [44] main::row#9 ← main::row#1 -Coalesced [45] main::screen#16 ← main::screen#1 -Coalesced [46] main::row_pressed_bits#7 ← main::row_pressed_bits#1 -Coalesced [47] main::col#6 ← main::col#1 -Coalesced [49] main::sc#3 ← main::sc#1 -Coalesced [54] keyboard_matrix_read::rowid#3 ← keyboard_matrix_read::rowid#1 -Coalesced down to 7 phi equivalence classes +Coalesced [45] main::i#13 ← main::i#1 +Coalesced [49] main::i#15 ← main::i#6 +Coalesced [54] main::i#16 ← main::i#2 +Coalesced [55] main::ch#9 ← main::ch#1 +Coalesced [56] main::i#11 ← main::i#6 +Coalesced (already) [57] main::i#12 ← main::i#10 +Coalesced (already) [58] main::i#14 ← main::i#10 +Coalesced [59] main::row#9 ← main::row#1 +Coalesced [60] main::screen#19 ← main::screen#1 +Coalesced [61] main::row_pressed_bits#7 ← main::row_pressed_bits#1 +Coalesced [62] main::col#6 ← main::col#1 +Coalesced [64] main::sc#3 ← main::sc#1 +Coalesced [66] keyboard_matrix_read::rowid#3 ← keyboard_matrix_read::rowid#0 +Coalesced down to 8 phi equivalence classes +Culled Empty Block (label) main::@37 +Culled Empty Block (label) main::@38 +Culled Empty Block (label) main::@34 +Culled Empty Block (label) main::@35 +Culled Empty Block (label) main::@36 +Culled Empty Block (label) main::@32 +Culled Empty Block (label) main::@33 Culled Empty Block (label) main::@31 -Culled Empty Block (label) main::@29 -Culled Empty Block (label) main::@30 -Culled Empty Block (label) main::@28 -Block Sequence Planned @begin @6 @end main main::@1 main::@13 main::@2 main::@return main::@5 main::@6 main::@26 main::@7 main::@17 main::@9 main::@19 main::@20 main::@10 main::@27 main::@21 main::@12 main::@11 main::@8 keyboard_char_pressed keyboard_char_pressed::@2 keyboard_char_pressed::@3 keyboard_char_pressed::@4 keyboard_char_pressed::@return keyboard_matrix_col keyboard_matrix_col::@return keyboard_matrix_read keyboard_matrix_read::@return keyboard_matrix_row keyboard_matrix_row::@return keyboard_init keyboard_init::@return +Block Sequence Planned @begin @5 @end main main::@1 main::@14 main::@2 main::@return main::@5 main::@6 main::@28 main::@7 main::@18 main::@9 main::@20 main::@21 main::@10 main::@29 main::@22 main::@30 main::@23 main::@11 main::@13 main::@8 keyboard_key_pressed keyboard_key_pressed::@2 keyboard_key_pressed::@return keyboard_matrix_read keyboard_matrix_read::@return keyboard_get_keycode keyboard_get_keycode::@return keyboard_init keyboard_init::@return Adding NOP phi() at start of @begin -Adding NOP phi() at start of @6 +Adding NOP phi() at start of @5 Adding NOP phi() at start of @end Adding NOP phi() at start of main -Adding NOP phi() at start of main::@13 +Adding NOP phi() at start of main::@14 Propagating live ranges... Propagating live ranges... Propagating live ranges... @@ -1381,14 +1861,14 @@ Propagating live ranges... FINAL CONTROL FLOW GRAPH @begin: scope:[] from [0] phi() [ ] ( ) - to:@6 -@6: scope:[] from @begin + to:@5 +@5: scope:[] from @begin [1] phi() [ ] ( ) [2] call main param-assignment [ ] ( ) to:@end -@end: scope:[] from @6 +@end: scope:[] from @5 [3] phi() [ ] ( ) -main: scope:[main] from @6 +main: scope:[main] from @5 [4] phi() [ ] ( main:2 [ ] ) to:main::@1 main::@1: scope:[main] from main main::@1 @@ -1396,12 +1876,12 @@ main::@1: scope:[main] from main main::@1 [6] *((byte*) main::sc#2) ← (byte) ' ' [ main::sc#2 ] ( main:2 [ main::sc#2 ] ) [7] (byte*) main::sc#1 ← ++ (byte*) main::sc#2 [ main::sc#1 ] ( main:2 [ main::sc#1 ] ) [8] if((byte*) main::sc#1<(word/signed word/dword/signed dword) 1024+(word/signed word/dword/signed dword) 1000) goto main::@1 [ main::sc#1 ] ( main:2 [ main::sc#1 ] ) - to:main::@13 -main::@13: scope:[main] from main::@1 + to:main::@14 +main::@14: scope:[main] from main::@1 [9] phi() [ ] ( main:2 [ ] ) [10] call keyboard_init param-assignment [ ] ( main:2 [ ] ) to:main::@2 -main::@2: scope:[main] from main::@12 main::@13 +main::@2: scope:[main] from main::@13 main::@14 [11] if(true) goto main::@5 [ ] ( main:2 [ ] ) to:main::@return main::@return: scope:[main] from main::@2 @@ -1410,107 +1890,104 @@ main::@return: scope:[main] from main::@2 main::@5: scope:[main] from main::@2 main::@5 [13] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) 255) goto main::@5 [ ] ( main:2 [ ] ) to:main::@6 -main::@6: scope:[main] from main::@19 main::@5 - [14] (byte*) main::screen#12 ← phi( main::@5/((byte*))(word/signed word/dword/signed dword) 1024 main::@19/(byte*) main::screen#1 ) [ main::row#2 main::screen#12 ] ( main:2 [ main::row#2 main::screen#12 ] ) - [14] (byte) main::row#2 ← phi( main::@5/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@19/(byte) main::row#1 ) [ main::row#2 main::screen#12 ] ( main:2 [ main::row#2 main::screen#12 ] ) - [15] (byte) keyboard_matrix_read::rowid#0 ← (byte) main::row#2 [ main::row#2 main::screen#12 keyboard_matrix_read::rowid#0 ] ( main:2 [ main::row#2 main::screen#12 keyboard_matrix_read::rowid#0 ] ) - [16] call keyboard_matrix_read param-assignment [ main::row#2 main::screen#12 keyboard_matrix_read::return#2 ] ( main:2 [ main::row#2 main::screen#12 keyboard_matrix_read::return#2 ] ) - [17] (byte) keyboard_matrix_read::return#0 ← (byte) keyboard_matrix_read::return#2 [ main::row#2 main::screen#12 keyboard_matrix_read::return#0 ] ( main:2 [ main::row#2 main::screen#12 keyboard_matrix_read::return#0 ] ) - to:main::@26 -main::@26: scope:[main] from main::@6 - [18] (byte) main::row_pressed_bits#0 ← (byte) keyboard_matrix_read::return#0 [ main::row#2 main::screen#12 main::row_pressed_bits#0 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#0 ] ) +main::@6: scope:[main] from main::@20 main::@5 + [14] (byte*) main::screen#13 ← phi( main::@5/((byte*))(word/signed word/dword/signed dword) 1024 main::@20/(byte*) main::screen#1 ) [ main::row#2 main::screen#13 ] ( main:2 [ main::row#2 main::screen#13 ] ) + [14] (byte) main::row#2 ← phi( main::@5/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@20/(byte) main::row#1 ) [ main::row#2 main::screen#13 ] ( main:2 [ main::row#2 main::screen#13 ] ) + [15] (byte) keyboard_matrix_read::rowid#1 ← (byte) main::row#2 [ main::row#2 main::screen#13 keyboard_matrix_read::rowid#1 ] ( main:2 [ main::row#2 main::screen#13 keyboard_matrix_read::rowid#1 ] ) + [16] call keyboard_matrix_read param-assignment [ main::row#2 main::screen#13 keyboard_matrix_read::return#0 ] ( main:2 [ main::row#2 main::screen#13 keyboard_matrix_read::return#0 ] ) + [17] (byte) keyboard_matrix_read::return#3 ← (byte) keyboard_matrix_read::return#0 [ main::row#2 main::screen#13 keyboard_matrix_read::return#3 ] ( main:2 [ main::row#2 main::screen#13 keyboard_matrix_read::return#3 ] ) + to:main::@28 +main::@28: scope:[main] from main::@6 + [18] (byte) main::row_pressed_bits#0 ← (byte) keyboard_matrix_read::return#3 [ main::row#2 main::screen#13 main::row_pressed_bits#0 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#0 ] ) to:main::@7 -main::@7: scope:[main] from main::@26 main::@9 - [19] (byte) main::col#2 ← phi( main::@26/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@9/(byte) main::col#1 ) [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ) - [19] (byte) main::row_pressed_bits#2 ← phi( main::@26/(byte) main::row_pressed_bits#0 main::@9/(byte) main::row_pressed_bits#1 ) [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ) - [20] (byte~) main::$5 ← (byte) main::row_pressed_bits#2 & (byte/word/signed word/dword/signed dword) 128 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 main::$5 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 main::$5 ] ) - [21] if((byte~) main::$5==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@8 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ) - to:main::@17 -main::@17: scope:[main] from main::@7 - [22] *((byte*) main::screen#12 + (byte) main::col#2) ← (byte) '1' [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ) +main::@7: scope:[main] from main::@28 main::@9 + [19] (byte) main::col#2 ← phi( main::@28/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@9/(byte) main::col#1 ) [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ) + [19] (byte) main::row_pressed_bits#2 ← phi( main::@28/(byte) main::row_pressed_bits#0 main::@9/(byte) main::row_pressed_bits#1 ) [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ) + [20] (byte~) main::$5 ← (byte) main::row_pressed_bits#2 & (byte/word/signed word/dword/signed dword) 128 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 main::$5 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 main::$5 ] ) + [21] if((byte~) main::$5==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@8 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ) + to:main::@18 +main::@18: scope:[main] from main::@7 + [22] *((byte*) main::screen#13 + (byte) main::col#2) ← (byte) '1' [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ) to:main::@9 -main::@9: scope:[main] from main::@17 main::@8 - [23] (byte) main::row_pressed_bits#1 ← (byte) main::row_pressed_bits#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ main::row#2 main::screen#12 main::col#2 main::row_pressed_bits#1 ] ( main:2 [ main::row#2 main::screen#12 main::col#2 main::row_pressed_bits#1 ] ) - [24] (byte) main::col#1 ← ++ (byte) main::col#2 [ main::row#2 main::screen#12 main::row_pressed_bits#1 main::col#1 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#1 main::col#1 ] ) - [25] if((byte) main::col#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@7 [ main::row#2 main::screen#12 main::row_pressed_bits#1 main::col#1 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#1 main::col#1 ] ) - to:main::@19 -main::@19: scope:[main] from main::@9 - [26] (byte*) main::screen#1 ← (byte*) main::screen#12 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::row#2 main::screen#1 ] ( main:2 [ main::row#2 main::screen#1 ] ) +main::@9: scope:[main] from main::@18 main::@8 + [23] (byte) main::row_pressed_bits#1 ← (byte) main::row_pressed_bits#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ main::row#2 main::screen#13 main::col#2 main::row_pressed_bits#1 ] ( main:2 [ main::row#2 main::screen#13 main::col#2 main::row_pressed_bits#1 ] ) + [24] (byte) main::col#1 ← ++ (byte) main::col#2 [ main::row#2 main::screen#13 main::row_pressed_bits#1 main::col#1 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#1 main::col#1 ] ) + [25] if((byte) main::col#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@7 [ main::row#2 main::screen#13 main::row_pressed_bits#1 main::col#1 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#1 main::col#1 ] ) + to:main::@20 +main::@20: scope:[main] from main::@9 + [26] (byte*) main::screen#1 ← (byte*) main::screen#13 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::row#2 main::screen#1 ] ( main:2 [ main::row#2 main::screen#1 ] ) [27] (byte) main::row#1 ← ++ (byte) main::row#2 [ main::row#1 main::screen#1 ] ( main:2 [ main::row#1 main::screen#1 ] ) [28] if((byte) main::row#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@6 [ main::row#1 main::screen#1 ] ( main:2 [ main::row#1 main::screen#1 ] ) - to:main::@20 -main::@20: scope:[main] from main::@19 + to:main::@21 +main::@21: scope:[main] from main::@20 [29] (byte*) main::screen#2 ← (byte*) main::screen#1 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::screen#2 ] ( main:2 [ main::screen#2 ] ) to:main::@10 -main::@10: scope:[main] from main::@12 main::@20 - [30] (byte) main::i#2 ← phi( main::@12/(byte) main::i#1 main::@20/(byte/signed byte/word/signed word/dword/signed dword) 0 ) [ main::screen#2 main::i#2 ] ( main:2 [ main::screen#2 main::i#2 ] ) - [31] (byte) main::ch#0 ← *((const byte[]) main::chars#0 + (byte) main::i#2) [ main::screen#2 main::i#2 main::ch#0 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 ] ) - [32] (byte) keyboard_char_pressed::ch#0 ← (byte) main::ch#0 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 ] ) - [33] call keyboard_char_pressed param-assignment [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#1 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#1 ] ) - [34] (byte) keyboard_char_pressed::return#0 ← (byte) keyboard_char_pressed::return#1 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#0 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#0 ] ) - to:main::@27 -main::@27: scope:[main] from main::@10 - [35] (byte~) main::$13 ← (byte) keyboard_char_pressed::return#0 [ main::screen#2 main::i#2 main::ch#0 main::$13 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 main::$13 ] ) - [36] if((byte~) main::$13==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@11 [ main::screen#2 main::i#2 main::ch#0 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 ] ) - to:main::@21 -main::@21: scope:[main] from main::@27 - [37] *((byte*) main::screen#2 + (byte) main::i#2) ← (byte) main::ch#0 [ main::screen#2 main::i#2 ] ( main:2 [ main::screen#2 main::i#2 ] ) - to:main::@12 -main::@12: scope:[main] from main::@11 main::@21 - [38] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::screen#2 main::i#1 ] ( main:2 [ main::screen#2 main::i#1 ] ) - [39] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 6) goto main::@10 [ main::screen#2 main::i#1 ] ( main:2 [ main::screen#2 main::i#1 ] ) +main::@10: scope:[main] from main::@11 main::@21 + [30] (byte) main::i#10 ← phi( main::@11/(byte) main::i#6 main::@21/(byte/signed byte/word/signed word/dword/signed dword) 0 ) [ main::screen#2 main::ch#2 main::i#10 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 ] ) + [30] (byte) main::ch#2 ← phi( main::@11/(byte) main::ch#1 main::@21/(byte/signed byte/word/signed word/dword/signed dword) 0 ) [ main::screen#2 main::ch#2 main::i#10 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 ] ) + [31] (byte) keyboard_get_keycode::ch#0 ← (byte) main::ch#2 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::ch#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::ch#0 ] ) + [32] call keyboard_get_keycode param-assignment [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#0 ] ) + [33] (byte) keyboard_get_keycode::return#2 ← (byte) keyboard_get_keycode::return#0 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#2 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#2 ] ) + to:main::@29 +main::@29: scope:[main] from main::@10 + [34] (byte) main::key#0 ← (byte) keyboard_get_keycode::return#2 [ main::screen#2 main::ch#2 main::i#10 main::key#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 main::key#0 ] ) + [35] if((byte) main::key#0==(byte/signed byte/word/signed word/dword/signed dword) 63) goto main::@11 [ main::screen#2 main::ch#2 main::i#10 main::key#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 main::key#0 ] ) + to:main::@22 +main::@22: scope:[main] from main::@29 + [36] (byte) keyboard_key_pressed::key#0 ← (byte) main::key#0 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 ] ) + [37] call keyboard_key_pressed param-assignment [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#0 ] ) + [38] (byte) keyboard_key_pressed::return#2 ← (byte) keyboard_key_pressed::return#0 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#2 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#2 ] ) + to:main::@30 +main::@30: scope:[main] from main::@22 + [39] (byte~) main::$16 ← (byte) keyboard_key_pressed::return#2 [ main::screen#2 main::ch#2 main::i#10 main::$16 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 main::$16 ] ) + [40] if((byte~) main::$16==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@11 [ main::screen#2 main::ch#2 main::i#10 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 ] ) + to:main::@23 +main::@23: scope:[main] from main::@30 + [41] *((byte*) main::screen#2 + (byte) main::i#10) ← (byte) main::ch#2 [ main::screen#2 main::ch#2 main::i#10 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 ] ) + [42] (byte) main::i#1 ← ++ (byte) main::i#10 [ main::screen#2 main::ch#2 main::i#1 ] ( main:2 [ main::screen#2 main::ch#2 main::i#1 ] ) + to:main::@11 +main::@11: scope:[main] from main::@23 main::@29 main::@30 + [43] (byte) main::i#6 ← phi( main::@30/(byte) main::i#10 main::@23/(byte) main::i#1 main::@29/(byte) main::i#10 ) [ main::screen#2 main::ch#2 main::i#6 ] ( main:2 [ main::screen#2 main::ch#2 main::i#6 ] ) + [44] (byte) main::ch#1 ← ++ (byte) main::ch#2 [ main::screen#2 main::ch#1 main::i#6 ] ( main:2 [ main::screen#2 main::ch#1 main::i#6 ] ) + [45] if((byte) main::ch#1!=(byte/signed byte/word/signed word/dword/signed dword) 64) goto main::@10 [ main::screen#2 main::ch#1 main::i#6 ] ( main:2 [ main::screen#2 main::ch#1 main::i#6 ] ) + to:main::@13 +main::@13: scope:[main] from main::@11 main::@13 + [46] (byte) main::i#4 ← phi( main::@11/(byte) main::i#6 main::@13/(byte) main::i#2 ) [ main::screen#2 main::i#4 ] ( main:2 [ main::screen#2 main::i#4 ] ) + [47] *((byte*) main::screen#2 + (byte) main::i#4) ← (byte) ' ' [ main::screen#2 main::i#4 ] ( main:2 [ main::screen#2 main::i#4 ] ) + [48] (byte) main::i#2 ← ++ (byte) main::i#4 [ main::screen#2 main::i#2 ] ( main:2 [ main::screen#2 main::i#2 ] ) + [49] if((byte) main::i#2<(byte/signed byte/word/signed word/dword/signed dword) 5) goto main::@13 [ main::screen#2 main::i#2 ] ( main:2 [ main::screen#2 main::i#2 ] ) to:main::@2 -main::@11: scope:[main] from main::@27 - [40] *((byte*) main::screen#2 + (byte) main::i#2) ← (byte) ' ' [ main::screen#2 main::i#2 ] ( main:2 [ main::screen#2 main::i#2 ] ) - to:main::@12 main::@8: scope:[main] from main::@7 - [41] *((byte*) main::screen#12 + (byte) main::col#2) ← (byte) '0' [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ) + [50] *((byte*) main::screen#13 + (byte) main::col#2) ← (byte) '0' [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ) to:main::@9 -keyboard_char_pressed: scope:[keyboard_char_pressed] from main::@10 - [42] (byte) keyboard_matrix_row::ch#0 ← (byte) keyboard_char_pressed::ch#0 [ keyboard_char_pressed::ch#0 keyboard_matrix_row::ch#0 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_row::ch#0 ] ) - [43] call keyboard_matrix_row param-assignment [ keyboard_char_pressed::ch#0 keyboard_matrix_row::return#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_row::return#1 ] ) - [44] (byte) keyboard_matrix_row::return#0 ← (byte) keyboard_matrix_row::return#1 [ keyboard_char_pressed::ch#0 keyboard_matrix_row::return#0 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_row::return#0 ] ) - to:keyboard_char_pressed::@2 -keyboard_char_pressed::@2: scope:[keyboard_char_pressed] from keyboard_char_pressed - [45] (byte) keyboard_matrix_read::rowid#1 ← (byte) keyboard_matrix_row::return#0 [ keyboard_char_pressed::ch#0 keyboard_matrix_read::rowid#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_read::rowid#1 ] ) - [46] call keyboard_matrix_read param-assignment [ keyboard_matrix_read::return#2 keyboard_char_pressed::ch#0 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_matrix_read::return#2 keyboard_char_pressed::ch#0 ] ) - [47] (byte) keyboard_matrix_read::return#1 ← (byte) keyboard_matrix_read::return#2 [ keyboard_char_pressed::ch#0 keyboard_matrix_read::return#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_read::return#1 ] ) - to:keyboard_char_pressed::@3 -keyboard_char_pressed::@3: scope:[keyboard_char_pressed] from keyboard_char_pressed::@2 - [48] (byte~) keyboard_char_pressed::$1 ← (byte) keyboard_matrix_read::return#1 [ keyboard_char_pressed::ch#0 keyboard_char_pressed::$1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_char_pressed::$1 ] ) - [49] (byte) keyboard_matrix_col::ch#0 ← (byte) keyboard_char_pressed::ch#0 [ keyboard_char_pressed::$1 keyboard_matrix_col::ch#0 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::ch#0 ] ) - [50] call keyboard_matrix_col param-assignment [ keyboard_char_pressed::$1 keyboard_matrix_col::return#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::return#1 ] ) - [51] (byte) keyboard_matrix_col::return#0 ← (byte) keyboard_matrix_col::return#1 [ keyboard_char_pressed::$1 keyboard_matrix_col::return#0 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::return#0 ] ) - to:keyboard_char_pressed::@4 -keyboard_char_pressed::@4: scope:[keyboard_char_pressed] from keyboard_char_pressed::@3 - [52] (byte~) keyboard_char_pressed::$2 ← (byte) keyboard_matrix_col::return#0 [ keyboard_char_pressed::$1 keyboard_char_pressed::$2 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_char_pressed::$2 ] ) - [53] (byte) keyboard_char_pressed::return#1 ← (byte~) keyboard_char_pressed::$1 & (byte~) keyboard_char_pressed::$2 [ keyboard_char_pressed::return#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#1 ] ) - to:keyboard_char_pressed::@return -keyboard_char_pressed::@return: scope:[keyboard_char_pressed] from keyboard_char_pressed::@4 - [54] return [ keyboard_char_pressed::return#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#1 ] ) +keyboard_key_pressed: scope:[keyboard_key_pressed] from main::@22 + [51] (byte) keyboard_matrix_read::rowid#0 ← (byte) keyboard_key_pressed::key#0 >> (byte/signed byte/word/signed word/dword/signed dword) 3 [ keyboard_key_pressed::key#0 keyboard_matrix_read::rowid#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_matrix_read::rowid#0 ] ) + [52] call keyboard_matrix_read param-assignment [ keyboard_matrix_read::return#0 keyboard_key_pressed::key#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_matrix_read::return#0 keyboard_key_pressed::key#0 ] ) + [53] (byte) keyboard_matrix_read::return#2 ← (byte) keyboard_matrix_read::return#0 [ keyboard_key_pressed::key#0 keyboard_matrix_read::return#2 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_matrix_read::return#2 ] ) + to:keyboard_key_pressed::@2 +keyboard_key_pressed::@2: scope:[keyboard_key_pressed] from keyboard_key_pressed + [54] (byte~) keyboard_key_pressed::$1 ← (byte) keyboard_matrix_read::return#2 [ keyboard_key_pressed::key#0 keyboard_key_pressed::$1 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_key_pressed::$1 ] ) + [55] (byte~) keyboard_key_pressed::$2 ← (byte) keyboard_key_pressed::key#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ keyboard_key_pressed::$1 keyboard_key_pressed::$2 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::$1 keyboard_key_pressed::$2 ] ) + [56] (byte) keyboard_key_pressed::return#0 ← (byte~) keyboard_key_pressed::$1 & *((const byte[]) keyboard_matrix_col_bitmask#0 + (byte~) keyboard_key_pressed::$2) [ keyboard_key_pressed::return#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#0 ] ) + to:keyboard_key_pressed::@return +keyboard_key_pressed::@return: scope:[keyboard_key_pressed] from keyboard_key_pressed::@2 + [57] return [ keyboard_key_pressed::return#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#0 ] ) to:@return -keyboard_matrix_col: scope:[keyboard_matrix_col] from keyboard_char_pressed::@3 - [55] (byte) keyboard_matrix_col::col_id#0 ← *((const byte[]) keyboard_matrix_chars#0 + (byte) keyboard_matrix_col::ch#0) >> (byte/signed byte/word/signed word/dword/signed dword) 4 [ keyboard_matrix_col::col_id#0 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_col:50 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::col_id#0 ] ) - [56] (byte) keyboard_matrix_col::return#1 ← *((const byte[]) keyboard_matrix_col_bitmask#0 + (byte) keyboard_matrix_col::col_id#0) [ keyboard_matrix_col::return#1 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_col:50 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::return#1 ] ) - to:keyboard_matrix_col::@return -keyboard_matrix_col::@return: scope:[keyboard_matrix_col] from keyboard_matrix_col - [57] return [ keyboard_matrix_col::return#1 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_col:50 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::return#1 ] ) - to:@return -keyboard_matrix_read: scope:[keyboard_matrix_read] from keyboard_char_pressed::@2 main::@6 - [58] (byte) keyboard_matrix_read::rowid#2 ← phi( keyboard_char_pressed::@2/(byte) keyboard_matrix_read::rowid#1 main::@6/(byte) keyboard_matrix_read::rowid#0 ) [ keyboard_matrix_read::rowid#2 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#12 keyboard_matrix_read::rowid#2 ] main:2::keyboard_char_pressed:33::keyboard_matrix_read:46 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_read::rowid#2 ] ) - [59] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_row_bits#0 + (byte) keyboard_matrix_read::rowid#2) [ ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#12 ] main:2::keyboard_char_pressed:33::keyboard_matrix_read:46 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 ] ) - [60] (byte) keyboard_matrix_read::return#2 ← ~ *((const byte*) CIA1_PORT_B#0) [ keyboard_matrix_read::return#2 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#12 keyboard_matrix_read::return#2 ] main:2::keyboard_char_pressed:33::keyboard_matrix_read:46 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_read::return#2 ] ) +keyboard_matrix_read: scope:[keyboard_matrix_read] from keyboard_key_pressed main::@6 + [58] (byte) keyboard_matrix_read::rowid#2 ← phi( keyboard_key_pressed/(byte) keyboard_matrix_read::rowid#0 main::@6/(byte) keyboard_matrix_read::rowid#1 ) [ keyboard_matrix_read::rowid#2 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#13 keyboard_matrix_read::rowid#2 ] main:2::keyboard_key_pressed:37::keyboard_matrix_read:52 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_matrix_read::rowid#2 ] ) + [59] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#2) [ ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#13 ] main:2::keyboard_key_pressed:37::keyboard_matrix_read:52 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 ] ) + [60] (byte) keyboard_matrix_read::return#0 ← ~ *((const byte*) CIA1_PORT_B#0) [ keyboard_matrix_read::return#0 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#13 keyboard_matrix_read::return#0 ] main:2::keyboard_key_pressed:37::keyboard_matrix_read:52 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_matrix_read::return#0 ] ) to:keyboard_matrix_read::@return keyboard_matrix_read::@return: scope:[keyboard_matrix_read] from keyboard_matrix_read - [61] return [ keyboard_matrix_read::return#2 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#12 keyboard_matrix_read::return#2 ] main:2::keyboard_char_pressed:33::keyboard_matrix_read:46 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_read::return#2 ] ) + [61] return [ keyboard_matrix_read::return#0 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#13 keyboard_matrix_read::return#0 ] main:2::keyboard_key_pressed:37::keyboard_matrix_read:52 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_matrix_read::return#0 ] ) to:@return -keyboard_matrix_row: scope:[keyboard_matrix_row] from keyboard_char_pressed - [62] (byte) keyboard_matrix_row::return#1 ← *((const byte[]) keyboard_matrix_chars#0 + (byte) keyboard_matrix_row::ch#0) & (byte/signed byte/word/signed word/dword/signed dword) 15 [ keyboard_matrix_row::return#1 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_row:43 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_row::return#1 ] ) - to:keyboard_matrix_row::@return -keyboard_matrix_row::@return: scope:[keyboard_matrix_row] from keyboard_matrix_row - [63] return [ keyboard_matrix_row::return#1 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_row:43 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_row::return#1 ] ) +keyboard_get_keycode: scope:[keyboard_get_keycode] from main::@10 + [62] (byte) keyboard_get_keycode::return#0 ← *((const byte[]) keyboard_char_keycodes#0 + (byte) keyboard_get_keycode::ch#0) [ keyboard_get_keycode::return#0 ] ( main:2::keyboard_get_keycode:32 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#0 ] ) + to:keyboard_get_keycode::@return +keyboard_get_keycode::@return: scope:[keyboard_get_keycode] from keyboard_get_keycode + [63] return [ keyboard_get_keycode::return#0 ] ( main:2::keyboard_get_keycode:32 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#0 ] ) to:@return -keyboard_init: scope:[keyboard_init] from main::@13 +keyboard_init: scope:[keyboard_init] from main::@14 [64] *((const byte*) CIA1_PORT_A_DDR#0) ← (byte/word/signed word/dword/signed dword) 255 [ ] ( main:2::keyboard_init:10 [ ] ) [65] *((const byte*) CIA1_PORT_B_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::keyboard_init:10 [ ] ) to:keyboard_init::@return @@ -1520,81 +1997,83 @@ keyboard_init::@return: scope:[keyboard_init] from keyboard_init DOMINATORS @begin dominated by @begin -@6 dominated by @begin @6 -@end dominated by @end @begin @6 -main dominated by main @begin @6 -main::@1 dominated by main main::@1 @begin @6 -main::@13 dominated by main main::@1 @begin main::@13 @6 -main::@2 dominated by main main::@1 main::@2 @begin main::@13 @6 -main::@return dominated by main::@return main main::@1 main::@2 @begin main::@13 @6 -main::@5 dominated by main main::@1 main::@2 main::@5 @begin main::@13 @6 -main::@6 dominated by main main::@1 main::@2 main::@5 main::@6 @begin main::@13 @6 -main::@26 dominated by main main::@26 main::@1 main::@2 main::@5 main::@6 @begin main::@13 @6 -main::@7 dominated by main::@7 main main::@26 main::@1 main::@2 main::@5 main::@6 @begin main::@13 @6 -main::@17 dominated by main::@7 main main::@26 main::@1 main::@2 main::@5 main::@6 @begin main::@17 main::@13 @6 -main::@9 dominated by main::@9 main::@7 main main::@26 main::@1 main::@2 main::@5 main::@6 @begin main::@13 @6 -main::@19 dominated by main::@9 main::@7 main main::@26 main::@1 main::@2 main::@5 main::@6 @begin main::@19 main::@13 @6 -main::@20 dominated by main::@9 main::@20 main::@7 main main::@26 main::@1 main::@2 main::@5 main::@6 @begin main::@19 main::@13 @6 -main::@10 dominated by main::@9 main::@20 main::@7 main main::@26 main::@1 main::@2 main::@5 main::@6 @begin main::@10 main::@19 main::@13 @6 -main::@27 dominated by main::@9 main::@20 main::@7 main::@27 main main::@26 main::@1 main::@2 main::@5 main::@6 @begin main::@10 main::@19 main::@13 @6 -main::@21 dominated by main::@9 main::@20 main::@7 main::@21 main::@27 main main::@26 main::@1 main::@2 main::@5 main::@6 @begin main::@10 main::@19 main::@13 @6 -main::@12 dominated by main::@9 main::@20 main::@7 main::@27 main main::@26 main::@1 main::@2 main::@5 main::@6 @begin main::@10 main::@19 main::@13 main::@12 @6 -main::@11 dominated by main::@9 main::@20 main::@7 main::@27 main main::@26 main::@1 main::@2 main::@5 main::@6 main::@11 @begin main::@10 main::@19 main::@13 @6 -main::@8 dominated by main::@7 main::@8 main main::@26 main::@1 main::@2 main::@5 main::@6 @begin main::@13 @6 -keyboard_char_pressed dominated by main::@9 main::@20 main::@7 main main::@26 main::@1 main::@2 main::@5 main::@6 keyboard_char_pressed @begin main::@10 main::@19 main::@13 @6 -keyboard_char_pressed::@2 dominated by main::@9 main::@20 main::@7 main main::@26 main::@1 main::@2 main::@5 main::@6 keyboard_char_pressed keyboard_char_pressed::@2 @begin main::@10 main::@19 main::@13 @6 -keyboard_char_pressed::@3 dominated by main::@9 main::@20 main::@7 main main::@26 main::@1 main::@2 main::@5 main::@6 keyboard_char_pressed keyboard_char_pressed::@2 @begin main::@10 keyboard_char_pressed::@3 main::@19 main::@13 @6 -keyboard_char_pressed::@4 dominated by main::@9 main::@20 main::@7 main main::@26 main::@1 main::@2 main::@5 main::@6 keyboard_char_pressed keyboard_char_pressed::@2 @begin main::@10 keyboard_char_pressed::@4 keyboard_char_pressed::@3 main::@19 main::@13 @6 -keyboard_char_pressed::@return dominated by main::@9 main::@20 main::@7 main keyboard_char_pressed::@return main::@26 main::@1 main::@2 main::@5 main::@6 keyboard_char_pressed keyboard_char_pressed::@2 @begin main::@10 keyboard_char_pressed::@4 keyboard_char_pressed::@3 main::@19 main::@13 @6 -keyboard_matrix_col dominated by main::@9 main::@20 main::@7 main main::@26 main::@1 main::@2 main::@5 main::@6 keyboard_char_pressed keyboard_char_pressed::@2 @begin main::@10 keyboard_char_pressed::@3 main::@19 main::@13 @6 keyboard_matrix_col -keyboard_matrix_col::@return dominated by main::@9 main::@20 main::@7 main main::@26 main::@1 main::@2 main::@5 main::@6 keyboard_char_pressed keyboard_char_pressed::@2 @begin main::@10 keyboard_char_pressed::@3 keyboard_matrix_col::@return main::@19 main::@13 @6 keyboard_matrix_col -keyboard_matrix_read dominated by keyboard_matrix_read main main::@1 main::@2 main::@5 main::@6 @begin main::@13 @6 -keyboard_matrix_read::@return dominated by keyboard_matrix_read main main::@1 main::@2 main::@5 main::@6 @begin main::@13 keyboard_matrix_read::@return @6 -keyboard_matrix_row dominated by main::@9 main::@20 main::@7 main main::@26 keyboard_matrix_row main::@1 main::@2 main::@5 main::@6 keyboard_char_pressed @begin main::@10 main::@19 main::@13 @6 -keyboard_matrix_row::@return dominated by main::@9 main::@20 main::@7 main main::@26 keyboard_matrix_row main::@1 main::@2 main::@5 main::@6 keyboard_char_pressed @begin main::@10 main::@19 main::@13 @6 keyboard_matrix_row::@return -keyboard_init dominated by main keyboard_init main::@1 @begin main::@13 @6 -keyboard_init::@return dominated by main keyboard_init main::@1 keyboard_init::@return @begin main::@13 @6 +@5 dominated by @begin @5 +@end dominated by @end @begin @5 +main dominated by main @begin @5 +main::@1 dominated by main main::@1 @begin @5 +main::@14 dominated by main main::@1 @begin main::@14 @5 +main::@2 dominated by main main::@1 main::@2 @begin main::@14 @5 +main::@return dominated by main::@return main main::@1 main::@2 @begin main::@14 @5 +main::@5 dominated by main main::@1 main::@2 main::@5 @begin main::@14 @5 +main::@6 dominated by main main::@1 main::@2 main::@5 main::@6 @begin main::@14 @5 +main::@28 dominated by main::@28 main main::@1 main::@2 main::@5 main::@6 @begin main::@14 @5 +main::@7 dominated by main::@7 main::@28 main main::@1 main::@2 main::@5 main::@6 @begin main::@14 @5 +main::@18 dominated by main::@7 main::@28 main main::@1 main::@2 main::@5 main::@6 @begin main::@18 main::@14 @5 +main::@9 dominated by main::@9 main::@7 main::@28 main main::@1 main::@2 main::@5 main::@6 @begin main::@14 @5 +main::@20 dominated by main::@9 main::@20 main::@7 main::@28 main main::@1 main::@2 main::@5 main::@6 @begin main::@14 @5 +main::@21 dominated by main::@9 main::@20 main::@7 main::@21 main::@28 main main::@1 main::@2 main::@5 main::@6 @begin main::@14 @5 +main::@10 dominated by main::@9 main::@20 main::@7 main::@21 main::@28 main main::@1 main::@2 main::@5 main::@6 @begin main::@10 main::@14 @5 +main::@29 dominated by main::@9 main::@20 main::@7 main::@21 main::@28 main main::@29 main::@1 main::@2 main::@5 main::@6 @begin main::@10 main::@14 @5 +main::@22 dominated by main::@9 main::@20 main::@7 main::@22 main::@21 main::@28 main main::@29 main::@1 main::@2 main::@5 main::@6 @begin main::@10 main::@14 @5 +main::@30 dominated by main::@9 main::@20 main::@7 main::@22 main::@21 main::@28 main main::@29 main::@1 main::@2 main::@5 main::@6 main::@30 @begin main::@10 main::@14 @5 +main::@23 dominated by main::@9 main::@20 main::@7 main::@22 main::@21 main::@28 main main::@29 main::@23 main::@1 main::@2 main::@5 main::@6 main::@30 @begin main::@10 main::@14 @5 +main::@11 dominated by main::@9 main::@20 main::@7 main::@21 main::@28 main main::@29 main::@1 main::@2 main::@5 main::@6 main::@11 @begin main::@10 main::@14 @5 +main::@13 dominated by main::@9 main::@20 main::@7 main::@21 main::@28 main main::@29 main::@1 main::@2 main::@5 main::@6 main::@11 @begin main::@10 main::@13 main::@14 @5 +main::@8 dominated by main::@7 main::@8 main::@28 main main::@1 main::@2 main::@5 main::@6 @begin main::@14 @5 +keyboard_key_pressed dominated by main::@9 main::@20 main::@7 main::@22 main::@21 main::@28 main main::@29 main::@1 main::@2 main::@5 main::@6 @begin main::@10 main::@14 keyboard_key_pressed @5 +keyboard_key_pressed::@2 dominated by main::@9 main::@20 main::@7 main::@22 main::@21 main::@28 main main::@29 main::@1 main::@2 keyboard_key_pressed::@2 main::@5 main::@6 @begin main::@10 main::@14 keyboard_key_pressed @5 +keyboard_key_pressed::@return dominated by main::@9 main::@20 main::@7 main::@22 main::@21 main::@28 main main::@29 keyboard_key_pressed::@return main::@1 main::@2 keyboard_key_pressed::@2 main::@5 main::@6 @begin main::@10 main::@14 keyboard_key_pressed @5 +keyboard_matrix_read dominated by keyboard_matrix_read main main::@1 main::@2 main::@5 main::@6 @begin main::@14 @5 +keyboard_matrix_read::@return dominated by keyboard_matrix_read main main::@1 main::@2 main::@5 main::@6 @begin keyboard_matrix_read::@return main::@14 @5 +keyboard_get_keycode dominated by main::@9 main::@20 main::@7 main::@21 main::@28 main main::@1 main::@2 main::@5 main::@6 keyboard_get_keycode @begin main::@10 main::@14 @5 +keyboard_get_keycode::@return dominated by main::@9 main::@20 main::@7 main::@21 main::@28 main main::@1 main::@2 main::@5 main::@6 keyboard_get_keycode @begin main::@10 main::@14 @5 keyboard_get_keycode::@return +keyboard_init dominated by main keyboard_init main::@1 @begin main::@14 @5 +keyboard_init::@return dominated by main keyboard_init main::@1 keyboard_init::@return @begin main::@14 @5 NATURAL LOOPS Found back edge: Loop head: main::@1 tails: main::@1 blocks: null Found back edge: Loop head: main::@5 tails: main::@5 blocks: null Found back edge: Loop head: main::@7 tails: main::@9 blocks: null -Found back edge: Loop head: main::@6 tails: main::@19 blocks: null -Found back edge: Loop head: main::@2 tails: main::@12 blocks: null -Found back edge: Loop head: main::@10 tails: main::@12 blocks: null +Found back edge: Loop head: main::@6 tails: main::@20 blocks: null +Found back edge: Loop head: main::@10 tails: main::@11 blocks: null +Found back edge: Loop head: main::@2 tails: main::@13 blocks: null +Found back edge: Loop head: main::@13 tails: main::@13 blocks: null Populated: Loop head: main::@1 tails: main::@1 blocks: main::@1 Populated: Loop head: main::@5 tails: main::@5 blocks: main::@5 -Populated: Loop head: main::@7 tails: main::@9 blocks: main::@9 main::@17 main::@8 main::@7 -Populated: Loop head: main::@6 tails: main::@19 blocks: main::@19 main::@9 main::@17 main::@8 main::@7 main::@26 main::@6 -Populated: Loop head: main::@2 tails: main::@12 blocks: main::@12 main::@11 main::@21 main::@27 main::@10 main::@20 main::@19 main::@9 main::@17 main::@8 main::@7 main::@26 main::@6 main::@5 main::@2 -Populated: Loop head: main::@10 tails: main::@12 blocks: main::@12 main::@11 main::@21 main::@27 main::@10 +Populated: Loop head: main::@7 tails: main::@9 blocks: main::@9 main::@18 main::@8 main::@7 +Populated: Loop head: main::@6 tails: main::@20 blocks: main::@20 main::@9 main::@18 main::@8 main::@7 main::@28 main::@6 +Populated: Loop head: main::@10 tails: main::@11 blocks: main::@11 main::@23 main::@29 main::@30 main::@10 main::@22 +Populated: Loop head: main::@2 tails: main::@13 blocks: main::@13 main::@11 main::@23 main::@29 main::@30 main::@10 main::@22 main::@21 main::@20 main::@9 main::@18 main::@8 main::@7 main::@28 main::@6 main::@5 main::@2 +Populated: Loop head: main::@13 tails: main::@13 blocks: main::@13 Loop head: main::@1 tails: main::@1 blocks: main::@1 Loop head: main::@5 tails: main::@5 blocks: main::@5 -Loop head: main::@7 tails: main::@9 blocks: main::@9 main::@17 main::@8 main::@7 -Loop head: main::@6 tails: main::@19 blocks: main::@19 main::@9 main::@17 main::@8 main::@7 main::@26 main::@6 -Loop head: main::@2 tails: main::@12 blocks: main::@12 main::@11 main::@21 main::@27 main::@10 main::@20 main::@19 main::@9 main::@17 main::@8 main::@7 main::@26 main::@6 main::@5 main::@2 -Loop head: main::@10 tails: main::@12 blocks: main::@12 main::@11 main::@21 main::@27 main::@10 +Loop head: main::@7 tails: main::@9 blocks: main::@9 main::@18 main::@8 main::@7 +Loop head: main::@6 tails: main::@20 blocks: main::@20 main::@9 main::@18 main::@8 main::@7 main::@28 main::@6 +Loop head: main::@10 tails: main::@11 blocks: main::@11 main::@23 main::@29 main::@30 main::@10 main::@22 +Loop head: main::@2 tails: main::@13 blocks: main::@13 main::@11 main::@23 main::@29 main::@30 main::@10 main::@22 main::@21 main::@20 main::@9 main::@18 main::@8 main::@7 main::@28 main::@6 main::@5 main::@2 +Loop head: main::@13 tails: main::@13 blocks: main::@13 NATURAL LOOPS WITH DEPTH Found 0 loops in scope [] -Found 6 loops in scope [main] +Found 7 loops in scope [main] Loop head: main::@1 tails: main::@1 blocks: main::@1 Loop head: main::@5 tails: main::@5 blocks: main::@5 - Loop head: main::@7 tails: main::@9 blocks: main::@9 main::@17 main::@8 main::@7 - Loop head: main::@6 tails: main::@19 blocks: main::@19 main::@9 main::@17 main::@8 main::@7 main::@26 main::@6 - Loop head: main::@2 tails: main::@12 blocks: main::@12 main::@11 main::@21 main::@27 main::@10 main::@20 main::@19 main::@9 main::@17 main::@8 main::@7 main::@26 main::@6 main::@5 main::@2 - Loop head: main::@10 tails: main::@12 blocks: main::@12 main::@11 main::@21 main::@27 main::@10 + Loop head: main::@7 tails: main::@9 blocks: main::@9 main::@18 main::@8 main::@7 + Loop head: main::@6 tails: main::@20 blocks: main::@20 main::@9 main::@18 main::@8 main::@7 main::@28 main::@6 + Loop head: main::@10 tails: main::@11 blocks: main::@11 main::@23 main::@29 main::@30 main::@10 main::@22 + Loop head: main::@2 tails: main::@13 blocks: main::@13 main::@11 main::@23 main::@29 main::@30 main::@10 main::@22 main::@21 main::@20 main::@9 main::@18 main::@8 main::@7 main::@28 main::@6 main::@5 main::@2 + Loop head: main::@13 tails: main::@13 blocks: main::@13 Found 0 loops in scope [keyboard_init] Found 0 loops in scope [keyboard_matrix_read] -Found 0 loops in scope [keyboard_char_pressed] -Found 0 loops in scope [keyboard_matrix_row] -Found 0 loops in scope [keyboard_matrix_col] +Found 0 loops in scope [keyboard_get_keycode] +Found 0 loops in scope [keyboard_key_pressed] Loop head: main::@1 tails: main::@1 blocks: main::@1 depth: 1 Loop head: main::@5 tails: main::@5 blocks: main::@5 depth: 2 -Loop head: main::@7 tails: main::@9 blocks: main::@9 main::@17 main::@8 main::@7 depth: 3 -Loop head: main::@6 tails: main::@19 blocks: main::@19 main::@9 main::@17 main::@8 main::@7 main::@26 main::@6 depth: 2 -Loop head: main::@2 tails: main::@12 blocks: main::@12 main::@11 main::@21 main::@27 main::@10 main::@20 main::@19 main::@9 main::@17 main::@8 main::@7 main::@26 main::@6 main::@5 main::@2 depth: 1 -Loop head: main::@10 tails: main::@12 blocks: main::@12 main::@11 main::@21 main::@27 main::@10 depth: 2 +Loop head: main::@7 tails: main::@9 blocks: main::@9 main::@18 main::@8 main::@7 depth: 3 +Loop head: main::@6 tails: main::@20 blocks: main::@20 main::@9 main::@18 main::@8 main::@7 main::@28 main::@6 depth: 2 +Loop head: main::@10 tails: main::@11 blocks: main::@11 main::@23 main::@29 main::@30 main::@10 main::@22 depth: 2 +Loop head: main::@2 tails: main::@13 blocks: main::@13 main::@11 main::@23 main::@29 main::@30 main::@10 main::@22 main::@21 main::@20 main::@9 main::@18 main::@8 main::@7 main::@28 main::@6 main::@5 main::@2 depth: 1 +Loop head: main::@13 tails: main::@13 blocks: main::@13 depth: 2 VARIABLE REGISTER WEIGHTS @@ -1602,55 +2081,101 @@ VARIABLE REGISTER WEIGHTS (byte*) CIA1_PORT_A_DDR (byte*) CIA1_PORT_B (byte*) CIA1_PORT_B_DDR +(byte) KEY_0 +(byte) KEY_1 +(byte) KEY_2 +(byte) KEY_3 +(byte) KEY_4 +(byte) KEY_5 +(byte) KEY_6 +(byte) KEY_7 +(byte) KEY_8 +(byte) KEY_9 +(byte) KEY_A +(byte) KEY_ARROW_LEFT +(byte) KEY_ARROW_UP +(byte) KEY_ASTERISK +(byte) KEY_AT +(byte) KEY_B +(byte) KEY_C +(byte) KEY_COLON +(byte) KEY_COMMA +(byte) KEY_D +(byte) KEY_DOT +(byte) KEY_E +(byte) KEY_EQUALS +(byte) KEY_F +(byte) KEY_G +(byte) KEY_H +(byte) KEY_I +(byte) KEY_J +(byte) KEY_K +(byte) KEY_L +(byte) KEY_M +(byte) KEY_MINUS +(byte) KEY_N +(byte) KEY_O +(byte) KEY_PLUS +(byte) KEY_POUND +(byte) KEY_Q +(byte) KEY_R +(byte) KEY_S +(byte) KEY_SEMICOLON +(byte) KEY_SLASH +(byte) KEY_SPACE +(byte) KEY_T +(byte) KEY_U +(byte) KEY_V +(byte) KEY_W +(byte) KEY_X +(byte) KEY_Y +(byte) KEY_Z (byte*) RASTER -(byte()) keyboard_char_pressed((byte) keyboard_char_pressed::ch) -(byte~) keyboard_char_pressed::$1 0.8 -(byte~) keyboard_char_pressed::$2 4.0 -(byte) keyboard_char_pressed::ch -(byte) keyboard_char_pressed::ch#0 13.125 -(byte) keyboard_char_pressed::return -(byte) keyboard_char_pressed::return#0 202.0 -(byte) keyboard_char_pressed::return#1 34.33333333333333 +(byte[]) keyboard_char_keycodes +(byte()) keyboard_get_keycode((byte) keyboard_get_keycode::ch) +(byte) keyboard_get_keycode::ch +(byte) keyboard_get_keycode::ch#0 103.0 +(byte) keyboard_get_keycode::return +(byte) keyboard_get_keycode::return#0 34.33333333333333 +(byte) keyboard_get_keycode::return#2 202.0 (void()) keyboard_init() -(byte[]) keyboard_matrix_chars -(byte()) keyboard_matrix_col((byte) keyboard_matrix_col::ch) -(byte) keyboard_matrix_col::ch -(byte) keyboard_matrix_col::ch#0 4.0 -(byte) keyboard_matrix_col::col_id -(byte) keyboard_matrix_col::col_id#0 4.0 -(byte) keyboard_matrix_col::return -(byte) keyboard_matrix_col::return#0 4.0 -(byte) keyboard_matrix_col::return#1 1.3333333333333333 +(byte()) keyboard_key_pressed((byte) keyboard_key_pressed::key) +(byte~) keyboard_key_pressed::$1 2.0 +(byte~) keyboard_key_pressed::$2 4.0 +(byte) keyboard_key_pressed::key +(byte) keyboard_key_pressed::key#0 20.999999999999996 +(byte) keyboard_key_pressed::return +(byte) keyboard_key_pressed::return#0 34.33333333333333 +(byte) keyboard_key_pressed::return#2 202.0 (byte[]) keyboard_matrix_col_bitmask (byte()) keyboard_matrix_read((byte) keyboard_matrix_read::rowid) (byte) keyboard_matrix_read::return -(byte) keyboard_matrix_read::return#0 202.0 -(byte) keyboard_matrix_read::return#1 4.0 -(byte) keyboard_matrix_read::return#2 26.25 +(byte) keyboard_matrix_read::return#0 26.25 +(byte) keyboard_matrix_read::return#2 4.0 +(byte) keyboard_matrix_read::return#3 202.0 (byte) keyboard_matrix_read::row_pressed_bits (byte) keyboard_matrix_read::rowid -(byte) keyboard_matrix_read::rowid#0 202.0 -(byte) keyboard_matrix_read::rowid#1 4.0 +(byte) keyboard_matrix_read::rowid#0 4.0 +(byte) keyboard_matrix_read::rowid#1 202.0 (byte) keyboard_matrix_read::rowid#2 105.0 -(byte()) keyboard_matrix_row((byte) keyboard_matrix_row::ch) -(byte) keyboard_matrix_row::ch -(byte) keyboard_matrix_row::ch#0 4.0 -(byte) keyboard_matrix_row::return -(byte) keyboard_matrix_row::return#0 4.0 -(byte) keyboard_matrix_row::return#1 1.3333333333333333 -(byte[8]) keyboard_row_bits +(byte[8]) keyboard_matrix_row_bitmask (void()) main() -(byte~) main::$13 202.0 +(byte~) main::$16 202.0 (byte~) main::$5 2002.0 (byte) main::ch -(byte) main::ch#0 50.5 -(byte[]) main::chars +(byte) main::ch#1 151.5 +(byte) main::ch#2 28.857142857142858 (byte) main::col (byte) main::col#1 1501.5 (byte) main::col#2 667.3333333333334 (byte) main::i -(byte) main::i#1 151.5 -(byte) main::i#2 56.11111111111111 +(byte) main::i#1 202.0 +(byte) main::i#10 42.08333333333333 +(byte) main::i#2 151.5 +(byte) main::i#4 202.0 +(byte) main::i#6 168.33333333333331 +(byte) main::key +(byte) main::key#0 151.5 (byte) main::row (byte) main::row#1 151.5 (byte) main::row#2 21.642857142857142 @@ -1663,89 +2188,80 @@ VARIABLE REGISTER WEIGHTS (byte*) main::sc#2 16.5 (byte*) main::screen (byte*) main::screen#1 71.0 -(byte*) main::screen#12 169.53846153846155 -(byte*) main::screen#2 17.75 +(byte*) main::screen#13 169.53846153846155 +(byte*) main::screen#2 10.142857142857142 Initial phi equivalence classes [ main::sc#2 main::sc#1 ] [ main::row#2 main::row#1 ] -[ main::screen#12 main::screen#1 ] +[ main::screen#13 main::screen#1 ] [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 ] [ main::col#2 main::col#1 ] -[ main::i#2 main::i#1 ] -[ keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#1 keyboard_matrix_read::rowid#0 ] -Added variable keyboard_matrix_read::return#0 to zero page equivalence class [ keyboard_matrix_read::return#0 ] +[ main::ch#2 main::ch#1 ] +[ main::i#4 main::i#10 main::i#6 main::i#1 main::i#2 ] +[ keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#0 keyboard_matrix_read::rowid#1 ] +Added variable keyboard_matrix_read::return#3 to zero page equivalence class [ keyboard_matrix_read::return#3 ] Added variable main::$5 to zero page equivalence class [ main::$5 ] Added variable main::screen#2 to zero page equivalence class [ main::screen#2 ] -Added variable main::ch#0 to zero page equivalence class [ main::ch#0 ] -Added variable keyboard_char_pressed::ch#0 to zero page equivalence class [ keyboard_char_pressed::ch#0 ] -Added variable keyboard_char_pressed::return#0 to zero page equivalence class [ keyboard_char_pressed::return#0 ] -Added variable main::$13 to zero page equivalence class [ main::$13 ] -Added variable keyboard_matrix_row::ch#0 to zero page equivalence class [ keyboard_matrix_row::ch#0 ] -Added variable keyboard_matrix_row::return#0 to zero page equivalence class [ keyboard_matrix_row::return#0 ] -Added variable keyboard_matrix_read::return#1 to zero page equivalence class [ keyboard_matrix_read::return#1 ] -Added variable keyboard_char_pressed::$1 to zero page equivalence class [ keyboard_char_pressed::$1 ] -Added variable keyboard_matrix_col::ch#0 to zero page equivalence class [ keyboard_matrix_col::ch#0 ] -Added variable keyboard_matrix_col::return#0 to zero page equivalence class [ keyboard_matrix_col::return#0 ] -Added variable keyboard_char_pressed::$2 to zero page equivalence class [ keyboard_char_pressed::$2 ] -Added variable keyboard_char_pressed::return#1 to zero page equivalence class [ keyboard_char_pressed::return#1 ] -Added variable keyboard_matrix_col::col_id#0 to zero page equivalence class [ keyboard_matrix_col::col_id#0 ] -Added variable keyboard_matrix_col::return#1 to zero page equivalence class [ keyboard_matrix_col::return#1 ] +Added variable keyboard_get_keycode::ch#0 to zero page equivalence class [ keyboard_get_keycode::ch#0 ] +Added variable keyboard_get_keycode::return#2 to zero page equivalence class [ keyboard_get_keycode::return#2 ] +Added variable main::key#0 to zero page equivalence class [ main::key#0 ] +Added variable keyboard_key_pressed::key#0 to zero page equivalence class [ keyboard_key_pressed::key#0 ] +Added variable keyboard_key_pressed::return#2 to zero page equivalence class [ keyboard_key_pressed::return#2 ] +Added variable main::$16 to zero page equivalence class [ main::$16 ] Added variable keyboard_matrix_read::return#2 to zero page equivalence class [ keyboard_matrix_read::return#2 ] -Added variable keyboard_matrix_row::return#1 to zero page equivalence class [ keyboard_matrix_row::return#1 ] +Added variable keyboard_key_pressed::$1 to zero page equivalence class [ keyboard_key_pressed::$1 ] +Added variable keyboard_key_pressed::$2 to zero page equivalence class [ keyboard_key_pressed::$2 ] +Added variable keyboard_key_pressed::return#0 to zero page equivalence class [ keyboard_key_pressed::return#0 ] +Added variable keyboard_matrix_read::return#0 to zero page equivalence class [ keyboard_matrix_read::return#0 ] +Added variable keyboard_get_keycode::return#0 to zero page equivalence class [ keyboard_get_keycode::return#0 ] Complete equivalence classes [ main::sc#2 main::sc#1 ] [ main::row#2 main::row#1 ] -[ main::screen#12 main::screen#1 ] +[ main::screen#13 main::screen#1 ] [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 ] [ main::col#2 main::col#1 ] -[ main::i#2 main::i#1 ] -[ keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#1 keyboard_matrix_read::rowid#0 ] -[ keyboard_matrix_read::return#0 ] +[ main::ch#2 main::ch#1 ] +[ main::i#4 main::i#10 main::i#6 main::i#1 main::i#2 ] +[ keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#0 keyboard_matrix_read::rowid#1 ] +[ keyboard_matrix_read::return#3 ] [ main::$5 ] [ main::screen#2 ] -[ main::ch#0 ] -[ keyboard_char_pressed::ch#0 ] -[ keyboard_char_pressed::return#0 ] -[ main::$13 ] -[ keyboard_matrix_row::ch#0 ] -[ keyboard_matrix_row::return#0 ] -[ keyboard_matrix_read::return#1 ] -[ keyboard_char_pressed::$1 ] -[ keyboard_matrix_col::ch#0 ] -[ keyboard_matrix_col::return#0 ] -[ keyboard_char_pressed::$2 ] -[ keyboard_char_pressed::return#1 ] -[ keyboard_matrix_col::col_id#0 ] -[ keyboard_matrix_col::return#1 ] +[ keyboard_get_keycode::ch#0 ] +[ keyboard_get_keycode::return#2 ] +[ main::key#0 ] +[ keyboard_key_pressed::key#0 ] +[ keyboard_key_pressed::return#2 ] +[ main::$16 ] [ keyboard_matrix_read::return#2 ] -[ keyboard_matrix_row::return#1 ] +[ keyboard_key_pressed::$1 ] +[ keyboard_key_pressed::$2 ] +[ keyboard_key_pressed::return#0 ] +[ keyboard_matrix_read::return#0 ] +[ keyboard_get_keycode::return#0 ] Allocated zp ZP_WORD:2 [ main::sc#2 main::sc#1 ] Allocated zp ZP_BYTE:4 [ main::row#2 main::row#1 ] -Allocated zp ZP_WORD:5 [ main::screen#12 main::screen#1 ] +Allocated zp ZP_WORD:5 [ main::screen#13 main::screen#1 ] Allocated zp ZP_BYTE:7 [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 ] Allocated zp ZP_BYTE:8 [ main::col#2 main::col#1 ] -Allocated zp ZP_BYTE:9 [ main::i#2 main::i#1 ] -Allocated zp ZP_BYTE:10 [ keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#1 keyboard_matrix_read::rowid#0 ] -Allocated zp ZP_BYTE:11 [ keyboard_matrix_read::return#0 ] -Allocated zp ZP_BYTE:12 [ main::$5 ] -Allocated zp ZP_WORD:13 [ main::screen#2 ] -Allocated zp ZP_BYTE:15 [ main::ch#0 ] -Allocated zp ZP_BYTE:16 [ keyboard_char_pressed::ch#0 ] -Allocated zp ZP_BYTE:17 [ keyboard_char_pressed::return#0 ] -Allocated zp ZP_BYTE:18 [ main::$13 ] -Allocated zp ZP_BYTE:19 [ keyboard_matrix_row::ch#0 ] -Allocated zp ZP_BYTE:20 [ keyboard_matrix_row::return#0 ] -Allocated zp ZP_BYTE:21 [ keyboard_matrix_read::return#1 ] -Allocated zp ZP_BYTE:22 [ keyboard_char_pressed::$1 ] -Allocated zp ZP_BYTE:23 [ keyboard_matrix_col::ch#0 ] -Allocated zp ZP_BYTE:24 [ keyboard_matrix_col::return#0 ] -Allocated zp ZP_BYTE:25 [ keyboard_char_pressed::$2 ] -Allocated zp ZP_BYTE:26 [ keyboard_char_pressed::return#1 ] -Allocated zp ZP_BYTE:27 [ keyboard_matrix_col::col_id#0 ] -Allocated zp ZP_BYTE:28 [ keyboard_matrix_col::return#1 ] -Allocated zp ZP_BYTE:29 [ keyboard_matrix_read::return#2 ] -Allocated zp ZP_BYTE:30 [ keyboard_matrix_row::return#1 ] +Allocated zp ZP_BYTE:9 [ main::ch#2 main::ch#1 ] +Allocated zp ZP_BYTE:10 [ main::i#4 main::i#10 main::i#6 main::i#1 main::i#2 ] +Allocated zp ZP_BYTE:11 [ keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#0 keyboard_matrix_read::rowid#1 ] +Allocated zp ZP_BYTE:12 [ keyboard_matrix_read::return#3 ] +Allocated zp ZP_BYTE:13 [ main::$5 ] +Allocated zp ZP_WORD:14 [ main::screen#2 ] +Allocated zp ZP_BYTE:16 [ keyboard_get_keycode::ch#0 ] +Allocated zp ZP_BYTE:17 [ keyboard_get_keycode::return#2 ] +Allocated zp ZP_BYTE:18 [ main::key#0 ] +Allocated zp ZP_BYTE:19 [ keyboard_key_pressed::key#0 ] +Allocated zp ZP_BYTE:20 [ keyboard_key_pressed::return#2 ] +Allocated zp ZP_BYTE:21 [ main::$16 ] +Allocated zp ZP_BYTE:22 [ keyboard_matrix_read::return#2 ] +Allocated zp ZP_BYTE:23 [ keyboard_key_pressed::$1 ] +Allocated zp ZP_BYTE:24 [ keyboard_key_pressed::$2 ] +Allocated zp ZP_BYTE:25 [ keyboard_key_pressed::return#0 ] +Allocated zp ZP_BYTE:26 [ keyboard_matrix_read::return#0 ] +Allocated zp ZP_BYTE:27 [ keyboard_get_keycode::return#0 ] INITIAL ASM //SEG0 Basic Upstart @@ -1758,34 +2274,84 @@ INITIAL ASM .label CIA1_PORT_B = $dc01 .label CIA1_PORT_A_DDR = $dc02 .label CIA1_PORT_B_DDR = $dc03 + .const KEY_3 = 8 + .const KEY_W = 9 + .const KEY_A = $a + .const KEY_4 = $b + .const KEY_Z = $c + .const KEY_S = $d + .const KEY_E = $e + .const KEY_5 = $10 + .const KEY_R = $11 + .const KEY_D = $12 + .const KEY_6 = $13 + .const KEY_C = $14 + .const KEY_F = $15 + .const KEY_T = $16 + .const KEY_X = $17 + .const KEY_7 = $18 + .const KEY_Y = $19 + .const KEY_G = $1a + .const KEY_8 = $1b + .const KEY_B = $1c + .const KEY_H = $1d + .const KEY_U = $1e + .const KEY_V = $1f + .const KEY_9 = $20 + .const KEY_I = $21 + .const KEY_J = $22 + .const KEY_0 = $23 + .const KEY_M = $24 + .const KEY_K = $25 + .const KEY_O = $26 + .const KEY_N = $27 + .const KEY_PLUS = $28 + .const KEY_L = $2a + .const KEY_MINUS = $2b + .const KEY_DOT = $2c + .const KEY_COLON = $2d + .const KEY_AT = $2e + .const KEY_COMMA = $2f + .const KEY_POUND = $30 + .const KEY_ASTERISK = $31 + .const KEY_SEMICOLON = $32 + .const KEY_EQUALS = $35 + .const KEY_ARROW_UP = $36 + .const KEY_SLASH = $37 + .const KEY_1 = $38 + .const KEY_ARROW_LEFT = $39 + .const KEY_2 = $3b + .const KEY_SPACE = $3c + .const KEY_Q = $3e //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @6 [phi:@begin->@6] -b6_from_bbegin: - jmp b6 -//SEG4 @6 -b6: +//SEG3 [1] phi from @begin to @5 [phi:@begin->@5] +b5_from_bbegin: + jmp b5 +//SEG4 @5 +b5: //SEG5 [2] call main param-assignment [ ] ( ) -//SEG6 [4] phi from @6 to main [phi:@6->main] -main_from_b6: +//SEG6 [4] phi from @5 to main [phi:@5->main] +main_from_b5: jsr main -//SEG7 [3] phi from @6 to @end [phi:@6->@end] -bend_from_b6: +//SEG7 [3] phi from @5 to @end [phi:@5->@end] +bend_from_b5: jmp bend //SEG8 @end bend: //SEG9 main main: { - .label _5 = $c - .label _13 = $12 + .label _5 = $d + .label _16 = $15 .label sc = 2 .label row_pressed_bits = 7 .label col = 8 .label screen = 5 .label row = 4 - .label screen_2 = $d - .label ch = $f - .label i = 9 + .label screen_2 = $e + .label key = $12 + .label ch = 9 + .label i = $a //SEG10 [5] phi from main to main::@1 [phi:main->main::@1] b1_from_main: //SEG11 [5] phi (byte*) main::sc#2 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main->main::@1#0] -- pbuz1=pbuc1 @@ -1818,11 +2384,11 @@ main: { cmp #<$400+$3e8 bcc b1_from_b1 !: - //SEG18 [9] phi from main::@1 to main::@13 [phi:main::@1->main::@13] - b13_from_b1: - jmp b13 - //SEG19 main::@13 - b13: + //SEG18 [9] phi from main::@1 to main::@14 [phi:main::@1->main::@14] + b14_from_b1: + jmp b14 + //SEG19 main::@14 + b14: //SEG20 [10] call keyboard_init param-assignment [ ] ( main:2 [ ] ) jsr keyboard_init jmp b2 @@ -1843,7 +2409,7 @@ main: { bne b5 //SEG27 [14] phi from main::@5 to main::@6 [phi:main::@5->main::@6] b6_from_b5: - //SEG28 [14] phi (byte*) main::screen#12 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main::@5->main::@6#0] -- pbuz1=pbuc1 + //SEG28 [14] phi (byte*) main::screen#13 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main::@5->main::@6#0] -- pbuz1=pbuc1 lda #<$400 sta screen lda #>$400 @@ -1852,36 +2418,36 @@ main: { lda #0 sta row jmp b6 - //SEG30 [14] phi from main::@19 to main::@6 [phi:main::@19->main::@6] - b6_from_b19: - //SEG31 [14] phi (byte*) main::screen#12 = (byte*) main::screen#1 [phi:main::@19->main::@6#0] -- register_copy - //SEG32 [14] phi (byte) main::row#2 = (byte) main::row#1 [phi:main::@19->main::@6#1] -- register_copy + //SEG30 [14] phi from main::@20 to main::@6 [phi:main::@20->main::@6] + b6_from_b20: + //SEG31 [14] phi (byte*) main::screen#13 = (byte*) main::screen#1 [phi:main::@20->main::@6#0] -- register_copy + //SEG32 [14] phi (byte) main::row#2 = (byte) main::row#1 [phi:main::@20->main::@6#1] -- register_copy jmp b6 //SEG33 main::@6 b6: - //SEG34 [15] (byte) keyboard_matrix_read::rowid#0 ← (byte) main::row#2 [ main::row#2 main::screen#12 keyboard_matrix_read::rowid#0 ] ( main:2 [ main::row#2 main::screen#12 keyboard_matrix_read::rowid#0 ] ) -- vbuz1=vbuz2 + //SEG34 [15] (byte) keyboard_matrix_read::rowid#1 ← (byte) main::row#2 [ main::row#2 main::screen#13 keyboard_matrix_read::rowid#1 ] ( main:2 [ main::row#2 main::screen#13 keyboard_matrix_read::rowid#1 ] ) -- vbuz1=vbuz2 lda row sta keyboard_matrix_read.rowid - //SEG35 [16] call keyboard_matrix_read param-assignment [ main::row#2 main::screen#12 keyboard_matrix_read::return#2 ] ( main:2 [ main::row#2 main::screen#12 keyboard_matrix_read::return#2 ] ) + //SEG35 [16] call keyboard_matrix_read param-assignment [ main::row#2 main::screen#13 keyboard_matrix_read::return#0 ] ( main:2 [ main::row#2 main::screen#13 keyboard_matrix_read::return#0 ] ) //SEG36 [58] phi from main::@6 to keyboard_matrix_read [phi:main::@6->keyboard_matrix_read] keyboard_matrix_read_from_b6: - //SEG37 [58] phi (byte) keyboard_matrix_read::rowid#2 = (byte) keyboard_matrix_read::rowid#0 [phi:main::@6->keyboard_matrix_read#0] -- register_copy + //SEG37 [58] phi (byte) keyboard_matrix_read::rowid#2 = (byte) keyboard_matrix_read::rowid#1 [phi:main::@6->keyboard_matrix_read#0] -- register_copy jsr keyboard_matrix_read - //SEG38 [17] (byte) keyboard_matrix_read::return#0 ← (byte) keyboard_matrix_read::return#2 [ main::row#2 main::screen#12 keyboard_matrix_read::return#0 ] ( main:2 [ main::row#2 main::screen#12 keyboard_matrix_read::return#0 ] ) -- vbuz1=vbuz2 - lda keyboard_matrix_read.return_2 - sta keyboard_matrix_read.return - jmp b26 - //SEG39 main::@26 - b26: - //SEG40 [18] (byte) main::row_pressed_bits#0 ← (byte) keyboard_matrix_read::return#0 [ main::row#2 main::screen#12 main::row_pressed_bits#0 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#0 ] ) -- vbuz1=vbuz2 + //SEG38 [17] (byte) keyboard_matrix_read::return#3 ← (byte) keyboard_matrix_read::return#0 [ main::row#2 main::screen#13 keyboard_matrix_read::return#3 ] ( main:2 [ main::row#2 main::screen#13 keyboard_matrix_read::return#3 ] ) -- vbuz1=vbuz2 lda keyboard_matrix_read.return + sta keyboard_matrix_read.return_3 + jmp b28 + //SEG39 main::@28 + b28: + //SEG40 [18] (byte) main::row_pressed_bits#0 ← (byte) keyboard_matrix_read::return#3 [ main::row#2 main::screen#13 main::row_pressed_bits#0 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#0 ] ) -- vbuz1=vbuz2 + lda keyboard_matrix_read.return_3 sta row_pressed_bits - //SEG41 [19] phi from main::@26 to main::@7 [phi:main::@26->main::@7] - b7_from_b26: - //SEG42 [19] phi (byte) main::col#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@26->main::@7#0] -- vbuz1=vbuc1 + //SEG41 [19] phi from main::@28 to main::@7 [phi:main::@28->main::@7] + b7_from_b28: + //SEG42 [19] phi (byte) main::col#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@28->main::@7#0] -- vbuz1=vbuc1 lda #0 sta col - //SEG43 [19] phi (byte) main::row_pressed_bits#2 = (byte) main::row_pressed_bits#0 [phi:main::@26->main::@7#1] -- register_copy + //SEG43 [19] phi (byte) main::row_pressed_bits#2 = (byte) main::row_pressed_bits#0 [phi:main::@28->main::@7#1] -- register_copy jmp b7 //SEG44 [19] phi from main::@9 to main::@7 [phi:main::@9->main::@7] b7_from_b9: @@ -1890,35 +2456,35 @@ main: { jmp b7 //SEG47 main::@7 b7: - //SEG48 [20] (byte~) main::$5 ← (byte) main::row_pressed_bits#2 & (byte/word/signed word/dword/signed dword) 128 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 main::$5 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 main::$5 ] ) -- vbuz1=vbuz2_band_vbuc1 + //SEG48 [20] (byte~) main::$5 ← (byte) main::row_pressed_bits#2 & (byte/word/signed word/dword/signed dword) 128 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 main::$5 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 main::$5 ] ) -- vbuz1=vbuz2_band_vbuc1 lda #$80 and row_pressed_bits sta _5 - //SEG49 [21] if((byte~) main::$5==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@8 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ) -- vbuz1_eq_0_then_la1 + //SEG49 [21] if((byte~) main::$5==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@8 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ) -- vbuz1_eq_0_then_la1 lda _5 beq b8 - jmp b17 - //SEG50 main::@17 - b17: - //SEG51 [22] *((byte*) main::screen#12 + (byte) main::col#2) ← (byte) '1' [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ) -- pbuz1_derefidx_vbuz2=vbuc1 + jmp b18 + //SEG50 main::@18 + b18: + //SEG51 [22] *((byte*) main::screen#13 + (byte) main::col#2) ← (byte) '1' [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ) -- pbuz1_derefidx_vbuz2=vbuc1 lda #'1' ldy col sta (screen),y jmp b9 //SEG52 main::@9 b9: - //SEG53 [23] (byte) main::row_pressed_bits#1 ← (byte) main::row_pressed_bits#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ main::row#2 main::screen#12 main::col#2 main::row_pressed_bits#1 ] ( main:2 [ main::row#2 main::screen#12 main::col#2 main::row_pressed_bits#1 ] ) -- vbuz1=vbuz1_rol_1 + //SEG53 [23] (byte) main::row_pressed_bits#1 ← (byte) main::row_pressed_bits#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ main::row#2 main::screen#13 main::col#2 main::row_pressed_bits#1 ] ( main:2 [ main::row#2 main::screen#13 main::col#2 main::row_pressed_bits#1 ] ) -- vbuz1=vbuz1_rol_1 asl row_pressed_bits - //SEG54 [24] (byte) main::col#1 ← ++ (byte) main::col#2 [ main::row#2 main::screen#12 main::row_pressed_bits#1 main::col#1 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#1 main::col#1 ] ) -- vbuz1=_inc_vbuz1 + //SEG54 [24] (byte) main::col#1 ← ++ (byte) main::col#2 [ main::row#2 main::screen#13 main::row_pressed_bits#1 main::col#1 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#1 main::col#1 ] ) -- vbuz1=_inc_vbuz1 inc col - //SEG55 [25] if((byte) main::col#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@7 [ main::row#2 main::screen#12 main::row_pressed_bits#1 main::col#1 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#1 main::col#1 ] ) -- vbuz1_neq_vbuc1_then_la1 + //SEG55 [25] if((byte) main::col#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@7 [ main::row#2 main::screen#13 main::row_pressed_bits#1 main::col#1 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#1 main::col#1 ] ) -- vbuz1_neq_vbuc1_then_la1 lda col cmp #8 bne b7_from_b9 - jmp b19 - //SEG56 main::@19 - b19: - //SEG57 [26] (byte*) main::screen#1 ← (byte*) main::screen#12 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::row#2 main::screen#1 ] ( main:2 [ main::row#2 main::screen#1 ] ) -- pbuz1=pbuz1_plus_vbuc1 + jmp b20 + //SEG56 main::@20 + b20: + //SEG57 [26] (byte*) main::screen#1 ← (byte*) main::screen#13 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::row#2 main::screen#1 ] ( main:2 [ main::row#2 main::screen#1 ] ) -- pbuz1=pbuz1_plus_vbuc1 lda screen clc adc #$28 @@ -1931,10 +2497,10 @@ main: { //SEG59 [28] if((byte) main::row#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@6 [ main::row#1 main::screen#1 ] ( main:2 [ main::row#1 main::screen#1 ] ) -- vbuz1_neq_vbuc1_then_la1 lda row cmp #8 - bne b6_from_b19 - jmp b20 - //SEG60 main::@20 - b20: + bne b6_from_b20 + jmp b21 + //SEG60 main::@21 + b21: //SEG61 [29] (byte*) main::screen#2 ← (byte*) main::screen#1 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::screen#2 ] ( main:2 [ main::screen#2 ] ) -- pbuz1=pbuz2_plus_vbuc1 lda #$28 clc @@ -1943,307 +2509,298 @@ main: { lda #0 adc screen+1 sta screen_2+1 - //SEG62 [30] phi from main::@20 to main::@10 [phi:main::@20->main::@10] - b10_from_b20: - //SEG63 [30] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@20->main::@10#0] -- vbuz1=vbuc1 + //SEG62 [30] phi from main::@21 to main::@10 [phi:main::@21->main::@10] + b10_from_b21: + //SEG63 [30] phi (byte) main::i#10 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@21->main::@10#0] -- vbuz1=vbuc1 lda #0 sta i - jmp b10 - //SEG64 [30] phi from main::@12 to main::@10 [phi:main::@12->main::@10] - b10_from_b12: - //SEG65 [30] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@12->main::@10#0] -- register_copy - jmp b10 - //SEG66 main::@10 - b10: - //SEG67 [31] (byte) main::ch#0 ← *((const byte[]) main::chars#0 + (byte) main::i#2) [ main::screen#2 main::i#2 main::ch#0 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 ] ) -- vbuz1=pbuc1_derefidx_vbuz2 - ldy i - lda chars,y + //SEG64 [30] phi (byte) main::ch#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@21->main::@10#1] -- vbuz1=vbuc1 + lda #0 sta ch - //SEG68 [32] (byte) keyboard_char_pressed::ch#0 ← (byte) main::ch#0 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 ] ) -- vbuz1=vbuz2 + jmp b10 + //SEG65 [30] phi from main::@11 to main::@10 [phi:main::@11->main::@10] + b10_from_b11: + //SEG66 [30] phi (byte) main::i#10 = (byte) main::i#6 [phi:main::@11->main::@10#0] -- register_copy + //SEG67 [30] phi (byte) main::ch#2 = (byte) main::ch#1 [phi:main::@11->main::@10#1] -- register_copy + jmp b10 + //SEG68 main::@10 + b10: + //SEG69 [31] (byte) keyboard_get_keycode::ch#0 ← (byte) main::ch#2 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::ch#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::ch#0 ] ) -- vbuz1=vbuz2 lda ch - sta keyboard_char_pressed.ch - //SEG69 [33] call keyboard_char_pressed param-assignment [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#1 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#1 ] ) - jsr keyboard_char_pressed - //SEG70 [34] (byte) keyboard_char_pressed::return#0 ← (byte) keyboard_char_pressed::return#1 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#0 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#0 ] ) -- vbuz1=vbuz2 - lda keyboard_char_pressed.return_1 - sta keyboard_char_pressed.return - jmp b27 - //SEG71 main::@27 - b27: - //SEG72 [35] (byte~) main::$13 ← (byte) keyboard_char_pressed::return#0 [ main::screen#2 main::i#2 main::ch#0 main::$13 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 main::$13 ] ) -- vbuz1=vbuz2 - lda keyboard_char_pressed.return - sta _13 - //SEG73 [36] if((byte~) main::$13==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@11 [ main::screen#2 main::i#2 main::ch#0 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 ] ) -- vbuz1_eq_0_then_la1 - lda _13 - beq b11 - jmp b21 - //SEG74 main::@21 - b21: - //SEG75 [37] *((byte*) main::screen#2 + (byte) main::i#2) ← (byte) main::ch#0 [ main::screen#2 main::i#2 ] ( main:2 [ main::screen#2 main::i#2 ] ) -- pbuz1_derefidx_vbuz2=vbuz3 + sta keyboard_get_keycode.ch + //SEG70 [32] call keyboard_get_keycode param-assignment [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#0 ] ) + jsr keyboard_get_keycode + //SEG71 [33] (byte) keyboard_get_keycode::return#2 ← (byte) keyboard_get_keycode::return#0 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#2 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#2 ] ) -- vbuz1=vbuz2 + lda keyboard_get_keycode.return + sta keyboard_get_keycode.return_2 + jmp b29 + //SEG72 main::@29 + b29: + //SEG73 [34] (byte) main::key#0 ← (byte) keyboard_get_keycode::return#2 [ main::screen#2 main::ch#2 main::i#10 main::key#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 main::key#0 ] ) -- vbuz1=vbuz2 + lda keyboard_get_keycode.return_2 + sta key + //SEG74 [35] if((byte) main::key#0==(byte/signed byte/word/signed word/dword/signed dword) 63) goto main::@11 [ main::screen#2 main::ch#2 main::i#10 main::key#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 main::key#0 ] ) -- vbuz1_eq_vbuc1_then_la1 + lda key + cmp #$3f + beq b11_from_b29 + jmp b22 + //SEG75 main::@22 + b22: + //SEG76 [36] (byte) keyboard_key_pressed::key#0 ← (byte) main::key#0 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 ] ) -- vbuz1=vbuz2 + lda key + sta keyboard_key_pressed.key + //SEG77 [37] call keyboard_key_pressed param-assignment [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#0 ] ) + jsr keyboard_key_pressed + //SEG78 [38] (byte) keyboard_key_pressed::return#2 ← (byte) keyboard_key_pressed::return#0 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#2 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#2 ] ) -- vbuz1=vbuz2 + lda keyboard_key_pressed.return + sta keyboard_key_pressed.return_2 + jmp b30 + //SEG79 main::@30 + b30: + //SEG80 [39] (byte~) main::$16 ← (byte) keyboard_key_pressed::return#2 [ main::screen#2 main::ch#2 main::i#10 main::$16 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 main::$16 ] ) -- vbuz1=vbuz2 + lda keyboard_key_pressed.return_2 + sta _16 + //SEG81 [40] if((byte~) main::$16==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@11 [ main::screen#2 main::ch#2 main::i#10 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 ] ) -- vbuz1_eq_0_then_la1 + lda _16 + beq b11_from_b30 + jmp b23 + //SEG82 main::@23 + b23: + //SEG83 [41] *((byte*) main::screen#2 + (byte) main::i#10) ← (byte) main::ch#2 [ main::screen#2 main::ch#2 main::i#10 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 ] ) -- pbuz1_derefidx_vbuz2=vbuz3 lda ch ldy i sta (screen_2),y - jmp b12 - //SEG76 main::@12 - b12: - //SEG77 [38] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::screen#2 main::i#1 ] ( main:2 [ main::screen#2 main::i#1 ] ) -- vbuz1=_inc_vbuz1 + //SEG84 [42] (byte) main::i#1 ← ++ (byte) main::i#10 [ main::screen#2 main::ch#2 main::i#1 ] ( main:2 [ main::screen#2 main::ch#2 main::i#1 ] ) -- vbuz1=_inc_vbuz1 inc i - //SEG78 [39] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 6) goto main::@10 [ main::screen#2 main::i#1 ] ( main:2 [ main::screen#2 main::i#1 ] ) -- vbuz1_neq_vbuc1_then_la1 - lda i - cmp #6 - bne b10_from_b12 - jmp b2 - //SEG79 main::@11 + //SEG85 [43] phi from main::@23 main::@29 main::@30 to main::@11 [phi:main::@23/main::@29/main::@30->main::@11] + b11_from_b23: + b11_from_b29: + b11_from_b30: + //SEG86 [43] phi (byte) main::i#6 = (byte) main::i#1 [phi:main::@23/main::@29/main::@30->main::@11#0] -- register_copy + jmp b11 + //SEG87 main::@11 b11: - //SEG80 [40] *((byte*) main::screen#2 + (byte) main::i#2) ← (byte) ' ' [ main::screen#2 main::i#2 ] ( main:2 [ main::screen#2 main::i#2 ] ) -- pbuz1_derefidx_vbuz2=vbuc1 + //SEG88 [44] (byte) main::ch#1 ← ++ (byte) main::ch#2 [ main::screen#2 main::ch#1 main::i#6 ] ( main:2 [ main::screen#2 main::ch#1 main::i#6 ] ) -- vbuz1=_inc_vbuz1 + inc ch + //SEG89 [45] if((byte) main::ch#1!=(byte/signed byte/word/signed word/dword/signed dword) 64) goto main::@10 [ main::screen#2 main::ch#1 main::i#6 ] ( main:2 [ main::screen#2 main::ch#1 main::i#6 ] ) -- vbuz1_neq_vbuc1_then_la1 + lda ch + cmp #$40 + bne b10_from_b11 + //SEG90 [46] phi from main::@11 main::@13 to main::@13 [phi:main::@11/main::@13->main::@13] + b13_from_b11: + b13_from_b13: + //SEG91 [46] phi (byte) main::i#4 = (byte) main::i#6 [phi:main::@11/main::@13->main::@13#0] -- register_copy + jmp b13 + //SEG92 main::@13 + b13: + //SEG93 [47] *((byte*) main::screen#2 + (byte) main::i#4) ← (byte) ' ' [ main::screen#2 main::i#4 ] ( main:2 [ main::screen#2 main::i#4 ] ) -- pbuz1_derefidx_vbuz2=vbuc1 lda #' ' ldy i sta (screen_2),y - jmp b12 - //SEG81 main::@8 + //SEG94 [48] (byte) main::i#2 ← ++ (byte) main::i#4 [ main::screen#2 main::i#2 ] ( main:2 [ main::screen#2 main::i#2 ] ) -- vbuz1=_inc_vbuz1 + inc i + //SEG95 [49] if((byte) main::i#2<(byte/signed byte/word/signed word/dword/signed dword) 5) goto main::@13 [ main::screen#2 main::i#2 ] ( main:2 [ main::screen#2 main::i#2 ] ) -- vbuz1_lt_vbuc1_then_la1 + lda i + cmp #5 + bcc b13_from_b13 + jmp b2 + //SEG96 main::@8 b8: - //SEG82 [41] *((byte*) main::screen#12 + (byte) main::col#2) ← (byte) '0' [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ) -- pbuz1_derefidx_vbuz2=vbuc1 + //SEG97 [50] *((byte*) main::screen#13 + (byte) main::col#2) ← (byte) '0' [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ) -- pbuz1_derefidx_vbuz2=vbuc1 lda #'0' ldy col sta (screen),y jmp b9 - chars: .byte '@', 'a', 'b', 'c', 'd', 'e' } -//SEG83 keyboard_char_pressed -keyboard_char_pressed: { - .label _1 = $16 - .label _2 = $19 - .label ch = $10 - .label return = $11 - .label return_1 = $1a - //SEG84 [42] (byte) keyboard_matrix_row::ch#0 ← (byte) keyboard_char_pressed::ch#0 [ keyboard_char_pressed::ch#0 keyboard_matrix_row::ch#0 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_row::ch#0 ] ) -- vbuz1=vbuz2 - lda ch - sta keyboard_matrix_row.ch - //SEG85 [43] call keyboard_matrix_row param-assignment [ keyboard_char_pressed::ch#0 keyboard_matrix_row::return#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_row::return#1 ] ) - jsr keyboard_matrix_row - //SEG86 [44] (byte) keyboard_matrix_row::return#0 ← (byte) keyboard_matrix_row::return#1 [ keyboard_char_pressed::ch#0 keyboard_matrix_row::return#0 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_row::return#0 ] ) -- vbuz1=vbuz2 - lda keyboard_matrix_row.return_1 - sta keyboard_matrix_row.return - jmp b2 - //SEG87 keyboard_char_pressed::@2 - b2: - //SEG88 [45] (byte) keyboard_matrix_read::rowid#1 ← (byte) keyboard_matrix_row::return#0 [ keyboard_char_pressed::ch#0 keyboard_matrix_read::rowid#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_read::rowid#1 ] ) -- vbuz1=vbuz2 - lda keyboard_matrix_row.return +//SEG98 keyboard_key_pressed +keyboard_key_pressed: { + .label _1 = $17 + .label _2 = $18 + .label return = $19 + .label key = $13 + .label return_2 = $14 + //SEG99 [51] (byte) keyboard_matrix_read::rowid#0 ← (byte) keyboard_key_pressed::key#0 >> (byte/signed byte/word/signed word/dword/signed dword) 3 [ keyboard_key_pressed::key#0 keyboard_matrix_read::rowid#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_matrix_read::rowid#0 ] ) -- vbuz1=vbuz2_ror_3 + lda key + lsr + lsr + lsr sta keyboard_matrix_read.rowid - //SEG89 [46] call keyboard_matrix_read param-assignment [ keyboard_matrix_read::return#2 keyboard_char_pressed::ch#0 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_matrix_read::return#2 keyboard_char_pressed::ch#0 ] ) - //SEG90 [58] phi from keyboard_char_pressed::@2 to keyboard_matrix_read [phi:keyboard_char_pressed::@2->keyboard_matrix_read] - keyboard_matrix_read_from_b2: - //SEG91 [58] phi (byte) keyboard_matrix_read::rowid#2 = (byte) keyboard_matrix_read::rowid#1 [phi:keyboard_char_pressed::@2->keyboard_matrix_read#0] -- register_copy + //SEG100 [52] call keyboard_matrix_read param-assignment [ keyboard_matrix_read::return#0 keyboard_key_pressed::key#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_matrix_read::return#0 keyboard_key_pressed::key#0 ] ) + //SEG101 [58] phi from keyboard_key_pressed to keyboard_matrix_read [phi:keyboard_key_pressed->keyboard_matrix_read] + keyboard_matrix_read_from_keyboard_key_pressed: + //SEG102 [58] phi (byte) keyboard_matrix_read::rowid#2 = (byte) keyboard_matrix_read::rowid#0 [phi:keyboard_key_pressed->keyboard_matrix_read#0] -- register_copy jsr keyboard_matrix_read - //SEG92 [47] (byte) keyboard_matrix_read::return#1 ← (byte) keyboard_matrix_read::return#2 [ keyboard_char_pressed::ch#0 keyboard_matrix_read::return#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_read::return#1 ] ) -- vbuz1=vbuz2 + //SEG103 [53] (byte) keyboard_matrix_read::return#2 ← (byte) keyboard_matrix_read::return#0 [ keyboard_key_pressed::key#0 keyboard_matrix_read::return#2 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_matrix_read::return#2 ] ) -- vbuz1=vbuz2 + lda keyboard_matrix_read.return + sta keyboard_matrix_read.return_2 + jmp b2 + //SEG104 keyboard_key_pressed::@2 + b2: + //SEG105 [54] (byte~) keyboard_key_pressed::$1 ← (byte) keyboard_matrix_read::return#2 [ keyboard_key_pressed::key#0 keyboard_key_pressed::$1 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_key_pressed::$1 ] ) -- vbuz1=vbuz2 lda keyboard_matrix_read.return_2 - sta keyboard_matrix_read.return_1 - jmp b3 - //SEG93 keyboard_char_pressed::@3 - b3: - //SEG94 [48] (byte~) keyboard_char_pressed::$1 ← (byte) keyboard_matrix_read::return#1 [ keyboard_char_pressed::ch#0 keyboard_char_pressed::$1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_char_pressed::$1 ] ) -- vbuz1=vbuz2 - lda keyboard_matrix_read.return_1 sta _1 - //SEG95 [49] (byte) keyboard_matrix_col::ch#0 ← (byte) keyboard_char_pressed::ch#0 [ keyboard_char_pressed::$1 keyboard_matrix_col::ch#0 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::ch#0 ] ) -- vbuz1=vbuz2 - lda ch - sta keyboard_matrix_col.ch - //SEG96 [50] call keyboard_matrix_col param-assignment [ keyboard_char_pressed::$1 keyboard_matrix_col::return#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::return#1 ] ) - jsr keyboard_matrix_col - //SEG97 [51] (byte) keyboard_matrix_col::return#0 ← (byte) keyboard_matrix_col::return#1 [ keyboard_char_pressed::$1 keyboard_matrix_col::return#0 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::return#0 ] ) -- vbuz1=vbuz2 - lda keyboard_matrix_col.return_1 - sta keyboard_matrix_col.return - jmp b4 - //SEG98 keyboard_char_pressed::@4 - b4: - //SEG99 [52] (byte~) keyboard_char_pressed::$2 ← (byte) keyboard_matrix_col::return#0 [ keyboard_char_pressed::$1 keyboard_char_pressed::$2 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_char_pressed::$2 ] ) -- vbuz1=vbuz2 - lda keyboard_matrix_col.return + //SEG106 [55] (byte~) keyboard_key_pressed::$2 ← (byte) keyboard_key_pressed::key#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ keyboard_key_pressed::$1 keyboard_key_pressed::$2 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::$1 keyboard_key_pressed::$2 ] ) -- vbuz1=vbuz2_band_vbuc1 + lda #7 + and key sta _2 - //SEG100 [53] (byte) keyboard_char_pressed::return#1 ← (byte~) keyboard_char_pressed::$1 & (byte~) keyboard_char_pressed::$2 [ keyboard_char_pressed::return#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#1 ] ) -- vbuz1=vbuz2_band_vbuz3 + //SEG107 [56] (byte) keyboard_key_pressed::return#0 ← (byte~) keyboard_key_pressed::$1 & *((const byte[]) keyboard_matrix_col_bitmask#0 + (byte~) keyboard_key_pressed::$2) [ keyboard_key_pressed::return#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#0 ] ) -- vbuz1=vbuz2_band_pbuc1_derefidx_vbuz3 lda _1 - and _2 - sta return_1 + ldy _2 + and keyboard_matrix_col_bitmask,y + sta return jmp breturn - //SEG101 keyboard_char_pressed::@return + //SEG108 keyboard_key_pressed::@return breturn: - //SEG102 [54] return [ keyboard_char_pressed::return#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#1 ] ) + //SEG109 [57] return [ keyboard_key_pressed::return#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#0 ] ) rts } -//SEG103 keyboard_matrix_col -keyboard_matrix_col: { - .label ch = $17 - .label return = $18 - .label col_id = $1b - .label return_1 = $1c - //SEG104 [55] (byte) keyboard_matrix_col::col_id#0 ← *((const byte[]) keyboard_matrix_chars#0 + (byte) keyboard_matrix_col::ch#0) >> (byte/signed byte/word/signed word/dword/signed dword) 4 [ keyboard_matrix_col::col_id#0 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_col:50 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::col_id#0 ] ) -- vbuz1=pbuc1_derefidx_vbuz2_ror_4 - ldy ch - lda keyboard_matrix_chars,y - lsr - lsr - lsr - lsr - sta col_id - //SEG105 [56] (byte) keyboard_matrix_col::return#1 ← *((const byte[]) keyboard_matrix_col_bitmask#0 + (byte) keyboard_matrix_col::col_id#0) [ keyboard_matrix_col::return#1 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_col:50 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::return#1 ] ) -- vbuz1=pbuc1_derefidx_vbuz2 - ldy col_id - lda keyboard_matrix_col_bitmask,y - sta return_1 - jmp breturn - //SEG106 keyboard_matrix_col::@return - breturn: - //SEG107 [57] return [ keyboard_matrix_col::return#1 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_col:50 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::return#1 ] ) - rts -} -//SEG108 keyboard_matrix_read +//SEG110 keyboard_matrix_read keyboard_matrix_read: { - .label rowid = $a - .label return = $b - .label return_1 = $15 - .label return_2 = $1d - //SEG109 [59] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_row_bits#0 + (byte) keyboard_matrix_read::rowid#2) [ ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#12 ] main:2::keyboard_char_pressed:33::keyboard_matrix_read:46 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 ] ) -- _deref_pbuc1=pbuc2_derefidx_vbuz1 + .label return = $1a + .label rowid = $b + .label return_2 = $16 + .label return_3 = $c + //SEG111 [59] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#2) [ ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#13 ] main:2::keyboard_key_pressed:37::keyboard_matrix_read:52 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 ] ) -- _deref_pbuc1=pbuc2_derefidx_vbuz1 ldy rowid - lda keyboard_row_bits,y + lda keyboard_matrix_row_bitmask,y sta CIA1_PORT_A - //SEG110 [60] (byte) keyboard_matrix_read::return#2 ← ~ *((const byte*) CIA1_PORT_B#0) [ keyboard_matrix_read::return#2 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#12 keyboard_matrix_read::return#2 ] main:2::keyboard_char_pressed:33::keyboard_matrix_read:46 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_read::return#2 ] ) -- vbuz1=_bnot__deref_pbuc1 + //SEG112 [60] (byte) keyboard_matrix_read::return#0 ← ~ *((const byte*) CIA1_PORT_B#0) [ keyboard_matrix_read::return#0 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#13 keyboard_matrix_read::return#0 ] main:2::keyboard_key_pressed:37::keyboard_matrix_read:52 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_matrix_read::return#0 ] ) -- vbuz1=_bnot__deref_pbuc1 lda CIA1_PORT_B eor #$ff - sta return_2 + sta return jmp breturn - //SEG111 keyboard_matrix_read::@return + //SEG113 keyboard_matrix_read::@return breturn: - //SEG112 [61] return [ keyboard_matrix_read::return#2 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#12 keyboard_matrix_read::return#2 ] main:2::keyboard_char_pressed:33::keyboard_matrix_read:46 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_read::return#2 ] ) + //SEG114 [61] return [ keyboard_matrix_read::return#0 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#13 keyboard_matrix_read::return#0 ] main:2::keyboard_key_pressed:37::keyboard_matrix_read:52 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_matrix_read::return#0 ] ) rts } -//SEG113 keyboard_matrix_row -keyboard_matrix_row: { - .label ch = $13 - .label return = $14 - .label return_1 = $1e - //SEG114 [62] (byte) keyboard_matrix_row::return#1 ← *((const byte[]) keyboard_matrix_chars#0 + (byte) keyboard_matrix_row::ch#0) & (byte/signed byte/word/signed word/dword/signed dword) 15 [ keyboard_matrix_row::return#1 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_row:43 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_row::return#1 ] ) -- vbuz1=pbuc1_derefidx_vbuz2_band_vbuc2 +//SEG115 keyboard_get_keycode +keyboard_get_keycode: { + .label return = $1b + .label ch = $10 + .label return_2 = $11 + //SEG116 [62] (byte) keyboard_get_keycode::return#0 ← *((const byte[]) keyboard_char_keycodes#0 + (byte) keyboard_get_keycode::ch#0) [ keyboard_get_keycode::return#0 ] ( main:2::keyboard_get_keycode:32 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#0 ] ) -- vbuz1=pbuc1_derefidx_vbuz2 ldy ch - lda keyboard_matrix_chars,y - and #$f - sta return_1 + lda keyboard_char_keycodes,y + sta return jmp breturn - //SEG115 keyboard_matrix_row::@return + //SEG117 keyboard_get_keycode::@return breturn: - //SEG116 [63] return [ keyboard_matrix_row::return#1 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_row:43 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_row::return#1 ] ) + //SEG118 [63] return [ keyboard_get_keycode::return#0 ] ( main:2::keyboard_get_keycode:32 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#0 ] ) rts } -//SEG117 keyboard_init +//SEG119 keyboard_init keyboard_init: { - //SEG118 [64] *((const byte*) CIA1_PORT_A_DDR#0) ← (byte/word/signed word/dword/signed dword) 255 [ ] ( main:2::keyboard_init:10 [ ] ) -- _deref_pbuc1=vbuc2 + //SEG120 [64] *((const byte*) CIA1_PORT_A_DDR#0) ← (byte/word/signed word/dword/signed dword) 255 [ ] ( main:2::keyboard_init:10 [ ] ) -- _deref_pbuc1=vbuc2 lda #$ff sta CIA1_PORT_A_DDR - //SEG119 [65] *((const byte*) CIA1_PORT_B_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::keyboard_init:10 [ ] ) -- _deref_pbuc1=vbuc2 + //SEG121 [65] *((const byte*) CIA1_PORT_B_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::keyboard_init:10 [ ] ) -- _deref_pbuc1=vbuc2 lda #0 sta CIA1_PORT_B_DDR jmp breturn - //SEG120 keyboard_init::@return + //SEG122 keyboard_init::@return breturn: - //SEG121 [66] return [ ] ( main:2::keyboard_init:10 [ ] ) + //SEG123 [66] return [ ] ( main:2::keyboard_init:10 [ ] ) rts } - keyboard_row_bits: .byte $fe, $fd, $fb, $f7, $ef, $df, $bf, $7f + keyboard_matrix_row_bitmask: .byte $fe, $fd, $fb, $f7, $ef, $df, $bf, $7f keyboard_matrix_col_bitmask: .byte 1, 2, 4, 8, $10, $20, $40, $80 - keyboard_matrix_chars: .byte $65, $21, $43, $42, $22, $61 + keyboard_char_keycodes: .byte KEY_AT, KEY_A, KEY_B, KEY_C, KEY_D, KEY_E, KEY_F, KEY_G, KEY_H, KEY_I, KEY_J, KEY_K, KEY_L, KEY_M, KEY_N, KEY_O, KEY_O, KEY_Q, KEY_R, KEY_S, KEY_T, KEY_U, KEY_V, KEY_W, KEY_X, KEY_Y, KEY_Z, $3f, KEY_POUND, $3f, KEY_ARROW_UP, KEY_ARROW_LEFT, KEY_SPACE, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, KEY_ASTERISK, KEY_PLUS, KEY_COMMA, KEY_MINUS, KEY_DOT, KEY_SLASH, KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_COLON, KEY_SEMICOLON, $3f, KEY_EQUALS, $3f, $3f REGISTER UPLIFT POTENTIAL REGISTERS Statement [6] *((byte*) main::sc#2) ← (byte) ' ' [ main::sc#2 ] ( main:2 [ main::sc#2 ] ) always clobbers reg byte a reg byte y Statement [8] if((byte*) main::sc#1<(word/signed word/dword/signed dword) 1024+(word/signed word/dword/signed dword) 1000) goto main::@1 [ main::sc#1 ] ( main:2 [ main::sc#1 ] ) always clobbers reg byte a Statement [13] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) 255) goto main::@5 [ ] ( main:2 [ ] ) always clobbers reg byte a -Statement [20] (byte~) main::$5 ← (byte) main::row_pressed_bits#2 & (byte/word/signed word/dword/signed dword) 128 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 main::$5 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 main::$5 ] ) always clobbers reg byte a +Statement [20] (byte~) main::$5 ← (byte) main::row_pressed_bits#2 & (byte/word/signed word/dword/signed dword) 128 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 main::$5 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 main::$5 ] ) always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ main::row#2 main::row#1 ] Removing always clobbered register reg byte a as potential for zp ZP_BYTE:7 [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 ] Removing always clobbered register reg byte a as potential for zp ZP_BYTE:8 [ main::col#2 main::col#1 ] -Statement [22] *((byte*) main::screen#12 + (byte) main::col#2) ← (byte) '1' [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ) always clobbers reg byte a -Statement [26] (byte*) main::screen#1 ← (byte*) main::screen#12 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::row#2 main::screen#1 ] ( main:2 [ main::row#2 main::screen#1 ] ) always clobbers reg byte a +Statement [22] *((byte*) main::screen#13 + (byte) main::col#2) ← (byte) '1' [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ) always clobbers reg byte a +Statement [26] (byte*) main::screen#1 ← (byte*) main::screen#13 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::row#2 main::screen#1 ] ( main:2 [ main::row#2 main::screen#1 ] ) always clobbers reg byte a Statement [29] (byte*) main::screen#2 ← (byte*) main::screen#1 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::screen#2 ] ( main:2 [ main::screen#2 ] ) always clobbers reg byte a -Statement [40] *((byte*) main::screen#2 + (byte) main::i#2) ← (byte) ' ' [ main::screen#2 main::i#2 ] ( main:2 [ main::screen#2 main::i#2 ] ) always clobbers reg byte a -Removing always clobbered register reg byte a as potential for zp ZP_BYTE:9 [ main::i#2 main::i#1 ] -Statement [41] *((byte*) main::screen#12 + (byte) main::col#2) ← (byte) '0' [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ) always clobbers reg byte a -Statement [53] (byte) keyboard_char_pressed::return#1 ← (byte~) keyboard_char_pressed::$1 & (byte~) keyboard_char_pressed::$2 [ keyboard_char_pressed::return#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#1 ] ) always clobbers reg byte a -Removing always clobbered register reg byte a as potential for zp ZP_BYTE:15 [ main::ch#0 ] -Statement [55] (byte) keyboard_matrix_col::col_id#0 ← *((const byte[]) keyboard_matrix_chars#0 + (byte) keyboard_matrix_col::ch#0) >> (byte/signed byte/word/signed word/dword/signed dword) 4 [ keyboard_matrix_col::col_id#0 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_col:50 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::col_id#0 ] ) always clobbers reg byte a -Removing always clobbered register reg byte a as potential for zp ZP_BYTE:22 [ keyboard_char_pressed::$1 ] -Statement [59] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_row_bits#0 + (byte) keyboard_matrix_read::rowid#2) [ ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#12 ] main:2::keyboard_char_pressed:33::keyboard_matrix_read:46 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 ] ) always clobbers reg byte a -Removing always clobbered register reg byte a as potential for zp ZP_BYTE:16 [ keyboard_char_pressed::ch#0 ] -Statement [60] (byte) keyboard_matrix_read::return#2 ← ~ *((const byte*) CIA1_PORT_B#0) [ keyboard_matrix_read::return#2 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#12 keyboard_matrix_read::return#2 ] main:2::keyboard_char_pressed:33::keyboard_matrix_read:46 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_read::return#2 ] ) always clobbers reg byte a -Statement [62] (byte) keyboard_matrix_row::return#1 ← *((const byte[]) keyboard_matrix_chars#0 + (byte) keyboard_matrix_row::ch#0) & (byte/signed byte/word/signed word/dword/signed dword) 15 [ keyboard_matrix_row::return#1 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_row:43 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_row::return#1 ] ) always clobbers reg byte a +Statement [47] *((byte*) main::screen#2 + (byte) main::i#4) ← (byte) ' ' [ main::screen#2 main::i#4 ] ( main:2 [ main::screen#2 main::i#4 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:10 [ main::i#4 main::i#10 main::i#6 main::i#1 main::i#2 ] +Statement [50] *((byte*) main::screen#13 + (byte) main::col#2) ← (byte) '0' [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ) always clobbers reg byte a +Statement [55] (byte~) keyboard_key_pressed::$2 ← (byte) keyboard_key_pressed::key#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ keyboard_key_pressed::$1 keyboard_key_pressed::$2 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::$1 keyboard_key_pressed::$2 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:9 [ main::ch#2 main::ch#1 ] +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:23 [ keyboard_key_pressed::$1 ] +Statement [56] (byte) keyboard_key_pressed::return#0 ← (byte~) keyboard_key_pressed::$1 & *((const byte[]) keyboard_matrix_col_bitmask#0 + (byte~) keyboard_key_pressed::$2) [ keyboard_key_pressed::return#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#0 ] ) always clobbers reg byte a +Statement [59] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#2) [ ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#13 ] main:2::keyboard_key_pressed:37::keyboard_matrix_read:52 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:19 [ keyboard_key_pressed::key#0 ] +Statement [60] (byte) keyboard_matrix_read::return#0 ← ~ *((const byte*) CIA1_PORT_B#0) [ keyboard_matrix_read::return#0 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#13 keyboard_matrix_read::return#0 ] main:2::keyboard_key_pressed:37::keyboard_matrix_read:52 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_matrix_read::return#0 ] ) always clobbers reg byte a Statement [64] *((const byte*) CIA1_PORT_A_DDR#0) ← (byte/word/signed word/dword/signed dword) 255 [ ] ( main:2::keyboard_init:10 [ ] ) always clobbers reg byte a Statement [65] *((const byte*) CIA1_PORT_B_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::keyboard_init:10 [ ] ) always clobbers reg byte a Statement [6] *((byte*) main::sc#2) ← (byte) ' ' [ main::sc#2 ] ( main:2 [ main::sc#2 ] ) always clobbers reg byte a reg byte y Statement [8] if((byte*) main::sc#1<(word/signed word/dword/signed dword) 1024+(word/signed word/dword/signed dword) 1000) goto main::@1 [ main::sc#1 ] ( main:2 [ main::sc#1 ] ) always clobbers reg byte a Statement [13] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) 255) goto main::@5 [ ] ( main:2 [ ] ) always clobbers reg byte a -Statement [20] (byte~) main::$5 ← (byte) main::row_pressed_bits#2 & (byte/word/signed word/dword/signed dword) 128 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 main::$5 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 main::$5 ] ) always clobbers reg byte a -Statement [22] *((byte*) main::screen#12 + (byte) main::col#2) ← (byte) '1' [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ) always clobbers reg byte a -Statement [26] (byte*) main::screen#1 ← (byte*) main::screen#12 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::row#2 main::screen#1 ] ( main:2 [ main::row#2 main::screen#1 ] ) always clobbers reg byte a +Statement [20] (byte~) main::$5 ← (byte) main::row_pressed_bits#2 & (byte/word/signed word/dword/signed dword) 128 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 main::$5 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 main::$5 ] ) always clobbers reg byte a +Statement [22] *((byte*) main::screen#13 + (byte) main::col#2) ← (byte) '1' [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ) always clobbers reg byte a +Statement [26] (byte*) main::screen#1 ← (byte*) main::screen#13 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::row#2 main::screen#1 ] ( main:2 [ main::row#2 main::screen#1 ] ) always clobbers reg byte a Statement [29] (byte*) main::screen#2 ← (byte*) main::screen#1 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::screen#2 ] ( main:2 [ main::screen#2 ] ) always clobbers reg byte a -Statement [37] *((byte*) main::screen#2 + (byte) main::i#2) ← (byte) main::ch#0 [ main::screen#2 main::i#2 ] ( main:2 [ main::screen#2 main::i#2 ] ) always clobbers reg byte a -Statement [40] *((byte*) main::screen#2 + (byte) main::i#2) ← (byte) ' ' [ main::screen#2 main::i#2 ] ( main:2 [ main::screen#2 main::i#2 ] ) always clobbers reg byte a -Statement [41] *((byte*) main::screen#12 + (byte) main::col#2) ← (byte) '0' [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ) always clobbers reg byte a -Statement [53] (byte) keyboard_char_pressed::return#1 ← (byte~) keyboard_char_pressed::$1 & (byte~) keyboard_char_pressed::$2 [ keyboard_char_pressed::return#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#1 ] ) always clobbers reg byte a -Statement [55] (byte) keyboard_matrix_col::col_id#0 ← *((const byte[]) keyboard_matrix_chars#0 + (byte) keyboard_matrix_col::ch#0) >> (byte/signed byte/word/signed word/dword/signed dword) 4 [ keyboard_matrix_col::col_id#0 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_col:50 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::col_id#0 ] ) always clobbers reg byte a -Statement [59] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_row_bits#0 + (byte) keyboard_matrix_read::rowid#2) [ ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#12 ] main:2::keyboard_char_pressed:33::keyboard_matrix_read:46 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 ] ) always clobbers reg byte a -Statement [60] (byte) keyboard_matrix_read::return#2 ← ~ *((const byte*) CIA1_PORT_B#0) [ keyboard_matrix_read::return#2 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#12 keyboard_matrix_read::return#2 ] main:2::keyboard_char_pressed:33::keyboard_matrix_read:46 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_read::return#2 ] ) always clobbers reg byte a -Statement [62] (byte) keyboard_matrix_row::return#1 ← *((const byte[]) keyboard_matrix_chars#0 + (byte) keyboard_matrix_row::ch#0) & (byte/signed byte/word/signed word/dword/signed dword) 15 [ keyboard_matrix_row::return#1 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_row:43 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_row::return#1 ] ) always clobbers reg byte a +Statement [41] *((byte*) main::screen#2 + (byte) main::i#10) ← (byte) main::ch#2 [ main::screen#2 main::ch#2 main::i#10 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 ] ) always clobbers reg byte a +Statement [47] *((byte*) main::screen#2 + (byte) main::i#4) ← (byte) ' ' [ main::screen#2 main::i#4 ] ( main:2 [ main::screen#2 main::i#4 ] ) always clobbers reg byte a +Statement [50] *((byte*) main::screen#13 + (byte) main::col#2) ← (byte) '0' [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ) always clobbers reg byte a +Statement [51] (byte) keyboard_matrix_read::rowid#0 ← (byte) keyboard_key_pressed::key#0 >> (byte/signed byte/word/signed word/dword/signed dword) 3 [ keyboard_key_pressed::key#0 keyboard_matrix_read::rowid#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_matrix_read::rowid#0 ] ) always clobbers reg byte a +Statement [55] (byte~) keyboard_key_pressed::$2 ← (byte) keyboard_key_pressed::key#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ keyboard_key_pressed::$1 keyboard_key_pressed::$2 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::$1 keyboard_key_pressed::$2 ] ) always clobbers reg byte a +Statement [56] (byte) keyboard_key_pressed::return#0 ← (byte~) keyboard_key_pressed::$1 & *((const byte[]) keyboard_matrix_col_bitmask#0 + (byte~) keyboard_key_pressed::$2) [ keyboard_key_pressed::return#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#0 ] ) always clobbers reg byte a +Statement [59] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#2) [ ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#13 ] main:2::keyboard_key_pressed:37::keyboard_matrix_read:52 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 ] ) always clobbers reg byte a +Statement [60] (byte) keyboard_matrix_read::return#0 ← ~ *((const byte*) CIA1_PORT_B#0) [ keyboard_matrix_read::return#0 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#13 keyboard_matrix_read::return#0 ] main:2::keyboard_key_pressed:37::keyboard_matrix_read:52 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_matrix_read::return#0 ] ) always clobbers reg byte a Statement [64] *((const byte*) CIA1_PORT_A_DDR#0) ← (byte/word/signed word/dword/signed dword) 255 [ ] ( main:2::keyboard_init:10 [ ] ) always clobbers reg byte a Statement [65] *((const byte*) CIA1_PORT_B_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::keyboard_init:10 [ ] ) always clobbers reg byte a Potential registers zp ZP_WORD:2 [ main::sc#2 main::sc#1 ] : zp ZP_WORD:2 , Potential registers zp ZP_BYTE:4 [ main::row#2 main::row#1 ] : zp ZP_BYTE:4 , reg byte x , reg byte y , -Potential registers zp ZP_WORD:5 [ main::screen#12 main::screen#1 ] : zp ZP_WORD:5 , +Potential registers zp ZP_WORD:5 [ main::screen#13 main::screen#1 ] : zp ZP_WORD:5 , Potential registers zp ZP_BYTE:7 [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 ] : zp ZP_BYTE:7 , reg byte x , reg byte y , Potential registers zp ZP_BYTE:8 [ main::col#2 main::col#1 ] : zp ZP_BYTE:8 , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:9 [ main::i#2 main::i#1 ] : zp ZP_BYTE:9 , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:10 [ keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#1 keyboard_matrix_read::rowid#0 ] : zp ZP_BYTE:10 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:11 [ keyboard_matrix_read::return#0 ] : zp ZP_BYTE:11 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:12 [ main::$5 ] : zp ZP_BYTE:12 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_WORD:13 [ main::screen#2 ] : zp ZP_WORD:13 , -Potential registers zp ZP_BYTE:15 [ main::ch#0 ] : zp ZP_BYTE:15 , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:16 [ keyboard_char_pressed::ch#0 ] : zp ZP_BYTE:16 , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:17 [ keyboard_char_pressed::return#0 ] : zp ZP_BYTE:17 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:18 [ main::$13 ] : zp ZP_BYTE:18 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:19 [ keyboard_matrix_row::ch#0 ] : zp ZP_BYTE:19 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:20 [ keyboard_matrix_row::return#0 ] : zp ZP_BYTE:20 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:21 [ keyboard_matrix_read::return#1 ] : zp ZP_BYTE:21 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:22 [ keyboard_char_pressed::$1 ] : zp ZP_BYTE:22 , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:23 [ keyboard_matrix_col::ch#0 ] : zp ZP_BYTE:23 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:24 [ keyboard_matrix_col::return#0 ] : zp ZP_BYTE:24 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:25 [ keyboard_char_pressed::$2 ] : zp ZP_BYTE:25 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:26 [ keyboard_char_pressed::return#1 ] : zp ZP_BYTE:26 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:27 [ keyboard_matrix_col::col_id#0 ] : zp ZP_BYTE:27 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:28 [ keyboard_matrix_col::return#1 ] : zp ZP_BYTE:28 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:29 [ keyboard_matrix_read::return#2 ] : zp ZP_BYTE:29 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:30 [ keyboard_matrix_row::return#1 ] : zp ZP_BYTE:30 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:9 [ main::ch#2 main::ch#1 ] : zp ZP_BYTE:9 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:10 [ main::i#4 main::i#10 main::i#6 main::i#1 main::i#2 ] : zp ZP_BYTE:10 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:11 [ keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#0 keyboard_matrix_read::rowid#1 ] : zp ZP_BYTE:11 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:12 [ keyboard_matrix_read::return#3 ] : zp ZP_BYTE:12 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:13 [ main::$5 ] : zp ZP_BYTE:13 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_WORD:14 [ main::screen#2 ] : zp ZP_WORD:14 , +Potential registers zp ZP_BYTE:16 [ keyboard_get_keycode::ch#0 ] : zp ZP_BYTE:16 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:17 [ keyboard_get_keycode::return#2 ] : zp ZP_BYTE:17 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:18 [ main::key#0 ] : zp ZP_BYTE:18 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:19 [ keyboard_key_pressed::key#0 ] : zp ZP_BYTE:19 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:20 [ keyboard_key_pressed::return#2 ] : zp ZP_BYTE:20 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:21 [ main::$16 ] : zp ZP_BYTE:21 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:22 [ keyboard_matrix_read::return#2 ] : zp ZP_BYTE:22 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:23 [ keyboard_key_pressed::$1 ] : zp ZP_BYTE:23 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:24 [ keyboard_key_pressed::$2 ] : zp ZP_BYTE:24 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:25 [ keyboard_key_pressed::return#0 ] : zp ZP_BYTE:25 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:26 [ keyboard_matrix_read::return#0 ] : zp ZP_BYTE:26 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:27 [ keyboard_get_keycode::return#0 ] : zp ZP_BYTE:27 , reg byte a , reg byte x , reg byte y , REGISTER UPLIFT SCOPES -Uplift Scope [main] 2,168.83: zp ZP_BYTE:8 [ main::col#2 main::col#1 ] 2,002: zp ZP_BYTE:12 [ main::$5 ] 1,490.13: zp ZP_BYTE:7 [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 ] 240.54: zp ZP_WORD:5 [ main::screen#12 main::screen#1 ] 207.61: zp ZP_BYTE:9 [ main::i#2 main::i#1 ] 202: zp ZP_BYTE:18 [ main::$13 ] 173.14: zp ZP_BYTE:4 [ main::row#2 main::row#1 ] 50.5: zp ZP_BYTE:15 [ main::ch#0 ] 33: zp ZP_WORD:2 [ main::sc#2 main::sc#1 ] 17.75: zp ZP_WORD:13 [ main::screen#2 ] -Uplift Scope [keyboard_matrix_read] 311: zp ZP_BYTE:10 [ keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#1 keyboard_matrix_read::rowid#0 ] 202: zp ZP_BYTE:11 [ keyboard_matrix_read::return#0 ] 26.25: zp ZP_BYTE:29 [ keyboard_matrix_read::return#2 ] 4: zp ZP_BYTE:21 [ keyboard_matrix_read::return#1 ] -Uplift Scope [keyboard_char_pressed] 202: zp ZP_BYTE:17 [ keyboard_char_pressed::return#0 ] 34.33: zp ZP_BYTE:26 [ keyboard_char_pressed::return#1 ] 13.12: zp ZP_BYTE:16 [ keyboard_char_pressed::ch#0 ] 4: zp ZP_BYTE:25 [ keyboard_char_pressed::$2 ] 0.8: zp ZP_BYTE:22 [ keyboard_char_pressed::$1 ] -Uplift Scope [keyboard_matrix_col] 4: zp ZP_BYTE:23 [ keyboard_matrix_col::ch#0 ] 4: zp ZP_BYTE:24 [ keyboard_matrix_col::return#0 ] 4: zp ZP_BYTE:27 [ keyboard_matrix_col::col_id#0 ] 1.33: zp ZP_BYTE:28 [ keyboard_matrix_col::return#1 ] -Uplift Scope [keyboard_matrix_row] 4: zp ZP_BYTE:19 [ keyboard_matrix_row::ch#0 ] 4: zp ZP_BYTE:20 [ keyboard_matrix_row::return#0 ] 1.33: zp ZP_BYTE:30 [ keyboard_matrix_row::return#1 ] +Uplift Scope [main] 2,168.83: zp ZP_BYTE:8 [ main::col#2 main::col#1 ] 2,002: zp ZP_BYTE:13 [ main::$5 ] 1,490.13: zp ZP_BYTE:7 [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 ] 765.92: zp ZP_BYTE:10 [ main::i#4 main::i#10 main::i#6 main::i#1 main::i#2 ] 240.54: zp ZP_WORD:5 [ main::screen#13 main::screen#1 ] 202: zp ZP_BYTE:21 [ main::$16 ] 180.36: zp ZP_BYTE:9 [ main::ch#2 main::ch#1 ] 173.14: zp ZP_BYTE:4 [ main::row#2 main::row#1 ] 151.5: zp ZP_BYTE:18 [ main::key#0 ] 33: zp ZP_WORD:2 [ main::sc#2 main::sc#1 ] 10.14: zp ZP_WORD:14 [ main::screen#2 ] +Uplift Scope [keyboard_matrix_read] 311: zp ZP_BYTE:11 [ keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#0 keyboard_matrix_read::rowid#1 ] 202: zp ZP_BYTE:12 [ keyboard_matrix_read::return#3 ] 26.25: zp ZP_BYTE:26 [ keyboard_matrix_read::return#0 ] 4: zp ZP_BYTE:22 [ keyboard_matrix_read::return#2 ] +Uplift Scope [keyboard_get_keycode] 202: zp ZP_BYTE:17 [ keyboard_get_keycode::return#2 ] 103: zp ZP_BYTE:16 [ keyboard_get_keycode::ch#0 ] 34.33: zp ZP_BYTE:27 [ keyboard_get_keycode::return#0 ] +Uplift Scope [keyboard_key_pressed] 202: zp ZP_BYTE:20 [ keyboard_key_pressed::return#2 ] 34.33: zp ZP_BYTE:25 [ keyboard_key_pressed::return#0 ] 21: zp ZP_BYTE:19 [ keyboard_key_pressed::key#0 ] 4: zp ZP_BYTE:24 [ keyboard_key_pressed::$2 ] 2: zp ZP_BYTE:23 [ keyboard_key_pressed::$1 ] Uplift Scope [keyboard_init] Uplift Scope [] -Uplifting [main] best 73937 combination reg byte y [ main::col#2 main::col#1 ] reg byte a [ main::$5 ] zp ZP_BYTE:7 [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 ] zp ZP_WORD:5 [ main::screen#12 main::screen#1 ] reg byte x [ main::i#2 main::i#1 ] reg byte a [ main::$13 ] reg byte x [ main::row#2 main::row#1 ] zp ZP_BYTE:15 [ main::ch#0 ] zp ZP_WORD:2 [ main::sc#2 main::sc#1 ] zp ZP_WORD:13 [ main::screen#2 ] -Uplifting [keyboard_matrix_read] best 72921 combination reg byte a [ keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#1 keyboard_matrix_read::rowid#0 ] reg byte a [ keyboard_matrix_read::return#0 ] reg byte a [ keyboard_matrix_read::return#2 ] reg byte a [ keyboard_matrix_read::return#1 ] -Uplifting [keyboard_char_pressed] best 72012 combination reg byte a [ keyboard_char_pressed::return#0 ] reg byte a [ keyboard_char_pressed::return#1 ] zp ZP_BYTE:16 [ keyboard_char_pressed::ch#0 ] reg byte a [ keyboard_char_pressed::$2 ] zp ZP_BYTE:22 [ keyboard_char_pressed::$1 ] -Uplifting [keyboard_matrix_col] best 71990 combination reg byte y [ keyboard_matrix_col::ch#0 ] reg byte a [ keyboard_matrix_col::return#0 ] reg byte a [ keyboard_matrix_col::col_id#0 ] reg byte a [ keyboard_matrix_col::return#1 ] -Uplifting [keyboard_matrix_row] best 71972 combination reg byte y [ keyboard_matrix_row::ch#0 ] reg byte a [ keyboard_matrix_row::return#0 ] reg byte a [ keyboard_matrix_row::return#1 ] -Uplifting [keyboard_init] best 71972 combination -Uplifting [] best 71972 combination +Uplift attempts [main] 10000/15552 (limiting to 10000) +Uplifting [main] best 77618 combination reg byte y [ main::col#2 main::col#1 ] reg byte a [ main::$5 ] zp ZP_BYTE:7 [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 ] zp ZP_BYTE:10 [ main::i#4 main::i#10 main::i#6 main::i#1 main::i#2 ] zp ZP_WORD:5 [ main::screen#13 main::screen#1 ] reg byte a [ main::$16 ] reg byte x [ main::ch#2 main::ch#1 ] reg byte x [ main::row#2 main::row#1 ] reg byte a [ main::key#0 ] zp ZP_WORD:2 [ main::sc#2 main::sc#1 ] zp ZP_WORD:14 [ main::screen#2 ] +Limited combination testing to 10000 combinations of 15552 possible. +Uplifting [keyboard_matrix_read] best 76602 combination reg byte a [ keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#0 keyboard_matrix_read::rowid#1 ] reg byte a [ keyboard_matrix_read::return#3 ] reg byte a [ keyboard_matrix_read::return#0 ] reg byte a [ keyboard_matrix_read::return#2 ] +Uplifting [keyboard_get_keycode] best 75396 combination reg byte a [ keyboard_get_keycode::return#2 ] reg byte x [ keyboard_get_keycode::ch#0 ] reg byte a [ keyboard_get_keycode::return#0 ] +Uplifting [keyboard_key_pressed] best 74489 combination reg byte a [ keyboard_key_pressed::return#2 ] reg byte a [ keyboard_key_pressed::return#0 ] zp ZP_BYTE:19 [ keyboard_key_pressed::key#0 ] reg byte a [ keyboard_key_pressed::$2 ] zp ZP_BYTE:23 [ keyboard_key_pressed::$1 ] +Uplifting [keyboard_init] best 74489 combination +Uplifting [] best 74489 combination Attempting to uplift remaining variables inzp ZP_BYTE:7 [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 ] -Uplifting [main] best 71972 combination zp ZP_BYTE:7 [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 ] -Attempting to uplift remaining variables inzp ZP_BYTE:15 [ main::ch#0 ] -Uplifting [main] best 71972 combination zp ZP_BYTE:15 [ main::ch#0 ] -Attempting to uplift remaining variables inzp ZP_BYTE:16 [ keyboard_char_pressed::ch#0 ] -Uplifting [keyboard_char_pressed] best 71972 combination zp ZP_BYTE:16 [ keyboard_char_pressed::ch#0 ] -Attempting to uplift remaining variables inzp ZP_BYTE:22 [ keyboard_char_pressed::$1 ] -Uplifting [keyboard_char_pressed] best 71972 combination zp ZP_BYTE:22 [ keyboard_char_pressed::$1 ] -Coalescing zero page register with common assignment [ zp ZP_WORD:5 [ main::screen#12 main::screen#1 ] ] with [ zp ZP_WORD:13 [ main::screen#2 ] ] - score: 1 -Coalescing zero page register with common assignment [ zp ZP_BYTE:15 [ main::ch#0 ] ] with [ zp ZP_BYTE:16 [ keyboard_char_pressed::ch#0 ] ] - score: 1 -Coalescing zero page register [ zp ZP_WORD:2 [ main::sc#2 main::sc#1 ] ] with [ zp ZP_WORD:5 [ main::screen#12 main::screen#1 main::screen#2 ] ] -Coalescing zero page register [ zp ZP_BYTE:7 [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 ] ] with [ zp ZP_BYTE:15 [ main::ch#0 keyboard_char_pressed::ch#0 ] ] -Allocated (was zp ZP_BYTE:7) zp ZP_BYTE:4 [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 main::ch#0 keyboard_char_pressed::ch#0 ] -Allocated (was zp ZP_BYTE:22) zp ZP_BYTE:5 [ keyboard_char_pressed::$1 ] +Uplifting [main] best 74489 combination zp ZP_BYTE:7 [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:10 [ main::i#4 main::i#10 main::i#6 main::i#1 main::i#2 ] +Uplifting [main] best 74489 combination zp ZP_BYTE:10 [ main::i#4 main::i#10 main::i#6 main::i#1 main::i#2 ] +Attempting to uplift remaining variables inzp ZP_BYTE:19 [ keyboard_key_pressed::key#0 ] +Uplifting [keyboard_key_pressed] best 74489 combination zp ZP_BYTE:19 [ keyboard_key_pressed::key#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:23 [ keyboard_key_pressed::$1 ] +Uplifting [keyboard_key_pressed] best 74489 combination zp ZP_BYTE:23 [ keyboard_key_pressed::$1 ] +Coalescing zero page register with common assignment [ zp ZP_WORD:5 [ main::screen#13 main::screen#1 ] ] with [ zp ZP_WORD:14 [ main::screen#2 ] ] - score: 1 +Coalescing zero page register [ zp ZP_WORD:2 [ main::sc#2 main::sc#1 ] ] with [ zp ZP_WORD:5 [ main::screen#13 main::screen#1 main::screen#2 ] ] +Coalescing zero page register [ zp ZP_BYTE:7 [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 ] ] with [ zp ZP_BYTE:10 [ main::i#4 main::i#10 main::i#6 main::i#1 main::i#2 ] ] +Allocated (was zp ZP_BYTE:7) zp ZP_BYTE:4 [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 main::i#4 main::i#10 main::i#6 main::i#1 main::i#2 ] +Allocated (was zp ZP_BYTE:19) zp ZP_BYTE:5 [ keyboard_key_pressed::key#0 ] +Allocated (was zp ZP_BYTE:23) zp ZP_BYTE:6 [ keyboard_key_pressed::$1 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart @@ -2256,19 +2813,68 @@ ASSEMBLER BEFORE OPTIMIZATION .label CIA1_PORT_B = $dc01 .label CIA1_PORT_A_DDR = $dc02 .label CIA1_PORT_B_DDR = $dc03 + .const KEY_3 = 8 + .const KEY_W = 9 + .const KEY_A = $a + .const KEY_4 = $b + .const KEY_Z = $c + .const KEY_S = $d + .const KEY_E = $e + .const KEY_5 = $10 + .const KEY_R = $11 + .const KEY_D = $12 + .const KEY_6 = $13 + .const KEY_C = $14 + .const KEY_F = $15 + .const KEY_T = $16 + .const KEY_X = $17 + .const KEY_7 = $18 + .const KEY_Y = $19 + .const KEY_G = $1a + .const KEY_8 = $1b + .const KEY_B = $1c + .const KEY_H = $1d + .const KEY_U = $1e + .const KEY_V = $1f + .const KEY_9 = $20 + .const KEY_I = $21 + .const KEY_J = $22 + .const KEY_0 = $23 + .const KEY_M = $24 + .const KEY_K = $25 + .const KEY_O = $26 + .const KEY_N = $27 + .const KEY_PLUS = $28 + .const KEY_L = $2a + .const KEY_MINUS = $2b + .const KEY_DOT = $2c + .const KEY_COLON = $2d + .const KEY_AT = $2e + .const KEY_COMMA = $2f + .const KEY_POUND = $30 + .const KEY_ASTERISK = $31 + .const KEY_SEMICOLON = $32 + .const KEY_EQUALS = $35 + .const KEY_ARROW_UP = $36 + .const KEY_SLASH = $37 + .const KEY_1 = $38 + .const KEY_ARROW_LEFT = $39 + .const KEY_2 = $3b + .const KEY_SPACE = $3c + .const KEY_Q = $3e //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @6 [phi:@begin->@6] -b6_from_bbegin: - jmp b6 -//SEG4 @6 -b6: +//SEG3 [1] phi from @begin to @5 [phi:@begin->@5] +b5_from_bbegin: + jmp b5 +//SEG4 @5 +b5: //SEG5 [2] call main param-assignment [ ] ( ) -//SEG6 [4] phi from @6 to main [phi:@6->main] -main_from_b6: +//SEG6 [4] phi from @5 to main [phi:@5->main] +main_from_b5: jsr main -//SEG7 [3] phi from @6 to @end [phi:@6->@end] -bend_from_b6: +//SEG7 [3] phi from @5 to @end [phi:@5->@end] +bend_from_b5: jmp bend //SEG8 @end bend: @@ -2277,7 +2883,7 @@ main: { .label sc = 2 .label row_pressed_bits = 4 .label screen = 2 - .label ch = 4 + .label i = 4 //SEG10 [5] phi from main to main::@1 [phi:main->main::@1] b1_from_main: //SEG11 [5] phi (byte*) main::sc#2 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main->main::@1#0] -- pbuz1=pbuc1 @@ -2310,11 +2916,11 @@ main: { cmp #<$400+$3e8 bcc b1_from_b1 !: - //SEG18 [9] phi from main::@1 to main::@13 [phi:main::@1->main::@13] - b13_from_b1: - jmp b13 - //SEG19 main::@13 - b13: + //SEG18 [9] phi from main::@1 to main::@14 [phi:main::@1->main::@14] + b14_from_b1: + jmp b14 + //SEG19 main::@14 + b14: //SEG20 [10] call keyboard_init param-assignment [ ] ( main:2 [ ] ) jsr keyboard_init jmp b2 @@ -2335,7 +2941,7 @@ main: { bne b5 //SEG27 [14] phi from main::@5 to main::@6 [phi:main::@5->main::@6] b6_from_b5: - //SEG28 [14] phi (byte*) main::screen#12 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main::@5->main::@6#0] -- pbuz1=pbuc1 + //SEG28 [14] phi (byte*) main::screen#13 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main::@5->main::@6#0] -- pbuz1=pbuc1 lda #<$400 sta screen lda #>$400 @@ -2343,32 +2949,32 @@ main: { //SEG29 [14] phi (byte) main::row#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@5->main::@6#1] -- vbuxx=vbuc1 ldx #0 jmp b6 - //SEG30 [14] phi from main::@19 to main::@6 [phi:main::@19->main::@6] - b6_from_b19: - //SEG31 [14] phi (byte*) main::screen#12 = (byte*) main::screen#1 [phi:main::@19->main::@6#0] -- register_copy - //SEG32 [14] phi (byte) main::row#2 = (byte) main::row#1 [phi:main::@19->main::@6#1] -- register_copy + //SEG30 [14] phi from main::@20 to main::@6 [phi:main::@20->main::@6] + b6_from_b20: + //SEG31 [14] phi (byte*) main::screen#13 = (byte*) main::screen#1 [phi:main::@20->main::@6#0] -- register_copy + //SEG32 [14] phi (byte) main::row#2 = (byte) main::row#1 [phi:main::@20->main::@6#1] -- register_copy jmp b6 //SEG33 main::@6 b6: - //SEG34 [15] (byte) keyboard_matrix_read::rowid#0 ← (byte) main::row#2 [ main::row#2 main::screen#12 keyboard_matrix_read::rowid#0 ] ( main:2 [ main::row#2 main::screen#12 keyboard_matrix_read::rowid#0 ] ) -- vbuaa=vbuxx + //SEG34 [15] (byte) keyboard_matrix_read::rowid#1 ← (byte) main::row#2 [ main::row#2 main::screen#13 keyboard_matrix_read::rowid#1 ] ( main:2 [ main::row#2 main::screen#13 keyboard_matrix_read::rowid#1 ] ) -- vbuaa=vbuxx txa - //SEG35 [16] call keyboard_matrix_read param-assignment [ main::row#2 main::screen#12 keyboard_matrix_read::return#2 ] ( main:2 [ main::row#2 main::screen#12 keyboard_matrix_read::return#2 ] ) + //SEG35 [16] call keyboard_matrix_read param-assignment [ main::row#2 main::screen#13 keyboard_matrix_read::return#0 ] ( main:2 [ main::row#2 main::screen#13 keyboard_matrix_read::return#0 ] ) //SEG36 [58] phi from main::@6 to keyboard_matrix_read [phi:main::@6->keyboard_matrix_read] keyboard_matrix_read_from_b6: - //SEG37 [58] phi (byte) keyboard_matrix_read::rowid#2 = (byte) keyboard_matrix_read::rowid#0 [phi:main::@6->keyboard_matrix_read#0] -- register_copy + //SEG37 [58] phi (byte) keyboard_matrix_read::rowid#2 = (byte) keyboard_matrix_read::rowid#1 [phi:main::@6->keyboard_matrix_read#0] -- register_copy jsr keyboard_matrix_read - //SEG38 [17] (byte) keyboard_matrix_read::return#0 ← (byte) keyboard_matrix_read::return#2 [ main::row#2 main::screen#12 keyboard_matrix_read::return#0 ] ( main:2 [ main::row#2 main::screen#12 keyboard_matrix_read::return#0 ] ) - // (byte) keyboard_matrix_read::return#0 = (byte) keyboard_matrix_read::return#2 // register copy reg byte a - jmp b26 - //SEG39 main::@26 - b26: - //SEG40 [18] (byte) main::row_pressed_bits#0 ← (byte) keyboard_matrix_read::return#0 [ main::row#2 main::screen#12 main::row_pressed_bits#0 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#0 ] ) -- vbuz1=vbuaa + //SEG38 [17] (byte) keyboard_matrix_read::return#3 ← (byte) keyboard_matrix_read::return#0 [ main::row#2 main::screen#13 keyboard_matrix_read::return#3 ] ( main:2 [ main::row#2 main::screen#13 keyboard_matrix_read::return#3 ] ) + // (byte) keyboard_matrix_read::return#3 = (byte) keyboard_matrix_read::return#0 // register copy reg byte a + jmp b28 + //SEG39 main::@28 + b28: + //SEG40 [18] (byte) main::row_pressed_bits#0 ← (byte) keyboard_matrix_read::return#3 [ main::row#2 main::screen#13 main::row_pressed_bits#0 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#0 ] ) -- vbuz1=vbuaa sta row_pressed_bits - //SEG41 [19] phi from main::@26 to main::@7 [phi:main::@26->main::@7] - b7_from_b26: - //SEG42 [19] phi (byte) main::col#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@26->main::@7#0] -- vbuyy=vbuc1 + //SEG41 [19] phi from main::@28 to main::@7 [phi:main::@28->main::@7] + b7_from_b28: + //SEG42 [19] phi (byte) main::col#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@28->main::@7#0] -- vbuyy=vbuc1 ldy #0 - //SEG43 [19] phi (byte) main::row_pressed_bits#2 = (byte) main::row_pressed_bits#0 [phi:main::@26->main::@7#1] -- register_copy + //SEG43 [19] phi (byte) main::row_pressed_bits#2 = (byte) main::row_pressed_bits#0 [phi:main::@28->main::@7#1] -- register_copy jmp b7 //SEG44 [19] phi from main::@9 to main::@7 [phi:main::@9->main::@7] b7_from_b9: @@ -2377,32 +2983,32 @@ main: { jmp b7 //SEG47 main::@7 b7: - //SEG48 [20] (byte~) main::$5 ← (byte) main::row_pressed_bits#2 & (byte/word/signed word/dword/signed dword) 128 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 main::$5 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 main::$5 ] ) -- vbuaa=vbuz1_band_vbuc1 + //SEG48 [20] (byte~) main::$5 ← (byte) main::row_pressed_bits#2 & (byte/word/signed word/dword/signed dword) 128 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 main::$5 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 main::$5 ] ) -- vbuaa=vbuz1_band_vbuc1 lda #$80 and row_pressed_bits - //SEG49 [21] if((byte~) main::$5==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@8 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ) -- vbuaa_eq_0_then_la1 + //SEG49 [21] if((byte~) main::$5==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@8 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ) -- vbuaa_eq_0_then_la1 cmp #0 beq b8 - jmp b17 - //SEG50 main::@17 - b17: - //SEG51 [22] *((byte*) main::screen#12 + (byte) main::col#2) ← (byte) '1' [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ) -- pbuz1_derefidx_vbuyy=vbuc1 + jmp b18 + //SEG50 main::@18 + b18: + //SEG51 [22] *((byte*) main::screen#13 + (byte) main::col#2) ← (byte) '1' [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ) -- pbuz1_derefidx_vbuyy=vbuc1 lda #'1' sta (screen),y jmp b9 //SEG52 main::@9 b9: - //SEG53 [23] (byte) main::row_pressed_bits#1 ← (byte) main::row_pressed_bits#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ main::row#2 main::screen#12 main::col#2 main::row_pressed_bits#1 ] ( main:2 [ main::row#2 main::screen#12 main::col#2 main::row_pressed_bits#1 ] ) -- vbuz1=vbuz1_rol_1 + //SEG53 [23] (byte) main::row_pressed_bits#1 ← (byte) main::row_pressed_bits#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ main::row#2 main::screen#13 main::col#2 main::row_pressed_bits#1 ] ( main:2 [ main::row#2 main::screen#13 main::col#2 main::row_pressed_bits#1 ] ) -- vbuz1=vbuz1_rol_1 asl row_pressed_bits - //SEG54 [24] (byte) main::col#1 ← ++ (byte) main::col#2 [ main::row#2 main::screen#12 main::row_pressed_bits#1 main::col#1 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#1 main::col#1 ] ) -- vbuyy=_inc_vbuyy + //SEG54 [24] (byte) main::col#1 ← ++ (byte) main::col#2 [ main::row#2 main::screen#13 main::row_pressed_bits#1 main::col#1 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#1 main::col#1 ] ) -- vbuyy=_inc_vbuyy iny - //SEG55 [25] if((byte) main::col#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@7 [ main::row#2 main::screen#12 main::row_pressed_bits#1 main::col#1 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#1 main::col#1 ] ) -- vbuyy_neq_vbuc1_then_la1 + //SEG55 [25] if((byte) main::col#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@7 [ main::row#2 main::screen#13 main::row_pressed_bits#1 main::col#1 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#1 main::col#1 ] ) -- vbuyy_neq_vbuc1_then_la1 cpy #8 bne b7_from_b9 - jmp b19 - //SEG56 main::@19 - b19: - //SEG57 [26] (byte*) main::screen#1 ← (byte*) main::screen#12 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::row#2 main::screen#1 ] ( main:2 [ main::row#2 main::screen#1 ] ) -- pbuz1=pbuz1_plus_vbuc1 + jmp b20 + //SEG56 main::@20 + b20: + //SEG57 [26] (byte*) main::screen#1 ← (byte*) main::screen#13 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::row#2 main::screen#1 ] ( main:2 [ main::row#2 main::screen#1 ] ) -- pbuz1=pbuz1_plus_vbuc1 lda screen clc adc #$28 @@ -2414,10 +3020,10 @@ main: { inx //SEG59 [28] if((byte) main::row#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@6 [ main::row#1 main::screen#1 ] ( main:2 [ main::row#1 main::screen#1 ] ) -- vbuxx_neq_vbuc1_then_la1 cpx #8 - bne b6_from_b19 - jmp b20 - //SEG60 main::@20 - b20: + bne b6_from_b20 + jmp b21 + //SEG60 main::@21 + b21: //SEG61 [29] (byte*) main::screen#2 ← (byte*) main::screen#1 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::screen#2 ] ( main:2 [ main::screen#2 ] ) -- pbuz1=pbuz1_plus_vbuc1 lda screen clc @@ -2426,236 +3032,246 @@ main: { bcc !+ inc screen+1 !: - //SEG62 [30] phi from main::@20 to main::@10 [phi:main::@20->main::@10] - b10_from_b20: - //SEG63 [30] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@20->main::@10#0] -- vbuxx=vbuc1 + //SEG62 [30] phi from main::@21 to main::@10 [phi:main::@21->main::@10] + b10_from_b21: + //SEG63 [30] phi (byte) main::i#10 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@21->main::@10#0] -- vbuz1=vbuc1 + lda #0 + sta i + //SEG64 [30] phi (byte) main::ch#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@21->main::@10#1] -- vbuxx=vbuc1 ldx #0 jmp b10 - //SEG64 [30] phi from main::@12 to main::@10 [phi:main::@12->main::@10] - b10_from_b12: - //SEG65 [30] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@12->main::@10#0] -- register_copy + //SEG65 [30] phi from main::@11 to main::@10 [phi:main::@11->main::@10] + b10_from_b11: + //SEG66 [30] phi (byte) main::i#10 = (byte) main::i#6 [phi:main::@11->main::@10#0] -- register_copy + //SEG67 [30] phi (byte) main::ch#2 = (byte) main::ch#1 [phi:main::@11->main::@10#1] -- register_copy jmp b10 - //SEG66 main::@10 + //SEG68 main::@10 b10: - //SEG67 [31] (byte) main::ch#0 ← *((const byte[]) main::chars#0 + (byte) main::i#2) [ main::screen#2 main::i#2 main::ch#0 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 ] ) -- vbuz1=pbuc1_derefidx_vbuxx - lda chars,x - sta ch - //SEG68 [32] (byte) keyboard_char_pressed::ch#0 ← (byte) main::ch#0 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 ] ) - // (byte) keyboard_char_pressed::ch#0 = (byte) main::ch#0 // register copy zp ZP_BYTE:4 - //SEG69 [33] call keyboard_char_pressed param-assignment [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#1 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#1 ] ) - jsr keyboard_char_pressed - //SEG70 [34] (byte) keyboard_char_pressed::return#0 ← (byte) keyboard_char_pressed::return#1 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#0 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#0 ] ) - // (byte) keyboard_char_pressed::return#0 = (byte) keyboard_char_pressed::return#1 // register copy reg byte a - jmp b27 - //SEG71 main::@27 - b27: - //SEG72 [35] (byte~) main::$13 ← (byte) keyboard_char_pressed::return#0 [ main::screen#2 main::i#2 main::ch#0 main::$13 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 main::$13 ] ) - // (byte~) main::$13 = (byte) keyboard_char_pressed::return#0 // register copy reg byte a - //SEG73 [36] if((byte~) main::$13==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@11 [ main::screen#2 main::i#2 main::ch#0 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 ] ) -- vbuaa_eq_0_then_la1 + //SEG69 [31] (byte) keyboard_get_keycode::ch#0 ← (byte) main::ch#2 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::ch#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::ch#0 ] ) + // (byte) keyboard_get_keycode::ch#0 = (byte) main::ch#2 // register copy reg byte x + //SEG70 [32] call keyboard_get_keycode param-assignment [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#0 ] ) + jsr keyboard_get_keycode + //SEG71 [33] (byte) keyboard_get_keycode::return#2 ← (byte) keyboard_get_keycode::return#0 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#2 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#2 ] ) + // (byte) keyboard_get_keycode::return#2 = (byte) keyboard_get_keycode::return#0 // register copy reg byte a + jmp b29 + //SEG72 main::@29 + b29: + //SEG73 [34] (byte) main::key#0 ← (byte) keyboard_get_keycode::return#2 [ main::screen#2 main::ch#2 main::i#10 main::key#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 main::key#0 ] ) + // (byte) main::key#0 = (byte) keyboard_get_keycode::return#2 // register copy reg byte a + //SEG74 [35] if((byte) main::key#0==(byte/signed byte/word/signed word/dword/signed dword) 63) goto main::@11 [ main::screen#2 main::ch#2 main::i#10 main::key#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 main::key#0 ] ) -- vbuaa_eq_vbuc1_then_la1 + cmp #$3f + beq b11_from_b29 + jmp b22 + //SEG75 main::@22 + b22: + //SEG76 [36] (byte) keyboard_key_pressed::key#0 ← (byte) main::key#0 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 ] ) -- vbuz1=vbuaa + sta keyboard_key_pressed.key + //SEG77 [37] call keyboard_key_pressed param-assignment [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#0 ] ) + jsr keyboard_key_pressed + //SEG78 [38] (byte) keyboard_key_pressed::return#2 ← (byte) keyboard_key_pressed::return#0 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#2 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#2 ] ) + // (byte) keyboard_key_pressed::return#2 = (byte) keyboard_key_pressed::return#0 // register copy reg byte a + jmp b30 + //SEG79 main::@30 + b30: + //SEG80 [39] (byte~) main::$16 ← (byte) keyboard_key_pressed::return#2 [ main::screen#2 main::ch#2 main::i#10 main::$16 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 main::$16 ] ) + // (byte~) main::$16 = (byte) keyboard_key_pressed::return#2 // register copy reg byte a + //SEG81 [40] if((byte~) main::$16==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@11 [ main::screen#2 main::ch#2 main::i#10 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 ] ) -- vbuaa_eq_0_then_la1 cmp #0 - beq b11 - jmp b21 - //SEG74 main::@21 - b21: - //SEG75 [37] *((byte*) main::screen#2 + (byte) main::i#2) ← (byte) main::ch#0 [ main::screen#2 main::i#2 ] ( main:2 [ main::screen#2 main::i#2 ] ) -- pbuz1_derefidx_vbuxx=vbuz2 + beq b11_from_b30 + jmp b23 + //SEG82 main::@23 + b23: + //SEG83 [41] *((byte*) main::screen#2 + (byte) main::i#10) ← (byte) main::ch#2 [ main::screen#2 main::ch#2 main::i#10 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 ] ) -- pbuz1_derefidx_vbuz2=vbuxx + ldy i txa - tay - lda ch sta (screen),y - jmp b12 - //SEG76 main::@12 - b12: - //SEG77 [38] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::screen#2 main::i#1 ] ( main:2 [ main::screen#2 main::i#1 ] ) -- vbuxx=_inc_vbuxx - inx - //SEG78 [39] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 6) goto main::@10 [ main::screen#2 main::i#1 ] ( main:2 [ main::screen#2 main::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1 - cpx #6 - bne b10_from_b12 - jmp b2 - //SEG79 main::@11 + //SEG84 [42] (byte) main::i#1 ← ++ (byte) main::i#10 [ main::screen#2 main::ch#2 main::i#1 ] ( main:2 [ main::screen#2 main::ch#2 main::i#1 ] ) -- vbuz1=_inc_vbuz1 + inc i + //SEG85 [43] phi from main::@23 main::@29 main::@30 to main::@11 [phi:main::@23/main::@29/main::@30->main::@11] + b11_from_b23: + b11_from_b29: + b11_from_b30: + //SEG86 [43] phi (byte) main::i#6 = (byte) main::i#1 [phi:main::@23/main::@29/main::@30->main::@11#0] -- register_copy + jmp b11 + //SEG87 main::@11 b11: - //SEG80 [40] *((byte*) main::screen#2 + (byte) main::i#2) ← (byte) ' ' [ main::screen#2 main::i#2 ] ( main:2 [ main::screen#2 main::i#2 ] ) -- pbuz1_derefidx_vbuxx=vbuc1 - txa - tay + //SEG88 [44] (byte) main::ch#1 ← ++ (byte) main::ch#2 [ main::screen#2 main::ch#1 main::i#6 ] ( main:2 [ main::screen#2 main::ch#1 main::i#6 ] ) -- vbuxx=_inc_vbuxx + inx + //SEG89 [45] if((byte) main::ch#1!=(byte/signed byte/word/signed word/dword/signed dword) 64) goto main::@10 [ main::screen#2 main::ch#1 main::i#6 ] ( main:2 [ main::screen#2 main::ch#1 main::i#6 ] ) -- vbuxx_neq_vbuc1_then_la1 + cpx #$40 + bne b10_from_b11 + //SEG90 [46] phi from main::@11 main::@13 to main::@13 [phi:main::@11/main::@13->main::@13] + b13_from_b11: + b13_from_b13: + //SEG91 [46] phi (byte) main::i#4 = (byte) main::i#6 [phi:main::@11/main::@13->main::@13#0] -- register_copy + jmp b13 + //SEG92 main::@13 + b13: + //SEG93 [47] *((byte*) main::screen#2 + (byte) main::i#4) ← (byte) ' ' [ main::screen#2 main::i#4 ] ( main:2 [ main::screen#2 main::i#4 ] ) -- pbuz1_derefidx_vbuz2=vbuc1 lda #' ' + ldy i sta (screen),y - jmp b12 - //SEG81 main::@8 + //SEG94 [48] (byte) main::i#2 ← ++ (byte) main::i#4 [ main::screen#2 main::i#2 ] ( main:2 [ main::screen#2 main::i#2 ] ) -- vbuz1=_inc_vbuz1 + inc i + //SEG95 [49] if((byte) main::i#2<(byte/signed byte/word/signed word/dword/signed dword) 5) goto main::@13 [ main::screen#2 main::i#2 ] ( main:2 [ main::screen#2 main::i#2 ] ) -- vbuz1_lt_vbuc1_then_la1 + lda i + cmp #5 + bcc b13_from_b13 + jmp b2 + //SEG96 main::@8 b8: - //SEG82 [41] *((byte*) main::screen#12 + (byte) main::col#2) ← (byte) '0' [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ) -- pbuz1_derefidx_vbuyy=vbuc1 + //SEG97 [50] *((byte*) main::screen#13 + (byte) main::col#2) ← (byte) '0' [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ) -- pbuz1_derefidx_vbuyy=vbuc1 lda #'0' sta (screen),y jmp b9 - chars: .byte '@', 'a', 'b', 'c', 'd', 'e' } -//SEG83 keyboard_char_pressed -keyboard_char_pressed: { - .label _1 = 5 - .label ch = 4 - //SEG84 [42] (byte) keyboard_matrix_row::ch#0 ← (byte) keyboard_char_pressed::ch#0 [ keyboard_char_pressed::ch#0 keyboard_matrix_row::ch#0 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_row::ch#0 ] ) -- vbuyy=vbuz1 - ldy ch - //SEG85 [43] call keyboard_matrix_row param-assignment [ keyboard_char_pressed::ch#0 keyboard_matrix_row::return#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_row::return#1 ] ) - jsr keyboard_matrix_row - //SEG86 [44] (byte) keyboard_matrix_row::return#0 ← (byte) keyboard_matrix_row::return#1 [ keyboard_char_pressed::ch#0 keyboard_matrix_row::return#0 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_row::return#0 ] ) - // (byte) keyboard_matrix_row::return#0 = (byte) keyboard_matrix_row::return#1 // register copy reg byte a - jmp b2 - //SEG87 keyboard_char_pressed::@2 - b2: - //SEG88 [45] (byte) keyboard_matrix_read::rowid#1 ← (byte) keyboard_matrix_row::return#0 [ keyboard_char_pressed::ch#0 keyboard_matrix_read::rowid#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_read::rowid#1 ] ) - // (byte) keyboard_matrix_read::rowid#1 = (byte) keyboard_matrix_row::return#0 // register copy reg byte a - //SEG89 [46] call keyboard_matrix_read param-assignment [ keyboard_matrix_read::return#2 keyboard_char_pressed::ch#0 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_matrix_read::return#2 keyboard_char_pressed::ch#0 ] ) - //SEG90 [58] phi from keyboard_char_pressed::@2 to keyboard_matrix_read [phi:keyboard_char_pressed::@2->keyboard_matrix_read] - keyboard_matrix_read_from_b2: - //SEG91 [58] phi (byte) keyboard_matrix_read::rowid#2 = (byte) keyboard_matrix_read::rowid#1 [phi:keyboard_char_pressed::@2->keyboard_matrix_read#0] -- register_copy +//SEG98 keyboard_key_pressed +keyboard_key_pressed: { + .label _1 = 6 + .label key = 5 + //SEG99 [51] (byte) keyboard_matrix_read::rowid#0 ← (byte) keyboard_key_pressed::key#0 >> (byte/signed byte/word/signed word/dword/signed dword) 3 [ keyboard_key_pressed::key#0 keyboard_matrix_read::rowid#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_matrix_read::rowid#0 ] ) -- vbuaa=vbuz1_ror_3 + lda key + lsr + lsr + lsr + //SEG100 [52] call keyboard_matrix_read param-assignment [ keyboard_matrix_read::return#0 keyboard_key_pressed::key#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_matrix_read::return#0 keyboard_key_pressed::key#0 ] ) + //SEG101 [58] phi from keyboard_key_pressed to keyboard_matrix_read [phi:keyboard_key_pressed->keyboard_matrix_read] + keyboard_matrix_read_from_keyboard_key_pressed: + //SEG102 [58] phi (byte) keyboard_matrix_read::rowid#2 = (byte) keyboard_matrix_read::rowid#0 [phi:keyboard_key_pressed->keyboard_matrix_read#0] -- register_copy jsr keyboard_matrix_read - //SEG92 [47] (byte) keyboard_matrix_read::return#1 ← (byte) keyboard_matrix_read::return#2 [ keyboard_char_pressed::ch#0 keyboard_matrix_read::return#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_read::return#1 ] ) - // (byte) keyboard_matrix_read::return#1 = (byte) keyboard_matrix_read::return#2 // register copy reg byte a - jmp b3 - //SEG93 keyboard_char_pressed::@3 - b3: - //SEG94 [48] (byte~) keyboard_char_pressed::$1 ← (byte) keyboard_matrix_read::return#1 [ keyboard_char_pressed::ch#0 keyboard_char_pressed::$1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_char_pressed::$1 ] ) -- vbuz1=vbuaa + //SEG103 [53] (byte) keyboard_matrix_read::return#2 ← (byte) keyboard_matrix_read::return#0 [ keyboard_key_pressed::key#0 keyboard_matrix_read::return#2 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_matrix_read::return#2 ] ) + // (byte) keyboard_matrix_read::return#2 = (byte) keyboard_matrix_read::return#0 // register copy reg byte a + jmp b2 + //SEG104 keyboard_key_pressed::@2 + b2: + //SEG105 [54] (byte~) keyboard_key_pressed::$1 ← (byte) keyboard_matrix_read::return#2 [ keyboard_key_pressed::key#0 keyboard_key_pressed::$1 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_key_pressed::$1 ] ) -- vbuz1=vbuaa sta _1 - //SEG95 [49] (byte) keyboard_matrix_col::ch#0 ← (byte) keyboard_char_pressed::ch#0 [ keyboard_char_pressed::$1 keyboard_matrix_col::ch#0 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::ch#0 ] ) -- vbuyy=vbuz1 - ldy ch - //SEG96 [50] call keyboard_matrix_col param-assignment [ keyboard_char_pressed::$1 keyboard_matrix_col::return#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::return#1 ] ) - jsr keyboard_matrix_col - //SEG97 [51] (byte) keyboard_matrix_col::return#0 ← (byte) keyboard_matrix_col::return#1 [ keyboard_char_pressed::$1 keyboard_matrix_col::return#0 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::return#0 ] ) - // (byte) keyboard_matrix_col::return#0 = (byte) keyboard_matrix_col::return#1 // register copy reg byte a - jmp b4 - //SEG98 keyboard_char_pressed::@4 - b4: - //SEG99 [52] (byte~) keyboard_char_pressed::$2 ← (byte) keyboard_matrix_col::return#0 [ keyboard_char_pressed::$1 keyboard_char_pressed::$2 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_char_pressed::$2 ] ) - // (byte~) keyboard_char_pressed::$2 = (byte) keyboard_matrix_col::return#0 // register copy reg byte a - //SEG100 [53] (byte) keyboard_char_pressed::return#1 ← (byte~) keyboard_char_pressed::$1 & (byte~) keyboard_char_pressed::$2 [ keyboard_char_pressed::return#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#1 ] ) -- vbuaa=vbuz1_band_vbuaa - and _1 - jmp breturn - //SEG101 keyboard_char_pressed::@return - breturn: - //SEG102 [54] return [ keyboard_char_pressed::return#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#1 ] ) - rts -} -//SEG103 keyboard_matrix_col -keyboard_matrix_col: { - //SEG104 [55] (byte) keyboard_matrix_col::col_id#0 ← *((const byte[]) keyboard_matrix_chars#0 + (byte) keyboard_matrix_col::ch#0) >> (byte/signed byte/word/signed word/dword/signed dword) 4 [ keyboard_matrix_col::col_id#0 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_col:50 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::col_id#0 ] ) -- vbuaa=pbuc1_derefidx_vbuyy_ror_4 - lda keyboard_matrix_chars,y - lsr - lsr - lsr - lsr - //SEG105 [56] (byte) keyboard_matrix_col::return#1 ← *((const byte[]) keyboard_matrix_col_bitmask#0 + (byte) keyboard_matrix_col::col_id#0) [ keyboard_matrix_col::return#1 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_col:50 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::return#1 ] ) -- vbuaa=pbuc1_derefidx_vbuaa + //SEG106 [55] (byte~) keyboard_key_pressed::$2 ← (byte) keyboard_key_pressed::key#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ keyboard_key_pressed::$1 keyboard_key_pressed::$2 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::$1 keyboard_key_pressed::$2 ] ) -- vbuaa=vbuz1_band_vbuc1 + lda #7 + and key + //SEG107 [56] (byte) keyboard_key_pressed::return#0 ← (byte~) keyboard_key_pressed::$1 & *((const byte[]) keyboard_matrix_col_bitmask#0 + (byte~) keyboard_key_pressed::$2) [ keyboard_key_pressed::return#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#0 ] ) -- vbuaa=vbuz1_band_pbuc1_derefidx_vbuaa tay lda keyboard_matrix_col_bitmask,y + and _1 jmp breturn - //SEG106 keyboard_matrix_col::@return + //SEG108 keyboard_key_pressed::@return breturn: - //SEG107 [57] return [ keyboard_matrix_col::return#1 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_col:50 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::return#1 ] ) + //SEG109 [57] return [ keyboard_key_pressed::return#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#0 ] ) rts } -//SEG108 keyboard_matrix_read +//SEG110 keyboard_matrix_read keyboard_matrix_read: { - //SEG109 [59] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_row_bits#0 + (byte) keyboard_matrix_read::rowid#2) [ ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#12 ] main:2::keyboard_char_pressed:33::keyboard_matrix_read:46 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 ] ) -- _deref_pbuc1=pbuc2_derefidx_vbuaa + //SEG111 [59] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#2) [ ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#13 ] main:2::keyboard_key_pressed:37::keyboard_matrix_read:52 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 ] ) -- _deref_pbuc1=pbuc2_derefidx_vbuaa tay - lda keyboard_row_bits,y + lda keyboard_matrix_row_bitmask,y sta CIA1_PORT_A - //SEG110 [60] (byte) keyboard_matrix_read::return#2 ← ~ *((const byte*) CIA1_PORT_B#0) [ keyboard_matrix_read::return#2 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#12 keyboard_matrix_read::return#2 ] main:2::keyboard_char_pressed:33::keyboard_matrix_read:46 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_read::return#2 ] ) -- vbuaa=_bnot__deref_pbuc1 + //SEG112 [60] (byte) keyboard_matrix_read::return#0 ← ~ *((const byte*) CIA1_PORT_B#0) [ keyboard_matrix_read::return#0 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#13 keyboard_matrix_read::return#0 ] main:2::keyboard_key_pressed:37::keyboard_matrix_read:52 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_matrix_read::return#0 ] ) -- vbuaa=_bnot__deref_pbuc1 lda CIA1_PORT_B eor #$ff jmp breturn - //SEG111 keyboard_matrix_read::@return + //SEG113 keyboard_matrix_read::@return breturn: - //SEG112 [61] return [ keyboard_matrix_read::return#2 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#12 keyboard_matrix_read::return#2 ] main:2::keyboard_char_pressed:33::keyboard_matrix_read:46 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_read::return#2 ] ) + //SEG114 [61] return [ keyboard_matrix_read::return#0 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#13 keyboard_matrix_read::return#0 ] main:2::keyboard_key_pressed:37::keyboard_matrix_read:52 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_matrix_read::return#0 ] ) rts } -//SEG113 keyboard_matrix_row -keyboard_matrix_row: { - //SEG114 [62] (byte) keyboard_matrix_row::return#1 ← *((const byte[]) keyboard_matrix_chars#0 + (byte) keyboard_matrix_row::ch#0) & (byte/signed byte/word/signed word/dword/signed dword) 15 [ keyboard_matrix_row::return#1 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_row:43 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_row::return#1 ] ) -- vbuaa=pbuc1_derefidx_vbuyy_band_vbuc2 - lda keyboard_matrix_chars,y - and #$f +//SEG115 keyboard_get_keycode +keyboard_get_keycode: { + //SEG116 [62] (byte) keyboard_get_keycode::return#0 ← *((const byte[]) keyboard_char_keycodes#0 + (byte) keyboard_get_keycode::ch#0) [ keyboard_get_keycode::return#0 ] ( main:2::keyboard_get_keycode:32 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#0 ] ) -- vbuaa=pbuc1_derefidx_vbuxx + lda keyboard_char_keycodes,x jmp breturn - //SEG115 keyboard_matrix_row::@return + //SEG117 keyboard_get_keycode::@return breturn: - //SEG116 [63] return [ keyboard_matrix_row::return#1 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_row:43 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_row::return#1 ] ) + //SEG118 [63] return [ keyboard_get_keycode::return#0 ] ( main:2::keyboard_get_keycode:32 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#0 ] ) rts } -//SEG117 keyboard_init +//SEG119 keyboard_init keyboard_init: { - //SEG118 [64] *((const byte*) CIA1_PORT_A_DDR#0) ← (byte/word/signed word/dword/signed dword) 255 [ ] ( main:2::keyboard_init:10 [ ] ) -- _deref_pbuc1=vbuc2 + //SEG120 [64] *((const byte*) CIA1_PORT_A_DDR#0) ← (byte/word/signed word/dword/signed dword) 255 [ ] ( main:2::keyboard_init:10 [ ] ) -- _deref_pbuc1=vbuc2 lda #$ff sta CIA1_PORT_A_DDR - //SEG119 [65] *((const byte*) CIA1_PORT_B_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::keyboard_init:10 [ ] ) -- _deref_pbuc1=vbuc2 + //SEG121 [65] *((const byte*) CIA1_PORT_B_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::keyboard_init:10 [ ] ) -- _deref_pbuc1=vbuc2 lda #0 sta CIA1_PORT_B_DDR jmp breturn - //SEG120 keyboard_init::@return + //SEG122 keyboard_init::@return breturn: - //SEG121 [66] return [ ] ( main:2::keyboard_init:10 [ ] ) + //SEG123 [66] return [ ] ( main:2::keyboard_init:10 [ ] ) rts } - keyboard_row_bits: .byte $fe, $fd, $fb, $f7, $ef, $df, $bf, $7f + keyboard_matrix_row_bitmask: .byte $fe, $fd, $fb, $f7, $ef, $df, $bf, $7f keyboard_matrix_col_bitmask: .byte 1, 2, 4, 8, $10, $20, $40, $80 - keyboard_matrix_chars: .byte $65, $21, $43, $42, $22, $61 + keyboard_char_keycodes: .byte KEY_AT, KEY_A, KEY_B, KEY_C, KEY_D, KEY_E, KEY_F, KEY_G, KEY_H, KEY_I, KEY_J, KEY_K, KEY_L, KEY_M, KEY_N, KEY_O, KEY_O, KEY_Q, KEY_R, KEY_S, KEY_T, KEY_U, KEY_V, KEY_W, KEY_X, KEY_Y, KEY_Z, $3f, KEY_POUND, $3f, KEY_ARROW_UP, KEY_ARROW_LEFT, KEY_SPACE, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, KEY_ASTERISK, KEY_PLUS, KEY_COMMA, KEY_MINUS, KEY_DOT, KEY_SLASH, KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_COLON, KEY_SEMICOLON, $3f, KEY_EQUALS, $3f, $3f ASSEMBLER OPTIMIZATIONS -Removing instruction jmp b6 +Removing instruction jmp b5 Removing instruction jmp bend Removing instruction jmp b1 -Removing instruction jmp b13 +Removing instruction jmp b14 Removing instruction jmp b2 Removing instruction jmp breturn Removing instruction jmp b6 -Removing instruction jmp b26 +Removing instruction jmp b28 Removing instruction jmp b7 -Removing instruction jmp b17 +Removing instruction jmp b18 Removing instruction jmp b9 -Removing instruction jmp b19 Removing instruction jmp b20 -Removing instruction jmp b10 -Removing instruction jmp b27 Removing instruction jmp b21 -Removing instruction jmp b12 +Removing instruction jmp b10 +Removing instruction jmp b29 +Removing instruction jmp b22 +Removing instruction jmp b30 +Removing instruction jmp b23 +Removing instruction jmp b11 +Removing instruction jmp b13 Removing instruction jmp b2 -Removing instruction jmp b3 -Removing instruction jmp b4 -Removing instruction jmp breturn Removing instruction jmp breturn Removing instruction jmp breturn Removing instruction jmp breturn Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination +Replacing instruction ldx #0 with TAX Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Replacing label b7_from_b9 with b7 -Replacing label b6_from_b19 with b6 -Replacing label b10_from_b12 with b10 +Replacing label b6_from_b20 with b6 +Replacing label b11_from_b29 with b11 +Replacing label b11_from_b30 with b11 +Replacing label b10_from_b11 with b10 +Replacing label b13_from_b13 with b13 Removing instruction bbegin: -Removing instruction b6_from_bbegin: -Removing instruction main_from_b6: -Removing instruction bend_from_b6: +Removing instruction b5_from_bbegin: +Removing instruction main_from_b5: +Removing instruction bend_from_b5: Removing instruction b1_from_b1: -Removing instruction b13_from_b1: -Removing instruction b6_from_b19: +Removing instruction b14_from_b1: +Removing instruction b6_from_b20: Removing instruction b7_from_b9: -Removing instruction b10_from_b12: +Removing instruction b10_from_b11: +Removing instruction b11_from_b23: +Removing instruction b11_from_b29: +Removing instruction b11_from_b30: +Removing instruction b13_from_b11: +Removing instruction b13_from_b13: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b6: +Removing instruction b5: Removing instruction bend: Removing instruction b1_from_main: -Removing instruction b13: +Removing instruction b14: Removing instruction breturn: Removing instruction b6_from_b5: Removing instruction keyboard_matrix_read_from_b6: -Removing instruction b26: -Removing instruction b7_from_b26: -Removing instruction b17: -Removing instruction b19: +Removing instruction b28: +Removing instruction b7_from_b28: +Removing instruction b18: Removing instruction b20: -Removing instruction b10_from_b20: -Removing instruction b27: Removing instruction b21: +Removing instruction b10_from_b21: +Removing instruction b29: +Removing instruction b22: +Removing instruction b30: +Removing instruction b23: +Removing instruction keyboard_matrix_read_from_keyboard_key_pressed: Removing instruction b2: -Removing instruction keyboard_matrix_read_from_b2: -Removing instruction b3: -Removing instruction b4: -Removing instruction breturn: Removing instruction breturn: Removing instruction breturn: Removing instruction breturn: @@ -2675,7 +3291,7 @@ Removing instruction b2: Succesful ASM optimization Pass5RedundantLabelElimination FINAL SYMBOL TABLE -(label) @6 +(label) @5 (label) @begin (label) @end (byte*) CIA1_PORT_A @@ -2686,70 +3302,159 @@ FINAL SYMBOL TABLE (const byte*) CIA1_PORT_B#0 CIA1_PORT_B = ((byte*))(word/dword/signed dword) 56321 (byte*) CIA1_PORT_B_DDR (const byte*) CIA1_PORT_B_DDR#0 CIA1_PORT_B_DDR = ((byte*))(word/dword/signed dword) 56323 +(byte) KEY_0 +(const byte) KEY_0#0 KEY_0 = (byte/signed byte/word/signed word/dword/signed dword) 35 +(byte) KEY_1 +(const byte) KEY_1#0 KEY_1 = (byte/signed byte/word/signed word/dword/signed dword) 56 +(byte) KEY_2 +(const byte) KEY_2#0 KEY_2 = (byte/signed byte/word/signed word/dword/signed dword) 59 +(byte) KEY_3 +(const byte) KEY_3#0 KEY_3 = (byte/signed byte/word/signed word/dword/signed dword) 8 +(byte) KEY_4 +(const byte) KEY_4#0 KEY_4 = (byte/signed byte/word/signed word/dword/signed dword) 11 +(byte) KEY_5 +(const byte) KEY_5#0 KEY_5 = (byte/signed byte/word/signed word/dword/signed dword) 16 +(byte) KEY_6 +(const byte) KEY_6#0 KEY_6 = (byte/signed byte/word/signed word/dword/signed dword) 19 +(byte) KEY_7 +(const byte) KEY_7#0 KEY_7 = (byte/signed byte/word/signed word/dword/signed dword) 24 +(byte) KEY_8 +(const byte) KEY_8#0 KEY_8 = (byte/signed byte/word/signed word/dword/signed dword) 27 +(byte) KEY_9 +(const byte) KEY_9#0 KEY_9 = (byte/signed byte/word/signed word/dword/signed dword) 32 +(byte) KEY_A +(const byte) KEY_A#0 KEY_A = (byte/signed byte/word/signed word/dword/signed dword) 10 +(byte) KEY_ARROW_LEFT +(const byte) KEY_ARROW_LEFT#0 KEY_ARROW_LEFT = (byte/signed byte/word/signed word/dword/signed dword) 57 +(byte) KEY_ARROW_UP +(const byte) KEY_ARROW_UP#0 KEY_ARROW_UP = (byte/signed byte/word/signed word/dword/signed dword) 54 +(byte) KEY_ASTERISK +(const byte) KEY_ASTERISK#0 KEY_ASTERISK = (byte/signed byte/word/signed word/dword/signed dword) 49 +(byte) KEY_AT +(const byte) KEY_AT#0 KEY_AT = (byte/signed byte/word/signed word/dword/signed dword) 46 +(byte) KEY_B +(const byte) KEY_B#0 KEY_B = (byte/signed byte/word/signed word/dword/signed dword) 28 +(byte) KEY_C +(const byte) KEY_C#0 KEY_C = (byte/signed byte/word/signed word/dword/signed dword) 20 +(byte) KEY_COLON +(const byte) KEY_COLON#0 KEY_COLON = (byte/signed byte/word/signed word/dword/signed dword) 45 +(byte) KEY_COMMA +(const byte) KEY_COMMA#0 KEY_COMMA = (byte/signed byte/word/signed word/dword/signed dword) 47 +(byte) KEY_D +(const byte) KEY_D#0 KEY_D = (byte/signed byte/word/signed word/dword/signed dword) 18 +(byte) KEY_DOT +(const byte) KEY_DOT#0 KEY_DOT = (byte/signed byte/word/signed word/dword/signed dword) 44 +(byte) KEY_E +(const byte) KEY_E#0 KEY_E = (byte/signed byte/word/signed word/dword/signed dword) 14 +(byte) KEY_EQUALS +(const byte) KEY_EQUALS#0 KEY_EQUALS = (byte/signed byte/word/signed word/dword/signed dword) 53 +(byte) KEY_F +(const byte) KEY_F#0 KEY_F = (byte/signed byte/word/signed word/dword/signed dword) 21 +(byte) KEY_G +(const byte) KEY_G#0 KEY_G = (byte/signed byte/word/signed word/dword/signed dword) 26 +(byte) KEY_H +(const byte) KEY_H#0 KEY_H = (byte/signed byte/word/signed word/dword/signed dword) 29 +(byte) KEY_I +(const byte) KEY_I#0 KEY_I = (byte/signed byte/word/signed word/dword/signed dword) 33 +(byte) KEY_J +(const byte) KEY_J#0 KEY_J = (byte/signed byte/word/signed word/dword/signed dword) 34 +(byte) KEY_K +(const byte) KEY_K#0 KEY_K = (byte/signed byte/word/signed word/dword/signed dword) 37 +(byte) KEY_L +(const byte) KEY_L#0 KEY_L = (byte/signed byte/word/signed word/dword/signed dword) 42 +(byte) KEY_M +(const byte) KEY_M#0 KEY_M = (byte/signed byte/word/signed word/dword/signed dword) 36 +(byte) KEY_MINUS +(const byte) KEY_MINUS#0 KEY_MINUS = (byte/signed byte/word/signed word/dword/signed dword) 43 +(byte) KEY_N +(const byte) KEY_N#0 KEY_N = (byte/signed byte/word/signed word/dword/signed dword) 39 +(byte) KEY_O +(const byte) KEY_O#0 KEY_O = (byte/signed byte/word/signed word/dword/signed dword) 38 +(byte) KEY_PLUS +(const byte) KEY_PLUS#0 KEY_PLUS = (byte/signed byte/word/signed word/dword/signed dword) 40 +(byte) KEY_POUND +(const byte) KEY_POUND#0 KEY_POUND = (byte/signed byte/word/signed word/dword/signed dword) 48 +(byte) KEY_Q +(const byte) KEY_Q#0 KEY_Q = (byte/signed byte/word/signed word/dword/signed dword) 62 +(byte) KEY_R +(const byte) KEY_R#0 KEY_R = (byte/signed byte/word/signed word/dword/signed dword) 17 +(byte) KEY_S +(const byte) KEY_S#0 KEY_S = (byte/signed byte/word/signed word/dword/signed dword) 13 +(byte) KEY_SEMICOLON +(const byte) KEY_SEMICOLON#0 KEY_SEMICOLON = (byte/signed byte/word/signed word/dword/signed dword) 50 +(byte) KEY_SLASH +(const byte) KEY_SLASH#0 KEY_SLASH = (byte/signed byte/word/signed word/dword/signed dword) 55 +(byte) KEY_SPACE +(const byte) KEY_SPACE#0 KEY_SPACE = (byte/signed byte/word/signed word/dword/signed dword) 60 +(byte) KEY_T +(const byte) KEY_T#0 KEY_T = (byte/signed byte/word/signed word/dword/signed dword) 22 +(byte) KEY_U +(const byte) KEY_U#0 KEY_U = (byte/signed byte/word/signed word/dword/signed dword) 30 +(byte) KEY_V +(const byte) KEY_V#0 KEY_V = (byte/signed byte/word/signed word/dword/signed dword) 31 +(byte) KEY_W +(const byte) KEY_W#0 KEY_W = (byte/signed byte/word/signed word/dword/signed dword) 9 +(byte) KEY_X +(const byte) KEY_X#0 KEY_X = (byte/signed byte/word/signed word/dword/signed dword) 23 +(byte) KEY_Y +(const byte) KEY_Y#0 KEY_Y = (byte/signed byte/word/signed word/dword/signed dword) 25 +(byte) KEY_Z +(const byte) KEY_Z#0 KEY_Z = (byte/signed byte/word/signed word/dword/signed dword) 12 (byte*) RASTER (const byte*) RASTER#0 RASTER = ((byte*))(word/dword/signed dword) 53266 -(byte()) keyboard_char_pressed((byte) keyboard_char_pressed::ch) -(byte~) keyboard_char_pressed::$1 $1 zp ZP_BYTE:5 0.8 -(byte~) keyboard_char_pressed::$2 reg byte a 4.0 -(label) keyboard_char_pressed::@2 -(label) keyboard_char_pressed::@3 -(label) keyboard_char_pressed::@4 -(label) keyboard_char_pressed::@return -(byte) keyboard_char_pressed::ch -(byte) keyboard_char_pressed::ch#0 ch zp ZP_BYTE:4 13.125 -(byte) keyboard_char_pressed::return -(byte) keyboard_char_pressed::return#0 reg byte a 202.0 -(byte) keyboard_char_pressed::return#1 reg byte a 34.33333333333333 +(byte[]) keyboard_char_keycodes +(const byte[]) keyboard_char_keycodes#0 keyboard_char_keycodes = { (const byte) KEY_AT#0, (const byte) KEY_A#0, (const byte) KEY_B#0, (const byte) KEY_C#0, (const byte) KEY_D#0, (const byte) KEY_E#0, (const byte) KEY_F#0, (const byte) KEY_G#0, (const byte) KEY_H#0, (const byte) KEY_I#0, (const byte) KEY_J#0, (const byte) KEY_K#0, (const byte) KEY_L#0, (const byte) KEY_M#0, (const byte) KEY_N#0, (const byte) KEY_O#0, (const byte) KEY_O#0, (const byte) KEY_Q#0, (const byte) KEY_R#0, (const byte) KEY_S#0, (const byte) KEY_T#0, (const byte) KEY_U#0, (const byte) KEY_V#0, (const byte) KEY_W#0, (const byte) KEY_X#0, (const byte) KEY_Y#0, (const byte) KEY_Z#0, (byte/signed byte/word/signed word/dword/signed dword) 63, (const byte) KEY_POUND#0, (byte/signed byte/word/signed word/dword/signed dword) 63, (const byte) KEY_ARROW_UP#0, (const byte) KEY_ARROW_LEFT#0, (const byte) KEY_SPACE#0, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (const byte) KEY_ASTERISK#0, (const byte) KEY_PLUS#0, (const byte) KEY_COMMA#0, (const byte) KEY_MINUS#0, (const byte) KEY_DOT#0, (const byte) KEY_SLASH#0, (const byte) KEY_0#0, (const byte) KEY_1#0, (const byte) KEY_2#0, (const byte) KEY_3#0, (const byte) KEY_4#0, (const byte) KEY_5#0, (const byte) KEY_6#0, (const byte) KEY_7#0, (const byte) KEY_8#0, (const byte) KEY_9#0, (const byte) KEY_COLON#0, (const byte) KEY_SEMICOLON#0, (byte/signed byte/word/signed word/dword/signed dword) 63, (const byte) KEY_EQUALS#0, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63 } +(byte()) keyboard_get_keycode((byte) keyboard_get_keycode::ch) +(label) keyboard_get_keycode::@return +(byte) keyboard_get_keycode::ch +(byte) keyboard_get_keycode::ch#0 reg byte x 103.0 +(byte) keyboard_get_keycode::return +(byte) keyboard_get_keycode::return#0 reg byte a 34.33333333333333 +(byte) keyboard_get_keycode::return#2 reg byte a 202.0 (void()) keyboard_init() (label) keyboard_init::@return -(byte[]) keyboard_matrix_chars -(const byte[]) keyboard_matrix_chars#0 keyboard_matrix_chars = { (byte/signed byte/word/signed word/dword/signed dword) 101, (byte/signed byte/word/signed word/dword/signed dword) 33, (byte/signed byte/word/signed word/dword/signed dword) 67, (byte/signed byte/word/signed word/dword/signed dword) 66, (byte/signed byte/word/signed word/dword/signed dword) 34, (byte/signed byte/word/signed word/dword/signed dword) 97 } -(byte()) keyboard_matrix_col((byte) keyboard_matrix_col::ch) -(label) keyboard_matrix_col::@return -(byte) keyboard_matrix_col::ch -(byte) keyboard_matrix_col::ch#0 reg byte y 4.0 -(byte) keyboard_matrix_col::col_id -(byte) keyboard_matrix_col::col_id#0 reg byte a 4.0 -(byte) keyboard_matrix_col::return -(byte) keyboard_matrix_col::return#0 reg byte a 4.0 -(byte) keyboard_matrix_col::return#1 reg byte a 1.3333333333333333 +(byte()) keyboard_key_pressed((byte) keyboard_key_pressed::key) +(byte~) keyboard_key_pressed::$1 $1 zp ZP_BYTE:6 2.0 +(byte~) keyboard_key_pressed::$2 reg byte a 4.0 +(label) keyboard_key_pressed::@2 +(label) keyboard_key_pressed::@return +(byte) keyboard_key_pressed::key +(byte) keyboard_key_pressed::key#0 key zp ZP_BYTE:5 20.999999999999996 +(byte) keyboard_key_pressed::return +(byte) keyboard_key_pressed::return#0 reg byte a 34.33333333333333 +(byte) keyboard_key_pressed::return#2 reg byte a 202.0 (byte[]) keyboard_matrix_col_bitmask (const byte[]) keyboard_matrix_col_bitmask#0 keyboard_matrix_col_bitmask = { (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 4, (byte/signed byte/word/signed word/dword/signed dword) 8, (byte/signed byte/word/signed word/dword/signed dword) 16, (byte/signed byte/word/signed word/dword/signed dword) 32, (byte/signed byte/word/signed word/dword/signed dword) 64, (byte/word/signed word/dword/signed dword) 128 } (byte()) keyboard_matrix_read((byte) keyboard_matrix_read::rowid) (label) keyboard_matrix_read::@return (byte) keyboard_matrix_read::return -(byte) keyboard_matrix_read::return#0 reg byte a 202.0 -(byte) keyboard_matrix_read::return#1 reg byte a 4.0 -(byte) keyboard_matrix_read::return#2 reg byte a 26.25 +(byte) keyboard_matrix_read::return#0 reg byte a 26.25 +(byte) keyboard_matrix_read::return#2 reg byte a 4.0 +(byte) keyboard_matrix_read::return#3 reg byte a 202.0 (byte) keyboard_matrix_read::row_pressed_bits (byte) keyboard_matrix_read::rowid -(byte) keyboard_matrix_read::rowid#0 reg byte a 202.0 -(byte) keyboard_matrix_read::rowid#1 reg byte a 4.0 +(byte) keyboard_matrix_read::rowid#0 reg byte a 4.0 +(byte) keyboard_matrix_read::rowid#1 reg byte a 202.0 (byte) keyboard_matrix_read::rowid#2 reg byte a 105.0 -(byte()) keyboard_matrix_row((byte) keyboard_matrix_row::ch) -(label) keyboard_matrix_row::@return -(byte) keyboard_matrix_row::ch -(byte) keyboard_matrix_row::ch#0 reg byte y 4.0 -(byte) keyboard_matrix_row::return -(byte) keyboard_matrix_row::return#0 reg byte a 4.0 -(byte) keyboard_matrix_row::return#1 reg byte a 1.3333333333333333 -(byte[8]) keyboard_row_bits -(const byte[8]) keyboard_row_bits#0 keyboard_row_bits = { (byte/word/signed word/dword/signed dword) 254, (byte/word/signed word/dword/signed dword) 253, (byte/word/signed word/dword/signed dword) 251, (byte/word/signed word/dword/signed dword) 247, (byte/word/signed word/dword/signed dword) 239, (byte/word/signed word/dword/signed dword) 223, (byte/word/signed word/dword/signed dword) 191, (byte/signed byte/word/signed word/dword/signed dword) 127 } +(byte[8]) keyboard_matrix_row_bitmask +(const byte[8]) keyboard_matrix_row_bitmask#0 keyboard_matrix_row_bitmask = { (byte/word/signed word/dword/signed dword) 254, (byte/word/signed word/dword/signed dword) 253, (byte/word/signed word/dword/signed dword) 251, (byte/word/signed word/dword/signed dword) 247, (byte/word/signed word/dword/signed dword) 239, (byte/word/signed word/dword/signed dword) 223, (byte/word/signed word/dword/signed dword) 191, (byte/signed byte/word/signed word/dword/signed dword) 127 } (void()) main() -(byte~) main::$13 reg byte a 202.0 +(byte~) main::$16 reg byte a 202.0 (byte~) main::$5 reg byte a 2002.0 (label) main::@1 (label) main::@10 (label) main::@11 -(label) main::@12 (label) main::@13 -(label) main::@17 -(label) main::@19 +(label) main::@14 +(label) main::@18 (label) main::@2 (label) main::@20 (label) main::@21 -(label) main::@26 -(label) main::@27 +(label) main::@22 +(label) main::@23 +(label) main::@28 +(label) main::@29 +(label) main::@30 (label) main::@5 (label) main::@6 (label) main::@7 @@ -2757,15 +3462,19 @@ FINAL SYMBOL TABLE (label) main::@9 (label) main::@return (byte) main::ch -(byte) main::ch#0 ch zp ZP_BYTE:4 50.5 -(byte[]) main::chars -(const byte[]) main::chars#0 chars = { (byte) '@', (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e' } +(byte) main::ch#1 reg byte x 151.5 +(byte) main::ch#2 reg byte x 28.857142857142858 (byte) main::col (byte) main::col#1 reg byte y 1501.5 (byte) main::col#2 reg byte y 667.3333333333334 (byte) main::i -(byte) main::i#1 reg byte x 151.5 -(byte) main::i#2 reg byte x 56.11111111111111 +(byte) main::i#1 i zp ZP_BYTE:4 202.0 +(byte) main::i#10 i zp ZP_BYTE:4 42.08333333333333 +(byte) main::i#2 i zp ZP_BYTE:4 151.5 +(byte) main::i#4 i zp ZP_BYTE:4 202.0 +(byte) main::i#6 i zp ZP_BYTE:4 168.33333333333331 +(byte) main::key +(byte) main::key#0 reg byte a 151.5 (byte) main::row (byte) main::row#1 reg byte x 151.5 (byte) main::row#2 reg byte x 21.642857142857142 @@ -2778,35 +3487,33 @@ FINAL SYMBOL TABLE (byte*) main::sc#2 sc zp ZP_WORD:2 16.5 (byte*) main::screen (byte*) main::screen#1 screen zp ZP_WORD:2 71.0 -(byte*) main::screen#12 screen zp ZP_WORD:2 169.53846153846155 -(byte*) main::screen#2 screen zp ZP_WORD:2 17.75 +(byte*) main::screen#13 screen zp ZP_WORD:2 169.53846153846155 +(byte*) main::screen#2 screen zp ZP_WORD:2 10.142857142857142 -zp ZP_WORD:2 [ main::sc#2 main::sc#1 main::screen#12 main::screen#1 main::screen#2 ] +zp ZP_WORD:2 [ main::sc#2 main::sc#1 main::screen#13 main::screen#1 main::screen#2 ] reg byte x [ main::row#2 main::row#1 ] -zp ZP_BYTE:4 [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 main::ch#0 keyboard_char_pressed::ch#0 ] +zp ZP_BYTE:4 [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 main::i#4 main::i#10 main::i#6 main::i#1 main::i#2 ] reg byte y [ main::col#2 main::col#1 ] -reg byte x [ main::i#2 main::i#1 ] -reg byte a [ keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#1 keyboard_matrix_read::rowid#0 ] -reg byte a [ keyboard_matrix_read::return#0 ] +reg byte x [ main::ch#2 main::ch#1 ] +reg byte a [ keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#0 keyboard_matrix_read::rowid#1 ] +reg byte a [ keyboard_matrix_read::return#3 ] reg byte a [ main::$5 ] -reg byte a [ keyboard_char_pressed::return#0 ] -reg byte a [ main::$13 ] -reg byte y [ keyboard_matrix_row::ch#0 ] -reg byte a [ keyboard_matrix_row::return#0 ] -reg byte a [ keyboard_matrix_read::return#1 ] -zp ZP_BYTE:5 [ keyboard_char_pressed::$1 ] -reg byte y [ keyboard_matrix_col::ch#0 ] -reg byte a [ keyboard_matrix_col::return#0 ] -reg byte a [ keyboard_char_pressed::$2 ] -reg byte a [ keyboard_char_pressed::return#1 ] -reg byte a [ keyboard_matrix_col::col_id#0 ] -reg byte a [ keyboard_matrix_col::return#1 ] +reg byte x [ keyboard_get_keycode::ch#0 ] +reg byte a [ keyboard_get_keycode::return#2 ] +reg byte a [ main::key#0 ] +zp ZP_BYTE:5 [ keyboard_key_pressed::key#0 ] +reg byte a [ keyboard_key_pressed::return#2 ] +reg byte a [ main::$16 ] reg byte a [ keyboard_matrix_read::return#2 ] -reg byte a [ keyboard_matrix_row::return#1 ] +zp ZP_BYTE:6 [ keyboard_key_pressed::$1 ] +reg byte a [ keyboard_key_pressed::$2 ] +reg byte a [ keyboard_key_pressed::return#0 ] +reg byte a [ keyboard_matrix_read::return#0 ] +reg byte a [ keyboard_get_keycode::return#0 ] FINAL ASSEMBLER -Score: 53505 +Score: 55731 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -2818,20 +3525,69 @@ Score: 53505 .label CIA1_PORT_B = $dc01 .label CIA1_PORT_A_DDR = $dc02 .label CIA1_PORT_B_DDR = $dc03 + .const KEY_3 = 8 + .const KEY_W = 9 + .const KEY_A = $a + .const KEY_4 = $b + .const KEY_Z = $c + .const KEY_S = $d + .const KEY_E = $e + .const KEY_5 = $10 + .const KEY_R = $11 + .const KEY_D = $12 + .const KEY_6 = $13 + .const KEY_C = $14 + .const KEY_F = $15 + .const KEY_T = $16 + .const KEY_X = $17 + .const KEY_7 = $18 + .const KEY_Y = $19 + .const KEY_G = $1a + .const KEY_8 = $1b + .const KEY_B = $1c + .const KEY_H = $1d + .const KEY_U = $1e + .const KEY_V = $1f + .const KEY_9 = $20 + .const KEY_I = $21 + .const KEY_J = $22 + .const KEY_0 = $23 + .const KEY_M = $24 + .const KEY_K = $25 + .const KEY_O = $26 + .const KEY_N = $27 + .const KEY_PLUS = $28 + .const KEY_L = $2a + .const KEY_MINUS = $2b + .const KEY_DOT = $2c + .const KEY_COLON = $2d + .const KEY_AT = $2e + .const KEY_COMMA = $2f + .const KEY_POUND = $30 + .const KEY_ASTERISK = $31 + .const KEY_SEMICOLON = $32 + .const KEY_EQUALS = $35 + .const KEY_ARROW_UP = $36 + .const KEY_SLASH = $37 + .const KEY_1 = $38 + .const KEY_ARROW_LEFT = $39 + .const KEY_2 = $3b + .const KEY_SPACE = $3c + .const KEY_Q = $3e //SEG2 @begin -//SEG3 [1] phi from @begin to @6 [phi:@begin->@6] -//SEG4 @6 +//SEG3 [1] phi from @begin to @5 [phi:@begin->@5] +//SEG4 @5 //SEG5 [2] call main param-assignment [ ] ( ) -//SEG6 [4] phi from @6 to main [phi:@6->main] +//SEG6 [4] phi from @5 to main [phi:@5->main] jsr main -//SEG7 [3] phi from @6 to @end [phi:@6->@end] +//SEG7 [3] phi from @5 to @end [phi:@5->@end] //SEG8 @end //SEG9 main main: { .label sc = 2 .label row_pressed_bits = 4 .label screen = 2 - .label ch = 4 + .label i = 4 //SEG10 [5] phi from main to main::@1 [phi:main->main::@1] //SEG11 [5] phi (byte*) main::sc#2 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main->main::@1#0] -- pbuz1=pbuc1 lda #<$400 @@ -2860,8 +3616,8 @@ main: { cmp #<$400+$3e8 bcc b1 !: - //SEG18 [9] phi from main::@1 to main::@13 [phi:main::@1->main::@13] - //SEG19 main::@13 + //SEG18 [9] phi from main::@1 to main::@14 [phi:main::@1->main::@14] + //SEG19 main::@14 //SEG20 [10] call keyboard_init param-assignment [ ] ( main:2 [ ] ) jsr keyboard_init //SEG21 main::@2 @@ -2875,59 +3631,59 @@ main: { cmp #$ff bne b5 //SEG27 [14] phi from main::@5 to main::@6 [phi:main::@5->main::@6] - //SEG28 [14] phi (byte*) main::screen#12 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main::@5->main::@6#0] -- pbuz1=pbuc1 + //SEG28 [14] phi (byte*) main::screen#13 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main::@5->main::@6#0] -- pbuz1=pbuc1 lda #<$400 sta screen lda #>$400 sta screen+1 //SEG29 [14] phi (byte) main::row#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@5->main::@6#1] -- vbuxx=vbuc1 ldx #0 - //SEG30 [14] phi from main::@19 to main::@6 [phi:main::@19->main::@6] - //SEG31 [14] phi (byte*) main::screen#12 = (byte*) main::screen#1 [phi:main::@19->main::@6#0] -- register_copy - //SEG32 [14] phi (byte) main::row#2 = (byte) main::row#1 [phi:main::@19->main::@6#1] -- register_copy + //SEG30 [14] phi from main::@20 to main::@6 [phi:main::@20->main::@6] + //SEG31 [14] phi (byte*) main::screen#13 = (byte*) main::screen#1 [phi:main::@20->main::@6#0] -- register_copy + //SEG32 [14] phi (byte) main::row#2 = (byte) main::row#1 [phi:main::@20->main::@6#1] -- register_copy //SEG33 main::@6 b6: - //SEG34 [15] (byte) keyboard_matrix_read::rowid#0 ← (byte) main::row#2 [ main::row#2 main::screen#12 keyboard_matrix_read::rowid#0 ] ( main:2 [ main::row#2 main::screen#12 keyboard_matrix_read::rowid#0 ] ) -- vbuaa=vbuxx + //SEG34 [15] (byte) keyboard_matrix_read::rowid#1 ← (byte) main::row#2 [ main::row#2 main::screen#13 keyboard_matrix_read::rowid#1 ] ( main:2 [ main::row#2 main::screen#13 keyboard_matrix_read::rowid#1 ] ) -- vbuaa=vbuxx txa - //SEG35 [16] call keyboard_matrix_read param-assignment [ main::row#2 main::screen#12 keyboard_matrix_read::return#2 ] ( main:2 [ main::row#2 main::screen#12 keyboard_matrix_read::return#2 ] ) + //SEG35 [16] call keyboard_matrix_read param-assignment [ main::row#2 main::screen#13 keyboard_matrix_read::return#0 ] ( main:2 [ main::row#2 main::screen#13 keyboard_matrix_read::return#0 ] ) //SEG36 [58] phi from main::@6 to keyboard_matrix_read [phi:main::@6->keyboard_matrix_read] - //SEG37 [58] phi (byte) keyboard_matrix_read::rowid#2 = (byte) keyboard_matrix_read::rowid#0 [phi:main::@6->keyboard_matrix_read#0] -- register_copy + //SEG37 [58] phi (byte) keyboard_matrix_read::rowid#2 = (byte) keyboard_matrix_read::rowid#1 [phi:main::@6->keyboard_matrix_read#0] -- register_copy jsr keyboard_matrix_read - //SEG38 [17] (byte) keyboard_matrix_read::return#0 ← (byte) keyboard_matrix_read::return#2 [ main::row#2 main::screen#12 keyboard_matrix_read::return#0 ] ( main:2 [ main::row#2 main::screen#12 keyboard_matrix_read::return#0 ] ) - // (byte) keyboard_matrix_read::return#0 = (byte) keyboard_matrix_read::return#2 // register copy reg byte a - //SEG39 main::@26 - //SEG40 [18] (byte) main::row_pressed_bits#0 ← (byte) keyboard_matrix_read::return#0 [ main::row#2 main::screen#12 main::row_pressed_bits#0 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#0 ] ) -- vbuz1=vbuaa + //SEG38 [17] (byte) keyboard_matrix_read::return#3 ← (byte) keyboard_matrix_read::return#0 [ main::row#2 main::screen#13 keyboard_matrix_read::return#3 ] ( main:2 [ main::row#2 main::screen#13 keyboard_matrix_read::return#3 ] ) + // (byte) keyboard_matrix_read::return#3 = (byte) keyboard_matrix_read::return#0 // register copy reg byte a + //SEG39 main::@28 + //SEG40 [18] (byte) main::row_pressed_bits#0 ← (byte) keyboard_matrix_read::return#3 [ main::row#2 main::screen#13 main::row_pressed_bits#0 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#0 ] ) -- vbuz1=vbuaa sta row_pressed_bits - //SEG41 [19] phi from main::@26 to main::@7 [phi:main::@26->main::@7] - //SEG42 [19] phi (byte) main::col#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@26->main::@7#0] -- vbuyy=vbuc1 + //SEG41 [19] phi from main::@28 to main::@7 [phi:main::@28->main::@7] + //SEG42 [19] phi (byte) main::col#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@28->main::@7#0] -- vbuyy=vbuc1 ldy #0 - //SEG43 [19] phi (byte) main::row_pressed_bits#2 = (byte) main::row_pressed_bits#0 [phi:main::@26->main::@7#1] -- register_copy + //SEG43 [19] phi (byte) main::row_pressed_bits#2 = (byte) main::row_pressed_bits#0 [phi:main::@28->main::@7#1] -- register_copy //SEG44 [19] phi from main::@9 to main::@7 [phi:main::@9->main::@7] //SEG45 [19] phi (byte) main::col#2 = (byte) main::col#1 [phi:main::@9->main::@7#0] -- register_copy //SEG46 [19] phi (byte) main::row_pressed_bits#2 = (byte) main::row_pressed_bits#1 [phi:main::@9->main::@7#1] -- register_copy //SEG47 main::@7 b7: - //SEG48 [20] (byte~) main::$5 ← (byte) main::row_pressed_bits#2 & (byte/word/signed word/dword/signed dword) 128 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 main::$5 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 main::$5 ] ) -- vbuaa=vbuz1_band_vbuc1 + //SEG48 [20] (byte~) main::$5 ← (byte) main::row_pressed_bits#2 & (byte/word/signed word/dword/signed dword) 128 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 main::$5 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 main::$5 ] ) -- vbuaa=vbuz1_band_vbuc1 lda #$80 and row_pressed_bits - //SEG49 [21] if((byte~) main::$5==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@8 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ) -- vbuaa_eq_0_then_la1 + //SEG49 [21] if((byte~) main::$5==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@8 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ) -- vbuaa_eq_0_then_la1 cmp #0 beq b8 - //SEG50 main::@17 - //SEG51 [22] *((byte*) main::screen#12 + (byte) main::col#2) ← (byte) '1' [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ) -- pbuz1_derefidx_vbuyy=vbuc1 + //SEG50 main::@18 + //SEG51 [22] *((byte*) main::screen#13 + (byte) main::col#2) ← (byte) '1' [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ) -- pbuz1_derefidx_vbuyy=vbuc1 lda #'1' sta (screen),y //SEG52 main::@9 b9: - //SEG53 [23] (byte) main::row_pressed_bits#1 ← (byte) main::row_pressed_bits#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ main::row#2 main::screen#12 main::col#2 main::row_pressed_bits#1 ] ( main:2 [ main::row#2 main::screen#12 main::col#2 main::row_pressed_bits#1 ] ) -- vbuz1=vbuz1_rol_1 + //SEG53 [23] (byte) main::row_pressed_bits#1 ← (byte) main::row_pressed_bits#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ main::row#2 main::screen#13 main::col#2 main::row_pressed_bits#1 ] ( main:2 [ main::row#2 main::screen#13 main::col#2 main::row_pressed_bits#1 ] ) -- vbuz1=vbuz1_rol_1 asl row_pressed_bits - //SEG54 [24] (byte) main::col#1 ← ++ (byte) main::col#2 [ main::row#2 main::screen#12 main::row_pressed_bits#1 main::col#1 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#1 main::col#1 ] ) -- vbuyy=_inc_vbuyy + //SEG54 [24] (byte) main::col#1 ← ++ (byte) main::col#2 [ main::row#2 main::screen#13 main::row_pressed_bits#1 main::col#1 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#1 main::col#1 ] ) -- vbuyy=_inc_vbuyy iny - //SEG55 [25] if((byte) main::col#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@7 [ main::row#2 main::screen#12 main::row_pressed_bits#1 main::col#1 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#1 main::col#1 ] ) -- vbuyy_neq_vbuc1_then_la1 + //SEG55 [25] if((byte) main::col#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@7 [ main::row#2 main::screen#13 main::row_pressed_bits#1 main::col#1 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#1 main::col#1 ] ) -- vbuyy_neq_vbuc1_then_la1 cpy #8 bne b7 - //SEG56 main::@19 - //SEG57 [26] (byte*) main::screen#1 ← (byte*) main::screen#12 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::row#2 main::screen#1 ] ( main:2 [ main::row#2 main::screen#1 ] ) -- pbuz1=pbuz1_plus_vbuc1 + //SEG56 main::@20 + //SEG57 [26] (byte*) main::screen#1 ← (byte*) main::screen#13 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::row#2 main::screen#1 ] ( main:2 [ main::row#2 main::screen#1 ] ) -- pbuz1=pbuz1_plus_vbuc1 lda screen clc adc #$28 @@ -2940,7 +3696,7 @@ main: { //SEG59 [28] if((byte) main::row#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@6 [ main::row#1 main::screen#1 ] ( main:2 [ main::row#1 main::screen#1 ] ) -- vbuxx_neq_vbuc1_then_la1 cpx #8 bne b6 - //SEG60 main::@20 + //SEG60 main::@21 //SEG61 [29] (byte*) main::screen#2 ← (byte*) main::screen#1 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::screen#2 ] ( main:2 [ main::screen#2 ] ) -- pbuz1=pbuz1_plus_vbuc1 lda screen clc @@ -2949,145 +3705,143 @@ main: { bcc !+ inc screen+1 !: - //SEG62 [30] phi from main::@20 to main::@10 [phi:main::@20->main::@10] - //SEG63 [30] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@20->main::@10#0] -- vbuxx=vbuc1 - ldx #0 - //SEG64 [30] phi from main::@12 to main::@10 [phi:main::@12->main::@10] - //SEG65 [30] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@12->main::@10#0] -- register_copy - //SEG66 main::@10 + //SEG62 [30] phi from main::@21 to main::@10 [phi:main::@21->main::@10] + //SEG63 [30] phi (byte) main::i#10 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@21->main::@10#0] -- vbuz1=vbuc1 + lda #0 + sta i + //SEG64 [30] phi (byte) main::ch#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@21->main::@10#1] -- vbuxx=vbuc1 + tax + //SEG65 [30] phi from main::@11 to main::@10 [phi:main::@11->main::@10] + //SEG66 [30] phi (byte) main::i#10 = (byte) main::i#6 [phi:main::@11->main::@10#0] -- register_copy + //SEG67 [30] phi (byte) main::ch#2 = (byte) main::ch#1 [phi:main::@11->main::@10#1] -- register_copy + //SEG68 main::@10 b10: - //SEG67 [31] (byte) main::ch#0 ← *((const byte[]) main::chars#0 + (byte) main::i#2) [ main::screen#2 main::i#2 main::ch#0 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 ] ) -- vbuz1=pbuc1_derefidx_vbuxx - lda chars,x - sta ch - //SEG68 [32] (byte) keyboard_char_pressed::ch#0 ← (byte) main::ch#0 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 ] ) - // (byte) keyboard_char_pressed::ch#0 = (byte) main::ch#0 // register copy zp ZP_BYTE:4 - //SEG69 [33] call keyboard_char_pressed param-assignment [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#1 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#1 ] ) - jsr keyboard_char_pressed - //SEG70 [34] (byte) keyboard_char_pressed::return#0 ← (byte) keyboard_char_pressed::return#1 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#0 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#0 ] ) - // (byte) keyboard_char_pressed::return#0 = (byte) keyboard_char_pressed::return#1 // register copy reg byte a - //SEG71 main::@27 - //SEG72 [35] (byte~) main::$13 ← (byte) keyboard_char_pressed::return#0 [ main::screen#2 main::i#2 main::ch#0 main::$13 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 main::$13 ] ) - // (byte~) main::$13 = (byte) keyboard_char_pressed::return#0 // register copy reg byte a - //SEG73 [36] if((byte~) main::$13==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@11 [ main::screen#2 main::i#2 main::ch#0 ] ( main:2 [ main::screen#2 main::i#2 main::ch#0 ] ) -- vbuaa_eq_0_then_la1 + //SEG69 [31] (byte) keyboard_get_keycode::ch#0 ← (byte) main::ch#2 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::ch#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::ch#0 ] ) + // (byte) keyboard_get_keycode::ch#0 = (byte) main::ch#2 // register copy reg byte x + //SEG70 [32] call keyboard_get_keycode param-assignment [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#0 ] ) + jsr keyboard_get_keycode + //SEG71 [33] (byte) keyboard_get_keycode::return#2 ← (byte) keyboard_get_keycode::return#0 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#2 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#2 ] ) + // (byte) keyboard_get_keycode::return#2 = (byte) keyboard_get_keycode::return#0 // register copy reg byte a + //SEG72 main::@29 + //SEG73 [34] (byte) main::key#0 ← (byte) keyboard_get_keycode::return#2 [ main::screen#2 main::ch#2 main::i#10 main::key#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 main::key#0 ] ) + // (byte) main::key#0 = (byte) keyboard_get_keycode::return#2 // register copy reg byte a + //SEG74 [35] if((byte) main::key#0==(byte/signed byte/word/signed word/dword/signed dword) 63) goto main::@11 [ main::screen#2 main::ch#2 main::i#10 main::key#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 main::key#0 ] ) -- vbuaa_eq_vbuc1_then_la1 + cmp #$3f + beq b11 + //SEG75 main::@22 + //SEG76 [36] (byte) keyboard_key_pressed::key#0 ← (byte) main::key#0 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 ] ) -- vbuz1=vbuaa + sta keyboard_key_pressed.key + //SEG77 [37] call keyboard_key_pressed param-assignment [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#0 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#0 ] ) + jsr keyboard_key_pressed + //SEG78 [38] (byte) keyboard_key_pressed::return#2 ← (byte) keyboard_key_pressed::return#0 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#2 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#2 ] ) + // (byte) keyboard_key_pressed::return#2 = (byte) keyboard_key_pressed::return#0 // register copy reg byte a + //SEG79 main::@30 + //SEG80 [39] (byte~) main::$16 ← (byte) keyboard_key_pressed::return#2 [ main::screen#2 main::ch#2 main::i#10 main::$16 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 main::$16 ] ) + // (byte~) main::$16 = (byte) keyboard_key_pressed::return#2 // register copy reg byte a + //SEG81 [40] if((byte~) main::$16==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@11 [ main::screen#2 main::ch#2 main::i#10 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 ] ) -- vbuaa_eq_0_then_la1 cmp #0 beq b11 - //SEG74 main::@21 - //SEG75 [37] *((byte*) main::screen#2 + (byte) main::i#2) ← (byte) main::ch#0 [ main::screen#2 main::i#2 ] ( main:2 [ main::screen#2 main::i#2 ] ) -- pbuz1_derefidx_vbuxx=vbuz2 + //SEG82 main::@23 + //SEG83 [41] *((byte*) main::screen#2 + (byte) main::i#10) ← (byte) main::ch#2 [ main::screen#2 main::ch#2 main::i#10 ] ( main:2 [ main::screen#2 main::ch#2 main::i#10 ] ) -- pbuz1_derefidx_vbuz2=vbuxx + ldy i txa - tay - lda ch sta (screen),y - //SEG76 main::@12 - b12: - //SEG77 [38] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::screen#2 main::i#1 ] ( main:2 [ main::screen#2 main::i#1 ] ) -- vbuxx=_inc_vbuxx - inx - //SEG78 [39] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 6) goto main::@10 [ main::screen#2 main::i#1 ] ( main:2 [ main::screen#2 main::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1 - cpx #6 - bne b10 - jmp b5 - //SEG79 main::@11 + //SEG84 [42] (byte) main::i#1 ← ++ (byte) main::i#10 [ main::screen#2 main::ch#2 main::i#1 ] ( main:2 [ main::screen#2 main::ch#2 main::i#1 ] ) -- vbuz1=_inc_vbuz1 + inc i + //SEG85 [43] phi from main::@23 main::@29 main::@30 to main::@11 [phi:main::@23/main::@29/main::@30->main::@11] + //SEG86 [43] phi (byte) main::i#6 = (byte) main::i#1 [phi:main::@23/main::@29/main::@30->main::@11#0] -- register_copy + //SEG87 main::@11 b11: - //SEG80 [40] *((byte*) main::screen#2 + (byte) main::i#2) ← (byte) ' ' [ main::screen#2 main::i#2 ] ( main:2 [ main::screen#2 main::i#2 ] ) -- pbuz1_derefidx_vbuxx=vbuc1 - txa - tay + //SEG88 [44] (byte) main::ch#1 ← ++ (byte) main::ch#2 [ main::screen#2 main::ch#1 main::i#6 ] ( main:2 [ main::screen#2 main::ch#1 main::i#6 ] ) -- vbuxx=_inc_vbuxx + inx + //SEG89 [45] if((byte) main::ch#1!=(byte/signed byte/word/signed word/dword/signed dword) 64) goto main::@10 [ main::screen#2 main::ch#1 main::i#6 ] ( main:2 [ main::screen#2 main::ch#1 main::i#6 ] ) -- vbuxx_neq_vbuc1_then_la1 + cpx #$40 + bne b10 + //SEG90 [46] phi from main::@11 main::@13 to main::@13 [phi:main::@11/main::@13->main::@13] + //SEG91 [46] phi (byte) main::i#4 = (byte) main::i#6 [phi:main::@11/main::@13->main::@13#0] -- register_copy + //SEG92 main::@13 + b13: + //SEG93 [47] *((byte*) main::screen#2 + (byte) main::i#4) ← (byte) ' ' [ main::screen#2 main::i#4 ] ( main:2 [ main::screen#2 main::i#4 ] ) -- pbuz1_derefidx_vbuz2=vbuc1 lda #' ' + ldy i sta (screen),y - jmp b12 - //SEG81 main::@8 + //SEG94 [48] (byte) main::i#2 ← ++ (byte) main::i#4 [ main::screen#2 main::i#2 ] ( main:2 [ main::screen#2 main::i#2 ] ) -- vbuz1=_inc_vbuz1 + inc i + //SEG95 [49] if((byte) main::i#2<(byte/signed byte/word/signed word/dword/signed dword) 5) goto main::@13 [ main::screen#2 main::i#2 ] ( main:2 [ main::screen#2 main::i#2 ] ) -- vbuz1_lt_vbuc1_then_la1 + lda i + cmp #5 + bcc b13 + jmp b5 + //SEG96 main::@8 b8: - //SEG82 [41] *((byte*) main::screen#12 + (byte) main::col#2) ← (byte) '0' [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#12 main::row_pressed_bits#2 main::col#2 ] ) -- pbuz1_derefidx_vbuyy=vbuc1 + //SEG97 [50] *((byte*) main::screen#13 + (byte) main::col#2) ← (byte) '0' [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ) -- pbuz1_derefidx_vbuyy=vbuc1 lda #'0' sta (screen),y jmp b9 - chars: .byte '@', 'a', 'b', 'c', 'd', 'e' } -//SEG83 keyboard_char_pressed -keyboard_char_pressed: { - .label _1 = 5 - .label ch = 4 - //SEG84 [42] (byte) keyboard_matrix_row::ch#0 ← (byte) keyboard_char_pressed::ch#0 [ keyboard_char_pressed::ch#0 keyboard_matrix_row::ch#0 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_row::ch#0 ] ) -- vbuyy=vbuz1 - ldy ch - //SEG85 [43] call keyboard_matrix_row param-assignment [ keyboard_char_pressed::ch#0 keyboard_matrix_row::return#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_row::return#1 ] ) - jsr keyboard_matrix_row - //SEG86 [44] (byte) keyboard_matrix_row::return#0 ← (byte) keyboard_matrix_row::return#1 [ keyboard_char_pressed::ch#0 keyboard_matrix_row::return#0 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_row::return#0 ] ) - // (byte) keyboard_matrix_row::return#0 = (byte) keyboard_matrix_row::return#1 // register copy reg byte a - //SEG87 keyboard_char_pressed::@2 - //SEG88 [45] (byte) keyboard_matrix_read::rowid#1 ← (byte) keyboard_matrix_row::return#0 [ keyboard_char_pressed::ch#0 keyboard_matrix_read::rowid#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_read::rowid#1 ] ) - // (byte) keyboard_matrix_read::rowid#1 = (byte) keyboard_matrix_row::return#0 // register copy reg byte a - //SEG89 [46] call keyboard_matrix_read param-assignment [ keyboard_matrix_read::return#2 keyboard_char_pressed::ch#0 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_matrix_read::return#2 keyboard_char_pressed::ch#0 ] ) - //SEG90 [58] phi from keyboard_char_pressed::@2 to keyboard_matrix_read [phi:keyboard_char_pressed::@2->keyboard_matrix_read] - //SEG91 [58] phi (byte) keyboard_matrix_read::rowid#2 = (byte) keyboard_matrix_read::rowid#1 [phi:keyboard_char_pressed::@2->keyboard_matrix_read#0] -- register_copy +//SEG98 keyboard_key_pressed +keyboard_key_pressed: { + .label _1 = 6 + .label key = 5 + //SEG99 [51] (byte) keyboard_matrix_read::rowid#0 ← (byte) keyboard_key_pressed::key#0 >> (byte/signed byte/word/signed word/dword/signed dword) 3 [ keyboard_key_pressed::key#0 keyboard_matrix_read::rowid#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_matrix_read::rowid#0 ] ) -- vbuaa=vbuz1_ror_3 + lda key + lsr + lsr + lsr + //SEG100 [52] call keyboard_matrix_read param-assignment [ keyboard_matrix_read::return#0 keyboard_key_pressed::key#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_matrix_read::return#0 keyboard_key_pressed::key#0 ] ) + //SEG101 [58] phi from keyboard_key_pressed to keyboard_matrix_read [phi:keyboard_key_pressed->keyboard_matrix_read] + //SEG102 [58] phi (byte) keyboard_matrix_read::rowid#2 = (byte) keyboard_matrix_read::rowid#0 [phi:keyboard_key_pressed->keyboard_matrix_read#0] -- register_copy jsr keyboard_matrix_read - //SEG92 [47] (byte) keyboard_matrix_read::return#1 ← (byte) keyboard_matrix_read::return#2 [ keyboard_char_pressed::ch#0 keyboard_matrix_read::return#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_read::return#1 ] ) - // (byte) keyboard_matrix_read::return#1 = (byte) keyboard_matrix_read::return#2 // register copy reg byte a - //SEG93 keyboard_char_pressed::@3 - //SEG94 [48] (byte~) keyboard_char_pressed::$1 ← (byte) keyboard_matrix_read::return#1 [ keyboard_char_pressed::ch#0 keyboard_char_pressed::$1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_char_pressed::$1 ] ) -- vbuz1=vbuaa + //SEG103 [53] (byte) keyboard_matrix_read::return#2 ← (byte) keyboard_matrix_read::return#0 [ keyboard_key_pressed::key#0 keyboard_matrix_read::return#2 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_matrix_read::return#2 ] ) + // (byte) keyboard_matrix_read::return#2 = (byte) keyboard_matrix_read::return#0 // register copy reg byte a + //SEG104 keyboard_key_pressed::@2 + //SEG105 [54] (byte~) keyboard_key_pressed::$1 ← (byte) keyboard_matrix_read::return#2 [ keyboard_key_pressed::key#0 keyboard_key_pressed::$1 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_key_pressed::$1 ] ) -- vbuz1=vbuaa sta _1 - //SEG95 [49] (byte) keyboard_matrix_col::ch#0 ← (byte) keyboard_char_pressed::ch#0 [ keyboard_char_pressed::$1 keyboard_matrix_col::ch#0 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::ch#0 ] ) -- vbuyy=vbuz1 - ldy ch - //SEG96 [50] call keyboard_matrix_col param-assignment [ keyboard_char_pressed::$1 keyboard_matrix_col::return#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::return#1 ] ) - jsr keyboard_matrix_col - //SEG97 [51] (byte) keyboard_matrix_col::return#0 ← (byte) keyboard_matrix_col::return#1 [ keyboard_char_pressed::$1 keyboard_matrix_col::return#0 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::return#0 ] ) - // (byte) keyboard_matrix_col::return#0 = (byte) keyboard_matrix_col::return#1 // register copy reg byte a - //SEG98 keyboard_char_pressed::@4 - //SEG99 [52] (byte~) keyboard_char_pressed::$2 ← (byte) keyboard_matrix_col::return#0 [ keyboard_char_pressed::$1 keyboard_char_pressed::$2 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_char_pressed::$2 ] ) - // (byte~) keyboard_char_pressed::$2 = (byte) keyboard_matrix_col::return#0 // register copy reg byte a - //SEG100 [53] (byte) keyboard_char_pressed::return#1 ← (byte~) keyboard_char_pressed::$1 & (byte~) keyboard_char_pressed::$2 [ keyboard_char_pressed::return#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#1 ] ) -- vbuaa=vbuz1_band_vbuaa - and _1 - //SEG101 keyboard_char_pressed::@return - //SEG102 [54] return [ keyboard_char_pressed::return#1 ] ( main:2::keyboard_char_pressed:33 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::return#1 ] ) - rts -} -//SEG103 keyboard_matrix_col -keyboard_matrix_col: { - //SEG104 [55] (byte) keyboard_matrix_col::col_id#0 ← *((const byte[]) keyboard_matrix_chars#0 + (byte) keyboard_matrix_col::ch#0) >> (byte/signed byte/word/signed word/dword/signed dword) 4 [ keyboard_matrix_col::col_id#0 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_col:50 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::col_id#0 ] ) -- vbuaa=pbuc1_derefidx_vbuyy_ror_4 - lda keyboard_matrix_chars,y - lsr - lsr - lsr - lsr - //SEG105 [56] (byte) keyboard_matrix_col::return#1 ← *((const byte[]) keyboard_matrix_col_bitmask#0 + (byte) keyboard_matrix_col::col_id#0) [ keyboard_matrix_col::return#1 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_col:50 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::return#1 ] ) -- vbuaa=pbuc1_derefidx_vbuaa + //SEG106 [55] (byte~) keyboard_key_pressed::$2 ← (byte) keyboard_key_pressed::key#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ keyboard_key_pressed::$1 keyboard_key_pressed::$2 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::$1 keyboard_key_pressed::$2 ] ) -- vbuaa=vbuz1_band_vbuc1 + lda #7 + and key + //SEG107 [56] (byte) keyboard_key_pressed::return#0 ← (byte~) keyboard_key_pressed::$1 & *((const byte[]) keyboard_matrix_col_bitmask#0 + (byte~) keyboard_key_pressed::$2) [ keyboard_key_pressed::return#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#0 ] ) -- vbuaa=vbuz1_band_pbuc1_derefidx_vbuaa tay lda keyboard_matrix_col_bitmask,y - //SEG106 keyboard_matrix_col::@return - //SEG107 [57] return [ keyboard_matrix_col::return#1 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_col:50 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::$1 keyboard_matrix_col::return#1 ] ) + and _1 + //SEG108 keyboard_key_pressed::@return + //SEG109 [57] return [ keyboard_key_pressed::return#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::return#0 ] ) rts } -//SEG108 keyboard_matrix_read +//SEG110 keyboard_matrix_read keyboard_matrix_read: { - //SEG109 [59] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_row_bits#0 + (byte) keyboard_matrix_read::rowid#2) [ ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#12 ] main:2::keyboard_char_pressed:33::keyboard_matrix_read:46 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 ] ) -- _deref_pbuc1=pbuc2_derefidx_vbuaa + //SEG111 [59] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#2) [ ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#13 ] main:2::keyboard_key_pressed:37::keyboard_matrix_read:52 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 ] ) -- _deref_pbuc1=pbuc2_derefidx_vbuaa tay - lda keyboard_row_bits,y + lda keyboard_matrix_row_bitmask,y sta CIA1_PORT_A - //SEG110 [60] (byte) keyboard_matrix_read::return#2 ← ~ *((const byte*) CIA1_PORT_B#0) [ keyboard_matrix_read::return#2 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#12 keyboard_matrix_read::return#2 ] main:2::keyboard_char_pressed:33::keyboard_matrix_read:46 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_read::return#2 ] ) -- vbuaa=_bnot__deref_pbuc1 + //SEG112 [60] (byte) keyboard_matrix_read::return#0 ← ~ *((const byte*) CIA1_PORT_B#0) [ keyboard_matrix_read::return#0 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#13 keyboard_matrix_read::return#0 ] main:2::keyboard_key_pressed:37::keyboard_matrix_read:52 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_matrix_read::return#0 ] ) -- vbuaa=_bnot__deref_pbuc1 lda CIA1_PORT_B eor #$ff - //SEG111 keyboard_matrix_read::@return - //SEG112 [61] return [ keyboard_matrix_read::return#2 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#12 keyboard_matrix_read::return#2 ] main:2::keyboard_char_pressed:33::keyboard_matrix_read:46 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_read::return#2 ] ) + //SEG113 keyboard_matrix_read::@return + //SEG114 [61] return [ keyboard_matrix_read::return#0 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#13 keyboard_matrix_read::return#0 ] main:2::keyboard_key_pressed:37::keyboard_matrix_read:52 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::key#0 keyboard_matrix_read::return#0 ] ) rts } -//SEG113 keyboard_matrix_row -keyboard_matrix_row: { - //SEG114 [62] (byte) keyboard_matrix_row::return#1 ← *((const byte[]) keyboard_matrix_chars#0 + (byte) keyboard_matrix_row::ch#0) & (byte/signed byte/word/signed word/dword/signed dword) 15 [ keyboard_matrix_row::return#1 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_row:43 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_row::return#1 ] ) -- vbuaa=pbuc1_derefidx_vbuyy_band_vbuc2 - lda keyboard_matrix_chars,y - and #$f - //SEG115 keyboard_matrix_row::@return - //SEG116 [63] return [ keyboard_matrix_row::return#1 ] ( main:2::keyboard_char_pressed:33::keyboard_matrix_row:43 [ main::screen#2 main::i#2 main::ch#0 keyboard_char_pressed::ch#0 keyboard_matrix_row::return#1 ] ) +//SEG115 keyboard_get_keycode +keyboard_get_keycode: { + //SEG116 [62] (byte) keyboard_get_keycode::return#0 ← *((const byte[]) keyboard_char_keycodes#0 + (byte) keyboard_get_keycode::ch#0) [ keyboard_get_keycode::return#0 ] ( main:2::keyboard_get_keycode:32 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#0 ] ) -- vbuaa=pbuc1_derefidx_vbuxx + lda keyboard_char_keycodes,x + //SEG117 keyboard_get_keycode::@return + //SEG118 [63] return [ keyboard_get_keycode::return#0 ] ( main:2::keyboard_get_keycode:32 [ main::screen#2 main::ch#2 main::i#10 keyboard_get_keycode::return#0 ] ) rts } -//SEG117 keyboard_init +//SEG119 keyboard_init keyboard_init: { - //SEG118 [64] *((const byte*) CIA1_PORT_A_DDR#0) ← (byte/word/signed word/dword/signed dword) 255 [ ] ( main:2::keyboard_init:10 [ ] ) -- _deref_pbuc1=vbuc2 + //SEG120 [64] *((const byte*) CIA1_PORT_A_DDR#0) ← (byte/word/signed word/dword/signed dword) 255 [ ] ( main:2::keyboard_init:10 [ ] ) -- _deref_pbuc1=vbuc2 lda #$ff sta CIA1_PORT_A_DDR - //SEG119 [65] *((const byte*) CIA1_PORT_B_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::keyboard_init:10 [ ] ) -- _deref_pbuc1=vbuc2 + //SEG121 [65] *((const byte*) CIA1_PORT_B_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::keyboard_init:10 [ ] ) -- _deref_pbuc1=vbuc2 lda #0 sta CIA1_PORT_B_DDR - //SEG120 keyboard_init::@return - //SEG121 [66] return [ ] ( main:2::keyboard_init:10 [ ] ) + //SEG122 keyboard_init::@return + //SEG123 [66] return [ ] ( main:2::keyboard_init:10 [ ] ) rts } - keyboard_row_bits: .byte $fe, $fd, $fb, $f7, $ef, $df, $bf, $7f + keyboard_matrix_row_bitmask: .byte $fe, $fd, $fb, $f7, $ef, $df, $bf, $7f keyboard_matrix_col_bitmask: .byte 1, 2, 4, 8, $10, $20, $40, $80 - keyboard_matrix_chars: .byte $65, $21, $43, $42, $22, $61 + keyboard_char_keycodes: .byte KEY_AT, KEY_A, KEY_B, KEY_C, KEY_D, KEY_E, KEY_F, KEY_G, KEY_H, KEY_I, KEY_J, KEY_K, KEY_L, KEY_M, KEY_N, KEY_O, KEY_O, KEY_Q, KEY_R, KEY_S, KEY_T, KEY_U, KEY_V, KEY_W, KEY_X, KEY_Y, KEY_Z, $3f, KEY_POUND, $3f, KEY_ARROW_UP, KEY_ARROW_LEFT, KEY_SPACE, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, KEY_ASTERISK, KEY_PLUS, KEY_COMMA, KEY_MINUS, KEY_DOT, KEY_SLASH, KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_COLON, KEY_SEMICOLON, $3f, KEY_EQUALS, $3f, $3f diff --git a/src/test/java/dk/camelot64/kickc/test/ref/test-keyboard.sym b/src/test/java/dk/camelot64/kickc/test/ref/test-keyboard.sym index 5f2324e52..01e7ae758 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/test-keyboard.sym +++ b/src/test/java/dk/camelot64/kickc/test/ref/test-keyboard.sym @@ -1,4 +1,4 @@ -(label) @6 +(label) @5 (label) @begin (label) @end (byte*) CIA1_PORT_A @@ -9,70 +9,159 @@ (const byte*) CIA1_PORT_B#0 CIA1_PORT_B = ((byte*))(word/dword/signed dword) 56321 (byte*) CIA1_PORT_B_DDR (const byte*) CIA1_PORT_B_DDR#0 CIA1_PORT_B_DDR = ((byte*))(word/dword/signed dword) 56323 +(byte) KEY_0 +(const byte) KEY_0#0 KEY_0 = (byte/signed byte/word/signed word/dword/signed dword) 35 +(byte) KEY_1 +(const byte) KEY_1#0 KEY_1 = (byte/signed byte/word/signed word/dword/signed dword) 56 +(byte) KEY_2 +(const byte) KEY_2#0 KEY_2 = (byte/signed byte/word/signed word/dword/signed dword) 59 +(byte) KEY_3 +(const byte) KEY_3#0 KEY_3 = (byte/signed byte/word/signed word/dword/signed dword) 8 +(byte) KEY_4 +(const byte) KEY_4#0 KEY_4 = (byte/signed byte/word/signed word/dword/signed dword) 11 +(byte) KEY_5 +(const byte) KEY_5#0 KEY_5 = (byte/signed byte/word/signed word/dword/signed dword) 16 +(byte) KEY_6 +(const byte) KEY_6#0 KEY_6 = (byte/signed byte/word/signed word/dword/signed dword) 19 +(byte) KEY_7 +(const byte) KEY_7#0 KEY_7 = (byte/signed byte/word/signed word/dword/signed dword) 24 +(byte) KEY_8 +(const byte) KEY_8#0 KEY_8 = (byte/signed byte/word/signed word/dword/signed dword) 27 +(byte) KEY_9 +(const byte) KEY_9#0 KEY_9 = (byte/signed byte/word/signed word/dword/signed dword) 32 +(byte) KEY_A +(const byte) KEY_A#0 KEY_A = (byte/signed byte/word/signed word/dword/signed dword) 10 +(byte) KEY_ARROW_LEFT +(const byte) KEY_ARROW_LEFT#0 KEY_ARROW_LEFT = (byte/signed byte/word/signed word/dword/signed dword) 57 +(byte) KEY_ARROW_UP +(const byte) KEY_ARROW_UP#0 KEY_ARROW_UP = (byte/signed byte/word/signed word/dword/signed dword) 54 +(byte) KEY_ASTERISK +(const byte) KEY_ASTERISK#0 KEY_ASTERISK = (byte/signed byte/word/signed word/dword/signed dword) 49 +(byte) KEY_AT +(const byte) KEY_AT#0 KEY_AT = (byte/signed byte/word/signed word/dword/signed dword) 46 +(byte) KEY_B +(const byte) KEY_B#0 KEY_B = (byte/signed byte/word/signed word/dword/signed dword) 28 +(byte) KEY_C +(const byte) KEY_C#0 KEY_C = (byte/signed byte/word/signed word/dword/signed dword) 20 +(byte) KEY_COLON +(const byte) KEY_COLON#0 KEY_COLON = (byte/signed byte/word/signed word/dword/signed dword) 45 +(byte) KEY_COMMA +(const byte) KEY_COMMA#0 KEY_COMMA = (byte/signed byte/word/signed word/dword/signed dword) 47 +(byte) KEY_D +(const byte) KEY_D#0 KEY_D = (byte/signed byte/word/signed word/dword/signed dword) 18 +(byte) KEY_DOT +(const byte) KEY_DOT#0 KEY_DOT = (byte/signed byte/word/signed word/dword/signed dword) 44 +(byte) KEY_E +(const byte) KEY_E#0 KEY_E = (byte/signed byte/word/signed word/dword/signed dword) 14 +(byte) KEY_EQUALS +(const byte) KEY_EQUALS#0 KEY_EQUALS = (byte/signed byte/word/signed word/dword/signed dword) 53 +(byte) KEY_F +(const byte) KEY_F#0 KEY_F = (byte/signed byte/word/signed word/dword/signed dword) 21 +(byte) KEY_G +(const byte) KEY_G#0 KEY_G = (byte/signed byte/word/signed word/dword/signed dword) 26 +(byte) KEY_H +(const byte) KEY_H#0 KEY_H = (byte/signed byte/word/signed word/dword/signed dword) 29 +(byte) KEY_I +(const byte) KEY_I#0 KEY_I = (byte/signed byte/word/signed word/dword/signed dword) 33 +(byte) KEY_J +(const byte) KEY_J#0 KEY_J = (byte/signed byte/word/signed word/dword/signed dword) 34 +(byte) KEY_K +(const byte) KEY_K#0 KEY_K = (byte/signed byte/word/signed word/dword/signed dword) 37 +(byte) KEY_L +(const byte) KEY_L#0 KEY_L = (byte/signed byte/word/signed word/dword/signed dword) 42 +(byte) KEY_M +(const byte) KEY_M#0 KEY_M = (byte/signed byte/word/signed word/dword/signed dword) 36 +(byte) KEY_MINUS +(const byte) KEY_MINUS#0 KEY_MINUS = (byte/signed byte/word/signed word/dword/signed dword) 43 +(byte) KEY_N +(const byte) KEY_N#0 KEY_N = (byte/signed byte/word/signed word/dword/signed dword) 39 +(byte) KEY_O +(const byte) KEY_O#0 KEY_O = (byte/signed byte/word/signed word/dword/signed dword) 38 +(byte) KEY_PLUS +(const byte) KEY_PLUS#0 KEY_PLUS = (byte/signed byte/word/signed word/dword/signed dword) 40 +(byte) KEY_POUND +(const byte) KEY_POUND#0 KEY_POUND = (byte/signed byte/word/signed word/dword/signed dword) 48 +(byte) KEY_Q +(const byte) KEY_Q#0 KEY_Q = (byte/signed byte/word/signed word/dword/signed dword) 62 +(byte) KEY_R +(const byte) KEY_R#0 KEY_R = (byte/signed byte/word/signed word/dword/signed dword) 17 +(byte) KEY_S +(const byte) KEY_S#0 KEY_S = (byte/signed byte/word/signed word/dword/signed dword) 13 +(byte) KEY_SEMICOLON +(const byte) KEY_SEMICOLON#0 KEY_SEMICOLON = (byte/signed byte/word/signed word/dword/signed dword) 50 +(byte) KEY_SLASH +(const byte) KEY_SLASH#0 KEY_SLASH = (byte/signed byte/word/signed word/dword/signed dword) 55 +(byte) KEY_SPACE +(const byte) KEY_SPACE#0 KEY_SPACE = (byte/signed byte/word/signed word/dword/signed dword) 60 +(byte) KEY_T +(const byte) KEY_T#0 KEY_T = (byte/signed byte/word/signed word/dword/signed dword) 22 +(byte) KEY_U +(const byte) KEY_U#0 KEY_U = (byte/signed byte/word/signed word/dword/signed dword) 30 +(byte) KEY_V +(const byte) KEY_V#0 KEY_V = (byte/signed byte/word/signed word/dword/signed dword) 31 +(byte) KEY_W +(const byte) KEY_W#0 KEY_W = (byte/signed byte/word/signed word/dword/signed dword) 9 +(byte) KEY_X +(const byte) KEY_X#0 KEY_X = (byte/signed byte/word/signed word/dword/signed dword) 23 +(byte) KEY_Y +(const byte) KEY_Y#0 KEY_Y = (byte/signed byte/word/signed word/dword/signed dword) 25 +(byte) KEY_Z +(const byte) KEY_Z#0 KEY_Z = (byte/signed byte/word/signed word/dword/signed dword) 12 (byte*) RASTER (const byte*) RASTER#0 RASTER = ((byte*))(word/dword/signed dword) 53266 -(byte()) keyboard_char_pressed((byte) keyboard_char_pressed::ch) -(byte~) keyboard_char_pressed::$1 $1 zp ZP_BYTE:5 0.8 -(byte~) keyboard_char_pressed::$2 reg byte a 4.0 -(label) keyboard_char_pressed::@2 -(label) keyboard_char_pressed::@3 -(label) keyboard_char_pressed::@4 -(label) keyboard_char_pressed::@return -(byte) keyboard_char_pressed::ch -(byte) keyboard_char_pressed::ch#0 ch zp ZP_BYTE:4 13.125 -(byte) keyboard_char_pressed::return -(byte) keyboard_char_pressed::return#0 reg byte a 202.0 -(byte) keyboard_char_pressed::return#1 reg byte a 34.33333333333333 +(byte[]) keyboard_char_keycodes +(const byte[]) keyboard_char_keycodes#0 keyboard_char_keycodes = { (const byte) KEY_AT#0, (const byte) KEY_A#0, (const byte) KEY_B#0, (const byte) KEY_C#0, (const byte) KEY_D#0, (const byte) KEY_E#0, (const byte) KEY_F#0, (const byte) KEY_G#0, (const byte) KEY_H#0, (const byte) KEY_I#0, (const byte) KEY_J#0, (const byte) KEY_K#0, (const byte) KEY_L#0, (const byte) KEY_M#0, (const byte) KEY_N#0, (const byte) KEY_O#0, (const byte) KEY_O#0, (const byte) KEY_Q#0, (const byte) KEY_R#0, (const byte) KEY_S#0, (const byte) KEY_T#0, (const byte) KEY_U#0, (const byte) KEY_V#0, (const byte) KEY_W#0, (const byte) KEY_X#0, (const byte) KEY_Y#0, (const byte) KEY_Z#0, (byte/signed byte/word/signed word/dword/signed dword) 63, (const byte) KEY_POUND#0, (byte/signed byte/word/signed word/dword/signed dword) 63, (const byte) KEY_ARROW_UP#0, (const byte) KEY_ARROW_LEFT#0, (const byte) KEY_SPACE#0, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (const byte) KEY_ASTERISK#0, (const byte) KEY_PLUS#0, (const byte) KEY_COMMA#0, (const byte) KEY_MINUS#0, (const byte) KEY_DOT#0, (const byte) KEY_SLASH#0, (const byte) KEY_0#0, (const byte) KEY_1#0, (const byte) KEY_2#0, (const byte) KEY_3#0, (const byte) KEY_4#0, (const byte) KEY_5#0, (const byte) KEY_6#0, (const byte) KEY_7#0, (const byte) KEY_8#0, (const byte) KEY_9#0, (const byte) KEY_COLON#0, (const byte) KEY_SEMICOLON#0, (byte/signed byte/word/signed word/dword/signed dword) 63, (const byte) KEY_EQUALS#0, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63 } +(byte()) keyboard_get_keycode((byte) keyboard_get_keycode::ch) +(label) keyboard_get_keycode::@return +(byte) keyboard_get_keycode::ch +(byte) keyboard_get_keycode::ch#0 reg byte x 103.0 +(byte) keyboard_get_keycode::return +(byte) keyboard_get_keycode::return#0 reg byte a 34.33333333333333 +(byte) keyboard_get_keycode::return#2 reg byte a 202.0 (void()) keyboard_init() (label) keyboard_init::@return -(byte[]) keyboard_matrix_chars -(const byte[]) keyboard_matrix_chars#0 keyboard_matrix_chars = { (byte/signed byte/word/signed word/dword/signed dword) 101, (byte/signed byte/word/signed word/dword/signed dword) 33, (byte/signed byte/word/signed word/dword/signed dword) 67, (byte/signed byte/word/signed word/dword/signed dword) 66, (byte/signed byte/word/signed word/dword/signed dword) 34, (byte/signed byte/word/signed word/dword/signed dword) 97 } -(byte()) keyboard_matrix_col((byte) keyboard_matrix_col::ch) -(label) keyboard_matrix_col::@return -(byte) keyboard_matrix_col::ch -(byte) keyboard_matrix_col::ch#0 reg byte y 4.0 -(byte) keyboard_matrix_col::col_id -(byte) keyboard_matrix_col::col_id#0 reg byte a 4.0 -(byte) keyboard_matrix_col::return -(byte) keyboard_matrix_col::return#0 reg byte a 4.0 -(byte) keyboard_matrix_col::return#1 reg byte a 1.3333333333333333 +(byte()) keyboard_key_pressed((byte) keyboard_key_pressed::key) +(byte~) keyboard_key_pressed::$1 $1 zp ZP_BYTE:6 2.0 +(byte~) keyboard_key_pressed::$2 reg byte a 4.0 +(label) keyboard_key_pressed::@2 +(label) keyboard_key_pressed::@return +(byte) keyboard_key_pressed::key +(byte) keyboard_key_pressed::key#0 key zp ZP_BYTE:5 20.999999999999996 +(byte) keyboard_key_pressed::return +(byte) keyboard_key_pressed::return#0 reg byte a 34.33333333333333 +(byte) keyboard_key_pressed::return#2 reg byte a 202.0 (byte[]) keyboard_matrix_col_bitmask (const byte[]) keyboard_matrix_col_bitmask#0 keyboard_matrix_col_bitmask = { (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 4, (byte/signed byte/word/signed word/dword/signed dword) 8, (byte/signed byte/word/signed word/dword/signed dword) 16, (byte/signed byte/word/signed word/dword/signed dword) 32, (byte/signed byte/word/signed word/dword/signed dword) 64, (byte/word/signed word/dword/signed dword) 128 } (byte()) keyboard_matrix_read((byte) keyboard_matrix_read::rowid) (label) keyboard_matrix_read::@return (byte) keyboard_matrix_read::return -(byte) keyboard_matrix_read::return#0 reg byte a 202.0 -(byte) keyboard_matrix_read::return#1 reg byte a 4.0 -(byte) keyboard_matrix_read::return#2 reg byte a 26.25 +(byte) keyboard_matrix_read::return#0 reg byte a 26.25 +(byte) keyboard_matrix_read::return#2 reg byte a 4.0 +(byte) keyboard_matrix_read::return#3 reg byte a 202.0 (byte) keyboard_matrix_read::row_pressed_bits (byte) keyboard_matrix_read::rowid -(byte) keyboard_matrix_read::rowid#0 reg byte a 202.0 -(byte) keyboard_matrix_read::rowid#1 reg byte a 4.0 +(byte) keyboard_matrix_read::rowid#0 reg byte a 4.0 +(byte) keyboard_matrix_read::rowid#1 reg byte a 202.0 (byte) keyboard_matrix_read::rowid#2 reg byte a 105.0 -(byte()) keyboard_matrix_row((byte) keyboard_matrix_row::ch) -(label) keyboard_matrix_row::@return -(byte) keyboard_matrix_row::ch -(byte) keyboard_matrix_row::ch#0 reg byte y 4.0 -(byte) keyboard_matrix_row::return -(byte) keyboard_matrix_row::return#0 reg byte a 4.0 -(byte) keyboard_matrix_row::return#1 reg byte a 1.3333333333333333 -(byte[8]) keyboard_row_bits -(const byte[8]) keyboard_row_bits#0 keyboard_row_bits = { (byte/word/signed word/dword/signed dword) 254, (byte/word/signed word/dword/signed dword) 253, (byte/word/signed word/dword/signed dword) 251, (byte/word/signed word/dword/signed dword) 247, (byte/word/signed word/dword/signed dword) 239, (byte/word/signed word/dword/signed dword) 223, (byte/word/signed word/dword/signed dword) 191, (byte/signed byte/word/signed word/dword/signed dword) 127 } +(byte[8]) keyboard_matrix_row_bitmask +(const byte[8]) keyboard_matrix_row_bitmask#0 keyboard_matrix_row_bitmask = { (byte/word/signed word/dword/signed dword) 254, (byte/word/signed word/dword/signed dword) 253, (byte/word/signed word/dword/signed dword) 251, (byte/word/signed word/dword/signed dword) 247, (byte/word/signed word/dword/signed dword) 239, (byte/word/signed word/dword/signed dword) 223, (byte/word/signed word/dword/signed dword) 191, (byte/signed byte/word/signed word/dword/signed dword) 127 } (void()) main() -(byte~) main::$13 reg byte a 202.0 +(byte~) main::$16 reg byte a 202.0 (byte~) main::$5 reg byte a 2002.0 (label) main::@1 (label) main::@10 (label) main::@11 -(label) main::@12 (label) main::@13 -(label) main::@17 -(label) main::@19 +(label) main::@14 +(label) main::@18 (label) main::@2 (label) main::@20 (label) main::@21 -(label) main::@26 -(label) main::@27 +(label) main::@22 +(label) main::@23 +(label) main::@28 +(label) main::@29 +(label) main::@30 (label) main::@5 (label) main::@6 (label) main::@7 @@ -80,15 +169,19 @@ (label) main::@9 (label) main::@return (byte) main::ch -(byte) main::ch#0 ch zp ZP_BYTE:4 50.5 -(byte[]) main::chars -(const byte[]) main::chars#0 chars = { (byte) '@', (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e' } +(byte) main::ch#1 reg byte x 151.5 +(byte) main::ch#2 reg byte x 28.857142857142858 (byte) main::col (byte) main::col#1 reg byte y 1501.5 (byte) main::col#2 reg byte y 667.3333333333334 (byte) main::i -(byte) main::i#1 reg byte x 151.5 -(byte) main::i#2 reg byte x 56.11111111111111 +(byte) main::i#1 i zp ZP_BYTE:4 202.0 +(byte) main::i#10 i zp ZP_BYTE:4 42.08333333333333 +(byte) main::i#2 i zp ZP_BYTE:4 151.5 +(byte) main::i#4 i zp ZP_BYTE:4 202.0 +(byte) main::i#6 i zp ZP_BYTE:4 168.33333333333331 +(byte) main::key +(byte) main::key#0 reg byte a 151.5 (byte) main::row (byte) main::row#1 reg byte x 151.5 (byte) main::row#2 reg byte x 21.642857142857142 @@ -101,28 +194,26 @@ (byte*) main::sc#2 sc zp ZP_WORD:2 16.5 (byte*) main::screen (byte*) main::screen#1 screen zp ZP_WORD:2 71.0 -(byte*) main::screen#12 screen zp ZP_WORD:2 169.53846153846155 -(byte*) main::screen#2 screen zp ZP_WORD:2 17.75 +(byte*) main::screen#13 screen zp ZP_WORD:2 169.53846153846155 +(byte*) main::screen#2 screen zp ZP_WORD:2 10.142857142857142 -zp ZP_WORD:2 [ main::sc#2 main::sc#1 main::screen#12 main::screen#1 main::screen#2 ] +zp ZP_WORD:2 [ main::sc#2 main::sc#1 main::screen#13 main::screen#1 main::screen#2 ] reg byte x [ main::row#2 main::row#1 ] -zp ZP_BYTE:4 [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 main::ch#0 keyboard_char_pressed::ch#0 ] +zp ZP_BYTE:4 [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 main::i#4 main::i#10 main::i#6 main::i#1 main::i#2 ] reg byte y [ main::col#2 main::col#1 ] -reg byte x [ main::i#2 main::i#1 ] -reg byte a [ keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#1 keyboard_matrix_read::rowid#0 ] -reg byte a [ keyboard_matrix_read::return#0 ] +reg byte x [ main::ch#2 main::ch#1 ] +reg byte a [ keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#0 keyboard_matrix_read::rowid#1 ] +reg byte a [ keyboard_matrix_read::return#3 ] reg byte a [ main::$5 ] -reg byte a [ keyboard_char_pressed::return#0 ] -reg byte a [ main::$13 ] -reg byte y [ keyboard_matrix_row::ch#0 ] -reg byte a [ keyboard_matrix_row::return#0 ] -reg byte a [ keyboard_matrix_read::return#1 ] -zp ZP_BYTE:5 [ keyboard_char_pressed::$1 ] -reg byte y [ keyboard_matrix_col::ch#0 ] -reg byte a [ keyboard_matrix_col::return#0 ] -reg byte a [ keyboard_char_pressed::$2 ] -reg byte a [ keyboard_char_pressed::return#1 ] -reg byte a [ keyboard_matrix_col::col_id#0 ] -reg byte a [ keyboard_matrix_col::return#1 ] +reg byte x [ keyboard_get_keycode::ch#0 ] +reg byte a [ keyboard_get_keycode::return#2 ] +reg byte a [ main::key#0 ] +zp ZP_BYTE:5 [ keyboard_key_pressed::key#0 ] +reg byte a [ keyboard_key_pressed::return#2 ] +reg byte a [ main::$16 ] reg byte a [ keyboard_matrix_read::return#2 ] -reg byte a [ keyboard_matrix_row::return#1 ] +zp ZP_BYTE:6 [ keyboard_key_pressed::$1 ] +reg byte a [ keyboard_key_pressed::$2 ] +reg byte a [ keyboard_key_pressed::return#0 ] +reg byte a [ keyboard_matrix_read::return#0 ] +reg byte a [ keyboard_get_keycode::return#0 ]