madpascal is making nice progress...

All aspects of programming on the Commander X16.
Post Reply
funkheld
Posts: 268
Joined: Mon Feb 26, 2024 11:11 am

madpascal is making nice progress...

Post by funkheld »

Hi good afternoon.

https://github.com/MADRAFi/Mad-Pascal/tree/x16
Madpascal for the x16 is only at the beginning of development.
A few x16 system commands still need to be implemented here.

could be a good intermediate level for basic and C.

I made a demo for the x16 with right-left scrolling.
layer0 with image and layer1 with text.

greeting

Code: Select all

uses x16_vera, x16, crt;

var
    i: byte;
    d: word;
    stop: Boolean;
    z: byte;
    u: byte;
	
procedure rechts;
begin
 z:=z-1;
 if z=255 then begin
   u:=u-1;
   Poke($9F38,u); 
 end;	
  
 Poke($9F37,z);
end;

procedure links;
begin
 z:=z+1;
 if z=0 then begin
   u:=u+1;
   Poke($9F38,u); 
 end;	
 
 Poke($9F37,z);
end;

	
Procedure KeyScan;
var c2: char;
begin

If KeyPressed then
    begin
      C2 := UpCase(ReadKey);

	case C2 of
	'Q': begin links;  end;
	'E': begin rechts; end;
	end;

    stop := (C2 = X16_KEY_ESC);
    end
end;

begin
  veraInit;
  veraDirectLoadPalette('FUNKPAL.PAL');
  veraDirectLoadImage('test.raw');
  gotoxy(10,11);
  writeln('TEXT IM SCREEN 80');
 
  Repeat
    KeyScan;
  Until stop;
end.
Attachments
FUNKPAL-RAW.zip
(2.59 KiB) Downloaded 18 times
mad1.jpg
mad1.jpg (57.28 KiB) Viewed 558 times
Last edited by funkheld on Sat Mar 30, 2024 8:01 pm, edited 9 times in total.
User avatar
ahenry3068
Posts: 994
Joined: Tue Apr 04, 2023 9:57 pm

Re: madpascal

Post by ahenry3068 »

funkheld wrote: Sat Mar 30, 2024 3:04 pm

Code: Select all

uses x16_vera, x16, crt;

var
    i: byte;
    d: word;
	stop: Boolean;
	z: byte;
	u: byte;
	
procedure rechts;
begin
 z:=z-1;
 if z=255 then begin
   u:=u-1;
   Poke($9F38,u); 
 end;	
  
 Poke($9F37,z);
end;

procedure links;
begin
 z:=z+1;
 if z=0 then begin
   u:=u+1;
   Poke($9F38,u); 
 end;	
 
 Poke($9F37,z);
end;

	
Procedure KeyScan;
var c2: char;
begin

If KeyPressed then
    begin
      C2 := UpCase(ReadKey);

	case C2 of
	'Q': begin links;  end;
	'E': begin rechts; end;
	end;

    stop := (C2 = X16_KEY_ESC);
    end
end;

begin
  veraInit;
  veraDirectLoadPalette('FUNKPAL.PAL');
  veraDirectLoadImage('test.raw');
  gotoxy(10,11);
  writeln('TEXT IM SCREEN 80');
 
  Repeat
    KeyScan;
  Until stop;
end.
You should attach "FUNKPAL.PAL" and the Test Image on this post. You'll have to put them in a ZIP file.
funkheld
Posts: 268
Joined: Mon Feb 26, 2024 11:11 am

Re: madpascal is making nice progress...

Post by funkheld »

To test, I copied char "B" 16384x into layer1.
The picture can be seen in the background layer0.

to watch the scrolling.
moves without flickering.

scroll up/down/left/right
taste : q/w/e/s

I like the madpascal.
I'm impressed at how quickly you can create a program like this
has finished. especially since I'm a beginner.

Code: Select all

uses x16_vera, x16, crt;

var
    i: byte;
    d: word;
 stop: Boolean;
    z: byte;
   zz: byte;
    u: byte;
   uu: byte;

procedure ascii ;
begin
 For d := 1 to 16384 do begin
   VPoke(1,$b000+d+1,2);  
   VPoke(1,$b000+d,0*16+2)  
 end; 
end;

