Jump to content
apersson850

Pascal on the 99/4A

Recommended Posts

39 minutes ago, apersson850 said:

I had it in my vault (I wasn't at home when I wrote the first answer). But it's on the net too. The p-system program development manual for the TI Professional computer. Look in appendix H for the backend errors.

That manual states that Backend Error 8 is triggered when the jump table has more than 400 entries. I'm pretty certain I don't have that many jumps in the procedure in question, so I'm guessing the TI implementation has a smaller jump table limit?

In any case, braking up the procedure into two separate procedures solved the problem :)

Share this post


Link to post
Share on other sites

Well, it's for the TI professional computer, which had much more memory than the 99/4A. So it makes sense that the problem comes quicker on our little machine. That's why I didn't give you any number, just a general explanation.

Share this post


Link to post
Share on other sites

I have a 4 character string which I want to split into 2 sub-strings each 2 characters long. The following gives an error 125 (type error) which I assume is because the concat intrinsic is being passed characters rather than strings.

program test;
var
  pmove,pto,pfrom : string;

begin
  readln(input,pmove);
  pfrom:=concat(pmove[1],pmove[2]);
  pto:=concat(pmove[3],pmove[4]);
  writeln(pfrom,pto);
end.

I there another way of doing this?

 

EDIT:

Ok figured it out using the copy function.

 

prom:=copy(pmove,1,2);
pto:=copy(pmove,3,2);

I am now keeping this little handy UCSD Pascal reference card on hand to help with remembering what's available on the system...

UCSD Pascal Quick Reference Card.pdf

  • Like 2

Share this post


Link to post
Share on other sites

Using copy is the neat way.

The brutal way to copy any data from any variable to any other variable is using moveleft.

moveleft(pmove[1],pfrom[1],2) will move two bytes starting from pmove[1] to pfrom. It starts filling at pfrom[1]. In pfrom[0] is the length indicator. So either you have to turn off range checking and set that to 2 manually, or you have to first assign pfrom a two character dummy string.

moveleft(pmove[3],pto[1],2) vill take care of the other one, with the same prerequisites.

 

For such short strings and where an easy, neat way exists, moveleft isn't really worth it. But there are other cases where it's very handy.

 

 

Edited by apersson850
  • Like 2

Share this post


Link to post
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.

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