Amiga Coding Nightmares

The place to upload all essential Amiga software.

Moderators: terriblefire, Terriblefire Moderator

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

Amiga Coding Nightmares

Post by terriblefire » Fri Sep 11, 2020 9:34 am

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.
———
I get cranky when asked to repeat myself.

User avatar
kludge
Posts: 388
Joined: Thu Nov 08, 2018 2:05 pm
Location: Sweden
Contact:

Re: Amiga Coding Nightmares

Post by kludge » Fri Sep 11, 2020 12:12 pm

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 ]

User avatar
Steve
Trusted Guru
Trusted Guru
Posts: 608
Joined: Fri Sep 15, 2017 11:49 am

Re: Amiga Coding Nightmares

Post by Steve » Fri Sep 11, 2020 12:13 pm

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.
Repairs & Servicing for Atari & Amiga machines (and any other retro computers) Located in the West Midlands UK. PM me if you require assistance.
www.solidstatesociety.co.uk

amimjf
Posts: 50
Joined: Sun Mar 22, 2020 8:25 am

Re: Amiga Coding Nightmares

Post by amimjf » Fri Sep 11, 2020 4:47 pm

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: 3472
Joined: Mon Aug 28, 2017 10:56 pm
Location: Glasgow, UK
Contact:

Re: Amiga Coding Nightmares

Post by terriblefire » Fri Sep 11, 2020 5:12 pm

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
———
I get cranky when asked to repeat myself.

amimjf
Posts: 50
Joined: Sun Mar 22, 2020 8:25 am

Re: Amiga Coding Nightmares

Post by amimjf » Fri Sep 11, 2020 5:59 pm

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”