Enterprise Forever

:UK => Programming => Topic started by: nicalejo on 2023.December.12. 17:32:47

Title: Programming and use of full memory
Post by: nicalejo on 2023.December.12. 17:32:47
Hi, I've been doing some test programming the ep128. I realized it is expandable til 3.5 mb, what is a craziness.

I did programming under IS-DOS and Turbo Pascal, wonderful tool, with the integrated editor, but I suspect the memory is limited to 64 kb due the nature of CP/m. ¿Am I right?
I also wrote the same under IS-BASIC. I am pretty sure under basic the whole memory is ready for programs but is slow as hell and we don't have an editor (copy, cut, paste).
I tried the same with Hisoft Pascal but ... I gave up. It has no integrated editor, the editing capabilities are limited and it is confusing to me how to work with several files. Maybe with an external editor, if exists, launched from HSP. Too much fight compared to Turbo Pascal.

So finally ¿are these the only options to develop with high level programming in the EP? ¿Cross compiling? I've read other posts in the forum but I don't know how up to date they are.

Title: Re: Programming and use of full memory
Post by: szipucsu on 2023.December.12. 19:21:31
Welcome to the forum!

You can create your IS-BASIC program using a PC and a .txt editor (Notepad). The .txt file can be loaded to the basic using LOAD command. Do not forget to press enter at the end of the last line, otherwise the last line won't be sent to the basic.

I don't know if Pascal and other platforms can interprete the .txt files but you can give them a try.
Title: Re: Programming and use of full memory
Post by: ergoGnomik on 2023.December.12. 19:58:40
Obviously, any integrated development environment running on the target platform will make it harder using all resources of the platform since it has to use some of it itself. Therefore, cross development tools are better choice from this perspective. And we didn't even mention the better compiler performance on modern hardware and ease of use of emulators in testing. AFAIK, z88dk (https://z88dk.org/site/) development suite has support for these machines. Maybe TRSE (https://lemonspawn.com/turbo-rascal-syntax-error-expected-but-begin/) can also be used, although it has no Enterprise support. (Yet, but I can imagine its developers could be convinced to do something about that.) Still, it can be used for Z80 based computers like ZX Spectrum, CPC and TVC, so maybe you could trick it into working for Enterprise too.
Title: Re: Programming and use of full memory
Post by: nicalejo on 2023.December.12. 20:08:39
Both options would be a dream for developing with comfort. I'll try to check how mature is z88dk with EP as target.

Thanks
Title: Re: Programming and use of full memory
Post by: nicalejo on 2023.December.13. 13:02:51
I managed to install EP128 emulator and Z88dk in my Mac. I was able to compile and later execute the results successfully in the emulator. Text based C programs, seem to work without problems.

Anything related to the EP HW needs to be achieved through the exos calls, all through the enterprise.h file.

Would be great that someone with the skills build a high level API in C to program using the hw capabilities.

[attachmini=1]
Title: Re: Programming and use of full memory
Post by: nicalejo on 2023.December.19. 10:14:55
Finally the subject of the thread did not reach what I wanted to know. Aside of the basic that can handle the full memory transparently to the programmer, is there another programming language able to do that? If I use hisoft pascal, ie, do I have the full memory for my programs or I have to deal with segments as other z80 machines?

I apologize because I've read about exos calls to allocate segments but I don't know if a compiler as Hisoft builds executables with these capabilities.

Thx
Title: Re: Programming and use of full memory
Post by: gflorez on 2023.December.19. 15:53:09
I think that the real magic of the Enterprise is EXOS. It is already managing the complete 4MB range of RAM/ROM, and very well, I think, because it behaves the same with 64KB than with 3MB of Ram.

