Ultimate Amiga

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: AMOS Pro Resource Bank Maker and Cygnus Ed  (Read 2505 times)

0 Members and 3 Guests are viewing this topic.

bruceuncle

  • AMOS Dev
  • A500
  • *****
  • Karma: 6
  • Offline Offline
  • Gender: Male
  • Posts: 425
  • WINUAE Amiga User
AMOS Pro Resource Bank Maker and Cygnus Ed
« on: January 28, 2012, 12:09:54 PM »

First, many thanks to all those posting to this forum.  You've been a great help in my getting AMOS Pro up and running in WINUAE.

My problem is with the AMOS Resource Bank Maker accessory.  I'm trying to use Cygnus Ed 3.5 as the editor for Dialogue Programs.  I've set the default editor line in the source (Resource_Bank_Maker.AMOS) to EDNAME$="C:CED {f} -keepio".  This seems to try to fire up Cygnus Ed but gives a System Request "Error - stack must be at least 8000 bytes".

My AmigaDos knowledge is very rusty since my last real Amigas (a 500 and a 2000 back in the late 80s and early 90s) but I've tried adding stack 10000 to S:Shell-Startup.  That works fine in the CLI but not for this Exec call from AMOS Pro.

Any ideas?

A short note on compatibility.  I'm running WINUAE launching via Amiga Forever in Windows 7 Pro 64-bit and have had absolutely no problems.  My AMOS Pro environment is running on an emulated A4000 with 68040 CPU, 8Mb Fast RAM and Workbench 3.11, all booting from a 'directory' DH0: hard drive - again no problems.  What a magnificent job this emulation software is doing  :).  And aaah, the fond memories from all those old games...
Logged
Repeat after me ...  "The AMOS Pro architecture is complex but it is not complicated."

skateblind

  • Important 'looking' person
  • Forum Mod
  • A2000
  • *****
  • Karma: 668
  • Offline Offline
  • Gender: Male
  • Posts: 509
Re: AMOS Pro Resource Bank Maker and Cygnus Ed
« Reply #1 on: January 28, 2012, 06:12:35 PM »

I am guessing it is because AMOS Pro and Dos commands are not great together. I did recently see a article in an old newsletter on calling a cli command from within AMOS. The code below was designed for AMOS 1.23 and above, but Pro was not yet created, so no idea what will happen.

Try use this:

Amos to Back
COM$ = " openWb " : Rem COM$=the Cli Command you wish to call
Dreg(1) = Varptr(COM$) : Rem D1 Contains the pointer to the command string
Dreg(2) = 0 : Rem D2 contains the Input Channel(0=default)
Dreg(3) = 0 : Rem D3 contains the Output Channel(0=default)
A = Doscall(-222) : Rem Call the Execute routine
Amos To Front
----------------------
The Cli Command will now be activated, and will return to AMOS when finished. The command you are calling must be in the C directory of your bootdisk, and a CLI or shell window must be open for this routine to work. As the routine uses a DOS Call, which can GURU if you don't get the parameters correct. It isn't for beginners. BTW, you can toggle between the Cli Program and AMOS with Left Amiga-A. Amiga buttons are the Windows  keys on your computer normally, for me anyway.
Logged
What are you looking at?

bruceuncle

  • AMOS Dev
  • A500
  • *****
  • Karma: 6
  • Offline Offline
  • Gender: Male
  • Posts: 425
  • WINUAE Amiga User
Re: AMOS Pro Resource Bank Maker and Cygnus Ed
« Reply #2 on: January 29, 2012, 04:06:50 AM »

Many thanks for the prompt reply.

I dug out my ancient AmigaDOS manuals this morning.  (Found them in a cupboard neatly tied up for recycling!  I must have had second thoughts a while back.)

After a bit of messing about, I finally solved it this way:

Created a script file as
S:AMOS_to_Ced:

     .k file/a
     stack 10000
     ced <file> -keepio


This takes a file name as a parameter, sets the stack and calls Cygnus Ed with the file name and the -keepio parameter.  The -keepio parameter is what ensures that it won't return to the callers (in this case, the script file followed by the AMOS Exec call from the program) until the user has finished editing and saving or discarding the file.

Changed the source for Resource_Bank_Maker.AMOS in three places as follows (changes highlighted in orange):

1 - In the initialisation, sets the new command string for the Exec call:

     ' Default CLI ASCII editor for DBL programs 
     ' ~~~~~~~~~~~~~~~~~~~~~
     'EDNAME$="C:ED {f}"
     ' other example (CygnusED)

     EDNAME$="Execute S:AMOS_to_Ced {f}"


2 - Uses the new command string (without checking it!):

     Procedure MN_PREDIT
        If Length(100+NPROG)>0
           F$="RAM:DBLtemp.ASC"
           Open Out 1,F$
           Trap Ssave 1,Start(100+NPROG) To Start(100+NPROG)+Length(100+NPROG)
           If Errtrap : Gosub ERR : Trap Kill F$ : Pop Proc : End If
           Trap Close 1

           ' Original checks on EX$ removed as now hard-coded:
           Dialog Freeze
           Amos To Back
           I=Instr(EDNAME$,"{f}")
           EX$=Left$(EDNAME$-"{f}",I-1)+F$+Right$(EDNAME$,Len(EDNAME$)-I-2)
           Exec EX$
           Amos To Front
           Dialog Unfreeze

           Erase 100+NPROG
           Open In 1,F$ : SZ=Lof(1)
           If SZ
              Reserve As Work 100+NPROG,SZ
              Trap Sload 1 To Start(100+NPROG),SZ
           Else
              Reserve As Work 100+NPROG,1
              Poke Start(100+NPROG),32
           End If
           PRG$(NPROG)=Left$(PRG$(NPROG),16)+Right$("       "+Str$(SZ),7)
           If Errtrap : Gosub ERR : End If
           Trap Close 1
           Trap Kill F$
           Inc BKCHANGE
        Else
           If NPROG>=0
              D=Dialog Box(1,1,Resource$(104))
              If D=2
                 Inc BKCHANGE
                 If NPROG_MAX<=N_PROG
                    NPROG_MAX=NPROG+1
                 End If
                 Reserve As Work 100+NPROG,1
                 Poke Start(100+NPROG),32
                 PRG$(NPROG)=Left$("empty"+Space$(16),16)
                 MN_PREDIT
              End If
           End If
        End If
        Dialog Update 1,12
        Pop Proc
        ERR:
        D=Dialog Box(1,2,Err$(Errtrap))
        Return
     End Proc


3 - Makes the Change Editor option unavailable and is friendly about it:


     Procedure MN_CHGEDITOR
       
        ' Option no longer allowed, so tell user
        D=Dialog Box(1,2,"Editor is Cygnus Ed only in this version!")

     End Proc


This is a bit nasty as it will only work on my system with my copy of
Resource_Bank_Maker.AMOS.  However it is a quick fix that works fine now.

It may be useful to others as a way of calling AmigaDOS from AMOS where multiple statements are inolved.

Thanks again.
Logged
Repeat after me ...  "The AMOS Pro architecture is complex but it is not complicated."
Pages: [1]   Go Up
 

TinyPortal 2.2.2 © 2005-2022