1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-23 08:32:39 +00:00

Merge remote-tracking branch 'origin/master'

This commit is contained in:
Jesper Gravgaard 2019-06-11 21:52:37 +02:00
commit 7c4a60aea4
9 changed files with 414 additions and 416 deletions

View File

@ -0,0 +1,6 @@
lda {z2}
and {z3}
sta {z1}
lda {z2}+1
and {z3}+1
sta {z1}+1

View File

@ -0,0 +1,7 @@
lda {z2}
clc
adc {z2}+1
sta {z1}
lda {z2}+1
adc #0
sta {z1}+1

View File

@ -0,0 +1,12 @@
lda {z2}
sta {z1}
lda {z2}+1
sta {z1}+1
cpx #0
beq !e+
!:
lsr {z1}+1
ror {z1}
dex
bne !-
!e:

View File

@ -0,0 +1,12 @@
lda {z2}
sta {z1}
lda {z2}+1
sta {z1}+1
cpy #0
beq !e+
!:
lsr {z1}+1
ror {z1}
dey
bne !-
!e:

View File

@ -90,7 +90,7 @@ word div10(word val){
val = (val >> 1) + 1;
val += val << 1;
val += val >> 4;
val += val >> 4 >> 4; // >> 8 is not supported?
val += val >> 8; // >> 8 is not supported? FIXED!
return val >> 4;
}

View File

