English Amiga Board


Go Back   English Amiga Board > Main > Amiga scene

 
 
Thread Tools
Old 28 April 2013, 23:20   #1
Narf the Mouse
Registered User
 
Join Date: Jan 2007
Location: Vancouver Area, Canada
Posts: 131
SAS C tutorial?

I'm a complete beginner to SAS C; how do I get from there, to "Hello World!"? Thanks.
Narf the Mouse is offline  
AdSense AdSense  
Old 28 April 2013, 23:36   #2
Leffmann

 
Join Date: Jul 2008
Location: Sweden
Posts: 2,029
Quick tutorial:

Download and install the most up to date SAS/C:
https://www.dropbox.com/s/rt23fhty36...sc658.lha?dl=1

Open your SAS/C drawer and the C drawer and run scsetup. Enter f.ex ram:hw to create a new empty project.

Open up your ram:hw drawer and click on edit and type in Hello World:
Code:
#include <stdio.h>

int main()
{
  puts("Hello, world!");
  return 0;
}
Rename the file to f.ex hello.c and save it, then click the build icon and your finished program will appear in the project drawer.

If you want to work from the command line instead then you can compile your program with:
Code:
sc hello.c LINK

Last edited by Leffmann; 21 December 2016 at 21:35.
Leffmann is offline  
Old 29 April 2013, 00:33   #3
Narf the Mouse
Registered User
 
Join Date: Jan 2007
Location: Vancouver Area, Canada
Posts: 131
Thanks, it works.

&quot;If you give a mouse a SAS C tutorial...&quot;

What does &quot;Declaration in statement block&quot; mean, and how do I declare a character array (or does it have strings?) Thanks. Edit: Actually, is there a manual/help guide somewhere?
Narf the Mouse is offline  
Old 29 April 2013, 13:11   #4
Leffmann

 
Join Date: Jul 2008
Location: Sweden
Posts: 2,029
SAS/C manuals in text format here:
https://www.dropbox.com/s/5358oxk2dt...tches.zip?dl=1

You also have some quick references in AmigaGuide format in SASC/Help. They don't teach C programming or how to program AmigaOS, just how to use SAS/C.

Last edited by Leffmann; 21 December 2016 at 21:37.
Leffmann is offline  
Old 12 June 2013, 01:36   #5
kamelito
Zone Friend
kamelito's Avatar
 
Join Date: May 2006
Location: France
Posts: 829
online version here
SAS Development System

Link updated
Kamelito

Last edited by kamelito; 19 July 2017 at 08:55.
kamelito is offline  
Old 18 June 2016, 12:18   #6
meynaf
son of 68k
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 44
Posts: 2,459
Quote:
Originally Posted by kamelito View Post
online version here
SAS Development System
Sorry to dig up the thread, but this link is now dead.
meynaf is online now  
Old 18 June 2016, 14:16   #7
ché
Registered User

ché's Avatar
 
Join Date: Dec 2015
Location: Binningen/Switzerland
Age: 52
Posts: 4
It is here:

SASC and some more
ché is offline  
Old 19 July 2017, 00:25   #8
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,058
trying to build something with sasc, all the time gives me some link or resolve errors,
this makes me mad - why do things start allways this way

first it want me to create o/sas-c-classic and bin/sas-c-classic, next this, for example:
Quote:
3.Ram Disk:source> smake
SAS/C_SMAKE 6.58 (27.12.96)
Copyright (c) 1988-1995 SAS Institute, Inc.
sc smalldata cpu=68020 define RELEASE opt nostkchk slib4.c
SAS/C Amiga Compiler 6.58
Copyright (c) 1988-1995 SAS Institute Inc.
***The following header files were included:
...
include:stdio.h
include:sys/commsize.h
include:sys/commlist.h
***End of header file list
Slink - Version 6.58
Copyright (c) 1988-1995 SAS Institute, Inc. All Rights Reserved.

ERROR: Multiply defined symbol '_SysBase'.
First defined in file 'LIB:c.o'.
Type = RELOCATABLE Value = 8
Redefined in file 'o/sas-c-classic/slib4.o'.
Type = RELOCATABLE Value = 0
Undefined symbols First Referenced
_Shutdown File 'o/sas-c-classic/slib4.o'
Enter a DEFINE value for _Shutdown (default ___stub):
_Startup File 'o/sas-c-classic/slib4.o'
Enter a DEFINE value for _Startup (default ___stub):
_main File 'LIB:sc.lib'
Enter a DEFINE value for _main (default ___stub):
what is wrong with this sc 658 setup?
emufan is offline  
Old 19 July 2017, 00:53   #9
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 46
Posts: 365
The source code (slib4.c) seems to have the problems and missing a main().
alkis is offline  
Old 19 July 2017, 01:13   #10
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,058
Quote:
Originally Posted by alkis View Post
The source code (slib4.c) seems to have the problems and missing a main().
it has a _Startup(void) which is def somewhere else, i have no clue.

