Jump to content
IGNORED

Mad Pascal


Recommended Posts

With cc65, you need to remember that there are only 6 bytes of register variables (really zeropage locations that are saved and restored depending on which ones your functions use-and this adds overhead to your function too!), but since you are using static local variables, the others that don't get fit as register are in BSS (ie. given a static location, and not on the C stack), which usually makes the code faster and smaller. In Ilmenit's code anyway.

 

In any project that isn't trivial, you will optimize your function variables appropriately, using register where appropriate and also just allocating your own zeropage variables also.

 

Also, as you've pointed out, printf family of functions are quite large... for obvious reasons I think (compatibility, portability, flexibility, etc...) Also, file I/O is also quite large with cc65 and is sometimes better to roll your own unless you are looking for portability, IMO.

Link to comment
Share on other sites

 

is nonsense.
none created more programs with the cc65 for atari800.
too much time spent on a working or still has other things on his mind.
cc65 is a waste of time from life.
greeting

 

I don't want to steal the thread but this is bullshit, software is being created in cc65: from this year at least: port of Moria and Turbo Snail. Previously The Hunt, Roxblox, His Dark Majesty etc.

 

Tebe, do you plan to create optimizer for Mad Pascal? I recently found a nice document about optimizations in VBCC compiler - a nice one for inspiration. Still a peephole optimizer would be probably the best. As more and more code is being created that outputs MADS asm (Effectus, Atalan) maybe it wouldn't be bad to create a peephole optimizer compatible for it :-) I think that 6502 CPU is simple enough even to create a superoptimizer for it. Would anyone like to participate in such project?

  • Like 3
Link to comment
Share on other sites

I noticed some changes in Mad Pascal 1.2.9. Procedures with assembler code are now followed with assembler directive and pushing and pulling of X register is done by txa:pha / pla:tax pair of code.

 

Graphics programs are really fast now with the help od FastGraph unit library. Circle and line examples simply vrooomm!!!

Link to comment
Share on other sites

news from future

 

recursion allowed, propably with new modificator like 'dynamic'

procedure name(a,b: integer); dynamic;

now all procedures/functions are dynamically allocated variables

 

with modificator 'dynamic' only selected, it's important for speed

recursion.zip

Edited by tebe
Link to comment
Share on other sites

What James said, but really I don't follow what you mean by 'dynamic'. Do you mean that will be required for recursion, or that recursion will be faster with it? Not understanding.

Normally, when you make a subroutine call in Pascal, local variables are supposed to go out of scope and the subroutine has it's own variable space on the stack.

They are preserved on the stack before the subroutine is executed and are restored when the subroutine returns.

That would be dynamic. The variables including parameters don't hold the same value from one call to the next.

Technically, I don't think it specifies you use a stack, that's just the typical approach.

 

I don't really know what Mad Pascal is doing but I assume something is static to make the program smaller and/or faster.

That would imply at present, some variable or parameter is stored in the same memory if you try a recursive call.

A recursive call of a subroutine could interfere with the previous call's variables.

But I'm just speculating since I haven't looked at what is going on.

Edited by JamesD
Link to comment
Share on other sites

Ah. Yeah that'd be a pretty big departure from normal Pascal. I guess I was assuming that Mad Pascal had the normal stack mechanisms. On such a limited machine, it's understandable, but I think they'll wind up wanting to go the normal call parameter stack route, and then maybe mark things as you mentioned if they want the static semantics and speed.

Link to comment
Share on other sites

  • 1 month later...

add VBXE (Color Map, 40x30, cell 8x8)

 

tested only with Altirra

// VBXE Color Map Graphics
 
uses crt, graph;
 
const
charsets = $8000;
 
var f: file;
    p: ^byte;
    chrAdr, i: byte;
 
    
procedure vbl; interrupt; assembler;
asm
{ mva >charsets chrAdr
 
jmp xitvbv
};
end;
 
 
procedure dli; interrupt; assembler;
asm
{ pha
 
lda chrAdr
sta wsync
sta chbase
 
add #4
sta chrAdr
 
pla
};
end;
 
 
begin
 
 InitGraph(vbxe, 12, '');
 
 p:=pointer(dpeek(88));
 assign(f, 'D:DONTTURN.SCR'); reset(f, 1);
 blockread(f, p, 40*24);
 close(f);
 
 p:=pointer(charsets);
 assign(f, 'D:DONTTURN.FNT'); reset(f, 1);
 blockread(f, p, 1024*;
 close(f);
 
 SetVideoBank($80);
 
 p:=pointer($4100+3*160);
 assign(f, 'D:DONTTURN.CMP'); reset(f, 1);
 blockread(f, p, 160*24);
 close(f);
 
 SetVideoBank(0);
 
 intr(iVBL, @vbl);
 
 intr(iDLI, @dli);
 
 p:=pointer(dpeek($230)+2);
 
 p^:=$f0;
 
 inc(p, 5);
 
 for i:=0 to 6 do begin
  p^:=$84;
  inc(p, 3);
 end;
 
 poke($d40e, $c0);
 
 SetBkColor(6);
 
 repeat until keypressed;
 
 clrscr;
end.

vbxe_mp.zip

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

MadPascal 1.3.0

 

+ {$i filename}
+ -o Optimize code
+ CONST by Type
const
a: word = 5; // WORD
b = 5; // BYTE
+ INTERRUPT, FORWARD, REGISTER
+ ColorMap (40x30x8x8) VBXE (unitGRAPH, CRT), SetColorMap, SetColorCell, SetVideoBank
+ SYSUTILS: TSearchRec, FindFirst, FindNext, FindClose
+ GRAPH: FillRect
+ SYSTEM: LOW, HIGH, SIZEOF, INTR (INTERRUPT_NUMBER), binStr, octStr, hexStr

post-4486-0-59838900-1456168526_thumb.png

mp_130.zip

post-4486-0-65135200-1456169523_thumb.png

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

  • 2 weeks later...

Is it possible to use Write routine with channel #6 in text modes 1 and 2? Or do I have to poke to display memory to show a character in specific color?

GotoXY and Write routines do seem to work only in text mode 0 and in window area in graphics modes.

Link to comment
Share on other sites

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...