QL / PASCAL

Anything QL Software or Programming Related.
User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: QL / PASCAL

Post by NormanDunbar »

More Pascal fun and ganes. I have not built this into a unit or similar yet, this is a "chuck it out and see what people think" sort of thing.

Chain-Q mentioned a while back that MT_INF should be returning a pointer to the system variables as a record type. That way, it would/should be easy to access a system variable in a manner similar to this:

Code: Select all

    ...
    TYPE
      { #include sysvars.inc defining the SystemVariables
        record type and a pointer to same. }
      {$i sysvars.inc}

    VAR
      system_vars: pSystemVariables;
      ver_ascii: Longint;
      job_id: Longint;
    ...
    BEGIN
      { Get the system_variables address into system_vars. It's
        a pointer to a SystemVariables record type. }
      job_id:=mt_inf(@system_vars,@ver_ascii);

      { Get the address of the Common Heap base }
      writeln('Common Heap Start: $', hexstr(system_vars^.SYS_CHPB));
 
      ...
      
    END.
So now, any of the system variables can be accessed from the SystemVariables record type, or, as in this case, from a pointer to that record.

The example program, sysvars.pp reads in sysvars.inc and the latter file defines the system variables record type -- that was a fun exercise -- and is based on the SMSQ versions and names of the various system variables.

If you run the example program, from an Emulator please as the attached version is not suitable for a bare bones QL unless you add an executabe header with 8KB data space, it will display some pages of information with all the system variables displayed. Use 'C' or 'c' to continue to the next page, or 'Q' or 'q' to quit.

If everyone is happy/nobody complains with the suggestion then I should be able to (easily?) incorporate this into the QDOS unit and I'll create a patch for same when I'm done.

sysvars.zip
(14.94 KiB) Downloaded 62 times
Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
pjw
QL Wafer Drive
Posts: 1286
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: QL / PASCAL

Post by pjw »

It works, Norm! (As was to be expected ;))
But I hope this isnt going to be the New Normal for zip files now: Qdos EXecutables to have an Ecstasy [XTcc] header rather than being native Qdos. To my mind it would be better to zip native Qdos files using a Qdos-enabled zip. They can still be unzipped to a host OS drive from the "QL" side and EXecuted from there if desired. Best of both worlds!

PS: A simple Press any key (except ESC (and/or Q, if you like)) to page wouldve suited me better, but hey, its your show!


Per
dont be happy. worry
- ?
User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: QL / PASCAL

Post by NormanDunbar »

Hi Per,

I know about the XTcc trailer, I wrote a utility to convert a cross compiled file into a QDOS executable some time back. This was just an example for comment.

As for press any key, I haven't worked out INKEY$ in Pascal yet! ;)


Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
stevepoole
Super Gold Card
Posts: 712
Joined: Mon Nov 24, 2014 2:03 pm

Re: QL / PASCAL

Post by stevepoole »

Hi Norman,

Tofro has provided a perfectly functional Pascal INKEY$ routine.

Tomorrow I will locate it and pass it on, if Tofro doen't beat me to it !

Best Wishes,
Steve.
____________________________


User avatar
pjw
QL Wafer Drive
Posts: 1286
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: QL / PASCAL

Post by pjw »

