mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-11-14 23:04:57 +00:00
Added progress while generating sines
This commit is contained in:
parent
3569405dc1
commit
5b070b5a27
@ -1,5 +1,7 @@
|
||||
package dk.camelot64.kickc.model;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Type inference of expressions (rValues & unary/binary operators)
|
||||
*/
|
||||
@ -308,10 +310,14 @@ public class SymbolTypeInference {
|
||||
} else {
|
||||
// element type already defined - check for a match
|
||||
if(!typeMatch(elmType, type)) {
|
||||
if(typeMatch(type, elmType)) {
|
||||
elmType = type;
|
||||
} else {
|
||||
throw new RuntimeException("Array element has type mismatch " + elm.toString() + " not matching type " + elmType.getTypeName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(elmType!=null) {
|
||||
return new SymbolTypeArray(elmType);
|
||||
} else {
|
||||
@ -344,9 +350,18 @@ public class SymbolTypeInference {
|
||||
if (lValueType.equals(rValueType)) {
|
||||
// Types match directly
|
||||
return true;
|
||||
} else if (rValueType instanceof SymbolTypeInline && ((SymbolTypeInline) rValueType).getTypes().contains(lValueType)) {
|
||||
} else if (rValueType instanceof SymbolTypeInline) {
|
||||
if(lValueType instanceof SymbolTypeInline) {
|
||||
// Both are inline types - RValue type must be superset of LValue
|
||||
Collection<SymbolTypeInteger> lValueTypes = ((SymbolTypeInline) lValueType).getTypes();
|
||||
Collection<SymbolTypeInteger> rValueTypes = ((SymbolTypeInline) rValueType).getTypes();
|
||||
if(rValueTypes.containsAll(lValueTypes)) {
|
||||
return true;
|
||||
}
|
||||
} else if (((SymbolTypeInline) rValueType).getTypes().contains(lValueType)) {
|
||||
// Types match because the right side is a constant that matches the left side
|
||||
return true;
|
||||
}
|
||||
} else if (lValueType instanceof SymbolTypePointer && rValueType instanceof SymbolTypePointer) {
|
||||
return typeMatch(((SymbolTypePointer) lValueType).getElementType(), ((SymbolTypePointer) rValueType).getElementType());
|
||||
} else if (SymbolType.STRING.equals(rValueType)) {
|
||||
|
@ -93,8 +93,8 @@ public class Pass2ConstantIdentification extends Pass2SsaOptimization {
|
||||
if (elementType == null) {
|
||||
elementType = type;
|
||||
} else {
|
||||
if (!elementType.equals(type)) {
|
||||
throw new RuntimeException("Array type mismatch " + elementType + "!=" + type + " " + valueArray.toString(getProgram()));
|
||||
if (!SymbolTypeInference.typeMatch(type, elementType)) {
|
||||
throw new RuntimeException("Array type mismatch " + elementType + " does not match " + type + " " + valueArray.toString(getProgram()));
|
||||
}
|
||||
}
|
||||
elements.add(constantValue);
|
||||
|
@ -124,7 +124,8 @@ public class Pass3LiveRangesAnalysis extends Pass2Base {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException("Never occurs!");
|
||||
// Do nothing
|
||||
// getLog().append("Not propagating "+aliveVar.toString(getProgram()) +" in BEFORE_METHOD case from "+stmt.toString(getProgram(), false)+ " to "+previousStmt.getStatement().toString(getProgram(), false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
.const PROCPORT = 1
|
||||
.const CHARGEN = $d000
|
||||
.const SCREEN = $400
|
||||
.const COLS = $d800
|
||||
.const RASTER = $d012
|
||||
.const BORDERCOL = $d020
|
||||
.const SPRITES_XPOS = $d000
|
||||
@ -19,6 +20,8 @@
|
||||
.const sinlen_y = $c5
|
||||
.const sintab_y = $1100
|
||||
.const sprites = $2000
|
||||
.label progress_idx = 4
|
||||
.label progress_cursor = 9
|
||||
.label sin_idx_x = 2
|
||||
.label sin_idx_y = 3
|
||||
jsr main
|
||||
@ -97,6 +100,52 @@ anim: {
|
||||
rts
|
||||
}
|
||||
init: {
|
||||
jsr clear_screen
|
||||
ldx #0
|
||||
b1:
|
||||
lda #0
|
||||
sta COLS,x
|
||||
lda #$b
|
||||
sta COLS+$28,x
|
||||
inx
|
||||
cpx #$28
|
||||
bne b1
|
||||
jsr place_sprites
|
||||
jsr gen_sprites
|
||||
lda #<SCREEN
|
||||
sta progress_init.line
|
||||
lda #>SCREEN
|
||||
sta progress_init.line+1
|
||||
jsr progress_init
|
||||
lda #<sintab_x
|
||||
sta gen_sintab.sintab
|
||||
lda #>sintab_x
|
||||
sta gen_sintab.sintab+1
|
||||
lda #sinlen_x
|
||||
sta gen_sintab.length
|
||||
lda #$10
|
||||
sta gen_sintab.min
|
||||
ldx #$ff
|
||||
jsr gen_sintab
|
||||
lda #<SCREEN+$28
|
||||
sta progress_init.line
|
||||
lda #>SCREEN+$28
|
||||
sta progress_init.line+1
|
||||
jsr progress_init
|
||||
lda #<sintab_y
|
||||
sta gen_sintab.sintab
|
||||
lda #>sintab_y
|
||||
sta gen_sintab.sintab+1
|
||||
lda #sinlen_y
|
||||
sta gen_sintab.length
|
||||
lda #$30
|
||||
sta gen_sintab.min
|
||||
ldx #$d0
|
||||
jsr gen_sintab
|
||||
jsr clear_screen
|
||||
rts
|
||||
}
|
||||
clear_screen: {
|
||||
.label sc = 7
|
||||
lda #<SCREEN
|
||||
sta sc
|
||||
@ -118,37 +167,15 @@ init: {
|
||||
cmp #<SCREEN+$3e8
|
||||
bcc b1
|
||||
!:
|
||||
jsr place_sprites
|
||||
jsr gen_sprites
|
||||
lda #<sintab_x
|
||||
sta gen_sintab.sintab
|
||||
lda #>sintab_x
|
||||
sta gen_sintab.sintab+1
|
||||
lda #sinlen_x
|
||||
sta gen_sintab.length
|
||||
lda #$10
|
||||
sta gen_sintab.min
|
||||
ldx #$ff
|
||||
jsr gen_sintab
|
||||
lda #<sintab_y
|
||||
sta gen_sintab.sintab
|
||||
lda #>sintab_y
|
||||
sta gen_sintab.sintab+1
|
||||
lda #sinlen_y
|
||||
sta gen_sintab.length
|
||||
lda #$30
|
||||
sta gen_sintab.min
|
||||
ldx #$d0
|
||||
jsr gen_sintab
|
||||
rts
|
||||
}
|
||||
gen_sintab: {
|
||||
.const f_2pi = $e2e5
|
||||
.label _0 = $b
|
||||
.label _3 = $b
|
||||
.label _13 = $b
|
||||
.label _17 = $b
|
||||
.label _23 = $b
|
||||
.label _0 = $d
|
||||
.label _3 = $d
|
||||
.label _13 = $d
|
||||
.label _17 = $d
|
||||
.label _23 = $d
|
||||
.label i = 2
|
||||
.label min = 2
|
||||
.label length = 3
|
||||
@ -204,6 +231,7 @@ gen_sintab: {
|
||||
sta setMEMtoFAC.mem+1
|
||||
jsr setMEMtoFAC
|
||||
lda #0
|
||||
sta progress_idx
|
||||
sta i
|
||||
b1:
|
||||
lda i
|
||||
@ -246,7 +274,7 @@ gen_sintab: {
|
||||
lda _23
|
||||
ldy i
|
||||
sta (sintab),y
|
||||
inc BORDERCOL
|
||||
jsr progress_inc
|
||||
inc i
|
||||
lda i
|
||||
cmp length
|
||||
@ -256,9 +284,31 @@ gen_sintab: {
|
||||
f_min: .byte 0, 0, 0, 0, 0
|
||||
f_amp: .byte 0, 0, 0, 0, 0
|
||||
}
|
||||
progress_inc: {
|
||||
inc progress_idx
|
||||
lda progress_idx
|
||||
cmp #8
|
||||
bne b1
|
||||
lda progress_chars+8
|
||||
ldy #0
|
||||
sta (progress_cursor),y
|
||||
inc progress_cursor
|
||||
bne !+
|
||||
inc progress_cursor+1
|
||||
!:
|
||||
lda #0
|
||||
sta progress_idx
|
||||
b1:
|
||||
ldx progress_idx
|
||||
lda progress_chars,x
|
||||
ldy #0
|
||||
sta (progress_cursor),y
|
||||
rts
|
||||
progress_chars: .byte $20, $65, $74, $75, $61, $f6, $e7, $ea, $e0
|
||||
}
|
||||
getFAC: {
|
||||
.label w = $b
|
||||
.label return = $b
|
||||
.label w = $d
|
||||
.label return = $d
|
||||
jsr $b1aa
|
||||
sty $fe
|
||||
sta $ff
|
||||
@ -271,7 +321,7 @@ getFAC: {
|
||||
rts
|
||||
}
|
||||
addMEMtoFAC: {
|
||||
.label mem = 9
|
||||
.label mem = $b
|
||||
jsr prepareMEM
|
||||
lda $fe
|
||||
ldy $ff
|
||||
@ -279,7 +329,7 @@ addMEMtoFAC: {
|
||||
rts
|
||||
}
|
||||
prepareMEM: {
|
||||
.label mem = 9
|
||||
.label mem = $b
|
||||
lda mem
|
||||
sta memLo
|
||||
lda mem+1
|
||||
@ -287,7 +337,7 @@ prepareMEM: {
|
||||
rts
|
||||
}
|
||||
mulFACbyMEM: {
|
||||
.label mem = 9
|
||||
.label mem = $b
|
||||
jsr prepareMEM
|
||||
lda $fe
|
||||
ldy $ff
|
||||
@ -299,7 +349,7 @@ sinFAC: {
|
||||
rts
|
||||
}
|
||||
divMEMbyFAC: {
|
||||
.label mem = 9
|
||||
.label mem = $b
|
||||
jsr prepareMEM
|
||||
lda $fe
|
||||
ldy $ff
|
||||
@ -307,8 +357,8 @@ divMEMbyFAC: {
|
||||
rts
|
||||
}
|
||||
setFAC: {
|
||||
.label _0 = 9
|
||||
.label w = $b
|
||||
.label _0 = $b
|
||||
.label w = $d
|
||||
lda w
|
||||
sta _0
|
||||
lda w+1
|
||||
@ -320,7 +370,7 @@ setFAC: {
|
||||
rts
|
||||
}
|
||||
setMEMtoFAC: {
|
||||
.label mem = 9
|
||||
.label mem = $b
|
||||
jsr prepareMEM
|
||||
ldx $fe
|
||||
ldy $ff
|
||||
@ -335,6 +385,10 @@ setARGtoFAC: {
|
||||
jsr $bc0f
|
||||
rts
|
||||
}
|
||||
progress_init: {
|
||||
.label line = 9
|
||||
rts
|
||||
}
|
||||
gen_sprites: {
|
||||
.label spr = 7
|
||||
.label i = 2
|
||||
@ -368,12 +422,12 @@ gen_sprites: {
|
||||
cml: .text "camelot"
|
||||
}
|
||||
gen_chargen_sprite: {
|
||||
.label _0 = $b
|
||||
.label _1 = $b
|
||||
.label _0 = $d
|
||||
.label _1 = $d
|
||||
.label sprite = 9
|
||||
.label chargen = $e
|
||||
.label chargen = $b
|
||||
.label bits = 4
|
||||
.label s_gen = $d
|
||||
.label s_gen = $f
|
||||
.label x = 5
|
||||
.label y = 3
|
||||
.label c = 6
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,10 +1,12 @@
|
||||
(label) @39
|
||||
(label) @42
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) BORDERCOL
|
||||
(const byte*) BORDERCOL#0 BORDERCOL = ((byte*))(word) 53280
|
||||
(byte*) CHARGEN
|
||||
(const byte*) CHARGEN#0 CHARGEN = ((byte*))(word) 53248
|
||||
(byte*) COLS
|
||||
(const byte*) COLS#0 COLS = ((byte*))(word) 55296
|
||||
(byte*) PROCPORT
|
||||
(const byte*) PROCPORT#0 PROCPORT = ((byte*))(byte/signed byte/word/signed word) 1
|
||||
(byte*) RASTER
|
||||
@ -27,7 +29,7 @@
|
||||
(label) addMEMtoFAC::@1
|
||||
(label) addMEMtoFAC::@return
|
||||
(byte*) addMEMtoFAC::mem
|
||||
(byte*) addMEMtoFAC::mem#2 mem zp ZP_PTR_BYTE:9 2.0
|
||||
(byte*) addMEMtoFAC::mem#2 mem zp ZP_PTR_BYTE:11 2.0
|
||||
(void()) anim()
|
||||
(byte~) anim::$0 reg byte a 202.0
|
||||
(byte~) anim::$1 reg byte a 202.0
|
||||
@ -61,14 +63,20 @@
|
||||
(byte) anim::yidx#2 yidx zp ZP_BYTE:5 202.0
|
||||
(byte) anim::yidx#3 yidx zp ZP_BYTE:5 33.888888888888886
|
||||
(byte) anim::yidx#6 yidx zp ZP_BYTE:5 60.599999999999994
|
||||
(void()) clear_screen()
|
||||
(label) clear_screen::@1
|
||||
(label) clear_screen::@return
|
||||
(byte*) clear_screen::sc
|
||||
(byte*) clear_screen::sc#1 sc zp ZP_PTR_BYTE:7 16.5
|
||||
(byte*) clear_screen::sc#2 sc zp ZP_PTR_BYTE:7 16.5
|
||||
(void()) divMEMbyFAC((byte*) divMEMbyFAC::mem)
|
||||
(label) divMEMbyFAC::@1
|
||||
(label) divMEMbyFAC::@return
|
||||
(byte*) divMEMbyFAC::mem
|
||||
(byte*) divMEMbyFAC::mem#2 mem zp ZP_PTR_BYTE:9 2.0
|
||||
(byte*) divMEMbyFAC::mem#2 mem zp ZP_PTR_BYTE:11 2.0
|
||||
(void()) gen_chargen_sprite((byte) gen_chargen_sprite::ch , (byte*) gen_chargen_sprite::sprite)
|
||||
(word~) gen_chargen_sprite::$0 $0 zp ZP_WORD:11 4.0
|
||||
(word~) gen_chargen_sprite::$1 $1 zp ZP_WORD:11 4.0
|
||||
(word~) gen_chargen_sprite::$0 $0 zp ZP_WORD:13 4.0
|
||||
(word~) gen_chargen_sprite::$1 $1 zp ZP_WORD:13 4.0
|
||||
(byte~) gen_chargen_sprite::$4 reg byte a 2002.0
|
||||
(byte~) gen_chargen_sprite::$7 reg byte a 20002.0
|
||||
(label) gen_chargen_sprite::@1
|
||||
@ -94,12 +102,12 @@
|
||||
(byte) gen_chargen_sprite::ch
|
||||
(byte) gen_chargen_sprite::ch#0 reg byte x 6.5
|
||||
(byte*) gen_chargen_sprite::chargen
|
||||
(byte*) gen_chargen_sprite::chargen#0 chargen zp ZP_PTR_BYTE:14 3.678571428571429
|
||||
(byte*) gen_chargen_sprite::chargen#0 chargen zp ZP_PTR_BYTE:11 3.678571428571429
|
||||
(byte) gen_chargen_sprite::s_gen
|
||||
(byte) gen_chargen_sprite::s_gen#1 s_gen zp ZP_BYTE:13 10001.0
|
||||
(byte) gen_chargen_sprite::s_gen#3 s_gen zp ZP_BYTE:13 21003.0
|
||||
(byte) gen_chargen_sprite::s_gen#5 s_gen zp ZP_BYTE:13 400.4
|
||||
(byte) gen_chargen_sprite::s_gen#6 s_gen zp ZP_BYTE:13 3500.5
|
||||
(byte) gen_chargen_sprite::s_gen#1 s_gen zp ZP_BYTE:15 10001.0
|
||||
(byte) gen_chargen_sprite::s_gen#3 s_gen zp ZP_BYTE:15 21003.0
|
||||
(byte) gen_chargen_sprite::s_gen#5 s_gen zp ZP_BYTE:15 400.4
|
||||
(byte) gen_chargen_sprite::s_gen#6 s_gen zp ZP_BYTE:15 3500.5
|
||||
(byte) gen_chargen_sprite::s_gen_cnt
|
||||
(byte) gen_chargen_sprite::s_gen_cnt#1 reg byte y 15001.5
|
||||
(byte) gen_chargen_sprite::s_gen_cnt#3 reg byte y 7001.0
|
||||
@ -120,12 +128,12 @@
|
||||
(byte) gen_chargen_sprite::y#1 y zp ZP_BYTE:3 151.5
|
||||
(byte) gen_chargen_sprite::y#2 y zp ZP_BYTE:3 13.173913043478262
|
||||
(void()) gen_sintab((byte*) gen_sintab::sintab , (byte) gen_sintab::length , (byte) gen_sintab::min , (byte) gen_sintab::max)
|
||||
(word~) gen_sintab::$0 $0 zp ZP_WORD:11 4.0
|
||||
(word~) gen_sintab::$13 $13 zp ZP_WORD:11 22.0
|
||||
(word~) gen_sintab::$17 $17 zp ZP_WORD:11 22.0
|
||||
(word~) gen_sintab::$23 $23 zp ZP_WORD:11 22.0
|
||||
(word~) gen_sintab::$0 $0 zp ZP_WORD:13 4.0
|
||||
(word~) gen_sintab::$13 $13 zp ZP_WORD:13 22.0
|
||||
(word~) gen_sintab::$17 $17 zp ZP_WORD:13 22.0
|
||||
(word~) gen_sintab::$23 $23 zp ZP_WORD:13 22.0
|
||||
(byte~) gen_sintab::$24 reg byte a 22.0
|
||||
(word~) gen_sintab::$3 $3 zp ZP_WORD:11 4.0
|
||||
(word~) gen_sintab::$3 $3 zp ZP_WORD:13 4.0
|
||||
(label) gen_sintab::@1
|
||||
(label) gen_sintab::@10
|
||||
(label) gen_sintab::@11
|
||||
@ -139,6 +147,7 @@
|
||||
(label) gen_sintab::@20
|
||||
(label) gen_sintab::@21
|
||||
(label) gen_sintab::@22
|
||||
(label) gen_sintab::@23
|
||||
(label) gen_sintab::@3
|
||||
(label) gen_sintab::@4
|
||||
(label) gen_sintab::@5
|
||||
@ -182,20 +191,23 @@
|
||||
(word()) getFAC()
|
||||
(label) getFAC::@return
|
||||
(word) getFAC::return
|
||||
(word) getFAC::return#0 return zp ZP_WORD:11 4.333333333333333
|
||||
(word) getFAC::return#2 return zp ZP_WORD:11 22.0
|
||||
(word) getFAC::return#0 return zp ZP_WORD:13 4.333333333333333
|
||||
(word) getFAC::return#2 return zp ZP_WORD:13 22.0
|
||||
(word) getFAC::w
|
||||
(word) getFAC::w#1 w zp ZP_WORD:11 4.0
|
||||
(word) getFAC::w#1 w zp ZP_WORD:13 4.0
|
||||
(void()) init()
|
||||
(label) init::@1
|
||||
(label) init::@2
|
||||
(label) init::@3
|
||||
(label) init::@4
|
||||
(label) init::@5
|
||||
(label) init::@6
|
||||
(label) init::@7
|
||||
(label) init::@8
|
||||
(label) init::@9
|
||||
(label) init::@return
|
||||
(byte*) init::sc
|
||||
(byte*) init::sc#1 sc zp ZP_PTR_BYTE:7 16.5
|
||||
(byte*) init::sc#2 sc zp ZP_PTR_BYTE:7 16.5
|
||||
(byte) init::i
|
||||
(byte) init::i#1 reg byte x 16.5
|
||||
(byte) init::i#2 reg byte x 14.666666666666666
|
||||
(void()) main()
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
@ -209,7 +221,7 @@
|
||||
(label) mulFACbyMEM::@1
|
||||
(label) mulFACbyMEM::@return
|
||||
(byte*) mulFACbyMEM::mem
|
||||
(byte*) mulFACbyMEM::mem#2 mem zp ZP_PTR_BYTE:9 2.0
|
||||
(byte*) mulFACbyMEM::mem#2 mem zp ZP_PTR_BYTE:11 2.0
|
||||
(void()) place_sprites()
|
||||
(label) place_sprites::@1
|
||||
(label) place_sprites::@return
|
||||
@ -236,29 +248,49 @@
|
||||
(byte~) prepareMEM::$1 reg byte a 4.0
|
||||
(label) prepareMEM::@return
|
||||
(byte*) prepareMEM::mem
|
||||
(byte*) prepareMEM::mem#0 mem zp ZP_PTR_BYTE:9 4.0
|
||||
(byte*) prepareMEM::mem#1 mem zp ZP_PTR_BYTE:9 4.0
|
||||
(byte*) prepareMEM::mem#2 mem zp ZP_PTR_BYTE:9 4.0
|
||||
(byte*) prepareMEM::mem#3 mem zp ZP_PTR_BYTE:9 4.0
|
||||
(byte*) prepareMEM::mem#4 mem zp ZP_PTR_BYTE:9 4.0
|
||||
(byte*) prepareMEM::mem#5 mem zp ZP_PTR_BYTE:9 4.666666666666666
|
||||
(byte*) prepareMEM::mem#0 mem zp ZP_PTR_BYTE:11 4.0
|
||||
(byte*) prepareMEM::mem#1 mem zp ZP_PTR_BYTE:11 4.0
|
||||
(byte*) prepareMEM::mem#2 mem zp ZP_PTR_BYTE:11 4.0
|
||||
(byte*) prepareMEM::mem#3 mem zp ZP_PTR_BYTE:11 4.0
|
||||
(byte*) prepareMEM::mem#4 mem zp ZP_PTR_BYTE:11 4.0
|
||||
(byte*) prepareMEM::mem#5 mem zp ZP_PTR_BYTE:11 4.666666666666666
|
||||
(byte*) progress_cursor
|
||||
(byte*) progress_cursor#10 progress_cursor zp ZP_PTR_BYTE:9 4.0
|
||||
(byte*) progress_cursor#11 progress_cursor zp ZP_PTR_BYTE:9 2.4285714285714284
|
||||
(byte*) progress_cursor#34 progress_cursor zp ZP_PTR_BYTE:9 0.6551724137931035
|
||||
(byte) progress_idx
|
||||
(byte) progress_idx#10 progress_idx zp ZP_BYTE:4 3.0
|
||||
(byte) progress_idx#12 progress_idx zp ZP_BYTE:4 2.142857142857143
|
||||
(byte) progress_idx#34 progress_idx zp ZP_BYTE:4 0.52
|
||||
(void()) progress_inc()
|
||||
(byte~) progress_inc::$2 reg byte a 4.0
|
||||
(byte~) progress_inc::$3 reg byte a 4.0
|
||||
(label) progress_inc::@1
|
||||
(label) progress_inc::@2
|
||||
(label) progress_inc::@return
|
||||
(byte[]) progress_inc::progress_chars
|
||||
(const byte[]) progress_inc::progress_chars#0 progress_chars = { (byte/signed byte/word/signed word) 32, (byte/signed byte/word/signed word) 101, (byte/signed byte/word/signed word) 116, (byte/signed byte/word/signed word) 117, (byte/signed byte/word/signed word) 97, (byte/word/signed word) 246, (byte/word/signed word) 231, (byte/word/signed word) 234, (byte/word/signed word) 224 }
|
||||
(void()) progress_init((byte*) progress_init::line)
|
||||
(label) progress_init::@return
|
||||
(byte*) progress_init::line
|
||||
(byte*) progress_init::line#2 line zp ZP_PTR_BYTE:9 0.0625
|
||||
(void()) setARGtoFAC()
|
||||
(label) setARGtoFAC::@return
|
||||
(void()) setFAC((word) setFAC::w)
|
||||
(byte*~) setFAC::$0 $0 zp ZP_PTR_BYTE:9 4.0
|
||||
(byte*~) setFAC::$0 $0 zp ZP_PTR_BYTE:11 4.0
|
||||
(label) setFAC::@1
|
||||
(label) setFAC::@return
|
||||
(word) setFAC::w
|
||||
(word) setFAC::w#0 w zp ZP_WORD:11 4.0
|
||||
(word) setFAC::w#1 w zp ZP_WORD:11 4.0
|
||||
(word) setFAC::w#3 w zp ZP_WORD:11 22.0
|
||||
(word) setFAC::w#4 w zp ZP_WORD:11 22.0
|
||||
(word) setFAC::w#5 w zp ZP_WORD:11 28.0
|
||||
(word) setFAC::w#0 w zp ZP_WORD:13 4.0
|
||||
(word) setFAC::w#1 w zp ZP_WORD:13 4.0
|
||||
(word) setFAC::w#3 w zp ZP_WORD:13 22.0
|
||||
(word) setFAC::w#4 w zp ZP_WORD:13 22.0
|
||||
(word) setFAC::w#5 w zp ZP_WORD:13 28.0
|
||||
(void()) setMEMtoFAC((byte*) setMEMtoFAC::mem)
|
||||
(label) setMEMtoFAC::@1
|
||||
(label) setMEMtoFAC::@return
|
||||
(byte*) setMEMtoFAC::mem
|
||||
(byte*) setMEMtoFAC::mem#5 mem zp ZP_PTR_BYTE:9 2.0
|
||||
(byte*) setMEMtoFAC::mem#5 mem zp ZP_PTR_BYTE:11 2.0
|
||||
(void()) sinFAC()
|
||||
(label) sinFAC::@return
|
||||
(byte) sin_idx_x
|
||||
@ -284,15 +316,17 @@
|
||||
|
||||
zp ZP_BYTE:2 [ sin_idx_x#13 sin_idx_x#11 sin_idx_x#3 gen_sintab::min#2 gen_sintab::i#10 gen_sintab::i#1 gen_sprites::i#2 gen_sprites::i#1 place_sprites::spr_id#2 place_sprites::spr_id#1 ]
|
||||
zp ZP_BYTE:3 [ sin_idx_y#13 sin_idx_y#11 sin_idx_y#3 gen_sintab::length#10 gen_chargen_sprite::y#2 gen_chargen_sprite::y#1 place_sprites::spr_x#2 place_sprites::spr_x#1 ]
|
||||
zp ZP_BYTE:4 [ anim::xidx#3 anim::xidx#0 anim::xidx#5 anim::xidx#1 anim::xidx#2 gen_chargen_sprite::bits#2 gen_chargen_sprite::bits#0 gen_chargen_sprite::bits#1 place_sprites::col#2 place_sprites::col#1 ]
|
||||
zp ZP_BYTE:4 [ anim::xidx#3 anim::xidx#0 anim::xidx#5 anim::xidx#1 anim::xidx#2 progress_idx#34 progress_idx#12 progress_idx#10 gen_chargen_sprite::bits#2 gen_chargen_sprite::bits#0 gen_chargen_sprite::bits#1 place_sprites::col#2 place_sprites::col#1 ]
|
||||
reg byte y [ anim::j2#3 anim::j2#2 ]
|
||||
zp ZP_BYTE:5 [ anim::yidx#3 anim::yidx#0 anim::yidx#6 anim::yidx#1 anim::yidx#2 gen_chargen_sprite::x#6 gen_chargen_sprite::x#1 ]
|
||||
zp ZP_BYTE:6 [ anim::j#2 anim::j#1 gen_chargen_sprite::c#3 ]
|
||||
zp ZP_PTR_BYTE:7 [ init::sc#2 init::sc#1 gen_sintab::sintab#12 gen_sprites::spr#2 gen_sprites::spr#1 ]
|
||||
reg byte x [ init::i#2 init::i#1 ]
|
||||
zp ZP_PTR_BYTE:7 [ clear_screen::sc#2 clear_screen::sc#1 gen_sintab::sintab#12 gen_sprites::spr#2 gen_sprites::spr#1 ]
|
||||
reg byte x [ gen_sintab::max#2 ]
|
||||
zp ZP_PTR_BYTE:9 [ addMEMtoFAC::mem#2 prepareMEM::mem#5 prepareMEM::mem#2 prepareMEM::mem#3 prepareMEM::mem#4 prepareMEM::mem#0 prepareMEM::mem#1 mulFACbyMEM::mem#2 divMEMbyFAC::mem#2 setMEMtoFAC::mem#5 gen_chargen_sprite::sprite#3 gen_chargen_sprite::sprite#10 gen_chargen_sprite::sprite#11 gen_chargen_sprite::sprite#0 gen_chargen_sprite::sprite#2 gen_chargen_sprite::sprite#4 gen_chargen_sprite::sprite#1 setFAC::$0 ]
|
||||
zp ZP_WORD:11 [ setFAC::w#5 setFAC::w#0 setFAC::w#3 setFAC::w#4 setFAC::w#1 gen_sintab::$0 gen_sintab::$3 gen_sintab::$13 gen_sintab::$17 getFAC::return#2 gen_sintab::$23 getFAC::w#1 getFAC::return#0 gen_chargen_sprite::$0 gen_chargen_sprite::$1 ]
|
||||
zp ZP_BYTE:13 [ gen_chargen_sprite::s_gen#3 gen_chargen_sprite::s_gen#5 gen_chargen_sprite::s_gen#6 gen_chargen_sprite::s_gen#1 ]
|
||||
zp ZP_PTR_BYTE:9 [ progress_cursor#34 progress_init::line#2 progress_cursor#11 progress_cursor#10 gen_chargen_sprite::sprite#3 gen_chargen_sprite::sprite#10 gen_chargen_sprite::sprite#11 gen_chargen_sprite::sprite#0 gen_chargen_sprite::sprite#2 gen_chargen_sprite::sprite#4 gen_chargen_sprite::sprite#1 ]
|
||||
zp ZP_PTR_BYTE:11 [ addMEMtoFAC::mem#2 prepareMEM::mem#5 prepareMEM::mem#2 prepareMEM::mem#3 prepareMEM::mem#4 prepareMEM::mem#0 prepareMEM::mem#1 mulFACbyMEM::mem#2 divMEMbyFAC::mem#2 setMEMtoFAC::mem#5 setFAC::$0 gen_chargen_sprite::chargen#0 ]
|
||||
zp ZP_WORD:13 [ setFAC::w#5 setFAC::w#0 setFAC::w#3 setFAC::w#4 setFAC::w#1 gen_sintab::$0 gen_sintab::$3 gen_sintab::$13 gen_sintab::$17 getFAC::return#2 gen_sintab::$23 getFAC::w#1 getFAC::return#0 gen_chargen_sprite::$0 gen_chargen_sprite::$1 ]
|
||||
zp ZP_BYTE:15 [ gen_chargen_sprite::s_gen#3 gen_chargen_sprite::s_gen#5 gen_chargen_sprite::s_gen#6 gen_chargen_sprite::s_gen#1 ]
|
||||
reg byte y [ gen_chargen_sprite::s_gen_cnt#3 gen_chargen_sprite::s_gen_cnt#4 gen_chargen_sprite::s_gen_cnt#5 gen_chargen_sprite::s_gen_cnt#1 ]
|
||||
reg byte x [ gen_chargen_sprite::b#2 gen_chargen_sprite::b#1 ]
|
||||
reg byte y [ place_sprites::j#2 place_sprites::j#1 ]
|
||||
@ -301,11 +335,12 @@ reg byte a [ anim::$0 ]
|
||||
reg byte a [ anim::$1 ]
|
||||
reg byte y [ anim::j2#1 ]
|
||||
reg byte a [ gen_sintab::$24 ]
|
||||
reg byte a [ progress_inc::$2 ]
|
||||
reg byte a [ progress_inc::$3 ]
|
||||
reg byte a [ prepareMEM::$0 ]
|
||||
reg byte a [ prepareMEM::$1 ]
|
||||
reg byte a [ gen_sprites::$0 ]
|
||||
reg byte x [ gen_chargen_sprite::ch#0 ]
|
||||
zp ZP_PTR_BYTE:14 [ gen_chargen_sprite::chargen#0 ]
|
||||
reg byte a [ gen_chargen_sprite::$4 ]
|
||||
reg byte a [ gen_chargen_sprite::$7 ]
|
||||
reg byte x [ place_sprites::j2#1 ]
|
||||
|
@ -4,6 +4,7 @@ import "print"
|
||||
const byte* PROCPORT = $01;
|
||||
const byte* CHARGEN = $d000;
|
||||
const byte* SCREEN = $0400;
|
||||
const byte* COLS = $d800;
|
||||
|
||||
const byte* RASTER = $d012;
|
||||
const byte* BORDERCOL = $d020;
|
||||
@ -35,15 +36,52 @@ void main() {
|
||||
}
|
||||
|
||||
void init() {
|
||||
for(byte* sc = SCREEN; sc<SCREEN+1000; sc++) {
|
||||
*sc = ' ';
|
||||
clear_screen();
|
||||
for( byte i : 0..39) {
|
||||
COLS[i] = $0;
|
||||
COLS[40+i] = $b;
|
||||
}
|
||||
place_sprites();
|
||||
gen_sprites();
|
||||
progress_init(SCREEN);
|
||||
gen_sintab(sintab_x, sinlen_x, $10, $ff);
|
||||
progress_init(SCREEN+40);
|
||||
gen_sintab(sintab_y, sinlen_y, $30, $d0);
|
||||
clear_screen();
|
||||
}
|
||||
|
||||
void clear_screen() {
|
||||
for(byte* sc = SCREEN; sc<SCREEN+1000; sc++) {
|
||||
*sc = ' ';
|
||||
}
|
||||
}
|
||||
|
||||
// Current position of the progress cursor
|
||||
byte* progress_cursor = SCREEN;
|
||||
// Current index within the progress cursor (0-7)
|
||||
byte progress_idx = 0;
|
||||
|
||||
// Initialize the PETSCII progress bar
|
||||
void progress_init(byte* line) {
|
||||
progress_cursor = line;
|
||||
progress_idx = 0;
|
||||
}
|
||||
|
||||
// Increase PETSCII progress one bit
|
||||
// Done by increasing the character until the idx is 8 and then moving to the next char
|
||||
void progress_inc() {
|
||||
// Progress characters
|
||||
const byte[] progress_chars = { $20, $65, $74, $75, $61, $f6, $e7, $ea, $e0};
|
||||
progress_idx++;
|
||||
if(progress_idx==8) {
|
||||
*progress_cursor = progress_chars[8];
|
||||
progress_cursor++;
|
||||
progress_idx = 0;
|
||||
}
|
||||
*progress_cursor = progress_chars[progress_idx];
|
||||
}
|
||||
|
||||
|
||||
byte sin_idx_x = 0;
|
||||
byte sin_idx_y = 0;
|
||||
|
||||
@ -179,6 +217,6 @@ void gen_sintab(byte* sintab, byte length, byte min, byte max) {
|
||||
mulFACbyMEM(f_amp); // fac = sin( i * 2 * PI / length ) * (max - min) / 2
|
||||
addMEMtoFAC(f_min); // fac = sin( i * 2 * PI / length ) * (max - min) / 2 + min + (max - min) / 2
|
||||
sintab[i] = (byte)getFAC();
|
||||
(*BORDERCOL)++;
|
||||
progress_inc();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user