Wednesday, 25 May 2011

Steady Progress

TAG Development Update

Another week has gone.   Time seems to slip away when undertaking large development work on a part-time basis.   Progress on TAG32 continues.   The code that provides structure is coming on well - applications are initialising, and starting and stopping.   The IRQ handlers are up and running along with the generation of events.

A few headaches remain in the structure of the old code.   Particularly the use of data storage within the code through the EQUx instructions.  While this was common practice way back when, and is OK for static values, it's not the way things should be done for variables and is unsafe for future use of threading and data execution protection.  Common register use is in place for the necessary structures - R12 is global data, R11 application handle, R10 package, R9 a live resource header.    Having data in a heap within a dynamic area per application gives much better control of memory usage, reduces fragmentation, reduces the chances of pollution, ensures everything is killed when an application exits, and reduces the use of the RMA to an absolute minimum.

I've had a few questions about software development on RISC OS and have asked a few as well.  StrongED is my preferred way to edit BASIC code.   TAG32 is pure assembler as ARM is by far the easiest CPU to write assembler for, and RISC OS is designed for assembler code throughout.   It takes a bit of effort but sometimes it's worth it and it is what makes RISC OS a bit different.

The PC by comparison is a much more complex instruction set and nothing in is aimed at assembler code any more with C#, VB.NET, and C++ used for almost everything.   This makes development faster on Windows but in many cases there is a total lack of understanding of what is going on.  Too many applications ignore the lazy garbage collector (one of the most stupid optimisations ever dreamt up) and create vast structures of objects and use hundreds of megabytes of RAM as a result.

RISC OS lacks a decent debugger so it's a case of structuring and commenting code, testing one thing at a time, using the console, and even reverting to reading code out to make sure it makes sense.  The only frustration with debugging assembler is that you can trash the machine very easily so it's good that RISC OS reboots very quickly.   BASIC gives a huge amount of power to develop functions, and I have for example functions to define structures and write the variable names and offsets into a file for debug assistance.  Use of LIBRARY replicates include and each file has a procedure to initialise it.

Use of StrongED, BASIC structures and defines, and heavily commented code

No comments:

Post a Comment