prog8/examples/test.p8

61 lines
1.0 KiB
Plaintext
Raw Normal View History

%import c64utils
2020-07-26 22:32:59 +00:00
main {
2020-08-24 21:18:46 +00:00
const uword rom = $e000
sub sumrom() -> uword {
uword p = rom
uword s = 0
ubyte i
repeat $20 {
repeat $100 {
s += @(p)
p++
}
}
return s
}
2020-07-26 21:32:20 +00:00
sub start() {
2020-08-24 21:18:46 +00:00
benchcommon.begin()
ubyte i
for i in 0 to 5 {
c64scr.print_uw(sumrom())
c64.CHROUT('\n')
}
benchcommon.end()
}
}
2020-08-18 13:16:56 +00:00
2020-08-24 00:56:22 +00:00
2020-08-24 21:18:46 +00:00
benchcommon {
uword last_time = 0
uword time_start = 0
2020-08-24 21:18:46 +00:00
asmsub read_time () clobbers(A,X,Y) {
%asm {{
jsr $FFDE
sta last_time
stx last_time+1
rts
}}
}
sub begin() {
benchcommon.read_time()
benchcommon.time_start = benchcommon.last_time
}
sub end() {
benchcommon.read_time()
c64scr.print_uwhex(benchcommon.last_time-benchcommon.time_start, false)
2020-08-23 16:32:53 +00:00
c64.CHROUT('\n')
2020-08-24 21:18:46 +00:00
void c64scr.input_chars($c000)
2020-08-23 22:26:26 +00:00
}
}
2020-08-24 21:18:46 +00:00