Programming Pandora on the 32016

Discuss all aspects of programming here. From 8-bit through to modern architectures.
litwr
Posts: 184
Joined: Sun Jun 12, 2016 8:44 am

Programming Pandora on the 32016

Postby litwr » Tue Jan 03, 2017 8:26 pm

I am trying to use 32016 machine code under Pandora. It looks almost impossible. There is no any documentation for the structure of an assembler source. :( Documentation says that this is possible by 3 ways:
1) to produce an AOF-file by the assembler for the linker and then to link it to an absolute image;
2) to produce a file for Pandora directly by the assembler;
3) to use BBC Basic "POKEs" and then CALL.
BBC Basic 32000 doesn't support inline assembly. :( I had tried to use the next code

Code: Select all

10 ?&7000=18:?&7001=0:REM it is RET 0 instruction
20 CALL &7000

It doesn't work. The assembler and linker work fine under PanOS but I couldn't make any executable suitable for Pandora. Is there any hope?

User avatar
richardtoohey
Posts: 3354
Joined: Thu Dec 29, 2011 5:13 am
Location: Tauranga, New Zealand

Re: PanOS software list

Postby richardtoohey » Wed Jan 04, 2017 9:03 am

Might be an utter red herring (in which case, sorry!) but peeking/poking &7000- is that the host or the parasite's memory that gets changed? And does it matter (especially in this context?)?

Sure there is hope :D but not sure it will arrive with me ... :oops:

litwr
Posts: 184
Joined: Sun Jun 12, 2016 8:44 am

Re: PanOS software list

Postby litwr » Wed Jan 04, 2017 12:35 pm

richardtoohey wrote:Might be an utter red herring (in which case, sorry!) but peeking/poking &7000- is that the host or the parasite's memory that gets changed? And does it matter (especially in this context?)?


BBC Basic reports PAGE=&6c91, TOP=&6c93, HIMEM=&ff9b8. So &7000 looks as a proper place. I checked it by "peeks" (PRINT !&7000), it is ok. It is an oddity that this important piece of information is not available. Disassembly of Basic may help but it is a bit too long way.

User avatar
BigEd
Posts: 1387
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Programming Pandora on the 32016

Postby BigEd » Wed Jan 04, 2017 1:54 pm

Two possibilities - have you got the endianness right on your POKEs, and do you mean 18 or &18?

And a third - is it possible CALL uses a particular calling convention and you have to return in a particular way?

litwr
Posts: 184
Joined: Sun Jun 12, 2016 8:44 am

Re: Programming Pandora on the 32016

Postby litwr » Wed Jan 04, 2017 2:35 pm

BigEd wrote:Two possibilities - have you got the endianness right on your POKEs, and do you mean 18 or &18?

And a third - is it possible CALL uses a particular calling convention and you have to return in a particular way?


My example shows 18 = &12. You mentioned the nature of the problem, a particular calling convention. It is unknown to me and I couldn't find in in the published documentation. There must be a kind of standard code sequence in the end of code. There must be a similar sequence for a Pandora program too. Thanks anyway.

User avatar
BigEd
Posts: 1387
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Programming Pandora on the 32016

Postby BigEd » Wed Jan 04, 2017 2:42 pm

I had a quick look at the bible and it seems there's
RXP
to return from "an external procedure"
That would be &32 - might be worth a try.
Edit: and you need a parameter to say how many words to remove from the stack, and you'd better guess right!

Local Procedure Calls/Returns
    Jump to Subroutine JSR
    Branch to Subroutine BSR
    Return from Subroutine RET
External Procedure Calls/Returns
    Call External Procedure CXP
    Call External Procedure with Descriptor CXPD
    Return from External Procedure RXP


User avatar
jgharston
Posts: 2658
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield

Re: Programming Pandora on the 32016

Postby jgharston » Wed Jan 04, 2017 5:38 pm

Basic32 implements CALL with a JSRD R4 instruction, so the called code needs to return to the caller with a RET &00 instruction, &12,&00. So, !&7000=&0012:CALL &7000 should be the minimal call.

Edit: See the disassemblies.

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

litwr
Posts: 184
Joined: Sun Jun 12, 2016 8:44 am

