• Please review our updated Terms and Rules here

PAL8 assembly language question

Mike_Z

Veteran Member
Joined
Dec 1, 2013
Messages
1,713
Location
Near Milwaukee Wisconsin
I'm working on a program, using PAL8 and have come across a problem. The program is doing a calculation that results in an ASCII number being held in the AC. I then want to store the AC in a memory location at the address BUFF. The program then calc's again and the new result is to be stored in the next address of BUFF. This should occur a few times. Here is what I tried to do.
Code:
BUFF,	"0; "0; "0;
BPTR,	0000

		DCA BUFF+BPTR

I'm using BPTR as a buff pointer. The first pass through the DCA, BPTR should be zero, the DCA should save the AC in BUFF+0. BPTR is incr'ed. The second time the DCA should save the AC in BUFF+1. But I think my trouble is that BUFF+BPTR is actually adding the addresses of BUFF and BPTR. How can I add the value held in BPTR to the address of BUFF and use it as the operand of the DCA? Thanks Mike
 
I'm working on a program, using PAL8 and have come across a problem. The program is doing a calculation that results in an ASCII number being held in the AC. I then want to store the AC in a memory location at the address BUFF. The program then calc's again and the new result is to be stored in the next address of BUFF. This should occur a few times. Here is what I tried to do.
Code:
BUFF,	"0; "0; "0;
BPTR,	0000

		DCA BUFF+BPTR

I'm using BPTR as a buff pointer. The first pass through the DCA, BPTR should be zero, the DCA should save the AC in BUFF+0. BPTR is incr'ed. The second time the DCA should save the AC in BUFF+1. But I think my trouble is that BUFF+BPTR is actually adding the addresses of BUFF and BPTR. How can I add the value held in BPTR to the address of BUFF and use it as the operand of the DCA? Thanks Mike

Well, you would first initialize the location BPTR with the value BUFF, and then do indirect stores thru BPTR each time, bumping BPTR by one after each store.

Or, if you want to get fancier, you could allocate BPTR at one of the autoincrement locations (0010-0017) in memory, and again do indirect stores thru BPTR, but the PDP8 will bump it automatically prior to using it (preincrement vs post increment). So for example init BPTR at 0010 to BUFF-1, then do DCA I BPTR to store data.

Don

Bitsavers http://www.bitsavers.org/pdf/dec/pdp8/handbooks/IntroToProgramming1969.pdf
would be a good reference, specifically pp.3-19 Address Modification and pp.3-27 Autoindexing
 
Last edited:
Say, that worked like a charm. Here is what I tried. I'll have to look into the auto indexing stuff. I seem to remember something about it, but...

Code:
BPTR,	BUFF

LDR,    CLA             /LOAD BUFFER
        TAD ONE
        DCA I BPTR
        ISZ BPTR
        TAD ONE
        DCA I BPTR

Thanks, Mike
 
Since, the basement is rather cold, I have been using SimH PDP8, upstairs. One problem that I have with SimH and I do not know how to get around it. At the end of a program, I use a HALT. When the program runs and gets to the HALT the SimH windows closes and I can not see the results. What can I do, at the end of my programs (in SimH) to stop the program can go back to OS/8? Thanks Mike
 
There is usually an INI file that goes with SIMH. If that file has an exit or quit at the end - that is what happens. Remove, or comment out, the exit or quit at the end of the INI file.

Dave
 
My INI file looks like this
Code:
set cpu 32K
set cpu idle
attach rk0 advent.rk05
boot rk0
exit
After removing the exit, the SimH windows doesn't close on HALT, I see this.

Code:
HALT instruction, PC: 00237 (NOP)
sim>

Here I can enter something. I thought that maybe I could enter PDP8.EXE and restart, but that doesn't work. Is there something that will end my program and put SimH back to SimH? Thanks Mike

I found that if I enter sim> boot rk0, the OS/8 prompt comes back, but can this is added to the INI file somehow and make it auto? Mike
 
From the SIMH prompt you can tell it to go to an address or cont.

Type ? or help at the prompt.

Yes, you can put another boot there, but the next halt will get it then...

Dave
 
Moving on to the next question, How do you use the operator !. I want to OR two values.

Code:
FIRST,    0076
SECOND,   1200
THIRD=FIRST!SECOND

But this seems to logically OR the addresses not the values. Then after that how can I save the new value THIRD into the AC or a memory spot? Thanks Mike
 
I thought that this may at least get the result into the AC
Code:
FIRST,    0076
SECOND, 1200
TAD FIRST!SECOND
But the result is still the addresses rather than the values. Mike
 
PAL is a primitive assembler and the instruction set of a PDP-8 is even more primitive. A lot you can do with later processors is complicated with the PDP-8. The PAL section in Programming Languages may also help. http://www.bitsavers.org/pdf/dec/pdp8/handbooks/

If I understand what you are wanting this does it a couple ways.

