Amiga Coding Nightmares

The place to upload all essential Amiga software.

Moderators: terriblefire, Terriblefire Moderator

Post Reply
terriblefire
Moderator Team
Moderator Team
Posts: 5368
Joined: Mon Aug 28, 2017 10:56 pm
Location: Glasgow, UK

Amiga Coding Nightmares

Post 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.
———
"It is not necessarily a supply voltage at no load, but the amount of current it can provide when touched that
indicates how much hurting you shall receive."
User avatar
kludge
Posts: 393
Joined: Thu Nov 08, 2018 2:05 pm
Location: Sweden

Re: Amiga Coding Nightmares

Post 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.
A kludge is a workaround or quick-and-dirty solution that is clumsy, inelegant, inefficient, difficult to extend and hard to maintain.

My lack of focus:
[ 4 * Amiga 500 ][ Amiga 500+ ][ 2 * Amiga 600 ][ A1200 ][ Amiga 2000 w/ A2386 ][ Amiga 4000/030 w/ CyberVision 64 3D, FastLane SCSI Z3 ][ CD32 ][ VIC-20 ][ 4 * C64 Breadbin ][ 5 * C64C ][ 2 * C128 ][ C128D ][ C64 DTV ][ Mac Classic ][ Mac Classic II ][ Mac Colour Classic ]
Steve
Posts: 2570
Joined: Fri Sep 15, 2017 11:49 am

Re: Amiga Coding Nightmares

Post 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.
amimjf
Posts: 87
Joined: Sun Mar 22, 2020 8:25 am

Re: Amiga Coding Nightmares

Post 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.
terriblefire
Moderator Team
Moderator Team
Posts: 5368
Joined: Mon Aug 28, 2017 10:56 pm
Location: Glasgow, UK

Re: Amiga Coding Nightmares

Post 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
———
"It is not necessarily a supply voltage at no load, but the amount of current it can provide when touched that
indicates how much hurting you shall receive."
amimjf
Posts: 87
Joined: Sun Mar 22, 2020 8:25 am

Re: Amiga Coding Nightmares

Post 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.
Post Reply

Return to “AMIGA SOFTWARE”