mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-10-21 02:24:34 +00:00
Added prime sieve test program
This commit is contained in:
parent
660d2a8979
commit
5a0b1a5d57
53
src/main/kc/stdlib/stdint.kc
Normal file
53
src/main/kc/stdlib/stdint.kc
Normal file
@ -0,0 +1,53 @@
|
||||
// Defines a set of integral type aliases with specific width requirements, along with macros specifying their limits and macro functions to create values of these types.
|
||||
|
||||
// Unsigned integer type with a width of exactly 8 bits
|
||||
typedef unsigned char uint8_t;
|
||||
// Signed integer type with a width of exactly 8 bits
|
||||
typedef signed char int8_t;
|
||||
// Unsigned integer type with a width of exactly 16 bits
|
||||
typedef unsigned int uint16_t;
|
||||
// Sisigned integer type with a width of exactly 16 bits
|
||||
typedef signed int int16_t;
|
||||
// Unsigned integer type with a width of exactly 32 bits
|
||||
typedef unsigned long uint32_t;
|
||||
// Siigned integer type with a width of exactly 32 bits
|
||||
typedef signed long int32_t;
|
||||
// Unsigned integer type with the maximum width supported.
|
||||
typedef unsigned long uintmax_t;
|
||||
// Signed integer type with the maximum width supported.
|
||||
typedef signed long intmax_t;
|
||||
|
||||
//TODO: Convert all limits to macros
|
||||
|
||||
// Minimum value of exactly 8-bit wide unsigned type
|
||||
const uint8_t UINT8_MIN = 0;
|
||||
// Maximum value of exactly 8-bit wide unsigned type
|
||||
const uint8_t UINT8_MAX = 255;
|
||||
// Minimum value of exactly 8-bit wide signed type
|
||||
const int8_t INT8_MIN = -128;
|
||||
// Maximum value of exactly 8-bit wide signed type
|
||||
const int8_t INT8_MAX = 127;
|
||||
// Minimum value of exactly 16-bit wide unsigned type
|
||||
const uint16_t UINT16_MIN = 0;
|
||||
// Maximum value of exactly 16-bit wide unsigned type
|
||||
const uint16_t UINT16_MAX = 65535;
|
||||
// Minimum value of exactly 16-bit wide signed type
|
||||
const int16_t INT16_MIN = -32768;
|
||||
// Maximum value of exactly 16-bit wide signed type
|
||||
const int16_t INT16_MAX = 32767;
|
||||
// Minimum value of exactly 16-bit wide unsigned type
|
||||
const uint32_t UINT32_MIN = 0;
|
||||
// Maximum value of exactly 32-bit wide unsigned type
|
||||
const uint32_t UINT32_MAX = 4194304;
|
||||
// Minimum value of exactly 32-bit wide signed type
|
||||
const int32_t INT32_MIN = -2097152;
|
||||
// Maximum value of exactly 32-bit wide signed type
|
||||
const int32_t INT32_MAX = 2097151;
|
||||
// Minimum value of exactly 16-bit wide unsigned type
|
||||
const uint32_t UINTMAX_MIN = UINT32_MIN;
|
||||
// Maximum value of exactly 32-bit wide unsigned type
|
||||
const uint32_t UINTMAX_MAX = UINT32_MAX;
|
||||
// Minimum value of exactly 32-bit wide signed type
|
||||
const int32_t INTMAX_MIN = INT32_MIN;
|
||||
// Maximum value of exactly 32-bit wide signed type
|
||||
const int32_t INTMAX_MAX = INT32_MAX;
|
@ -35,6 +35,11 @@ public class TestPrograms {
|
||||
public TestPrograms() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSieve() throws IOException, URISyntaxException {
|
||||
compileAndCompare("sieve");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProblemPointerInsideStructSizeofRewriting() throws IOException, URISyntaxException {
|
||||
compileAndCompare("problem-pointer-inside-struct-sizeof-rewriting");
|
||||
|
@ -1,11 +1,10 @@
|
||||
import "print"
|
||||
import "string"
|
||||
import "time"
|
||||
import "stdint"
|
||||
import "division"
|
||||
import "c64"
|
||||
import "print"
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned int uint16_t;
|
||||
|
||||
const char* SCREEN = 0x0400;
|
||||
|
||||
|
775
src/test/ref/sieve.asm
Normal file
775
src/test/ref/sieve.asm
Normal file
@ -0,0 +1,775 @@
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
.label D018 = $d018
|
||||
// CIA #2 Timer A+B Value (32-bit)
|
||||
.label CIA2_TIMER_AB = $dd04
|
||||
// CIA #2 Timer A Control Register
|
||||
.label CIA2_TIMER_A_CONTROL = $dd0e
|
||||
// CIA #2 Timer B Control Register
|
||||
.label CIA2_TIMER_B_CONTROL = $dd0f
|
||||
// Timer Control - Start/stop timer (0:stop, 1: start)
|
||||
.const CIA_TIMER_CONTROL_START = 1
|
||||
// Timer Control - Time CONTINUOUS/ONE-SHOT (0:CONTINUOUS, 1: ONE-SHOT)
|
||||
.const CIA_TIMER_CONTROL_CONTINUOUS = 0
|
||||
// Timer B Control - Timer counts (00:system cycles, 01: CNT pulses, 10: timer A underflow, 11: time A underflow while CNT is high)
|
||||
.const CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A = $40
|
||||
// Clock cycles per frame (on a C64 PAL)
|
||||
.const CLOCKS_PER_FRAME = $4cc8
|
||||
// Frames per second (on a C64 PAL)
|
||||
.const FRAMES_PER_SEC = $3c
|
||||
// Clock cycles used to start & read the cycle clock by calling clock_start() and clock() once. Can be subtracted when calculating the number of cycles used by a routine.
|
||||
// To make precise cycle measurements interrupts and the display must be disabled so neither steals any cycles from the code.
|
||||
.const CLOCKS_PER_INIT = $12
|
||||
.label SCREEN = $400
|
||||
.const COUNT = $4000
|
||||
/* Up to what number? */
|
||||
.const SQRT_COUNT = $80
|
||||
/* Sqrt of COUNT */
|
||||
.label sieve = $1000
|
||||
// Clock cycles per second (on a C64 PAL)
|
||||
.const CLOCKS_PER_SEC = CLOCKS_PER_FRAME*FRAMES_PER_SEC
|
||||
.label rem16u = $1e
|
||||
.label print_char_cursor = $c
|
||||
.label print_line_cursor = $15
|
||||
.label print_char_cursor_62 = $15
|
||||
.label print_char_cursor_99 = $15
|
||||
main: {
|
||||
.label toD0181_gfx = $1800
|
||||
.const toD0181_return = (>(SCREEN&$3fff)*4)|(>toD0181_gfx)/4&$f
|
||||
.label _10 = $18
|
||||
.label _14 = $28
|
||||
.label cyclecount = $18
|
||||
.label sec100s = 6
|
||||
.label i = 2
|
||||
.label sieve_i = 4
|
||||
.label j = 8
|
||||
.label s = $a
|
||||
.label i_3 = 6
|
||||
.label i_10 = 6
|
||||
.label _38 = $2c
|
||||
//Show lower case font
|
||||
lda #toD0181_return
|
||||
sta D018
|
||||
jsr print_cls
|
||||
lda #<$400
|
||||
sta print_char_cursor
|
||||
lda #>$400
|
||||
sta print_char_cursor+1
|
||||
lda #<str
|
||||
sta print_str.str
|
||||
lda #>str
|
||||
sta print_str.str+1
|
||||
jsr print_str
|
||||
lda #<$400
|
||||
sta print_line_cursor
|
||||
lda #>$400
|
||||
sta print_line_cursor+1
|
||||
jsr print_ln
|
||||
lda print_line_cursor
|
||||
sta print_char_cursor
|
||||
lda print_line_cursor+1
|
||||
sta print_char_cursor+1
|
||||
lda #<str1
|
||||
sta print_str.str
|
||||
lda #>str1
|
||||
sta print_str.str+1
|
||||
jsr print_str
|
||||
lda #<COUNT
|
||||
sta print_word_decimal.w
|
||||
lda #>COUNT
|
||||
sta print_word_decimal.w+1
|
||||
jsr print_word_decimal
|
||||
jsr print_ln
|
||||
ldx #0
|
||||
lda #<sieve
|
||||
sta memset.str
|
||||
lda #>sieve
|
||||
sta memset.str+1
|
||||
lda #<COUNT
|
||||
sta memset.num
|
||||
lda #>COUNT
|
||||
sta memset.num+1
|
||||
jsr memset
|
||||
jsr clock_start
|
||||
lda #<sieve+2
|
||||
sta sieve_i
|
||||
lda #>sieve+2
|
||||
sta sieve_i+1
|
||||
lda #<2
|
||||
sta i
|
||||
lda #>2
|
||||
sta i+1
|
||||
b1:
|
||||
lda i+1
|
||||
cmp #>SQRT_COUNT
|
||||
bcs !b2+
|
||||
jmp b2
|
||||
!b2:
|
||||
bne !+
|
||||
lda i
|
||||
cmp #<SQRT_COUNT
|
||||
bcs !b2+
|
||||
jmp b2
|
||||
!b2:
|
||||
!:
|
||||
jsr clock
|
||||
lda cyclecount
|
||||
sec
|
||||
sbc #<CLOCKS_PER_INIT
|
||||
sta cyclecount
|
||||
lda cyclecount+1
|
||||
sbc #>CLOCKS_PER_INIT
|
||||
sta cyclecount+1
|
||||
lda cyclecount+2
|
||||
sbc #<CLOCKS_PER_INIT>>$10
|
||||
sta cyclecount+2
|
||||
lda cyclecount+3
|
||||
sbc #>CLOCKS_PER_INIT>>$10
|
||||
sta cyclecount+3
|
||||
jsr div32u16u
|
||||
lda _14
|
||||
sta sec100s
|
||||
lda _14+1
|
||||
sta sec100s+1
|
||||
lda print_line_cursor
|
||||
sta print_char_cursor
|
||||
lda print_line_cursor+1
|
||||
sta print_char_cursor+1
|
||||
lda #<str2
|
||||
sta print_str.str
|
||||
lda #>str2
|
||||
sta print_str.str+1
|
||||
jsr print_str
|
||||
jsr print_word_decimal
|
||||
lda #<str3
|
||||
sta print_str.str
|
||||
lda #>str3
|
||||
sta print_str.str+1
|
||||
jsr print_str
|
||||
jsr print_dword_decimal
|
||||
jsr print_ln
|
||||
lda #<2
|
||||
sta i_10
|
||||
lda #>2
|
||||
sta i_10+1
|
||||
b8:
|
||||
lda i_10
|
||||
clc
|
||||
adc #<sieve
|
||||
sta _38
|
||||
lda i_10+1
|
||||
adc #>sieve
|
||||
sta _38+1
|
||||
ldy #0
|
||||
lda (_38),y
|
||||
cmp #0
|
||||
bne b29
|
||||
lda print_char_cursor_62
|
||||
sta print_char_cursor
|
||||
lda print_char_cursor_62+1
|
||||
sta print_char_cursor+1
|
||||
jsr print_word_decimal
|
||||
jsr print_char
|
||||
b9:
|
||||
inc i_3
|
||||
bne !+
|
||||
inc i_3+1
|
||||
!:
|
||||
lda i_3+1
|
||||
cmp #>$514
|
||||
bcc b28
|
||||
bne !+
|
||||
lda i_3
|
||||
cmp #<$514
|
||||
bcc b28
|
||||
!:
|
||||
lda #<str4
|
||||
sta print_str.str
|
||||
lda #>str4
|
||||
sta print_str.str+1
|
||||
jsr print_str
|
||||
b12:
|
||||
inc SCREEN+$3e7
|
||||
jmp b12
|
||||
b28:
|
||||
lda print_char_cursor
|
||||
sta print_char_cursor_99
|
||||
lda print_char_cursor+1
|
||||
sta print_char_cursor_99+1
|
||||
jmp b8
|
||||
b29:
|
||||
lda print_char_cursor_62
|
||||
sta print_char_cursor
|
||||
lda print_char_cursor_62+1
|
||||
sta print_char_cursor+1
|
||||
jmp b9
|
||||
b2:
|
||||
ldy #0
|
||||
lda (sieve_i),y
|
||||
cmp #0
|
||||
bne b4
|
||||
lda i
|
||||
asl
|
||||
sta j
|
||||
lda i+1
|
||||
rol
|
||||
sta j+1
|
||||
lda j
|
||||
clc
|
||||
adc #<sieve
|
||||
sta s
|
||||
lda j+1
|
||||
adc #>sieve
|
||||
sta s+1
|
||||
b5:
|
||||
lda j+1
|
||||
cmp #>COUNT
|
||||
bcc b6
|
||||
bne !+
|
||||
lda j
|
||||
cmp #<COUNT
|
||||
bcc b6
|
||||
!:
|
||||
b4:
|
||||
inc i
|
||||
bne !+
|
||||
inc i+1
|
||||
!:
|
||||
inc sieve_i
|
||||
bne !+
|
||||
inc sieve_i+1
|
||||
!:
|
||||
jmp b1
|
||||
b6:
|
||||
lda #1
|
||||
ldy #0
|
||||
sta (s),y
|
||||
lda s
|
||||
clc
|
||||
adc i
|
||||
sta s
|
||||
lda s+1
|
||||
adc i+1
|
||||
sta s+1
|
||||
lda j
|
||||
clc
|
||||
adc i
|
||||
sta j
|
||||
lda j+1
|
||||
adc i+1
|
||||
sta j+1
|
||||
jmp b5
|
||||
str: .text "Sieve benchmark - calculating primes@"
|
||||
str1: .text "between 2 and @"
|
||||
str2: .text "100ths seconds used: @"
|
||||
str3: .text " cycles: @"
|
||||
str4: .text "...@"
|
||||
}
|
||||
// Print a zero-terminated string
|
||||
// print_str(byte* zeropage($e) str)
|
||||
print_str: {
|
||||
.label str = $e
|
||||
b1:
|
||||
ldy #0
|
||||
lda (str),y
|
||||
cmp #'@'
|
||||
bne b2
|
||||
rts
|
||||
b2:
|
||||
ldy #0
|
||||
lda (str),y
|
||||
sta (print_char_cursor),y
|
||||
inc print_char_cursor
|
||||
bne !+
|
||||
inc print_char_cursor+1
|
||||
!:
|
||||
inc str
|
||||
bne !+
|
||||
inc str+1
|
||||
!:
|
||||
jmp b1
|
||||
}
|
||||
// Print a single char
|
||||
print_char: {
|
||||
.const ch = ' '
|
||||
lda #ch
|
||||
ldy #0
|
||||
sta (print_char_cursor),y
|
||||
inc print_char_cursor
|
||||
bne !+
|
||||
inc print_char_cursor+1
|
||||
!:
|
||||
rts
|
||||
}
|
||||
// Print a word as DECIMAL
|
||||
// print_word_decimal(word zeropage(6) w)
|
||||
print_word_decimal: {
|
||||
.label w = 6
|
||||
lda w
|
||||
sta utoa.value
|
||||
lda w+1
|
||||
sta utoa.value+1
|
||||
jsr utoa
|
||||
lda #<decimal_digits
|
||||
sta print_str.str
|
||||
lda #>decimal_digits
|
||||
sta print_str.str+1
|
||||
jsr print_str
|
||||
rts
|
||||
}
|
||||
// Converts unsigned number value to a string representing it in RADIX format.
|
||||
// If the leading digits are zero they are not included in the string.
|
||||
// - value : The number to be converted to RADIX
|
||||
// - buffer : receives the string representing the number and zero-termination.
|
||||
// - radix : The radix to convert the number to (from the enum RADIX)
|
||||
// utoa(word zeropage($11) value, byte* zeropage($13) buffer)
|
||||
utoa: {
|
||||
.const max_digits = 5
|
||||
.label digit_value = $2e
|
||||
.label digit = $10
|
||||
.label value = $11
|
||||
.label buffer = $13
|
||||
lda #<decimal_digits
|
||||
sta buffer
|
||||
lda #>decimal_digits
|
||||
sta buffer+1
|
||||
ldx #0
|
||||
txa
|
||||
sta digit
|
||||
b1:
|
||||
lda digit
|
||||
asl
|
||||
tay
|
||||
lda RADIX_DECIMAL_VALUES,y
|
||||
sta digit_value
|
||||
lda RADIX_DECIMAL_VALUES+1,y
|
||||
sta digit_value+1
|
||||
cpx #0
|
||||
bne b3
|
||||
cmp value+1
|
||||
bne !+
|
||||
lda digit_value
|
||||
cmp value
|
||||
beq b3
|
||||
!:
|
||||
bcc b3
|
||||
b2:
|
||||
inc digit
|
||||
lda digit
|
||||
cmp #max_digits-1
|
||||
bcc b1
|
||||
lda value
|
||||
tay
|
||||
lda DIGITS,y
|
||||
ldy #0
|
||||
sta (buffer),y
|
||||
inc buffer
|
||||
bne !+
|
||||
inc buffer+1
|
||||
!:
|
||||
lda #0
|
||||
tay
|
||||
sta (buffer),y
|
||||
rts
|
||||
b3:
|
||||
jsr utoa_append
|
||||
inc buffer
|
||||
bne !+
|
||||
inc buffer+1
|
||||
!:
|
||||
ldx #1
|
||||
jmp b2
|
||||
}
|
||||
// Used to convert a single digit of an unsigned number value to a string representation
|
||||
// Counts a single digit up from '0' as long as the value is larger than sub.
|
||||
// Each time the digit is increased sub is subtracted from value.
|
||||
// - buffer : pointer to the char that receives the digit
|
||||
// - value : The value where the digit will be derived from
|
||||
// - sub : the value of a '1' in the digit. Subtracted continually while the digit is increased.
|
||||
// (For decimal the subs used are 10000, 1000, 100, 10, 1)
|
||||
// returns : the value reduced by sub * digit so that it is less than sub.
|
||||
// utoa_append(byte* zeropage($13) buffer, word zeropage($11) value, word zeropage($2e) sub)
|
||||
utoa_append: {
|
||||
.label buffer = $13
|
||||
.label value = $11
|
||||
.label sub = $2e
|
||||
.label return = $11
|
||||
ldx #0
|
||||
b1:
|
||||
lda sub+1
|
||||
cmp value+1
|
||||
bne !+
|
||||
lda sub
|
||||
cmp value
|
||||
beq b2
|
||||
!:
|
||||
bcc b2
|
||||
lda DIGITS,x
|
||||
ldy #0
|
||||
sta (buffer),y
|
||||
rts
|
||||
b2:
|
||||
inx
|
||||
lda value
|
||||
sec
|
||||
sbc sub
|
||||
sta value
|
||||
lda value+1
|
||||
sbc sub+1
|
||||
sta value+1
|
||||
jmp b1
|
||||
}
|
||||
// Print a newline
|
||||
print_ln: {
|
||||
b1:
|
||||
lda #$28
|
||||
clc
|
||||
adc print_line_cursor
|
||||
sta print_line_cursor
|
||||
bcc !+
|
||||
inc print_line_cursor+1
|
||||
!:
|
||||
lda print_line_cursor+1
|
||||
cmp print_char_cursor+1
|
||||
bcc b1
|
||||
bne !+
|
||||
lda print_line_cursor
|
||||
cmp print_char_cursor
|
||||
bcc b1
|
||||
!:
|
||||
rts
|
||||
}
|
||||
// Print a dword as DECIMAL
|
||||
// print_dword_decimal(dword zeropage($18) w)
|
||||
print_dword_decimal: {
|
||||
.label w = $18
|
||||
jsr ultoa
|
||||
lda #<decimal_digits_long
|
||||
sta print_str.str
|
||||
lda #>decimal_digits_long
|
||||
sta print_str.str+1
|
||||
jsr print_str
|
||||
rts
|
||||
}
|
||||
// Converts unsigned number value to a string representing it in RADIX format.
|
||||
// If the leading digits are zero they are not included in the string.
|
||||
// - value : The number to be converted to RADIX
|
||||
// - buffer : receives the string representing the number and zero-termination.
|
||||
// - radix : The radix to convert the number to (from the enum RADIX)
|
||||
// ultoa(dword zeropage($18) value, byte* zeropage($1c) buffer)
|
||||
ultoa: {
|
||||
.const max_digits = $a
|
||||
.label digit_value = $30
|
||||
.label digit = $17
|
||||
.label value = $18
|
||||
.label buffer = $1c
|
||||
lda #<decimal_digits_long
|
||||
sta buffer
|
||||
lda #>decimal_digits_long
|
||||
sta buffer+1
|
||||
ldx #0
|
||||
txa
|
||||
sta digit
|
||||
b1:
|
||||
lda digit
|
||||
asl
|
||||
asl
|
||||
tay
|
||||
lda RADIX_DECIMAL_VALUES_LONG,y
|
||||
sta digit_value
|
||||
lda RADIX_DECIMAL_VALUES_LONG+1,y
|
||||
sta digit_value+1
|
||||
lda RADIX_DECIMAL_VALUES_LONG+2,y
|
||||
sta digit_value+2
|
||||
lda RADIX_DECIMAL_VALUES_LONG+3,y
|
||||
sta digit_value+3
|
||||
cpx #0
|
||||
bne b3
|
||||
lda value+3
|
||||
cmp digit_value+3
|
||||
bcc !+
|
||||
bne b3
|
||||
lda value+2
|
||||
cmp digit_value+2
|
||||
bcc !+
|
||||
bne b3
|
||||
lda value+1
|
||||
cmp digit_value+1
|
||||
bcc !+
|
||||
bne b3
|
||||
lda value
|
||||
cmp digit_value
|
||||
bcs b3
|
||||
!:
|
||||
b2:
|
||||
inc digit
|
||||
lda digit
|
||||
cmp #max_digits-1
|
||||
bcc b1
|
||||
lda value
|
||||
tay
|
||||
lda DIGITS,y
|
||||
ldy #0
|
||||
sta (buffer),y
|
||||
inc buffer
|
||||
bne !+
|
||||
inc buffer+1
|
||||
!:
|
||||
lda #0
|
||||
tay
|
||||
sta (buffer),y
|
||||
rts
|
||||
b3:
|
||||
jsr ultoa_append
|
||||
inc buffer
|
||||
bne !+
|
||||
inc buffer+1
|
||||
!:
|
||||
ldx #1
|
||||
jmp b2
|
||||
}
|
||||
// Used to convert a single digit of an unsigned number value to a string representation
|
||||
// Counts a single digit up from '0' as long as the value is larger than sub.
|
||||
// Each time the digit is increased sub is subtracted from value.
|
||||
// - buffer : pointer to the char that receives the digit
|
||||
// - value : The value where the digit will be derived from
|
||||
// - sub : the value of a '1' in the digit. Subtracted continually while the digit is increased.
|
||||
// (For decimal the subs used are 10000, 1000, 100, 10, 1)
|
||||
// returns : the value reduced by sub * digit so that it is less than sub.
|
||||
// ultoa_append(byte* zeropage($1c) buffer, dword zeropage($18) value, dword zeropage($30) sub)
|
||||
ultoa_append: {
|
||||
.label buffer = $1c
|
||||
.label value = $18
|
||||
.label sub = $30
|
||||
.label return = $18
|
||||
ldx #0
|
||||
b1:
|
||||
lda value+3
|
||||
cmp sub+3
|
||||
bcc !+
|
||||
bne b2
|
||||
lda value+2
|
||||
cmp sub+2
|
||||
bcc !+
|
||||
bne b2
|
||||
lda value+1
|
||||
cmp sub+1
|
||||
bcc !+
|
||||
bne b2
|
||||
lda value
|
||||
cmp sub
|
||||
bcs b2
|
||||
!:
|
||||
lda DIGITS,x
|
||||
ldy #0
|
||||
sta (buffer),y
|
||||
rts
|
||||
b2:
|
||||
inx
|
||||
lda value
|
||||
sec
|
||||
sbc sub
|
||||
sta value
|
||||
lda value+1
|
||||
sbc sub+1
|
||||
sta value+1
|
||||
lda value+2
|
||||
sbc sub+2
|
||||
sta value+2
|
||||
lda value+3
|
||||
sbc sub+3
|
||||
sta value+3
|
||||
jmp b1
|
||||
}
|
||||
// Divide unsigned 32-bit dword dividend with a 16-bit word divisor
|
||||
// The 16-bit word remainder can be found in rem16u after the division
|
||||
// div32u16u(dword zeropage($18) dividend)
|
||||
div32u16u: {
|
||||
.label divisor = CLOCKS_PER_SEC/$64
|
||||
.label quotient_hi = $34
|
||||
.label quotient_lo = $22
|
||||
.label return = $28
|
||||
.label dividend = $18
|
||||
lda dividend+2
|
||||
sta divr16u.dividend
|
||||
lda dividend+3
|
||||
sta divr16u.dividend+1
|
||||
lda #<0
|
||||
sta divr16u.rem
|
||||
sta divr16u.rem+1
|
||||
jsr divr16u
|
||||
lda divr16u.return
|
||||
sta quotient_hi
|
||||
lda divr16u.return+1
|
||||
sta quotient_hi+1
|
||||
lda dividend
|
||||
sta divr16u.dividend
|
||||
lda dividend+1
|
||||
sta divr16u.dividend+1
|
||||
jsr divr16u
|
||||
lda quotient_hi
|
||||
sta return+2
|
||||
lda quotient_hi+1
|
||||
sta return+3
|
||||
lda quotient_lo
|
||||
sta return
|
||||
lda quotient_lo+1
|
||||
sta return+1
|
||||
rts
|
||||
}
|
||||
// Performs division on two 16 bit unsigned words and an initial remainder
|
||||
// Returns the quotient dividend/divisor.
|
||||
// The final remainder will be set into the global variable rem16u
|
||||
// Implemented using simple binary division
|
||||
// divr16u(word zeropage($20) dividend, word zeropage($1e) rem)
|
||||
divr16u: {
|
||||
.label rem = $1e
|
||||
.label dividend = $20
|
||||
.label quotient = $22
|
||||
.label return = $22
|
||||
ldx #0
|
||||
txa
|
||||
sta quotient
|
||||
sta quotient+1
|
||||
b1:
|
||||
asl rem
|
||||
rol rem+1
|
||||
lda dividend+1
|
||||
and #$80
|
||||
cmp #0
|
||||
beq b2
|
||||
lda #1
|
||||
ora rem
|
||||
sta rem
|
||||
b2:
|
||||
asl dividend
|
||||
rol dividend+1
|
||||
asl quotient
|
||||
rol quotient+1
|
||||
lda rem+1
|
||||
cmp #>div32u16u.divisor
|
||||
bcc b3
|
||||
bne !+
|
||||
lda rem
|
||||
cmp #<div32u16u.divisor
|
||||
bcc b3
|
||||
!:
|
||||
inc quotient
|
||||
bne !+
|
||||
inc quotient+1
|
||||
!:
|
||||
lda rem
|
||||
sec
|
||||
sbc #<div32u16u.divisor
|
||||
sta rem
|
||||
lda rem+1
|
||||
sbc #>div32u16u.divisor
|
||||
sta rem+1
|
||||
b3:
|
||||
inx
|
||||
cpx #$10
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Returns the processor clock time used since the beginning of an implementation defined era (normally the beginning of the program).
|
||||
// This uses CIA #2 Timer A+B on the C64, and must be initialized using clock_start()
|
||||
clock: {
|
||||
.label return = $18
|
||||
lda #<$ffffffff
|
||||
sec
|
||||
sbc CIA2_TIMER_AB
|
||||
sta return
|
||||
lda #>$ffffffff
|
||||
sbc CIA2_TIMER_AB+1
|
||||
sta return+1
|
||||
lda #<$ffffffff>>$10
|
||||
sbc CIA2_TIMER_AB+2
|
||||
sta return+2
|
||||
lda #>$ffffffff>>$10
|
||||
sbc CIA2_TIMER_AB+3
|
||||
sta return+3
|
||||
rts
|
||||
}
|
||||
// Reset & start the processor clock time. The value can be read using clock().
|
||||
// This uses CIA #2 Timer A+B on the C64
|
||||
clock_start: {
|
||||
// Setup CIA#2 timer A to count (down) CPU cycles
|
||||
lda #CIA_TIMER_CONTROL_CONTINUOUS
|
||||
sta CIA2_TIMER_A_CONTROL
|
||||
lda #CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A
|
||||
sta CIA2_TIMER_B_CONTROL
|
||||
lda #<$ffffffff
|
||||
sta CIA2_TIMER_AB
|
||||
lda #>$ffffffff
|
||||
sta CIA2_TIMER_AB+1
|
||||
lda #<$ffffffff>>$10
|
||||
sta CIA2_TIMER_AB+2
|
||||
lda #>$ffffffff>>$10
|
||||
sta CIA2_TIMER_AB+3
|
||||
lda #CIA_TIMER_CONTROL_START|CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A
|
||||
sta CIA2_TIMER_B_CONTROL
|
||||
lda #CIA_TIMER_CONTROL_START
|
||||
sta CIA2_TIMER_A_CONTROL
|
||||
rts
|
||||
}
|
||||
// Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str.
|
||||
// memset(void* zeropage($26) str, byte register(X) c, word zeropage($24) num)
|
||||
memset: {
|
||||
.label end = $24
|
||||
.label dst = $26
|
||||
.label num = $24
|
||||
.label str = $26
|
||||
lda num
|
||||
bne !+
|
||||
lda num+1
|
||||
beq breturn
|
||||
!:
|
||||
lda end
|
||||
clc
|
||||
adc str
|
||||
sta end
|
||||
lda end+1
|
||||
adc str+1
|
||||
sta end+1
|
||||
b2:
|
||||
txa
|
||||
ldy #0
|
||||
sta (dst),y
|
||||
inc dst
|
||||
bne !+
|
||||
inc dst+1
|
||||
!:
|
||||
lda dst+1
|
||||
cmp end+1
|
||||
bne b2
|
||||
lda dst
|
||||
cmp end
|
||||
bne b2
|
||||
breturn:
|
||||
rts
|
||||
}
|
||||
// Clear the screen. Also resets current line/char cursor.
|
||||
print_cls: {
|
||||
ldx #' '
|
||||
lda #<$400
|
||||
sta memset.str
|
||||
lda #>$400
|
||||
sta memset.str+1
|
||||
lda #<$3e8
|
||||
sta memset.num
|
||||
lda #>$3e8
|
||||
sta memset.num+1
|
||||
jsr memset
|
||||
rts
|
||||
}
|
||||
// The digits used for numbers
|
||||
DIGITS: .text "0123456789abcdef"
|
||||
// Values of decimal digits
|
||||
RADIX_DECIMAL_VALUES: .word $2710, $3e8, $64, $a
|
||||
// Values of decimal digits
|
||||
RADIX_DECIMAL_VALUES_LONG: .dword $3b9aca00, $5f5e100, $989680, $f4240, $186a0, $2710, $3e8, $64, $a
|
||||
// Digits used for storing the decimal word
|
||||
decimal_digits: .fill 6, 0
|
||||
// Digits used for storing the decimal word
|
||||
decimal_digits_long: .fill $b, 0
|
419
src/test/ref/sieve.cfg
Normal file
419
src/test/ref/sieve.cfg
Normal file
@ -0,0 +1,419 @@
|
||||
@begin: scope:[] from
|
||||
[0] phi()
|
||||
to:@1
|
||||
@1: scope:[] from @begin
|
||||
[1] phi()
|
||||
[2] call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
[3] phi()
|
||||
main: scope:[main] from @1
|
||||
[4] phi()
|
||||
to:main::toD0181
|
||||
main::toD0181: scope:[main] from main
|
||||
[5] phi()
|
||||
to:main::@13
|
||||
main::@13: scope:[main] from main::toD0181
|
||||
[6] *((const byte*) D018#0) ← (const byte) main::toD0181_return#0
|
||||
[7] call print_cls
|
||||
to:main::@14
|
||||
main::@14: scope:[main] from main::@13
|
||||
[8] phi()
|
||||
[9] call print_str
|
||||
to:main::@15
|
||||
main::@15: scope:[main] from main::@14
|
||||
[10] phi()
|
||||
[11] call print_ln
|
||||
to:main::@16
|
||||
main::@16: scope:[main] from main::@15
|
||||
[12] (byte*~) print_char_cursor#89 ← (byte*) print_line_cursor#1
|
||||
[13] call print_str
|
||||
to:main::@17
|
||||
main::@17: scope:[main] from main::@16
|
||||
[14] phi()
|
||||
[15] call print_word_decimal
|
||||
to:main::@18
|
||||
main::@18: scope:[main] from main::@17
|
||||
[16] phi()
|
||||
[17] call print_ln
|
||||
to:main::@19
|
||||
main::@19: scope:[main] from main::@18
|
||||
[18] phi()
|
||||
[19] call memset
|
||||
to:main::@20
|
||||
main::@20: scope:[main] from main::@19
|
||||
[20] phi()
|
||||
[21] call clock_start
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main::@20 main::@4
|
||||
[22] (byte*) main::sieve_i#2 ← phi( main::@20/(const byte*) sieve#0+(byte) 2 main::@4/(byte*) main::sieve_i#1 )
|
||||
[22] (word) main::i#11 ← phi( main::@20/(byte) 2 main::@4/(word) main::i#2 )
|
||||
[23] if((word) main::i#11<(const byte) SQRT_COUNT#0) goto main::@2
|
||||
to:main::@3
|
||||
main::@3: scope:[main] from main::@1
|
||||
[24] phi()
|
||||
[25] call clock
|
||||
[26] (dword) clock::return#2 ← (dword) clock::return#0
|
||||
to:main::@21
|
||||
main::@21: scope:[main] from main::@3
|
||||
[27] (dword~) main::$10 ← (dword) clock::return#2
|
||||
[28] (dword) main::cyclecount#0 ← (dword~) main::$10 - (const dword) CLOCKS_PER_INIT#0
|
||||
[29] (dword) div32u16u::dividend#0 ← (dword) main::cyclecount#0
|
||||
[30] call div32u16u
|
||||
[31] (dword) div32u16u::return#2 ← (dword) div32u16u::return#0
|
||||
to:main::@22
|
||||
main::@22: scope:[main] from main::@21
|
||||
[32] (dword~) main::$14 ← (dword) div32u16u::return#2
|
||||
[33] (word) main::sec100s#0 ← (word)(dword~) main::$14
|
||||
[34] (byte*~) print_char_cursor#90 ← (byte*) print_line_cursor#1
|
||||
[35] call print_str
|
||||
to:main::@23
|
||||
main::@23: scope:[main] from main::@22
|
||||
[36] (word) print_word_decimal::w#1 ← (word) main::sec100s#0
|
||||
[37] call print_word_decimal
|
||||
to:main::@24
|
||||
main::@24: scope:[main] from main::@23
|
||||
[38] phi()
|
||||
[39] call print_str
|
||||
to:main::@25
|
||||
main::@25: scope:[main] from main::@24
|
||||
[40] (dword) print_dword_decimal::w#0 ← (dword) main::cyclecount#0
|
||||
[41] call print_dword_decimal
|
||||
to:main::@26
|
||||
main::@26: scope:[main] from main::@25
|
||||
[42] phi()
|
||||
[43] call print_ln
|
||||
to:main::@8
|
||||
main::@8: scope:[main] from main::@26 main::@28
|
||||
[44] (byte*) print_char_cursor#62 ← phi( main::@28/(byte*~) print_char_cursor#99 main::@26/(byte*) print_line_cursor#1 )
|
||||
[44] (word) main::i#10 ← phi( main::@28/(word) main::i#3 main::@26/(byte) 2 )
|
||||
[45] (byte*~) main::$38 ← (const byte*) sieve#0 + (word) main::i#10
|
||||
[46] if((byte) 0!=*((byte*~) main::$38)) goto main::@29
|
||||
to:main::@10
|
||||
main::@10: scope:[main] from main::@8
|
||||
[47] (word) print_word_decimal::w#2 ← (word) main::i#10
|
||||
[48] (byte*~) print_char_cursor#96 ← (byte*) print_char_cursor#62
|
||||
[49] call print_word_decimal
|
||||
to:main::@27
|
||||
main::@27: scope:[main] from main::@10
|
||||
[50] phi()
|
||||
[51] call print_char
|
||||
to:main::@9
|
||||
main::@9: scope:[main] from main::@27 main::@29
|
||||
[52] (byte*) print_char_cursor#63 ← phi( main::@29/(byte*~) print_char_cursor#101 main::@27/(byte*) print_char_cursor#10 )
|
||||
[53] (word) main::i#3 ← ++ (word) main::i#10
|
||||
[54] if((word) main::i#3<(word) $514) goto main::@28
|
||||
to:main::@11
|
||||
main::@11: scope:[main] from main::@9
|
||||
[55] phi()
|
||||
[56] call print_str
|
||||
to:main::@12
|
||||
main::@12: scope:[main] from main::@11 main::@12
|
||||
[57] *((const byte*) SCREEN#0+(word) $3e7) ← ++ *((const byte*) SCREEN#0+(word) $3e7)
|
||||
to:main::@12
|
||||
main::@28: scope:[main] from main::@9
|
||||
[58] (byte*~) print_char_cursor#99 ← (byte*) print_char_cursor#63
|
||||
to:main::@8
|
||||
main::@29: scope:[main] from main::@8
|
||||
[59] (byte*~) print_char_cursor#101 ← (byte*) print_char_cursor#62
|
||||
to:main::@9
|
||||
main::@2: scope:[main] from main::@1
|
||||
[60] if((byte) 0!=*((byte*) main::sieve_i#2)) goto main::@4
|
||||
to:main::@7
|
||||
main::@7: scope:[main] from main::@2
|
||||
[61] (word) main::j#0 ← (word) main::i#11 << (byte) 1
|
||||
[62] (byte*) main::s#0 ← (const byte*) sieve#0 + (word) main::j#0
|
||||
to:main::@5
|
||||
main::@5: scope:[main] from main::@6 main::@7
|
||||
[63] (byte*) main::s#2 ← phi( main::@7/(byte*) main::s#0 main::@6/(byte*) main::s#1 )
|
||||
[63] (word) main::j#2 ← phi( main::@7/(word) main::j#0 main::@6/(word) main::j#1 )
|
||||
[64] if((word) main::j#2<(const word) COUNT#0) goto main::@6
|
||||
to:main::@4
|
||||
main::@4: scope:[main] from main::@2 main::@5
|
||||
[65] (word) main::i#2 ← ++ (word) main::i#11
|
||||
[66] (byte*) main::sieve_i#1 ← ++ (byte*) main::sieve_i#2
|
||||
to:main::@1
|
||||
main::@6: scope:[main] from main::@5
|
||||
[67] *((byte*) main::s#2) ← (byte) 1
|
||||
[68] (byte*) main::s#1 ← (byte*) main::s#2 + (word) main::i#11
|
||||
[69] (word) main::j#1 ← (word) main::j#2 + (word) main::i#11
|
||||
to:main::@5
|
||||
print_str: scope:[print_str] from main::@11 main::@14 main::@16 main::@22 main::@24 print_dword_decimal::@1 print_word_decimal::@1
|
||||
[70] (byte*) print_char_cursor#66 ← phi( main::@11/(byte*) print_char_cursor#63 main::@14/(byte*) 1024 main::@16/(byte*~) print_char_cursor#89 main::@22/(byte*~) print_char_cursor#90 main::@24/(byte*) print_char_cursor#2 print_dword_decimal::@1/(byte*) print_char_cursor#2 print_word_decimal::@1/(byte*) print_char_cursor#58 )
|
||||
[70] (byte*) print_str::str#10 ← phi( main::@11/(const string) main::str4 main::@14/(const string) main::str main::@16/(const string) main::str1 main::@22/(const string) main::str2 main::@24/(const string) main::str3 print_dword_decimal::@1/(const byte[$b]) decimal_digits_long#0 print_word_decimal::@1/(const byte[6]) decimal_digits#0 )
|
||||
to:print_str::@1
|
||||
print_str::@1: scope:[print_str] from print_str print_str::@2
|
||||
[71] (byte*) print_char_cursor#2 ← phi( print_str/(byte*) print_char_cursor#66 print_str::@2/(byte*) print_char_cursor#1 )
|
||||
[71] (byte*) print_str::str#8 ← phi( print_str/(byte*) print_str::str#10 print_str::@2/(byte*) print_str::str#0 )
|
||||
[72] if(*((byte*) print_str::str#8)!=(byte) '@') goto print_str::@2
|
||||
to:print_str::@return
|
||||
print_str::@return: scope:[print_str] from print_str::@1
|
||||
[73] return
|
||||
to:@return
|
||||
print_str::@2: scope:[print_str] from print_str::@1
|
||||
[74] *((byte*) print_char_cursor#2) ← *((byte*) print_str::str#8)
|
||||
[75] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#2
|
||||
[76] (byte*) print_str::str#0 ← ++ (byte*) print_str::str#8
|
||||
to:print_str::@1
|
||||
print_char: scope:[print_char] from main::@27
|
||||
[77] *((byte*) print_char_cursor#2) ← (const byte) print_char::ch#0
|
||||
[78] (byte*) print_char_cursor#10 ← ++ (byte*) print_char_cursor#2
|
||||
to:print_char::@return
|
||||
print_char::@return: scope:[print_char] from print_char
|
||||
[79] return
|
||||
to:@return
|
||||
print_word_decimal: scope:[print_word_decimal] from main::@10 main::@17 main::@23
|
||||
[80] (byte*) print_char_cursor#58 ← phi( main::@10/(byte*~) print_char_cursor#96 main::@17/(byte*) print_char_cursor#2 main::@23/(byte*) print_char_cursor#2 )
|
||||
[80] (word) print_word_decimal::w#3 ← phi( main::@10/(word) print_word_decimal::w#2 main::@17/(const word) COUNT#0 main::@23/(word) print_word_decimal::w#1 )
|
||||
[81] (word) utoa::value#1 ← (word) print_word_decimal::w#3
|
||||
[82] call utoa
|
||||
to:print_word_decimal::@1
|
||||
print_word_decimal::@1: scope:[print_word_decimal] from print_word_decimal
|
||||
[83] phi()
|
||||
[84] call print_str
|
||||
to:print_word_decimal::@return
|
||||
print_word_decimal::@return: scope:[print_word_decimal] from print_word_decimal::@1
|
||||
[85] return
|
||||
to:@return
|
||||
utoa: scope:[utoa] from print_word_decimal
|
||||
[86] phi()
|
||||
to:utoa::@1
|
||||
utoa::@1: scope:[utoa] from utoa utoa::@2
|
||||
[87] (byte*) utoa::buffer#11 ← phi( utoa::@2/(byte*) utoa::buffer#12 utoa/(const byte[6]) decimal_digits#0 )
|
||||
[87] (byte) utoa::started#2 ← phi( utoa::@2/(byte) utoa::started#3 utoa/(byte) 0 )
|
||||
[87] (word) utoa::value#2 ← phi( utoa::@2/(word) utoa::value#4 utoa/(word) utoa::value#1 )
|
||||
[87] (byte) utoa::digit#2 ← phi( utoa::@2/(byte) utoa::digit#1 utoa/(byte) 0 )
|
||||
[88] (byte~) utoa::$11 ← (byte) utoa::digit#2 << (byte) 1
|
||||
[89] (word) utoa::digit_value#0 ← *((const word[]) RADIX_DECIMAL_VALUES#0 + (byte~) utoa::$11)
|
||||
[90] if((byte) 0!=(byte) utoa::started#2) goto utoa::@3
|
||||
to:utoa::@6
|
||||
utoa::@6: scope:[utoa] from utoa::@1
|
||||
[91] if((word) utoa::value#2>=(word) utoa::digit_value#0) goto utoa::@3
|
||||
to:utoa::@2
|
||||
utoa::@2: scope:[utoa] from utoa::@5 utoa::@6
|
||||
[92] (byte*) utoa::buffer#12 ← phi( utoa::@6/(byte*) utoa::buffer#11 utoa::@5/(byte*) utoa::buffer#3 )
|
||||
[92] (byte) utoa::started#3 ← phi( utoa::@6/(byte) utoa::started#2 utoa::@5/(byte) 1 )
|
||||
[92] (word) utoa::value#4 ← phi( utoa::@6/(word) utoa::value#2 utoa::@5/(word) utoa::value#0 )
|
||||
[93] (byte) utoa::digit#1 ← ++ (byte) utoa::digit#2
|
||||
[94] if((byte) utoa::digit#1<(const byte) utoa::max_digits#1-(byte) 1) goto utoa::@1
|
||||
to:utoa::@4
|
||||
utoa::@4: scope:[utoa] from utoa::@2
|
||||
[95] (byte~) utoa::$4 ← (byte)(word) utoa::value#4
|
||||
[96] *((byte*) utoa::buffer#12) ← *((const byte[]) DIGITS#0 + (byte~) utoa::$4)
|
||||
[97] (byte*) utoa::buffer#4 ← ++ (byte*) utoa::buffer#12
|
||||
[98] *((byte*) utoa::buffer#4) ← (byte) 0
|
||||
to:utoa::@return
|
||||
utoa::@return: scope:[utoa] from utoa::@4
|
||||
[99] return
|
||||
to:@return
|
||||
utoa::@3: scope:[utoa] from utoa::@1 utoa::@6
|
||||
[100] (byte*) utoa_append::buffer#0 ← (byte*) utoa::buffer#11
|
||||
[101] (word) utoa_append::value#0 ← (word) utoa::value#2
|
||||
[102] (word) utoa_append::sub#0 ← (word) utoa::digit_value#0
|
||||
[103] call utoa_append
|
||||
[104] (word) utoa_append::return#0 ← (word) utoa_append::value#2
|
||||
to:utoa::@5
|
||||
utoa::@5: scope:[utoa] from utoa::@3
|
||||
[105] (word) utoa::value#0 ← (word) utoa_append::return#0
|
||||
[106] (byte*) utoa::buffer#3 ← ++ (byte*) utoa::buffer#11
|
||||
to:utoa::@2
|
||||
utoa_append: scope:[utoa_append] from utoa::@3
|
||||
[107] phi()
|
||||
to:utoa_append::@1
|
||||
utoa_append::@1: scope:[utoa_append] from utoa_append utoa_append::@2
|
||||
[108] (byte) utoa_append::digit#2 ← phi( utoa_append/(byte) 0 utoa_append::@2/(byte) utoa_append::digit#1 )
|
||||
[108] (word) utoa_append::value#2 ← phi( utoa_append/(word) utoa_append::value#0 utoa_append::@2/(word) utoa_append::value#1 )
|
||||
[109] if((word) utoa_append::value#2>=(word) utoa_append::sub#0) goto utoa_append::@2
|
||||
to:utoa_append::@3
|
||||
utoa_append::@3: scope:[utoa_append] from utoa_append::@1
|
||||
[110] *((byte*) utoa_append::buffer#0) ← *((const byte[]) DIGITS#0 + (byte) utoa_append::digit#2)
|
||||
to:utoa_append::@return
|
||||
utoa_append::@return: scope:[utoa_append] from utoa_append::@3
|
||||
[111] return
|
||||
to:@return
|
||||
utoa_append::@2: scope:[utoa_append] from utoa_append::@1
|
||||
[112] (byte) utoa_append::digit#1 ← ++ (byte) utoa_append::digit#2
|
||||
[113] (word) utoa_append::value#1 ← (word) utoa_append::value#2 - (word) utoa_append::sub#0
|
||||
to:utoa_append::@1
|
||||
print_ln: scope:[print_ln] from main::@15 main::@18 main::@26
|
||||
[114] (byte*) print_line_cursor#21 ← phi( main::@15/(byte*) 1024 main::@18/(byte*) print_line_cursor#1 main::@26/(byte*) print_line_cursor#1 )
|
||||
to:print_ln::@1
|
||||
print_ln::@1: scope:[print_ln] from print_ln print_ln::@1
|
||||
[115] (byte*) print_line_cursor#11 ← phi( print_ln/(byte*) print_line_cursor#21 print_ln::@1/(byte*) print_line_cursor#1 )
|
||||
[116] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#11 + (byte) $28
|
||||
[117] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#2) goto print_ln::@1
|
||||
to:print_ln::@return
|
||||
print_ln::@return: scope:[print_ln] from print_ln::@1
|
||||
[118] return
|
||||
to:@return
|
||||
print_dword_decimal: scope:[print_dword_decimal] from main::@25
|
||||
[119] (dword) ultoa::value#1 ← (dword) print_dword_decimal::w#0
|
||||
[120] call ultoa
|
||||
to:print_dword_decimal::@1
|
||||
print_dword_decimal::@1: scope:[print_dword_decimal] from print_dword_decimal
|
||||
[121] phi()
|
||||
[122] call print_str
|
||||
to:print_dword_decimal::@return
|
||||
print_dword_decimal::@return: scope:[print_dword_decimal] from print_dword_decimal::@1
|
||||
[123] return
|
||||
to:@return
|
||||
ultoa: scope:[ultoa] from print_dword_decimal
|
||||
[124] phi()
|
||||
to:ultoa::@1
|
||||
ultoa::@1: scope:[ultoa] from ultoa ultoa::@2
|
||||
[125] (byte*) ultoa::buffer#11 ← phi( ultoa::@2/(byte*) ultoa::buffer#12 ultoa/(const byte[$b]) decimal_digits_long#0 )
|
||||
[125] (byte) ultoa::started#2 ← phi( ultoa::@2/(byte) ultoa::started#3 ultoa/(byte) 0 )
|
||||
[125] (dword) ultoa::value#2 ← phi( ultoa::@2/(dword) ultoa::value#4 ultoa/(dword) ultoa::value#1 )
|
||||
[125] (byte) ultoa::digit#2 ← phi( ultoa::@2/(byte) ultoa::digit#1 ultoa/(byte) 0 )
|
||||
[126] (byte~) ultoa::$11 ← (byte) ultoa::digit#2 << (byte) 2
|
||||
[127] (dword) ultoa::digit_value#0 ← *((const dword[]) RADIX_DECIMAL_VALUES_LONG#0 + (byte~) ultoa::$11)
|
||||
[128] if((byte) 0!=(byte) ultoa::started#2) goto ultoa::@3
|
||||
to:ultoa::@6
|
||||
ultoa::@6: scope:[ultoa] from ultoa::@1
|
||||
[129] if((dword) ultoa::value#2>=(dword) ultoa::digit_value#0) goto ultoa::@3
|
||||
to:ultoa::@2
|
||||
ultoa::@2: scope:[ultoa] from ultoa::@5 ultoa::@6
|
||||
[130] (byte*) ultoa::buffer#12 ← phi( ultoa::@6/(byte*) ultoa::buffer#11 ultoa::@5/(byte*) ultoa::buffer#3 )
|
||||
[130] (byte) ultoa::started#3 ← phi( ultoa::@6/(byte) ultoa::started#2 ultoa::@5/(byte) 1 )
|
||||
[130] (dword) ultoa::value#4 ← phi( ultoa::@6/(dword) ultoa::value#2 ultoa::@5/(dword) ultoa::value#0 )
|
||||
[131] (byte) ultoa::digit#1 ← ++ (byte) ultoa::digit#2
|
||||
[132] if((byte) ultoa::digit#1<(const byte) ultoa::max_digits#1-(byte) 1) goto ultoa::@1
|
||||
to:ultoa::@4
|
||||
ultoa::@4: scope:[ultoa] from ultoa::@2
|
||||
[133] (byte~) ultoa::$4 ← (byte)(dword) ultoa::value#4
|
||||
[134] *((byte*) ultoa::buffer#12) ← *((const byte[]) DIGITS#0 + (byte~) ultoa::$4)
|
||||
[135] (byte*) ultoa::buffer#4 ← ++ (byte*) ultoa::buffer#12
|
||||
[136] *((byte*) ultoa::buffer#4) ← (byte) 0
|
||||
to:ultoa::@return
|
||||
ultoa::@return: scope:[ultoa] from ultoa::@4
|
||||
[137] return
|
||||
to:@return
|
||||
ultoa::@3: scope:[ultoa] from ultoa::@1 ultoa::@6
|
||||
[138] (byte*) ultoa_append::buffer#0 ← (byte*) ultoa::buffer#11
|
||||
[139] (dword) ultoa_append::value#0 ← (dword) ultoa::value#2
|
||||
[140] (dword) ultoa_append::sub#0 ← (dword) ultoa::digit_value#0
|
||||
[141] call ultoa_append
|
||||
[142] (dword) ultoa_append::return#0 ← (dword) ultoa_append::value#2
|
||||
to:ultoa::@5
|
||||
ultoa::@5: scope:[ultoa] from ultoa::@3
|
||||
[143] (dword) ultoa::value#0 ← (dword) ultoa_append::return#0
|
||||
[144] (byte*) ultoa::buffer#3 ← ++ (byte*) ultoa::buffer#11
|
||||
to:ultoa::@2
|
||||
ultoa_append: scope:[ultoa_append] from ultoa::@3
|
||||
[145] phi()
|
||||
to:ultoa_append::@1
|
||||
ultoa_append::@1: scope:[ultoa_append] from ultoa_append ultoa_append::@2
|
||||
[146] (byte) ultoa_append::digit#2 ← phi( ultoa_append/(byte) 0 ultoa_append::@2/(byte) ultoa_append::digit#1 )
|
||||
[146] (dword) ultoa_append::value#2 ← phi( ultoa_append/(dword) ultoa_append::value#0 ultoa_append::@2/(dword) ultoa_append::value#1 )
|
||||
[147] if((dword) ultoa_append::value#2>=(dword) ultoa_append::sub#0) goto ultoa_append::@2
|
||||
to:ultoa_append::@3
|
||||
ultoa_append::@3: scope:[ultoa_append] from ultoa_append::@1
|
||||
[148] *((byte*) ultoa_append::buffer#0) ← *((const byte[]) DIGITS#0 + (byte) ultoa_append::digit#2)
|
||||
to:ultoa_append::@return
|
||||
ultoa_append::@return: scope:[ultoa_append] from ultoa_append::@3
|
||||
[149] return
|
||||
to:@return
|
||||
ultoa_append::@2: scope:[ultoa_append] from ultoa_append::@1
|
||||
[150] (byte) ultoa_append::digit#1 ← ++ (byte) ultoa_append::digit#2
|
||||
[151] (dword) ultoa_append::value#1 ← (dword) ultoa_append::value#2 - (dword) ultoa_append::sub#0
|
||||
to:ultoa_append::@1
|
||||
div32u16u: scope:[div32u16u] from main::@21
|
||||
[152] (word) divr16u::dividend#1 ← > (dword) div32u16u::dividend#0
|
||||
[153] call divr16u
|
||||
[154] (word) divr16u::return#2 ← (word) divr16u::return#0
|
||||
to:div32u16u::@1
|
||||
div32u16u::@1: scope:[div32u16u] from div32u16u
|
||||
[155] (word) div32u16u::quotient_hi#0 ← (word) divr16u::return#2
|
||||
[156] (word) divr16u::dividend#2 ← < (dword) div32u16u::dividend#0
|
||||
[157] (word) divr16u::rem#4 ← (word) rem16u#1
|
||||
[158] call divr16u
|
||||
[159] (word) divr16u::return#3 ← (word) divr16u::return#0
|
||||
to:div32u16u::@2
|
||||
div32u16u::@2: scope:[div32u16u] from div32u16u::@1
|
||||
[160] (word) div32u16u::quotient_lo#0 ← (word) divr16u::return#3
|
||||
[161] (dword) div32u16u::return#0 ← (word) div32u16u::quotient_hi#0 dw= (word) div32u16u::quotient_lo#0
|
||||
to:div32u16u::@return
|
||||
div32u16u::@return: scope:[div32u16u] from div32u16u::@2
|
||||
[162] return
|
||||
to:@return
|
||||
divr16u: scope:[divr16u] from div32u16u div32u16u::@1
|
||||
[163] (word) divr16u::dividend#5 ← phi( div32u16u/(word) divr16u::dividend#1 div32u16u::@1/(word) divr16u::dividend#2 )
|
||||
[163] (word) divr16u::rem#10 ← phi( div32u16u/(byte) 0 div32u16u::@1/(word) divr16u::rem#4 )
|
||||
to:divr16u::@1
|
||||
divr16u::@1: scope:[divr16u] from divr16u divr16u::@3
|
||||
[164] (byte) divr16u::i#2 ← phi( divr16u/(byte) 0 divr16u::@3/(byte) divr16u::i#1 )
|
||||
[164] (word) divr16u::quotient#3 ← phi( divr16u/(byte) 0 divr16u::@3/(word) divr16u::return#0 )
|
||||
[164] (word) divr16u::dividend#3 ← phi( divr16u/(word) divr16u::dividend#5 divr16u::@3/(word) divr16u::dividend#0 )
|
||||
[164] (word) divr16u::rem#5 ← phi( divr16u/(word) divr16u::rem#10 divr16u::@3/(word) divr16u::rem#11 )
|
||||
[165] (word) divr16u::rem#0 ← (word) divr16u::rem#5 << (byte) 1
|
||||
[166] (byte~) divr16u::$1 ← > (word) divr16u::dividend#3
|
||||
[167] (byte~) divr16u::$2 ← (byte~) divr16u::$1 & (byte) $80
|
||||
[168] if((byte~) divr16u::$2==(byte) 0) goto divr16u::@2
|
||||
to:divr16u::@4
|
||||
divr16u::@4: scope:[divr16u] from divr16u::@1
|
||||
[169] (word) divr16u::rem#1 ← (word) divr16u::rem#0 | (byte) 1
|
||||
to:divr16u::@2
|
||||
divr16u::@2: scope:[divr16u] from divr16u::@1 divr16u::@4
|
||||
[170] (word) divr16u::rem#6 ← phi( divr16u::@1/(word) divr16u::rem#0 divr16u::@4/(word) divr16u::rem#1 )
|
||||
[171] (word) divr16u::dividend#0 ← (word) divr16u::dividend#3 << (byte) 1
|
||||
[172] (word) divr16u::quotient#1 ← (word) divr16u::quotient#3 << (byte) 1
|
||||
[173] if((word) divr16u::rem#6<(const word) div32u16u::divisor#0) goto divr16u::@3
|
||||
to:divr16u::@5
|
||||
divr16u::@5: scope:[divr16u] from divr16u::@2
|
||||
[174] (word) divr16u::quotient#2 ← ++ (word) divr16u::quotient#1
|
||||
[175] (word) divr16u::rem#2 ← (word) divr16u::rem#6 - (const word) div32u16u::divisor#0
|
||||
to:divr16u::@3
|
||||
divr16u::@3: scope:[divr16u] from divr16u::@2 divr16u::@5
|
||||
[176] (word) divr16u::return#0 ← phi( divr16u::@2/(word) divr16u::quotient#1 divr16u::@5/(word) divr16u::quotient#2 )
|
||||
[176] (word) divr16u::rem#11 ← phi( divr16u::@2/(word) divr16u::rem#6 divr16u::@5/(word) divr16u::rem#2 )
|
||||
[177] (byte) divr16u::i#1 ← ++ (byte) divr16u::i#2
|
||||
[178] if((byte) divr16u::i#1!=(byte) $10) goto divr16u::@1
|
||||
to:divr16u::@6
|
||||
divr16u::@6: scope:[divr16u] from divr16u::@3
|
||||
[179] (word) rem16u#1 ← (word) divr16u::rem#11
|
||||
to:divr16u::@return
|
||||
divr16u::@return: scope:[divr16u] from divr16u::@6
|
||||
[180] return
|
||||
to:@return
|
||||
clock: scope:[clock] from main::@3
|
||||
[181] (dword) clock::return#0 ← (dword) $ffffffff - *((const dword*) CIA2_TIMER_AB#0)
|
||||
to:clock::@return
|
||||
clock::@return: scope:[clock] from clock
|
||||
[182] return
|
||||
to:@return
|
||||
clock_start: scope:[clock_start] from main::@20
|
||||
[183] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0
|
||||
[184] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0
|
||||
[185] *((const dword*) CIA2_TIMER_AB#0) ← (dword) $ffffffff
|
||||
[186] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0
|
||||
[187] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0
|
||||
to:clock_start::@return
|
||||
clock_start::@return: scope:[clock_start] from clock_start
|
||||
[188] return
|
||||
to:@return
|
||||
memset: scope:[memset] from main::@19 print_cls
|
||||
[189] (byte) memset::c#3 ← phi( main::@19/(byte) 0 print_cls/(byte) ' ' )
|
||||
[189] (void*) memset::str#3 ← phi( main::@19/(void*)(const byte*) sieve#0 print_cls/(void*)(byte*) 1024 )
|
||||
[189] (word) memset::num#2 ← phi( main::@19/(const word) COUNT#0 print_cls/(word) $3e8 )
|
||||
[190] if((word) memset::num#2<=(byte) 0) goto memset::@return
|
||||
to:memset::@1
|
||||
memset::@1: scope:[memset] from memset
|
||||
[191] (byte*) memset::end#0 ← (byte*)(void*) memset::str#3 + (word) memset::num#2
|
||||
[192] (byte*~) memset::dst#3 ← (byte*)(void*) memset::str#3
|
||||
to:memset::@2
|
||||
memset::@2: scope:[memset] from memset::@1 memset::@2
|
||||
[193] (byte*) memset::dst#2 ← phi( memset::@1/(byte*~) memset::dst#3 memset::@2/(byte*) memset::dst#1 )
|
||||
[194] *((byte*) memset::dst#2) ← (byte) memset::c#3
|
||||
[195] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#2
|
||||
[196] if((byte*) memset::dst#1!=(byte*) memset::end#0) goto memset::@2
|
||||
to:memset::@return
|
||||
memset::@return: scope:[memset] from memset memset::@2
|
||||
[197] return
|
||||
to:@return
|
||||
print_cls: scope:[print_cls] from main::@13
|
||||
[198] phi()
|
||||
[199] call memset
|
||||
to:print_cls::@return
|
||||
print_cls::@return: scope:[print_cls] from print_cls
|
||||
[200] return
|
||||
to:@return
|
9476
src/test/ref/sieve.log
Normal file
9476
src/test/ref/sieve.log
Normal file
File diff suppressed because it is too large
Load Diff
391
src/test/ref/sieve.sym
Normal file
391
src/test/ref/sieve.sym
Normal file
@ -0,0 +1,391 @@
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(dword*) CIA2_TIMER_AB
|
||||
(const dword*) CIA2_TIMER_AB#0 CIA2_TIMER_AB = (dword*) 56580
|
||||
(byte*) CIA2_TIMER_A_CONTROL
|
||||
(const byte*) CIA2_TIMER_A_CONTROL#0 CIA2_TIMER_A_CONTROL = (byte*) 56590
|
||||
(byte*) CIA2_TIMER_B_CONTROL
|
||||
(const byte*) CIA2_TIMER_B_CONTROL#0 CIA2_TIMER_B_CONTROL = (byte*) 56591
|
||||
(byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES
|
||||
(byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A
|
||||
(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A = (byte) $40
|
||||
(byte) CIA_TIMER_CONTROL_CONTINUOUS
|
||||
(const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 CIA_TIMER_CONTROL_CONTINUOUS = (byte) 0
|
||||
(byte) CIA_TIMER_CONTROL_START
|
||||
(const byte) CIA_TIMER_CONTROL_START#0 CIA_TIMER_CONTROL_START = (byte) 1
|
||||
(byte) CIA_TIMER_CONTROL_STOP
|
||||
(word) CLOCKS_PER_FRAME
|
||||
(const word) CLOCKS_PER_FRAME#0 CLOCKS_PER_FRAME = (word) $4cc8
|
||||
(dword) CLOCKS_PER_INIT
|
||||
(const dword) CLOCKS_PER_INIT#0 CLOCKS_PER_INIT = (byte) $12
|
||||
(dword) CLOCKS_PER_SEC
|
||||
(const dword) CLOCKS_PER_SEC#0 CLOCKS_PER_SEC = (const word) CLOCKS_PER_FRAME#0*(const byte) FRAMES_PER_SEC#0
|
||||
(word) COUNT
|
||||
(const word) COUNT#0 COUNT = (word) $4000
|
||||
(byte*) D018
|
||||
(const byte*) D018#0 D018 = (byte*) 53272
|
||||
(byte[]) DIGITS
|
||||
(const byte[]) DIGITS#0 DIGITS = (string) "0123456789abcdef"
|
||||
(byte) FRAMES_PER_SEC
|
||||
(const byte) FRAMES_PER_SEC#0 FRAMES_PER_SEC = (byte) $3c
|
||||
(const byte) RADIX::BINARY BINARY = (number) 2
|
||||
(const byte) RADIX::DECIMAL DECIMAL = (number) $a
|
||||
(const byte) RADIX::HEXADECIMAL HEXADECIMAL = (number) $10
|
||||
(const byte) RADIX::OCTAL OCTAL = (number) 8
|
||||
(word[]) RADIX_BINARY_VALUES
|
||||
(dword[]) RADIX_BINARY_VALUES_LONG
|
||||
(word[]) RADIX_DECIMAL_VALUES
|
||||
(const word[]) RADIX_DECIMAL_VALUES#0 RADIX_DECIMAL_VALUES = { (word) $2710, (word) $3e8, (word) $64, (word) $a }
|
||||
(dword[]) RADIX_DECIMAL_VALUES_LONG
|
||||
(const dword[]) RADIX_DECIMAL_VALUES_LONG#0 RADIX_DECIMAL_VALUES_LONG = { (dword) $3b9aca00, (dword) $5f5e100, (dword) $989680, (dword) $f4240, (dword) $186a0, (dword) $2710, (dword) $3e8, (dword) $64, (dword) $a }
|
||||
(word[]) RADIX_HEXADECIMAL_VALUES
|
||||
(dword[]) RADIX_HEXADECIMAL_VALUES_LONG
|
||||
(word[]) RADIX_OCTAL_VALUES
|
||||
(dword[]) RADIX_OCTAL_VALUES_LONG
|
||||
(byte*) SCREEN
|
||||
(const byte*) SCREEN#0 SCREEN = (byte*) 1024
|
||||
(byte) SQRT_COUNT
|
||||
(const byte) SQRT_COUNT#0 SQRT_COUNT = (byte) $80
|
||||
(dword()) clock()
|
||||
(label) clock::@return
|
||||
(dword) clock::return
|
||||
(dword) clock::return#0 return zp ZP_DWORD:24 1.3333333333333333
|
||||
(dword) clock::return#2 return zp ZP_DWORD:24 4.0
|
||||
(void()) clock_start()
|
||||
(label) clock_start::@return
|
||||
(byte[6]) decimal_digits
|
||||
(const byte[6]) decimal_digits#0 decimal_digits = { fill( 6, 0) }
|
||||
(byte[$b]) decimal_digits_long
|
||||
(const byte[$b]) decimal_digits_long#0 decimal_digits_long = { fill( $b, 0) }
|
||||
(dword()) div32u16u((dword) div32u16u::dividend , (word) div32u16u::divisor)
|
||||
(label) div32u16u::@1
|
||||
(label) div32u16u::@2
|
||||
(label) div32u16u::@return
|
||||
(dword) div32u16u::dividend
|
||||
(dword) div32u16u::dividend#0 dividend zp ZP_DWORD:24 1.2000000000000002
|
||||
(word) div32u16u::divisor
|
||||
(const word) div32u16u::divisor#0 divisor = (word)(const dword) CLOCKS_PER_SEC#0/(byte) $64
|
||||
(dword) div32u16u::quotient
|
||||
(word) div32u16u::quotient_hi
|
||||
(word) div32u16u::quotient_hi#0 quotient_hi zp ZP_WORD:52 0.6666666666666666
|
||||
(word) div32u16u::quotient_lo
|
||||
(word) div32u16u::quotient_lo#0 quotient_lo zp ZP_WORD:34 4.0
|
||||
(dword) div32u16u::return
|
||||
(dword) div32u16u::return#0 return zp ZP_DWORD:40 1.3333333333333333
|
||||
(dword) div32u16u::return#2 return zp ZP_DWORD:40 4.0
|
||||
(word()) divr16u((word) divr16u::dividend , (word) divr16u::divisor , (word) divr16u::rem)
|
||||
(byte~) divr16u::$1 reg byte a 22.0
|
||||
(byte~) divr16u::$2 reg byte a 22.0
|
||||
(label) divr16u::@1
|
||||
(label) divr16u::@2
|
||||
(label) divr16u::@3
|
||||
(label) divr16u::@4
|
||||
(label) divr16u::@5
|
||||
(label) divr16u::@6
|
||||
(label) divr16u::@return
|
||||
(word) divr16u::dividend
|
||||
(word) divr16u::dividend#0 dividend zp ZP_WORD:32 2.75
|
||||
(word) divr16u::dividend#1 dividend zp ZP_WORD:32 4.0
|
||||
(word) divr16u::dividend#2 dividend zp ZP_WORD:32 2.0
|
||||
(word) divr16u::dividend#3 dividend zp ZP_WORD:32 5.0
|
||||
(word) divr16u::dividend#5 dividend zp ZP_WORD:32 6.0
|
||||
(word) divr16u::divisor
|
||||
(byte) divr16u::i
|
||||
(byte) divr16u::i#1 reg byte x 16.5
|
||||
(byte) divr16u::i#2 reg byte x 1.6923076923076923
|
||||
(word) divr16u::quotient
|
||||
(word) divr16u::quotient#1 quotient zp ZP_WORD:34 16.5
|
||||
(word) divr16u::quotient#2 quotient zp ZP_WORD:34 11.0
|
||||
(word) divr16u::quotient#3 quotient zp ZP_WORD:34 2.75
|
||||
(word) divr16u::rem
|
||||
(word) divr16u::rem#0 rem zp ZP_WORD:30 8.25
|
||||
(word) divr16u::rem#1 rem zp ZP_WORD:30 22.0
|
||||
(word) divr16u::rem#10 rem zp ZP_WORD:30 4.0
|
||||
(word) divr16u::rem#11 rem zp ZP_WORD:30 11.666666666666666
|
||||
(word) divr16u::rem#2 rem zp ZP_WORD:30 22.0
|
||||
(word) divr16u::rem#4 rem zp ZP_WORD:30 4.0
|
||||
(word) divr16u::rem#5 rem zp ZP_WORD:30 24.0
|
||||
(word) divr16u::rem#6 rem zp ZP_WORD:30 11.0
|
||||
(word) divr16u::return
|
||||
(word) divr16u::return#0 return zp ZP_WORD:34 5.285714285714286
|
||||
(word) divr16u::return#2 return zp ZP_WORD:34 4.0
|
||||
(word) divr16u::return#3 return zp ZP_WORD:34 4.0
|
||||
(void()) main()
|
||||
(dword~) main::$10 $10 zp ZP_DWORD:24 4.0
|
||||
(dword~) main::$14 $14 zp ZP_DWORD:40 2.0
|
||||
(byte*~) main::$38 $38 zp ZP_WORD:44 22.0
|
||||
(label) main::@1
|
||||
(label) main::@10
|
||||
(label) main::@11
|
||||
(label) main::@12
|
||||
(label) main::@13
|
||||
(label) main::@14
|
||||
(label) main::@15
|
||||
(label) main::@16
|
||||
(label) main::@17
|
||||
(label) main::@18
|
||||
(label) main::@19
|
||||
(label) main::@2
|
||||
(label) main::@20
|
||||
(label) main::@21
|
||||
(label) main::@22
|
||||
(label) main::@23
|
||||
(label) main::@24
|
||||
(label) main::@25
|
||||
(label) main::@26
|
||||
(label) main::@27
|
||||
(label) main::@28
|
||||
(label) main::@29
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@5
|
||||
(label) main::@6
|
||||
(label) main::@7
|
||||
(label) main::@8
|
||||
(label) main::@9
|
||||
(dword) main::cyclecount
|
||||
(dword) main::cyclecount#0 cyclecount zp ZP_DWORD:24 0.5
|
||||
(word) main::i
|
||||
(word) main::i#10 i#10 zp ZP_WORD:6 4.4
|
||||
(word) main::i#11 i zp ZP_WORD:2 24.6
|
||||
(word) main::i#2 i zp ZP_WORD:2 11.0
|
||||
(word) main::i#3 i#3 zp ZP_WORD:6 11.0
|
||||
(word) main::j
|
||||
(word) main::j#0 j zp ZP_WORD:8 16.5
|
||||
(word) main::j#1 j zp ZP_WORD:8 202.0
|
||||
(word) main::j#2 j zp ZP_WORD:8 78.5
|
||||
(byte*) main::s
|
||||
(byte*) main::s#0 s zp ZP_WORD:10 22.0
|
||||
(byte*) main::s#1 s zp ZP_WORD:10 101.0
|
||||
(byte*) main::s#2 s zp ZP_WORD:10 104.66666666666666
|
||||
(word) main::sec100s
|
||||
(word) main::sec100s#0 sec100s zp ZP_WORD:6 1.3333333333333333
|
||||
(byte*) main::sieve_i
|
||||
(byte*) main::sieve_i#1 sieve_i zp ZP_WORD:4 22.0
|
||||
(byte*) main::sieve_i#2 sieve_i zp ZP_WORD:4 3.0
|
||||
(const string) main::str str = (string) "Sieve benchmark - calculating primes@"
|
||||
(const string) main::str1 str1 = (string) "between 2 and @"
|
||||
(const string) main::str2 str2 = (string) "100ths seconds used: @"
|
||||
(const string) main::str3 str3 = (string) " cycles: @"
|
||||
(const string) main::str4 str4 = (string) "...@"
|
||||
(label) main::toD0181
|
||||
(word~) main::toD0181_$0
|
||||
(number~) main::toD0181_$1
|
||||
(number~) main::toD0181_$2
|
||||
(number~) main::toD0181_$3
|
||||
(word~) main::toD0181_$4
|
||||
(byte~) main::toD0181_$5
|
||||
(number~) main::toD0181_$6
|
||||
(number~) main::toD0181_$7
|
||||
(number~) main::toD0181_$8
|
||||
(byte*) main::toD0181_gfx
|
||||
(const byte*) main::toD0181_gfx#0 toD0181_gfx = (byte*) 6144
|
||||
(byte) main::toD0181_return
|
||||
(const byte) main::toD0181_return#0 toD0181_return = >(word)(const byte*) SCREEN#0&(word) $3fff*(byte) 4|>(word)(const byte*) main::toD0181_gfx#0/(byte) 4&(byte) $f
|
||||
(byte*) main::toD0181_screen
|
||||
(void*()) memset((void*) memset::str , (byte) memset::c , (word) memset::num)
|
||||
(label) memset::@1
|
||||
(label) memset::@2
|
||||
(label) memset::@return
|
||||
(byte) memset::c
|
||||
(byte) memset::c#3 reg byte x 1.375
|
||||
(byte*) memset::dst
|
||||
(byte*) memset::dst#1 dst zp ZP_WORD:38 16.5
|
||||
(byte*) memset::dst#2 dst zp ZP_WORD:38 17.5
|
||||
(byte*~) memset::dst#3 dst zp ZP_WORD:38 4.0
|
||||
(byte*) memset::end
|
||||
(byte*) memset::end#0 end zp ZP_WORD:36 2.1666666666666665
|
||||
(word) memset::num
|
||||
(word) memset::num#2 num zp ZP_WORD:36 2.0
|
||||
(void*) memset::return
|
||||
(void*) memset::str
|
||||
(void*) memset::str#3 str zp ZP_WORD:38
|
||||
(void()) print_char((byte) print_char::ch)
|
||||
(label) print_char::@return
|
||||
(byte) print_char::ch
|
||||
(const byte) print_char::ch#0 ch = (byte) ' '
|
||||
(byte*) print_char_cursor
|
||||
(byte*) print_char_cursor#1 print_char_cursor zp ZP_WORD:12 101.0
|
||||
(byte*) print_char_cursor#10 print_char_cursor zp ZP_WORD:12 4.333333333333333
|
||||
(byte*~) print_char_cursor#101 print_char_cursor zp ZP_WORD:12 22.0
|
||||
(byte*) print_char_cursor#2 print_char_cursor zp ZP_WORD:12 10.25
|
||||
(byte*) print_char_cursor#58 print_char_cursor zp ZP_WORD:12 4.25
|
||||
(byte*) print_char_cursor#62 print_char_cursor#62 zp ZP_WORD:21 8.75
|
||||
(byte*) print_char_cursor#63 print_char_cursor zp ZP_WORD:12 8.75
|
||||
(byte*) print_char_cursor#66 print_char_cursor zp ZP_WORD:12 14.0
|
||||
(byte*~) print_char_cursor#89 print_char_cursor zp ZP_WORD:12 4.0
|
||||
(byte*~) print_char_cursor#90 print_char_cursor zp ZP_WORD:12 4.0
|
||||
(byte*~) print_char_cursor#96 print_char_cursor zp ZP_WORD:12 22.0
|
||||
(byte*~) print_char_cursor#99 print_char_cursor#99 zp ZP_WORD:21 22.0
|
||||
(void()) print_cls()
|
||||
(label) print_cls::@return
|
||||
(void()) print_dword_decimal((dword) print_dword_decimal::w)
|
||||
(label) print_dword_decimal::@1
|
||||
(label) print_dword_decimal::@return
|
||||
(dword) print_dword_decimal::w
|
||||
(dword) print_dword_decimal::w#0 w zp ZP_DWORD:24 4.0
|
||||
(byte*) print_line_cursor
|
||||
(byte*) print_line_cursor#1 print_line_cursor zp ZP_WORD:21 0.9347826086956521
|
||||
(byte*) print_line_cursor#11 print_line_cursor zp ZP_WORD:21 24.0
|
||||
(byte*) print_line_cursor#21 print_line_cursor zp ZP_WORD:21 6.0
|
||||
(void()) print_ln()
|
||||
(label) print_ln::@1
|
||||
(label) print_ln::@return
|
||||
(byte*) print_screen
|
||||
(void()) print_str((byte*) print_str::str)
|
||||
(label) print_str::@1
|
||||
(label) print_str::@2
|
||||
(label) print_str::@return
|
||||
(byte*) print_str::str
|
||||
(byte*) print_str::str#0 str zp ZP_WORD:14 202.0
|
||||
(byte*) print_str::str#10 str zp ZP_WORD:14 2.0
|
||||
(byte*) print_str::str#8 str zp ZP_WORD:14 101.5
|
||||
(void()) print_word_decimal((word) print_word_decimal::w)
|
||||
(label) print_word_decimal::@1
|
||||
(label) print_word_decimal::@return
|
||||
(word) print_word_decimal::w
|
||||
(word) print_word_decimal::w#1 w zp ZP_WORD:6 4.0
|
||||
(word) print_word_decimal::w#2 w zp ZP_WORD:6 11.0
|
||||
(word) print_word_decimal::w#3 w zp ZP_WORD:6 15.0
|
||||
(word) rem16u
|
||||
(word) rem16u#1 rem16u zp ZP_WORD:30 0.6666666666666666
|
||||
(byte*) sieve
|
||||
(const byte*) sieve#0 sieve = (byte*) 4096
|
||||
(void()) ultoa((dword) ultoa::value , (byte*) ultoa::buffer , (byte) ultoa::radix)
|
||||
(byte~) ultoa::$11 reg byte a 22.0
|
||||
(byte~) ultoa::$4 reg byte a 4.0
|
||||
(label) ultoa::@1
|
||||
(label) ultoa::@2
|
||||
(label) ultoa::@3
|
||||
(label) ultoa::@4
|
||||
(label) ultoa::@5
|
||||
(label) ultoa::@6
|
||||
(label) ultoa::@return
|
||||
(byte*) ultoa::buffer
|
||||
(byte*) ultoa::buffer#11 buffer zp ZP_WORD:28 4.0
|
||||
(byte*) ultoa::buffer#12 buffer zp ZP_WORD:28 7.400000000000001
|
||||
(byte*) ultoa::buffer#3 buffer zp ZP_WORD:28 22.0
|
||||
(byte*) ultoa::buffer#4 buffer zp ZP_WORD:28 4.0
|
||||
(byte) ultoa::digit
|
||||
(byte) ultoa::digit#1 digit zp ZP_BYTE:23 16.5
|
||||
(byte) ultoa::digit#2 digit zp ZP_BYTE:23 2.5384615384615383
|
||||
(dword) ultoa::digit_value
|
||||
(dword) ultoa::digit_value#0 digit_value zp ZP_DWORD:48 6.6000000000000005
|
||||
(dword*) ultoa::digit_values
|
||||
(byte) ultoa::max_digits
|
||||
(const byte) ultoa::max_digits#1 max_digits = (byte) $a
|
||||
(byte) ultoa::radix
|
||||
(byte) ultoa::started
|
||||
(byte) ultoa::started#2 reg byte x 6.6000000000000005
|
||||
(byte) ultoa::started#3 reg byte x 7.333333333333333
|
||||
(dword) ultoa::value
|
||||
(dword) ultoa::value#0 value zp ZP_DWORD:24 11.0
|
||||
(dword) ultoa::value#1 value zp ZP_DWORD:24 2.0
|
||||
(dword) ultoa::value#2 value zp ZP_DWORD:24 7.666666666666666
|
||||
(dword) ultoa::value#4 value zp ZP_DWORD:24 11.0
|
||||
(dword()) ultoa_append((byte*) ultoa_append::buffer , (dword) ultoa_append::value , (dword) ultoa_append::sub)
|
||||
(label) ultoa_append::@1
|
||||
(label) ultoa_append::@2
|
||||
(label) ultoa_append::@3
|
||||
(label) ultoa_append::@return
|
||||
(byte*) ultoa_append::buffer
|
||||
(byte*) ultoa_append::buffer#0 buffer zp ZP_WORD:28 1.625
|
||||
(byte) ultoa_append::digit
|
||||
(byte) ultoa_append::digit#1 reg byte x 101.0
|
||||
(byte) ultoa_append::digit#2 reg byte x 102.0
|
||||
(dword) ultoa_append::return
|
||||
(dword) ultoa_append::return#0 return zp ZP_DWORD:24 22.0
|
||||
(dword) ultoa_append::sub
|
||||
(dword) ultoa_append::sub#0 sub zp ZP_DWORD:48 35.5
|
||||
(dword) ultoa_append::value
|
||||
(dword) ultoa_append::value#0 value zp ZP_DWORD:24 4.333333333333333
|
||||
(dword) ultoa_append::value#1 value zp ZP_DWORD:24 202.0
|
||||
(dword) ultoa_append::value#2 value zp ZP_DWORD:24 52.66666666666666
|
||||
(void()) utoa((word) utoa::value , (byte*) utoa::buffer , (byte) utoa::radix)
|
||||
(byte~) utoa::$11 reg byte a 202.0
|
||||
(byte~) utoa::$4 reg byte a 4.0
|
||||
(label) utoa::@1
|
||||
(label) utoa::@2
|
||||
(label) utoa::@3
|
||||
(label) utoa::@4
|
||||
(label) utoa::@5
|
||||
(label) utoa::@6
|
||||
(label) utoa::@return
|
||||
(byte*) utoa::buffer
|
||||
(byte*) utoa::buffer#11 buffer zp ZP_WORD:19 36.72727272727273
|
||||
(byte*) utoa::buffer#12 buffer zp ZP_WORD:19 61.39999999999999
|
||||
(byte*) utoa::buffer#3 buffer zp ZP_WORD:19 202.0
|
||||
(byte*) utoa::buffer#4 buffer zp ZP_WORD:19 4.0
|
||||
(byte) utoa::digit
|
||||
(byte) utoa::digit#1 digit zp ZP_BYTE:16 151.5
|
||||
(byte) utoa::digit#2 digit zp ZP_BYTE:16 23.307692307692307
|
||||
(word) utoa::digit_value
|
||||
(word) utoa::digit_value#0 digit_value zp ZP_WORD:46 60.599999999999994
|
||||
(word*) utoa::digit_values
|
||||
(byte) utoa::max_digits
|
||||
(const byte) utoa::max_digits#1 max_digits = (byte) 5
|
||||
(byte) utoa::radix
|
||||
(byte) utoa::started
|
||||
(byte) utoa::started#2 reg byte x 60.599999999999994
|
||||
(byte) utoa::started#3 reg byte x 67.33333333333333
|
||||
(word) utoa::value
|
||||
(word) utoa::value#0 value zp ZP_WORD:17 101.0
|
||||
(word) utoa::value#1 value zp ZP_WORD:17 2.0
|
||||
(word) utoa::value#2 value zp ZP_WORD:17 67.66666666666666
|
||||
(word) utoa::value#4 value zp ZP_WORD:17 101.0
|
||||
(word()) utoa_append((byte*) utoa_append::buffer , (word) utoa_append::value , (word) utoa_append::sub)
|
||||
(label) utoa_append::@1
|
||||
(label) utoa_append::@2
|
||||
(label) utoa_append::@3
|
||||
(label) utoa_append::@return
|
||||
(byte*) utoa_append::buffer
|
||||
(byte*) utoa_append::buffer#0 buffer zp ZP_WORD:19 12.875
|
||||
(byte) utoa_append::digit
|
||||
(byte) utoa_append::digit#1 reg byte x 1001.0
|
||||
(byte) utoa_append::digit#2 reg byte x 1002.0
|
||||
(word) utoa_append::return
|
||||
(word) utoa_append::return#0 return zp ZP_WORD:17 202.0
|
||||
(word) utoa_append::sub
|
||||
(word) utoa_append::sub#0 sub zp ZP_WORD:46 350.5
|
||||
(word) utoa_append::value
|
||||
(word) utoa_append::value#0 value zp ZP_WORD:17 34.33333333333333
|
||||
(word) utoa_append::value#1 value zp ZP_WORD:17 2002.0
|
||||
(word) utoa_append::value#2 value zp ZP_WORD:17 517.6666666666667
|
||||
|
||||
zp ZP_WORD:2 [ main::i#11 main::i#2 ]
|
||||
zp ZP_WORD:4 [ main::sieve_i#2 main::sieve_i#1 ]
|
||||
zp ZP_WORD:6 [ main::i#10 main::i#3 print_word_decimal::w#3 print_word_decimal::w#2 print_word_decimal::w#1 main::sec100s#0 ]
|
||||
zp ZP_WORD:8 [ main::j#2 main::j#0 main::j#1 ]
|
||||
zp ZP_WORD:10 [ main::s#2 main::s#0 main::s#1 ]
|
||||
zp ZP_WORD:12 [ print_char_cursor#66 print_char_cursor#63 print_char_cursor#101 print_char_cursor#10 print_char_cursor#89 print_char_cursor#90 print_char_cursor#2 print_char_cursor#58 print_char_cursor#1 print_char_cursor#96 ]
|
||||
zp ZP_WORD:14 [ print_str::str#8 print_str::str#10 print_str::str#0 ]
|
||||
zp ZP_BYTE:16 [ utoa::digit#2 utoa::digit#1 ]
|
||||
zp ZP_WORD:17 [ utoa::value#2 utoa::value#4 utoa::value#1 utoa::value#0 utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 utoa_append::return#0 ]
|
||||
reg byte x [ utoa::started#2 utoa::started#3 ]
|
||||
zp ZP_WORD:19 [ utoa::buffer#11 utoa::buffer#12 utoa::buffer#3 utoa::buffer#4 utoa_append::buffer#0 ]
|
||||
reg byte x [ utoa_append::digit#2 utoa_append::digit#1 ]
|
||||
zp ZP_WORD:21 [ print_line_cursor#11 print_line_cursor#21 print_char_cursor#62 print_char_cursor#99 print_line_cursor#1 ]
|
||||
zp ZP_BYTE:23 [ ultoa::digit#2 ultoa::digit#1 ]
|
||||
zp ZP_DWORD:24 [ ultoa::value#2 ultoa::value#4 ultoa::value#1 ultoa::value#0 ultoa_append::value#2 ultoa_append::value#0 ultoa_append::value#1 print_dword_decimal::w#0 ultoa_append::return#0 main::cyclecount#0 div32u16u::dividend#0 clock::return#2 main::$10 clock::return#0 ]
|
||||
reg byte x [ ultoa::started#2 ultoa::started#3 ]
|
||||
zp ZP_WORD:28 [ ultoa::buffer#11 ultoa::buffer#12 ultoa::buffer#3 ultoa::buffer#4 ultoa_append::buffer#0 ]
|
||||
reg byte x [ ultoa_append::digit#2 ultoa_append::digit#1 ]
|
||||
zp ZP_WORD:30 [ divr16u::rem#5 divr16u::rem#10 divr16u::rem#4 divr16u::rem#11 divr16u::rem#6 divr16u::rem#0 divr16u::rem#1 divr16u::rem#2 rem16u#1 ]
|
||||
zp ZP_WORD:32 [ divr16u::dividend#3 divr16u::dividend#5 divr16u::dividend#1 divr16u::dividend#2 divr16u::dividend#0 ]
|
||||
zp ZP_WORD:34 [ divr16u::quotient#3 divr16u::return#0 divr16u::quotient#1 divr16u::quotient#2 divr16u::return#2 divr16u::return#3 div32u16u::quotient_lo#0 ]
|
||||
reg byte x [ divr16u::i#2 divr16u::i#1 ]
|
||||
zp ZP_WORD:36 [ memset::num#2 memset::end#0 ]
|
||||
zp ZP_WORD:38 [ memset::str#3 memset::dst#2 memset::dst#3 memset::dst#1 ]
|
||||
reg byte x [ memset::c#3 ]
|
||||
zp ZP_DWORD:40 [ div32u16u::return#2 main::$14 div32u16u::return#0 ]
|
||||
zp ZP_WORD:44 [ main::$38 ]
|
||||
reg byte a [ utoa::$11 ]
|
||||
zp ZP_WORD:46 [ utoa::digit_value#0 utoa_append::sub#0 ]
|
||||
reg byte a [ utoa::$4 ]
|
||||
reg byte a [ ultoa::$11 ]
|
||||
zp ZP_DWORD:48 [ ultoa::digit_value#0 ultoa_append::sub#0 ]
|
||||
reg byte a [ ultoa::$4 ]
|
||||
zp ZP_WORD:52 [ div32u16u::quotient_hi#0 ]
|
||||
reg byte a [ divr16u::$1 ]
|
||||
reg byte a [ divr16u::$2 ]
|
Loading…
Reference in New Issue
Block a user