Jump to content

Mad Pascal

Recommended Posts

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.


uses crt, graph;
var f: file;
txt: string;
 assign(f, 'S:'); rewrite(f,1);
 blockwrite(f, txt[1], length(txt));
 blockwrite(f, txt[1], length(txt));
 repeat until keypressed;
  • Like 2
Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...
  • 2 weeks later...

VBXE blitter



{$r blit.rc}
uses crt, graph, vbxe;
sinustable: array [0..255] of byte = (
$80, $7d, $7a, $77, $74, $70, $6d, $6a,
$67, $64, $61, $5e, $5b, $58, $55, $52,
$4f, $4d, $4a, $47, $44, $41, $3f, $3c,
$39, $37, $34, $32, $2f, $2d, $2b, $28,
$26, $24, $22, $20, $1e, $1c, $1a, $18,
$16, $15, $13, $11, $10, $0f, $0d, $0c,
$0b, $0a, $08, $07, $06, $06, $05, $04,
$03, $03, $02, $02, $02, $01, $01, $01,
$01, $01, $01, $01, $02, $02, $02, $03,
$03, $04, $05, $06, $06, $07, $08, $0a,
$0b, $0c, $0d, $0f, $10, $11, $13, $15,
$16, $18, $1a, $1c, $1e, $20, $22, $24,
$26, $28, $2b, $2d, $2f, $32, $34, $37,
$39, $3c, $3f, $41, $44, $47, $4a, $4d,
$4f, $52, $55, $58, $5b, $5e, $61, $64,
$67, $6a, $6d, $70, $74, $77, $7a, $7d,
$80, $83, $86, $89, $8c, $90, $93, $96,
$99, $9c, $9f, $a2, $a5, $a8, $ab, $ae,
$b1, $b3, $b6, $b9, $bc, $bf, $c1, $c4,
$c7, $c9, $cc, $ce, $d1, $d3, $d5, $d8,
$da, $dc, $de, $e0, $e2, $e4, $e6, $e8,
$ea, $eb, $ed, $ef, $f0, $f1, $f3, $f4,
$f5, $f6, $f8, $f9, $fa, $fa, $fb, $fc,
$fd, $fd, $fe, $fe, $fe, $ff, $ff, $ff,
$ff, $ff, $ff, $ff, $fe, $fe, $fe, $fd,
$fd, $fc, $fb, $fa, $fa, $f9, $f8, $f6,
$f5, $f4, $f3, $f1, $f0, $ef, $ed, $eb,
$ea, $e8, $e6, $e4, $e2, $e0, $de, $dc,
$da, $d8, $d5, $d3, $d1, $ce, $cc, $c9,
$c7, $c4, $c1, $bf, $bc, $b9, $b6, $b3,
$b1, $ae, $ab, $a8, $a5, $a2, $9f, $9c,
$99, $96, $93, $90, $8c, $89, $86, $83
bonus = $18000; // adres bitmapy w pamięci VBXE, ladowana przez RESOURCE $R
src0 = bonus + 0;
src1 = bonus + 16;
src2 = bonus + 16*2;
src3 = bonus + 16*3;
src4 = bonus + 16*4;
src5 = bonus + 16*5;
src6 = bonus + 16*6;
src7 = bonus + 16*7;
src8 = bonus + 16*8;
src9 = bonus + 16*9;
dst0 = VBXE_OVRADR+16*320+24;
dst1 = VBXE_OVRADR+16*2*320+24;
dst2 = VBXE_OVRADR+16*3*320+24;
dst3 = VBXE_OVRADR+16*4*320+24;
dst4 = VBXE_OVRADR+16*5*320+24;
dst5 = VBXE_OVRADR+16*6*320+24;
dst6 = VBXE_OVRADR+16*7*320+24;
dst7 = VBXE_OVRADR+16*8*320+24;
dst8 = VBXE_OVRADR+16*9*320+24;
dst9 = VBXE_OVRADR+16*10*320+24;
var i: byte;
blit0: TBCB absolute $4000;
blit1: TBCB absolute $4000+21;
blit2: TBCB absolute $4000+21*2;
blit3: TBCB absolute $4000+21*3;
blit4: TBCB absolute $4000+21*4;
blit5: TBCB absolute $4000+21*5;
blit6: TBCB absolute $4000+21*6;
blit7: TBCB absolute $4000+21*7;
blit8: TBCB absolute $4000+21*8;
blit9: TBCB absolute $4000+21*9;
procedure InitBlit(var a: TBCB; src, dst: cardinal; ctr: byte);
 fillbyte(a, 0, sizeof(a));
 a.src_adr.byte2:=src shr 16;
 a.src_adr.byte1:=src shr 8;
 a.dst_adr.byte2:=dst shr 16;
 a.dst_adr.byte1:=dst shr 8;
procedure MoveBlit(var a: TBCB; dst: cardinal);
 a.dst_adr.byte2 := dst shr 16;
 a.dst_adr.byte1 := dst shr 8;
 a.dst_adr.byte0 := dst;
 a.blt_and_mask := $ff;
 InitGraph(vbxe, 0, '');
 if GraphResult <> grOK then begin
  writeln('VBXE not detected');
 InitBlit(blit0, src0, dst0, %1000);
 InitBlit(blit1, src1, dst1, %1000);
 InitBlit(blit2, src2, dst2, %1000);
 InitBlit(blit3, src3, dst3, %1000);
 InitBlit(blit4, src4, dst4, %1000);
 InitBlit(blit5, src5, dst5, %1000);
 InitBlit(blit6, src6, dst6, %1000);
 InitBlit(blit7, src7, dst7, %1000);
 InitBlit(blit8, src8, dst8, %1000);
 InitBlit(blit9, src9, dst9, 0);
 blit0.blt_and_mask := 0; // clear
 blit1.blt_and_mask := 0; //
 blit2.blt_and_mask := 0; //
 blit3.blt_and_mask := 0; //
 blit4.blt_and_mask := 0; //
 blit5.blt_and_mask := 0; //
 blit6.blt_and_mask := 0; //
 blit7.blt_and_mask := 0; //
 blit8.blt_and_mask := 0; //
 blit9.blt_and_mask := 0; //
 RunBlit(Blit0); //
 MoveBlit(blit0, dst0 + sinustable[i]);
 MoveBlit(blit1, dst1 + sinustable[i+16]);
 MoveBlit(blit2, dst2 + sinustable[i+16*2]);
 MoveBlit(blit3, dst3 + sinustable[i+16*3]);
 MoveBlit(blit4, dst4 + sinustable[i+16*4]);
 MoveBlit(blit5, dst5 + sinustable[i+16*5]);
 MoveBlit(blit6, dst6 + sinustable[i+16*6]);
 MoveBlit(blit7, dst7 + sinustable[i+16*7]);
 MoveBlit(blit8, dst8 + sinustable[i+16*8]);
 MoveBlit(blit9, dst9 + sinustable[i+16*9]);
 until keypressed;



  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...


I started with larger project in Mad Pascal, but I came across with a problem of free available memory for code and variables. Normally I try to develop in structured fashion, with custom variables and routines as I need them. Now I try to use as few variables as I can, making routines with more functionality, to make room for additonal code.


To make maximum use of free memory, I have to (correct me if I am wrong):

- declare variables on absolute addresses with data (allowed memory locations)

- use moderate amount of variables

- make routines with more functionality to shrink amount of additional routines



Now here is a question... Does normally Mad Pascal code size depend on free available memory? Is Mad Pascal capable of smart linking (using routines in units as needed)? I tested this and it is obviously not the case, so I have to remove routines which are not needed.


Sorry for my annoyance and greetings :)


