Multitasking on the 2068 (Part 2)

Authors

Publication

Pub Details

Date

Pages

BASIC Terms

See all articles from SMUG Bytes v6 n3

The following changes are necessary to last months machine code.

64824 0         NO-OP Inst.
64979 241 POP AF

Note I have indicated where to call another routine if you desire to do something else before returning. Put it in there with a call as you have all the registers still pushed. But remember you are still in DI mode. The El at 64986 isn’t necessary as there is an El at the end of the regular interrupt routine. It’s there so no one would say he didn’t do it.

We now need a basic prog.to start and set the clock. I used ZEUS to compile the program and saved it as clock. bin on our AERCO disk system.

Note that this program runs without crashing if the clock started in line 2. It asks for inputs which are fine.

Doing a NEW turns off the clock but a RANDOMIZE USR 64809 restarts it. Once the clock is started you can delete the BASIC program, so long as you can remember the start/stop addresses. The clock can be reset using the data statement addresses as direct POKE commands.

Now to keep the clock ticking without printing you have to: POKE 64949,24: POKE 64950,10

To again start printing, repoke with: POKE 64949,33 :POKE 64950,63

Other then the statement that a CLS must immediately be followed by a PRINT “” so that a RST 16 code works properly, you should avoid writing to line zero in your program. Anything written there would be over written by the clock. This is another reason you don’t edit a program with the clock printing.

You can change the AT statement in DATA to print elsewhere. However, don’t print it at the bottom of the EDIT/INPUT screen or even on the bottom of the top screen as an input requiring another line will all of a sudden put the clock in the bottom screen.

There you have it. True Multitasking ala the QL. Not multi-processing but time sharing. For those who say it doesn’t slow things up, don’t believe it. It does slow it up bit as I found input slower because it had to get info from the routine at address 56 as well. As such it had to run the whole routine to get a character as well, not just check. Anything extra you do slows things up at least a wee bit. However, having a toy do multitasking means that perhaps it isn’t a toy.

It hasn’t been tested in all cases there may be other situations that cause problems as well. However, enjoy.

Note

Lloyd’s sample program uses an AERCO-specific machine code loading mechanism in line 1. Substitute CAT “clock.bin”,64800,256 with LOAD “clock” CODE for most emulators.

Products

 

Media

 

Image Gallery

Source Code

    1 CLEAR 64799: CAT "clock.bin" , 64800, 256 
    2 POKE 65021,195: POKE 65022, 76: POKE 65023,253: REM necessary codes to finish the call routine. 
    3 OUT 244,0: PRINT "": REM OUT is for AERCO Disk users-it may crash without it. The PRINT is necessary as RST 16 woun't work after CLS without it. 
    4 RANDOMIZE USR 64809: REM Start clock 
    5 CLS: PRINT AT 5,1; "A MULTITASKING DIGITAL CLOCK"; AT 6,15; "by"; AT 7,8; "Lloyd H. Dreger"; AT 9,8; "COPYRIGHT 1988" 
    8 INPUT "Do you wish to set clock? y/n "; a$ 
    9 IF a$="n" OR a$="'N" THEN GO TO 35 
   10 INPUT "What hour? 00-23 ";a$ 
   11 IF LEN a$=1 THEN LET a$="0"+a$ 
   12 IF LEN a$>2 THEN GO TO 10 
   13 LET y=64834 
   14 FOR x=1 TO 2: POKE Y, CODE a$ (x) :Let y=y+1: NEXT x 
   15 LET y=y+1 
   16 INPUT "What min? ";a$ 
   17 IF LEN a$=1 THEN LET a$="0"+a$ 
   18 IF LEN a$>2 THEN GO TO 16 
   19 FOR x=1 TO 2 
   20 POKE Y, CODE a$ (x) 
   21 LET y=y+1 
   22 NEXT x 
   23 LET y=y+1 
   24 INPUT "What sec? "; a$ 
   25 IF LEN a$=1 THEN LET a$="0"+a$ 
   26 IF LEN a$>2 THEN GO TO 24 
   27 FOR x=1 TO 2 
   28 POKE y, CODE a$ (x) 
   29 LET y=y+1 
   30 NEXT x
   35 PRINT "To reset clock--"; TAB 8; " GO TO 5"'"To STOP clock--"; TAB 8; " RANDOMIZE USR 64800"''"To restart clock--"; TAB 8; OUT 244, 0 and"; TAB 8; " RANDOMIZE USR 64809" 
   36 PRINT '"DO NOT RUN clock while entering or editing programs or while MOVing and CATing programs to AERCO Disks"''"Read NOTES to write programs using this clock." 
   89 STOP 
   90 RANDOMIZE USR 64800: REM the stop clock statement
Scroll to Top