procedure oben;
begin
  zz:=zz-1;
  if zz=255 then begin
    uu:=uu-1;
    Poke($9F3a,uu); 
  end;  
  Poke($9F39,zz)
end;

procedure unten;
begin
  zz:=zz+1;
  if zz=255 then begin
    uu:=uu+1;
    Poke($9F3a,uu); 
  end;  
  Poke($9F39,zz)
end;
	
procedure rechts;
begin
 z:=z-1;
 if z=255 then begin
   u:=u-1;
   Poke($9F38,u); 
 end;	
 Poke($9F37,z);
end;

procedure links;
begin
 z:=z+1;
 if z=0 then begin
   u:=u+1;
   Poke($9F38,u); 
 end;	
 Poke($9F37,z);
end;

Procedure KeyScan;
var c2: char;
begin

If KeyPressed then
begin
        C2 := UpCase(ReadKey);

	case C2 of
	  'Q': begin links;  end;
	  'E': begin rechts; end;
	  'S': begin oben;  end;
	  'W': begin unten; end;
	end;

         stop := (C2 = X16_KEY_ESC);
    end
end;

begin
  veraInit;
  veraDirectLoadPalette('FUNKPAL.PAL');
  veraDirectLoadImage('test.raw');
  ascii;
 
 Repeat
    KeyScan;
 Until stop;
end.
Attachments
charb.jpg
charb.jpg (136.58 KiB) Viewed 537 times
mortarm
Posts: 232
Joined: Tue May 16, 2023 6:21 pm

Re: madpascal is making nice progress...

Post by mortarm »

Why is there no B in the upper left corner?
funkheld
Posts: 268
Joined: Mon Feb 26, 2024 11:11 am

Re: madpascal is making nice progress...

Post by funkheld »

to test.
because I wanted to see when the starting point came while scrolling right/left/up/down.
have you tested it yet?

greeting
Attachments
scrscroll.jpg
scrscroll.jpg (129.78 KiB) Viewed 399 times
Last edited by funkheld on Sun Mar 31, 2024 7:42 am, edited 1 time in total.
funkheld
Posts: 268
Joined: Mon Feb 26, 2024 11:11 am

Re: madpascal is making nice progress...

Post by funkheld »

madrafi is still looking for help because he doesn't really know the x16 system and help for asm.
Unfortunately, I'm only a beginner at 75 years old.

Thanks.
greeting

----------------------------------------------------
Post by MADRAFi » Wed Feb 28, 2024 8:58 pm
Hi,
I am working on adding target for x16. However I am not asm coder so it is progressing slowly. I also do not know x16 architecture either. :lol:
Any help is appreciated.
Mad-Pascal fork until it is merged is located here: https://github.com/MADRAFi/Mad-Pascal/tree/x16

viewtopic.php?t=7205
------------------------------------------
Martin Schmalenbach
Posts: 125
Joined: Tue Jul 21, 2020 10:08 pm

Re: madpascal is making nice progress...

Post by Martin Schmalenbach »

Very cool!

If I’m not mistaken this project is for a pascal compiler designed to run on a modern computer, but producing 6502 machine code. Have I got that right?

It’s interesting to see that a number of Pascal-like compilers are being developed for the X16. I’m currently porting the original Tiny Pascal compiler that was first published over 3 consecutive editions of BYTE magazine from Sep - November 1978. That was written in North Star Basic, somewhat different from the basic on a C64 or X16!

It generates pcode which runs inside a virtual machine. Currently the virtual machine is also written in Basic, a port of the one published as part of the BYTE series and written in Tiny Pascal. When I have the whole thing much more stable I’ll rewrite the virtual machine in 6502 machine language before moving on to have the compiler generate 6502 machine code itself.

My port is designed to run on the X16 itself, not a modern computer.
mortarm
Posts: 232
Joined: Tue May 16, 2023 6:21 pm

Re: madpascal is making nice progress...

Post by mortarm »

Buuut the X16 is a modern computer. It just came out in '22 or '23.
funkheld
Posts: 268
Joined: Mon Feb 26, 2024 11:11 am

Re: madpascal is making nice progress...

Post by funkheld »

Martin says that his Pascal runs and is programmed on the x16.

The madpascal runs on the PC and generates the code (prg) 6502 for the x16.
madpascal does it like cc65 or prog8.

hello martin, I'm looking forward to your tiny pascal for the x16.

greeting
Post Reply