zbyti Posted July 27, 2020 Share Posted July 27, 2020 (edited) Added chessboard benchmark visualization. Edited August 2, 2020 by zbyti Quote Link to comment Share on other sites More sharing options...
zbyti Posted July 30, 2020 Share Posted July 30, 2020 (edited) Old Good Sieve: 1899 10x (less is better) on emulator mad pascal : 607 frames cc65 : 614 frames vbcc : 636 frames vc +atari -O3 -speed sieve.c -o sieve-vbcc.xex -c99 cl65 -t atari -Osir -Cl --add-source -o sieve-cc65.xex sieve.c sieve-vbcc.xex sieve.c sieve-cc65.xex sieve-mp.xex sieve.pas Edited July 30, 2020 by zbyti add mad pascal Quote Link to comment Share on other sites More sharing options...
vbc Posted July 30, 2020 Share Posted July 30, 2020 1 hour ago, zbyti said: Old Good Sieve: 1899 10x (less is better) on emulator mad pascal : 607 frames cc65 : 614 frames vbcc : 636 frames -O3 does not seem to work too well with this test. -O gives better results. Also, when compiling with vbcc, did you notice this warning? > stop_ticks ==- start_ticks; warning 153 in line 41 of "sieve.c": statement has no effect Replacing it with stop_ticks -= start_ticks; and using those options cl65 -t atari -Oisr -Cl sieve.c -o sieve-cc65.xex vc +atari -O -speed sieve.c -c99 -o sieve-vbcc.xex I get: mad pascal : 607 cc65 : 601 vbcc : 589 sieve-vbcc.xex sieve-cc65.xex sieve.c 1 Quote Link to comment Share on other sites More sharing options...
zbyti Posted July 30, 2020 Share Posted July 30, 2020 (edited) @vbc It's ashamed to admit it, but I missed this warning, I changed it at the end and confused it with the printf warning. I've been programming too much in Action! on A8 last days where it is correct I need to study the compiler flags closely - perfect result, congratulations! Edited July 30, 2020 by zbyti last days Quote Link to comment Share on other sites More sharing options...
tebe Posted August 2, 2020 Author Share Posted August 2, 2020 sieve: 580 sieve.obx sieve.pas 2 Quote Link to comment Share on other sites More sharing options...
zbyti Posted August 2, 2020 Share Posted August 2, 2020 (edited) In the newly released MP arrays have clearly speed up Can be checked with Mad Pascal Bench Suite Edited September 7, 2020 by zbyti add score 1 Quote Link to comment Share on other sites More sharing options...
zbyti Posted September 7, 2020 Share Posted September 7, 2020 (edited) New release of Mad Pascal - another speed improvements (mostly for FOR loops). EDIT: I announced it as if I did the optimizations Kudos for @tebe ! Edited September 15, 2020 by zbyti Kudos! 2 Quote Link to comment Share on other sites More sharing options...
zbyti Posted September 15, 2020 Share Posted September 15, 2020 (edited) I was just curious program GrandTheftAntic; uses crt, graph; var i : byte absolute $d8; scores : array[0..16] of word absolute $da; rtclok : byte absolute $14; sdmct : word absolute $22f; x : single; begin for i := 0 to 15 do begin InitGraph(i + 16); Pause; rtclok := 0; while rtclok < 100 do Inc(scores[i]); end; sdmct := 0; i := 16; Pause; rtclok := 0; while rtclok < 100 do Inc(scores[i]); sdmct := $22; InitGraph(0); for i := 0 to 15 do begin x := (100 * scores[i]) / scores[16]; writeln(scores[i], ' GR.', i, ' ', x, '%'); end; writeln(scores[16], ' ANTIC OFF'); ReadKey; end. GrandTheftAntic.pas GrandTheftAntic.xex Edited September 15, 2020 by zbyti scores with % 3 Quote Link to comment Share on other sites More sharing options...
zbyti Posted September 21, 2020 Share Posted September 21, 2020 Pussyless Code That's feeling when even comments don't let us understand someone else's code... 1 1 Quote Link to comment Share on other sites More sharing options...
tebe Posted September 21, 2020 Author Share Posted September 21, 2020 (edited) new switches -target [-t] -zpage [-z] -code [-c] -data [-d] -stack [-s] -define [-d] -ipath [i] mp.exe -t c64 -z 10 generates code for C64 (zpage=$10) https://github.com/tebe6502/Mad-Pascal/tree/master/samples/c64 Edited September 21, 2020 by tebe 3 Quote Link to comment Share on other sites More sharing options...
zbyti Posted September 22, 2020 Share Posted September 22, 2020 I will test it today, thank you! Quote Link to comment Share on other sites More sharing options...
zbyti Posted September 22, 2020 Share Posted September 22, 2020 #!/bin/bash mp="$HOME/Programs/MadPascal/mp" mads="$HOME/Programs/mads/mads" base="$HOME/Programs/MadPascal/base" if [ -z "$1" ]; then echo -e "\nPlease call '$0 <argument>' to run this command!\n" exit 1 fi $mp $1 -t c64 -z 10 -o name=${1::-4} if [ -f $name.a65 ]; then [ ! -d "output" ] && mkdir output mv $name.a65 output/ $mads output/$name.a65 -x -i:$base -o:output/$name.prg else exit 1 fi if [ ! -z "$2" ]; then x64 output/$name.prg fi program Multiplatformity; begin {$ifdef c64} writeln('YO C64!'); {$else} writeln('YO ATARI!!'); {$endif} while true do; end. 1 Quote Link to comment Share on other sites More sharing options...
zbyti Posted September 22, 2020 Share Posted September 22, 2020 (edited) BREAKING NEWS! Basic functionality of the Commander X16 works too! ./x16emu -prg x16-test.prg program x16_Test; begin writeln('HEJ! MAD PASCALA HERE!'); end. x16-test.prg Edited September 22, 2020 by zbyti code chunk 1 Quote Link to comment Share on other sites More sharing options...
zbyti Posted September 23, 2020 Share Posted September 23, 2020 (edited) For those who like Atari CPU supremacy program YoshBenchPlus; var {$ifdef c64} i : word absolute $70; a : word absolute $72; b : word absolute $74; clock : byte absolute $a2; {$else} i : word absolute $e0; a : word absolute $e2; b : word absolute $e4; clock : byte absolute $14; {$endif} procedure vbsync; var tmp: byte; begin tmp := clock; while clock = tmp do; end; begin i:=0; a:=0; b:=0; vbsync; clock := 0; while clock < 100 do begin Inc(a); b := a; Inc(b); a := b; Inc(i); end; writeln('YOSHPLUS - ITERATIONS IN 100 FRAMES.'); {$ifdef c64} writeln('MAD PASCAL 1.6.4 ON C64'); {$else} writeln('MAD PASCAL 1.6.4 ON ATARI 800XL'); {$endif} writeln('COUNTER = ', i); while true do; end. YoshBenchPlus.xex YoshBenchPlus.prg YoshBenchPlus.pas Edited September 23, 2020 by zbyti change zp 1 Quote Link to comment Share on other sites More sharing options...
zbyti Posted September 23, 2020 Share Posted September 23, 2020 // Eratosthenes Sieve benchmark 1899 const size = 8192; iter_max = 10; var flags: array [0..size] of boolean; iter: byte; ticks: word = 0; {$ifdef c64} i: word absolute $70; k: word absolute $72; prime: word absolute $74; count: word absolute $76; clock1 : byte absolute $a1; clock2 : byte absolute $a2; {$else} i: word absolute $e0; k: word absolute $e2; prime: word absolute $e4; count: word absolute $e6; clock1 : byte absolute $13; clock2 : byte absolute $14; {$endif} procedure vbsync; var tmp: byte; begin tmp := clock2; while clock2 = tmp do; end; begin writeln(iter_max,' ITERATIONS'); vbsync; clock2 := 0; clock1 := 0; for iter := iter_max-1 downto 0 do begin fillchar(flags, sizeof(flags), true); count := 0; for i:=0 to size do if flags[i] then begin prime := i*2 + 3; k := prime + i; while (k <= size) do begin flags[k] := false; inc(k, prime); end; inc(count); end; end; ticks := clock2 + (clock1 * 256); writeln(ticks, ' TICKS'); writeln(count, ' PRIMES'); while true do; end. sieve.pas sieve.xex sieve.prg 1 Quote Link to comment Share on other sites More sharing options...
zbyti Posted September 23, 2020 Share Posted September 23, 2020 (edited) program MonteCarloPi; const probe = 10000; r = 127 * 127; var {$ifdef c64} stop : word absolute $70; i : word absolute $70; x : word absolute $74; y : word absolute $76; bingo : word absolute $78; foundPi : word absolute $7a; n : byte absolute $7c; clock1 : byte absolute $a1; clock2 : byte absolute $a2; rndNumber : byte absolute $d41b; {$else} stop : word absolute $e0; i : word absolute $e0; x : word absolute $e4; y : word absolute $e6; bingo : word absolute $e8; foundPi : word absolute $ea; n : byte absolute $ec; clock1 : byte absolute $13; clock2 : byte absolute $14; rndNumber : byte absolute $d20a; {$endif} procedure vbsync; begin n := clock2; while clock2 = n do; end; {$ifdef c64} //SID's Random Number Generator procedure c64Randomize; assembler; asm { lda #$ff ; maximum frequency value sta $D40E ; voice 3 frequency low byte sta $D40F ; voice 3 frequency high byte lda #$80 ; noise waveform, gate bit off sta $D412 ; voice 3 control register }; end; {$endif} begin bingo := 0; {$ifdef c64} c64Randomize; {$endif} vbsync; clock2 := 0; clock1 := 0; for i := 1 to probe do begin n := rndNumber and 127; x := n * n; n := rndNumber and 127; y := n * n; if (x + y) <= r then Inc(bingo); end; foundPi := 4 * bingo; stop := (clock1 * 256) + clock2; writeln('PROBE SIZE ', probe); writeln('POINTS IN CIRCLE ', bingo); writeln('FOUND PI APPROXIMATION ', foundPi / probe); writeln('FRAMES COUNTER = ', stop); while true do; end. MonteCarlo.xex MonteCarlo.prg MonteCarlo.pas Edited September 23, 2020 by zbyti add const 1 Quote Link to comment Share on other sites More sharing options...
tebe Posted September 25, 2020 Author Share Posted September 25, 2020 (edited) new unit MD5 https://github.com/tebe6502/Mad-Pascal/blob/master/lib/md5.pas md5_bench.pas md5_bench.prg md5_bench.xex FPC: writeln(MD5Print(MD5Buffer(test, 512))); Edited September 25, 2020 by tebe 1 1 Quote Link to comment Share on other sites More sharing options...
zbyti Posted September 25, 2020 Share Posted September 25, 2020 {$ifdef atari} pause; {$endif} {$ifdef c64} pause; {$endif} -t don't recognize that? Quote Link to comment Share on other sites More sharing options...
zbyti Posted September 27, 2020 Share Posted September 27, 2020 (edited) Pascal can do it too (* * This is a part of Quatari 256B intro * <https://demozoo.org/productions/280623> *) program Landscape; var cursor_y : byte absolute $54; cursor_x : byte absolute $55; prev_y : byte absolute $5a; prev_x : byte absolute $5b; color4 : byte absolute $02c8; color : byte absolute $02fb; rnd : byte absolute $d20a; i : byte absolute $e0; color_height: array[0..13] of byte = ( 170,150,144,144,122,122,110,110,94,94,86,86,82,80 ); procedure openmode(m : byte); assembler; asm { lda m jsr $ef9c }; end; procedure drawto; assembler; asm { jsr $f9c2 }; end; begin openmode(9); color4 := $b0; for i := 0 to 79 do begin cursor_x := i; prev_x := i; prev_y := 1; color := 13; while color <> $ff do begin cursor_y := color_height[color]; if rnd < $80 then inc(color_height[color]) else if rnd < $80 then dec(color_height[color]); drawto; dec(color); end; end; repeat until false; end. landscape.pas landscape.xex landscape.mp4 Edited September 27, 2020 by zbyti Doo Dah Day :] Quote Link to comment Share on other sites More sharing options...
drac030 Posted September 27, 2020 Share Posted September 27, 2020 (edited) The bad thing about this program are the illegal system calls. I do realize that you used them to fit in 256 bytes, but straight assembler still can do better. I have a lazy sunday so I sat and translated your program back to assembly (probably the most useless thing one could do considering that the original source probably can be found somewhere, but I was too lazy to search). Features: 1) open/close/draw using CIO 2) wait for a key at the end 3) switch to GR.0 before exiting 4) 162 bytes binary 5) VBXE version as a bonus (needs the "S2:" driver loaded) 6) sources included @tschak909 land.arc Edited September 27, 2020 by drac030 2 1 Quote Link to comment Share on other sites More sharing options...
zbyti Posted September 27, 2020 Share Posted September 27, 2020 @drac030 thank you for your insight! Your advice always welcome :] here original source quatari.asm Quote Link to comment Share on other sites More sharing options...
drac030 Posted September 27, 2020 Share Posted September 27, 2020 (edited) Thanks. Now I understand the odd conditional you have used in Pascal. This: lda RANDOM bpl skip1 iny skip1: lda RANDOM bpl skip2 dey skip2: I would understand rather as an equivalent to: if rnd >= $80 then inc(color_height[color]); if rnd >= $80 then dec(color_height[color]); But I do not know Pascal, so... Edited September 27, 2020 by drac030 corrected obvious mistake 1 Quote Link to comment Share on other sites More sharing options...
zbyti Posted September 27, 2020 Share Posted September 27, 2020 (edited) You know Pascal enough I see It was 3:00 am then but why I don't refactor this part any further I don't know I use emulators only to run stuff, You make my life difficult with arc and native encoding LAND.S CIOEQU.I Edited September 27, 2020 by zbyti arc :] Quote Link to comment Share on other sites More sharing options...
zbyti Posted September 27, 2020 Share Posted September 27, 2020 (edited) 17 minutes ago, drac030 said: Thanks. Now I understand the odd conditional you have used in Pascal. This: lda RANDOM bpl skip1 iny skip1: lda RANDOM bpl skip2 dey skip2: I would understand rather as an equivalent to: if rnd >= $80 then inc(color_height[color]); if rnd >= $80 then dec(color_height[color]); But I do not know Pascal, so... Chmm... but: if rnd < $80 then inc(color_height[color]) else if rnd < $80 then dec(color_height[color]); in this case dec have less probability and terrain look not as flat ? Edited September 27, 2020 by zbyti flat Quote Link to comment Share on other sites More sharing options...
drac030 Posted September 27, 2020 Share Posted September 27, 2020 Yes, it is so. I just assumed that you wanted to render the original assembly exactly in Pascal. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.