Re: Programming Pandora on the 32016

Postby litwr » Wed Jan 04, 2017 6:26 pm

BigEd wrote:I had a quick look at the bible and it seems there's
RXP
to return from "an external procedure"
That would be &32 - might be worth a try.

I had tried RXP with 0 parameter. No success.
jgharston wrote:Basic32 implements CALL with a JSRD R4 instruction, so the called code needs to return to the caller with a RET &00 instruction, &12,&00. So, !&7000=&0012:CALL &7000 should be the minimal call.

Edit: See the disassemblies.

JSRD? It is a bit odd instruction name. SERIES 32000 INSTRUCTION SET MANUAL has no such. Your code is the same as mine. It doesn't work. :(
pandorian-meditation.png

This time CALL causes leaving Basic and meditation in Pandora. The disassembly may help... It has comments! :D

Code: Select all

0000563D 67 D0 81 B5       gP.5    ADDRD  &01B5(SB),R1              ; R1=>string buffer
00005641 5F 10             _.      MOVQD  +0,R2                     ; R2=0 = no parameters passed
00005643 62 40             b@      SAVE   [R6]
00005645 7F 0E             ..      JSRD  R1                         ; Call address directly
00005647 72 02             r.      RESTORE [R6]
00005649 12 00             ..      RET    &00

I miss the idea of ADDRD. :( It puts address of SB+&1b5 to R1. So it misses the value of R1. IMHO it is a bug. ADDR corresponds to LEA of Intel 80x86.

User avatar
jgharston
Posts: 2658
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield

Re: Programming Pandora on the 32016

Postby jgharston » Wed Jan 04, 2017 9:15 pm

Hmm. Try Basic32 v1.09 or v1.13. It has JSRD R4 with R4 being the destination address, instead of JSRD R1 where R1 is the parameter buffer!

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

litwr
Posts: 184
Joined: Sun Jun 12, 2016 8:44 am

Re: Programming Pandora on the 32016

Postby litwr » Thu Jan 05, 2017 4:36 am

Thanks. I am using Basic supplied with PanOS 1.40. It should be 1.13 version... I've just found a way to avoid the bug, to use a dummy parameter. So CALL &7000,A% works. The problem is solved! :)
The other problem is end-of-program code for Pandora. It is somewhere in the Basic disassembly...

User avatar
richardtoohey
Posts: 3354
Joined: Thu Dec 29, 2011 5:13 am
Location: Tauranga, New Zealand

Re: Programming Pandora on the 32016

Postby richardtoohey » Thu Jan 05, 2017 6:13 am

Well done on sorting it out. :D

Sorry for the red herring - I was vaguely thinking about &FFFFnnnn indicating host versus parasite memory and was wondering if the poked data was ending up in the "wrong" memory.

From what I've read now that is to do with LOAD/SAVE addresses (&FFFFnnnn means address nnnn in host memory) and nothing to do with peeks & pokes, so utterly irrelevant here.

Note to self: don't post just before bed when too tired to check information :oops:

User avatar
daveejhitchins
Posts: 3617
Joined: Wed Jun 13, 2012 5:23 pm
Location: Newton Aycliffe, County Durham

Re: Programming Pandora on the 32016

Postby daveejhitchins » Thu Jan 05, 2017 7:48 am

richardtoohey wrote:Note to self: don't post just before bed when too tired to check information :oops:
I should think so, Richard . . . No one's ever done the before . . . :roll:

Dave H :lol:
Parts: UM6502CE, GAL22V10D, GAL16V8D, AS6C62256A, TC514400AZ, WD1772, R6522, TMS27C512, AT28C256
Products: ARA II, ABR, ATI, AP6, MGC, AP5 . . .
For a price list, contact me at: Retro Hardware AT dave ej hitchins DOT plus DOT com

litwr
Posts: 184
Joined: Sun Jun 12, 2016 8:44 am

Re: Programming Pandora on the 32016

Postby litwr » Fri Jan 06, 2017 9:53 am

Thanks again. An attempt to help often helps. :) It is interesting to get discs which were used at work at the 80s... They may contain program samples, etc.


Return to “programming”

Who is online

Users browsing this forum: No registered users and 4 guests