Jump to content
IGNORED

Mad Pascal


Recommended Posts

5 hours ago, JesperGravgaard said:

However, I am somewhat unsure in which tests "higher is better" and in which "lower is better".

Is there a list showing this somewhere, that I have missed?

@zbyti maybe you can point me in the right direction.

Screenshot_2020-11-13_11-31-42.thumb.png.028d6428b88df6397000b8d3fcb806b5.png

 

If the title of the benchmark contains word FRAMES the score is a number of iterations (for example in 200 frames) and more is better. In other cases score means execution time in frames and less is better.

Edited by zbyti
FRAMES / TICKS / JIFFIES :D
  • Like 2
Link to comment
Share on other sites

I've updated to MP 1.6.4. See errors below when I try to change from "function f():a" to procedure p(var a)" when a is s struct. 

 

@tebe Since the link of the MADS page goes to the releases overview, it would probably best to not mention a version there anymore.

 

// Datenstrukturen für Variablen im Spiel
type hund_aktion = ( hund_stehen=0, hund_hoch=1, hund_runter=2, hund_links=3, hund_rechts=4);

//const hund_stehen: hund_aktion=0;
//const hund_hoch:   hund_aktion=1;
//const hund_runter: hund_aktion=2;

// hund_hoch=1, hund_runter=2, hund_links=3, hund_rechts=4);
type thund = record 
                aussehen: zeichen;
                spalte: zahl;
                zeile: zahl;
                alte_spalte: zahl;
                alte_zeile: zahl;
                aktion: hund_aktion;
                aktion_dauer: zahl;
             end;


function AnimiereHund2(hund: thund): thund;
begin

  if hund.aktion_dauer = 0 then
  begin
      hund.aktion:=hund_aktion(Random(5));
      hund.aktion_dauer:=Random(5);
  end;
  AnimiereHund2:=hund;
end;

procedure AnimiereHund(var hund: thund);
begin

  if hund.aktion_dauer = 0 then
  begin
      hund.aktion:=hund_aktion(Random(5));
      hund.aktion_dauer:=Random(5);
  end;
end;

 

Mad Pascal Compiler version 1.6.4 [2020/10/04] for 6502
Compiling pas\Lilly.pas
pas\lfiguren.pas (153,8) Error: Incompatible types: got "HUND.AKTION" expected "ENUM"
ERROR: MP error occurred. See messages above.

Link to comment
Share on other sites

Mad Pascal Compiler version 1.6.5 [2020/11/03] for 6502
Compiling hello.pas
hello.pas (10,27) Error: Identifier not found 'ZEICHEN'

 

@JAC! Can you provide a complete example?

 

EDIT: okay all in all I wouldn't take care of it anyway ;) 

Edited by zbyti
all types, begin .. end.
Link to comment
Share on other sites

  • 3 weeks later...

My joystick example:

const
  JOY_LEFT            = %1000;
  JOY_RIGHT           = %0100;
  JOY_UP              = %0010;
  JOY_DOWN            = %0001;
var
  bHposp0      : byte absolute 0;
  bHposp1      : byte absolute 1;
  bShipY       : byte absolute 2;
  joyDirection : byte absolute 3;
  bMask        : byte absolute $ff;
  bIter        : byte absolute $fd;
  wShipX       : word absolute 0;
  HPOSP01      : word absolute $D000;  

procedure copyShip;
begin
  Move(pointer(GFX_SHIP_ADR), pointer(P0_ADR + bShipY), GFX_SHIP_SEG);
  Move(pointer(GFX_SHIP_ADR + GFX_SHIP_SEG), pointer(P1_ADR + bShipY), GFX_SHIP_SEG);
end;

procedure moveShip;
begin
  bMask := %1100;
  for bIter := 1 downto 0 do begin
    case (joyDirection and bMask) of
      JOY_RIGHT: begin
        if bHposp1 < SHIP_RIGHT_LIMIT then begin
          Inc(wShipX,$0101); HPOSP01 := wShipX;
        end;
      end;
      JOY_LEFT: begin
        if bHposp0 > SHIP_LEFT_LIMIT then begin
          Dec(wShipX,$0101); HPOSP01 := wShipX;
        end;
      end;
      JOY_UP: begin
        if bShipY > SHIP_TOP_LIMIT then begin
          Dec(bShipY); copyShip;
        end;
      end;
      JOY_DOWN: begin
        if bShipY < SHIP_BOTTOM_LIMIT then begin
          Inc(bShipY); copyShip;
        end;
      end;
    end;
    bMask := %0011;
  end;
end;
joyDirection := PORTA;
if (joyDirection and %1111) <> %1111 then moveShip;

Screenshot_2020-12-05_12-31-23.thumb.png.be5f9f7db3169f689e98c2749b7c934d.png

main.xex

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

  • 3 weeks later...

Hi!

1 hour ago, MrFish said:

New? It shows the most recent version 1.6.4 with a release date of October 4, 2020.

Well, tebe has not updated the version number since Oct 12, when he uploaded 1.6.5: https://github.com/tebe6502/Mad-Pascal/commit/bc01ebd

He always include the "mp.exe" file in the repo, so you can just download as a ZIP and use from there.

 

You can see all the changes via google-translate: https://translate.google.com/translate?sl=auto&tl=en&u=https://github.com/tebe6502/Mad-Pascal/blob/master/CHANGELOG

 

Have Fun!

Link to comment
Share on other sites

Hi!

I'd like to load data from a rather large file at certain positions. See example code.
Unfortunately the "seek" function seems to only work in SDX (I tested with xBootDOS and DOS25)


Since I have no experience yet on what alternative method could be used to set a file handle to a certain position in a file,
I'd be grateful if somebody has an idea how to manage that. 

procedure seek_map(chunk: byte);
begin
  buf := pointer(TXT1+40);   //Test: Point to text area
  //buf := pointer(TILES_BUFFER);
  // Open file
  Assign(fil, 'D1:BRIT.DAT');
  // Read data
  Reset(fil,1);
  Seek(fil,chunk*256);      // SEEK does not work?
  BlockRead(fil, buf, 40);   // Test: show 40 characters at TXT1
  // Close file
  Close(fil);
end;

 

Link to comment
Share on other sites

DOS 2.5 and similar set sector number, only SDX file positions

 

unti SYSTEM


procedure Seek(var f: file; a: cardinal); assembler;
(*
@description:
Set file position (SDX only)

@param: f - file handle
@param: a - new position
*)
asm
{    txa:pha

    mwa f :bp2

    ldy #s@file.chanel
    lda (:bp2),y
    tax
    lda #37
    sta iccmd,x

    ldy #s@file.record
    lda (:bp2),y
    sta eax
    iny
    lda (:bp2),y
    sta eax+1
    lda #$00
    sta eax+2
    sta eax+3

    mva a ecx
    mva a+1 ecx+1
    mva a+2 ecx+2
    mva a+3 ecx+3

    jsr imulECX

    mva eax icax3,x
    mva eax+1 icax4,x
    mva eax+2 icax5,x

    m@call    ciov

    sty IOResult

    pla:tax
};
end;

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

Thank you very much TeBe and XXL!


I (theoretically) get the concept now; but i couldn't put it down in code; my assembler skills - an knowledge of the OS system calls - are to little yet.

 

Maybe equivalent implementations of the BASIC POINT and NOTE commands  - or  some set/getsector() functions - would be a nice future addition to the MAD Pascal library 

 

:)

 

 

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