Page 1 of 1

Amiga Coding Nightmares

Posted: Fri Sep 11, 2020 9:34 am
by terriblefire
One thing I hate about the Amiga is how over complicated the operating system is.. as an example.. The following code is needed in a C driver to setup a new task thread. Sure you can use CreateTask() normally but not easily when in a driver context.

Code: Select all

// setup a task handler
    APTR task_stack = __AllocMem(SysBase, TASK_STACK_SIZE, MEMF_ANY|MEMF_CLEAR);

    if (task_stack != NULL)
    {
        device->Task.tc_SPLower = task_stack;
        device->Task.tc_SPUpper = (APTR) ((ULONG)task_stack + TASK_STACK_SIZE);
        device->Task.tc_SPReg = device->Task.tc_SPUpper;
        
        device->Task.tc_Node.ln_Type = NT_TASK;
        device->Task.tc_Node.ln_Pri = TASK_PRIORITY;
        device->Task.tc_Node.ln_Name = (char *) DevName;
        device->Task.tc_UserData = (APTR) device;
        __AddTask(SysBase, &(device->Task), (APTR) TASK_METHOD, NULL);
    }
Thats horrific. People will argue that it makes things more flexible but it also makes simple things terribly expensive to write and horrific to maintain.

Re: Amiga Coding Nightmares

Posted: Fri Sep 11, 2020 12:12 pm
by kludge
Reminds me of when I tried to code ObjC on the Mac at one point. As a non-programmer I couldn't make sense of it. Lots and lots of words and text. Straight up C code I can handle, but that was just horrific.

Re: Amiga Coding Nightmares

Posted: Fri Sep 11, 2020 12:13 pm
by Steve
Yeah, not to go too far off topic but as an atari/pc/linux/mac guy I find AmigaOS to be very strange sometimes :) It is quirky and has a different take on computing OS concepts.. but that is also what I find fun about it, even if I almost threw a hissy fit when I couldn't change to drive G in the Amiga shell the other day when needing to do something lol.

Re: Amiga Coding Nightmares

Posted: Fri Sep 11, 2020 4:47 pm
by amimjf
I think most lowlevel operating systems are very similar,.. here is a snippet from the day job,..

Code: Select all

rtems_status_code sts;
rtems_id task_id;
rtems_task_argument arg = 0x1;

rtems_task my_task( rtems_task_argument arg )
{
	return 0;
}

sts = rtems_task_create( rtems_build_name( 'H', 'E', 'L', 'P' ), 
						 1, 
						 0x4000, 
						 RTEMS_FLOATING_POINT | RTEMS_DEFAULT,
						 RTEMS_PREEMPT | RTEMS_TIMESLICE | RTEMS_DEFAULT,
						 &task_id );
						 
sts = rtems_task_start( task_id, &my_task, arg );
pretty similar i think,.. i've not even included the code to setup a memory region, so the task has a stack space to allocate from.

Re: Amiga Coding Nightmares

Posted: Fri Sep 11, 2020 5:12 pm
by terriblefire
Nah that is much more readable...

My example was a snippet but i find Amiga C coding horrific. Linux C coding isnt fun but i can do it...

Linux C++ is the best :P

Re: Amiga Coding Nightmares

Posted: Fri Sep 11, 2020 5:59 pm
by amimjf
I suppose if you think the internals like this are unchanged from 83/84,.. API design has changed quite a bit, the only stuff i've ever seen older is OpenVMS the kernel API goes back to the mid-70s.

Ignoring the C library API of course, thats 60s but its pretty simple.