tebe Posted July 26, 2015 Share Posted July 26, 2015 (edited) http://mads.atari8.info https://github.com/tebe6502/Mad-Pascal https://mads.atari8.info/library/doc/index.html http://bocianu.atari.pl/blog/blibs https://github.com/Ripjetski6502/A8MadPascalLibrary Mad Pascal 1.6.6 Based on Sub-Pascal 32-bit real mode compiler for 80386+ processors v. 2.0 by Vasiliy Tereshkov, 2009 Mad-Pascal is a subset of Pascal programming language. It includes: 1. If, Case, For, While, Repeat statements. 2. Compound statements. 3. Label, Goto statements. 4. Records, Objects. 5. Arithmetic and boolean operators. 6. Procedures and functions with up to 8 parameters. Returned value of a function is assigned to a predefined Result variable. 7. Static local variables. 8. Primitive data types (All types except the ShortReal/Real type are compatible. Pointers are dereferenced as pointers to Word): + Cardinal Word, Byte + Integer, SmallInt, ShortInt + Char, PChar + Boolean + Pointer + File, Text + ShortReal/Real (fixed-point), Single (IEEE-754), Float16 (Half Single) 9. One-dimensional and Two-dimensional arrays (with zero lower bound) of any primitive type. Arrays are treated as pointers to their origins (like in C) and can be passed to subroutines as parameters. 10. Predefined type string [N] which is equivalent to array [0..N] of Char. 11. Separate program modules. 12. Recursion. PasIntro.zip Edited October 4, 2022 by tebe update 9 Quote Link to comment Share on other sites More sharing options...
as... Posted July 26, 2015 Share Posted July 26, 2015 oh my good!!! Quote Link to comment Share on other sites More sharing options...
mani Posted July 26, 2015 Share Posted July 26, 2015 Quote Link to comment Share on other sites More sharing options...
Gury Posted July 27, 2015 Share Posted July 27, 2015 That's MEGA fascinating!!! Tebe, you are absolutely amazing, making even Turbo Pascal-like cross compiler available to Atari developers. I tried it and it works great. I like the way you mirrored the structure of Turbo Pascal units: crt, graph, math, system. It moves me to those nostalgic days of programming in TP in DOS . Firstly I thought you used Free Pascal as the base compiler core but I read your information about Sub-Pascal. Just great! And congratulations for winning the Głuchołazy 2015 intro contest!!! Gury 1 Quote Link to comment Share on other sites More sharing options...
tebe Posted July 27, 2015 Author Share Posted July 27, 2015 use graph.pas and crt.pas begin InitGraph(; SetColor(1); Circle(250,60,90); SetBkColor($86); MoveTo(10,10); LineTo(300,15); Circle(110,160,150); LineTo(22,190); SetBkColor($c6); Line(5,85, 311,190); repeat until keypressed; end. 1 Quote Link to comment Share on other sites More sharing options...
Gury Posted July 27, 2015 Share Posted July 27, 2015 Hi, I prepared some simple examples demonstrating P/M graphics with Mad-Pascal. Code is simplified for clarity and readibility. I think there is still a bug in my code because of little garbage on-screen. Anyway, here it is. First example with simple static player 0 on-screen and second example, which shows how to move player 0 with joystick. Source code is included in this post. Just invoke command prompt window and type pm or pm2 (and press enter key ) // // P/M Graphics demonstration // by Bostjan Gorisek 2015 // // Developed in Mad-Pascal by Tebe / Madteam // const max = 10; // Number of player 0 data values var p0Data : array [0..max] of byte; px0 : byte; // Sprite X position py0 : byte; // Sprite Y position pmgMem : Word; i : Byte; begin // Set graphics mode and playfield colors InitGraph(0); Poke(710, 0); Poke(712, 0); Poke(752, 1); // Cursor off writeln(eol,'P/M Graphics demonstration'); writeln(eol,'by Bostjan Gorisek 2015',eol); // Initialize P/M graphics Poke(53277, 0); pmgMem := Peek(106) - 4; Poke(54279, pmgMem); pmgMem := pmgMem * 256; Poke(559, 46); // Set player 0 coordinates px0 := 120; py0 := 60; // Draw player 0 image p0Data[0] := 60; p0Data[1] := 66; p0Data[2] := 129; p0Data[3] := 165; p0Data[4] := 129; p0Data[5] := 153; p0Data[6] := 129; p0Data[7] := 165; p0Data[8] := 153; p0Data[9] := 66; p0Data[10] := 60; // Clear player 0 memory fillchar(pointer(pmgMem+512), 128, 0); // Draw player 0 // Vertical position of player 0 //Move(pointer(p0Data), pointer(pmgMem+512+py0), 10); for i := 0 to max do begin Poke(pmgMem+512+py0+i, p0Data[i]); end; Poke(53277,3); // Turn on P/M graphics Poke(53256,1); // Size of player 0 (double size) Poke(704,183); // Player 0 color Poke(53248,px0); // Horizontal position of player 0 repeat until keypressed; // Reset P/M graphics InitGraph(0); Poke(53277, 0); end. // // P/M Graphics demonstration 2 // by Bostjan Gorisek 2015 // // Developed in Mad-Pascal by Tebe / Madteam // const _max = 7; // Number of player 0 data values _speed = 40; // Player 0 movement speed var p0Data : array [0.._max] of byte; px0 : byte; // Sprite X position py0 : byte; // Sprite Y position pmgMem : Word; i : Byte; begin // Set graphics mode and playfield colors InitGraph(; Poke(710, 122); Poke(712, 130); Poke(709, 64); Poke(752, 1); // Cursor off // Set playfield graphics SetColor(1); MoveTo(10,10); LineTo(300,10); Line(30,50,100,50); Line(100,50,100,130); Line(30,130,100,130); Line(30,130,30,50); Circle(250,60,20); // Initialize P/M graphics Poke(53277, 0); pmgMem := Peek(106) - 4; Poke(54279, pmgMem); pmgMem := pmgMem * 256; Poke(559, 46); // Set player 0 coordinates px0 := 120; py0 := 60; // Draw player 0 image p0Data[0] := 48; p0Data[1] := 120; p0Data[2] := 252; p0Data[3] := 48; p0Data[4] := 48; p0Data[5] := 48; p0Data[6] := 48; p0Data[7] := 48; // Clear player 0 memory fillchar(pointer(pmgMem+512), 128, 0); // Draw player 0 // Vertical position of player 0 //Move(pointer(p0Data), pointer(pmgMem+512+py0), _max); for i := 0 to _max do begin Poke(pmgMem+512+py0+i, p0Data[i]); end; Poke(53277,3); // Turn on P/M graphics Poke(53256,0); // Size of player 0 (normal size) Poke(704,44); // Player 0 color Poke(53248,px0); // Horizontal position of player 0 repeat // Move player 0 left if Peek(632)=11 then begin Dec(px0); if px0 < 45 then px0 := 45; Poke(53248,px0); Delay(_speed); // Move player 0 right end else if Peek(632)=7 then begin Inc(px0); if px0 > 203 then px0 := 203; Poke(53248,px0); Delay(_speed); // Move player 0 up end else if Peek(632)=14 then begin Dec(py0); if py0 < 16 then py0 := 16; Poke(pmgMem+512+py0-1, 0); Poke(pmgMem+512+py0+_max+1, 0); for i := 0 to _max do begin Poke(pmgMem+512+py0+i, p0Data[i]); end; Delay(_speed-; // Move player 0 down end else if Peek(632)=13 then begin Inc(py0); if py0 > 97 then py0 := 97; Poke(pmgMem+512+py0-1, 0); Poke(pmgMem+512+py0+_max+1, 0); for i := 0 to _max do begin Poke(pmgMem+512+py0+i, p0Data[i]); end; Delay(_speed-; end; until keypressed; // Reset P/M graphics InitGraph(0); Poke(53277, 0); end. pmgdemos.zip 2 Quote Link to comment Share on other sites More sharing options...
funkheld Posted July 27, 2015 Share Posted July 27, 2015 hello, what happens next if I have the "pmgdemo.obx". as it is a xex? thanks Quote Link to comment Share on other sites More sharing options...
tebe Posted July 27, 2015 Author Share Posted July 27, 2015 yes, OBX = XEX Quote Link to comment Share on other sites More sharing options...
funkheld Posted July 27, 2015 Share Posted July 27, 2015 hello, thanks....ist ok. Pascal loops wonderful . greeting. Quote Link to comment Share on other sites More sharing options...
fujidude Posted July 27, 2015 Share Posted July 27, 2015 (edited) hello, what happens next if I have the "pmgdemo.obx". as it is a xex? .OBX is to .OBJ as .XEX is to .EXE. Although the Atari doesn't care what extension you use, usually .OBJ (and presumably then .OBX), is usually object code that is not yet in a final executable application form. For example for languages which first compile object code, then link the object code to a run time or library (which is itself plain object code) that is needed to make a full working program, it would be best practice to choose an .OBJ extension. Once you have various object code components linked together in a complete executable though, you would use .EXE. The .COM extension is typically for .EXE files that are external commands for a CLI driven DOS. I think the main (only?) reason some people are using .OBX or .XEX on Atari now days, is to make it easier to distinguish such files from DOS/WIN files with the extensions of .EXE or.COM. It can get confusing! Especially when the extensions are used somewhat willy nilly without care as to differences of meaning. The computer itself cares little what you use though. The differences are for people's benefit of understanding. Edited July 27, 2015 by fujidude Quote Link to comment Share on other sites More sharing options...
tebe Posted July 27, 2015 Author Share Posted July 27, 2015 (edited) loops if INDEX is BYTE for i:=0 to 255 do // infinite loop for i:=15 downto 0 do // infinite loop while i<=255 do inc(i); // infinite loop REPEAT UNTIL, is safe i:=0; repeat inc(i); until i=0; // 256x Edited July 27, 2015 by tebe Quote Link to comment Share on other sites More sharing options...
funkheld Posted July 27, 2015 Share Posted July 27, 2015 please where is the starting address from the OBX in atari800? greeting Quote Link to comment Share on other sites More sharing options...
tebe Posted July 27, 2015 Author Share Posted July 27, 2015 $ff, $ff, lo(address), hi(address) Quote Link to comment Share on other sites More sharing options...
tebe Posted July 27, 2015 Author Share Posted July 27, 2015 (edited) Gury, pmgdemo.pas // Draw player 0 // Vertical position of player 0 Move(@p0Data, pointer(pmgMem+512+py0), max+1); @ address p.s. pmgMem = $BC00, screen mem = $BC40 -> garbage Edited July 27, 2015 by tebe Quote Link to comment Share on other sites More sharing options...
funkheld Posted July 28, 2015 Share Posted July 28, 2015 Hello, this "pasintro" runs with graphics and sound also wonderful on the "MIST" best regards 1 Quote Link to comment Share on other sites More sharing options...
funkheld Posted July 28, 2015 Share Posted July 28, 2015 Hi good afternoon. I wish for this Pascal please times a Command Reference. it's a wonderful pascal. Pointer, Byte, Word, Char ......... greeting Quote Link to comment Share on other sites More sharing options...
funkheld Posted July 28, 2015 Share Posted July 28, 2015 hello, good day. as you can for Poke and Peek also use pointers in Pascal? thank you. greeting Quote Link to comment Share on other sites More sharing options...
funkheld Posted July 28, 2015 Share Posted July 28, 2015 (edited) ASM with MAD Pascal ok. greeting Edited July 29, 2015 by funkheld Quote Link to comment Share on other sites More sharing options...
funkheld Posted July 28, 2015 Share Posted July 28, 2015 (edited) how can you please fill an array of pointers? there is an error message. thank you var dlist: array [0..110] of byte; dl_idx : word; begin dl_idx= @dlist; Poke(dl_idx+0,255); Poke(dl_idx+1,23); DPoke(dl_idx+2,476); Poke(dl_idx+4,76); repeat until keypressed; end. Edited July 28, 2015 by funkheld Quote Link to comment Share on other sites More sharing options...
tebe Posted July 28, 2015 Author Share Posted July 28, 2015 var dlist: array [0..110] of byte; dl_idx : word; begin dl_idx:= word(@dlist); Poke(dl_idx+0,255); Poke(dl_idx+1,23); DPoke(dl_idx+2,476); Poke(dl_idx+4,76); Quote Link to comment Share on other sites More sharing options...
funkheld Posted July 28, 2015 Share Posted July 28, 2015 i have an own dplist designed with the image address: 36960 this is dplist stored here: dlist: array [0..110] of byte; here the dplist describes: procedure initdlist (a: word); dl_idx is taken for poke / peek. then follows the poken in the screen and the graphics commands are through this command set to the new dplist: dpoke ($58,36960); this order is important: init graph (7); dpoke (560,word(dlist)); dpoke ($58,36960); greeting var dlist: array [0..110] of byte; dl_idx: word; procedure DLByte(a: byte); begin Poke(dl_idx, a); inc(dl_idx); end; procedure DLWord(a: word); begin DPoke(dl_idx, a); inc(dl_idx, 2); end; procedure InitDlist(a: word); begin DLByte($70); DLByte($70); DLByte($70); DLByte($4d); DLWord(36960); DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d); DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d); DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d); DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d); DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d); DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d); DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d); DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d); DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d); DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d); DLByte($41); DLWord(a); end; begin dl_idx:= word(@dlist); InitDlist(word(@dlist)); InitGraph(7); DPoke(560,word(@dlist)); DPoke($58,36960); SetColor(1); MoveTo(5,5); LineTo(159,95); SetColor(2); MoveTo(159,0); LineTo(0,95); SetColor(3); Circle(80,50,45); Poke(36960,129); Poke(36961,255); Poke(36962,129); repeat until keypressed; end. Quote Link to comment Share on other sites More sharing options...
ascrnet Posted July 28, 2015 Share Posted July 28, 2015 (edited) I really liked the idea, I hope that in the future contains everything you need to develop a game or application quickly as serious a framework.Here I made a small test example. // Show colors // AsCrNet var num : byte; begin ClrScr; TextColor(15); GotoXY(14,9); write('Show colors'); repeat num := Random(255); TextBackground(num); Delay(900); until keypressed; end. greetings Edited July 28, 2015 by ascrnet Quote Link to comment Share on other sites More sharing options...
tebe Posted July 28, 2015 Author Share Posted July 28, 2015 (edited) fpc -Mtp filename.pas // Show colors // AsCrNet uses crt; var num : byte; begin ClrScr; TextColor(15); repeat num := Random(255); TextBackground(num); GotoXY(14,9); write('Show colors'); Delay(900); until keypressed; end. run application on PC and XE/XL Edited July 28, 2015 by tebe Quote Link to comment Share on other sites More sharing options...
funkheld Posted July 28, 2015 Share Posted July 28, 2015 (edited) Hello, good evening. what is missing are file commands (GET, PUT ...) greeting Edited August 3, 2015 by funkheld Quote Link to comment Share on other sites More sharing options...
funkheld Posted July 28, 2015 Share Posted July 28, 2015 hello tebe. what this: ??? fpc -Mtp filename.pas greeting 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.