Apologies for harping on this theme.. Im one of those few remaining fools who refuse to see my "QL" as a retro machine. True, it cant be my main machine any more, for no fault of its own, as it has fallen by the wayside, having been surpassed by inferior, but better funded, systems.
tofro wrote:<>
the simple reason why we want (and have, like in C68 and FreePascal) programs that need to self modify (and relocate) and not pure position independant code and data is size vs. performance. As you will know, PC and other address register-relative addressing only works +/- 32kBytes away, because the register offsets on a 680xx (with xx < 20) are only 16 bits wide.<>
So if a modern C, Pascal, etc compilers were made for the QL, which would only target machines or emulators with 68020+ processors (like QL + Super GoldCard, Qx0's, and QPC2*) then we could get back to "pure", "QL-compatible" code, as god intended?
If that were to happen, my guess is that, over time, SMSQmulator and possibly uQLx would soon offer 608020+ capability. Then the retro's could be left alone to do their thing with the tools that are already available (thats the whole point, right?) and the remainder could move on to pastures green..

(* I dont know about Q68, it only emulates a 68000, but sports a 32 bit bus..)


Per
dont be happy. worry
- ?
User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: QL / PASCAL

Post by NormanDunbar »

Ok, a few minor changes and for Per, a QL executable!

On emulators, you need sysvars.exe, and on the QL itself, or emulators which don't understand the new header arrangement, you need sysvars.xtcc_exe instead. The window is the standard one opened by the initialisation of the job, 512 by 256 at 0 by 0.

I've added Per's request to change the operation of the "Press C to continue or Q to quit" and it's now "Any key to continue, ESC to quit". Also, there's no need to press ENTER to get onto the next page, now either, I've found how to do an INKEY$:

Code: Select all

...
VAR
    Enter: char;
    ...
BEGIN
   ...
   Enter := char(io_fbyte(stdInputHandle, -1));
   ...
Thank's Steven for the offer, I managed to find a working one, in the Free Pascal source.

The updated zip file is around here somewhere:
sysvars.zip
(38.98 KiB) Downloaded 52 times

Cheers,
Norman.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: QL / PASCAL

Post by NormanDunbar »

stevepoole wrote:Hi Norman,
Tofro has provided a perfectly functional Pascal INKEY$ routine.
Tomorrow I will locate it and pass it on, if Tofro doen't beat me to it !
Thanks very much Steve, no need now, I extracted the "Press any key to exit" code from the Free Pascal source for the system unit, and it works fine.

Appreciate the offer.


Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
pjw
QL Wafer Drive
Posts: 1286
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: QL / PASCAL

Post by pjw »

NormanDunbar wrote:Ok, a few minor changes and for Per, a QL executable!

On emulators, you need sysvars.exe, and on the QL itself, or emulators which don't understand the new header arrangement, you need sysvars.xtcc_exe instead. The window is the standard one opened by the initialisation of the job, 512 by 256 at 0 by 0.

I've added Per's request to change the operation of the "Press C to continue or Q to quit" and it's now "Any key to continue, ESC to quit". Also, there's no need to press ENTER to get onto the next page, now either, I've found how to do an INKEY$:
<>
Not a request, Norm, just feedback. As a service to the community (I hope). My career was in care and education, so Im not one of those "strong, silent men" types, who seem to think that if they just shut up enough everyone will understand what they mean.


Per
dont be happy. worry
- ?
User avatar
XorA
Site Admin
Posts: 1358
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: QL / PASCAL

Post by XorA »

If that were to happen, my guess is that, over time, SMSQmulator and possibly uQLx would soon offer 608020+ capability. Then the retro's could be left alone to do their thing with the tools that are already available (thats the whole point, right?) and the remainder could move on to pastures green..
It should not take you very long to add 68020 support to uQlx


User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: QL / PASCAL

Post by NormanDunbar »

pjw wrote:]Not a request, Norm, just feedback. As a service to the community (I hope).
Maybe I read it as a request. Or maybe I just took it that way. However, it was definitely not a problem. A quick 5 minute change while MrsD was doing "Pilates by Zoom" plus an extra econd to create the XTcc trailer and 30 secinds to convert to EXECable and zip it all up. :D Zero problem at all.
pjw wrote:My career was in care and education, so Im not one of those "strong, silent men" types, who seem to think that if they just shut up enough everyone will understand what they mean.
In which case, you ave my admiration for what you did. Thanks. I have a father in care with Dementia, a late mother andlate step father both of whom died in care of the same thing, and my mother in law is in care with....Dementia! Dementia has totally f*cked my family. But the care they got/are getting is excellent.

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
Post Reply