initially i was about to compile a lightwave plugin, demscape, this gave similiar errors,
so i was about to try the examples in the sdk and i got same errors.
the example with the errors listed above, is in demscape.lha -> sdk/source/
the demscape plugin src is in the main folder. maybe you can build it

Last edited by emufan; 21 July 2017 at 22:46.
emufan is offline  
Old 19 July 2017, 02:01   #11
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 46
Posts: 365
Go to SDK/source dir, open smakefile in an editor

Code:
#
# Server library and startup module -- SAS/C makefile
#
UINC    = /include/
ULIB    = /lib/

CFLAGS  = smalldata cpu=68020
SFLAGS  = $(CFLAGS) define RELEASE opt nostkchk IDIR $(UINC)
add the bold part.

type smake
It builds cleanly after adding the include directory.
alkis is offline  
Old 19 July 2017, 02:46   #12
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,058
thanks for your help, but it does fail the same way.
Quote:
include:sys/commsize.h
include:sys/commlist.h
***End of header file list
Slink - Version 6.58
Copyright (c) 1988-1995 SAS Institute, Inc. All Rights Reserved.

ERROR: Multiply defined symbol '_SysBase'.
First defined in file 'LIB:c.o'.
Type = RELOCATABLE Value = 8
Redefined in file 'o/sas-c-classic/slib4.o'.
Type = RELOCATABLE Value = 0
Undefined symbols First Referenced
_Shutdown File 'o/sas-c-classic/slib4.o'
Enter a DEFINE value for _Shutdown (default ___stub):
_Startup File 'o/sas-c-classic/slib4.o'
Enter a DEFINE value for _Startup (default ___stub):
_main File 'LIB:sc.lib'
Enter a DEFINE value for _main (default ___stub):

SLINK Complete - Maximum code size = 1784 ($000006f8) bytes

Final output file size = 2456 ($00000998) bytes
slink failed returncode 101
sc failed returncode 101

*** SMAKE: Error return from child process ***

*** SMAKE: STOP ***
i simply dont understand , why this stupid compiler isnt able to create
those damn temp folder (o/ ... bin/ ... ) on it's own.
maybe my install is all crap or the author should have been using this compiler on it's own , at least once. i dont get it.
emufan is offline  
Old 19 July 2017, 03:27   #13
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 46
Posts: 365
you are calling smake, right? From inside the "SDK/source" folder, right?
alkis is offline  
Old 19 July 2017, 15:35   #14
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,058
Quote:
Originally Posted by alkis View Post
you are calling smake, right? From inside the "SDK/source" folder, right?
yes, using the shell, cd , next smake.

and now it works, after i extracted my old archive over the SC: installation. - i dont get it.
but this makes the linking work, without "Enter a DEFINE value" messages.

i have no idea what i have destroyed in the old install, since it did work last time, I build the toasterless software.

now i'm about the compile the demscape plugin, lets see how this works

thnx.

#1) it does build the plugin, but i get some undefined variables at the end,
have to look into it :/

the stupid bin/sas-c-classic o/sas-c-classic folder thing i could fix:
there is a ENVARC:sc/SCOPTIONS files, here are those path configs listed.

#2) sc produce all kind of stupid errors, just because you have set a wrong include path.
the compiler gave me a "non matching or overloaded function" error - sort of experience,
until i "fixed" the default include path to sc:include in the smakefile ...

#3) maybe you can help here again: scan.cc
Code:
    int x;
    int startx = (int)ceil(MIN(x1,x2));
    int endx   = (int)floor(MAX(x1,x2));
    if (startx > endx) return;
while linking scan.o
Code:
Undefined symbols        First Referenced
@floor__Fd               File 'scan.o'
Enter a DEFINE value for @floor__Fd (default ___stub):
how can I fix this?

#4) hmm, floor and ceil is listed in some math libs (ffp sing doub), i guess a link lib is missing.

#5) i have no clue which scm* lib i have to add, or which math*.h i have to include.
the demscape.lnk file says:
Code:
FROM sc:lib/serv_s.o "quadedge.o"+"hfield.o"+"stuff.o"+"Basic.o"+"simplfield.o"+"heap.o"+"scan.o"+"demscape.o"
TO "demscape.p"
LIB sc:lib/server.lib LIB:scm881.lib
    LIB:sc.lib LIB:amiga.lib
