Jump to content
IGNORED

Mad Pascal examples


Gury

Recommended Posts

This is really a great example of how to combine Pascal with inline assembly. I think back to 30 years ago when I tried the same on my Amiga coding for my Atari (link). Now you can have this in readable Pascal code - awesome.

  • Like 2
Link to comment
Share on other sites

  • 3 weeks later...
7 hours ago, tebe said:

'dots_cross.pas' (plotter), cross compiled version (PC, Atari XE/XL) ; 'dots_v2.pas' optimized Atari XE/XL version

Is there a special reason form removing the "( )" in the V2? I would not expect it to have an impact on the speed.

image.thumb.png.9ce57ff783c4e7042ff0018bb59608d4.png

Link to comment
Share on other sites

  • 2 weeks later...

Mr.Oger.and.Dr.Sharky.Hunting.the.Jaguar

 

https://demozoo.org/graphics/334168/

 

{$r vga.rc}

uses crt, vbxe;

const
	pic = VBXE_OVRADR;

var	xdl: txdl absolute VBXE_XDLADR+VBXE_WINDOW;

begin

 if VBXE.GraphResult <> VBXE.grOK then begin
  writeln('VBXE not detected');
  halt;
 end;

 SetHorizontalRes(VBXE.VGAMed);

 VBXEMemoryBank($80);

 xdl.rptl_ := 0;
 xdl.rptl := 240;

 poke(559,0);

 repeat
 until keypressed;

 VBXEOff;

end.

 

mr_oger.png

vga.zip

Edited by tebe
  • Like 2
Link to comment
Share on other sites

  • 3 weeks later...

The algorithm is based on the BASIC programs for BBC Micro by [Steve McCrea](https://twitter.com/Kweepa).

 

improve

 

  Gr10Init(DISPLAY_LIST_ADDRESS, VIDEO_RAM_ADDRESS, 59, 4, 0);

 

      { Calculate ray direction (X,Y,Z) }
      { Here the perspective is provided by calculation of Z
      { with inverset square root function Z=1/Sqrt(L+1) }
      Z := iSqrt(X * X + Y * Y + 1);

raytracer.png

raytracer.obx raytracer.pas

Edited by tebe
  • Like 5
Link to comment
Share on other sites

https://demozoo.org/graphics/332400/

 

kittens_dos64.atr (type VANS.EXE KITTENS.ANS)

kittens_mydos.atr(select L, type DISPANSI.EXE)

 

Press key W / S (move screen up/down)

 

https://github.com/tebe6502/Mad-Pascal/tree/master/samples/a8/graph_vbxe_ansi

madbit-skate_kittens.png

kittens_dos64.atr kittens_mydos.atr

Edited by tebe
  • Like 4
Link to comment
Share on other sites

  • 3 months later...
  • 2 weeks later...

example of using the $eval directive

var
	// Generate the 2D array used for the circles. Experiment!
	sqr : array of byte = [ {$eval DWIDTH,200,"255/(sqrt(power(:1-DWIDTH/2.5,2)*4+power(:2-HEI/2-20,2))+5)*32.0" } ];

	data: array of byte = [ {$bin2csv smooth_data.bin} ];

	tab40 : array of word = [ {$eval 200, ":1*DWIDTH"} ];

	sinx: array of byte = [ {$eval 256, "(sin(:1/256.0*PI*2.0)*48+63)"} ];

 

grim.png

grim.obx grim_source.7z

  • Like 7
Link to comment
Share on other sites

  • 2 weeks later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...