tebe Posted May 16, 2018 Author Share Posted May 16, 2018 thx DMSC, you are right, it's BUG Quote Link to comment Share on other sites More sharing options...
Lastic Posted May 17, 2018 Share Posted May 17, 2018 Hi! . The provided mp.pas source has an error, I don't know if the posted EXE cames from the same source. In line 16945, changes the "j" inside the function call to "i", so the line changes from: j := CompileConstFactor(j, ConstVal, ConstValType); to read: j := CompileConstFactor(i, ConstVal, ConstValType); . Without this, the program fails depending on the uninitialized value of "j". Also, another error on line 23193, change "i" to "j" on the Error call, the line must read: Error(j, 'Unresolved forward declaration of ' + Ident[j].Name); . After that, compile with " fpc -MDelphi -Os -Xi -Xs -XX mp-155.fix.pas " to get a working executable. Thanks a lot for the quick reply, it works now. Now I'm stuck with the workflow on how to create an Atari executable. I compile the Pascal source with mp sourcename.pas, this creates an sourcename.a65 , which is Mads assembler if I'm correct. Then I should create the executable with : mads source name.a65 , correct ? I'll have another look at the mads documentation also. Quote Link to comment Share on other sites More sharing options...
tebe Posted May 17, 2018 Author Share Posted May 17, 2018 mads filename.a65 -x -i:base \base\ is MP folder 1 Quote Link to comment Share on other sites More sharing options...
Lastic Posted May 17, 2018 Share Posted May 17, 2018 mads filename.a65 -x -i:base \base\ is MP folder Thanks, it kept failing until I figured out that you have to give the absolute filepath to the base folder. Mads & Mad Pascal is absolutely fabulous, all the examples included will provide me with a lot of learning material , loving it. Quote Link to comment Share on other sites More sharing options...
JoSch Posted June 29, 2018 Share Posted June 29, 2018 Looks like the UNIT parsing is screwed up in MP 1.5.5. I cannot compile the UNITs anymore. I even tried to compile the Mad Kingdom cardgui.pas, but that only gets me: Error: Syntax error, 'BEGIN' expected but 'UNIT' found. Quote Link to comment Share on other sites More sharing options...
tebe Posted June 29, 2018 Author Share Posted June 29, 2018 (edited) compile UNIT? there has never been such functionality http://wiki.freepascal.org/Unit Edited June 29, 2018 by tebe Quote Link to comment Share on other sites More sharing options...
JoSch Posted June 29, 2018 Share Posted June 29, 2018 So, you compile the main program. And MP compiles the necessary units. Then, why it doesn't recognize the function I have in a unit? See the attached code. 8ray.zip Quote Link to comment Share on other sites More sharing options...
bocianu Posted June 29, 2018 Share Posted June 29, 2018 You need to put headers of public functions into interface section. 8ray.zip Quote Link to comment Share on other sites More sharing options...
JoSch Posted June 29, 2018 Share Posted June 29, 2018 I didn't? Well, the code is two years old. So, I missed something. Stupid me. Quote Link to comment Share on other sites More sharing options...
bocianu Posted June 29, 2018 Share Posted June 29, 2018 Don't be so self critical, that could work 2 years ago In previous versions of MP, there was no distinction between public and private methods. It was introduced in version 1.4.5, on my personal request as far as I remember Quote Link to comment Share on other sites More sharing options...
pirx Posted June 30, 2018 Share Posted June 30, 2018 Question / idea: asm {} block is fantastic and stuff and I see only one serious drawback of using it on a wider scale - Pascal code can not access asm labels / addresses. It is fully understandable, it is just a foreign body in a Pascal source code. maybe it could be possible to define variables in Pascal as placeholders for asm variables, so when the code gets to be assembled by MADS, the variables are naturally recognised and used in assembly. No really good example on hand, but I had this idea: var dl_addr1 : word; //?????? pointer? //display list internals asm{ .by $41 dl_addr1 .word scr } so dl_addr1 could be accessed directly in Mad Pascal. Is such a construct possible already? If not, would it be possible to have it added? Quote Link to comment Share on other sites More sharing options...
JoSch Posted July 2, 2018 Share Posted July 2, 2018 Don't be so self critical, that could work 2 years ago In previous versions of MP, there was no distinction between public and private methods. It was introduced in version 1.4.5, on my personal request as far as I remember Yeah, but I could have researched that. Or open my eyes, because the samples have the interface declaration BTW, shouldn't the missing interface be flagged as error? Quote Link to comment Share on other sites More sharing options...
JoSch Posted July 2, 2018 Share Posted July 2, 2018 Question / idea:[...] Is such a construct possible already? If not, would it be possible to have it added? How about: var dl_arr1: word asm = $4000; # Adress is optional. asm { sta dl_arr1 } Quote Link to comment Share on other sites More sharing options...
tebe Posted July 2, 2018 Author Share Posted July 2, 2018 (edited) var dst: word absolute $8000; procedure test; assembler; var src: word absolute $4000; asm { lda src sta dst lda src+1 sta dst+1 mwa #111 src }; end; function test2: word; assembler; asm { lda MAIN.TEST.src sta Result lda MAIN.TEST.src+1 sta Result+1 }; end; begin test; writeln(test2); end. Edited July 2, 2018 by tebe Quote Link to comment Share on other sites More sharing options...
pirx Posted July 2, 2018 Share Posted July 2, 2018 How about: var dl_arr1: word asm = $4000; # Adress is optional. asm { sta dl_arr1 } Yes, this way it is easy, I was rather thinking about being able to DPoke(dl_addr1, scr2); from Pascal so it changes the value inside the asm{} block. But I need to analyse TeBe's example, possibly it is what I wanted, just do not understand it on a first glance. Quote Link to comment Share on other sites More sharing options...
pirx Posted July 2, 2018 Share Posted July 2, 2018 (edited) Hi! Thanks again for the example, I was not clear enough, but I meant something like in the example below - way to access variables that are defined inside ASM{} block. The code below compiles, but obviously does not work as MP does not know what "src_mod" is. Proposal: define it like this var src_mod: word asm_placeholder; and pass just the label "src_mod" itself without any value to MADS, that would be able to compile it using correct address. I understand it might be impossible, just asking. var src_mod: word; //??? procedure test; assembler; var src: word absolute $4000; asm { src_mod lda #111 sta src }; end; function test2: word; assembler; asm { lda MAIN.TEST.src sta Result lda MAIN.TEST.src+1 sta Result+1 }; end; begin test; writeln(test2); Poke(src_mod+1,112); writeln(test2); end. Edited July 2, 2018 by pirx Quote Link to comment Share on other sites More sharing options...
bocianu Posted July 2, 2018 Share Posted July 2, 2018 (edited) It's possible to access asm labels, but you have to write some kind of 'accessor function' Not very convenient, especialy when you wish to access plenty of labels... but still possible. function test:byte; assembler; asm { mylabel lda #123 sta result }; end; function mylabel:word; assembler; asm { mwa #test.mylabel result }; end; begin writeln(test); // 123 poke(mylabel+1, 33); writeln(test); // 33 ! Readkey; end. Edited July 2, 2018 by bocianu Quote Link to comment Share on other sites More sharing options...
pirx Posted July 2, 2018 Share Posted July 2, 2018 ha, nice! Indeed, I was thinking about many labels, as many as lines on the screen in fact Quote Link to comment Share on other sites More sharing options...
JoSch Posted July 3, 2018 Share Posted July 3, 2018 (edited) Hi. This doesn't seem to be supported at the moment. Am I correct? type Vector = object function add(x, y: Vector): Vector; end; FreePascal uses this syntax for classes: type Vector = Class; Vector = Class function add(x, y: Vector): Vector; end; Is it possible to implement something like that? Edited July 3, 2018 by JoSch Quote Link to comment Share on other sites More sharing options...
tebe Posted July 14, 2018 Author Share Posted July 14, 2018 Hi. This doesn't seem to be supported at the moment. Am I correct? type Vector = object function add(x, y: Vector): Vector; end; yes, you're right Quote Link to comment Share on other sites More sharing options...
tebe Posted July 14, 2018 Author Share Posted July 14, 2018 (edited) MadPascal 1.5.6 http://mads.atari8.info - SYSUTILS: Click - SYSTEM: Sqrt(Integer): Single - MATH: Sign - added new functionality, function returns result by its name, previously only through the variable RESULT - adding support for STRING arrays (example /games/tower.pas) - new directive {$LIBRARYPATH path1;path2;...} - new library BLIBS - PASDOC (https://gitlab.com/bocianu/pasdoc) (* source: CLSN PASCAL *) (* This program uses a mutually *) (* recursive routine to calculate *) (* the number PI *) uses crt; function a(t: byte): single; forward; function b(n: byte): single; begin if (n=0) then b:=1/sqrt(2) else b:=sqrt(a(n-1)*b(n-1)); end; function a(t:byte): single; begin if (t=0) then a:=1 else a:=(a(t-1)+b(t-1))*0.5; end; function d(n: byte): single; var j: byte; s: single; begin s:=0; for j:=1 to n do s:=s+(1 shl (j+1))*(sqr(a(j))-sqr(b(j))); d:=1-s; end; function x_pi: single; const level=2; begin x_pi:=4*a(level)*b(level)/d(level); end; begin writeln('PI=',x_pi); repeat until keypressed; end. Edited July 14, 2018 by tebe 3 Quote Link to comment Share on other sites More sharing options...
JoSch Posted July 14, 2018 Share Posted July 14, 2018 yes, you're right Any chance for support? Quote Link to comment Share on other sites More sharing options...
tebe Posted July 16, 2018 Author Share Posted July 16, 2018 MadPascal 1.5.7 is arrived (bugs were slaughtered) Any chance for support? maybe in the future 1 Quote Link to comment Share on other sites More sharing options...
tebe Posted November 22, 2018 Author Share Posted November 22, 2018 Mad Pascal 1.5.8, http://mads.atari8.info - GRAPHICS: Font, FontInitialize, FillRect, TextOut, TextWidth, MoveTo, LineTo - SYSTEM: FileMode (RESET), [fmOpenRead, fmOpenWrite, fmOpenAppend, fmOpenReadWrite] - {$info user_defined}, {$warning user_defined}, {$error user_defined}, {$include filename}, {$resource filename} - PROGRAM (par1, par2 ...) - MAIN.@DEFINES.name 4 Quote Link to comment Share on other sites More sharing options...
tebe Posted July 21, 2019 Author Share Posted July 21, 2019 MadPascal 1.6.0, http://mads.atari8.info - SYSTEM: TDateTime - GRAPH, FASTGRAPH: Arc, PieSlice, TLastArcCoords, LastArcCoords - SYSUTILS: Now, Date, DateToStr, DecodeDate, DecodeDateTime, DecodeTime, EncodeDate, EncodeDateTime, EncodeTime, IsLeapYear, BoolToStr, StrToBool - STRUTILS: AddChar, AddCharR, PadLeft, PadRight - dodana obsługa {$INCLUDE %DATE%}, {$INCLUDE %TIME%}, https://www.freepascal.org/docs-html/prog/progsu41.html - -CODE:, -DATA:, -STACK:, -ZPAGE: without '$' mark 5 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.