@ -563,12 +563,11 @@ append: {
div10: {
.label _0 = $21
.label _2 = $23
.label _3 = 4
.label _4 = $25
.label _5 = $25
.label _3 = $25
.label _4 = 4
.label val = $21
.label val_1 = $23
.label val_2 = 4
.label val_2 = $25
.label val_3 = 4
.label return = 4
.label val_4 = 2
@ -611,27 +610,25 @@ div10: {
lda val_2+1
adc val_1+1
sta val_2+1
sta _4+1
ldy #8
lda val_2
sta _4
ldy #4
lda val_2+1
sta _4+1
cpy #0
beq !e+
!:
lsr _4+1
ror _4
dey
bne !-
ldy #4
!:
lsr _5+1
ror _5
dey
bne !-
!e:
lda val_3
clc
adc _5
adc val_2
sta val_3
lda val_3+1
adc _5+1
adc val_2+1
sta val_3+1
ldy #4
!:

View File

@ -390,57 +390,56 @@ div10: scope:[div10] from main::@6
[185] (word) div10::val#1 ← (word) div10::val#0 + (word~) div10::$2
[186] (word~) div10::$3 ← (word) div10::val#1 >> (byte) 4
[187] (word) div10::val#2 ← (word) div10::val#1 + (word~) div10::$3
[188] (word~) div10::$4 ← (word) div10::val#2 >> (byte) 4
[189] (word~) div10::$5 ← (word~) div10::$4 >> (byte) 4
[190] (word) div10::val#3 ← (word) div10::val#2 + (word~) div10::$5
[191] (word) div10::return#0 ← (word) div10::val#3 >> (byte) 4
[188] (word~) div10::$4 ← (word) div10::val#2 >> (byte) 8
[189] (word) div10::val#3 ← (word) div10::val#2 + (word~) div10::$4
[190] (word) div10::return#0 ← (word) div10::val#3 >> (byte) 4
to:div10::@return
div10::@return: scope:[div10] from div10
[192] return
[191] return
to:@return
div16u: scope:[div16u] from main::@2
[193] (word) divr16u::dividend#1 ← (word) div16u::dividend#0
[194] call divr16u
[195] (word) divr16u::return#2 ← (word) divr16u::return#0
[192] (word) divr16u::dividend#1 ← (word) div16u::dividend#0
[193] call divr16u
[194] (word) divr16u::return#2 ← (word) divr16u::return#0
to:div16u::@1
div16u::@1: scope:[div16u] from div16u
[196] (word) div16u::return#0 ← (word) divr16u::return#2
[195] (word) div16u::return#0 ← (word) divr16u::return#2
to:div16u::@return
div16u::@return: scope:[div16u] from div16u::@1
[197] return
[196] return
to:@return
divr16u: scope:[divr16u] from div16u
[198] phi()
[197] phi()
to:divr16u::@1
divr16u::@1: scope:[divr16u] from divr16u divr16u::@3
[199] (byte) divr16u::i#2 ← phi( divr16u/(byte) 0 divr16u::@3/(byte) divr16u::i#1 )
[199] (word) divr16u::quotient#3 ← phi( divr16u/(byte) 0 divr16u::@3/(word) divr16u::return#0 )
[199] (word) divr16u::dividend#2 ← phi( divr16u/(word) divr16u::dividend#1 divr16u::@3/(word) divr16u::dividend#0 )
[199] (word) divr16u::rem#4 ← phi( divr16u/(byte) 0 divr16u::@3/(word) divr16u::rem#9 )
[200] (word) divr16u::rem#0 ← (word) divr16u::rem#4 << (byte) 1
[201] (byte~) divr16u::$1 ← > (word) divr16u::dividend#2
[202] (byte~) divr16u::$2 ← (byte~) divr16u::$1 & (byte) $80
[203] if((byte~) divr16u::$2==(byte) 0) goto divr16u::@2
[198] (byte) divr16u::i#2 ← phi( divr16u/(byte) 0 divr16u::@3/(byte) divr16u::i#1 )
[198] (word) divr16u::quotient#3 ← phi( divr16u/(byte) 0 divr16u::@3/(word) divr16u::return#0 )
[198] (word) divr16u::dividend#2 ← phi( divr16u/(word) divr16u::dividend#1 divr16u::@3/(word) divr16u::dividend#0 )
[198] (word) divr16u::rem#4 ← phi( divr16u/(byte) 0 divr16u::@3/(word) divr16u::rem#9 )
[199] (word) divr16u::rem#0 ← (word) divr16u::rem#4 << (byte) 1
[200] (byte~) divr16u::$1 ← > (word) divr16u::dividend#2
[201] (byte~) divr16u::$2 ← (byte~) divr16u::$1 & (byte) $80
[202] if((byte~) divr16u::$2==(byte) 0) goto divr16u::@2
to:divr16u::@4
divr16u::@4: scope:[divr16u] from divr16u::@1
[204] (word) divr16u::rem#1 ← (word) divr16u::rem#0 | (byte) 1
[203] (word) divr16u::rem#1 ← (word) divr16u::rem#0 | (byte) 1
to:divr16u::@2
divr16u::@2: scope:[divr16u] from divr16u::@1 divr16u::@4
[205] (word) divr16u::rem#5 ← phi( divr16u::@1/(word) divr16u::rem#0 divr16u::@4/(word) divr16u::rem#1 )
[206] (word) divr16u::dividend#0 ← (word) divr16u::dividend#2 << (byte) 1
[207] (word) divr16u::quotient#1 ← (word) divr16u::quotient#3 << (byte) 1
[208] if((word) divr16u::rem#5<(const word) div16u::divisor#0) goto divr16u::@3
[204] (word) divr16u::rem#5 ← phi( divr16u::@1/(word) divr16u::rem#0 divr16u::@4/(word) divr16u::rem#1 )
[205] (word) divr16u::dividend#0 ← (word) divr16u::dividend#2 << (byte) 1
[206] (word) divr16u::quotient#1 ← (word) divr16u::quotient#3 << (byte) 1
[207] if((word) divr16u::rem#5<(const word) div16u::divisor#0) goto divr16u::@3
to:divr16u::@5
divr16u::@5: scope:[divr16u] from divr16u::@2
[209] (word) divr16u::quotient#2 ← ++ (word) divr16u::quotient#1
[210] (word) divr16u::rem#2 ← (word) divr16u::rem#5 - (const word) div16u::divisor#0
[208] (word) divr16u::quotient#2 ← ++ (word) divr16u::quotient#1
[209] (word) divr16u::rem#2 ← (word) divr16u::rem#5 - (const word) div16u::divisor#0
to:divr16u::@3
divr16u::@3: scope:[divr16u] from divr16u::@2 divr16u::@5
[211] (word) divr16u::return#0 ← phi( divr16u::@2/(word) divr16u::quotient#1 divr16u::@5/(word) divr16u::quotient#2 )
[211] (word) divr16u::rem#9 ← phi( divr16u::@2/(word) divr16u::rem#5 divr16u::@5/(word) divr16u::rem#2 )
[212] (byte) divr16u::i#1 ← ++ (byte) divr16u::i#2
[213] if((byte) divr16u::i#1!=(byte) $10) goto divr16u::@1
[210] (word) divr16u::return#0 ← phi( divr16u::@2/(word) divr16u::quotient#1 divr16u::@5/(word) divr16u::quotient#2 )
[210] (word) divr16u::rem#9 ← phi( divr16u::@2/(word) divr16u::rem#5 divr16u::@5/(word) divr16u::rem#2 )
[211] (byte) divr16u::i#1 ← ++ (byte) divr16u::i#2
[212] if((byte) divr16u::i#1!=(byte) $10) goto divr16u::@1
to:divr16u::@return
divr16u::@return: scope:[divr16u] from divr16u::@3
[214] return
[213] return
to:@return

File diff suppressed because it is too large Load Diff

View File

@ -36,9 +36,8 @@
(word()) div10((word) div10::val)
(word~) div10::$0 $0 zp ZP_WORD:33 4.0
(word~) div10::$2 $2 zp ZP_WORD:35 4.0
(word~) div10::$3 $3 zp ZP_WORD:4 4.0
(word~) div10::$4 $4 zp ZP_WORD:37 4.0
(word~) div10::$5 $5 zp ZP_WORD:37 4.0
(word~) div10::$3 $3 zp ZP_WORD:37 4.0
(word~) div10::$4 $4 zp ZP_WORD:4 4.0
(label) div10::@return
(word) div10::return
(word) div10::return#0 return zp ZP_WORD:4 34.33333333333333
@ -46,7 +45,7 @@
(word) div10::val
(word) div10::val#0 val zp ZP_WORD:33 3.0
(word) div10::val#1 val#1 zp ZP_WORD:35 3.0
(word) div10::val#2 val#2 zp ZP_WORD:4 2.0
(word) div10::val#2 val#2 zp ZP_WORD:37 3.0
(word) div10::val#3 val#3 zp ZP_WORD:4 4.0
(word) div10::val#4 val#4 zp ZP_WORD:2 103.0
(word()) div16u((word) div16u::dividend , (word) div16u::divisor)
@ -303,7 +302,7 @@
(const byte*) zp2#0 zp2 = (byte*) 98
zp ZP_WORD:2 [ main::u#11 main::u#2 myprintf::w1#6 myprintf::w1#0 myprintf::w1#1 div16u::dividend#0 main::u#15 main::u#4 div10::val#4 ]
zp ZP_WORD:4 [ myprintf::w2#7 myprintf::w2#0 myprintf::w2#1 main::v#1 main::v#2 div16u::return#2 div16u::return#0 div10::return#2 div10::return#0 divr16u::quotient#3 divr16u::return#0 divr16u::quotient#1 divr16u::quotient#2 divr16u::return#2 div10::$3 div10::val#2 div10::val#3 ]
zp ZP_WORD:4 [ myprintf::w2#7 myprintf::w2#0 myprintf::w2#1 main::v#1 main::v#2 div16u::return#2 div16u::return#0 div10::return#2 div10::return#0 divr16u::quotient#3 divr16u::return#0 divr16u::quotient#1 divr16u::quotient#2 divr16u::return#2 div10::$4 div10::val#3 ]
zp ZP_WORD:6 [ myprintf::w3#7 myprintf::w3#0 myprintf::w3#1 main::$3 main::$12 main::$2 main::$11 ]
zp ZP_WORD:8 [ myprintf::str#10 myprintf::str#5 myprintf::str#0 ]
zp ZP_BYTE:10 [ myprintf::bFormat#10 myprintf::bFormat#4 ]
@ -341,6 +340,6 @@ reg byte a [ utoa::$16 ]
reg byte a [ utoa::$17 ]
zp ZP_WORD:33 [ div10::$0 div10::val#0 ]
zp ZP_WORD:35 [ div10::$2 div10::val#1 ]
zp ZP_WORD:37 [ div10::$4 div10::$5 ]
zp ZP_WORD:37 [ div10::$3 div10::val#2 ]
reg byte a [ divr16u::$1 ]
reg byte a [ divr16u::$2 ]