From 86ae6de3251048a244b490ab18d64aa939d837ae Mon Sep 17 00:00:00 2001 From: zbyti Date: Tue, 22 Sep 2020 19:34:29 +0200 Subject: [PATCH 1/5] A8 horizontal stars done on one missile --- examples/README.md | 12 +++++++----- examples/a8/horizontal_stars.mfk | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 examples/a8/horizontal_stars.mfk diff --git a/examples/README.md b/examples/README.md index e9035f2e..b5dfa9aa 100644 --- a/examples/README.md +++ b/examples/README.md @@ -88,15 +88,17 @@ how to create a program made of multiple files loaded on demand * [Vertical scroll example](a8/vertical_scroll.mfk) – simple vertical scroll example -* [System Off example](a8/systemoff_example.mfk) – Programming example with ROM off +* [Horizontal stars example](a8/horizontal_stars.mfk) – horizontal stars done on one missile -* [GR.8 Chessboard Benchmark](a8/gr8_chessboard_benchmark.mfk) – Chessboard drawing benchmark in GR.8 +* [System Off example](a8/systemoff_example.mfk) – programming with ROM off -* [FOR Countdown Benchmark](a8/countdown_for_benchmark.mfk) – Countdown from 1,999,999 to 0 (FOR loop) +* [GR.8 Chessboard Benchmark](a8/gr8_chessboard_benchmark.mfk) – chessboard drawing benchmark in GR.8 -* [WHILE Countdown Benchmark](a8/countdown_while_benchmark.mfk) – Countdown from 1,999,999 to 0 (WHILE loop) +* [FOR Countdown Benchmark](a8/countdown_for_benchmark.mfk) – countdown from 1,999,999 to 0 (FOR loop) -* [Sieve of Eratosthenes (1899) Benchmark](a8/sieve1899.mfk) – Sieve of Eratosthenes, 1899 primes algorithm +* [WHILE Countdown Benchmark](a8/countdown_while_benchmark.mfk) – countdown from 1,999,999 to 0 (WHILE loop) + +* [Sieve of Eratosthenes (1899) Benchmark](a8/sieve1899.mfk) – sieve of Eratosthenes, 1899 primes algorithm * [Monte Carlo PI estimation Benchmark](a8/montecarlo_pi_benchmark.mfk) – measures the efficiency of multiplication diff --git a/examples/a8/horizontal_stars.mfk b/examples/a8/horizontal_stars.mfk new file mode 100644 index 00000000..d5ad7090 --- /dev/null +++ b/examples/a8/horizontal_stars.mfk @@ -0,0 +1,21 @@ +void main(){ + array(byte) stars[256] align(fast) + byte i + + os_PCOLR0 = $e + gtia_grafm = $e + + for i:stars { + stars[i] = pokey_random + } + + while true { + if antic_vcount == 0 { + for i:stars { + antic_wsync = 1 + gtia_hposm0 = stars[i] + stars[i] += 1 + } + } + } +} \ No newline at end of file From 7182f320321918bb56712e39044fa6fd1816ec2c Mon Sep 17 00:00:00 2001 From: zbyti Date: Wed, 23 Sep 2020 00:04:22 +0200 Subject: [PATCH 2/5] more life in empty space --- examples/a8/horizontal_stars.mfk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/a8/horizontal_stars.mfk b/examples/a8/horizontal_stars.mfk index d5ad7090..24db7571 100644 --- a/examples/a8/horizontal_stars.mfk +++ b/examples/a8/horizontal_stars.mfk @@ -1,5 +1,6 @@ void main(){ array(byte) stars[256] align(fast) + array(byte) speed[256] align(fast) byte i os_PCOLR0 = $e @@ -7,6 +8,7 @@ void main(){ for i:stars { stars[i] = pokey_random + speed[i] = (pokey_random & 3) + 1 } while true { @@ -14,7 +16,7 @@ void main(){ for i:stars { antic_wsync = 1 gtia_hposm0 = stars[i] - stars[i] += 1 + stars[i] += speed[i] } } } From 433066fedd5301b69eae840bfd96ef6329ff2966 Mon Sep 17 00:00:00 2001 From: zbyti Date: Wed, 23 Sep 2020 20:18:04 +0200 Subject: [PATCH 3/5] comment fix --- examples/a8/systemoff_example.mfk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/a8/systemoff_example.mfk b/examples/a8/systemoff_example.mfk index 8ea33344..991dd27f 100644 --- a/examples/a8/systemoff_example.mfk +++ b/examples/a8/systemoff_example.mfk @@ -34,7 +34,7 @@ const array(byte) dl align(32) = [ // init procedure void system_off(){ asm { sei } // turn off IRQ - antic_nmien = 0 // turn off ANTIC + antic_nmien = 0 // turn off NMI pia_portb = $fe // turn off ROM rti = $40 // set RTI opcode vbivec = rti.addr // set address for VBI routine From a4de5735937325475159b3bba591f0fc12599ffd Mon Sep 17 00:00:00 2001 From: zbyti Date: Wed, 23 Sep 2020 23:09:15 +0200 Subject: [PATCH 4/5] A8 Grand Ttheft Antic --- examples/README.md | 2 + examples/a8/grand_theft_antic.mfk | 86 +++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 examples/a8/grand_theft_antic.mfk diff --git a/examples/README.md b/examples/README.md index b5dfa9aa..584e85b2 100644 --- a/examples/README.md +++ b/examples/README.md @@ -90,6 +90,8 @@ how to create a program made of multiple files loaded on demand * [Horizontal stars example](a8/horizontal_stars.mfk) – horizontal stars done on one missile +* [Grand Ttheft Antic](a8/grand_theft_antic.mfk) – ANTIC impact on CPU depending on the used graphic mode + * [System Off example](a8/systemoff_example.mfk) – programming with ROM off * [GR.8 Chessboard Benchmark](a8/gr8_chessboard_benchmark.mfk) – chessboard drawing benchmark in GR.8 diff --git a/examples/a8/grand_theft_antic.mfk b/examples/a8/grand_theft_antic.mfk new file mode 100644 index 00000000..65d31c90 --- /dev/null +++ b/examples/a8/grand_theft_antic.mfk @@ -0,0 +1,86 @@ +byte i @ $b0 +pointer screen @ $b2 +array(word) scores[17] @ $80 + +asm void openmode(byte register(a) m) @ $ef9c extern + +asm void pause() { + lda os_RTCLOK.b2 + .rt_check: + cmp os_RTCLOK.b2 + beq .rt_check + rts +} + +// print in HEX +void printScore(word val) { + array(byte) tmp[4] + byte iter + + tmp[0] = val.hi >> 4 + tmp[1] = val.hi & %00001111 + tmp[2] = val.lo >> 4 + tmp[3] = val.lo & %00001111 + + for iter:tmp { + if tmp[iter] < 10 { + screen[iter] = tmp[iter] + $10 + } else { + screen[iter] = tmp[iter] + $17 + } + } + + if i < 16 { + screen[4] = 0 + screen[5] = 'G' atariscr + screen[6] = 'R' atariscr + screen[7] = '.' atariscr + if i < 10 { + screen[8] = i + $10 + } else { + screen[8] = i + $17 + } + } else { + screen[4] = 0 + screen[5] = 'O' atariscr + screen[6] = 'F' atariscr + screen[7] = 'F' atariscr + } + + screen += 40 +} + + +void main(){ + for i:scores { + scores[i] = 0 + } + + for i,0,to,15 { + openmode(i) + pause() + os_RTCLOK.b2 = 0 + while os_RTCLOK.b2 < 100 { + scores[i] += 1 + } + } + + os_SDMCTL = 0 + i = 16 + pause() + os_RTCLOK.b2 = 0 + while os_RTCLOK.b2 < 100 { + scores[i] += 1 + } + os_SDMCTL = $22 + + pause() + openmode(0) + screen = os_SAVMSC + + for i:scores { + printScore(scores[i]) + } + + while true {} +} \ No newline at end of file From 1d046f26e394db1fbba34aac0d6791e0b38aa4b5 Mon Sep 17 00:00:00 2001 From: zbyti Date: Wed, 23 Sep 2020 23:17:01 +0200 Subject: [PATCH 5/5] A8 Grand Ttheft Antic refactor --- examples/a8/grand_theft_antic.mfk | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/a8/grand_theft_antic.mfk b/examples/a8/grand_theft_antic.mfk index 65d31c90..62551ec8 100644 --- a/examples/a8/grand_theft_antic.mfk +++ b/examples/a8/grand_theft_antic.mfk @@ -74,7 +74,6 @@ void main(){ } os_SDMCTL = $22 - pause() openmode(0) screen = os_SAVMSC