and smakefile lists this cpu/fpu option:
Code:
CFLAGS  = cpu=68020 math=68881 opt nostkchk idir=$(UINC) idir=cxxinclude:
scan.cc has no #include for any math lib, so how can i fix this error:
Code:
Undefined symbols        First Referenced
@floor__Fd               File 'scan.o'
Enter a DEFINE value for @floor__Fd (default ___stub):
adding all remaining errors:
Code:
Undefined symbols        First Referenced
@floor__Fd               File 'scan.o'
Enter a DEFINE value for @floor__Fd (default ___stub): 
@exit__Fi                File 'hfield.o'
Enter a DEFINE value for @exit__Fi (default ___stub): 
@qsort__FPvUiUiPFPCvPCv_i File 'scan.o'
Enter a DEFINE value for @qsort__FPvUiUiPFPCvPCv_i (default ___stub): 
@mrand48__Fv             File 'quadedge.o'
Enter a DEFINE value for @mrand48__Fv (default ___stub): 
@abort__Fv               File 'Basic.o'
Enter a DEFINE value for @abort__Fv (default ___stub): 
@sqrt__Fd                File 'quadedge.o'
Enter a DEFINE value for @sqrt__Fd (default ___stub): 
@ceil__Fd                File 'scan.o'
Enter a DEFINE value for @ceil__Fd (default ___stub): 
@__builtin_memcpy__FPvPCvUi File 'simplfield.o'
Enter a DEFINE value for @__builtin_memcpy__FPvPCvUi (default ___stub): 
@fabs__Fd                File 'quadedge.o'
Enter a DEFINE value for @fabs__Fd (default ___stub):
#6) somehow ugly and i cannot believe this is the real solution:
in SCOPTIONS file you can add BATCH - from manual:
Quote:
batch
sets the value of all undefined data symbols to 0 and all
undefined code symbols to _ _ _ stub.
Normally, slink asks you to enter a value for each undefined
symbol. However, if you specify batch, slink does not prompt
you to enter values for undefined symbols.
If an undefined function is called, the library function _ _ stub
(_ _ _stub to the linker) is called instead.
The library's version of _ _ stub displays a requester telling you
that an undefined routine was called and allows you to choose
whether to abort or continue.

Last edited by emufan; 20 July 2017 at 02:24.
emufan is offline  
Old 21 July 2017, 15:12   #15
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,058
after using the BATCH option in SCOPTIONS, i get the stub requester
when using the plugin. so this workaround does work.
but it leaves the plugin non working. so is there an option or an additional lib I have
to link in, to make it build without the "Undefined symbols" compiler request?

Last edited by emufan; 21 July 2017 at 22:46.
emufan is offline  
Old 21 July 2017, 16:32   #16
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 46
Posts: 365
Check demscape.zip in the zone.
fixed smakefile, a few minor changes in scan.cc and sdk/include/splug.h in order to compile
.
I've deleted the *.o, kept the demscape.p which I guess is the plugin.

Ignore .uaem files (or delete them)
alkis is offline  
Old 21 July 2017, 22:06   #17
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,058
just tested, it does now open the gui within modeler. thanks alot.
i'll have a look at the changes, wonder what you have fixed.

#1) found the fixes. I can build the plugin now aswell. thnx again

#2) it does really work, very cool

Last edited by emufan; 21 July 2017 at 22:49.
emufan is offline  
Old 21 July 2017, 23:06   #18
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 46
Posts: 365
cool
alkis is offline  
Old 21 July 2017, 23:09   #19
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,058
Quote:
Originally Posted by alkis View Post
cool
indeed. i think the original version was compiled with an older sdk,
so it didnt work with LW5. this is now fixed

read this:
Quote:
I have successfully (?????) compiled the code on the Amiga, however I get a startup error when trying to run the plugin. I cannot figure out what the problem is,
it simply didnt work, so you made it work for the first time ever

#1) the intel version comes with a dem shader plugin, but no src included.

Last edited by emufan; 22 July 2017 at 00:53.
emufan is offline  
Old 22 July 2017, 01:51   #20
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 46
Posts: 365
In the zone, a new zip with hopefully a working demshade pluggin.
alkis is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
SAS C v6.50 Avanaboy request.Apps 2 22 April 2012 03:48
Sas C 6.58 AmiCoder request.Apps 3 06 February 2010 02:19
SAS/C v6.50 zerostress request.Apps 3 08 October 2007 11:35
Sas C V 6.0 Jherek Carnelia request.Apps 1 20 March 2007 11:13
Sas C Scoglio request.Apps 0 28 October 2002 12:13

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 21:33.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.46932 seconds with 12 queries