You should be benevolent with classic programs, when it was hard and expensive to expand the machine memory. The HEASS assembler takes all the available memory, but it was made on the 90s.
Title: Re: Programming and use of full memory
Post by: Povi on 2023.December.19. 16:35:36
If I use hisoft pascal, ie, do I have the full memory for my programs or I have to deal with segments as other z80 machines?
Unfortunatelly the hisoft pascal uses only 64kB RAM, where the lower part of memory is used by the compiler and stores the source code. Even if you open a graphic video channel, and you want to write the video ram directly (not via exos escape sequencees), you have to page it to the 3rd page, and set the compilers upper limit to 0xbfff.
Title: Re: Programming and use of full memory
Post by: nicalejo on 2023.December.19. 18:19:51
We need some kind of cross compiler that produces code taking profit de exos. Difficult task, would be great the people of Turbo Rascal put the hands on it
Title: Re: Programming and use of full memory
Post by: ergoGnomik on 2023.December.19. 21:40:48
We need some kind of cross compiler that produces code taking profit de exos. Difficult task, would be great the people of Turbo Rascal put the hands on it
Or maybe you could try ask Povi if he's willing to help. He did some work on HiSoft Pascal. Version 1.2 is his achievement, AFAIK. The TRSE project repository is on github (https://github.com/leuat/TRSE/) and the units folder hides some invaluable gems like CPC, MSX, Spectrum and TVC unit sources.
Title: Re: Programming and use of full memory
Post by: Tuby128 on 2023.December.19. 23:18:17
Nicaleajo, do you have windows?
Title: Re: Programming and use of full memory
Post by: ergoGnomik on 2023.December.20. 06:29:51
Nicaleajo, do you have windows?
Szerinted?
What do you think?
I managed to install EP128 emulator and Z88dk in my Mac.
És azt már merő rosszindulatnak érzem megemlíteni (elnézésedet is kérem érte), hogy a hozzászólása mellett az adattáblájában is ott virít a MacOS szimbólum és verziószám.
And I feel, it is sheer spite mentioning, which I apologise for, that next to his post in the data plate you can find the MacOS logo and version number.
Title: Re: Programming and use of full memory
Post by: Tutus on 2023.December.20. 09:14:57
Szerinted?
What do you think?És azt már merő rosszindulatnak érzem megemlíteni (elnézésedet is kérem érte), hogy a hozzászólása mellett az adattáblájában is ott virít a MacOS szimbólum és verziószám.
And I feel, it is sheer spite mentioning, which I apologise for, that next to his post in the data plate you can find the MacOS logo and version number.
:D Jogos!
Title: Re: Programming and use of full memory
Post by: nicalejo on 2023.December.20. 13:32:06
After doing some tests, the z88dk compiler can be used to develop programs. All the access to the video is done through ESC sequences and I suspect this is slow, so is intended the current support for the SDK to simple applications in terms of graphics.

I think the use of the full memory has to be completed developing the enterprise version of what they call the FAR allocating system, several routines for allocating and access data through an API.

Far memory API implementation (https://www.z88dk.org/wiki/doku.php?id=porting:farmemory)

Would be great if someone wrote this in the z88dk project with the knowledge about EP system memory management.

This gives the comfort of programming in c and crosscompile

As a proof I wrote this

Code: [Select]
#include <stdio.h>
#include <enterprise.h>


void myplot(int x, int y)
{
 plot(x,y+33);
}

void mydraw(int x, int y)
{
 draw(x,y+33);
}

void mysetxy(int x, int y)
{
 setxy(x,y+33);
}

void myputchar(int x, int y, char c)
{
  esccmd_cmd='I'; // INK colour
  esccmd_x=1;
  exos_write_block(DEFAULT_VIDEO, 3, esccmd);
  mysetxy(x,y);printf("%c",c);
}

int main()
{
   int x,y;

   exos_set_vmode(VM_HRG,CM_2,40,24);
   exos_write_character(DEFAULT_VIDEO, 0x1A);

   for(y=0;y<=10;y+=10)
   {
   mysetxy(0,y);drawr(80,0);
   }

   for(x=0;x<=80;x+=10)
   {
   mysetxy(x,0);drawr(0,10);
   if (x != 80) myputchar(x+3,2,'A');
   }

   while (getch() == 0);

   for(x=0;x<=80;x+=10)
   {
   clga(x+1,33+1, x+9, 33+9);
   if (x != 80) myputchar(x+3,2,'B');
   }

   while (getch() == 0);

   return 0;
}

To compile

  zcc  +enterprise -lm -lgfxep  -create-app -otest.app test.c

I don't know why all the y coordinates have to be increased in 33 and then call the given function in the current API with the corrected value

[attachimg=1]
Title: Re: Programming and use of full memory
Post by: Tuby128 on 2023.December.20. 15:49:07
A good programme always writes his own Library :D
Title: Re: Programming and use of full memory
Post by: gflorez on 2023.December.20. 16:17:49
The ESCape sequences can't contain values below 20h, because they will be ignored or used as control characters. Is for that you have added 33 to the coordinate values.

You can know more reading this document about the Video Driver Specifications (http://enterprise.iko.hu/technical/ET12-9_EXOS_21_Sound_Driver_Specification.pdf).

Here is an extract:

[attachimg=1]

In the same document you have the list of direct calls, if you want to compare them with the ESCape sequences.
Title: Re: Programming and use of full memory
Post by: nicalejo on 2023.December.20. 20:43:12
Uah! It is a weird but good reason. But is more weird that does not happen with the x coordinates, 0 is 0, nothing to add. Maybe the reason is the Y is passed before. Anyway, the related calls to exos in the z88dk had something not trusty, sometimes don't work as expected. I can rewrite everything I need bypassing them.

This calls to exos using escape sequences seem to be very slow.