Home » Archimedes archive » Acorn User » AU 1995-02.adf » !Dark_DarkHorse » !DarkHorse/Docs/FileFormat

!DarkHorse/Docs/FileFormat

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1995-02.adf » !Dark_DarkHorse
Filename: !DarkHorse/Docs/FileFormat
Read OK:
File size: 51B9 bytes
Load address: 0000
Exec address: 0000
File contents
___________________________________________________________________________
                   | 
     ,####         | Name    : DARKHORSE FILE FORMAT ver 1.00
   #######         |  
  ########         | Author  : MR KULDIP S PARDESI
 #########         |            
 ################# | Copyright KOOL 1993
 '###############" |                                                       
  "#############"  | Email : archie@dcs.qmw.ac.uk
    "#########"    |            
       """""       | Post : 50 SELBORNE RD, ILFORD, ESSEX, IG1 3AJ, ENGLAND
___________________|_______________________________________________________

 THIS IS A UPDATED FILE FORMAT FOR DARKHORSE SCREENSAVERS. IF YOU ARE A
 REGISTERED USER OR HAVE DARKHORSE 1.00 OR ABOVE, YOU WILL ALREADY HAVE
 THIS FILE.

 Copyright of Savers - Important
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Sorry about all this copyright stuff, but it's to protect you aswell as
 myself.

 The actual copyright of the saver remains that of the author. If you
 write a saver, you are entitled to put it into the Freeware market,
 but not into a distributed copy of DarkHorse. 

 If you wish to have your saver included within the distribution of
 DarkHorse, please send me a copy of your saver and I'll be more than
 happy to do just that. You don't need to give me a copy of the source,
 unless there is a bug in the saver needing attention or if you would
 just like to anyway.

 The reason for this is that I would like to keep a record of exactly
 what savers are included with which versions of DarkHorse. In this
 way I can also make sure that DarkHorse is functioning properly in
 that no damaging savers are being utilised by DarkHorse.

 Hopefully, as more savers become available - PD/shareware/freeware
 libraries will issue the savers on their own for people to pick and
 choose the ones they want to include in their personal copy of
 DarkHorse.
___________________________________________________________________________

 DarkHorse Savers
 ~~~~~~~~~~~~~~~~
 The following text describes how to write your own screen savers to work
 with DarkHorse. 

 IT IS A GOOD IDEA TO READ THIS ENTIRE TEXT AS IT PROVIDES USEFUL HINTS
 AND TIPS AS TO HOW TO GET YOUR OWN SAVERS TO WORK.

 All the DarkHorse screensavers are held in the directory 'Horses' within
 the !DarkHorse application directory. This means that the maximum number
 of savers allowed is the maximum  number of files allowed in a directory
 by RISCOS. This is not really a problem for the present.

 The savers are completely coded in assembly, and are stand alone units
 which are executed by the DarkHorse application.

 DarkHorse screensavers can occupy as much memory as they like. DarkHorse
 will claim the required amount from the RMA when it is needed. On top of
 this your saver can claim as much memory as it wants (or is available) 
 internally. If you do need some extra memory during runtime, you should
 use "OS_Module 6" to claim from RMA and be sure to free it using 
 "OS_Module 7" when you exit from the saver. If "OS_Module 6" fails -
 ie. 'that amount of memory cannot be claimed', the system would usually
 report an error. However, DarkHorse has been written such that if an
 error occurs from within a saver, it will automatically change saver's
 to 'Dark Task' and use that to blank. 'Claiming' and 'Freeing' memory
 will usually be done on saver code 'initialisation' and 'shutdown'
 respectively (see below about 'initialisation' and 'shutdown' code).

 The filename that this code is given is the name that will appear in
 the 'Savers' list within DarkHorse.

 The saver has the facility to read data given by the user so that the
 actual blanking is more varied.

 DarkHorse does not work under interrupts, meaning that it will not be able
 to screen blank if another task is hogging the processor. DarkHorse is a
 RISCOS application which relies upon the Wimp_Poll to function properly.

 Changes since version 0.99 (unregistered DarkHorse)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 The new format requires the coder to write an extra block of code
 which is for the purpose of exitting and shutting down a screensaver.
 Most of the current savers have this block empty, as they do not need
 to do anything on exit from a saver. The purpose of the 'shutdown' code
 is to allow the saver to free any chunks of memory it may have claimed
 as heap/RMA etc. or perhaps the saver needs to set some crucial
 variables. This addition has caused a minor change to offsets at which
 your code is assembled at.
 
 The other change is such that on every call to your 'polling' code,
 DarkHorse will set the registers r2 and r3 to contain a GCOL and TINT
 values respectively, which will be incremented on every polling code
 call correctly according to the current screenmode. These values can be
 used directy to set the next GCOL and TINT colours.
 
 Finally some tidying up has been done such that the saver format is
 more efficient.
 
 The following is the complete new fileformat :

 The Saver FileFormat
 ~~~~~~~~~~~~~~~~~~~~
 DarkHorse screensavers consist of four main sections :

 . The header - 
                This data format allows known data to be found at known
                addresses, see the format below.

 . The initialisation code - 

                When DarkHorse is to start screenblanking using your code,
                it will first call a section of your code which allows any
                initial declarations/setups (ie claiming memory)
                to be made. This will only be called once, after which the
                'polling code' will be called repeatedly, until exit from
                the saver. This call will be made at an offset of 100 bytes
                relative to the start of your code, ie if your code is
                assembled at code%, the initialisation is called at 
                code%+100. The header described below, explains how to
                implement this.
                
 . The shutdown code -
 
                This section of code is called when DarkHorse has noticed
                a mouse movement or keypress during screen blanking and
                thus is returning desktop control to the user. For most
                savers this shutdown code will be empty. However, it will
                come in use if your saver had claimed memory which requires
                freeing, or if you wish to set/reset some variables etc.
                
                The call will be made at an offset of 104 bytes relative to
                the start of yout code, ie if your code is assembled at
                code%, the shutdown code is called at code%+104. The header
                described below, explains how to implement this.

 . The polling code -
                
                After calling the initialisation code, the saver repeatedly
                calls this 'polling code' which should perform a single
                iteration, preserve any internal variables and exit. This
                obviously allows DarkHorse to multitask. The actual code
                for polling should start at an offset of 108 bytes relative
                to the start of your code, ie if your code is assembled at
                code%, the polling code is called at code%+108. The header
                described below, explains a little more.


 The screensaver header :

 bytes (0-3) 1 word       : indicates the number and type of argument that
 word  (0  )                the saver will take, and indicates whether the
                            saver requires the DarkHorse application to 
                            clear the screen to black or not before entering
                            the saver.

                            Set this first word to :

                                          0  = no parameters
                                         10  = one long string
                            1,2,3,4,5,6,7,8  = number of integer parameters 
                             as above + 255  = as above but don't black the
                                               screen on entry.

                            This word is used to by DarkHorse to check if
                            the argument input given by the user is valid.
                            If an invalid input is given, the saver will 
                            use the default value(s) (see below).

                            If the screen is to be blacked - ie removing the
                            desktop image - the palette will be set to a more
                            pleasent range.

 bytes (4-35) 8 words    :  The 8 words here should contain the default 
 words (1-8)                value(s) of the argument so that DarkHorse will
                            know what to set the input of a new saver and
                            be able to refer to them when an invalid
                            argument has been given by the user. 

                            These 8 words are also the data which are the
                            parameters passed in by the user. DarkHorse 
                            actually writes the parameters to this
                            location, then your code will read them from
                            here.

 bytes (36-99) 16 words   : These words are used to store the argument help
 words (9-24)               which will be displayed to the user on two rows
                            of 32 bytes each. Usually this help will 
                            describe the argument required by this saver.

 bytes (100-103) 1 word   : B init ; Jumps to the init routine.

                            You will need to write the actual initialisation
                            code at a further location, and jump to it from
                            here, using a branch instruction as shown.
                            
                            DarkHorse calls this location for initialisation,
                            ie CALL (code%+100)
                            
                            The init routine should use 'MOV pc,r14' to
                            exit the initialisation.

 bytes (104-107) 1 word   : B shutdown ; Jumps to the shutdown routine.

                            You will need to write the actual shutdown
                            code at a further location, and jump to it from
                            here, using a branch instruction as shown.

                            DarkHorse calls this location for shutdown
                            ie CALL (code%+104)
     
                            The shutdown routine should use 'MOV pc,r14' to
                            exit the shutdown code.

 bytes (108-xxx) x word   : The actual poll routine will start here.
                            ie CALL (code%+108)


 Register settings
 ~~~~~~~~~~~~~~~~~
 On entry into the saver Initialisation code at +100 bytes, the
 registers will be set thus :

 r0 = screen width  (coordinate value) 
 r1 = screen height (coordinate value) 
 r2 = number of colours in current screen mode 2/4/16/256
 r3 = screen base address
 r4 = screen size in bytes

 On entry into the saver Polling code at +108 bytes, the registers
 will be set thus :

 r0 = a random integer number between (0-screen width)
 r1 = a random integer number between (0-screen height)
 r2 = the next gcol in the current palette
 r3 = the next tint (only 256 colour modes)
   
 The actual code
 ~~~~~~~~~~~~~~~
 The most obvious and convenient way, is to use the BASIC assembler - 

 Below is a skeleton program of the screensaver format which can be
 built upon.

 It includes an assembly block at the end to set the current foreground
 colour to the next in the palette, such that all the colours available
 are cycled through. If you intend to use this, you will need to make
 sure to include the few statements in the 'initialisation code' which
 stores the number of colours at the label '.nocols'. See the code below
 to see what I mean. Now to use the 'SetCol' routine, (which can be
 called from the init code or poll code) , first preserve the current
 registers to stack/memory and call the routine with 'BL SetCol'. This
 will set the GCOL according to screen mode, and return back, after which
 you should restore the registers that you stored. Alternatively you
 can explicitly set the GCOL and TINT to the values passed into your
 polling code as registers r2 and r3 respectively.

 Once you are happy with your code and it has been assembled, you will
 need to store it to disk. For the example program given below, you can
 do the following, after running the program (ie after assembling) :

 PRINT ~code%, ~P%          <-- This will print the hexadecimal values
                                of start and end of code, respectively.

 *SAVE "MySaver" XXXX YYYY  <-- This will save the code to file "MySaver"
                                XXXX is the hex value given by ~code%
                                YYYY is the hex value given by ~P% 

 You can test your code by CALLing code%+100 to check initialisation,
 and then call code%+108 repeatedly to check your polling code.

 The only checking of argument values that darkhorse will make is :

 - if the input is supposed to be a string (ie type 10), it will be
   checked and if necessary truncated to length 32 bytes.
 - if the input is supposed to have a certain number of arguments,
   the check will ensure this else replace them with the default.
 - darkhorse will ensure all arguments are integer and positive,
   no negative input allowed as it can make some savers hang due
   to loops going the wrong way etc.
 
 So, although DarkHorse does do a few checks for you, please test your
 savers thoroughly, to make sure they don't hang/crash the machine 
 when extreme values are given. Be sure to test your saver with values
 of zero as argument input, because for example if you're using a user
 argument value to provide an increment step for a loop, a step of
 zero will not make the difference, and may cause your saver to run into
 an infinite loop.

 Another thing to make sure is that the help strings in the header
 are not any larger than the size specified. If you accidently make
 them larger, they will overwrite any assembly instructions which
 follow. This has happened to me, and it took me a while to find out
 what the problem was. So, I advise you to double check the lengths - 
 the two strings must be less than 31 chars each.

 Yet another good tip to getting your savers to work is, to write the
 saver in BASIC first and get it working exactly as you want. Then it's
 simply a matter of converting your BASIC statements into equivalent
 assembly.

 This file is included in the form of a BASIC program so that it can be
 adapted easily, called 'BaseSave' it can be found in the directory
 'Example' within the 'WorkHorses' directory. This 'Example' directory
 also contains a BASIC file called 'flash'. This is the source code to
 the saver 'flash' which is a very, very simple saver built upon the code
 below. 'flash' is a good example of how to utilise the 'BaseSave' code,
 and it shows how to extend the basic structure a little. It's fully
 commented. Also included is a BASIC program called 'BASICflash', which
 is the BASIC equivalent to the flash saver. It's a good idea to get a
 print out of 'BaseSave', 'flash' and 'BASICflash' to compare and
 understand the saver workings. 

 If you intend to use BaseSave, you will only need to write the sections
 of code which do any initialisation you want, and the polling code. These
 can be inserted into the BaseSave as indicated below.

 For the average Archimedes assembly coder, there shouldn't be any
 problems in getting your ideas into code. However, "it's a funny old
 game", and programming in assembly isn't the easiest thing in the
 world (or the hardest), so if you do have problems in getting your
 code to function properly with DarkHorse, don't hesitate to contact me.

--------------------------------------------------------------------

REM > BaseSave

DIM code% 8192

PROCAssemble

REM * Set Header information.

!(code%+0)  = 0  : REM argument type/number
!(code%+4)  = 0  : REM argument 1
!(code%+8)  = 0  : REM argument 2
!(code%+12) = 0  : REM argument 3
!(code%+16) = 0  : REM argument 4
!(code%+20) = 0  : REM argument 5
!(code%+24) = 0  : REM argument 6
!(code%+28) = 0  : REM argument 7
!(code%+32) = 0  : REM argument 8

$(code%+36)=""   : REM help string 1
$(code%+68)=""   : REM help string 2

END

DEFPROCAssemble

FOR pass=0 TO 3 STEP 3
P%=code%
[OPT pass

.argument_type
EQUD 0

.arguments
EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0

.help_strings
EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0
EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0

B init     ; Jumps to the initialisation routine.
           ; this is location code+100

B shutdown ; Jumps to the shutdown routine.
           ; this is location code+104

;-------------------------------------------------

.poll ; this is location code+108 bytes

ADR r11,regs         ; address r0 to space to hold regs.
STMIA r11,{r1-r14}   ; preserve regs.

;--------------------------------------------------------------------
;           ********************************************
;           *** YOUR SINGLE POLLING CODE STARTS HERE ***
;           ********************************************
;            At this moment r0 = random int 0-scr.width
;                           r1 = random int 0-scr.height
;                           r2 = next gcol number
;                           r3 = next tint number
;
;            blah! blah! blah! blah! blah! blah! blah!
;
;           ********************************************
;           ***  YOUR SINGLE POLLING CODE ENDS HERE  ***
;           ********************************************
;--------------------------------------------------------------------

ADR r11,regs        ; address r0 to space to hold regs.
LDMIA r11,{r1-r14}  ; restore regs.
MOV PC,r14          ; exit polling code.

;--------------------------------------------------------------------

.init ; the initialisation code

;--------------------------------------------------------------------
;           ********************************************
;           *** YOUR INITIALISATION CODE STARTS HERE ***
;           ********************************************
;               At this moment r0 = screen width
;                              r1 = screen height
;                              r2 = number of colours
;                              r3 = screen base address
;                              r4 = screensize in bytes
;
;            blah! blah! blah! blah! blah! blah! blah!
;
;           ********************************************
;           ***  YOUR INITIALISATION CODE ENDS HERE  ***
;           ********************************************
;--------------------------------------------------------------------

;--------------------------------------------------------------------

; you have to do this here if you want to use my '.SetCol' code

ADR r3,nocols
STR r2,[r3]   ; store number of colours to SetCol data block.

;--------------------------------------------------------------------

MOV PC,r14 ; exit initialisation.

;-----------------------------------------------------------------

.shutdown ; the shutdown code

;--------------------------------------------------------------------
;           ********************************************
;           ***    YOUR SHUTDOWN CODE STARTS HERE    ***
;           ********************************************

;            blah! blah! blah! blah! blah! blah! blah!

;           ********************************************
;           ***     YOUR SHUTDOWN CODE ENDS HERE     ***
;           ********************************************
;--------------------------------------------------------------------
MOV PC,r14 ; exit shutdown code.

.regs
EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0
EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0


;--------------------------------------------------------------------
; THE CODE BELOW CAN BE CALLED REPEATEDLY TO SET THE NEXT GCOL.
;--------------------------------------------------------------------

.nocols
EQUD 2:EQUD 1:EQUD 0
.SetCol
LDR 8,[PC,#(-20)]:LDR 9,[PC,#(-20)]:LDR 10,[PC,#(-20)]
CMPS 8,#256:BLT lessthan256
SWI 256+18:SWI 256:MOV r0,9:SWI "OS_WriteC"
SWI 256+23:SWI 256+17:SWI 256+2:MOV r0,10:SWI "OS_WriteC"
SWI 256:SWI 256:SWI 256:SWI 256:SWI 256:SWI 256
ADD 10,10,#64:CMPS 10,#256:MOVEQ 10,#0:ADDEQ 9,9,#1:CMPS 9,#64
MOVGE 9,#1:STR 9,[PC,#(-120)]:STR 10,[PC,#(-120)]:MOV PC,r14
.lessthan256:SWI 256+18:SWI 256:MOV r0,9:SWI "OS_WriteC"
ADD 9,9,#1:CMPS 9,8:MOVGE 9,#1:STR 9,[PC,#(-160)]:MOV PC,r14

]
NEXT pass

PRINT code%,P%

ENDPROC


 
00000000  5f 5f 5f 5f 5f 5f 5f 5f  5f 5f 5f 5f 5f 5f 5f 5f  |________________|
*
00000040  5f 5f 5f 5f 5f 5f 5f 5f  5f 5f 5f 0a 20 20 20 20  |___________.    |
00000050  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 7c  |               ||
00000060  20 0a 20 20 20 20 20 2c  23 23 23 23 20 20 20 20  | .     ,####    |
00000070  20 20 20 20 20 7c 20 4e  61 6d 65 20 20 20 20 3a  |     | Name    :|
00000080  20 44 41 52 4b 48 4f 52  53 45 20 46 49 4c 45 20  | DARKHORSE FILE |
00000090  46 4f 52 4d 41 54 20 76  65 72 20 31 2e 30 30 0a  |FORMAT ver 1.00.|
000000a0  20 20 20 23 23 23 23 23  23 23 20 20 20 20 20 20  |   #######      |
000000b0  20 20 20 7c 20 20 0a 20  20 23 23 23 23 23 23 23  |   |  .  #######|
000000c0  23 20 20 20 20 20 20 20  20 20 7c 20 41 75 74 68  |#         | Auth|
000000d0  6f 72 20 20 3a 20 4d 52  20 4b 55 4c 44 49 50 20  |or  : MR KULDIP |
000000e0  53 20 50 41 52 44 45 53  49 0a 20 23 23 23 23 23  |S PARDESI. #####|
000000f0  23 23 23 23 20 20 20 20  20 20 20 20 20 7c 20 20  |####         |  |
00000100  20 20 20 20 20 20 20 20  20 20 0a 20 23 23 23 23  |          . ####|
00000110  23 23 23 23 23 23 23 23  23 23 23 23 23 20 7c 20  |############# | |
00000120  43 6f 70 79 72 69 67 68  74 20 4b 4f 4f 4c 20 31  |Copyright KOOL 1|
00000130  39 39 33 0a 20 27 23 23  23 23 23 23 23 23 23 23  |993. '##########|
00000140  23 23 23 23 23 22 20 7c  20 20 20 20 20 20 20 20  |#####" |        |
00000150  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000170  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 0a  |               .|
00000180  20 20 22 23 23 23 23 23  23 23 23 23 23 23 23 23  |  "#############|
00000190  22 20 20 7c 20 45 6d 61  69 6c 20 3a 20 61 72 63  |"  | Email : arc|
000001a0  68 69 65 40 64 63 73 2e  71 6d 77 2e 61 63 2e 75  |hie@dcs.qmw.ac.u|
000001b0  6b 0a 20 20 20 20 22 23  23 23 23 23 23 23 23 23  |k.    "#########|
000001c0  22 20 20 20 20 7c 20 20  20 20 20 20 20 20 20 20  |"    |          |
000001d0  20 20 0a 20 20 20 20 20  20 20 22 22 22 22 22 20  |  .       """"" |
000001e0  20 20 20 20 20 20 7c 20  50 6f 73 74 20 3a 20 35  |      | Post : 5|
000001f0  30 20 53 45 4c 42 4f 52  4e 45 20 52 44 2c 20 49  |0 SELBORNE RD, I|
00000200  4c 46 4f 52 44 2c 20 45  53 53 45 58 2c 20 49 47  |LFORD, ESSEX, IG|
00000210  31 20 33 41 4a 2c 20 45  4e 47 4c 41 4e 44 0a 5f  |1 3AJ, ENGLAND._|
00000220  5f 5f 5f 5f 5f 5f 5f 5f  5f 5f 5f 5f 5f 5f 5f 5f  |________________|
00000230  5f 5f 7c 5f 5f 5f 5f 5f  5f 5f 5f 5f 5f 5f 5f 5f  |__|_____________|
00000240  5f 5f 5f 5f 5f 5f 5f 5f  5f 5f 5f 5f 5f 5f 5f 5f  |________________|
*
00000260  5f 5f 5f 5f 5f 5f 5f 5f  5f 5f 0a 0a 20 54 48 49  |__________.. THI|
00000270  53 20 49 53 20 41 20 55  50 44 41 54 45 44 20 46  |S IS A UPDATED F|
00000280  49 4c 45 20 46 4f 52 4d  41 54 20 46 4f 52 20 44  |ILE FORMAT FOR D|
00000290  41 52 4b 48 4f 52 53 45  20 53 43 52 45 45 4e 53  |ARKHORSE SCREENS|
000002a0  41 56 45 52 53 2e 20 49  46 20 59 4f 55 20 41 52  |AVERS. IF YOU AR|
000002b0  45 20 41 0a 20 52 45 47  49 53 54 45 52 45 44 20  |E A. REGISTERED |
000002c0  55 53 45 52 20 4f 52 20  48 41 56 45 20 44 41 52  |USER OR HAVE DAR|
000002d0  4b 48 4f 52 53 45 20 31  2e 30 30 20 4f 52 20 41  |KHORSE 1.00 OR A|
000002e0  42 4f 56 45 2c 20 59 4f  55 20 57 49 4c 4c 20 41  |BOVE, YOU WILL A|
000002f0  4c 52 45 41 44 59 20 48  41 56 45 0a 20 54 48 49  |LREADY HAVE. THI|
00000300  53 20 46 49 4c 45 2e 0a  0a 20 43 6f 70 79 72 69  |S FILE... Copyri|
00000310  67 68 74 20 6f 66 20 53  61 76 65 72 73 20 2d 20  |ght of Savers - |
00000320  49 6d 70 6f 72 74 61 6e  74 0a 20 7e 7e 7e 7e 7e  |Important. ~~~~~|
00000330  7e 7e 7e 7e 7e 7e 7e 7e  7e 7e 7e 7e 7e 7e 7e 7e  |~~~~~~~~~~~~~~~~|
00000340  7e 7e 7e 7e 7e 7e 7e 7e  7e 7e 0a 20 53 6f 72 72  |~~~~~~~~~~. Sorr|
00000350  79 20 61 62 6f 75 74 20  61 6c 6c 20 74 68 69 73  |y about all this|
00000360  20 63 6f 70 79 72 69 67  68 74 20 73 74 75 66 66  | copyright stuff|
00000370  2c 20 62 75 74 20 69 74  27 73 20 74 6f 20 70 72  |, but it's to pr|
00000380  6f 74 65 63 74 20 79 6f  75 20 61 73 77 65 6c 6c  |otect you aswell|
00000390  20 61 73 0a 20 6d 79 73  65 6c 66 2e 0a 0a 20 54  | as. myself... T|
000003a0  68 65 20 61 63 74 75 61  6c 20 63 6f 70 79 72 69  |he actual copyri|
000003b0  67 68 74 20 6f 66 20 74  68 65 20 73 61 76 65 72  |ght of the saver|
000003c0  20 72 65 6d 61 69 6e 73  20 74 68 61 74 20 6f 66  | remains that of|
000003d0  20 74 68 65 20 61 75 74  68 6f 72 2e 20 49 66 20  | the author. If |
000003e0  79 6f 75 0a 20 77 72 69  74 65 20 61 20 73 61 76  |you. write a sav|
000003f0  65 72 2c 20 79 6f 75 20  61 72 65 20 65 6e 74 69  |er, you are enti|
00000400  74 6c 65 64 20 74 6f 20  70 75 74 20 69 74 20 69  |tled to put it i|
00000410  6e 74 6f 20 74 68 65 20  46 72 65 65 77 61 72 65  |nto the Freeware|
00000420  20 6d 61 72 6b 65 74 2c  0a 20 62 75 74 20 6e 6f  | market,. but no|
00000430  74 20 69 6e 74 6f 20 61  20 64 69 73 74 72 69 62  |t into a distrib|
00000440  75 74 65 64 20 63 6f 70  79 20 6f 66 20 44 61 72  |uted copy of Dar|
00000450  6b 48 6f 72 73 65 2e 20  0a 0a 20 49 66 20 79 6f  |kHorse. .. If yo|
00000460  75 20 77 69 73 68 20 74  6f 20 68 61 76 65 20 79  |u wish to have y|
00000470  6f 75 72 20 73 61 76 65  72 20 69 6e 63 6c 75 64  |our saver includ|
00000480  65 64 20 77 69 74 68 69  6e 20 74 68 65 20 64 69  |ed within the di|
00000490  73 74 72 69 62 75 74 69  6f 6e 20 6f 66 0a 20 44  |stribution of. D|
000004a0  61 72 6b 48 6f 72 73 65  2c 20 70 6c 65 61 73 65  |arkHorse, please|
000004b0  20 73 65 6e 64 20 6d 65  20 61 20 63 6f 70 79 20  | send me a copy |
000004c0  6f 66 20 79 6f 75 72 20  73 61 76 65 72 20 61 6e  |of your saver an|
000004d0  64 20 49 27 6c 6c 20 62  65 20 6d 6f 72 65 20 74  |d I'll be more t|
000004e0  68 61 6e 0a 20 68 61 70  70 79 20 74 6f 20 64 6f  |han. happy to do|
000004f0  20 6a 75 73 74 20 74 68  61 74 2e 20 59 6f 75 20  | just that. You |
00000500  64 6f 6e 27 74 20 6e 65  65 64 20 74 6f 20 67 69  |don't need to gi|
00000510  76 65 20 6d 65 20 61 20  63 6f 70 79 20 6f 66 20  |ve me a copy of |
00000520  74 68 65 20 73 6f 75 72  63 65 2c 0a 20 75 6e 6c  |the source,. unl|
00000530  65 73 73 20 74 68 65 72  65 20 69 73 20 61 20 62  |ess there is a b|
00000540  75 67 20 69 6e 20 74 68  65 20 73 61 76 65 72 20  |ug in the saver |
00000550  6e 65 65 64 69 6e 67 20  61 74 74 65 6e 74 69 6f  |needing attentio|
00000560  6e 20 6f 72 20 69 66 20  79 6f 75 20 77 6f 75 6c  |n or if you woul|
00000570  64 0a 20 6a 75 73 74 20  6c 69 6b 65 20 74 6f 20  |d. just like to |
00000580  61 6e 79 77 61 79 2e 0a  0a 20 54 68 65 20 72 65  |anyway... The re|
00000590  61 73 6f 6e 20 66 6f 72  20 74 68 69 73 20 69 73  |ason for this is|
000005a0  20 74 68 61 74 20 49 20  77 6f 75 6c 64 20 6c 69  | that I would li|
000005b0  6b 65 20 74 6f 20 6b 65  65 70 20 61 20 72 65 63  |ke to keep a rec|
000005c0  6f 72 64 20 6f 66 20 65  78 61 63 74 6c 79 0a 20  |ord of exactly. |
000005d0  77 68 61 74 20 73 61 76  65 72 73 20 61 72 65 20  |what savers are |
000005e0  69 6e 63 6c 75 64 65 64  20 77 69 74 68 20 77 68  |included with wh|
000005f0  69 63 68 20 76 65 72 73  69 6f 6e 73 20 6f 66 20  |ich versions of |
00000600  44 61 72 6b 48 6f 72 73  65 2e 20 49 6e 20 74 68  |DarkHorse. In th|
00000610  69 73 0a 20 77 61 79 20  49 20 63 61 6e 20 61 6c  |is. way I can al|
00000620  73 6f 20 6d 61 6b 65 20  73 75 72 65 20 74 68 61  |so make sure tha|
00000630  74 20 44 61 72 6b 48 6f  72 73 65 20 69 73 20 66  |t DarkHorse is f|
00000640  75 6e 63 74 69 6f 6e 69  6e 67 20 70 72 6f 70 65  |unctioning prope|
00000650  72 6c 79 20 69 6e 0a 20  74 68 61 74 20 6e 6f 20  |rly in. that no |
00000660  64 61 6d 61 67 69 6e 67  20 73 61 76 65 72 73 20  |damaging savers |
00000670  61 72 65 20 62 65 69 6e  67 20 75 74 69 6c 69 73  |are being utilis|
00000680  65 64 20 62 79 20 44 61  72 6b 48 6f 72 73 65 2e  |ed by DarkHorse.|
00000690  0a 0a 20 48 6f 70 65 66  75 6c 6c 79 2c 20 61 73  |.. Hopefully, as|
000006a0  20 6d 6f 72 65 20 73 61  76 65 72 73 20 62 65 63  | more savers bec|
000006b0  6f 6d 65 20 61 76 61 69  6c 61 62 6c 65 20 2d 20  |ome available - |
000006c0  50 44 2f 73 68 61 72 65  77 61 72 65 2f 66 72 65  |PD/shareware/fre|
000006d0  65 77 61 72 65 0a 20 6c  69 62 72 61 72 69 65 73  |eware. libraries|
000006e0  20 77 69 6c 6c 20 69 73  73 75 65 20 74 68 65 20  | will issue the |
000006f0  73 61 76 65 72 73 20 6f  6e 20 74 68 65 69 72 20  |savers on their |
00000700  6f 77 6e 20 66 6f 72 20  70 65 6f 70 6c 65 20 74  |own for people t|
00000710  6f 20 70 69 63 6b 20 61  6e 64 0a 20 63 68 6f 6f  |o pick and. choo|
00000720  73 65 20 74 68 65 20 6f  6e 65 73 20 74 68 65 79  |se the ones they|
00000730  20 77 61 6e 74 20 74 6f  20 69 6e 63 6c 75 64 65  | want to include|
00000740  20 69 6e 20 74 68 65 69  72 20 70 65 72 73 6f 6e  | in their person|
00000750  61 6c 20 63 6f 70 79 20  6f 66 0a 20 44 61 72 6b  |al copy of. Dark|
00000760  48 6f 72 73 65 2e 0a 5f  5f 5f 5f 5f 5f 5f 5f 5f  |Horse.._________|
00000770  5f 5f 5f 5f 5f 5f 5f 5f  5f 5f 5f 5f 5f 5f 5f 5f  |________________|
*
000007b0  5f 5f 0a 0a 20 44 61 72  6b 48 6f 72 73 65 20 53  |__.. DarkHorse S|
000007c0  61 76 65 72 73 0a 20 7e  7e 7e 7e 7e 7e 7e 7e 7e  |avers. ~~~~~~~~~|
000007d0  7e 7e 7e 7e 7e 7e 7e 0a  20 54 68 65 20 66 6f 6c  |~~~~~~~. The fol|
000007e0  6c 6f 77 69 6e 67 20 74  65 78 74 20 64 65 73 63  |lowing text desc|
000007f0  72 69 62 65 73 20 68 6f  77 20 74 6f 20 77 72 69  |ribes how to wri|
00000800  74 65 20 79 6f 75 72 20  6f 77 6e 20 73 63 72 65  |te your own scre|
00000810  65 6e 20 73 61 76 65 72  73 20 74 6f 20 77 6f 72  |en savers to wor|
00000820  6b 0a 20 77 69 74 68 20  44 61 72 6b 48 6f 72 73  |k. with DarkHors|
00000830  65 2e 20 0a 0a 20 49 54  20 49 53 20 41 20 47 4f  |e. .. IT IS A GO|
00000840  4f 44 20 49 44 45 41 20  54 4f 20 52 45 41 44 20  |OD IDEA TO READ |
00000850  54 48 49 53 20 45 4e 54  49 52 45 20 54 45 58 54  |THIS ENTIRE TEXT|
00000860  20 41 53 20 49 54 20 50  52 4f 56 49 44 45 53 20  | AS IT PROVIDES |
00000870  55 53 45 46 55 4c 20 48  49 4e 54 53 0a 20 41 4e  |USEFUL HINTS. AN|
00000880  44 20 54 49 50 53 20 41  53 20 54 4f 20 48 4f 57  |D TIPS AS TO HOW|
00000890  20 54 4f 20 47 45 54 20  59 4f 55 52 20 4f 57 4e  | TO GET YOUR OWN|
000008a0  20 53 41 56 45 52 53 20  54 4f 20 57 4f 52 4b 2e  | SAVERS TO WORK.|
000008b0  0a 0a 20 41 6c 6c 20 74  68 65 20 44 61 72 6b 48  |.. All the DarkH|
000008c0  6f 72 73 65 20 73 63 72  65 65 6e 73 61 76 65 72  |orse screensaver|
000008d0  73 20 61 72 65 20 68 65  6c 64 20 69 6e 20 74 68  |s are held in th|
000008e0  65 20 64 69 72 65 63 74  6f 72 79 20 27 48 6f 72  |e directory 'Hor|
000008f0  73 65 73 27 20 77 69 74  68 69 6e 0a 20 74 68 65  |ses' within. the|
00000900  20 21 44 61 72 6b 48 6f  72 73 65 20 61 70 70 6c  | !DarkHorse appl|
00000910  69 63 61 74 69 6f 6e 20  64 69 72 65 63 74 6f 72  |ication director|
00000920  79 2e 20 54 68 69 73 20  6d 65 61 6e 73 20 74 68  |y. This means th|
00000930  61 74 20 74 68 65 20 6d  61 78 69 6d 75 6d 20 6e  |at the maximum n|
00000940  75 6d 62 65 72 0a 20 6f  66 20 73 61 76 65 72 73  |umber. of savers|
00000950  20 61 6c 6c 6f 77 65 64  20 69 73 20 74 68 65 20  | allowed is the |
00000960  6d 61 78 69 6d 75 6d 20  20 6e 75 6d 62 65 72 20  |maximum  number |
00000970  6f 66 20 66 69 6c 65 73  20 61 6c 6c 6f 77 65 64  |of files allowed|
00000980  20 69 6e 20 61 20 64 69  72 65 63 74 6f 72 79 0a  | in a directory.|
00000990  20 62 79 20 52 49 53 43  4f 53 2e 20 54 68 69 73  | by RISCOS. This|
000009a0  20 69 73 20 6e 6f 74 20  72 65 61 6c 6c 79 20 61  | is not really a|
000009b0  20 70 72 6f 62 6c 65 6d  20 66 6f 72 20 74 68 65  | problem for the|
000009c0  20 70 72 65 73 65 6e 74  2e 0a 0a 20 54 68 65 20  | present... The |
000009d0  73 61 76 65 72 73 20 61  72 65 20 63 6f 6d 70 6c  |savers are compl|
000009e0  65 74 65 6c 79 20 63 6f  64 65 64 20 69 6e 20 61  |etely coded in a|
000009f0  73 73 65 6d 62 6c 79 2c  20 61 6e 64 20 61 72 65  |ssembly, and are|
00000a00  20 73 74 61 6e 64 20 61  6c 6f 6e 65 20 75 6e 69  | stand alone uni|
00000a10  74 73 0a 20 77 68 69 63  68 20 61 72 65 20 65 78  |ts. which are ex|
00000a20  65 63 75 74 65 64 20 62  79 20 74 68 65 20 44 61  |ecuted by the Da|
00000a30  72 6b 48 6f 72 73 65 20  61 70 70 6c 69 63 61 74  |rkHorse applicat|
00000a40  69 6f 6e 2e 0a 0a 20 44  61 72 6b 48 6f 72 73 65  |ion... DarkHorse|
00000a50  20 73 63 72 65 65 6e 73  61 76 65 72 73 20 63 61  | screensavers ca|
00000a60  6e 20 6f 63 63 75 70 79  20 61 73 20 6d 75 63 68  |n occupy as much|
00000a70  20 6d 65 6d 6f 72 79 20  61 73 20 74 68 65 79 20  | memory as they |
00000a80  6c 69 6b 65 2e 20 44 61  72 6b 48 6f 72 73 65 0a  |like. DarkHorse.|
00000a90  20 77 69 6c 6c 20 63 6c  61 69 6d 20 74 68 65 20  | will claim the |
00000aa0  72 65 71 75 69 72 65 64  20 61 6d 6f 75 6e 74 20  |required amount |
00000ab0  66 72 6f 6d 20 74 68 65  20 52 4d 41 20 77 68 65  |from the RMA whe|
00000ac0  6e 20 69 74 20 69 73 20  6e 65 65 64 65 64 2e 20  |n it is needed. |
00000ad0  4f 6e 20 74 6f 70 20 6f  66 0a 20 74 68 69 73 20  |On top of. this |
00000ae0  79 6f 75 72 20 73 61 76  65 72 20 63 61 6e 20 63  |your saver can c|
00000af0  6c 61 69 6d 20 61 73 20  6d 75 63 68 20 6d 65 6d  |laim as much mem|
00000b00  6f 72 79 20 61 73 20 69  74 20 77 61 6e 74 73 20  |ory as it wants |
00000b10  28 6f 72 20 69 73 20 61  76 61 69 6c 61 62 6c 65  |(or is available|
00000b20  29 20 0a 20 69 6e 74 65  72 6e 61 6c 6c 79 2e 20  |) . internally. |
00000b30  49 66 20 79 6f 75 20 64  6f 20 6e 65 65 64 20 73  |If you do need s|
00000b40  6f 6d 65 20 65 78 74 72  61 20 6d 65 6d 6f 72 79  |ome extra memory|
00000b50  20 64 75 72 69 6e 67 20  72 75 6e 74 69 6d 65 2c  | during runtime,|
00000b60  20 79 6f 75 20 73 68 6f  75 6c 64 0a 20 75 73 65  | you should. use|
00000b70  20 22 4f 53 5f 4d 6f 64  75 6c 65 20 36 22 20 74  | "OS_Module 6" t|
00000b80  6f 20 63 6c 61 69 6d 20  66 72 6f 6d 20 52 4d 41  |o claim from RMA|
00000b90  20 61 6e 64 20 62 65 20  73 75 72 65 20 74 6f 20  | and be sure to |
00000ba0  66 72 65 65 20 69 74 20  75 73 69 6e 67 20 0a 20  |free it using . |
00000bb0  22 4f 53 5f 4d 6f 64 75  6c 65 20 37 22 20 77 68  |"OS_Module 7" wh|
00000bc0  65 6e 20 79 6f 75 20 65  78 69 74 20 66 72 6f 6d  |en you exit from|
00000bd0  20 74 68 65 20 73 61 76  65 72 2e 20 49 66 20 22  | the saver. If "|
00000be0  4f 53 5f 4d 6f 64 75 6c  65 20 36 22 20 66 61 69  |OS_Module 6" fai|
00000bf0  6c 73 20 2d 0a 20 69 65  2e 20 27 74 68 61 74 20  |ls -. ie. 'that |
00000c00  61 6d 6f 75 6e 74 20 6f  66 20 6d 65 6d 6f 72 79  |amount of memory|
00000c10  20 63 61 6e 6e 6f 74 20  62 65 20 63 6c 61 69 6d  | cannot be claim|
00000c20  65 64 27 2c 20 74 68 65  20 73 79 73 74 65 6d 20  |ed', the system |
00000c30  77 6f 75 6c 64 20 75 73  75 61 6c 6c 79 0a 20 72  |would usually. r|
00000c40  65 70 6f 72 74 20 61 6e  20 65 72 72 6f 72 2e 20  |eport an error. |
00000c50  48 6f 77 65 76 65 72 2c  20 44 61 72 6b 48 6f 72  |However, DarkHor|
00000c60  73 65 20 68 61 73 20 62  65 65 6e 20 77 72 69 74  |se has been writ|
00000c70  74 65 6e 20 73 75 63 68  20 74 68 61 74 20 69 66  |ten such that if|
00000c80  20 61 6e 0a 20 65 72 72  6f 72 20 6f 63 63 75 72  | an. error occur|
00000c90  73 20 66 72 6f 6d 20 77  69 74 68 69 6e 20 61 20  |s from within a |
00000ca0  73 61 76 65 72 2c 20 69  74 20 77 69 6c 6c 20 61  |saver, it will a|
00000cb0  75 74 6f 6d 61 74 69 63  61 6c 6c 79 20 63 68 61  |utomatically cha|
00000cc0  6e 67 65 20 73 61 76 65  72 27 73 0a 20 74 6f 20  |nge saver's. to |
00000cd0  27 44 61 72 6b 20 54 61  73 6b 27 20 61 6e 64 20  |'Dark Task' and |
00000ce0  75 73 65 20 74 68 61 74  20 74 6f 20 62 6c 61 6e  |use that to blan|
00000cf0  6b 2e 20 27 43 6c 61 69  6d 69 6e 67 27 20 61 6e  |k. 'Claiming' an|
00000d00  64 20 27 46 72 65 65 69  6e 67 27 20 6d 65 6d 6f  |d 'Freeing' memo|
00000d10  72 79 0a 20 77 69 6c 6c  20 75 73 75 61 6c 6c 79  |ry. will usually|
00000d20  20 62 65 20 64 6f 6e 65  20 6f 6e 20 73 61 76 65  | be done on save|
00000d30  72 20 63 6f 64 65 20 27  69 6e 69 74 69 61 6c 69  |r code 'initiali|
00000d40  73 61 74 69 6f 6e 27 20  61 6e 64 20 27 73 68 75  |sation' and 'shu|
00000d50  74 64 6f 77 6e 27 0a 20  72 65 73 70 65 63 74 69  |tdown'. respecti|
00000d60  76 65 6c 79 20 28 73 65  65 20 62 65 6c 6f 77 20  |vely (see below |
00000d70  61 62 6f 75 74 20 27 69  6e 69 74 69 61 6c 69 73  |about 'initialis|
00000d80  61 74 69 6f 6e 27 20 61  6e 64 20 27 73 68 75 74  |ation' and 'shut|
00000d90  64 6f 77 6e 27 20 63 6f  64 65 29 2e 0a 0a 20 54  |down' code)... T|
00000da0  68 65 20 66 69 6c 65 6e  61 6d 65 20 74 68 61 74  |he filename that|
00000db0  20 74 68 69 73 20 63 6f  64 65 20 69 73 20 67 69  | this code is gi|
00000dc0  76 65 6e 20 69 73 20 74  68 65 20 6e 61 6d 65 20  |ven is the name |
00000dd0  74 68 61 74 20 77 69 6c  6c 20 61 70 70 65 61 72  |that will appear|
00000de0  20 69 6e 0a 20 74 68 65  20 27 53 61 76 65 72 73  | in. the 'Savers|
00000df0  27 20 6c 69 73 74 20 77  69 74 68 69 6e 20 44 61  |' list within Da|
00000e00  72 6b 48 6f 72 73 65 2e  0a 0a 20 54 68 65 20 73  |rkHorse... The s|
00000e10  61 76 65 72 20 68 61 73  20 74 68 65 20 66 61 63  |aver has the fac|
00000e20  69 6c 69 74 79 20 74 6f  20 72 65 61 64 20 64 61  |ility to read da|
00000e30  74 61 20 67 69 76 65 6e  20 62 79 20 74 68 65 20  |ta given by the |
00000e40  75 73 65 72 20 73 6f 20  74 68 61 74 20 74 68 65  |user so that the|
00000e50  0a 20 61 63 74 75 61 6c  20 62 6c 61 6e 6b 69 6e  |. actual blankin|
00000e60  67 20 69 73 20 6d 6f 72  65 20 76 61 72 69 65 64  |g is more varied|
00000e70  2e 0a 0a 20 44 61 72 6b  48 6f 72 73 65 20 64 6f  |... DarkHorse do|
00000e80  65 73 20 6e 6f 74 20 77  6f 72 6b 20 75 6e 64 65  |es not work unde|
00000e90  72 20 69 6e 74 65 72 72  75 70 74 73 2c 20 6d 65  |r interrupts, me|
00000ea0  61 6e 69 6e 67 20 74 68  61 74 20 69 74 20 77 69  |aning that it wi|
00000eb0  6c 6c 20 6e 6f 74 20 62  65 20 61 62 6c 65 0a 20  |ll not be able. |
00000ec0  74 6f 20 73 63 72 65 65  6e 20 62 6c 61 6e 6b 20  |to screen blank |
00000ed0  69 66 20 61 6e 6f 74 68  65 72 20 74 61 73 6b 20  |if another task |
00000ee0  69 73 20 68 6f 67 67 69  6e 67 20 74 68 65 20 70  |is hogging the p|
00000ef0  72 6f 63 65 73 73 6f 72  2e 20 44 61 72 6b 48 6f  |rocessor. DarkHo|
00000f00  72 73 65 20 69 73 20 61  0a 20 52 49 53 43 4f 53  |rse is a. RISCOS|
00000f10  20 61 70 70 6c 69 63 61  74 69 6f 6e 20 77 68 69  | application whi|
00000f20  63 68 20 72 65 6c 69 65  73 20 75 70 6f 6e 20 74  |ch relies upon t|
00000f30  68 65 20 57 69 6d 70 5f  50 6f 6c 6c 20 74 6f 20  |he Wimp_Poll to |
00000f40  66 75 6e 63 74 69 6f 6e  20 70 72 6f 70 65 72 6c  |function properl|
00000f50  79 2e 0a 0a 20 43 68 61  6e 67 65 73 20 73 69 6e  |y... Changes sin|
00000f60  63 65 20 76 65 72 73 69  6f 6e 20 30 2e 39 39 20  |ce version 0.99 |
00000f70  28 75 6e 72 65 67 69 73  74 65 72 65 64 20 44 61  |(unregistered Da|
00000f80  72 6b 48 6f 72 73 65 29  0a 20 7e 7e 7e 7e 7e 7e  |rkHorse). ~~~~~~|
00000f90  7e 7e 7e 7e 7e 7e 7e 7e  7e 7e 7e 7e 7e 7e 7e 7e  |~~~~~~~~~~~~~~~~|
*
00000fb0  7e 7e 7e 7e 7e 7e 7e 7e  7e 7e 7e 7e 7e 0a 20 54  |~~~~~~~~~~~~~. T|
00000fc0  68 65 20 6e 65 77 20 66  6f 72 6d 61 74 20 72 65  |he new format re|
00000fd0  71 75 69 72 65 73 20 74  68 65 20 63 6f 64 65 72  |quires the coder|
00000fe0  20 74 6f 20 77 72 69 74  65 20 61 6e 20 65 78 74  | to write an ext|
00000ff0  72 61 20 62 6c 6f 63 6b  20 6f 66 20 63 6f 64 65  |ra block of code|
00001000  0a 20 77 68 69 63 68 20  69 73 20 66 6f 72 20 74  |. which is for t|
00001010  68 65 20 70 75 72 70 6f  73 65 20 6f 66 20 65 78  |he purpose of ex|
00001020  69 74 74 69 6e 67 20 61  6e 64 20 73 68 75 74 74  |itting and shutt|
00001030  69 6e 67 20 64 6f 77 6e  20 61 20 73 63 72 65 65  |ing down a scree|
00001040  6e 73 61 76 65 72 2e 0a  20 4d 6f 73 74 20 6f 66  |nsaver.. Most of|
00001050  20 74 68 65 20 63 75 72  72 65 6e 74 20 73 61 76  | the current sav|
00001060  65 72 73 20 68 61 76 65  20 74 68 69 73 20 62 6c  |ers have this bl|
00001070  6f 63 6b 20 65 6d 70 74  79 2c 20 61 73 20 74 68  |ock empty, as th|
00001080  65 79 20 64 6f 20 6e 6f  74 20 6e 65 65 64 0a 20  |ey do not need. |
00001090  74 6f 20 64 6f 20 61 6e  79 74 68 69 6e 67 20 6f  |to do anything o|
000010a0  6e 20 65 78 69 74 20 66  72 6f 6d 20 61 20 73 61  |n exit from a sa|
000010b0  76 65 72 2e 20 54 68 65  20 70 75 72 70 6f 73 65  |ver. The purpose|
000010c0  20 6f 66 20 74 68 65 20  27 73 68 75 74 64 6f 77  | of the 'shutdow|
000010d0  6e 27 20 63 6f 64 65 0a  20 69 73 20 74 6f 20 61  |n' code. is to a|
000010e0  6c 6c 6f 77 20 74 68 65  20 73 61 76 65 72 20 74  |llow the saver t|
000010f0  6f 20 66 72 65 65 20 61  6e 79 20 63 68 75 6e 6b  |o free any chunk|
00001100  73 20 6f 66 20 6d 65 6d  6f 72 79 20 69 74 20 6d  |s of memory it m|
00001110  61 79 20 68 61 76 65 20  63 6c 61 69 6d 65 64 0a  |ay have claimed.|
00001120  20 61 73 20 68 65 61 70  2f 52 4d 41 20 65 74 63  | as heap/RMA etc|
00001130  2e 20 6f 72 20 70 65 72  68 61 70 73 20 74 68 65  |. or perhaps the|
00001140  20 73 61 76 65 72 20 6e  65 65 64 73 20 74 6f 20  | saver needs to |
00001150  73 65 74 20 73 6f 6d 65  20 63 72 75 63 69 61 6c  |set some crucial|
00001160  0a 20 76 61 72 69 61 62  6c 65 73 2e 20 54 68 69  |. variables. Thi|
00001170  73 20 61 64 64 69 74 69  6f 6e 20 68 61 73 20 63  |s addition has c|
00001180  61 75 73 65 64 20 61 20  6d 69 6e 6f 72 20 63 68  |aused a minor ch|
00001190  61 6e 67 65 20 74 6f 20  6f 66 66 73 65 74 73 20  |ange to offsets |
000011a0  61 74 20 77 68 69 63 68  0a 20 79 6f 75 72 20 63  |at which. your c|
000011b0  6f 64 65 20 69 73 20 61  73 73 65 6d 62 6c 65 64  |ode is assembled|
000011c0  20 61 74 2e 0a 20 0a 20  54 68 65 20 6f 74 68 65  | at.. . The othe|
000011d0  72 20 63 68 61 6e 67 65  20 69 73 20 73 75 63 68  |r change is such|
000011e0  20 74 68 61 74 20 6f 6e  20 65 76 65 72 79 20 63  | that on every c|
000011f0  61 6c 6c 20 74 6f 20 79  6f 75 72 20 27 70 6f 6c  |all to your 'pol|
00001200  6c 69 6e 67 27 20 63 6f  64 65 2c 0a 20 44 61 72  |ling' code,. Dar|
00001210  6b 48 6f 72 73 65 20 77  69 6c 6c 20 73 65 74 20  |kHorse will set |
00001220  74 68 65 20 72 65 67 69  73 74 65 72 73 20 72 32  |the registers r2|
00001230  20 61 6e 64 20 72 33 20  74 6f 20 63 6f 6e 74 61  | and r3 to conta|
00001240  69 6e 20 61 20 47 43 4f  4c 20 61 6e 64 20 54 49  |in a GCOL and TI|
00001250  4e 54 0a 20 76 61 6c 75  65 73 20 72 65 73 70 65  |NT. values respe|
00001260  63 74 69 76 65 6c 79 2c  20 77 68 69 63 68 20 77  |ctively, which w|
00001270  69 6c 6c 20 62 65 20 69  6e 63 72 65 6d 65 6e 74  |ill be increment|
00001280  65 64 20 6f 6e 20 65 76  65 72 79 20 70 6f 6c 6c  |ed on every poll|
00001290  69 6e 67 20 63 6f 64 65  0a 20 63 61 6c 6c 20 63  |ing code. call c|
000012a0  6f 72 72 65 63 74 6c 79  20 61 63 63 6f 72 64 69  |orrectly accordi|
000012b0  6e 67 20 74 6f 20 74 68  65 20 63 75 72 72 65 6e  |ng to the curren|
000012c0  74 20 73 63 72 65 65 6e  6d 6f 64 65 2e 20 54 68  |t screenmode. Th|
000012d0  65 73 65 20 76 61 6c 75  65 73 20 63 61 6e 20 62  |ese values can b|
000012e0  65 0a 20 75 73 65 64 20  64 69 72 65 63 74 79 20  |e. used directy |
000012f0  74 6f 20 73 65 74 20 74  68 65 20 6e 65 78 74 20  |to set the next |
00001300  47 43 4f 4c 20 61 6e 64  20 54 49 4e 54 20 63 6f  |GCOL and TINT co|
00001310  6c 6f 75 72 73 2e 0a 20  0a 20 46 69 6e 61 6c 6c  |lours.. . Finall|
00001320  79 20 73 6f 6d 65 20 74  69 64 79 69 6e 67 20 75  |y some tidying u|
00001330  70 20 68 61 73 20 62 65  65 6e 20 64 6f 6e 65 20  |p has been done |
00001340  73 75 63 68 20 74 68 61  74 20 74 68 65 20 73 61  |such that the sa|
00001350  76 65 72 20 66 6f 72 6d  61 74 20 69 73 0a 20 6d  |ver format is. m|
00001360  6f 72 65 20 65 66 66 69  63 69 65 6e 74 2e 0a 20  |ore efficient.. |
00001370  0a 20 54 68 65 20 66 6f  6c 6c 6f 77 69 6e 67 20  |. The following |
00001380  69 73 20 74 68 65 20 63  6f 6d 70 6c 65 74 65 20  |is the complete |
00001390  6e 65 77 20 66 69 6c 65  66 6f 72 6d 61 74 20 3a  |new fileformat :|
000013a0  0a 0a 20 54 68 65 20 53  61 76 65 72 20 46 69 6c  |.. The Saver Fil|
000013b0  65 46 6f 72 6d 61 74 0a  20 7e 7e 7e 7e 7e 7e 7e  |eFormat. ~~~~~~~|
000013c0  7e 7e 7e 7e 7e 7e 7e 7e  7e 7e 7e 7e 7e 0a 20 44  |~~~~~~~~~~~~~. D|
000013d0  61 72 6b 48 6f 72 73 65  20 73 63 72 65 65 6e 73  |arkHorse screens|
000013e0  61 76 65 72 73 20 63 6f  6e 73 69 73 74 20 6f 66  |avers consist of|
000013f0  20 66 6f 75 72 20 6d 61  69 6e 20 73 65 63 74 69  | four main secti|
00001400  6f 6e 73 20 3a 0a 0a 20  2e 20 54 68 65 20 68 65  |ons :.. . The he|
00001410  61 64 65 72 20 2d 20 0a  20 20 20 20 20 20 20 20  |ader - .        |
00001420  20 20 20 20 20 20 20 20  54 68 69 73 20 64 61 74  |        This dat|
00001430  61 20 66 6f 72 6d 61 74  20 61 6c 6c 6f 77 73 20  |a format allows |
00001440  6b 6e 6f 77 6e 20 64 61  74 61 20 74 6f 20 62 65  |known data to be|
00001450  20 66 6f 75 6e 64 20 61  74 20 6b 6e 6f 77 6e 0a  | found at known.|
00001460  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001470  61 64 64 72 65 73 73 65  73 2c 20 73 65 65 20 74  |addresses, see t|
00001480  68 65 20 66 6f 72 6d 61  74 20 62 65 6c 6f 77 2e  |he format below.|
00001490  0a 0a 20 2e 20 54 68 65  20 69 6e 69 74 69 61 6c  |.. . The initial|
000014a0  69 73 61 74 69 6f 6e 20  63 6f 64 65 20 2d 20 0a  |isation code - .|
000014b0  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
000014c0  20 57 68 65 6e 20 44 61  72 6b 48 6f 72 73 65 20  | When DarkHorse |
000014d0  69 73 20 74 6f 20 73 74  61 72 74 20 73 63 72 65  |is to start scre|
000014e0  65 6e 62 6c 61 6e 6b 69  6e 67 20 75 73 69 6e 67  |enblanking using|
000014f0  20 79 6f 75 72 20 63 6f  64 65 2c 0a 20 20 20 20  | your code,.    |
00001500  20 20 20 20 20 20 20 20  20 20 20 20 69 74 20 77  |            it w|
00001510  69 6c 6c 20 66 69 72 73  74 20 63 61 6c 6c 20 61  |ill first call a|
00001520  20 73 65 63 74 69 6f 6e  20 6f 66 20 79 6f 75 72  | section of your|
00001530  20 63 6f 64 65 20 77 68  69 63 68 20 61 6c 6c 6f  | code which allo|
00001540  77 73 20 61 6e 79 0a 20  20 20 20 20 20 20 20 20  |ws any.         |
00001550  20 20 20 20 20 20 20 69  6e 69 74 69 61 6c 20 64  |       initial d|
00001560  65 63 6c 61 72 61 74 69  6f 6e 73 2f 73 65 74 75  |eclarations/setu|
00001570  70 73 20 28 69 65 20 63  6c 61 69 6d 69 6e 67 20  |ps (ie claiming |
00001580  6d 65 6d 6f 72 79 29 0a  20 20 20 20 20 20 20 20  |memory).        |
00001590  20 20 20 20 20 20 20 20  74 6f 20 62 65 20 6d 61  |        to be ma|
000015a0  64 65 2e 20 54 68 69 73  20 77 69 6c 6c 20 6f 6e  |de. This will on|
000015b0  6c 79 20 62 65 20 63 61  6c 6c 65 64 20 6f 6e 63  |ly be called onc|
000015c0  65 2c 20 61 66 74 65 72  20 77 68 69 63 68 20 74  |e, after which t|
000015d0  68 65 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |he.             |
000015e0  20 20 20 27 70 6f 6c 6c  69 6e 67 20 63 6f 64 65  |   'polling code|
000015f0  27 20 77 69 6c 6c 20 62  65 20 63 61 6c 6c 65 64  |' will be called|
00001600  20 72 65 70 65 61 74 65  64 6c 79 2c 20 75 6e 74  | repeatedly, unt|
00001610  69 6c 20 65 78 69 74 20  66 72 6f 6d 0a 20 20 20  |il exit from.   |
00001620  20 20 20 20 20 20 20 20  20 20 20 20 20 74 68 65  |             the|
00001630  20 73 61 76 65 72 2e 20  54 68 69 73 20 63 61 6c  | saver. This cal|
00001640  6c 20 77 69 6c 6c 20 62  65 20 6d 61 64 65 20 61  |l will be made a|
00001650  74 20 61 6e 20 6f 66 66  73 65 74 20 6f 66 20 31  |t an offset of 1|
00001660  30 30 20 62 79 74 65 73  0a 20 20 20 20 20 20 20  |00 bytes.       |
00001670  20 20 20 20 20 20 20 20  20 72 65 6c 61 74 69 76  |         relativ|
00001680  65 20 74 6f 20 74 68 65  20 73 74 61 72 74 20 6f  |e to the start o|
00001690  66 20 79 6f 75 72 20 63  6f 64 65 2c 20 69 65 20  |f your code, ie |
000016a0  69 66 20 79 6f 75 72 20  63 6f 64 65 20 69 73 0a  |if your code is.|
000016b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000016c0  61 73 73 65 6d 62 6c 65  64 20 61 74 20 63 6f 64  |assembled at cod|
000016d0  65 25 2c 20 74 68 65 20  69 6e 69 74 69 61 6c 69  |e%, the initiali|
000016e0  73 61 74 69 6f 6e 20 69  73 20 63 61 6c 6c 65 64  |sation is called|
000016f0  20 61 74 20 0a 20 20 20  20 20 20 20 20 20 20 20  | at .           |
00001700  20 20 20 20 20 63 6f 64  65 25 2b 31 30 30 2e 20  |     code%+100. |
00001710  54 68 65 20 68 65 61 64  65 72 20 64 65 73 63 72  |The header descr|
00001720  69 62 65 64 20 62 65 6c  6f 77 2c 20 65 78 70 6c  |ibed below, expl|
00001730  61 69 6e 73 20 68 6f 77  20 74 6f 0a 20 20 20 20  |ains how to.    |
00001740  20 20 20 20 20 20 20 20  20 20 20 20 69 6d 70 6c  |            impl|
00001750  65 6d 65 6e 74 20 74 68  69 73 2e 0a 20 20 20 20  |ement this..    |
00001760  20 20 20 20 20 20 20 20  20 20 20 20 0a 20 2e 20  |            . . |
00001770  54 68 65 20 73 68 75 74  64 6f 77 6e 20 63 6f 64  |The shutdown cod|
00001780  65 20 2d 0a 20 0a 20 20  20 20 20 20 20 20 20 20  |e -. .          |
00001790  20 20 20 20 20 20 54 68  69 73 20 73 65 63 74 69  |      This secti|
000017a0  6f 6e 20 6f 66 20 63 6f  64 65 20 69 73 20 63 61  |on of code is ca|
000017b0  6c 6c 65 64 20 77 68 65  6e 20 44 61 72 6b 48 6f  |lled when DarkHo|
000017c0  72 73 65 20 68 61 73 20  6e 6f 74 69 63 65 64 0a  |rse has noticed.|
000017d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000017e0  61 20 6d 6f 75 73 65 20  6d 6f 76 65 6d 65 6e 74  |a mouse movement|
000017f0  20 6f 72 20 6b 65 79 70  72 65 73 73 20 64 75 72  | or keypress dur|
00001800  69 6e 67 20 73 63 72 65  65 6e 20 62 6c 61 6e 6b  |ing screen blank|
00001810  69 6e 67 20 61 6e 64 0a  20 20 20 20 20 20 20 20  |ing and.        |
00001820  20 20 20 20 20 20 20 20  74 68 75 73 20 69 73 20  |        thus is |
00001830  72 65 74 75 72 6e 69 6e  67 20 64 65 73 6b 74 6f  |returning deskto|
00001840  70 20 63 6f 6e 74 72 6f  6c 20 74 6f 20 74 68 65  |p control to the|
00001850  20 75 73 65 72 2e 20 46  6f 72 20 6d 6f 73 74 0a  | user. For most.|
00001860  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001870  73 61 76 65 72 73 20 74  68 69 73 20 73 68 75 74  |savers this shut|
00001880  64 6f 77 6e 20 63 6f 64  65 20 77 69 6c 6c 20 62  |down code will b|
00001890  65 20 65 6d 70 74 79 2e  20 48 6f 77 65 76 65 72  |e empty. However|
000018a0  2c 20 69 74 20 77 69 6c  6c 0a 20 20 20 20 20 20  |, it will.      |
000018b0  20 20 20 20 20 20 20 20  20 20 63 6f 6d 65 20 69  |          come i|
000018c0  6e 20 75 73 65 20 69 66  20 79 6f 75 72 20 73 61  |n use if your sa|
000018d0  76 65 72 20 68 61 64 20  63 6c 61 69 6d 65 64 20  |ver had claimed |
000018e0  6d 65 6d 6f 72 79 20 77  68 69 63 68 20 72 65 71  |memory which req|
000018f0  75 69 72 65 73 0a 20 20  20 20 20 20 20 20 20 20  |uires.          |
00001900  20 20 20 20 20 20 66 72  65 65 69 6e 67 2c 20 6f  |      freeing, o|
00001910  72 20 69 66 20 79 6f 75  20 77 69 73 68 20 74 6f  |r if you wish to|
00001920  20 73 65 74 2f 72 65 73  65 74 20 73 6f 6d 65 20  | set/reset some |
00001930  76 61 72 69 61 62 6c 65  73 20 65 74 63 2e 0a 20  |variables etc.. |
00001940  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 0a  |               .|
00001950  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001960  54 68 65 20 63 61 6c 6c  20 77 69 6c 6c 20 62 65  |The call will be|
00001970  20 6d 61 64 65 20 61 74  20 61 6e 20 6f 66 66 73  | made at an offs|
00001980  65 74 20 6f 66 20 31 30  34 20 62 79 74 65 73 20  |et of 104 bytes |
00001990  72 65 6c 61 74 69 76 65  20 74 6f 0a 20 20 20 20  |relative to.    |
000019a0  20 20 20 20 20 20 20 20  20 20 20 20 74 68 65 20  |            the |
000019b0  73 74 61 72 74 20 6f 66  20 79 6f 75 74 20 63 6f  |start of yout co|
000019c0  64 65 2c 20 69 65 20 69  66 20 79 6f 75 72 20 63  |de, ie if your c|
000019d0  6f 64 65 20 69 73 20 61  73 73 65 6d 62 6c 65 64  |ode is assembled|
000019e0  20 61 74 0a 20 20 20 20  20 20 20 20 20 20 20 20  | at.            |
000019f0  20 20 20 20 63 6f 64 65  25 2c 20 74 68 65 20 73  |    code%, the s|
00001a00  68 75 74 64 6f 77 6e 20  63 6f 64 65 20 69 73 20  |hutdown code is |
00001a10  63 61 6c 6c 65 64 20 61  74 20 63 6f 64 65 25 2b  |called at code%+|
00001a20  31 30 34 2e 20 54 68 65  20 68 65 61 64 65 72 0a  |104. The header.|
00001a30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001a40  64 65 73 63 72 69 62 65  64 20 62 65 6c 6f 77 2c  |described below,|
00001a50  20 65 78 70 6c 61 69 6e  73 20 68 6f 77 20 74 6f  | explains how to|
00001a60  20 69 6d 70 6c 65 6d 65  6e 74 20 74 68 69 73 2e  | implement this.|
00001a70  0a 0a 20 2e 20 54 68 65  20 70 6f 6c 6c 69 6e 67  |.. . The polling|
00001a80  20 63 6f 64 65 20 2d 0a  20 20 20 20 20 20 20 20  | code -.        |
00001a90  20 20 20 20 20 20 20 20  0a 20 20 20 20 20 20 20  |        .       |
00001aa0  20 20 20 20 20 20 20 20  20 41 66 74 65 72 20 63  |         After c|
00001ab0  61 6c 6c 69 6e 67 20 74  68 65 20 69 6e 69 74 69  |alling the initi|
00001ac0  61 6c 69 73 61 74 69 6f  6e 20 63 6f 64 65 2c 20  |alisation code, |
00001ad0  74 68 65 20 73 61 76 65  72 20 72 65 70 65 61 74  |the saver repeat|
00001ae0  65 64 6c 79 0a 20 20 20  20 20 20 20 20 20 20 20  |edly.           |
00001af0  20 20 20 20 20 63 61 6c  6c 73 20 74 68 69 73 20  |     calls this |
00001b00  27 70 6f 6c 6c 69 6e 67  20 63 6f 64 65 27 20 77  |'polling code' w|
00001b10  68 69 63 68 20 73 68 6f  75 6c 64 20 70 65 72 66  |hich should perf|
00001b20  6f 72 6d 20 61 20 73 69  6e 67 6c 65 0a 20 20 20  |orm a single.   |
00001b30  20 20 20 20 20 20 20 20  20 20 20 20 20 69 74 65  |             ite|
00001b40  72 61 74 69 6f 6e 2c 20  70 72 65 73 65 72 76 65  |ration, preserve|
00001b50  20 61 6e 79 20 69 6e 74  65 72 6e 61 6c 20 76 61  | any internal va|
00001b60  72 69 61 62 6c 65 73 20  61 6e 64 20 65 78 69 74  |riables and exit|
00001b70  2e 20 54 68 69 73 0a 20  20 20 20 20 20 20 20 20  |. This.         |
00001b80  20 20 20 20 20 20 20 6f  62 76 69 6f 75 73 6c 79  |       obviously|
00001b90  20 61 6c 6c 6f 77 73 20  44 61 72 6b 48 6f 72 73  | allows DarkHors|
00001ba0  65 20 74 6f 20 6d 75 6c  74 69 74 61 73 6b 2e 20  |e to multitask. |
00001bb0  54 68 65 20 61 63 74 75  61 6c 20 63 6f 64 65 0a  |The actual code.|
00001bc0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001bd0  66 6f 72 20 70 6f 6c 6c  69 6e 67 20 73 68 6f 75  |for polling shou|
00001be0  6c 64 20 73 74 61 72 74  20 61 74 20 61 6e 20 6f  |ld start at an o|
00001bf0  66 66 73 65 74 20 6f 66  20 31 30 38 20 62 79 74  |ffset of 108 byt|
00001c00  65 73 20 72 65 6c 61 74  69 76 65 0a 20 20 20 20  |es relative.    |
00001c10  20 20 20 20 20 20 20 20  20 20 20 20 74 6f 20 74  |            to t|
00001c20  68 65 20 73 74 61 72 74  20 6f 66 20 79 6f 75 72  |he start of your|
00001c30  20 63 6f 64 65 2c 20 69  65 20 69 66 20 79 6f 75  | code, ie if you|
00001c40  72 20 63 6f 64 65 20 69  73 20 61 73 73 65 6d 62  |r code is assemb|
00001c50  6c 65 64 20 61 74 0a 20  20 20 20 20 20 20 20 20  |led at.         |
00001c60  20 20 20 20 20 20 20 63  6f 64 65 25 2c 20 74 68  |       code%, th|
00001c70  65 20 70 6f 6c 6c 69 6e  67 20 63 6f 64 65 20 69  |e polling code i|
00001c80  73 20 63 61 6c 6c 65 64  20 61 74 20 63 6f 64 65  |s called at code|
00001c90  25 2b 31 30 38 2e 20 54  68 65 20 68 65 61 64 65  |%+108. The heade|
00001ca0  72 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r.              |
00001cb0  20 20 64 65 73 63 72 69  62 65 64 20 62 65 6c 6f  |  described belo|
00001cc0  77 2c 20 65 78 70 6c 61  69 6e 73 20 61 20 6c 69  |w, explains a li|
00001cd0  74 74 6c 65 20 6d 6f 72  65 2e 0a 0a 0a 20 54 68  |ttle more.... Th|
00001ce0  65 20 73 63 72 65 65 6e  73 61 76 65 72 20 68 65  |e screensaver he|
00001cf0  61 64 65 72 20 3a 0a 0a  20 62 79 74 65 73 20 28  |ader :.. bytes (|
00001d00  30 2d 33 29 20 31 20 77  6f 72 64 20 20 20 20 20  |0-3) 1 word     |
00001d10  20 20 3a 20 69 6e 64 69  63 61 74 65 73 20 74 68  |  : indicates th|
00001d20  65 20 6e 75 6d 62 65 72  20 61 6e 64 20 74 79 70  |e number and typ|
00001d30  65 20 6f 66 20 61 72 67  75 6d 65 6e 74 20 74 68  |e of argument th|
00001d40  61 74 0a 20 77 6f 72 64  20 20 28 30 20 20 29 20  |at. word  (0  ) |
00001d50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 74  |               t|
00001d60  68 65 20 73 61 76 65 72  20 77 69 6c 6c 20 74 61  |he saver will ta|
00001d70  6b 65 2c 20 61 6e 64 20  69 6e 64 69 63 61 74 65  |ke, and indicate|
00001d80  73 20 77 68 65 74 68 65  72 20 74 68 65 0a 20 20  |s whether the.  |
00001d90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001da0  20 20 20 20 20 20 20 20  20 20 73 61 76 65 72 20  |          saver |
00001db0  72 65 71 75 69 72 65 73  20 74 68 65 20 44 61 72  |requires the Dar|
00001dc0  6b 48 6f 72 73 65 20 61  70 70 6c 69 63 61 74 69  |kHorse applicati|
00001dd0  6f 6e 20 74 6f 20 0a 20  20 20 20 20 20 20 20 20  |on to .         |
00001de0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001df0  20 20 20 63 6c 65 61 72  20 74 68 65 20 73 63 72  |   clear the scr|
00001e00  65 65 6e 20 74 6f 20 62  6c 61 63 6b 20 6f 72 20  |een to black or |
00001e10  6e 6f 74 20 62 65 66 6f  72 65 20 65 6e 74 65 72  |not before enter|
00001e20  69 6e 67 0a 20 20 20 20  20 20 20 20 20 20 20 20  |ing.            |
00001e30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001e40  74 68 65 20 73 61 76 65  72 2e 0a 0a 20 20 20 20  |the saver...    |
00001e50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001e60  20 20 20 20 20 20 20 20  53 65 74 20 74 68 69 73  |        Set this|
00001e70  20 66 69 72 73 74 20 77  6f 72 64 20 74 6f 20 3a  | first word to :|
00001e80  0a 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |..              |
00001e90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001ea0  20 20 20 20 20 20 20 20  20 20 20 20 30 20 20 3d  |            0  =|
00001eb0  20 6e 6f 20 70 61 72 61  6d 65 74 65 72 73 0a 20  | no parameters. |
00001ec0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00001ee0  20 20 20 20 20 20 20 20  31 30 20 20 3d 20 6f 6e  |        10  = on|
00001ef0  65 20 6c 6f 6e 67 20 73  74 72 69 6e 67 0a 20 20  |e long string.  |
00001f00  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001f10  20 20 20 20 20 20 20 20  20 20 31 2c 32 2c 33 2c  |          1,2,3,|
00001f20  34 2c 35 2c 36 2c 37 2c  38 20 20 3d 20 6e 75 6d  |4,5,6,7,8  = num|
00001f30  62 65 72 20 6f 66 20 69  6e 74 65 67 65 72 20 70  |ber of integer p|
00001f40  61 72 61 6d 65 74 65 72  73 20 0a 20 20 20 20 20  |arameters .     |
00001f50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001f60  20 20 20 20 20 20 20 20  61 73 20 61 62 6f 76 65  |        as above|
00001f70  20 2b 20 32 35 35 20 20  3d 20 61 73 20 61 62 6f  | + 255  = as abo|
00001f80  76 65 20 62 75 74 20 64  6f 6e 27 74 20 62 6c 61  |ve but don't bla|
00001f90  63 6b 20 74 68 65 0a 20  20 20 20 20 20 20 20 20  |ck the.         |
00001fa0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00001fc0  20 20 20 20 20 20 73 63  72 65 65 6e 20 6f 6e 20  |      screen on |
00001fd0  65 6e 74 72 79 2e 0a 0a  20 20 20 20 20 20 20 20  |entry...        |
00001fe0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001ff0  20 20 20 20 54 68 69 73  20 77 6f 72 64 20 69 73  |    This word is|
00002000  20 75 73 65 64 20 74 6f  20 62 79 20 44 61 72 6b  | used to by Dark|
00002010  48 6f 72 73 65 20 74 6f  20 63 68 65 63 6b 20 69  |Horse to check i|
00002020  66 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |f.              |
00002030  20 20 20 20 20 20 20 20  20 20 20 20 20 20 74 68  |              th|
00002040  65 20 61 72 67 75 6d 65  6e 74 20 69 6e 70 75 74  |e argument input|
00002050  20 67 69 76 65 6e 20 62  79 20 74 68 65 20 75 73  | given by the us|
00002060  65 72 20 69 73 20 76 61  6c 69 64 2e 0a 20 20 20  |er is valid..   |
00002070  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002080  20 20 20 20 20 20 20 20  20 49 66 20 61 6e 20 69  |         If an i|
00002090  6e 76 61 6c 69 64 20 69  6e 70 75 74 20 69 73 20  |nvalid input is |
000020a0  67 69 76 65 6e 2c 20 74  68 65 20 73 61 76 65 72  |given, the saver|
000020b0  20 77 69 6c 6c 20 0a 20  20 20 20 20 20 20 20 20  | will .         |
000020c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000020d0  20 20 20 75 73 65 20 74  68 65 20 64 65 66 61 75  |   use the defau|
000020e0  6c 74 20 76 61 6c 75 65  28 73 29 20 28 73 65 65  |lt value(s) (see|
000020f0  20 62 65 6c 6f 77 29 2e  0a 0a 20 20 20 20 20 20  | below)...      |
00002100  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002110  20 20 20 20 20 20 49 66  20 74 68 65 20 73 63 72  |      If the scr|
00002120  65 65 6e 20 69 73 20 74  6f 20 62 65 20 62 6c 61  |een is to be bla|
00002130  63 6b 65 64 20 2d 20 69  65 20 72 65 6d 6f 76 69  |cked - ie removi|
00002140  6e 67 20 74 68 65 0a 20  20 20 20 20 20 20 20 20  |ng the.         |
00002150  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002160  20 20 20 64 65 73 6b 74  6f 70 20 69 6d 61 67 65  |   desktop image|
00002170  20 2d 20 74 68 65 20 70  61 6c 65 74 74 65 20 77  | - the palette w|
00002180  69 6c 6c 20 62 65 20 73  65 74 20 74 6f 20 61 20  |ill be set to a |
00002190  6d 6f 72 65 0a 20 20 20  20 20 20 20 20 20 20 20  |more.           |
000021a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000021b0  20 70 6c 65 61 73 65 6e  74 20 72 61 6e 67 65 2e  | pleasent range.|
000021c0  0a 0a 20 62 79 74 65 73  20 28 34 2d 33 35 29 20  |.. bytes (4-35) |
000021d0  38 20 77 6f 72 64 73 20  20 20 20 3a 20 20 54 68  |8 words    :  Th|
000021e0  65 20 38 20 77 6f 72 64  73 20 68 65 72 65 20 73  |e 8 words here s|
000021f0  68 6f 75 6c 64 20 63 6f  6e 74 61 69 6e 20 74 68  |hould contain th|
00002200  65 20 64 65 66 61 75 6c  74 20 0a 20 77 6f 72 64  |e default . word|
00002210  73 20 28 31 2d 38 29 20  20 20 20 20 20 20 20 20  |s (1-8)         |
00002220  20 20 20 20 20 20 20 76  61 6c 75 65 28 73 29 20  |       value(s) |
00002230  6f 66 20 74 68 65 20 61  72 67 75 6d 65 6e 74 20  |of the argument |
00002240  73 6f 20 74 68 61 74 20  44 61 72 6b 48 6f 72 73  |so that DarkHors|
00002250  65 20 77 69 6c 6c 0a 20  20 20 20 20 20 20 20 20  |e will.         |
00002260  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002270  20 20 20 6b 6e 6f 77 20  77 68 61 74 20 74 6f 20  |   know what to |
00002280  73 65 74 20 74 68 65 20  69 6e 70 75 74 20 6f 66  |set the input of|
00002290  20 61 20 6e 65 77 20 73  61 76 65 72 20 61 6e 64  | a new saver and|
000022a0  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
000022b0  20 20 20 20 20 20 20 20  20 20 20 20 20 62 65 20  |             be |
000022c0  61 62 6c 65 20 74 6f 20  72 65 66 65 72 20 74 6f  |able to refer to|
000022d0  20 74 68 65 6d 20 77 68  65 6e 20 61 6e 20 69 6e  | them when an in|
000022e0  76 61 6c 69 64 0a 20 20  20 20 20 20 20 20 20 20  |valid.          |
000022f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002300  20 20 61 72 67 75 6d 65  6e 74 20 68 61 73 20 62  |  argument has b|
00002310  65 65 6e 20 67 69 76 65  6e 20 62 79 20 74 68 65  |een given by the|
00002320  20 75 73 65 72 2e 20 0a  0a 20 20 20 20 20 20 20  | user. ..       |
00002330  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002340  20 20 20 20 20 54 68 65  73 65 20 38 20 77 6f 72  |     These 8 wor|
00002350  64 73 20 61 72 65 20 61  6c 73 6f 20 74 68 65 20  |ds are also the |
00002360  64 61 74 61 20 77 68 69  63 68 20 61 72 65 20 74  |data which are t|
00002370  68 65 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |he.             |
00002380  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 70  |               p|
00002390  61 72 61 6d 65 74 65 72  73 20 70 61 73 73 65 64  |arameters passed|
000023a0  20 69 6e 20 62 79 20 74  68 65 20 75 73 65 72 2e  | in by the user.|
000023b0  20 44 61 72 6b 48 6f 72  73 65 20 0a 20 20 20 20  | DarkHorse .    |
000023c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000023d0  20 20 20 20 20 20 20 20  61 63 74 75 61 6c 6c 79  |        actually|
000023e0  20 77 72 69 74 65 73 20  74 68 65 20 70 61 72 61  | writes the para|
000023f0  6d 65 74 65 72 73 20 74  6f 20 74 68 69 73 0a 20  |meters to this. |
00002400  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002410  20 20 20 20 20 20 20 20  20 20 20 6c 6f 63 61 74  |           locat|
00002420  69 6f 6e 2c 20 74 68 65  6e 20 79 6f 75 72 20 63  |ion, then your c|
00002430  6f 64 65 20 77 69 6c 6c  20 72 65 61 64 20 74 68  |ode will read th|
00002440  65 6d 20 66 72 6f 6d 0a  20 20 20 20 20 20 20 20  |em from.        |
00002450  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002460  20 20 20 20 68 65 72 65  2e 0a 0a 20 62 79 74 65  |    here... byte|
00002470  73 20 28 33 36 2d 39 39  29 20 31 36 20 77 6f 72  |s (36-99) 16 wor|
00002480  64 73 20 20 20 3a 20 54  68 65 73 65 20 77 6f 72  |ds   : These wor|
00002490  64 73 20 61 72 65 20 75  73 65 64 20 74 6f 20 73  |ds are used to s|
000024a0  74 6f 72 65 20 74 68 65  20 61 72 67 75 6d 65 6e  |tore the argumen|
000024b0  74 20 68 65 6c 70 0a 20  77 6f 72 64 73 20 28 39  |t help. words (9|
000024c0  2d 32 34 29 20 20 20 20  20 20 20 20 20 20 20 20  |-24)            |
000024d0  20 20 20 77 68 69 63 68  20 77 69 6c 6c 20 62 65  |   which will be|
000024e0  20 64 69 73 70 6c 61 79  65 64 20 74 6f 20 74 68  | displayed to th|
000024f0  65 20 75 73 65 72 20 6f  6e 20 74 77 6f 20 72 6f  |e user on two ro|
00002500  77 73 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |ws.             |
00002510  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 6f  |               o|
00002520  66 20 33 32 20 62 79 74  65 73 20 65 61 63 68 2e  |f 32 bytes each.|
00002530  20 55 73 75 61 6c 6c 79  20 74 68 69 73 20 68 65  | Usually this he|
00002540  6c 70 20 77 69 6c 6c 20  0a 20 20 20 20 20 20 20  |lp will .       |
00002550  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002560  20 20 20 20 20 64 65 73  63 72 69 62 65 20 74 68  |     describe th|
00002570  65 20 61 72 67 75 6d 65  6e 74 20 72 65 71 75 69  |e argument requi|
00002580  72 65 64 20 62 79 20 74  68 69 73 20 73 61 76 65  |red by this save|
00002590  72 2e 0a 0a 20 62 79 74  65 73 20 28 31 30 30 2d  |r... bytes (100-|
000025a0  31 30 33 29 20 31 20 77  6f 72 64 20 20 20 3a 20  |103) 1 word   : |
000025b0  42 20 69 6e 69 74 20 3b  20 4a 75 6d 70 73 20 74  |B init ; Jumps t|
000025c0  6f 20 74 68 65 20 69 6e  69 74 20 72 6f 75 74 69  |o the init routi|
000025d0  6e 65 2e 0a 0a 20 20 20  20 20 20 20 20 20 20 20  |ne...           |
000025e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000025f0  20 59 6f 75 20 77 69 6c  6c 20 6e 65 65 64 20 74  | You will need t|
00002600  6f 20 77 72 69 74 65 20  74 68 65 20 61 63 74 75  |o write the actu|
00002610  61 6c 20 69 6e 69 74 69  61 6c 69 73 61 74 69 6f  |al initialisatio|
00002620  6e 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |n.              |
00002630  20 20 20 20 20 20 20 20  20 20 20 20 20 20 63 6f  |              co|
00002640  64 65 20 61 74 20 61 20  66 75 72 74 68 65 72 20  |de at a further |
00002650  6c 6f 63 61 74 69 6f 6e  2c 20 61 6e 64 20 6a 75  |location, and ju|
00002660  6d 70 20 74 6f 20 69 74  20 66 72 6f 6d 0a 20 20  |mp to it from.  |
00002670  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002680  20 20 20 20 20 20 20 20  20 20 68 65 72 65 2c 20  |          here, |
00002690  75 73 69 6e 67 20 61 20  62 72 61 6e 63 68 20 69  |using a branch i|
000026a0  6e 73 74 72 75 63 74 69  6f 6e 20 61 73 20 73 68  |nstruction as sh|
000026b0  6f 77 6e 2e 0a 20 20 20  20 20 20 20 20 20 20 20  |own..           |
000026c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000026d0  20 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  | .              |
000026e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 44 61  |              Da|
000026f0  72 6b 48 6f 72 73 65 20  63 61 6c 6c 73 20 74 68  |rkHorse calls th|
00002700  69 73 20 6c 6f 63 61 74  69 6f 6e 20 66 6f 72 20  |is location for |
00002710  69 6e 69 74 69 61 6c 69  73 61 74 69 6f 6e 2c 0a  |initialisation,.|
00002720  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002730  20 20 20 20 20 20 20 20  20 20 20 20 69 65 20 43  |            ie C|
00002740  41 4c 4c 20 28 63 6f 64  65 25 2b 31 30 30 29 0a  |ALL (code%+100).|
00002750  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002760  20 20 20 20 20 20 20 20  20 20 20 20 0a 20 20 20  |            .   |
00002770  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002780  20 20 20 20 20 20 20 20  20 54 68 65 20 69 6e 69  |         The ini|
00002790  74 20 72 6f 75 74 69 6e  65 20 73 68 6f 75 6c 64  |t routine should|
000027a0  20 75 73 65 20 27 4d 4f  56 20 70 63 2c 72 31 34  | use 'MOV pc,r14|
000027b0  27 20 74 6f 0a 20 20 20  20 20 20 20 20 20 20 20  |' to.           |
000027c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000027d0  20 65 78 69 74 20 74 68  65 20 69 6e 69 74 69 61  | exit the initia|
000027e0  6c 69 73 61 74 69 6f 6e  2e 0a 0a 20 62 79 74 65  |lisation... byte|
000027f0  73 20 28 31 30 34 2d 31  30 37 29 20 31 20 77 6f  |s (104-107) 1 wo|
00002800  72 64 20 20 20 3a 20 42  20 73 68 75 74 64 6f 77  |rd   : B shutdow|
00002810  6e 20 3b 20 4a 75 6d 70  73 20 74 6f 20 74 68 65  |n ; Jumps to the|
00002820  20 73 68 75 74 64 6f 77  6e 20 72 6f 75 74 69 6e  | shutdown routin|
00002830  65 2e 0a 0a 20 20 20 20  20 20 20 20 20 20 20 20  |e...            |
00002840  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002850  59 6f 75 20 77 69 6c 6c  20 6e 65 65 64 20 74 6f  |You will need to|
00002860  20 77 72 69 74 65 20 74  68 65 20 61 63 74 75 61  | write the actua|
00002870  6c 20 73 68 75 74 64 6f  77 6e 0a 20 20 20 20 20  |l shutdown.     |
00002880  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002890  20 20 20 20 20 20 20 63  6f 64 65 20 61 74 20 61  |       code at a|
000028a0  20 66 75 72 74 68 65 72  20 6c 6f 63 61 74 69 6f  | further locatio|
000028b0  6e 2c 20 61 6e 64 20 6a  75 6d 70 20 74 6f 20 69  |n, and jump to i|
000028c0  74 20 66 72 6f 6d 0a 20  20 20 20 20 20 20 20 20  |t from.         |
000028d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000028e0  20 20 20 68 65 72 65 2c  20 75 73 69 6e 67 20 61  |   here, using a|
000028f0  20 62 72 61 6e 63 68 20  69 6e 73 74 72 75 63 74  | branch instruct|
00002900  69 6f 6e 20 61 73 20 73  68 6f 77 6e 2e 0a 0a 20  |ion as shown... |
00002910  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002920  20 20 20 20 20 20 20 20  20 20 20 44 61 72 6b 48  |           DarkH|
00002930  6f 72 73 65 20 63 61 6c  6c 73 20 74 68 69 73 20  |orse calls this |
00002940  6c 6f 63 61 74 69 6f 6e  20 66 6f 72 20 73 68 75  |location for shu|
00002950  74 64 6f 77 6e 0a 20 20  20 20 20 20 20 20 20 20  |tdown.          |
00002960  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002970  20 20 69 65 20 43 41 4c  4c 20 28 63 6f 64 65 25  |  ie CALL (code%|
00002980  2b 31 30 34 29 0a 20 20  20 20 20 0a 20 20 20 20  |+104).     .    |
00002990  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000029a0  20 20 20 20 20 20 20 20  54 68 65 20 73 68 75 74  |        The shut|
000029b0  64 6f 77 6e 20 72 6f 75  74 69 6e 65 20 73 68 6f  |down routine sho|
000029c0  75 6c 64 20 75 73 65 20  27 4d 4f 56 20 70 63 2c  |uld use 'MOV pc,|
000029d0  72 31 34 27 20 74 6f 0a  20 20 20 20 20 20 20 20  |r14' to.        |
000029e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000029f0  20 20 20 20 65 78 69 74  20 74 68 65 20 73 68 75  |    exit the shu|
00002a00  74 64 6f 77 6e 20 63 6f  64 65 2e 0a 0a 20 62 79  |tdown code... by|
00002a10  74 65 73 20 28 31 30 38  2d 78 78 78 29 20 78 20  |tes (108-xxx) x |
00002a20  77 6f 72 64 20 20 20 3a  20 54 68 65 20 61 63 74  |word   : The act|
00002a30  75 61 6c 20 70 6f 6c 6c  20 72 6f 75 74 69 6e 65  |ual poll routine|
00002a40  20 77 69 6c 6c 20 73 74  61 72 74 20 68 65 72 65  | will start here|
00002a50  2e 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |..              |
00002a60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 69 65  |              ie|
00002a70  20 43 41 4c 4c 20 28 63  6f 64 65 25 2b 31 30 38  | CALL (code%+108|
00002a80  29 0a 0a 0a 20 52 65 67  69 73 74 65 72 20 73 65  |)... Register se|
00002a90  74 74 69 6e 67 73 0a 20  7e 7e 7e 7e 7e 7e 7e 7e  |ttings. ~~~~~~~~|
00002aa0  7e 7e 7e 7e 7e 7e 7e 7e  7e 0a 20 4f 6e 20 65 6e  |~~~~~~~~~. On en|
00002ab0  74 72 79 20 69 6e 74 6f  20 74 68 65 20 73 61 76  |try into the sav|
00002ac0  65 72 20 49 6e 69 74 69  61 6c 69 73 61 74 69 6f  |er Initialisatio|
00002ad0  6e 20 63 6f 64 65 20 61  74 20 2b 31 30 30 20 62  |n code at +100 b|
00002ae0  79 74 65 73 2c 20 74 68  65 0a 20 72 65 67 69 73  |ytes, the. regis|
00002af0  74 65 72 73 20 77 69 6c  6c 20 62 65 20 73 65 74  |ters will be set|
00002b00  20 74 68 75 73 20 3a 0a  0a 20 72 30 20 3d 20 73  | thus :.. r0 = s|
00002b10  63 72 65 65 6e 20 77 69  64 74 68 20 20 28 63 6f  |creen width  (co|
00002b20  6f 72 64 69 6e 61 74 65  20 76 61 6c 75 65 29 20  |ordinate value) |
00002b30  0a 20 72 31 20 3d 20 73  63 72 65 65 6e 20 68 65  |. r1 = screen he|
00002b40  69 67 68 74 20 28 63 6f  6f 72 64 69 6e 61 74 65  |ight (coordinate|
00002b50  20 76 61 6c 75 65 29 20  0a 20 72 32 20 3d 20 6e  | value) . r2 = n|
00002b60  75 6d 62 65 72 20 6f 66  20 63 6f 6c 6f 75 72 73  |umber of colours|
00002b70  20 69 6e 20 63 75 72 72  65 6e 74 20 73 63 72 65  | in current scre|
00002b80  65 6e 20 6d 6f 64 65 20  32 2f 34 2f 31 36 2f 32  |en mode 2/4/16/2|
00002b90  35 36 0a 20 72 33 20 3d  20 73 63 72 65 65 6e 20  |56. r3 = screen |
00002ba0  62 61 73 65 20 61 64 64  72 65 73 73 0a 20 72 34  |base address. r4|
00002bb0  20 3d 20 73 63 72 65 65  6e 20 73 69 7a 65 20 69  | = screen size i|
00002bc0  6e 20 62 79 74 65 73 0a  0a 20 4f 6e 20 65 6e 74  |n bytes.. On ent|
00002bd0  72 79 20 69 6e 74 6f 20  74 68 65 20 73 61 76 65  |ry into the save|
00002be0  72 20 50 6f 6c 6c 69 6e  67 20 63 6f 64 65 20 61  |r Polling code a|
00002bf0  74 20 2b 31 30 38 20 62  79 74 65 73 2c 20 74 68  |t +108 bytes, th|
00002c00  65 20 72 65 67 69 73 74  65 72 73 0a 20 77 69 6c  |e registers. wil|
00002c10  6c 20 62 65 20 73 65 74  20 74 68 75 73 20 3a 0a  |l be set thus :.|
00002c20  0a 20 72 30 20 3d 20 61  20 72 61 6e 64 6f 6d 20  |. r0 = a random |
00002c30  69 6e 74 65 67 65 72 20  6e 75 6d 62 65 72 20 62  |integer number b|
00002c40  65 74 77 65 65 6e 20 28  30 2d 73 63 72 65 65 6e  |etween (0-screen|
00002c50  20 77 69 64 74 68 29 0a  20 72 31 20 3d 20 61 20  | width). r1 = a |
00002c60  72 61 6e 64 6f 6d 20 69  6e 74 65 67 65 72 20 6e  |random integer n|
00002c70  75 6d 62 65 72 20 62 65  74 77 65 65 6e 20 28 30  |umber between (0|
00002c80  2d 73 63 72 65 65 6e 20  68 65 69 67 68 74 29 0a  |-screen height).|
00002c90  20 72 32 20 3d 20 74 68  65 20 6e 65 78 74 20 67  | r2 = the next g|
00002ca0  63 6f 6c 20 69 6e 20 74  68 65 20 63 75 72 72 65  |col in the curre|
00002cb0  6e 74 20 70 61 6c 65 74  74 65 0a 20 72 33 20 3d  |nt palette. r3 =|
00002cc0  20 74 68 65 20 6e 65 78  74 20 74 69 6e 74 20 28  | the next tint (|
00002cd0  6f 6e 6c 79 20 32 35 36  20 63 6f 6c 6f 75 72 20  |only 256 colour |
00002ce0  6d 6f 64 65 73 29 0a 20  20 20 0a 20 54 68 65 20  |modes).   . The |
00002cf0  61 63 74 75 61 6c 20 63  6f 64 65 0a 20 7e 7e 7e  |actual code. ~~~|
00002d00  7e 7e 7e 7e 7e 7e 7e 7e  7e 7e 7e 7e 0a 20 54 68  |~~~~~~~~~~~~. Th|
00002d10  65 20 6d 6f 73 74 20 6f  62 76 69 6f 75 73 20 61  |e most obvious a|
00002d20  6e 64 20 63 6f 6e 76 65  6e 69 65 6e 74 20 77 61  |nd convenient wa|
00002d30  79 2c 20 69 73 20 74 6f  20 75 73 65 20 74 68 65  |y, is to use the|
00002d40  20 42 41 53 49 43 20 61  73 73 65 6d 62 6c 65 72  | BASIC assembler|
00002d50  20 2d 20 0a 0a 20 42 65  6c 6f 77 20 69 73 20 61  | - .. Below is a|
00002d60  20 73 6b 65 6c 65 74 6f  6e 20 70 72 6f 67 72 61  | skeleton progra|
00002d70  6d 20 6f 66 20 74 68 65  20 73 63 72 65 65 6e 73  |m of the screens|
00002d80  61 76 65 72 20 66 6f 72  6d 61 74 20 77 68 69 63  |aver format whic|
00002d90  68 20 63 61 6e 20 62 65  0a 20 62 75 69 6c 74 20  |h can be. built |
00002da0  75 70 6f 6e 2e 0a 0a 20  49 74 20 69 6e 63 6c 75  |upon... It inclu|
00002db0  64 65 73 20 61 6e 20 61  73 73 65 6d 62 6c 79 20  |des an assembly |
00002dc0  62 6c 6f 63 6b 20 61 74  20 74 68 65 20 65 6e 64  |block at the end|
00002dd0  20 74 6f 20 73 65 74 20  74 68 65 20 63 75 72 72  | to set the curr|
00002de0  65 6e 74 20 66 6f 72 65  67 72 6f 75 6e 64 0a 20  |ent foreground. |
00002df0  63 6f 6c 6f 75 72 20 74  6f 20 74 68 65 20 6e 65  |colour to the ne|
00002e00  78 74 20 69 6e 20 74 68  65 20 70 61 6c 65 74 74  |xt in the palett|
00002e10  65 2c 20 73 75 63 68 20  74 68 61 74 20 61 6c 6c  |e, such that all|
00002e20  20 74 68 65 20 63 6f 6c  6f 75 72 73 20 61 76 61  | the colours ava|
00002e30  69 6c 61 62 6c 65 0a 20  61 72 65 20 63 79 63 6c  |ilable. are cycl|
00002e40  65 64 20 74 68 72 6f 75  67 68 2e 20 49 66 20 79  |ed through. If y|
00002e50  6f 75 20 69 6e 74 65 6e  64 20 74 6f 20 75 73 65  |ou intend to use|
00002e60  20 74 68 69 73 2c 20 79  6f 75 20 77 69 6c 6c 20  | this, you will |
00002e70  6e 65 65 64 20 74 6f 20  6d 61 6b 65 0a 20 73 75  |need to make. su|
00002e80  72 65 20 74 6f 20 69 6e  63 6c 75 64 65 20 74 68  |re to include th|
00002e90  65 20 66 65 77 20 73 74  61 74 65 6d 65 6e 74 73  |e few statements|
00002ea0  20 69 6e 20 74 68 65 20  27 69 6e 69 74 69 61 6c  | in the 'initial|
00002eb0  69 73 61 74 69 6f 6e 20  63 6f 64 65 27 20 77 68  |isation code' wh|
00002ec0  69 63 68 0a 20 73 74 6f  72 65 73 20 74 68 65 20  |ich. stores the |
00002ed0  6e 75 6d 62 65 72 20 6f  66 20 63 6f 6c 6f 75 72  |number of colour|
00002ee0  73 20 61 74 20 74 68 65  20 6c 61 62 65 6c 20 27  |s at the label '|
00002ef0  2e 6e 6f 63 6f 6c 73 27  2e 20 53 65 65 20 74 68  |.nocols'. See th|
00002f00  65 20 63 6f 64 65 20 62  65 6c 6f 77 0a 20 74 6f  |e code below. to|
00002f10  20 73 65 65 20 77 68 61  74 20 49 20 6d 65 61 6e  | see what I mean|
00002f20  2e 20 4e 6f 77 20 74 6f  20 75 73 65 20 74 68 65  |. Now to use the|
00002f30  20 27 53 65 74 43 6f 6c  27 20 72 6f 75 74 69 6e  | 'SetCol' routin|
00002f40  65 2c 20 28 77 68 69 63  68 20 63 61 6e 20 62 65  |e, (which can be|
00002f50  0a 20 63 61 6c 6c 65 64  20 66 72 6f 6d 20 74 68  |. called from th|
00002f60  65 20 69 6e 69 74 20 63  6f 64 65 20 6f 72 20 70  |e init code or p|
00002f70  6f 6c 6c 20 63 6f 64 65  29 20 2c 20 66 69 72 73  |oll code) , firs|
00002f80  74 20 70 72 65 73 65 72  76 65 20 74 68 65 20 63  |t preserve the c|
00002f90  75 72 72 65 6e 74 0a 20  72 65 67 69 73 74 65 72  |urrent. register|
00002fa0  73 20 74 6f 20 73 74 61  63 6b 2f 6d 65 6d 6f 72  |s to stack/memor|
00002fb0  79 20 61 6e 64 20 63 61  6c 6c 20 74 68 65 20 72  |y and call the r|
00002fc0  6f 75 74 69 6e 65 20 77  69 74 68 20 27 42 4c 20  |outine with 'BL |
00002fd0  53 65 74 43 6f 6c 27 2e  20 54 68 69 73 0a 20 77  |SetCol'. This. w|
00002fe0  69 6c 6c 20 73 65 74 20  74 68 65 20 47 43 4f 4c  |ill set the GCOL|
00002ff0  20 61 63 63 6f 72 64 69  6e 67 20 74 6f 20 73 63  | according to sc|
00003000  72 65 65 6e 20 6d 6f 64  65 2c 20 61 6e 64 20 72  |reen mode, and r|
00003010  65 74 75 72 6e 20 62 61  63 6b 2c 20 61 66 74 65  |eturn back, afte|
00003020  72 20 77 68 69 63 68 0a  20 79 6f 75 20 73 68 6f  |r which. you sho|
00003030  75 6c 64 20 72 65 73 74  6f 72 65 20 74 68 65 20  |uld restore the |
00003040  72 65 67 69 73 74 65 72  73 20 74 68 61 74 20 79  |registers that y|
00003050  6f 75 20 73 74 6f 72 65  64 2e 20 41 6c 74 65 72  |ou stored. Alter|
00003060  6e 61 74 69 76 65 6c 79  20 79 6f 75 0a 20 63 61  |natively you. ca|
00003070  6e 20 65 78 70 6c 69 63  69 74 6c 79 20 73 65 74  |n explicitly set|
00003080  20 74 68 65 20 47 43 4f  4c 20 61 6e 64 20 54 49  | the GCOL and TI|
00003090  4e 54 20 74 6f 20 74 68  65 20 76 61 6c 75 65 73  |NT to the values|
000030a0  20 70 61 73 73 65 64 20  69 6e 74 6f 20 79 6f 75  | passed into you|
000030b0  72 0a 20 70 6f 6c 6c 69  6e 67 20 63 6f 64 65 20  |r. polling code |
000030c0  61 73 20 72 65 67 69 73  74 65 72 73 20 72 32 20  |as registers r2 |
000030d0  61 6e 64 20 72 33 20 72  65 73 70 65 63 74 69 76  |and r3 respectiv|
000030e0  65 6c 79 2e 0a 0a 20 4f  6e 63 65 20 79 6f 75 20  |ely... Once you |
000030f0  61 72 65 20 68 61 70 70  79 20 77 69 74 68 20 79  |are happy with y|
00003100  6f 75 72 20 63 6f 64 65  20 61 6e 64 20 69 74 20  |our code and it |
00003110  68 61 73 20 62 65 65 6e  20 61 73 73 65 6d 62 6c  |has been assembl|
00003120  65 64 2c 20 79 6f 75 20  77 69 6c 6c 0a 20 6e 65  |ed, you will. ne|
00003130  65 64 20 74 6f 20 73 74  6f 72 65 20 69 74 20 74  |ed to store it t|
00003140  6f 20 64 69 73 6b 2e 20  46 6f 72 20 74 68 65 20  |o disk. For the |
00003150  65 78 61 6d 70 6c 65 20  70 72 6f 67 72 61 6d 20  |example program |
00003160  67 69 76 65 6e 20 62 65  6c 6f 77 2c 20 79 6f 75  |given below, you|
00003170  20 63 61 6e 0a 20 64 6f  20 74 68 65 20 66 6f 6c  | can. do the fol|
00003180  6c 6f 77 69 6e 67 2c 20  61 66 74 65 72 20 72 75  |lowing, after ru|
00003190  6e 6e 69 6e 67 20 74 68  65 20 70 72 6f 67 72 61  |nning the progra|
000031a0  6d 20 28 69 65 20 61 66  74 65 72 20 61 73 73 65  |m (ie after asse|
000031b0  6d 62 6c 69 6e 67 29 20  3a 0a 0a 20 50 52 49 4e  |mbling) :.. PRIN|
000031c0  54 20 7e 63 6f 64 65 25  2c 20 7e 50 25 20 20 20  |T ~code%, ~P%   |
000031d0  20 20 20 20 20 20 20 3c  2d 2d 20 54 68 69 73 20  |       <-- This |
000031e0  77 69 6c 6c 20 70 72 69  6e 74 20 74 68 65 20 68  |will print the h|
000031f0  65 78 61 64 65 63 69 6d  61 6c 20 76 61 6c 75 65  |exadecimal value|
00003200  73 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |s.              |
00003210  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003220  20 20 6f 66 20 73 74 61  72 74 20 61 6e 64 20 65  |  of start and e|
00003230  6e 64 20 6f 66 20 63 6f  64 65 2c 20 72 65 73 70  |nd of code, resp|
00003240  65 63 74 69 76 65 6c 79  2e 0a 0a 20 2a 53 41 56  |ectively... *SAV|
00003250  45 20 22 4d 79 53 61 76  65 72 22 20 58 58 58 58  |E "MySaver" XXXX|
00003260  20 59 59 59 59 20 20 3c  2d 2d 20 54 68 69 73 20  | YYYY  <-- This |
00003270  77 69 6c 6c 20 73 61 76  65 20 74 68 65 20 63 6f  |will save the co|
00003280  64 65 20 74 6f 20 66 69  6c 65 20 22 4d 79 53 61  |de to file "MySa|
00003290  76 65 72 22 0a 20 20 20  20 20 20 20 20 20 20 20  |ver".           |
000032a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000032b0  20 20 20 20 20 58 58 58  58 20 69 73 20 74 68 65  |     XXXX is the|
000032c0  20 68 65 78 20 76 61 6c  75 65 20 67 69 76 65 6e  | hex value given|
000032d0  20 62 79 20 7e 63 6f 64  65 25 0a 20 20 20 20 20  | by ~code%.     |
000032e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000032f0  20 20 20 20 20 20 20 20  20 20 20 59 59 59 59 20  |           YYYY |
00003300  69 73 20 74 68 65 20 68  65 78 20 76 61 6c 75 65  |is the hex value|
00003310  20 67 69 76 65 6e 20 62  79 20 7e 50 25 20 0a 0a  | given by ~P% ..|
00003320  20 59 6f 75 20 63 61 6e  20 74 65 73 74 20 79 6f  | You can test yo|
00003330  75 72 20 63 6f 64 65 20  62 79 20 43 41 4c 4c 69  |ur code by CALLi|
00003340  6e 67 20 63 6f 64 65 25  2b 31 30 30 20 74 6f 20  |ng code%+100 to |
00003350  63 68 65 63 6b 20 69 6e  69 74 69 61 6c 69 73 61  |check initialisa|
00003360  74 69 6f 6e 2c 0a 20 61  6e 64 20 74 68 65 6e 20  |tion,. and then |
00003370  63 61 6c 6c 20 63 6f 64  65 25 2b 31 30 38 20 72  |call code%+108 r|
00003380  65 70 65 61 74 65 64 6c  79 20 74 6f 20 63 68 65  |epeatedly to che|
00003390  63 6b 20 79 6f 75 72 20  70 6f 6c 6c 69 6e 67 20  |ck your polling |
000033a0  63 6f 64 65 2e 0a 0a 20  54 68 65 20 6f 6e 6c 79  |code... The only|
000033b0  20 63 68 65 63 6b 69 6e  67 20 6f 66 20 61 72 67  | checking of arg|
000033c0  75 6d 65 6e 74 20 76 61  6c 75 65 73 20 74 68 61  |ument values tha|
000033d0  74 20 64 61 72 6b 68 6f  72 73 65 20 77 69 6c 6c  |t darkhorse will|
000033e0  20 6d 61 6b 65 20 69 73  20 3a 0a 0a 20 2d 20 69  | make is :.. - i|
000033f0  66 20 74 68 65 20 69 6e  70 75 74 20 69 73 20 73  |f the input is s|
00003400  75 70 70 6f 73 65 64 20  74 6f 20 62 65 20 61 20  |upposed to be a |
00003410  73 74 72 69 6e 67 20 28  69 65 20 74 79 70 65 20  |string (ie type |
00003420  31 30 29 2c 20 69 74 20  77 69 6c 6c 20 62 65 0a  |10), it will be.|
00003430  20 20 20 63 68 65 63 6b  65 64 20 61 6e 64 20 69  |   checked and i|
00003440  66 20 6e 65 63 65 73 73  61 72 79 20 74 72 75 6e  |f necessary trun|
00003450  63 61 74 65 64 20 74 6f  20 6c 65 6e 67 74 68 20  |cated to length |
00003460  33 32 20 62 79 74 65 73  2e 0a 20 2d 20 69 66 20  |32 bytes.. - if |
00003470  74 68 65 20 69 6e 70 75  74 20 69 73 20 73 75 70  |the input is sup|
00003480  70 6f 73 65 64 20 74 6f  20 68 61 76 65 20 61 20  |posed to have a |
00003490  63 65 72 74 61 69 6e 20  6e 75 6d 62 65 72 20 6f  |certain number o|
000034a0  66 20 61 72 67 75 6d 65  6e 74 73 2c 0a 20 20 20  |f arguments,.   |
000034b0  74 68 65 20 63 68 65 63  6b 20 77 69 6c 6c 20 65  |the check will e|
000034c0  6e 73 75 72 65 20 74 68  69 73 20 65 6c 73 65 20  |nsure this else |
000034d0  72 65 70 6c 61 63 65 20  74 68 65 6d 20 77 69 74  |replace them wit|
000034e0  68 20 74 68 65 20 64 65  66 61 75 6c 74 2e 0a 20  |h the default.. |
000034f0  2d 20 64 61 72 6b 68 6f  72 73 65 20 77 69 6c 6c  |- darkhorse will|
00003500  20 65 6e 73 75 72 65 20  61 6c 6c 20 61 72 67 75  | ensure all argu|
00003510  6d 65 6e 74 73 20 61 72  65 20 69 6e 74 65 67 65  |ments are intege|
00003520  72 20 61 6e 64 20 70 6f  73 69 74 69 76 65 2c 0a  |r and positive,.|
00003530  20 20 20 6e 6f 20 6e 65  67 61 74 69 76 65 20 69  |   no negative i|
00003540  6e 70 75 74 20 61 6c 6c  6f 77 65 64 20 61 73 20  |nput allowed as |
00003550  69 74 20 63 61 6e 20 6d  61 6b 65 20 73 6f 6d 65  |it can make some|
00003560  20 73 61 76 65 72 73 20  68 61 6e 67 20 64 75 65  | savers hang due|
00003570  0a 20 20 20 74 6f 20 6c  6f 6f 70 73 20 67 6f 69  |.   to loops goi|
00003580  6e 67 20 74 68 65 20 77  72 6f 6e 67 20 77 61 79  |ng the wrong way|
00003590  20 65 74 63 2e 0a 20 0a  20 53 6f 2c 20 61 6c 74  | etc.. . So, alt|
000035a0  68 6f 75 67 68 20 44 61  72 6b 48 6f 72 73 65 20  |hough DarkHorse |
000035b0  64 6f 65 73 20 64 6f 20  61 20 66 65 77 20 63 68  |does do a few ch|
000035c0  65 63 6b 73 20 66 6f 72  20 79 6f 75 2c 20 70 6c  |ecks for you, pl|
000035d0  65 61 73 65 20 74 65 73  74 20 79 6f 75 72 0a 20  |ease test your. |
000035e0  73 61 76 65 72 73 20 74  68 6f 72 6f 75 67 68 6c  |savers thoroughl|
000035f0  79 2c 20 74 6f 20 6d 61  6b 65 20 73 75 72 65 20  |y, to make sure |
00003600  74 68 65 79 20 64 6f 6e  27 74 20 68 61 6e 67 2f  |they don't hang/|
00003610  63 72 61 73 68 20 74 68  65 20 6d 61 63 68 69 6e  |crash the machin|
00003620  65 20 0a 20 77 68 65 6e  20 65 78 74 72 65 6d 65  |e . when extreme|
00003630  20 76 61 6c 75 65 73 20  61 72 65 20 67 69 76 65  | values are give|
00003640  6e 2e 20 42 65 20 73 75  72 65 20 74 6f 20 74 65  |n. Be sure to te|
00003650  73 74 20 79 6f 75 72 20  73 61 76 65 72 20 77 69  |st your saver wi|
00003660  74 68 20 76 61 6c 75 65  73 0a 20 6f 66 20 7a 65  |th values. of ze|
00003670  72 6f 20 61 73 20 61 72  67 75 6d 65 6e 74 20 69  |ro as argument i|
00003680  6e 70 75 74 2c 20 62 65  63 61 75 73 65 20 66 6f  |nput, because fo|
00003690  72 20 65 78 61 6d 70 6c  65 20 69 66 20 79 6f 75  |r example if you|
000036a0  27 72 65 20 75 73 69 6e  67 20 61 20 75 73 65 72  |'re using a user|
000036b0  0a 20 61 72 67 75 6d 65  6e 74 20 76 61 6c 75 65  |. argument value|
000036c0  20 74 6f 20 70 72 6f 76  69 64 65 20 61 6e 20 69  | to provide an i|
000036d0  6e 63 72 65 6d 65 6e 74  20 73 74 65 70 20 66 6f  |ncrement step fo|
000036e0  72 20 61 20 6c 6f 6f 70  2c 20 61 20 73 74 65 70  |r a loop, a step|
000036f0  20 6f 66 0a 20 7a 65 72  6f 20 77 69 6c 6c 20 6e  | of. zero will n|
00003700  6f 74 20 6d 61 6b 65 20  74 68 65 20 64 69 66 66  |ot make the diff|
00003710  65 72 65 6e 63 65 2c 20  61 6e 64 20 6d 61 79 20  |erence, and may |
00003720  63 61 75 73 65 20 79 6f  75 72 20 73 61 76 65 72  |cause your saver|
00003730  20 74 6f 20 72 75 6e 20  69 6e 74 6f 0a 20 61 6e  | to run into. an|
00003740  20 69 6e 66 69 6e 69 74  65 20 6c 6f 6f 70 2e 0a  | infinite loop..|
00003750  0a 20 41 6e 6f 74 68 65  72 20 74 68 69 6e 67 20  |. Another thing |
00003760  74 6f 20 6d 61 6b 65 20  73 75 72 65 20 69 73 20  |to make sure is |
00003770  74 68 61 74 20 74 68 65  20 68 65 6c 70 20 73 74  |that the help st|
00003780  72 69 6e 67 73 20 69 6e  20 74 68 65 20 68 65 61  |rings in the hea|
00003790  64 65 72 0a 20 61 72 65  20 6e 6f 74 20 61 6e 79  |der. are not any|
000037a0  20 6c 61 72 67 65 72 20  74 68 61 6e 20 74 68 65  | larger than the|
000037b0  20 73 69 7a 65 20 73 70  65 63 69 66 69 65 64 2e  | size specified.|
000037c0  20 49 66 20 79 6f 75 20  61 63 63 69 64 65 6e 74  | If you accident|
000037d0  6c 79 20 6d 61 6b 65 0a  20 74 68 65 6d 20 6c 61  |ly make. them la|
000037e0  72 67 65 72 2c 20 74 68  65 79 20 77 69 6c 6c 20  |rger, they will |
000037f0  6f 76 65 72 77 72 69 74  65 20 61 6e 79 20 61 73  |overwrite any as|
00003800  73 65 6d 62 6c 79 20 69  6e 73 74 72 75 63 74 69  |sembly instructi|
00003810  6f 6e 73 20 77 68 69 63  68 0a 20 66 6f 6c 6c 6f  |ons which. follo|
00003820  77 2e 20 54 68 69 73 20  68 61 73 20 68 61 70 70  |w. This has happ|
00003830  65 6e 65 64 20 74 6f 20  6d 65 2c 20 61 6e 64 20  |ened to me, and |
00003840  69 74 20 74 6f 6f 6b 20  6d 65 20 61 20 77 68 69  |it took me a whi|
00003850  6c 65 20 74 6f 20 66 69  6e 64 20 6f 75 74 0a 20  |le to find out. |
00003860  77 68 61 74 20 74 68 65  20 70 72 6f 62 6c 65 6d  |what the problem|
00003870  20 77 61 73 2e 20 53 6f  2c 20 49 20 61 64 76 69  | was. So, I advi|
00003880  73 65 20 79 6f 75 20 74  6f 20 64 6f 75 62 6c 65  |se you to double|
00003890  20 63 68 65 63 6b 20 74  68 65 20 6c 65 6e 67 74  | check the lengt|
000038a0  68 73 20 2d 20 0a 20 74  68 65 20 74 77 6f 20 73  |hs - . the two s|
000038b0  74 72 69 6e 67 73 20 6d  75 73 74 20 62 65 20 6c  |trings must be l|
000038c0  65 73 73 20 74 68 61 6e  20 33 31 20 63 68 61 72  |ess than 31 char|
000038d0  73 20 65 61 63 68 2e 0a  0a 20 59 65 74 20 61 6e  |s each... Yet an|
000038e0  6f 74 68 65 72 20 67 6f  6f 64 20 74 69 70 20 74  |other good tip t|
000038f0  6f 20 67 65 74 74 69 6e  67 20 79 6f 75 72 20 73  |o getting your s|
00003900  61 76 65 72 73 20 74 6f  20 77 6f 72 6b 20 69 73  |avers to work is|
00003910  2c 20 74 6f 20 77 72 69  74 65 20 74 68 65 0a 20  |, to write the. |
00003920  73 61 76 65 72 20 69 6e  20 42 41 53 49 43 20 66  |saver in BASIC f|
00003930  69 72 73 74 20 61 6e 64  20 67 65 74 20 69 74 20  |irst and get it |
00003940  77 6f 72 6b 69 6e 67 20  65 78 61 63 74 6c 79 20  |working exactly |
00003950  61 73 20 79 6f 75 20 77  61 6e 74 2e 20 54 68 65  |as you want. The|
00003960  6e 20 69 74 27 73 0a 20  73 69 6d 70 6c 79 20 61  |n it's. simply a|
00003970  20 6d 61 74 74 65 72 20  6f 66 20 63 6f 6e 76 65  | matter of conve|
00003980  72 74 69 6e 67 20 79 6f  75 72 20 42 41 53 49 43  |rting your BASIC|
00003990  20 73 74 61 74 65 6d 65  6e 74 73 20 69 6e 74 6f  | statements into|
000039a0  20 65 71 75 69 76 61 6c  65 6e 74 0a 20 61 73 73  | equivalent. ass|
000039b0  65 6d 62 6c 79 2e 0a 0a  20 54 68 69 73 20 66 69  |embly... This fi|
000039c0  6c 65 20 69 73 20 69 6e  63 6c 75 64 65 64 20 69  |le is included i|
000039d0  6e 20 74 68 65 20 66 6f  72 6d 20 6f 66 20 61 20  |n the form of a |
000039e0  42 41 53 49 43 20 70 72  6f 67 72 61 6d 20 73 6f  |BASIC program so|
000039f0  20 74 68 61 74 20 69 74  20 63 61 6e 20 62 65 0a  | that it can be.|
00003a00  20 61 64 61 70 74 65 64  20 65 61 73 69 6c 79 2c  | adapted easily,|
00003a10  20 63 61 6c 6c 65 64 20  27 42 61 73 65 53 61 76  | called 'BaseSav|
00003a20  65 27 20 69 74 20 63 61  6e 20 62 65 20 66 6f 75  |e' it can be fou|
00003a30  6e 64 20 69 6e 20 74 68  65 20 64 69 72 65 63 74  |nd in the direct|
00003a40  6f 72 79 0a 20 27 45 78  61 6d 70 6c 65 27 20 77  |ory. 'Example' w|
00003a50  69 74 68 69 6e 20 74 68  65 20 27 57 6f 72 6b 48  |ithin the 'WorkH|
00003a60  6f 72 73 65 73 27 20 64  69 72 65 63 74 6f 72 79  |orses' directory|
00003a70  2e 20 54 68 69 73 20 27  45 78 61 6d 70 6c 65 27  |. This 'Example'|
00003a80  20 64 69 72 65 63 74 6f  72 79 0a 20 61 6c 73 6f  | directory. also|
00003a90  20 63 6f 6e 74 61 69 6e  73 20 61 20 42 41 53 49  | contains a BASI|
00003aa0  43 20 66 69 6c 65 20 63  61 6c 6c 65 64 20 27 66  |C file called 'f|
00003ab0  6c 61 73 68 27 2e 20 54  68 69 73 20 69 73 20 74  |lash'. This is t|
00003ac0  68 65 20 73 6f 75 72 63  65 20 63 6f 64 65 20 74  |he source code t|
00003ad0  6f 0a 20 74 68 65 20 73  61 76 65 72 20 27 66 6c  |o. the saver 'fl|
00003ae0  61 73 68 27 20 77 68 69  63 68 20 69 73 20 61 20  |ash' which is a |
00003af0  76 65 72 79 2c 20 76 65  72 79 20 73 69 6d 70 6c  |very, very simpl|
00003b00  65 20 73 61 76 65 72 20  62 75 69 6c 74 20 75 70  |e saver built up|
00003b10  6f 6e 20 74 68 65 20 63  6f 64 65 0a 20 62 65 6c  |on the code. bel|
00003b20  6f 77 2e 20 27 66 6c 61  73 68 27 20 69 73 20 61  |ow. 'flash' is a|
00003b30  20 67 6f 6f 64 20 65 78  61 6d 70 6c 65 20 6f 66  | good example of|
00003b40  20 68 6f 77 20 74 6f 20  75 74 69 6c 69 73 65 20  | how to utilise |
00003b50  74 68 65 20 27 42 61 73  65 53 61 76 65 27 20 63  |the 'BaseSave' c|
00003b60  6f 64 65 2c 0a 20 61 6e  64 20 69 74 20 73 68 6f  |ode,. and it sho|
00003b70  77 73 20 68 6f 77 20 74  6f 20 65 78 74 65 6e 64  |ws how to extend|
00003b80  20 74 68 65 20 62 61 73  69 63 20 73 74 72 75 63  | the basic struc|
00003b90  74 75 72 65 20 61 20 6c  69 74 74 6c 65 2e 20 49  |ture a little. I|
00003ba0  74 27 73 20 66 75 6c 6c  79 0a 20 63 6f 6d 6d 65  |t's fully. comme|
00003bb0  6e 74 65 64 2e 20 41 6c  73 6f 20 69 6e 63 6c 75  |nted. Also inclu|
00003bc0  64 65 64 20 69 73 20 61  20 42 41 53 49 43 20 70  |ded is a BASIC p|
00003bd0  72 6f 67 72 61 6d 20 63  61 6c 6c 65 64 20 27 42  |rogram called 'B|
00003be0  41 53 49 43 66 6c 61 73  68 27 2c 20 77 68 69 63  |ASICflash', whic|
00003bf0  68 0a 20 69 73 20 74 68  65 20 42 41 53 49 43 20  |h. is the BASIC |
00003c00  65 71 75 69 76 61 6c 65  6e 74 20 74 6f 20 74 68  |equivalent to th|
00003c10  65 20 66 6c 61 73 68 20  73 61 76 65 72 2e 20 49  |e flash saver. I|
00003c20  74 27 73 20 61 20 67 6f  6f 64 20 69 64 65 61 20  |t's a good idea |
00003c30  74 6f 20 67 65 74 20 61  0a 20 70 72 69 6e 74 20  |to get a. print |
00003c40  6f 75 74 20 6f 66 20 27  42 61 73 65 53 61 76 65  |out of 'BaseSave|
00003c50  27 2c 20 27 66 6c 61 73  68 27 20 61 6e 64 20 27  |', 'flash' and '|
00003c60  42 41 53 49 43 66 6c 61  73 68 27 20 74 6f 20 63  |BASICflash' to c|
00003c70  6f 6d 70 61 72 65 20 61  6e 64 0a 20 75 6e 64 65  |ompare and. unde|
00003c80  72 73 74 61 6e 64 20 74  68 65 20 73 61 76 65 72  |rstand the saver|
00003c90  20 77 6f 72 6b 69 6e 67  73 2e 20 0a 0a 20 49 66  | workings. .. If|
00003ca0  20 79 6f 75 20 69 6e 74  65 6e 64 20 74 6f 20 75  | you intend to u|
00003cb0  73 65 20 42 61 73 65 53  61 76 65 2c 20 79 6f 75  |se BaseSave, you|
00003cc0  20 77 69 6c 6c 20 6f 6e  6c 79 20 6e 65 65 64 20  | will only need |
00003cd0  74 6f 20 77 72 69 74 65  20 74 68 65 20 73 65 63  |to write the sec|
00003ce0  74 69 6f 6e 73 0a 20 6f  66 20 63 6f 64 65 20 77  |tions. of code w|
00003cf0  68 69 63 68 20 64 6f 20  61 6e 79 20 69 6e 69 74  |hich do any init|
00003d00  69 61 6c 69 73 61 74 69  6f 6e 20 79 6f 75 20 77  |ialisation you w|
00003d10  61 6e 74 2c 20 61 6e 64  20 74 68 65 20 70 6f 6c  |ant, and the pol|
00003d20  6c 69 6e 67 20 63 6f 64  65 2e 20 54 68 65 73 65  |ling code. These|
00003d30  0a 20 63 61 6e 20 62 65  20 69 6e 73 65 72 74 65  |. can be inserte|
00003d40  64 20 69 6e 74 6f 20 74  68 65 20 42 61 73 65 53  |d into the BaseS|
00003d50  61 76 65 20 61 73 20 69  6e 64 69 63 61 74 65 64  |ave as indicated|
00003d60  20 62 65 6c 6f 77 2e 0a  0a 20 46 6f 72 20 74 68  | below... For th|
00003d70  65 20 61 76 65 72 61 67  65 20 41 72 63 68 69 6d  |e average Archim|
00003d80  65 64 65 73 20 61 73 73  65 6d 62 6c 79 20 63 6f  |edes assembly co|
00003d90  64 65 72 2c 20 74 68 65  72 65 20 73 68 6f 75 6c  |der, there shoul|
00003da0  64 6e 27 74 20 62 65 20  61 6e 79 0a 20 70 72 6f  |dn't be any. pro|
00003db0  62 6c 65 6d 73 20 69 6e  20 67 65 74 74 69 6e 67  |blems in getting|
00003dc0  20 79 6f 75 72 20 69 64  65 61 73 20 69 6e 74 6f  | your ideas into|
00003dd0  20 63 6f 64 65 2e 20 48  6f 77 65 76 65 72 2c 20  | code. However, |
00003de0  22 69 74 27 73 20 61 20  66 75 6e 6e 79 20 6f 6c  |"it's a funny ol|
00003df0  64 0a 20 67 61 6d 65 22  2c 20 61 6e 64 20 70 72  |d. game", and pr|
00003e00  6f 67 72 61 6d 6d 69 6e  67 20 69 6e 20 61 73 73  |ogramming in ass|
00003e10  65 6d 62 6c 79 20 69 73  6e 27 74 20 74 68 65 20  |embly isn't the |
00003e20  65 61 73 69 65 73 74 20  74 68 69 6e 67 20 69 6e  |easiest thing in|
00003e30  20 74 68 65 0a 20 77 6f  72 6c 64 20 28 6f 72 20  | the. world (or |
00003e40  74 68 65 20 68 61 72 64  65 73 74 29 2c 20 73 6f  |the hardest), so|
00003e50  20 69 66 20 79 6f 75 20  64 6f 20 68 61 76 65 20  | if you do have |
00003e60  70 72 6f 62 6c 65 6d 73  20 69 6e 20 67 65 74 74  |problems in gett|
00003e70  69 6e 67 20 79 6f 75 72  0a 20 63 6f 64 65 20 74  |ing your. code t|
00003e80  6f 20 66 75 6e 63 74 69  6f 6e 20 70 72 6f 70 65  |o function prope|
00003e90  72 6c 79 20 77 69 74 68  20 44 61 72 6b 48 6f 72  |rly with DarkHor|
00003ea0  73 65 2c 20 64 6f 6e 27  74 20 68 65 73 69 74 61  |se, don't hesita|
00003eb0  74 65 20 74 6f 20 63 6f  6e 74 61 63 74 20 6d 65  |te to contact me|
00003ec0  2e 0a 0a 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |...-------------|
00003ed0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00003f00  2d 2d 2d 2d 2d 2d 2d 0a  0a 52 45 4d 20 3e 20 42  |-------..REM > B|
00003f10  61 73 65 53 61 76 65 0a  0a 44 49 4d 20 63 6f 64  |aseSave..DIM cod|
00003f20  65 25 20 38 31 39 32 0a  0a 50 52 4f 43 41 73 73  |e% 8192..PROCAss|
00003f30  65 6d 62 6c 65 0a 0a 52  45 4d 20 2a 20 53 65 74  |emble..REM * Set|
00003f40  20 48 65 61 64 65 72 20  69 6e 66 6f 72 6d 61 74  | Header informat|
00003f50  69 6f 6e 2e 0a 0a 21 28  63 6f 64 65 25 2b 30 29  |ion...!(code%+0)|
00003f60  20 20 3d 20 30 20 20 3a  20 52 45 4d 20 61 72 67  |  = 0  : REM arg|
00003f70  75 6d 65 6e 74 20 74 79  70 65 2f 6e 75 6d 62 65  |ument type/numbe|
00003f80  72 0a 21 28 63 6f 64 65  25 2b 34 29 20 20 3d 20  |r.!(code%+4)  = |
00003f90  30 20 20 3a 20 52 45 4d  20 61 72 67 75 6d 65 6e  |0  : REM argumen|
00003fa0  74 20 31 0a 21 28 63 6f  64 65 25 2b 38 29 20 20  |t 1.!(code%+8)  |
00003fb0  3d 20 30 20 20 3a 20 52  45 4d 20 61 72 67 75 6d  |= 0  : REM argum|
00003fc0  65 6e 74 20 32 0a 21 28  63 6f 64 65 25 2b 31 32  |ent 2.!(code%+12|
00003fd0  29 20 3d 20 30 20 20 3a  20 52 45 4d 20 61 72 67  |) = 0  : REM arg|
00003fe0  75 6d 65 6e 74 20 33 0a  21 28 63 6f 64 65 25 2b  |ument 3.!(code%+|
00003ff0  31 36 29 20 3d 20 30 20  20 3a 20 52 45 4d 20 61  |16) = 0  : REM a|
00004000  72 67 75 6d 65 6e 74 20  34 0a 21 28 63 6f 64 65  |rgument 4.!(code|
00004010  25 2b 32 30 29 20 3d 20  30 20 20 3a 20 52 45 4d  |%+20) = 0  : REM|
00004020  20 61 72 67 75 6d 65 6e  74 20 35 0a 21 28 63 6f  | argument 5.!(co|
00004030  64 65 25 2b 32 34 29 20  3d 20 30 20 20 3a 20 52  |de%+24) = 0  : R|
00004040  45 4d 20 61 72 67 75 6d  65 6e 74 20 36 0a 21 28  |EM argument 6.!(|
00004050  63 6f 64 65 25 2b 32 38  29 20 3d 20 30 20 20 3a  |code%+28) = 0  :|
00004060  20 52 45 4d 20 61 72 67  75 6d 65 6e 74 20 37 0a  | REM argument 7.|
00004070  21 28 63 6f 64 65 25 2b  33 32 29 20 3d 20 30 20  |!(code%+32) = 0 |
00004080  20 3a 20 52 45 4d 20 61  72 67 75 6d 65 6e 74 20  | : REM argument |
00004090  38 0a 0a 24 28 63 6f 64  65 25 2b 33 36 29 3d 22  |8..$(code%+36)="|
000040a0  22 20 20 20 3a 20 52 45  4d 20 68 65 6c 70 20 73  |"   : REM help s|
000040b0  74 72 69 6e 67 20 31 0a  24 28 63 6f 64 65 25 2b  |tring 1.$(code%+|
000040c0  36 38 29 3d 22 22 20 20  20 3a 20 52 45 4d 20 68  |68)=""   : REM h|
000040d0  65 6c 70 20 73 74 72 69  6e 67 20 32 0a 0a 45 4e  |elp string 2..EN|
000040e0  44 0a 0a 44 45 46 50 52  4f 43 41 73 73 65 6d 62  |D..DEFPROCAssemb|
000040f0  6c 65 0a 0a 46 4f 52 20  70 61 73 73 3d 30 20 54  |le..FOR pass=0 T|
00004100  4f 20 33 20 53 54 45 50  20 33 0a 50 25 3d 63 6f  |O 3 STEP 3.P%=co|
00004110  64 65 25 0a 5b 4f 50 54  20 70 61 73 73 0a 0a 2e  |de%.[OPT pass...|
00004120  61 72 67 75 6d 65 6e 74  5f 74 79 70 65 0a 45 51  |argument_type.EQ|
00004130  55 44 20 30 0a 0a 2e 61  72 67 75 6d 65 6e 74 73  |UD 0...arguments|
00004140  0a 45 51 55 44 20 30 3a  45 51 55 44 20 30 3a 45  |.EQUD 0:EQUD 0:E|
00004150  51 55 44 20 30 3a 45 51  55 44 20 30 3a 45 51 55  |QUD 0:EQUD 0:EQU|
00004160  44 20 30 3a 45 51 55 44  20 30 3a 45 51 55 44 20  |D 0:EQUD 0:EQUD |
00004170  30 3a 45 51 55 44 20 30  0a 0a 2e 68 65 6c 70 5f  |0:EQUD 0...help_|
00004180  73 74 72 69 6e 67 73 0a  45 51 55 44 20 30 3a 45  |strings.EQUD 0:E|
00004190  51 55 44 20 30 3a 45 51  55 44 20 30 3a 45 51 55  |QUD 0:EQUD 0:EQU|
000041a0  44 20 30 3a 45 51 55 44  20 30 3a 45 51 55 44 20  |D 0:EQUD 0:EQUD |
000041b0  30 3a 45 51 55 44 20 30  3a 45 51 55 44 20 30 0a  |0:EQUD 0:EQUD 0.|
000041c0  45 51 55 44 20 30 3a 45  51 55 44 20 30 3a 45 51  |EQUD 0:EQUD 0:EQ|
000041d0  55 44 20 30 3a 45 51 55  44 20 30 3a 45 51 55 44  |UD 0:EQUD 0:EQUD|
000041e0  20 30 3a 45 51 55 44 20  30 3a 45 51 55 44 20 30  | 0:EQUD 0:EQUD 0|
000041f0  3a 45 51 55 44 20 30 0a  0a 42 20 69 6e 69 74 20  |:EQUD 0..B init |
00004200  20 20 20 20 3b 20 4a 75  6d 70 73 20 74 6f 20 74  |    ; Jumps to t|
00004210  68 65 20 69 6e 69 74 69  61 6c 69 73 61 74 69 6f  |he initialisatio|
00004220  6e 20 72 6f 75 74 69 6e  65 2e 0a 20 20 20 20 20  |n routine..     |
00004230  20 20 20 20 20 20 3b 20  74 68 69 73 20 69 73 20  |      ; this is |
00004240  6c 6f 63 61 74 69 6f 6e  20 63 6f 64 65 2b 31 30  |location code+10|
00004250  30 0a 0a 42 20 73 68 75  74 64 6f 77 6e 20 3b 20  |0..B shutdown ; |
00004260  4a 75 6d 70 73 20 74 6f  20 74 68 65 20 73 68 75  |Jumps to the shu|
00004270  74 64 6f 77 6e 20 72 6f  75 74 69 6e 65 2e 0a 20  |tdown routine.. |
00004280  20 20 20 20 20 20 20 20  20 20 3b 20 74 68 69 73  |          ; this|
00004290  20 69 73 20 6c 6f 63 61  74 69 6f 6e 20 63 6f 64  | is location cod|
000042a0  65 2b 31 30 34 0a 0a 3b  2d 2d 2d 2d 2d 2d 2d 2d  |e+104..;--------|
000042b0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000042d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 0a 0a 2e 70 6f 6c 6c  |---------...poll|
000042e0  20 3b 20 74 68 69 73 20  69 73 20 6c 6f 63 61 74  | ; this is locat|
000042f0  69 6f 6e 20 63 6f 64 65  2b 31 30 38 20 62 79 74  |ion code+108 byt|
00004300  65 73 0a 0a 41 44 52 20  72 31 31 2c 72 65 67 73  |es..ADR r11,regs|
00004310  20 20 20 20 20 20 20 20  20 3b 20 61 64 64 72 65  |         ; addre|
00004320  73 73 20 72 30 20 74 6f  20 73 70 61 63 65 20 74  |ss r0 to space t|
00004330  6f 20 68 6f 6c 64 20 72  65 67 73 2e 0a 53 54 4d  |o hold regs..STM|
00004340  49 41 20 72 31 31 2c 7b  72 31 2d 72 31 34 7d 20  |IA r11,{r1-r14} |
00004350  20 20 3b 20 70 72 65 73  65 72 76 65 20 72 65 67  |  ; preserve reg|
00004360  73 2e 0a 0a 3b 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |s...;-----------|
00004370  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000043a0  2d 2d 2d 2d 2d 2d 2d 2d  2d 0a 3b 20 20 20 20 20  |---------.;     |
000043b0  20 20 20 20 20 20 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |      **********|
000043c0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
000043e0  2a 2a 0a 3b 20 20 20 20  20 20 20 20 20 20 20 2a  |**.;           *|
000043f0  2a 2a 20 59 4f 55 52 20  53 49 4e 47 4c 45 20 50  |** YOUR SINGLE P|
00004400  4f 4c 4c 49 4e 47 20 43  4f 44 45 20 53 54 41 52  |OLLING CODE STAR|
00004410  54 53 20 48 45 52 45 20  2a 2a 2a 0a 3b 20 20 20  |TS HERE ***.;   |
00004420  20 20 20 20 20 20 20 20  2a 2a 2a 2a 2a 2a 2a 2a  |        ********|
00004430  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00004450  2a 2a 2a 2a 0a 3b 20 20  20 20 20 20 20 20 20 20  |****.;          |
00004460  20 20 41 74 20 74 68 69  73 20 6d 6f 6d 65 6e 74  |  At this moment|
00004470  20 72 30 20 3d 20 72 61  6e 64 6f 6d 20 69 6e 74  | r0 = random int|
00004480  20 30 2d 73 63 72 2e 77  69 64 74 68 0a 3b 20 20  | 0-scr.width.;  |
00004490  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000044a0  20 20 20 20 20 20 20 20  20 72 31 20 3d 20 72 61  |         r1 = ra|
000044b0  6e 64 6f 6d 20 69 6e 74  20 30 2d 73 63 72 2e 68  |ndom int 0-scr.h|
000044c0  65 69 67 68 74 0a 3b 20  20 20 20 20 20 20 20 20  |eight.;         |
000044d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000044e0  20 20 72 32 20 3d 20 6e  65 78 74 20 67 63 6f 6c  |  r2 = next gcol|
000044f0  20 6e 75 6d 62 65 72 0a  3b 20 20 20 20 20 20 20  | number.;       |
00004500  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004510  20 20 20 20 72 33 20 3d  20 6e 65 78 74 20 74 69  |    r3 = next ti|
00004520  6e 74 20 6e 75 6d 62 65  72 0a 3b 0a 3b 20 20 20  |nt number.;.;   |
00004530  20 20 20 20 20 20 20 20  20 62 6c 61 68 21 20 62  |         blah! b|
00004540  6c 61 68 21 20 62 6c 61  68 21 20 62 6c 61 68 21  |lah! blah! blah!|
00004550  20 62 6c 61 68 21 20 62  6c 61 68 21 20 62 6c 61  | blah! blah! bla|
00004560  68 21 0a 3b 0a 3b 20 20  20 20 20 20 20 20 20 20  |h!.;.;          |
00004570  20 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  | ***************|
00004580  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
00004590  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 0a 3b 20  |*************.; |
000045a0  20 20 20 20 20 20 20 20  20 20 2a 2a 2a 20 20 59  |          ***  Y|
000045b0  4f 55 52 20 53 49 4e 47  4c 45 20 50 4f 4c 4c 49  |OUR SINGLE POLLI|
000045c0  4e 47 20 43 4f 44 45 20  45 4e 44 53 20 48 45 52  |NG CODE ENDS HER|
000045d0  45 20 20 2a 2a 2a 0a 3b  20 20 20 20 20 20 20 20  |E  ***.;        |
000045e0  20 20 20 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |   *************|
000045f0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
00004600  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 0a  |***************.|
00004610  3b 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |;---------------|
00004620  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00004650  2d 2d 2d 2d 2d 0a 0a 41  44 52 20 72 31 31 2c 72  |-----..ADR r11,r|
00004660  65 67 73 20 20 20 20 20  20 20 20 3b 20 61 64 64  |egs        ; add|
00004670  72 65 73 73 20 72 30 20  74 6f 20 73 70 61 63 65  |ress r0 to space|
00004680  20 74 6f 20 68 6f 6c 64  20 72 65 67 73 2e 0a 4c  | to hold regs..L|
00004690  44 4d 49 41 20 72 31 31  2c 7b 72 31 2d 72 31 34  |DMIA r11,{r1-r14|
000046a0  7d 20 20 3b 20 72 65 73  74 6f 72 65 20 72 65 67  |}  ; restore reg|
000046b0  73 2e 0a 4d 4f 56 20 50  43 2c 72 31 34 20 20 20  |s..MOV PC,r14   |
000046c0  20 20 20 20 20 20 20 3b  20 65 78 69 74 20 70 6f  |       ; exit po|
000046d0  6c 6c 69 6e 67 20 63 6f  64 65 2e 0a 0a 3b 2d 2d  |lling code...;--|
000046e0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00004720  2d 2d 0a 0a 2e 69 6e 69  74 20 3b 20 74 68 65 20  |--...init ; the |
00004730  69 6e 69 74 69 61 6c 69  73 61 74 69 6f 6e 20 63  |initialisation c|
00004740  6f 64 65 0a 0a 3b 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |ode..;----------|
00004750  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00004780  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 0a 3b 20 20 20 20  |----------.;    |
00004790  20 20 20 20 20 20 20 2a  2a 2a 2a 2a 2a 2a 2a 2a  |       *********|
000047a0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
000047c0  2a 2a 2a 0a 3b 20 20 20  20 20 20 20 20 20 20 20  |***.;           |
000047d0  2a 2a 2a 20 59 4f 55 52  20 49 4e 49 54 49 41 4c  |*** YOUR INITIAL|
000047e0  49 53 41 54 49 4f 4e 20  43 4f 44 45 20 53 54 41  |ISATION CODE STA|
000047f0  52 54 53 20 48 45 52 45  20 2a 2a 2a 0a 3b 20 20  |RTS HERE ***.;  |
00004800  20 20 20 20 20 20 20 20  20 2a 2a 2a 2a 2a 2a 2a  |         *******|
00004810  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00004830  2a 2a 2a 2a 2a 0a 3b 20  20 20 20 20 20 20 20 20  |*****.;         |
00004840  20 20 20 20 20 20 41 74  20 74 68 69 73 20 6d 6f  |      At this mo|
00004850  6d 65 6e 74 20 72 30 20  3d 20 73 63 72 65 65 6e  |ment r0 = screen|
00004860  20 77 69 64 74 68 0a 3b  20 20 20 20 20 20 20 20  | width.;        |
00004870  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004880  20 20 20 20 20 20 72 31  20 3d 20 73 63 72 65 65  |      r1 = scree|
00004890  6e 20 68 65 69 67 68 74  0a 3b 20 20 20 20 20 20  |n height.;      |
000048a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000048b0  20 20 20 20 20 20 20 20  72 32 20 3d 20 6e 75 6d  |        r2 = num|
000048c0  62 65 72 20 6f 66 20 63  6f 6c 6f 75 72 73 0a 3b  |ber of colours.;|
000048d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000048e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 72 33  |              r3|
000048f0  20 3d 20 73 63 72 65 65  6e 20 62 61 73 65 20 61  | = screen base a|
00004900  64 64 72 65 73 73 0a 3b  20 20 20 20 20 20 20 20  |ddress.;        |
00004910  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004920  20 20 20 20 20 20 72 34  20 3d 20 73 63 72 65 65  |      r4 = scree|
00004930  6e 73 69 7a 65 20 69 6e  20 62 79 74 65 73 0a 3b  |nsize in bytes.;|
00004940  0a 3b 20 20 20 20 20 20  20 20 20 20 20 20 62 6c  |.;            bl|
00004950  61 68 21 20 62 6c 61 68  21 20 62 6c 61 68 21 20  |ah! blah! blah! |
00004960  62 6c 61 68 21 20 62 6c  61 68 21 20 62 6c 61 68  |blah! blah! blah|
00004970  21 20 62 6c 61 68 21 0a  3b 0a 3b 20 20 20 20 20  |! blah!.;.;     |
00004980  20 20 20 20 20 20 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |      **********|
00004990  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
000049b0  2a 2a 0a 3b 20 20 20 20  20 20 20 20 20 20 20 2a  |**.;           *|
000049c0  2a 2a 20 20 59 4f 55 52  20 49 4e 49 54 49 41 4c  |**  YOUR INITIAL|
000049d0  49 53 41 54 49 4f 4e 20  43 4f 44 45 20 45 4e 44  |ISATION CODE END|
000049e0  53 20 48 45 52 45 20 20  2a 2a 2a 0a 3b 20 20 20  |S HERE  ***.;   |
000049f0  20 20 20 20 20 20 20 20  2a 2a 2a 2a 2a 2a 2a 2a  |        ********|
00004a00  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00004a20  2a 2a 2a 2a 0a 3b 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |****.;----------|
00004a30  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00004a60  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 0a 0a 3b 2d 2d 2d  |----------..;---|
00004a70  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00004ab0  2d 0a 0a 3b 20 79 6f 75  20 68 61 76 65 20 74 6f  |-..; you have to|
00004ac0  20 64 6f 20 74 68 69 73  20 68 65 72 65 20 69 66  | do this here if|
00004ad0  20 79 6f 75 20 77 61 6e  74 20 74 6f 20 75 73 65  | you want to use|
00004ae0  20 6d 79 20 27 2e 53 65  74 43 6f 6c 27 20 63 6f  | my '.SetCol' co|
00004af0  64 65 0a 0a 41 44 52 20  72 33 2c 6e 6f 63 6f 6c  |de..ADR r3,nocol|
00004b00  73 0a 53 54 52 20 72 32  2c 5b 72 33 5d 20 20 20  |s.STR r2,[r3]   |
00004b10  3b 20 73 74 6f 72 65 20  6e 75 6d 62 65 72 20 6f  |; store number o|
00004b20  66 20 63 6f 6c 6f 75 72  73 20 74 6f 20 53 65 74  |f colours to Set|
00004b30  43 6f 6c 20 64 61 74 61  20 62 6c 6f 63 6b 2e 0a  |Col data block..|
00004b40  0a 3b 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |.;--------------|
00004b50  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00004b80  2d 2d 2d 2d 2d 2d 0a 0a  4d 4f 56 20 50 43 2c 72  |------..MOV PC,r|
00004b90  31 34 20 3b 20 65 78 69  74 20 69 6e 69 74 69 61  |14 ; exit initia|
00004ba0  6c 69 73 61 74 69 6f 6e  2e 0a 0a 3b 2d 2d 2d 2d  |lisation...;----|
00004bb0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00004be0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 0a 0a 2e  |-------------...|
00004bf0  73 68 75 74 64 6f 77 6e  20 3b 20 74 68 65 20 73  |shutdown ; the s|
00004c00  68 75 74 64 6f 77 6e 20  63 6f 64 65 0a 0a 3b 2d  |hutdown code..;-|
00004c10  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00004c50  2d 2d 2d 0a 3b 20 20 20  20 20 20 20 20 20 20 20  |---.;           |
00004c60  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00004c80  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 0a 3b 20 20  |************.;  |
00004c90  20 20 20 20 20 20 20 20  20 2a 2a 2a 20 20 20 20  |         ***    |
00004ca0  59 4f 55 52 20 53 48 55  54 44 4f 57 4e 20 43 4f  |YOUR SHUTDOWN CO|
00004cb0  44 45 20 53 54 41 52 54  53 20 48 45 52 45 20 20  |DE STARTS HERE  |
00004cc0  20 20 2a 2a 2a 0a 3b 20  20 20 20 20 20 20 20 20  |  ***.;         |
00004cd0  20 20 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |  **************|
00004ce0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
00004cf0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 0a 0a  |**************..|
00004d00  3b 20 20 20 20 20 20 20  20 20 20 20 20 62 6c 61  |;            bla|
00004d10  68 21 20 62 6c 61 68 21  20 62 6c 61 68 21 20 62  |h! blah! blah! b|
00004d20  6c 61 68 21 20 62 6c 61  68 21 20 62 6c 61 68 21  |lah! blah! blah!|
00004d30  20 62 6c 61 68 21 0a 0a  3b 20 20 20 20 20 20 20  | blah!..;       |
00004d40  20 20 20 20 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |    ************|
00004d50  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00004d70  0a 3b 20 20 20 20 20 20  20 20 20 20 20 2a 2a 2a  |.;           ***|
00004d80  20 20 20 20 20 59 4f 55  52 20 53 48 55 54 44 4f  |     YOUR SHUTDO|
00004d90  57 4e 20 43 4f 44 45 20  45 4e 44 53 20 48 45 52  |WN CODE ENDS HER|
00004da0  45 20 20 20 20 20 2a 2a  2a 0a 3b 20 20 20 20 20  |E     ***.;     |
00004db0  20 20 20 20 20 20 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |      **********|
00004dc0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00004de0  2a 2a 0a 3b 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |**.;------------|
00004df0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00004e20  2d 2d 2d 2d 2d 2d 2d 2d  0a 4d 4f 56 20 50 43 2c  |--------.MOV PC,|
00004e30  72 31 34 20 3b 20 65 78  69 74 20 73 68 75 74 64  |r14 ; exit shutd|
00004e40  6f 77 6e 20 63 6f 64 65  2e 0a 0a 2e 72 65 67 73  |own code....regs|
00004e50  0a 45 51 55 44 20 30 3a  45 51 55 44 20 30 3a 45  |.EQUD 0:EQUD 0:E|
00004e60  51 55 44 20 30 3a 45 51  55 44 20 30 3a 45 51 55  |QUD 0:EQUD 0:EQU|
00004e70  44 20 30 3a 45 51 55 44  20 30 3a 45 51 55 44 20  |D 0:EQUD 0:EQUD |
00004e80  30 3a 45 51 55 44 20 30  0a 45 51 55 44 20 30 3a  |0:EQUD 0.EQUD 0:|
00004e90  45 51 55 44 20 30 3a 45  51 55 44 20 30 3a 45 51  |EQUD 0:EQUD 0:EQ|
00004ea0  55 44 20 30 3a 45 51 55  44 20 30 3a 45 51 55 44  |UD 0:EQUD 0:EQUD|
00004eb0  20 30 3a 45 51 55 44 20  30 3a 45 51 55 44 20 30  | 0:EQUD 0:EQUD 0|
00004ec0  0a 0a 0a 3b 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |...;------------|
00004ed0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00004f00  2d 2d 2d 2d 2d 2d 2d 2d  0a 3b 20 54 48 45 20 43  |--------.; THE C|
00004f10  4f 44 45 20 42 45 4c 4f  57 20 43 41 4e 20 42 45  |ODE BELOW CAN BE|
00004f20  20 43 41 4c 4c 45 44 20  52 45 50 45 41 54 45 44  | CALLED REPEATED|
00004f30  4c 59 20 54 4f 20 53 45  54 20 54 48 45 20 4e 45  |LY TO SET THE NE|
00004f40  58 54 20 47 43 4f 4c 2e  0a 3b 2d 2d 2d 2d 2d 2d  |XT GCOL..;------|
00004f50  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00004f80  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 0a 0a  |--------------..|
00004f90  2e 6e 6f 63 6f 6c 73 0a  45 51 55 44 20 32 3a 45  |.nocols.EQUD 2:E|
00004fa0  51 55 44 20 31 3a 45 51  55 44 20 30 0a 2e 53 65  |QUD 1:EQUD 0..Se|
00004fb0  74 43 6f 6c 0a 4c 44 52  20 38 2c 5b 50 43 2c 23  |tCol.LDR 8,[PC,#|
00004fc0  28 2d 32 30 29 5d 3a 4c  44 52 20 39 2c 5b 50 43  |(-20)]:LDR 9,[PC|
00004fd0  2c 23 28 2d 32 30 29 5d  3a 4c 44 52 20 31 30 2c  |,#(-20)]:LDR 10,|
00004fe0  5b 50 43 2c 23 28 2d 32  30 29 5d 0a 43 4d 50 53  |[PC,#(-20)].CMPS|
00004ff0  20 38 2c 23 32 35 36 3a  42 4c 54 20 6c 65 73 73  | 8,#256:BLT less|
00005000  74 68 61 6e 32 35 36 0a  53 57 49 20 32 35 36 2b  |than256.SWI 256+|
00005010  31 38 3a 53 57 49 20 32  35 36 3a 4d 4f 56 20 72  |18:SWI 256:MOV r|
00005020  30 2c 39 3a 53 57 49 20  22 4f 53 5f 57 72 69 74  |0,9:SWI "OS_Writ|
00005030  65 43 22 0a 53 57 49 20  32 35 36 2b 32 33 3a 53  |eC".SWI 256+23:S|
00005040  57 49 20 32 35 36 2b 31  37 3a 53 57 49 20 32 35  |WI 256+17:SWI 25|
00005050  36 2b 32 3a 4d 4f 56 20  72 30 2c 31 30 3a 53 57  |6+2:MOV r0,10:SW|
00005060  49 20 22 4f 53 5f 57 72  69 74 65 43 22 0a 53 57  |I "OS_WriteC".SW|
00005070  49 20 32 35 36 3a 53 57  49 20 32 35 36 3a 53 57  |I 256:SWI 256:SW|
*
00005090  49 20 32 35 36 3a 53 57  49 20 32 35 36 0a 41 44  |I 256:SWI 256.AD|
000050a0  44 20 31 30 2c 31 30 2c  23 36 34 3a 43 4d 50 53  |D 10,10,#64:CMPS|
000050b0  20 31 30 2c 23 32 35 36  3a 4d 4f 56 45 51 20 31  | 10,#256:MOVEQ 1|
000050c0  30 2c 23 30 3a 41 44 44  45 51 20 39 2c 39 2c 23  |0,#0:ADDEQ 9,9,#|
000050d0  31 3a 43 4d 50 53 20 39  2c 23 36 34 0a 4d 4f 56  |1:CMPS 9,#64.MOV|
000050e0  47 45 20 39 2c 23 31 3a  53 54 52 20 39 2c 5b 50  |GE 9,#1:STR 9,[P|
000050f0  43 2c 23 28 2d 31 32 30  29 5d 3a 53 54 52 20 31  |C,#(-120)]:STR 1|
00005100  30 2c 5b 50 43 2c 23 28  2d 31 32 30 29 5d 3a 4d  |0,[PC,#(-120)]:M|
00005110  4f 56 20 50 43 2c 72 31  34 0a 2e 6c 65 73 73 74  |OV PC,r14..lesst|
00005120  68 61 6e 32 35 36 3a 53  57 49 20 32 35 36 2b 31  |han256:SWI 256+1|
00005130  38 3a 53 57 49 20 32 35  36 3a 4d 4f 56 20 72 30  |8:SWI 256:MOV r0|
00005140  2c 39 3a 53 57 49 20 22  4f 53 5f 57 72 69 74 65  |,9:SWI "OS_Write|
00005150  43 22 0a 41 44 44 20 39  2c 39 2c 23 31 3a 43 4d  |C".ADD 9,9,#1:CM|
00005160  50 53 20 39 2c 38 3a 4d  4f 56 47 45 20 39 2c 23  |PS 9,8:MOVGE 9,#|
00005170  31 3a 53 54 52 20 39 2c  5b 50 43 2c 23 28 2d 31  |1:STR 9,[PC,#(-1|
00005180  36 30 29 5d 3a 4d 4f 56  20 50 43 2c 72 31 34 0a  |60)]:MOV PC,r14.|
00005190  0a 5d 0a 4e 45 58 54 20  70 61 73 73 0a 0a 50 52  |.].NEXT pass..PR|
000051a0  49 4e 54 20 63 6f 64 65  25 2c 50 25 0a 0a 45 4e  |INT code%,P%..EN|
000051b0  44 50 52 4f 43 0a 0a 0a  20                       |DPROC... |
000051b9