[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(major) update to Peersoft now available



Hello guys

This time I am very exited to announce that a major (and quite exotic on the
Apple 2 utility offering ;-) feature has been added to Peersoft.
Now Peersoft allows Applesoft programmers to implement concurrent Applesoft
subroutines within their own programs.
No assembly language wizardry is required from them for supporting this new
feature
That would bring a simpler alternative than using GNO/ME or André Fachat
(GECKOS) work's on our humble pre GS machines. Here is a very simple codlet
that illustrates what it looks like
]LIST
1000 RE =  PEEK( 40160) + 256 *  PEEK( 40161)
1005  POKE 40157, 10: REM # OF APPLESOFT INSTR. RUNS BETWEEN 2 CONTEXT
SWITCHES
1010  DEFINT I,J: DIM I2(127), I1(127), I0(127): REM ARRAYS FOR CONTEXT
STORES
1020  CALL RE,0,IT,J2,J1,J0: REM PHYSICALLY REORGANIZE THE SIMPLE VARIABLE
AREA
1025  CALL RE,4,IT,I0,1100,I1,1200,I2,1300: REM ACTIVATE THE MT KERNEL
1030  PRINT "PROGRAM COMPLETED": END
1100  GOSUB 2100: FOR J0 = 1 TO 10: PRINT J0"/"IT: NEXT J0: GOSUB 2000:
RETURN
1200  GOSUB 2100: FOR J1 = 1 TO 20: PRINT J1"/"IT: NEXT J1: GOSUB 2000:
RETURN
1300  GOSUB 2100: FOR J2 = 1 TO 30: PRINT J2"/"IT: NEXT J2: GOSUB 2000:
RETURN
2000  PRINT "SUBROUTINE #"IT" COMPLETED": RETURN
2100  PRINT "SUBROUTINE #"IT" ENTERED": RETURN
]RUN
SUBROUTINE #0 ENTERED
1/0
2/0
3/0
4/0
SUBROUTINE #1 ENTERED
1/1
2/1
3/1
4/1
SUBROUTINE #2 ENTERED
1/2
2/2
3/2
4/2
5/0
6/0
7/0
8/0
9/0
...
Some facts to keep in mind:
a) Peersoft is a software only solution, no IRQ/NMI interrupt signal from a
harware device is used. Thus Peersoft concurrency model runs equally well on
the whole Apple 2 range from the Apple ][+ (or ][ with a firmware card) to
//gs;
b) As for any "multitask" "kernel", there is a small overload to accept due
to context switching, but this delay should be considered minimal when
compared to context switches involved in more general purpose monitors as
those mentioned above. For Peersoft, only some bytes from page zero, the
hardware stack pointer (reg. S) and some bytes from the hardware stack
(which serves also that a general purpose stack by Applesoft itself) are
saved and restored on every context switch. This context size to manage is
relatively small because such context swicth occur at a known location
within the execution loop.
c) Peersoft does not preempt machine code routines, if you have a machine
langage routine that lasts a long time from the user point of view, and you
would like to see its run "sliced" as your Applesoft concurrent subroutines
currently are, then you will have to split the code and call each segment
from within Applesoft. I might give some samples beyond the obvious one
included in the TF Applesoft program provided on the disk, before next
Peersoft release.
d) Thru future Peersoft releases, part of development resources (mainly time
to spend) will be dedicated to develop communications between concurrent
subroutines... and stability enhancements too, particularly relating to
error handling allowing "local" error handling to every subroutine as
required by the Applesoft programmer.
e) a tutorial RTF file and a sister Applesoft progarm (TUTORIAL) on the disk
is there to give readers early details upon how to design programs
benefiting from Peersoft MT mechanism. 
For a great introduction on concurrent progarmming on 6502, I would
recommend André's page @ http://www.6502.org/users/andre/
Also the GNO/ME (Unix for Apple //gs) Web site @ http://www.gno.org/gno/ is
recommended for anyone with a strong //gs configuration (just like the big
boys from today, eg. Linux, *BSD and others).
Not that I have included a tutorial file (RTF format, name is
TutorialMT.rtf) for helping Applesoft programmers to use concurrent
programming within their own programs. The conclusion section of this
document is a todo list which I might implement in future releases of
Peersoft.

By the way from this release on Peersoft also includes a simple variable
area physical reorganization utility routine in order to optimize access to
selected variables, so that access time to such variables do not depend on
variable in memory creation order anymore from the time the program was run.
Here the term physical is used because such reorg would imply actually
moving variables' values in memory, unlike the use of a cache where only
references/pointers to variables value are handled within a separate
dedicated memory area.

Logisitic stuff:
URL is http://bgilon.free.fr/apple2
Archive Peersoftv1.4.zip
One do file for assemby sources, one for executable files (Applesoft and
machine code).
For organization of the archive, please look at my previous posts (same
archive organization) 

Have fun with your Apple 2,

Again, any feedback, bug report or wish for enhancements is welcomed on this
thread,
Thank you for reading,
Benoît