1
2 0076 FIRST=0076
3 1200 SECOND=1200
4 0200 *200
5 00200 1204 TAD VAL
6 00201 7200 CLA
7 00202 1377 TAD (FIRST SECOND
8 00203 7402 HLT
9 00204 1276 VAL, FIRST SECOND
00377 1276
10 $
 
I thought that this may at least get the result into the AC
Code:
FIRST,    0076
SECOND, 1200
TAD FIRST!SECOND
But the result is still the addresses rather than the values. Mike

You are looking at the world from the viewpoint of a higher level language such as C, PASCAL, etc, where using the variable means using the contents of the variable, rather than the address of the variable.

In C terms, you could view FIRST and SECOND as types of INT* rather than INTs. In that case FIRST|SECOND means IOR the pointers/addresses, where you would more likely write *FIRST | *SECOND in C, which means dereference the pointers to get the value before using them.

So in PAL, you would have to do:

Code:
FIRST, 0076
SECOND, 1200
THIRD, 0000

    CLA            / 0
    TAD FIRST      / FIRST
    CMA            / ~FIRST
    AND SECOND     / ~FIRST & SECOND
    TAD FIRST      / ~FIRST & SECOND + FIRST == FIRST | SECOND
    DCA THIRD      / FIRST | SECOND => THIRD
to store the contents of FIRST IOR'ed with the contents of SECOND into THIRD

Don
 
Last edited:
And to the administrators here ... I REALLY dislike the restriction of only being able to edit my post within 15 minutes of first posting it. Lots of times after spending 10 minutes or so composing it, then hitting post, I come back about 10 minutes later (ie 5 minutes too late) and want to make a few minor edits or corrections. No longer can do. It used to be editing was open for a few days (maybe that was too long) but *15* minutes is IMHO too short. Maybe can it be changed to an hour or two?

Don
 
+1 as well I am afraid... I generally write some fairly long posts and even though I check the text before hitting 'post', I am convinced that some of the text changes between hitting post and it appearing! Whether this is true or not...

I would generally check my text after posting and double-check all my cross-references to links (such as schematics etc.). For a long post, the timer just plain and simply times out on me. The result is that I have to post a subsequent correction. This is not helpful for readers down the line.

I don't normally ask for much in life, but a slight increase in this time would really help keep the integrity of posts up. Thanks for the great board irrespectively of what you decide though...

Dave
 
Mike,

You have to remember that an assembler works at a single machine instruction level.

The assembler can manipulate constants only without resorting to generating extra instructions.

If a machine does not contain an OR instruction itself, you have to synthesise a logical OR instruction from the basic machine instruction set.

Some assemblers contain a MACRO facility that can be used to produce your own instructions - but still all the MACRO facility is is a text substitution.

Didn't you ask how to create an OR instruction last year?!

Dave
 
Just got back from hernia surgery, not feeling very well. Yes I did ask about the OR, had used it and it works well. I was reading the PAL8 section of the OS/8 Language manual. Here is where I first saw the '!' operator. And there is a PAL command line option that also added a 6 bit rotation prior to the OR operation. I had thought that maybe I could use the '!' in place of the the OR code and maybe save some memory space. There is a lot of good stuff in the Language Manual and you can not know how it works, exactly (at least me) without trying it. I was thinking that maybe doing some indirect addressing could accomplish this, but right now my gut is taking up most of my attention. Thanks Mike
 
>>> Just got back from hernia surgery, not feeling very well.

I am not surprised! Wrap up warm - and no trips down to a cold basement!

The way the ! operator works is at ASSEMBLY time. The PAL8 assembler itself permits you to perform a mathematical expression on constants at assembly time that evaluate to a constant WORD or a constant ADDRESS within your run-time program. However, an ASSEMBLE time mathematical operation cannot operate on RUNTIME operands. You have to differentiate in your mind what happens at ASSEMBLY time and what happens at RUNTIME.

The only permitted actions at RUNTIME is what features the processor itself provides. If no OR instruction is present, one has to be synthesised from whatever basic instructions the processor has.

However, at ASSEMBLY time you can modify constant values by ORing together (for example) fields that form a constant word to be held in the PDP8's memory.

Hope you feel better soon!

Dave
 
Thanks, right now just standing up and sitting down is a delicate operation, much less than tackling the stairs. Then to top it off, the outside temperature was -20 this morning. So, I'm trapped in the house for a while. I'll have to think about the assembly vs run time some more, but I have time. You know, I'd like to find a training aid for PAL8. One that has a bunch of well commented examples. Mike
 
I know how you feel. I was off work for about 6 months due to having 2 major, 1 minor and an aborted surgery back in 2012. Interestingly, the surgeon found that I had an internal birth defect for 52 years and not known about it. This had ultimately caused my medical problem in 2012. Go figure! The aborted surgery was when they noticed it before carrying out the 2nd major operation. They abandoned the surgery whilst they worked out why my anatomy differed from what is in Gray's!!!

Anyhow, I found this book for your further education to read by the fire! http://bitsavers.informatik.uni-stuttgart.de/pdf/dec/pdp8/handbooks/DEC-08-XINPA-A-D_intrPgm_75.pdf. Hopefully, this will help in your quest to understand PDP-8 PAL?

Enjoy,

Dave
 
Back
Top