dmsc Posted February 25, 2017 Share Posted February 25, 2017 (edited) Hi tebe, new, fixed MP 1.4.5, http://mads.atari8.info/mp_145.7z Sorry, I found another bug, this code should write "5" but writes "3": program bug2; var A : array [0..10] of byte; B, C : byte; begin B := 4; C := 5; A[C] := B - 1; writeln(C); end. Generated offending code for line 9 is: ldy B dey sty C sta adr.A,y Thanks again! Edited February 25, 2017 by dmsc 1 Quote Link to comment Share on other sites More sharing options...
tebe Posted February 25, 2017 Author Share Posted February 25, 2017 fixed mp_145_2.zip 2 Quote Link to comment Share on other sites More sharing options...
dmsc Posted February 25, 2017 Share Posted February 25, 2017 Hi tebe! fixed Many thanks! I will post my program soon. Quote Link to comment Share on other sites More sharing options...
dmsc Posted March 2, 2017 Share Posted March 2, 2017 Hi tebe!, mp_145_2.zip I modified Mad Pascal sources to add support for '$IFDEF', '$IFNDEF', '$ELSE', '$ENDIF', '$DEFINE' and '$UNDEF' directives, this allows having one source that compiles in multiple pascal versions, for example: {$ifndef ATARI} TextColor(Yellow}; {$else} TextAttrib := $80; {$endif} Attached is an archive with the modified "mp.pas" source file and a patch file with the alterations, it is mainly additions. Hope you can include this in the next Mad Pascal version! mp_patched.zip add-defines.patch.txt 1 Quote Link to comment Share on other sites More sharing options...
tebe Posted March 2, 2017 Author Share Posted March 2, 2017 (edited) thanks DMSC for the project support TextColor(Yellow); uses crt, vbxe, graph; begin InitGraph (mVBXE, 0 , ''); TextColor(color_Yellow); writeln('atari'); end. with VBXE TextColor is much colorfull Edited March 2, 2017 by tebe 1 Quote Link to comment Share on other sites More sharing options...
Gury Posted March 6, 2017 Share Posted March 6, 2017 (edited) The language is becoming more and more stable and mature, new release really differs from other versions. For one, it optimizes code better and is even closer to Pascal conventions, for example implementing uses and interface blocks in units. Great! Edited March 6, 2017 by Gury Quote Link to comment Share on other sites More sharing options...
tebe Posted March 12, 2017 Author Share Posted March 12, 2017 1.4.6 - conditional directives $IFDEF, $IFNDEF, $ELSE, $ENDIF, $DEFINE, $UNDEF (added by DMSC) - possible function result by EXIT(expression) - enumeration types (basic implementation) - two-dimensional array 3 Quote Link to comment Share on other sites More sharing options...
Gury Posted March 12, 2017 Share Posted March 12, 2017 I think support for two-dimensional arrays is one of the greatest features of Mad Pascal. Thank you, Tebe. 2 Quote Link to comment Share on other sites More sharing options...
dmsc Posted March 12, 2017 Share Posted March 12, 2017 Hi! 1.4.6 - conditional directives $IFDEF, $IFNDEF, $ELSE, $ENDIF, $DEFINE, $UNDEF (added by DMSC) - possible function result by EXIT(expression) - enumeration types (basic implementation) - two-dimensional array Very good!! I discovered two bugs: - In my "ifdef" implementation, the "ATARI" define is active only in the second pass, this makes using "ifdef" in an USES clause imposible. - The two dimensional array access does not work if the first parameter is a byte, because the argument is not expanded to a word before adding to the second parameter. Attached are two patches for those bugs, and the "mp.pas" with the patches applied. 0001-Fixes-parsing-of-defines-in-first-pass.patch.txt 0002-Fixes-array-index-access.patch.txt mp.pas.txt 1 Quote Link to comment Share on other sites More sharing options...
peteym5 Posted March 26, 2017 Share Posted March 26, 2017 Mads Pascal looks really interesting. I have been looking for something higher level than doing my games all in assembly, but don't want to deal with the memory overhead of compiled Turbo Basic. Plus the speed of using integers vs all floating point. Now it does have memory location control to what the start memory address will be? I will need to look through all the samples to figure that out. Quote Link to comment Share on other sites More sharing options...
Gury Posted May 6, 2017 Share Posted May 6, 2017 I struggle with GTIA mode 9 - 11 display list mixing with text and I am very curious how to synchronize all necessary registers to make simple display list (with dli and vbi), for example text mode 0 on top and the middle of the screen. Not just using graphics mode 8 text window on the bottom. GTIA modes are handled differently from other OS modes (handled by ANTIC chip). Sure, GTIA modes use the graphics mode 8 schema, but byte pixels are handled differently, two pixels per byte. Thanks for any help. Quote Link to comment Share on other sites More sharing options...
pps Posted May 10, 2017 Share Posted May 10, 2017 @Gury: I'll try to do something for you next days. Quote Link to comment Share on other sites More sharing options...
Gury Posted May 10, 2017 Share Posted May 10, 2017 (edited) Hi pps, Don't bother to much, it's not a hurry. I was not probably so clear what I try to achieve. GTIA modes share same schema as graphics mode 8 and generating a display list with text mode 0 (ANTIC mode 2) results in text, which looks blured and is not clear for human eye, because it is interlaced with GTIA mode bit pattern. To make text normal in GTIA modes 9, 10 and 11, you have to use DLI and VBI to synchronize all necessary registers to work properly in these modes. Here is a link to an example in Atari BASIC, which does just this. I will try to translate this program to Mad Pascal and we will see. Greetings Edited May 10, 2017 by Gury Quote Link to comment Share on other sites More sharing options...
Estece Posted May 18, 2017 Share Posted May 18, 2017 Hello! Thank You for mad pascal and keep up the good work Tebe! Gury this is what i have done //Mad pascal 18-05-2017 // //OPTION = ADVANCE TO NEXT GTIA MODE //SELECT = CLEAR SCREEN //START = FREEZE OR RESTART uses crt, graph; procedure dli; interrupt; //30 FOR I=1768 TO 1791:READ A:POKE I,A:NEXT I begin asm { pha sta $d40f sta $d40a //220 DATA 72,141,15,212,141,10,212 lda $2c0 eor $4f and $4e sta $d01a //230 DATA 173,192,2,69,79,37,78,141,26,208 lda #$00 sta $d01b pla }; end; //240 DATA 169,0,141,27,208,104,64 var m,c,t,i,j,a,b:byte; label line80,line90,line190; procedure gosub210; begin ClrScr; FillChar(pointer(DPeek(Dpeek(560)+4)),94*40,0); FillChar(pointer(DPeek(Dpeek(560)+100)),66*40,0); for i:=1 to 200 do; end; //210 PRINT #6;CHR$(125):FOR I=1 TO 200:NEXT I:RETURN begin Poke(54286,64); Initgraph(; //10 POKE 54286,64:GRAPHICS 8 Poke(Peek(560)+Peek(561)*256+166,143); //20 POKE PEEK(560)+256*PEEK(561)+166,143 SetIntVec(iDLI, @dli); //40 POKE 512,232:POKE 513,6 Poke(54286,192); Poke(87,9); m:=1; //50 POKE 54286,192:POKE 87,9:M=1 Poke(704,0); Poke(705,26); Poke(706,54); Poke(707,84); //60 POKE 704,0:POKE 705,26:POKE 706,54:POKE 707,84 Poke(708,104); Poke(709,130); Poke(710,184); Poke(711,218); //70 POKE 708,104:POKE 709,130:POKE 710,184:POKE 711,218 line80:; if m=1 then t:=128; if m=2 then t:=12; if m=3 then t:=6; Poke(712,t); Poke(623,m*64); c:=0; //80 POKE 712,6+122*(M=1)+6*(M=2):POKE 623,64*M:C=0 line90:; t:=8; if m<>2 then t:=14; SetColor(Random(t)+1); //90 COLOR (8+6*(M<>2))*RND(0)+1 i:=Random(72)+4; j:=Random(72)+4; //100 I=INT(72*RND(0))+4:J=INT(72*RND(0))+4 a:=Random(144)+8; b:=Random(144)+8; //110 A=INT(144*RND(0))+8:B=INT(144*RND(0))+8 MoveTo(i,a+1); LineTo(j,a+1); LineTo(j,b+1); LineTo(i,b+1); //120 PLOT I,A+1:DRAWTO J,A+1:DRAWTO J,B+1:DRAWTO I,B+1 MoveTo(j,b); LineTo(i,b); LineTo(i,a); LineTo(j,a); //130 PLOT J,B:DRAWTO I,B:DRAWTO I,A:DRAWTO J,A Inc(c); Poke(752,1); WriteLn(' MODE=',m+8,' #',c); //140 C=C+1:POKE 752,1:PRINT " MODE=";M+8;" #";C a:=Consol; if a=7 then goto line90; //150 A=PEEK(53279):IF A=7 THEN 90 Poke(77,0); if a<4 then begin gosub210; Inc(m); if m=4 then Dec(m,3); goto line80; end; //160 POKE 77,0:IF A<4 THEN GOSUB 210:M=M+1-3*(M=3):GOTO 80 if a<6 then begin gosub210; c:=0; goto line90; end; //170 IF A<6 THEN GOSUB 210:C=0:GOTO 90 writeln(' **** FREEZE ****'); for i:=1 to 200 do; //180 PRINT " **** FREEZE ****":FOR I=1 TO 200:NEXT I line190:; if Consol<>6 then goto line190; //190 IF PEEK(53279)<>6 THEN 190 Poke(77,0); for i:=1 to 50 do; goto line90; //200 POKE 77,0:FOR I=1 TO 50:NEXT I:GOTO 90 end. rect.obx Quote Link to comment Share on other sites More sharing options...
Gury Posted May 18, 2017 Share Posted May 18, 2017 Hi Estece, this is exactly what I was asking for Thank you! Greetings P.S. Some people don't like to see goto statement in Pascal language It can be arguably replaced by a branch/loop statement in any one situation. Quote Link to comment Share on other sites More sharing options...
tebe Posted May 21, 2017 Author Share Posted May 21, 2017 MadPascal 1.4.7 http://mads.atari8.info - optimization: imulBYTE, imulWORD, imulCARD, mulSHORTINT, mulSMALLINT, mulINTEGER - add support pointer to record, example: type TPoint = record x,y: smallint end; var a,b: ^TPoint; begin a^.y := b^.x; a^ := b^; end. - add support section INITIALIZATION in units - add new type EXTMEM in resource file $R (load data to extended ram) - add new type OBJECT, (RECORD with methods), example: type TMemoryStream = Object Position: cardinal; Size: cardinal; procedure Create; procedure ReadBuffer(var Buffer; Count: word); procedure WriteBuffer(var Buffer; Count: word); end; - unit CMC, MPT, RMT replaced with OBJECT p.s. TMemoryStream example -> ..\example\extmem\ new game MadKingdom by Bocianu -> ..\example\MadKingdom 3 Quote Link to comment Share on other sites More sharing options...
dmsc Posted May 23, 2017 Share Posted May 23, 2017 Hi tebe! tebe, on 21 May 2017 - 1:06 PM, said: MadPascal 1.4.7 http://mads.atari8.info - optimization: imulBYTE, imulWORD, imulCARD, mulSHORTINT, mulSMALLINT, mulINTEGER ... Superb! Now that two-dimensional arrays work ok, here is a version of my solitaire game that compiles for MadPascal, TP7 and FreePascal, using the corresponding text modes for each platform. And thanks to the optimizations, the XEX is smaller than before . sol_v17.pas.txt sol_v17.xex Quote Link to comment Share on other sites More sharing options...
Gury Posted May 23, 2017 Share Posted May 23, 2017 Great! Quote Link to comment Share on other sites More sharing options...
peteym5 Posted May 23, 2017 Share Posted May 23, 2017 When I try compiling the program with a .bat file in Windows 10, I am getting "identifier not found 'INITGRAPH' " Not sure what I am doing wrong. All the sub-directories are available inside the folder. Quote Link to comment Share on other sites More sharing options...
tebe Posted May 24, 2017 Author Share Posted May 24, 2017 (edited) folder example: D:\dir1\PAS6502\dir2\dir3\ execute: ..\..\mp.exe filename.pas or execute: cd D:\dir1\PAS6502\ mp dir2\dir3\filename.pas Edited May 24, 2017 by tebe Quote Link to comment Share on other sites More sharing options...
peteym5 Posted May 24, 2017 Share Posted May 24, 2017 I figured what is missing a line at the beginning of the code. uses crt, fastgraph; I am looking into Mad Pascal as an alternative to doing programs all in Assembly. Is there a way to set the program start address? I do admit optimized assembly VBI routines can generate amazing game play, so that part probably remain as assembly. What slows me do is doing stuff like initializing levels, setting up screens, splash title game and setting game options, displaying texts, etc. Those things can be handled by a higher level language like compiled Turbo Basic or the Mad Pascal. Quote Link to comment Share on other sites More sharing options...
snicklin Posted June 20, 2017 Share Posted June 20, 2017 Is there any way in Mad Pascal that a compiled file can then load and run another compiled file? i.e. Can you chain together multiple programs? Quote Link to comment Share on other sites More sharing options...
snicklin Posted June 21, 2017 Share Posted June 21, 2017 Is there a way to set the program start address? I think that this would be quite critical for anyone using Mad Pascal, especially if mixing the program with assembly routines loaded in. Quote Link to comment Share on other sites More sharing options...
pirx Posted June 21, 2017 Share Posted June 21, 2017 Well, haven't looked at the MP code, but it generates MADS source, so it can be modified there: CODEORIGIN = $2000 org CODEORIGIN - not ideal solution, but one could add something like sed 's/CODEORIGIN = $2000/CODEORIGIN = $3000/' filename.a65 to the compile script / make and voila Quote Link to comment Share on other sites More sharing options...
peteym5 Posted July 10, 2017 Share Posted July 10, 2017 Well, haven't looked at the MP code, but it generates MADS source, so it can be modified there: CODEORIGIN = $2000 org CODEORIGIN - not ideal solution, but one could add something like sed 's/CODEORIGIN = $2000/CODEORIGIN = $3000/' filename.a65 to the compile script / make and voila I found that. What I will be changing it to is $8000 or $A000 and run from a cartridge. As long as the program stays within the memory size, it should work. Can also use Inflate to expand sections into RAM before executing subroutines. I learned a little of this programming language a few months ago and do believe it is an easier alternative to making games all in assembly. I have a group of people who want some cartridge games made, but they are not much beyond using Basic. Trying to teach them how to do assembler via telecommunication will take forever. So MADS PASCAL, MADS ASSEMBLER, and MADS STUDIO are a great alternatives. Maybe someone can make up some webpage tutorials, or video tutorials and post them on youtube. 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.