Link to comment
Share on other sites

Ok, thx, I use these options anyway. I will prepare special MP environment with only necessary core library routines, some variables directed to specific free locations (if needed) and probably resource file data, also on specific memory locations.


Normal Mad Pascal object code size is cca 29k - 30k (used by standard available free memory), but I can get along with data on specific addresses.


It would be wonderful, someday of course, to adapt Mad Pascal using additional XL memory (with PORTB flag set) or other free memory for code. Just a thought.


Greetings and thank you for such a great language!

Link to comment
Share on other sites

Wow, tebe made an rmt library :)


For everyone who wants amiga style stereo playback of rmt modules, simply use this resource of the rmt_player routine instead the provided one in the examples: rmt_pl_stereo.obx


Notice, this one is not optimised and will have all features of rmt included, so maybe compile your own routine if, you want it to use less of the memory.

  • Like 1
Link to comment
Share on other sites



Here's another small patch needed to compile blit.pas VBXE example on Linux. And static binaries (32-bit) for Linux.

Mp + VBXE is... like a dream come true :)



Damn right! I never thought I would have a reason to try learning Pascal for anything these days.

Link to comment
Share on other sites

And I never thought of ever using Pascal for anything other than looking at old code.

I am glad you figured it out :) The fact is that Pascal is as strong as C for several years, from Turbo Pascal, Delphi and now Lazarus and Free Pascal on PC platform.

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.

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.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...