mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-12-24 20:32:39 +00:00
Fixed ATASCII newline encoding. Closes #526
This commit is contained in:
parent
5831e8ac26
commit
7c1bed30f2
@ -7,4 +7,5 @@ char * SCREEN = 0x0400;
|
||||
|
||||
void main() {
|
||||
SCREEN[0] = TEXT[13];
|
||||
SCREEN[1] = '\n';
|
||||
}
|
@ -7,9 +7,12 @@ main: {
|
||||
// SCREEN[0] = TEXT[13]
|
||||
lda TEXT+$d
|
||||
sta SCREEN
|
||||
// SCREEN[1] = '\n'
|
||||
.encoding "ascii"
|
||||
lda #'\$9b'
|
||||
sta SCREEN+1
|
||||
// }
|
||||
rts
|
||||
}
|
||||
.encoding "ascii"
|
||||
TEXT: .text @"hello, world!\$9b"
|
||||
.byte 0
|
||||
|
@ -2,7 +2,9 @@
|
||||
(void()) main()
|
||||
main: scope:[main] from
|
||||
[0] *((const byte*) SCREEN) ← *((const byte*) TEXT+(byte) $d)
|
||||
[1] *((const byte*) SCREEN+(byte) 1) ← (byte) '
|
||||
'at
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
[1] return
|
||||
[2] return
|
||||
to:@return
|
||||
|
@ -5,6 +5,8 @@ CONTROL FLOW GRAPH SSA
|
||||
(void()) main()
|
||||
main: scope:[main] from __start::@1
|
||||
*((const byte*) SCREEN + (number) 0) ← *((const byte*) TEXT + (number) $d)
|
||||
*((const byte*) SCREEN + (number) 1) ← (byte) '
|
||||
'at
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
@ -38,13 +40,17 @@ SYMBOL TABLE SSA
|
||||
|
||||
Adding number conversion cast (unumber) $d in *((const byte*) SCREEN + (number) 0) ← *((const byte*) TEXT + (number) $d)
|
||||
Adding number conversion cast (unumber) 0 in *((const byte*) SCREEN + (number) 0) ← *((const byte*) TEXT + (unumber)(number) $d)
|
||||
Adding number conversion cast (unumber) 1 in *((const byte*) SCREEN + (number) 1) ← (byte) '
|
||||
'at
|
||||
Successful SSA optimization PassNAddNumberTypeConversions
|
||||
Simplifying constant pointer cast (byte*) 1024
|
||||
Simplifying constant integer cast $d
|
||||
Simplifying constant integer cast 0
|
||||
Simplifying constant integer cast 1
|
||||
Successful SSA optimization PassNCastSimplification
|
||||
Finalized unsigned number type (byte) $d
|
||||
Finalized unsigned number type (byte) 0
|
||||
Finalized unsigned number type (byte) 1
|
||||
Successful SSA optimization PassNFinalizeNumberTypeConversions
|
||||
Simplifying expression containing zero SCREEN in [0] *((const byte*) SCREEN + (byte) 0) ← *((const byte*) TEXT + (byte) $d)
|
||||
Successful SSA optimization PassNSimplifyExpressionWithZero
|
||||
@ -56,6 +62,7 @@ Removing unused procedure block __start::@2
|
||||
Removing unused procedure block __start::@return
|
||||
Successful SSA optimization PassNEliminateEmptyStart
|
||||
Consolidated array index constant in *(TEXT+$d)
|
||||
Consolidated array index constant in *(SCREEN+1)
|
||||
Successful SSA optimization Pass2ConstantAdditionElimination
|
||||
CALL GRAPH
|
||||
|
||||
@ -67,9 +74,11 @@ FINAL CONTROL FLOW GRAPH
|
||||
(void()) main()
|
||||
main: scope:[main] from
|
||||
[0] *((const byte*) SCREEN) ← *((const byte*) TEXT+(byte) $d)
|
||||
[1] *((const byte*) SCREEN+(byte) 1) ← (byte) '
|
||||
'at
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
[1] return
|
||||
[2] return
|
||||
to:@return
|
||||
|
||||
|
||||
@ -94,26 +103,31 @@ main: {
|
||||
// [0] *((const byte*) SCREEN) ← *((const byte*) TEXT+(byte) $d) -- _deref_pbuc1=_deref_pbuc2
|
||||
lda TEXT+$d
|
||||
sta SCREEN
|
||||
// [1] *((const byte*) SCREEN+(byte) 1) ← (byte) ' 'at -- _deref_pbuc1=vbuc2
|
||||
.encoding "ascii"
|
||||
lda #'\$9b'
|
||||
sta SCREEN+1
|
||||
jmp __breturn
|
||||
// main::@return
|
||||
__breturn:
|
||||
// [1] return
|
||||
// [2] return
|
||||
rts
|
||||
}
|
||||
// File Data
|
||||
.encoding "ascii"
|
||||
TEXT: .text @"hello, world!\$9b"
|
||||
.byte 0
|
||||
|
||||
REGISTER UPLIFT POTENTIAL REGISTERS
|
||||
Statement [0] *((const byte*) SCREEN) ← *((const byte*) TEXT+(byte) $d) [ ] ( [ ] { } ) always clobbers reg byte a
|
||||
Statement [1] *((const byte*) SCREEN+(byte) 1) ← (byte) '
|
||||
'at [ ] ( [ ] { } ) always clobbers reg byte a
|
||||
|
||||
REGISTER UPLIFT SCOPES
|
||||
Uplift Scope [main]
|
||||
Uplift Scope []
|
||||
|
||||
Uplifting [main] best 17 combination
|
||||
Uplifting [] best 17 combination
|
||||
Uplifting [main] best 23 combination
|
||||
Uplifting [] best 23 combination
|
||||
|
||||
ASSEMBLER BEFORE OPTIMIZATION
|
||||
// File Comments
|
||||
@ -129,14 +143,17 @@ main: {
|
||||
// [0] *((const byte*) SCREEN) ← *((const byte*) TEXT+(byte) $d) -- _deref_pbuc1=_deref_pbuc2
|
||||
lda TEXT+$d
|
||||
sta SCREEN
|
||||
// [1] *((const byte*) SCREEN+(byte) 1) ← (byte) ' 'at -- _deref_pbuc1=vbuc2
|
||||
.encoding "ascii"
|
||||
lda #'\$9b'
|
||||
sta SCREEN+1
|
||||
jmp __breturn
|
||||
// main::@return
|
||||
__breturn:
|
||||
// [1] return
|
||||
// [2] return
|
||||
rts
|
||||
}
|
||||
// File Data
|
||||
.encoding "ascii"
|
||||
TEXT: .text @"hello, world!\$9b"
|
||||
.byte 0
|
||||
|
||||
@ -156,7 +173,7 @@ FINAL SYMBOL TABLE
|
||||
|
||||
|
||||
FINAL ASSEMBLER
|
||||
Score: 14
|
||||
Score: 20
|
||||
|
||||
// File Comments
|
||||
// Tests ATASCII encoding
|
||||
@ -172,13 +189,17 @@ main: {
|
||||
// [0] *((const byte*) SCREEN) ← *((const byte*) TEXT+(byte) $d) -- _deref_pbuc1=_deref_pbuc2
|
||||
lda TEXT+$d
|
||||
sta SCREEN
|
||||
// SCREEN[1] = '\n'
|
||||
// [1] *((const byte*) SCREEN+(byte) 1) ← (byte) ' 'at -- _deref_pbuc1=vbuc2
|
||||
.encoding "ascii"
|
||||
lda #'\$9b'
|
||||
sta SCREEN+1
|
||||
// main::@return
|
||||
// }
|
||||
// [1] return
|
||||
// [2] return
|
||||
rts
|
||||
}
|
||||
// File Data
|
||||
.encoding "ascii"
|
||||
TEXT: .text @"hello, world!\$9b"
|
||||
.byte 0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user