/* $VER: 0.9, ©1993 Dietmar Eilert. Assemble & link file using A68K    */

OPTIONS RESULTS                             /* enable return codes     */

if (LEFT(ADDRESS(), 6) ~= "GOLDED") then    /* not started by GoldEd ? */
    address 'GOLDED.1'

'LOCK CURRENT'                              /* lock GUI, gain access   */
OPTIONS FAILAT 6                            /* ignore warnings         */
SIGNAL ON SYNTAX                            /* ensure clean exit       */

/* ------------------------- INSERT YOUR CODE HERE: ------------------ */

'QUERY CAT'
isGerman = (result = "deutsch")

'QUERY ANYTEXT'

if (result = 'TRUE') then 

    do

        'QUERY DOC VAR OLDNAME'             /* remember current file name */
        'SAVE ALL NAME="t:test.asm"'        /* create temorary file */

        shell                               /* address shell */

        'a68k t:test.asm -ot:test.o'

        if (RC = 0) then
            'blink t:test.o'

        ok = (RC = 0)

        shell                               /* address host (GoldED) */

        'NAME NEW ' || oldname              /* restore old file name */

        if (ok) then do

            if (isGerman) then
                'REQUEST BODY="A68K fertig. Programm starten ?" BUTTON="_starten|_abbrechen"'
            else
                'REQUEST BODY="A68K done. Run program ?" BUTTON="_run|_cancel"'

            if (result = 1) then do

                'QUERY CON VAR CON'

                shell
                't:test >' || CON
                shell

            end
        end
    end

else do

    if (isGerman) then
        'REQUEST BODY="Kein Text vorhanden ?!"'
    else
        'REQUEST BODY="Text buffer is empty ?!"'
end

/* ---------------------------- END OF YOUR CODE ----------------------- */

'UNLOCK' /* VERY important: unlock GUI */
EXIT

SYNTAX:

SAY "Sorry, error line" SIGL ":" ERRORTEXT(RC) ":-("
'UNLOCK'
EXIT
