Home » Archimedes archive » Acorn User » AU 1998-13 (Christmas).adf » Regulars » StarInfo/Kennedy/CrazySrc

StarInfo/Kennedy/CrazySrc

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 1998-13 (Christmas).adf » Regulars
Filename: StarInfo/Kennedy/CrazySrc
Read OK:
File size: 12298 bytes
Load address: 0000
Exec address: 0000
File contents
   10REM File        : CrazySrc
   20REM Date        : 10-Jun-98
   30REM Author      : LEN A.Thoukydides, 1997
   40REM Description : Change the pointer appearance.
   50REM               This is inspired by MouseP written by Andrew Bolt
   60REM               from the *Info section of Acorn User magazine, June 1997.
   70
   80REM Modified    : Nick Kennedy, 1998
   90REM               This now works on pre RiscOS 3.60 machines, and exits correctly
  100REM               if there is an error on initialisation.
  110
  120REM The filename to save the module under
  130filename$ = "CrazyPoint"
  140
  150REM Allocate memory to assemble the module
  160code_size% = &2000
  170DIM code% code_size%
  180
  190REM Interval between updates in centiseconds (minimum 2)
  200interval=4
  210
  220REM Pointer types
  230ptr_unknown = 0
  240ptr_single = 1
  250ptr_double = 2
  260ptr_caret = 3
  270ptr_menu = 4
  280
  290REM Pointer colours
  300colour_trans = 0
  310colour_cyan = &55
  320colour_blue = &aa
  330colour_red = &ff
  340colour_trans_cyan = &11
  350colour_trans_blue = &22
  360colour_trans_red = &33
  370
  380REM Usage of workspace
  390ws_internal = 0
  400ws_types = 4
  410ws_hpos = 12
  420ws_vpos = 16
  430ws_xeig = 20
  440ws_yeig = 24
  450ws_ceig = 28
  460ws_filtn = 32
  470ws_filtv = 36
  480ws_cogr = 40
  490ws_cogc = 44
  500ws_friction = 48
  510ws_spring = 52
  520ws_force = 56
  530ws_ptr_block = 60 + 2
  540ws_ptr_block_shape = ws_ptr_block + 1
  550ws_ptr_block_width = ws_ptr_block + 2
  560ws_ptr_block_height = ws_ptr_block + 3
  570ws_ptr_block_activex = ws_ptr_block + 4
  580ws_ptr_block_activey = ws_ptr_block + 5
  590ws_ptr_block_data = ws_ptr_block + 6
  600ws_buffer = ws_ptr_block + 10
  610ws_buffer_size = 256
  620ws_ptr_data = ws_buffer + ws_buffer_size
  630ws_ptr_data_size = 256
  640ws_size = ws_ptr_data + ws_ptr_data_size
  650
  660REM Multi-pass assembly
  670FOR opt% = 12 TO 14 STEP 2
  680    P% = 0
  690    O% = code%
  700    L% = code% + code_size%
  710    [OPT opt%
  720
  730        ; Module header
  740        EQUD    0                       ; Start code
  750        EQUD    initialisation          ; Initialisation code
  760        EQUD    finalisation            ; Finalisation code
  770        EQUD    service                 ; Service call handler
  780        EQUD    title                   ; Title string
  790        EQUD    help                    ; Help string
  800        EQUD    command                 ; Help and command table
  810        EQUD    0                       ; SWI chunk base number
  820        EQUD    0                       ; SWI handler code
  830        EQUD    0                       ; SWI decoding table
  840        EQUD    0                       ; SWI decoding code
  850
  860        ; Title string
  870.title  EQUS    "CrazyPointer"
  880        EQUB    0
  890
  900
  910        ; Help string
  920.help   EQUS    "Crazy Pointer" + CHR$9 + "1.02 (10 Jun 1998)"
  930        EQUS    " " + CHR$169 + " A.Thoukydides, 1997"
  940        EQUB    0
  950        ALIGN
  960        
  970        ; Help and command keyword table
  980.command
  990        EQUS    "CrazyPointer"          ; Command name
 1000        EQUB    0
 1010        ALIGN
 1020        EQUD    0                       ; Offset to code
 1030        EQUD    &0                      ; Information word
 1040        EQUD    0                       ; Offset to syntax message
 1050        EQUD    command_help            ; Offset to help text
 1060        
 1070        EQUS    "CrazyPointerWobble"    ; Command name
 1080        EQUB    0
 1090        ALIGN
 1100        EQUD    command_wobble          ; Offset to code
 1110        EQUD    &00070001               ; Information word
 1120        EQUD    command_wobble_syntax   ; Offset to syntax message
 1130        EQUD    command_wobble_help     ; Offset to help text
 1140        
 1150        EQUB    0                       ; Terminate the list of keywords
 1160
 1170        ; Help for the CrazyPointer keyword
 1180.command_help
 1190        EQUS    "Crazy Pointer provides animated mouse pointers."
 1200        EQUS    " Replacements are provided for the standard, double-click,"
 1210        EQUS    " and caret pointers."
 1220        EQUB    13
 1230        EQUS    "This module is inspired by MouseP written by Andrew Bolt"
 1240        EQUS    " and published in the June 1997 *Info section of Acorn User."
 1250        EQUB    0
 1260        ALIGN
 1270
 1280        ; The *CrazyPointerWobble command
 1290.command_wobble
 1300        STMFD   r13!, {r14}             ; Stack registers
 1310        SUB     r13, r13, #48           ; Reserve some stack space
 1320        LDR     r12, [r12]              ; Obtain pointer to workspace
 1330        MOV     r1, r0                  ; Copy the command tail pointer
 1340        ADR     r0, command_wobble_def  ; Pointer to keyword definition
 1350        MOV     r2, r13                 ; Pointer to output buffer
 1360        MOV     r3, #48                 ; Size of the output buffer
 1370        SWI     "XOS_ReadArgs"          ; Scan the command string
 1380        BVS     command_wobble_done     ; Return from handler if error
 1390        LDR     r0, [r2], #4            ; Check if wobble is disabled
 1400        TEQ     r0, #0                  ; Is wobble being disabled
 1410        BNE     command_wobble_disable  ; Disable the pointer wobble if required
 1420        LDR     r0, [r2], #4            ; Read friction pointer
 1430        TEQ     r0, #0                  ; Was a value specified
 1440        BEQ     command_wobble_spring   ; Skip this bit if not
 1450        LDRB    r1, [r0], #1            ; Read the type
 1460        TEQ     r1, #0                  ; Is the value an integer
 1470        BNE     command_wobble_fail     ; Generate an error if not
 1480        FNldru(1, 0, 3, 4)              ; Read the friction value
 1490        STR     r1, [r12, #ws_friction] ; Store the friction value
 1500.command_wobble_spring
 1510        LDR     r0, [r2], #4            ; Read spring pointer
 1520        TEQ     r0, #0                  ; Was a value specified
 1530        BEQ     command_wobble_force    ; Skip this bit if not
 1540        LDRB    r1, [r0], #1            ; Read the type
 1550        TEQ     r1, #0                  ; Is the value an integer
 1560        BNE     command_wobble_fail     ; Generate an error if not
 1570        FNldru(1, 0, 3, 4)              ; Read the spring value
 1580        STR     r1, [r12, #ws_spring]   ; Store the spring value
 1590.command_wobble_force
 1600        LDR     r0, [r2], #4            ; Read force pointer
 1610        TEQ     r0, #0                  ; Was a value specified
 1620        BEQ     command_wobble_done     ; Skip this bit if not
 1630        LDRB    r1, [r0], #1            ; Read the type
 1640        TEQ     r1, #0                  ; Is the value an integer
 1650        BNE     command_wobble_fail     ; Generate an error if not
 1660        FNldru(1, 0, 3, 4)              ; Read the force value
 1670        STR     r1, [r12, #ws_force]    ; Store the force value
 1680.command_wobble_done
 1690        ADD     r13, r13, #48           ; Skip back over the reserved space
 1700        LDMFD   r13!, {pc}              ; Return from the command handler
 1710.command_wobble_disable
 1720        MOV     r0, #0                  ; Value to clear filter with
 1730        STR     r0, [r12, #ws_filtn]    ; Clear any existing wibble
 1740        STR     r0, [r12, #ws_filtv]    ; Clear any existing wibble velocity
 1750        MOV     r0, #32                 ; Value to disable wobble
 1760        STR     r0, [r12, #ws_force]    ; Clear the force multiplier
 1770        B       command_wobble_done     ; Return from the command handler
 1780.command_wobble_fail
 1790        ADR     r0, command_wobble_error; Pointer to error block
 1800        CMP     pc, #&80000000          ; Set the overflow flag for an error
 1810        B       command_wobble_done     ; Return from the command handler
 1820.command_wobble_error
 1830        EQUD    0
 1840        EQUS    "Invalid command parameters"
 1850        EQUB    0
 1860        ALIGN
 1870.command_wobble_def
 1880        EQUS    "nowobble/s,friction/e,spring/e,force/e"
 1890        EQUB    0
 1900.command_wobble_help
 1910        EQUS    "*CrazyPointerWobble allows the pointer wobble to be"
 1920        EQUS    " controlled by setting three constants."
 1930        EQUS    " These are all specified on a logarithmic scale in the range"
 1940        EQUS    " 0 to 10, with a value of 5 being the default."
 1950        EQUB    13
 1960.command_wobble_syntax
 1970        EQUS    "Syntax: *CrazyPointerWobble [-nowobble]"
 1980        EQUS    " [[-friction] <value>]"
 1990        EQUS    " [[-spring] <value>]"
 2000        EQUS    " [[-force] <value>]"
 2010        EQUB    0
 2020        ALIGN
 2030
 2040        ; Initialisation code
 2050.initialisation
 2060        STMFD   r13!, {r11, r14}        ; Stack registers
 2070        MOV     r0, #6                  ; Reason code to claim memory
 2080        MOV     r3, #ws_size            ; The size of workspace required
 2090        SWI     "XOS_Module"            ; Claim some module workspace
 2100        MOVVS   r11, r0                 ; Copy any error pointer
 2110        BVS     fail_ws                 ; Fail if an error was produced
 2120        STR     r2, [r12]               ; Store workspace pointer
 2130        MOV     r12, r2                 ; Copy the workspace pointer
 2140        MOV     r0, #0                  ; Value to clear flags with
 2150        STR     r0, [r12, #ws_internal] ; Clear the internal operation flag
 2160        STRB    r0, [r12, #ws_ptr_block]; Reason code to set pointer shape
 2170        STRB    r0, [r12, #ws_ptr_block_activex]; Store horizontal hotspot
 2180        STRB    r0, [r12, #ws_ptr_block_activey]; Store vertical hotspot
 2190        STR     r0, [r12, #ws_filtn]    ; Initially no wibble
 2200        STR     r0, [r12, #ws_filtv]    ; Initially no wibble velocity
 2210        MOV     r0, #5                  ; The default configuration
 2220        STR     r0, [r12, #ws_friction] ; The default friction
 2230        STR     r0, [r12, #ws_spring]   ; The default spring strength
 2240        STR     r0, [r12, #ws_force]    ; The default force
 2250        MVN     r0, #&9f000             ; Initial centre row offset
 2260        STR     r0, [r12, #ws_cogr]     ; Initial row offset to centre
 2270        MVN     r0, #&4a000             ; Initial centre column offset
 2280        STR     r0, [r12, #ws_cogc]     ; Initial column offset to centre
 2290        MOV     r0, #ptr_unknown        ; Most pointers are unknown initially
 2300        STRB    r0, [r12, #ws_types]    ; Shape 0 is not a pointer
 2310        STRB    r0, [r12, #ws_types + 2]; Shape 2 is unknown
 2320        STRB    r0, [r12, #ws_types + 3]; Shape 3 is unknown
 2330        STRB    r0, [r12, #ws_types + 4]; Shape 4 is unknown
 2340        MOV     r0, #ptr_single         ; The standard desktop pointer
 2350        STRB    r0, [r12, #ws_types + 1]; Assume shape 1 is the standard one
 2360        MOV     r0, #8                  ; Width of pointer in bytes
 2370        STRB    r0, [r12, #ws_ptr_block_width]; Store width of pointer
 2380        MOV     r0, #32                 ; Height of pointer in pixels
 2390        STRB    r0, [r12, #ws_ptr_block_height]; Store height of pointer
 2400        ADD     r0, r12, #ws_ptr_data   ; Pointer to pointer data        
 2410        STR     r0, [r12, #ws_ptr_block_data]; Store pointer to the data
 2420        MOV     r0, #21                 ; Reason code to read pointer position
 2430        ADD     r1, r12, #ws_buffer     ; Pointer to a buffer
 2440        MOV     r2, #6                  ; Reason code to read pointer position
 2450        STRB    r2, [r1]                ; Store reason code in buffer
 2460        SWI     "XOS_Word"              ; Read pointer position
 2470        MOVVS   r11, r0                 ; Copy any error pointer
 2480        BVS     fail_position           ; Fail if an error was produced
 2490        LDRB    r2, [r1, #1]            ; Read LSB of horizontal position
 2500        LDRB    r3, [r1, #2]            ; Read MSB of horizontal position
 2510        ORR     r2, r2, r3, ASL#8       ; Combine horizontal position
 2520        MOV     r2, r2, ASL#16          ; Scale the horizontal position up
 2530        STR     r2, [r12, #ws_hpos]     ; Store the initial horizontal position
 2540        LDRB    r2, [r1, #3]            ; Read LSB of vertical position
 2550        LDRB    r3, [r1, #4]            ; Read MSB of vertical position
 2560        ORR     r2, r2, r3, ASL#8       ; Combine vertical position
 2570        MOV     r2, r2, ASL#16          ; Scale the vertical position up
 2580        STR     r2, [r12, #ws_vpos]     ; Store the initial vertical position
 2590        BL      read_vdu                ; Read the pixel scalings
 2600        MOVVS   r11, r0                 ; Copy any error pointer
 2610        BVS     fail_vdu                ; Fail if an error was produced
 2620        MOV     r0, #interval-1         ; Time interval of 'interval' centiseconds
 2630        ADR     r1, update              ; Address of the update routine
 2640        MOV     r2, r12                 ; Value of r12 used by the handler
 2650        SWI     "XOS_CallEvery"         ; Claim the event vector
 2660        MOVVS   r11, r0                 ; Copy any error pointer
 2670        BVS     fail_eventv             ; Fail if an error was produced
 2680        MOV     r0, #&1f                ; Number of the SpriteV vector
 2690        ADR     r1, spritev_handler     ; Address of the handler routine
 2700        MOV     r2, r12                 ; Value of r12 used by the handler
 2710        SWI     "XOS_Claim"             ; Claim the OS_SpriteOp vector
 2720        MOVVS   r11, r0                 ; Copy any error pointer
 2730        BVS     fail_spritev            ; Fail if an error was produced
 2740        MOV     r0, #&07                ; Number of the WordV vector
 2750        ADR     r1, wordv_handler       ; Address of the handler routine
 2760        MOV     r2, r12                 ; Value of r12 used by the handler
 2770        SWI     "XOS_Claim"             ; Claim the OS_Word vector
 2780        MOVVS   r11, r0                 ; Copy any error pointer
 2790        BVS     fail_wordv              ; Fail if an error was produced
 2800;       MOV     r0, #14                 ; OS_Byte code to enable an event
 2810;       MOV     r1, #4                  ; The vsync event number
 2820;       SWI     "XOS_Byte"              ; Enable the vertical sync event
 2830;       MOVVS   r11, r0                 ; Copy any error pointer
 2840;       BVS     fail_vsync              ; Fail if an error was produced
 2850        LDMFD   r13!, {r11, pc}         ; Return to RISC OS
 2860
 2870        ; Finalisation code
 2880.finalisation
 2890        STMFD   r13!, {r11, r14}        ; Stack registers
 2900        LDR     r12, [r12]              ; Obtain workspace pointer
 2910        MOV     r11, #0                 ; Clear the error pointer
 2920;        MOV     r0, #13                 ; OS_Byte code to disable an event
 2930;        MOV     r1, #4                  ; The vsync event number
 2940;        SWI     "XOS_Byte"              ; Disable the vertical sync event
 2950        BVS     exit                    ; Exit if an error was produced
 2960.fail_vsync
 2970        MOV     r0, #&07                ; Number of the WordV vector
 2980        ADR     r1, wordv_handler       ; Address of the handler routine
 2990        MOV     r2, r12                 ; Value of r12 used by the handler
 3000        SWI     "XOS_Release"           ; Release the OS_Word vector
 3010        BVS     exit                    ; Exit if an error was produced
 3020.fail_wordv
 3030        MOV     r0, #&1f                ; Number of the SpriteV vector
 3040        ADR     r1, spritev_handler     ; Address of the handler routine
 3050        MOV     r2, r12                 ; Value of r12 used by the handler
 3060        SWI     "XOS_Release"           ; Release the OS_SpriteOp vector
 3070        BVS     exit                    ; Exit if an error was produced
 3080.fail_spritev
 3090        ADR     r0, update              ; Address of the update routine
 3100        MOV     r1, r12                 ; Value of r12 used by the handler
 3110        SWI     "XOS_RemoveTickerEvent" ; Remove the ticker event
 3120        BVS     exit                    ; Exit if an error was produced
 3130.fail_eventv
 3140.fail_vdu
 3150.fail_position
 3160        MOV     r0, #7                  ; Reason code to release memory
 3170        MOV     r2, r12                 ; Copy the workspace pointer
 3180        SWI     "XOS_Module"            ; Release the workspace
 3190        BVS     exit                    ; Exit if an error was produced
 3200.fail_ws
 3210        TEQ     r11, #0                 ; Is there an error pointer
 3220        BEQ     exit                    ; Exit without error if not
 3230        MOV     r0, r11                 ; Copy the error pointer
 3240        CMP     pc, #&80000000          ; Set the overflow flag
 3250.exit   LDMFD   r13!, {r11, pc}         ; Return to RISC OS
 3260
 3270        ; Service call handler
 3280.service
 3290        TEQ     r1, #&46                ; Service_ModeChange
 3300        MOVNES  pc, r14                 ; Reject unrecognised calls quickly
 3310        LDR     r12, [r12]              ; Obtain workspace pointer
 3320        TEQ     r1, #&46                ; Service_ModeChange
 3330        BEQ     service_mode_change     ; Jump to handler for mode changes
 3340
 3350        ; Handle mode changes
 3360.service_mode_change
 3370        STMFD   r13!, {r14}             ; Stack registers
 3380        BL      read_vdu                ; Read the pixel scaling
 3390        LDMFD   r13!, {pc}^             ; Return from service call
 3400
 3410        ; Read the pixel scalings
 3420.read_vdu
 3430        STMFD   r13!, {r0-r3, r14}      ; Stack registers
 3440        MVN     r0, #0                  ; Read variables for current mode
 3450        MOV     r1, #4                  ; Variable number for XEigFactor
 3460        SWI     "XOS_ReadModeVariable"  ; Read the XEigFactor value
 3470        MOV     r3, r2                  ; Copy the XEigFactor value
 3480        MOV     r1, #5                  ; Variable number for YEigFactor
 3490        SWI     "XOS_ReadModeVariable"  ; Read the YEigFactor value
 3500        MOV     r0, #0                  ; Initialise the common eigen value
 3510.read_vdu_loop
 3520        TEQ     r2, #0                  ; Is the YEigFactor zero
 3530        TEQNE   r3, #0                  ; Is the XEigFactor zero
 3540        BEQ     read_vdu_done           ; Exit loop if common component removed
 3550        ADD     r0, r0, #1              ; Increment common component
 3560        SUB     r2, r2, #1              ; Decrement YEigFactor
 3570        SUB     r3, r3, #1              ; Decrement XEigFactor
 3580        B       read_vdu_loop           ; Keep looping until finished
 3590.read_vdu_done
 3600        STR     r0, [r12, #ws_ceig]     ; Store the common eigen value
 3610        STR     r3, [r12, #ws_xeig]     ; Store the adjusted XEigFactor
 3620        STR     r2, [r12, #ws_yeig]     ; Store the adjusted YEigFactor
 3630        LDMFD   r13!, {r0-r3, pc}^      ; Return from subroutine
 3640
 3650        ; EventV handler routine
 3660.eventv_handler
 3670;        STMFD   r13!, {r8-r9, r14}      ; Stack registers
 3680;        MOV     r9, pc                  ; Save the current status and mode
 3690;        ORR     r8, r9, #3              ; Derive the SVC-mode version
 3700;        TEQP    r8, #0                  ; Enter SVC mode
 3710;        MOV     r0, r0                  ; Allow the processor to adapt
 3720;        STMFD   r13!, {r14}             ; Save r14_svc
 3730;        BL      update                  ; Update the pointer shape
 3740;        LDMFD   r13!, {r14}             ; Restore r14_svc
 3750;        TEQP    r9, #0                  ; Reenter the original processor mode
 3760;        MOV     r0, r0                  ; Allow the processor to adapt again
 3770;        LDMFD   r13!, {r8-r9, pc}^      ; Pass on the call
 3780
 3790        ; SpriteV handler routine
 3800.spritev_handler
 3810        STMFD   r13!, {r2, r8-r11, r14} ; Stack registers
 3820        AND     r8, r0, #&ff            ; Mask out the reason code
 3830        TEQ     r8, #36                 ; Reason code to set the pointer shape
 3840        BNE     spritev_handler_done    ; Not interested in other reason codes
 3850        TST     r3, #&10                ; Is the shape being changed
 3860        BNE     spritev_handler_done    ; Not interested otherwise
 3870        AND     r8, r0, #&300           ; Get register interpretation
 3880        TEQ     r8, #512                ; Is it a pointer to the sprite
 3890        ADDEQ   r2, r2, #4              ; Advance pointer to the name
 3900        ADR     r8, pointers_start      ; Pointer to the first reference name
 3910.spritev_handler_loop
 3920        MOV     r9, #0                  ; Check from the first character
 3930.spritev_handler_char
 3940        LDRB    r10, [r2, r9]           ; Read pointer name character
 3950        LDRB    r11, [r8, r9]           ; Read reference name character
 3960        TEQ     r11, #0                 ; Is it the end of the reference
 3970        BEQ     spritev_handler_found   ; Complete match if it is
 3980        TEQ     r10, r11                ; Do the characters match
 3990        BNE     spritev_handler_next    ; Skip to the next reference if not
 4000        ADD     r9, r9, #1              ; Advance to the next character
 4010        TEQ     r9, #12                 ; Maximum length is twelve characters
 4020        BEQ     spritev_handler_found   ; All matched if reached this point
 4030        B       spritev_handler_char    ; Loop for the next character
 4040.spritev_handler_next
 4050        ADD     r8, r8, #16             ; Advance to the next record
 4060        ADR     r9, pointers_end        ; Pointer to the end of the list
 4070        TEQ     r8, r9                  ; Has the end been reached
 4080        BNE     spritev_handler_loop    ; There is another name to check
 4090        MOV     r2, #0                  ; No matching pointer name
 4100.spritev_handler_checked
 4110        AND     r8, r3, #&f             ; Extract the pointer number
 4120        ADD     r8, r8, #ws_types       ; Offset to type details
 4130        STRB    r2, [r12, r8]           ; Store the pointer type
 4140        TEQ     r2, #0                  ; Was a pointer match found
 4150        ORRNE   r3, r3, #&10            ; Clear the shape definition flag
 4160.spritev_handler_done
 4170        LDMFD   r13!, {r2, r8-r11, pc}^ ; Pass on to the original routine
 4180.spritev_handler_found
 4190        LDR     r2, [r8, #12]           ; Read the pointer index
 4200        B       spritev_handler_checked ; Handle the match
 4210
 4220        ; Known pointer names
 4230.pointers_start
 4240        FNpointer("ptr_default", ptr_single)
 4250        FNpointer("ptr_double", ptr_double)
 4260        FNpointer("ptr_write", ptr_caret)
 4270        FNpointer("ptr_caret", ptr_caret)
 4280        FNpointer("idc_ibeam", ptr_caret)
 4290        FNpointer("ptr_menu", ptr_menu)
 4300.pointers_end
 4310
 4320        ; WordV handler routine
 4330.wordv_handler
 4340        TEQ     r0, #21                 ; The reason code for pointer operations
 4350        MOVNES  pc, r14                 ; Pass on other reason codes
 4360        STMFD   r13!, {r0-r1, r14}      ; Stack registers
 4370        LDRB    r0, [r1]                ; Get the sub reason code
 4380        TEQ     r0, #0                  ; Reason code to define the pointer
 4390        BNE     wordv_handler_done      ; Not interested in other reason codes
 4400        LDR     r0, [r12, #ws_internal] ; Read the internal flag
 4410        TEQ     r0, #0                  ; Is it an internal operation
 4420        BNE     wordv_handler_done      ; Skip the next bit if it is
 4430        LDRB    r0, [r1, #1]            ; Read the shape number
 4440        ADD     r0, r0, #ws_types       ; Offset to type details
 4450        MOV     r1, #ptr_unknown        ; Code for an unknown pointer type
 4460        STRB    r1, [r12, r0]           ; Set this pointer type to unknown
 4470.wordv_handler_done
 4480        LDMFD   r13!, {r0-r1, pc}^      ; Pass on the call
 4490
 4500        ; Update the shape of the mouse pointer
 4510.update STMFD   r13!, {r0-r5, r14}      ; Stack registers
 4520        MOV     r0, #106                ; Reason code to read pointer shape
 4530        MOV     r1, #&7f                ; Invalid shape number to force read
 4540        SWI     "XOS_Byte"              ; Read the current pointer shape number
 4550        BVS     update_done             ; No update pointer if error produced
 4560        STRB    r1, [r12, #ws_ptr_block_shape]; Store the pointer shape
 4570        TST     r1, #&80                ; Is the pointer linked
 4580        BNE     update_done             ; No update if not
 4590        ADD     r1, r1, #ws_types       ; Offset to type details
 4600        LDRB    r3, [r12, r1]           ; Discover the type of pointer required
 4610        MOV     r0, #21                 ; Reason code to read pointer position
 4620        ADD     r1, r12, #ws_buffer     ; Pointer to a buffer
 4630        MOV     r2, #6                  ; Reason code to read pointer position
 4640        STRB    r2, [r1]                ; Store reason code in buffer
 4650        SWI     "XOS_Word"              ; Read pointer position
 4660        BVS     update_done             ; No update pointer if error produced
 4670        MOV     r0, r3                  ; Copy pointer shape type
 4680        LDRB    r4, [r1, #1]            ; Read LSB of horizontal position
 4690        LDRB    r5, [r1, #2]            ; Read MSB of horizontal position
 4700        ORR     r4, r4, r5, ASL#8       ; Combine horizontal position
 4710        MOV     r4, r4, ASL#16          ; Scale the horizontal position up
 4720        LDR     r5, [r12, #ws_hpos]     ; Read previous horizontal position
 4730        SUB     r2, r4, r5              ; Calculate horizontal movement
 4740        MOV     r2, r2, ASR#1           ; Reduce the horizontal position
 4750        ADD     r4, r5, r2              ; And modify the last known position
 4760        LDRB    r3, [r1, #3]            ; Read LSB of vertical position
 4770        LDRB    r5, [r1, #4]            ; Read MSB of vertical position
 4780        ORR     r3, r3, r5, ASL#8       ; Combine vertical position
 4790        MOV     r3, r3, ASL#16          ; Scale the vertical position up
 4800        LDR     r5, [r12, #ws_vpos]     ; Read previous vertical position
 4810        SUB     r1, r5, r3              ; Calculate vertical movement
 4820        MOV     r1, r1, ASR#1           ; Reduce the vertical movement
 4830        SUB     r3, r5, r1              ; And modify the last known position
 4840        STR     r3, [r12, #ws_vpos]     ; Store the updated vertical position
 4850        STR     r4, [r12, #ws_hpos]     ; Store the updated horizontal position
 4860        LDR     r3, [r12, #ws_ceig]     ; Read the common eigen value
 4870        MOV     r4, #1                  ; Value to be shifted
 4880        MOV     r4, r4, ASL r3          ; The eigen value
 4890        ADD     r1, r1, r4, ASR#1       ; Improve vertical movement rounding
 4900        ADD     r2, r2, r4, ASR#1       ; Improve horizontal movement rounding
 4910        MOV     r1, r1, ASR r3          ; Scale the vertical movement
 4920        MOV     r2, r2, ASR r3          ; Scale the horizontal movement
 4930        ADR     r14, update_plot        ; Return address to update pointer
 4940        ADD     pc, pc, r0, LSL#2       ; Jump to the relevant routine
 4950        MOV     r0, r0                  ; This instruction is never executed
 4960        B       update_done             ; Shape 0 is unknown
 4970        B       update_single           ; Shape 1 is a single pointer
 4980        B       update_double           ; Shape 2 is a double click pointer
 4990        B       update_write            ; Shape 3 is a caret or writable icon
 5000        B       update_menu             ; Shape 4 is a popup menu icon
 5010.update_plot
 5020        MOV     r0, #21                 ; Reason code to set pointer shape
 5030        ADD     r1, r12, #ws_ptr_block  ; Pointer to parameter block
 5040        STR     r0, [r12, #ws_internal] ; Set the internal flag
 5050        SWI     "XOS_Word"              ; Define the pointer
 5060        BVS     update_done             ; Skip the rest in an error produced
 5070        MOV     r0, #106                ; Reason code to select pointer
 5080        LDRB    r1, [r12, #ws_ptr_block_shape]; Get the shape number
 5090        SWI     "XOS_Byte"              ; Refresh the pointer
 5100.update_done
 5110        MOV     r0, #0                  ; Value to clear the flag with
 5120        STR     r0, [r12, #ws_internal] ; Clear the internal flag
 5130        LDMFD   r13!, {r0-r5, pc}^      ; Return from the subroutine
 5140
 5150        ; Generate a standard pointer shape that has moved by (r2, r1)
 5160.update_standard
 5170        STMFD   r13!, {r0, r3-r8, r14}  ; Stack registers
 5180        LDR     r5, [r12, #ws_cogr]     ; Read previous row pointer centre
 5190        LDR     r6, [r12, #ws_cogc]     ; Read previous column pointer centre
 5200        MOV     r7, #0                  ; Start by assuming no movement
 5210        TEQ     r1, #0                  ; Is there any row motion
 5220        TEQEQ   r2, #0                  ; Is there any column motion
 5230        BEQ     update_standard_still   ; Do not change direction if still
 5240        ADD     r5, r5, r1              ; Calculate the new row offset
 5250        ADD     r6, r6, r2              ; Calculate the new column offset
 5260        MOV     r0, r5, ASR#8           ; Scale the new row offset
 5270        MUL     r1, r0, r0              ; Square the new row offset
 5280        MOV     r0, r6, ASR#8           ; Scale the new column offset
 5290        MUL     r2, r0, r0              ; Square the new column offset
 5300        ADD     r0, r1, r2              ; Sum the squares
 5310        BL      sqrt                    ; Calculate the new tail length
 5320        MOV     r0, r0, ASL#8           ; Scale the new length back up
 5330        SUB     r7, r0, #11<<16         ; Subtract the nominal length
 5340        MOV     r0, r5                  ; Copy the new row offset
 5350        MOV     r1, r6                  ; Copy the new column offset
 5360        BL      normalise               ; Normalise the offset length
 5370        MOV     r2, #11                 ; The required tail mass length
 5380        MUL     r5, r2, r0              ; The scaled row offset
 5390        MUL     r6, r2, r1              ; The scaled column offset
 5400        STR     r5, [r12, #ws_cogr]     ; Store the updated row centre
 5410        STR     r6, [r12, #ws_cogc]     ; Store the updated column centre
 5420.update_standard_still
 5430        MOV     r0, r7, ASR#3           ; Copy and scale the length offset
 5440        BL      update_filter           ; Update the pointer wibble
 5450        ADD     r0, r0, r0, ASL#2       ; Multiply the length offset by 5
 5460        MOV     r7, #11<<16             ; The nominal tail length
 5470        ADD     r7, r7, r0              ; Add the wibble to the tail length
 5480        MOV     r0, #7                  ; Number of coordinates in pointer shape
 5490        ADR     r1, update_standard_basic; Pointer to the basic shape
 5500        ADR     r2, update_standard_length; Pointer to the length adjustment
 5510        MOV     r3, r7                  ; Copy the required head length
 5520        ADD     r4, r12, #ws_buffer     ; Pointer to the destination buffer
 5530        BL      trans_add               ; Set the required head length
 5540        MOV     r1, r4                  ; New source buffer is previous output
 5550        ADR     r2, update_standard_tail; Pointer to tail width adjustment
 5560        STMFD   r13!, {r0-r1}           ; Stack registers
 5570        MOV     r0, #100<<16            ; Area to divide by the length
 5580        MOV     r1, r7, ASR#16          ; Scale the tail length
 5590        RSB     r1, r1, #21             ; Calculate the tail length
 5600        BL      divide                  ; Calculate the tail width offset
 5610        MOV     r3, r0                  ; Copy the tail width offset
 5620        LDMFD   r13!, {r0-r1}           ; Restore registers
 5630        BL      trans_add               ; Set the width of the tail base
 5640        ADR     r2, update_standard_head; Pointer to head width adjustment
 5650        STMFD   r13!, {r0-r1}           ; Stack registers
 5660        MOV     r0, #132<<16            ; Area to divide by the length
 5670        MOV     r1, r7, ASR#16          ; Scale the tail length
 5680        BL      divide                  ; Calculate the head width offset
 5690        MOV     r3, r0                  ; Copy the head width offset
 5700        LDMFD   r13!, {r0-r1}           ; Restore registers
 5710        BL      trans_add               ; Set the width of the header base
 5720        MOV     r2, r1                  ; Destination coordinates are the same
 5730        MOV     r3, r5                  ; Row component of desired vertical
 5740        MOV     r4, r6                  ; Column component of desired vertical
 5750        BL      trans_rotate            ; Rotate the pointer as required
 5760        BL      trans_fit               ; Scale the coordinates for the pointer
 5770        MOV     r1, r0                  ; Copy the number of points
 5780        LDMFD   r13!, {r0, r3-r8, pc}   ; Return from subroutine
 5790.update_standard_basic                  ; The basic pointer shape
 5800        FNcoordinate(0, 0)
 5810        FNcoordinate(0, 0)
 5820        FNcoordinate(0, 2)
 5830        FNcoordinate(21, -2)
 5840        FNcoordinate(21, 2)
 5850        FNcoordinate(0, -2)
 5860        FNcoordinate(0, 0)
 5870.update_standard_length                 ; Offsets to change the head length
 5880        FNcoordinate(0, 0)
 5890        FNcoordinate(1, 0)
 5900        FNcoordinate(1, 0)
 5910        FNcoordinate(0, 0)
 5920        FNcoordinate(0, 0)
 5930        FNcoordinate(1, 0)
 5940        FNcoordinate(1, 0)
 5950.update_standard_tail                   ; Offsets to change the tail width
 5960        FNcoordinate(0, 0)
 5970        FNcoordinate(0, 0)
 5980        FNcoordinate(0, 0)
 5990        FNcoordinate(0, 0.5)
 6000        FNcoordinate(0, -0.5)
 6010        FNcoordinate(0, 0)
 6020        FNcoordinate(0, 0)
 6030.update_standard_head                   ; Offsets to change the head width
 6040        FNcoordinate(0, 0)
 6050        FNcoordinate(0, 0.5)
 6060        FNcoordinate(0, 0)
 6070        FNcoordinate(0, 0)
 6080        FNcoordinate(0, 0)
 6090        FNcoordinate(0, 0)
 6100        FNcoordinate(0, -0.5)
 6110
 6120        ; Plot a single pointer type r0 that has moved by (r2, r1)
 6130.update_single
 6140        STMFD   r13!, {r0-r2, r14}      ; Stack registers
 6150        BL      update_standard         ; Construct the pointer shape
 6160        MOV     r0, #colour_trans       ; Background is transparent
 6170        BL      plot_fill               ; Clear the pointer initially
 6180        MOV     r0, #colour_blue        ; Fill the interior with solid blue
 6190        BL      plot_poly_fill          ; Plot the filled interior
 6200        MOV     r0, #colour_cyan        ; Outline the pointer in cyan
 6210        BL      plot_poly_line          ; Plot the pointer outline
 6220        LDMFD   r13!, {r0-r2, pc}       ; Return from subroutine
 6230
 6240        ; Plot a double click pointer type r0 that has moved by (r2, r1)
 6250.update_double
 6260        STMFD   r13!, {r0-r2, r14}      ; Stack registers
 6270        BL      update_standard         ; Construct the pointer shape
 6280        MOV     r0, #colour_trans       ; Background is transparent
 6290        BL      plot_fill               ; Clear the pointer initially
 6300        MOV     r0, #colour_trans_blue  ; Fill interior with transparent blue
 6310        BL      plot_poly_fill          ; Plot the filled interior
 6320        MOV     r0, #colour_cyan        ; Outline the pointer in cyan
 6330        BL      plot_poly_line          ; Plot the pointer outline
 6340        LDMFD   r13!, {r0-r2, pc}       ; Return from subroutine
 6350
 6360        ; Plot a caret pointer type r0 that has moved by (r2, r1)
 6370.update_write
 6380        STMFD   r13!, {r0-r6, r14}      ; Stack registers
 6390        MOV     r0, r2, ASR#3           ; Value to update position with
 6400        BL      update_filter           ; Filter the update
 6410        MOV     r3, r0, ASL#2           ; Copy the filter output
 6420        MOV     r0, #22                 ; Number of coordinates
 6430        ADR     r1, update_write_basic  ; The required pointer shape
 6440        ADR     r2, update_write_horizontal; Changes to add horizontal motion
 6450        ADD     r4, r12, #ws_buffer     ; Pointer to destination buffer
 6460        BL      trans_add               ; Add the motion to the shape
 6470        MOV     r1, r4                  ; Copy buffer pointer
 6480        MOV     r2, r1                  ; Use the same buffer for the results
 6490        BL      trans_fit               ; Scale the coordinates for the pointer
 6500        MOV     r1, r0                  ; Copy the number of points
 6510        MOV     r0, #colour_trans       ; Background is transparent
 6520        BL      plot_fill               ; Clear the pointer initially
 6530        MOV     r0, #colour_blue        ; Fill interior with solid blue
 6540        BL      plot_poly_fill          ; Plot the filled interior
 6550        MOV     r0, #colour_cyan        ; Outline the pointer in cyan
 6560        BL      plot_poly_line          ; Plot the pointer outline
 6570        LDMFD   r13!, {r0-r6, pc}       ; Return from subroutine
 6580.update_write_basic                     ; The basic pointer shape
 6590        FNcoordinate(-10, -4)
 6600        FNcoordinate(-10, -2)
 6610        FNcoordinate(-8, 0)
 6620        FNcoordinate(-10, 2)
 6630        FNcoordinate(-10, 4)
 6640        FNcoordinate(-8, 4)
 6650        FNcoordinate(-7, 1)
 6660        FNcoordinate(-2, 1)
 6670        FNcoordinate(2, 1)
 6680        FNcoordinate(6, 1)
 6690        FNcoordinate(7, 4)
 6700        FNcoordinate(9, 4)
 6710        FNcoordinate(9, 2)
 6720        FNcoordinate(7, 0)
 6730        FNcoordinate(9, -2)
 6740        FNcoordinate(9, -4)
 6750        FNcoordinate(7, -4)
 6760        FNcoordinate(6, -1)
 6770        FNcoordinate(2, -1)
 6780        FNcoordinate(-2, -1)
 6790        FNcoordinate(-7, -1)
 6800        FNcoordinate(-8, -4)
 6810.update_write_horizontal                ; Offsets to distort horizontally
 6820        FNcoordinate(0.6, -1)
 6830        FNcoordinate(0.3, -0.8)
 6840        FNcoordinate(0, -0.6)
 6850        FNcoordinate(-0.3, -0.8)
 6860        FNcoordinate(-0.6, -1)
 6870        FNcoordinate(-0.6, -1)
 6880        FNcoordinate(-0.15, -0.5)
 6890        FNcoordinate(-0.15, -0)
 6900        FNcoordinate(0.15, -0)
 6910        FNcoordinate(0.15, -0.5)
 6920        FNcoordinate(0.6, -1)
 6930        FNcoordinate(0.6, -1)
 6940        FNcoordinate(0.3, -0.8)
 6950        FNcoordinate(0, -0.6)
 6960        FNcoordinate(-0.3, -0.8)
 6970        FNcoordinate(-0.6, -1)
 6980        FNcoordinate(-0.6, -1)
 6990        FNcoordinate(-0.15, -0.5)
 7000        FNcoordinate(-0.15, -0)
 7010        FNcoordinate(0.15, -0)
 7020        FNcoordinate(0.15, -0.5)
 7030        FNcoordinate(0.6, -1)
 7040
 7050        ; Plot a menu pointer type r0 that has moved by (r2, r1)
 7060.update_menu
 7070        STMFD   r13!, {r0-r4, r14}      ; Stack registers
 7080        LDR     r3, [r12, #ws_cogr]     ; Read previous row direction
 7090        LDR     r4, [r12, #ws_cogc]     ; Read previous column direction
 7100        TEQ     r1, #0                  ; Is there any vertical motion
 7110        TEQEQ   r2, #0                  ; Is there any horizontal motion
 7120        BEQ     update_menu_still       ; Do not change direction if still
 7130        ADD     r0, r3, r1, ASR#3       ; Update the row direction
 7140        ADD     r1, r4, r2, ASR#3       ; Update the column direction
 7150        BL      normalise               ; Normalise the direction vector
 7160        MOV     r3, r0                  ; Copy the row direction
 7170        MOV     r4, r1                  ; Copy the column direction
 7180        STR     r3, [r12, #ws_cogr]     ; Store the new row direction
 7190        STR     r4, [r12, #ws_cogc]     ; Store the new column direction
 7200.update_menu_still
 7210        MOV     r0, #8                  ; Number of points to transform
 7220        ADR     r1, update_menu_frame   ; Pointer to source cordinates
 7230        ADD     r2, r12, #ws_buffer     ; Pointer to destination buffer
 7240        BL      trans_fit               ; Scale the coordinates for the pointer
 7250        ADD     r2, r2, r0, LSL#3       ; Pointer to destination buffer
 7260        MOV     r0, #9                  ; Number of points in pointer shape
 7270        ADR     r1, update_menu_ptr     ; Pointer to source coordinates
 7280        BL      trans_rotate            ; Rotate the pointer as required
 7290        MOV     r1, r2                  ; Source buffer is same as destination
 7300        BL      trans_fit               ; Scale the coordinates for the pointer
 7310        MOV     r0, #colour_trans       ; Background is transparent
 7320        ADD     r2, r12, #ws_buffer     ; Pointer to coordinates buffer
 7330        BL      plot_fill               ; Clear the pointer initially
 7340        MOV     r1, #4                  ; Number of coordinates in menu shape
 7350        MOV     r0, #colour_trans_blue  ; Fill interior with solid blue
 7360        BL      plot_poly_fill          ; Plot the filled interior
 7370        MOV     r0, #colour_cyan        ; Outline the pointer in cyan
 7380        BL      plot_poly_line          ; Plot the pointer outline
 7390        MOV     r0, #colour_trans_cyan  ; Outline the pointer in cyan
 7400        ADD     r2, r2, r1, LSL#3       ; Pointer to interior shape
 7410        BL      plot_poly_fill          ; Plot the menu interior
 7420        ADD     r2, r2, r1, LSL#3       ; Pointer to pointer shape
 7430        MOV     r0, #colour_blue        ; Fill interior with solid blue
 7440        MOV     r1, #9                  ; Number of coordinates in pointer shape
 7450        BL      plot_poly_fill          ; Plot the filled interior
 7460        MOV     r0, #colour_cyan        ; Outline the pointer in cyan
 7470        BL      plot_poly_line          ; Plot the pointer outline
 7480        LDMFD   r13!, {r0-r4, pc}       ; Return from subroutine
 7490.update_menu_frame                      ; The outside frame of the menu
 7500        FNcoordinate(-3, 0)
 7510        FNcoordinate(-3, 16)
 7520        FNcoordinate(20, 16)
 7530        FNcoordinate(20, 0)
 7540.update_menu_entries                    ; The interior of the menu
 7550        FNcoordinate(0.5, 1)
 7560        FNcoordinate(0.5, 14)
 7570        FNcoordinate(18.5, 14)
 7580        FNcoordinate(18.5, 1)
 7590.update_menu_ptr                        ; The pointer shape
 7600        FNcoordinate(1, 0)
 7610        FNcoordinate(5, 4)
 7620        FNcoordinate(6, 4)
 7630        FNcoordinate(6, 2)
 7640        FNcoordinate(11, 2)
 7650        FNcoordinate(11, -2)
 7660        FNcoordinate(6, -2)
 7670        FNcoordinate(6, -4)
 7680        FNcoordinate(5, -4)
 7690
 7700        ; Apply an underdamped filter to the value in r0
 7710.update_filter
 7720        STMFD   r13!, {r1-r3, r14}      ; Stack registers
 7730        LDR     r1, [r12, #ws_filtn]    ; Get previous position
 7740        LDR     r2, [r12, #ws_filtv]    ; Get previous velocity
 7750        LDR     r3, [r12, #ws_friction] ; The amount of friction
 7760        RSB     r3, r3, #10             ; Convert to a shift value
 7770        SUB     r2, r2, r2, ASR r3      ; Apply some friction
 7780        LDR     r3, [r12, #ws_spring]   ; The spring constant
 7790        RSB     r3, r3, #11             ; Convert to a shift value
 7800        SUB     r2, r2, r1, ASR r3      ; Include the restorative force
 7810        ADD     r1, r1, r2              ; Add part of velocity to the position
 7820        LDR     r3, [r12, #ws_force]    ; The force multiplier
 7830        RSBS    r3, r3, #13             ; Convert to a shift value
 7840        MOVMI   r0, #0                  ; No wibble if result negative
 7850        MOV     r0, r0, ASR r3          ; Scale the new input
 7860        ADD     r0, r1, r0, ASL#8       ; Add the new input
 7870        MOV     r1, #1<<16              ; The maximum allowed value
 7880        CMP     r0, r1                  ; Compare to the maximum
 7890        MOVGT   r0, r1                  ; Enforce the maximum position
 7900        CMPGT   r2, #0                  ; Clip the velocity if maximum reached
 7910        MOVGT   r2, #0                  ; Set the velocity to zero
 7920        RSB     r1, r1, #0              ; The minimum allowed value
 7930        CMP     r0, r1                  ; Compare to the mimimum
 7940        MOVLT   r0, r1                  ; Enforce the minimum
 7950        CMPLT   r2, #0                  ; Clip the velocity if minimum reached
 7960        MOVLT   r2, #0                  ; Set the velocity to zero
 7970        MOVS    r1, r0                  ; Copy the new position
 7980        RSBMI   r1, r1, #0              ; Ensure copy of position is positive
 7990        CMP     r1, #1<<8               ; Minimum visible position
 8000        MOVLT   r2, r2, ASR#1           ; Increase friction when small movement
 8010        STR     r0, [r12, #ws_filtn]    ; Store the new position
 8020        STR     r2, [r12, #ws_filtv]    ; Store the new velocity
 8030.update_filter_done
 8040        LDMFD   r13!, {r1-r3, pc}       ; Return from subroutine
 8050
 8060        ; Fill the pointer image data with colour r0
 8070.plot_fill
 8080        STMFD   r13!, {r0-r2, r14}      ; Stack registers
 8090        BL      colour_expand           ; Expand the colour to fill a word
 8100        ADD     r1, r12, #ws_ptr_data   ; Start of pointer image data
 8110        MOV     r2, #32                 ; Number of rows to clear
 8120.plot_fill_loop
 8130        SUBS    r2, r2, #1              ; Decrement number of rows remaining
 8140        LDMMIFD r13!, {r0-r2, pc}       ; Return from subroutine when finished
 8150        STR     r0, [r1], #4            ; Set this word of the pointer image
 8160        STR     r0, [r1], #4            ; Set this word of the pointer image
 8170        MOV     r0, r0, ROR#2           ; Rotate pattern by a pixel for next row
 8180        B       plot_fill_loop          ; Loop for the next word
 8190
 8200        ; Plot a horizontal line in colour r0 from (r2, r1) to (r3, r1)
 8210.plot_row
 8220        STMFD   r13!, {r0-r4, r14}      ; Stack registers
 8230        LDRB    r4, [r12, #ws_ptr_block_activex]; Read horizontal hotspot
 8240        ADD     r2, r2, r4              ; Set the horizontal origin
 8250        ADD     r3, r3, r4              ; Set the horizontal origin
 8260        LDRB    r4, [r12, #ws_ptr_block_activey]; Read vertical hotspot
 8270        ADD     r1, r1, r4              ; Set the vertical origin
 8280        CMP     r2, r3                  ; Place limits in the correct order
 8290        MOVGT   r4, r2                  ; Make a temporary copy
 8300        MOVGT   r2, r3                  ; Swap the limits
 8310        MOVGT   r3, r4                  ; Copy the temporary value back
 8320        CMP     r1, #0                  ; Check lower row limit
 8330        BLT     plot_row_done           ; No plotting if before first row
 8340        CMP     r1, #31                 ; Check upper row limit
 8350        BGT     plot_row_done           ; No plotting if after last row
 8360        BL      colour_expand           ; Expand the colour to fill a word
 8370        TST     r1, #1                  ; Is it an odd numbered row
 8380        MOVNE   r0, r0, ROR#2           ; Rotate colour pattern if it is
 8390        ADD     r4, r12, r1, ASL#3      ; Calculate row start
 8400        ADD     r4, r4, #ws_ptr_data    ; Include data start offset
 8410        LDR     r1, [r4]                ; Read the existing first word
 8420        BL      plot_row_word           ; Process the first word
 8430        STR     r1, [r4]                ; Store the updated first word
 8440        SUB     r2, r2, #16             ; Adjust the start position
 8450        SUB     r3, r3, #16             ; Adjust the end position
 8460        LDR     r1, [r4, #4]!           ; Read the existing second word
 8470        BL      plot_row_word           ; Process the second word
 8480        STR     r1, [r4]                ; Store the updated second word
 8490.plot_row_done
 8500        LDMFD   r13!, {r0-r4, pc}       ; Return from subroutine
 8510.plot_row_word
 8520        STMFD   r13!, {r2-r4, r14}      ; Stack registers
 8530        CMP     r2, #0                  ; Range check lower limit
 8540        MOVLT   r2, #0                  ; Start from first pixel
 8550        CMP     r3, #15                 ; Range check upper limit
 8560        MOVGT   r3, #15                 ; End at the last pixel
 8570        SUB     r3, r3, r2              ; Difference between the two ends
 8580        ADD     r3, r3, #1              ; Convert to number of pixels
 8590        MOV     r4, r2, ASL#1           ; Convert start to rotation
 8600        MOV     r2, #3                  ; Mask for a single pixel
 8610        MOV     r2, r2, LSL r4          ; Mask for the first pixel position
 8620        MOV     r4, #0                  ; No pixels set initially
 8630.plot_row_word_loop
 8640        SUBS    r3, r3, #1              ; Decrement number of pixels
 8650        BMI     plot_row_word_done      ; Escape the loop if finished
 8660        ORR     r4, r4, r2              ; Include this pixel in the mask
 8670        MOV     r2, r2, LSL#2           ; Advance to the next pixel
 8680        B       plot_row_word_loop      ; Loop for the next pixel
 8690.plot_row_word_done
 8700        BIC     r1, r1, r4              ; Clear pixels to set
 8710        AND     r4, r4, r0              ; Colour the mask
 8720        ORR     r1, r1, r4              ; Include the new pixels in the word
 8730        LDMFD   r13!, {r2-r4, pc}       ; Return from subroutine
 8740
 8750        ; Plot a single point in colour r0 at (r2, r1)
 8760.plot_point
 8770        STMFD   r13!, {r0-r3, r14}      ; Stack registers
 8780        LDRB    r3, [r12, #ws_ptr_block_activex]; Read horizontal hotspot
 8790        ADD     r2, r2, r3              ; Set the horizontal origin
 8800        LDRB    r3, [r12, #ws_ptr_block_activey]; Read vertical hotspot
 8810        ADD     r1, r1, r3              ; Set the vertical origin
 8820        CMP     r1, #0                  ; Check lower row limit
 8830        CMPGE   r2, #0                  ; Check lower column limit
 8840        BLT     plot_point_done         ; No plotting if below visible range
 8850        CMP     r1, #31                 ; Check upper row limit
 8860        CMPLE   r2, #31                 ; Check upper column limit
 8870        BGT     plot_point_done         ; No plotting if above visible range
 8880        BL      colour_expand           ; Expand the colour to fill a word
 8890        TST     r1, #1                  ; Is it an odd numbered row
 8900        MOVNE   r0, r0, ROR#2           ; Rotate colour pattern if it is
 8910        ADD     r1, r12, r1, ASL#3      ; Calculate row start
 8920        ADD     r1, r1, #ws_ptr_data    ; Include data start offset
 8930        TST     r2, #&10                ; Should the second word be used
 8940        ADDNE   r1, r1, #4              ; Advance if it should
 8950        AND     r2, r2, #&f             ; Pixel within the word
 8960        ADD     r2, r2, r2              ; Convert to a rotation
 8970        MOV     r3, #3                  ; Mask for a single pixel
 8980        MOV     r3, r3, LSL r2          ; Rotate to the correct position
 8990        AND     r0, r0, r3              ; Mask out the required colour
 9000        LDR     r2, [r1]                ; Read the existing image word
 9010        BIC     r2, r2, r3              ; Clear the pixel to be set
 9020        ORR     r2, r2, r0              ; Set the required colour
 9030        STR     r2, [r1]                ; Strore the updated word
 9040.plot_point_done
 9050        LDMFD   r13!, {r0-r3, pc}       ; Return from subroutine
 9060
 9070        ; Plot a midpoint line in colour r0 from (r2, r1) to (r4, r3)
 9080.plot_line
 9090        STMFD   r13!, {r0-r7, r14}      ; Stack registers
 9100        MOV     r5, #0                  ; Start with default coordinates
 9110        SUBS    r1, r1, r3              ; Change in row number
 9120        RSBMI   r3, r3, #0              ; Reflect start point vertically
 9130        RSBMI   r1, r1, #0              ; Reflect change in row number
 9140        ORRMI   r5, r5, #2              ; Record vertical flip
 9150        SUBS    r2, r2, r4              ; Change in column number
 9160        RSBMI   r4, r4, #0              ; Reflect start point horizontally
 9170        RSBMI   r2, r2, #0              ; Reflect change in column number
 9180        ORRMI   r5, r5, #4              ; Record horizontal flip
 9190        CMP     r2, r1                  ; Check slope of line
 9200        MOVGT   r6, r3                  ; Copy original row number
 9210        MOVGT   r3, r4                  ; Swap row with column
 9220        MOVGT   r4, r6                  ; Set new row number
 9230        MOVGT   r6, r1                  ; Copy original row change
 9240        MOVGT   r1, r2                  ; Swap row with column
 9250        MOVGT   r2, r6                  ; Set new row change
 9260        ORRGT   r5, r5, #1              ; Record coordinate reversal
 9270        ADD     r6, r2, r2              ; Horizontal step increment
 9280        SUB     r7, r6, r1              ; Initial decision variable value
 9290        SUB     r2, r2, r1              ; Half of diagonal step increment
 9300        ADD     r2, r2, r2              ; Diagonal step increment
 9310        ADD     r1, r3, r1              ; The last point to plot 
 9320.plot_line_loop
 9330        BL      plot_line_point         ; Plot the first point of the line
 9340        CMP     r3, r1                  ; Has the line been finished
 9350        LDMGEFD r13!, {r0-r7, pc}       ; Return from subroutine when finished
 9360        CMP     r7, #0                  ; Check the decision variable
 9370        ADDLE   r7, r7, r6              ; Increment decision variable
 9380        ADDGT   r7, r7, r2              ; Increment decision variable
 9390        ADDGT   r4, r4, #1              ; Perform the diagonal step
 9400        ADD     r3, r3, #1              ; Advance to the next pixel
 9410        B       plot_line_loop          ; Loop for the next pixel
 9420.plot_line_point
 9430        STMFD   r13!, {r1-r2, r14}      ; Stack registers
 9440        TST     r5, #1                  ; Have coordinates been reversed
 9450        MOVEQ   r1, r3                  ; Copy unreversed row
 9460        MOVEQ   r2, r4                  ; Copy unreversed column
 9470        MOVNE   r1, r4                  ; Copy reversed row
 9480        MOVNE   r2, r3                  ; Copy reversed column
 9490        TST     r5, #2                  ; Has row been negated
 9500        RSBNE   r1, r1, #0              ; Negate row if required
 9510        TST     r5, #4                  ; Has column been negated
 9520        RSBNE   r2, r2, #0              ; Negate column if required
 9530        BL      plot_point              ; Plot the point
 9540        LDMFD   r13!, {r1-r2, pc}       ; Return from subroutine
 9550
 9560        ; Plot a closed polyline in colour r0 using r1 vertices starting at r2
 9570.plot_poly_line
 9580        STMFD   r13!, {r0-r7, r14}      ; Stack registers
 9590        MOV     r5, r2                  ; Pointer to the current vertex
 9600        MOV     r6, r2                  ; Keep a pointer to the first vertex
 9610        MOV     r7, r1                  ; Copy number of segments
 9620.plot_poly_line_loop
 9630        SUBS    r7, r7, #1              ; Decrement remaining segments
 9640        LDMMIFD r13!, {r0-r7, pc}       ; Return from subroutine when finished
 9650        LDMIA   r5!, {r1-r2}            ; Read line start coordinates
 9660        MOVEQ   r5, r6                  ; Wrap around to the start for the end
 9670        LDMIA   r5, {r3-r4}             ; Read line end coordinates
 9680        BL      plot_line               ; Plot this line
 9690        B       plot_poly_line_loop     ; Loop for the next line segment
 9700
 9710        ; Fill a polygon in colour r0 using r1 vertices starting at r2
 9720.plot_poly_fill
 9730        STMFD   r13!, {r0-r6, r14}      ; Stack registers
 9740        SUB     r13, r13, r1, LSL#4     ; Reserve space for edge details
 9750        MOV     r3, r13                 ; Copy edge details pointer
 9760        SUB     r13, r13, r1, LSL#2     ; Reserve space for intersections
 9770        MOV     r4, r13                 ; Copy intersections pointer
 9780        BL      plot_poly_fill_preprocess; Construct the edge details
 9790.plot_poly_fill_loop
 9800        MOV     r2, #0                  ; No intersections found yet
 9810        BL      plot_poly_fill_inter    ; Find any intersecting edges
 9820        BL      plot_poly_fill_plot     ; Perform the plotting
 9830        ADD     r5, r5, #1              ; Advance to the next row
 9840        CMP     r5, r6                  ; Has the last row been reached
 9850        BLE     plot_poly_fill_loop     ; Loop until all finished
 9860.plot_poly_fill_done
 9870        ADD     r13, r13, r1, LSL#2     ; Release the intersections space
 9880        ADD     r13, r13, r1, LSL#4     ; Release the edge details space
 9890        LDMFD   r13!, {r0-r6, pc}       ; Return from subroutine
 9900.plot_poly_fill_preprocess
 9910        STMFD   r13!, {r0-r4, r7-r10, r14}; Stack registers
 9920        LDR     r5, [r2]                ; Initialise first row number
 9930        LDR     r6, [r2]                ; Initialise last row number
 9940        MOV     r0, r2                  ; Copy vertex pointer
 9950.plot_poly_fill_preprocess_loop
 9960        SUBS    r1, r1, #1              ; Decrement number of edges
 9970        LDMMIFD r13!, {r0-r4, r7-r10, pc}; Return from subroutine when finished
 9980        LDMIA   r0!, {r7-r8}            ; Read line start coordinates
 9990        MOVEQ   r0, r2                  ; Wrap around to the start for the end
10000        LDMIA   r0, {r9-r10}            ; Read line end coordinates
10010        CMP     r7, r9                  ; Do the coordinates need reversing
10020        MOVGT   r4, r7                  ; Copy first row to temporary
10030        MOVGT   r7, r9                  ; Swap row numbers
10040        MOVGT   r9, r4                  ; Set end row number
10050        MOVGT   r4, r8                  ; Copy first column to temporary
10060        MOVGT   r8, r10                 ; Swap column numbers
10070        MOVGT   r10, r4                 ; Set end column number
10080        CMP     r7, r5                  ; Compare with first row
10090        MOVLT   r5, r7                  ; Update first row number is required
10100        CMP     r9, r6                  ; Compare with last row
10110        MOVGT   r6, r9                  ; Update last row number is required
10120        MOV     r8, r8, ASL#16          ; Scale start column
10130        MOV     r10, r10, ASL#16        ; Scale end column
10140        STR     r7, [r3]                ; Store start row number
10150        STR     r9, [r3, #4]            ; Store end row number
10160        STR     r8, [r3, #8]            ; Store start column number
10170        STMFD   r13!, {r0-r1}           ; Stack registers
10180        SUB     r0, r10, r8             ; Required column change
10190        SUBS    r1, r9, r7              ; Required row change
10200        MOVEQ   r0, #0                  ; Fake horizontal lines
10210        BLNE    divide                  ; Calculate column increment
10220        STR     r0, [r3, #12]           ; Store start column number
10230        LDMFD   r13!, {r0-r1}           ; Restore registers
10240        ADD     r3, r3, #16             ; Advance edge details pointer
10250        B       plot_poly_fill_preprocess_loop; Loop for the next edge
10260.plot_poly_fill_inter
10270        STMFD   r13!, {r0-r1, r3-r9, r14}; Stack registers
10280.plot_poly_fill_inter_loop
10290        SUBS    r1, r1, #1              ; Decrement number of edges
10300        LDMMIFD r13!, {r0-r1, r3-r9, pc}; Return from subroutine when finished
10310        LDMIA   r3!, {r6-r9}            ; Read the details for this edge
10320        CMP     r6, r5                  ; Is start row early enough
10330        BGT     plot_poly_fill_inter_loop; Loop for next edge if not
10340        CMP     r7, r5                  ; Is end row late enough
10350        BLE     plot_poly_fill_inter_loop; Loop for next edge if not
10360        SUB     r6, r5, r6              ; Number of rows from start of edge
10370        MLA     r8, r6, r9, r8          ; Calculate intercept column
10380        MOV     r0, r8, ASR#16          ; Scale the intercept column
10390        ADD     r6, r4, r2, LSL#2       ; The next available intersection entry
10400.plot_poly_fill_inter_insert
10410        TEQ     r4, r6                  ; Is this the start of the list
10420        BEQ     plot_poly_fill_inter_done; Exit loop if the start reached
10430        LDR     r7, [r6, #-4]           ; Read the previous intersection
10440        CMP     r0, r7                  ; Should this intersection be ealier
10450        STRLT   r7, [r6], #-4           ; Shuffle down to next intersection
10460        BLT     plot_poly_fill_inter_insert
10470.plot_poly_fill_inter_done
10480        STR     r0, [r6]                ; Store this intersection in the list
10490        ADD     r2, r2, #1              ; Increment intersection count
10500        B       plot_poly_fill_inter_loop; Loop for next edge
10510.plot_poly_fill_plot
10520        STMFD   r13!, {r1-r5, r14}      ; Stack registers
10530        MOV     r1, r5                  ; Copy row number
10540        MOV     r5, r2, LSR#1           ; Calculate number of segments
10550.plot_poly_fill_plot_loop
10560        SUBS    r5, r5, #1              ; Decrement segment count
10570        LDMMIFD r13!, {r1-r5, pc}       ; Return from subroutine
10580        LDMIA   r4!, {r2-r3}            ; Read segment details
10590        ADD     r2, r2, #1              ; Advance the start position
10600        CMP     r2, r3                  ; Is the segment visible
10610        BLLE    plot_row                ; Plot this segment if visible
10620        B       plot_poly_fill_plot_loop; Loop for the next segment
10630
10640        ; Expand a single byte colour description into a full word
10650.colour_expand
10660        ORR     r0, r0, r0, LSL#8       ; Expand to 16 bits
10670        ORR     r0, r0, r0, LSL#16      ; Expand to 32 bits
10680        MOV     pc, r14                 ; Return from subroutine
10690
10700        ; Divide r0 by r1 to give r0
10710.divide STMFD   r13!, {r2-r3, r14}      ; Stack registers
10720        CMP     r0, #0                  ; Is dividend negative
10730        RSBMI   r0, r0, #0              ; Ensure dividend is positive
10740        BL      divide_unsigned         ; Perform the division
10750        RSBMI   r0, r0, #0              ; Correct the sign of the result
10760        LDMFD   r13!, {r2-r3, pc}       ; Return from subroutine
10770.divide_unsigned
10780        MOV     r3, r1                  ; Copy the divisor
10790        CMP     r3, r0, LSR#1           ; Is divisor larger than double dividend
10800.divide_unsigned_double
10810        MOVLS   r3, r3, LSL#1           ; Double the divisor
10820        CMPLS   r3, r0, LSR#1           ; Is divisor larger than double dividend
10830        BLS     divide_unsigned_double  ; Loop again if not large enough
10840        MOV     r2, #0                  ; Clear the quotient
10850.divide_unsigned_loop
10860        CMP     r0, r3                  ; Can the divisor be subtracted
10870        SUBCS   r0, r0, r3              ; Subtract divisor if possible
10880        ADC     r2, r2, r2              ; Double quotient and add the new bit
10890        MOV     r3, r3, LSR#1           ; Halve the divisor
10900        CMP     r3, r1                  ; Has the original divisor been exceeded
10910        BCS     divide_unsigned_loop    ; Loop if it has not
10920        MOV     r0, r2                  ; Copy the result
10930        MOVS    pc, r14                 ; Return from subroutine
10940
10950        ; Calculate the square root of an unsigned integer in r0 to give r0
10960.sqrt   STMFD   r13!, {r1-r4, r14}      ; Stack registers
10970        MOV     r1, r0                  ; Copy the original integer
10980        MOV     r0, #0                  ; Initialise the result
10990        MOV     r2, #1<<15              ; The first bit to test
11000.sqrt_loop
11010        ORR     r3, r0, r2              ; Construct the current guess
11020        MUL     r4, r3, r3              ; Square the current guess
11030        CMP     r4, r1                  ; Compare with the required value
11040        MOVLS   r0, r3                  ; Keep the current guess if suitable
11050        MOVS    r2, r2, LSR#1           ; Advance to the next bit
11060        BNE     sqrt_loop               ; Loop until all bits tested
11070        LDMFD   r13!, {r1-r4, pc}       ; Return from subroutine
11080
11090        ; Normalise a vector (r0, r1) to have a magnitude of 1<<16
11100.normalise
11110        STMFD   r13!, {r2-r5, r14}      ; Stack registers
11120        TEQ     r0, #0                  ; Check horizontal component
11130        TEQEQ   r1, #0                  ; Check vertical component
11140        BEQ     normalise_done          ; Unable to normalise zero vectors
11150        MOVS    r2, r0                  ; Copy the horizontal component
11160        RSBMI   r0, r0, #0              ; Keep a positive copy
11170        MOVS    r3, r1                  ; Copy the vertical component
11180        RSBMI   r1, r1, #0              ; Keep a positive copy
11190.normalise_prescale
11200        TST     r0, #1<<30              ; Is the horizontal component large
11210        TSTEQ   r1, #1<<30              ; Is the vertical component large
11220        BNE     normalise_prescale_done ; Skip loop if large enough
11230        MOV     r2, r2, ASL#1           ; Double the horizontal component
11240        MOV     r0, r0, ASL#1           ; Double the horizontal component copy
11250        MOV     r3, r3, ASL#1           ; Double the vertical component
11260        MOV     r1, r1, ASL#1           ; Double the vertical component copy
11270        B       normalise_prescale      ; Loop until large enough
11280.normalise_prescale_done
11290        MOV     r4, r2, ASR#16          ; Scale down horizontal component
11300        MOV     r5, r3, ASR#16          ; Scale down vertical component
11310        MUL     r0, r4, r4              ; Square the horizontal component
11320        MUL     r1, r5, r5              ; Square the vertical component
11330        ADD     r0, r0, r1              ; Sum the squares of the lengths
11340        BL      sqrt                    ; Calculate the length of the vector
11350        TEQ     r0, #0                  ; Is the length zero
11360        MOVEQ   r0, #1                  ; Force a minimum length
11370        MOV     r1, r0                  ; Copy length to divide by
11380        MOV     r0, r3                  ; Copy the vertical component
11390        BL      divide                  ; Scale the vertical component
11400        MOV     r3, r0                  ; Store the scaled vertical component
11410        MOV     r0, r2                  ; Copy the horizontal component
11420        BL      divide                  ; Scale the horizontal component
11430        MOV     r1, r3                  ; Restore the scaled vertical component
11440.normalise_done
11450        LDMFD   r13!, {r2-r5, pc}       ; Return from subroutine
11460
11470        ; Scale and translate r0 coordinates from at r1 to at r2 for the pointer
11480.trans_fit
11490        STMFD   r13!, {r0-r10, r14}     ; Stack registers
11500        MOV     r3, #0                  ; Initialise minimum row number
11510        MOV     r4, #0                  ; Initialise maximum row number
11520        MOV     r5, #0                  ; Initialise minimum column number
11530        MOV     r6, #0                  ; Initialise maximum column number
11540        LDR     r9, [r12, #ws_yeig]     ; Read the YEigFactor value
11550        LDR     r10, [r12, #ws_xeig]    ; Read the XEigFactor value
11560.trans_fit_loop
11570        SUBS    r0, r0, #1              ; Decrement number of coordinates
11580        BMI     trans_fit_hotspot       ; Exit loop when all coordinates done
11590        LDMIA   r1!, {r7-r8}            ; Read the next coordinate pair
11600        ADD     r7, r7, #1<<15          ; Improve horizontal rounding
11610        MOV     r7, r7, ASR#16          ; Scale column number
11620        MOV     r7, r7, ASR r9          ; Scale by eigen value also
11630        ADD     r8, r8, #1<<15          ; Improve horizontal rounding
11640        MOV     r8, r8, ASR#16          ; Scale column number
11650        MOV     r8, r8, ASR r10         ; Scale by eigen value also
11660        STMIA   r2!, {r7-r8}            ; Write the transformed coordinates
11670        CMP     r7, r3                  ; Compare with minimum row
11680        MOVLT   r3, r7                  ; Update minimum row if required
11690        CMP     r7, r4                  ; Compare with maximum row
11700        MOVGT   r4, r7                  ; Update maximum row if required
11710        CMP     r8, r5                  ; Compare with minimum column
11720        MOVLT   r5, r8                  ; Update minimum column if required
11730        CMP     r8, r6                  ; Compare with maximum column
11740        MOVGT   r6, r8                  ; Update maximum column if required
11750        B       trans_fit_loop          ; Loop for the next coordinate pair
11760.trans_fit_hotspot
11770        LDRB    r0, [r12, #ws_ptr_block_activey]; Read last vertical hotspot
11780        LDRB    r1, [r12, #ws_ptr_block_activex]; Read last horizontal hotspot
11790        ADD     r7, r4, r0              ; Calculate last used row
11800        RSBS    r7, r7, #31             ; Number of spare pixels at the bottom
11810        ADDMI   r0, r0, r7              ; Force last row within pointer
11820        ADDS    r7, r3, r0              ; Calculate first used row
11830        SUBMI   r0, r0, r7              ; Force first row within pointer
11840        CMP     r0, #0                  ; Is hotspot within the pointer
11850        MOVLT   r0, #0                  ; Hotspot must be positive
11860        CMP     r0, #31                 ; Is hotspot within the pointer
11870        MOVGT   r0, #31                 ; Restrict hotspot to within pointer
11880        ADD     r8, r6, r1              ; Calculate last used column
11890        RSBS    r8, r8, #31             ; Number of spare pixels at the right
11900        ADDMI   r1, r1, r8              ; Force last column within pointer
11910        ADDS    r8, r5, r1              ; Calculate first used column
11920        SUBMI   r1, r1, r8              ; Force first column within pointer
11930        CMP     r1, #0                  ; Is hotspot within the pointer
11940        MOVLT   r1, #0                  ; Hotspot must be positive
11950        CMP     r1, #31                 ; Is hotspot within the pointer
11960        MOVGT   r1, #31                 ; Restrict hotspot to within pointer
11970        STRB    r0, [r12, #ws_ptr_block_activey]; Store vertical hotspot
11980        STRB    r1, [r12, #ws_ptr_block_activex]; Store horizontal hotspot
11990.trans_fit_done
12000        LDMFD   r13!, {r0-r10, pc}      ; Return from subroutine
12010
12020        ; Rotate r0 coordinates from at r1 to at r2 with vertical (r4, r3)
12030.trans_rotate
12040        STMFD   r13!, {r0-r8, r14}      ; Stack registers
12050        STMFD   r13!, {r0-r1}           ; Stack registers
12060        MOV     r0, r3                  ; Copy vertical row
12070        MOV     r1, r4                  ; Copy vertical column
12080        BL      normalise               ; Normalise the vertical vector
12090        MOV     r3, r0, ASR#8           ; Copy and scale normalised row
12100        MOV     r4, r1, ASR#8           ; Copy and scale normalised column
12110        LDMFD   r13!, {r0-r1}           ; Restore registers
12120.trans_rotate_loop
12130        SUBS    r0, r0, #1              ; Decrement number of coordinates
12140        LDMMIFD r13!, {r0-r8, pc}       ; Return from subroutine when finished
12150        LDMIA   r1!, {r5-r6}            ; Read the next coordinate pair
12160        MOV     r5, r5, ASR#8           ; Prescale the row number
12170        MOV     r6, r6, ASR#8           ; Prescale the column number
12180        MUL     r7, r5, r3              ; Rotate row to row
12190        RSB     r7, r7, #0              ; Correct sign of row rotation
12200        MUL     r8, r5, r4              ; Rotate row to column
12210        MLA     r7, r6, r4, r7          ; Rotate column to row
12220        MLA     r8, r6, r3, r8          ; Rotate column to column
12230        RSB     r8, r8, #0              ; Correct sign of column rotation
12240        STMIA   r2!, {r7-r8}            ; Write the transformed coordinates
12250        B       trans_rotate_loop       ; Keep looping until all processed
12260
12270        ; Add r0 coordinates at r1 to r3 fraction of those at r2 to give at r4
12280.trans_add
12290        STMFD   r13!, {r0-r8, r14}      ; Stack registers
12300        MOV     r3, r3, ASR#8           ; Prescale the required fraction
12310.trans_add_loop
12320        SUBS    r0, r0, #1              ; Decrement number of coordinates
12330        LDMMIFD r13!, {r0-r8, pc}       ; Return from subroutine when finished
12340        LDMIA   r1!, {r5-r6}            ; Read the original coordinates
12350        LDMIA   r2!, {r7-r8}            ; Read the new coordinates
12360        MOV     r7, r7, ASR#8           ; Prescale the new row number
12370        MOV     r8, r8, ASR#8           ; Prescale the new column number
12380        MLA     r5, r7, r3, r5          ; Add the required row fraction
12390        MLA     r6, r8, r3, r6          ; Add the required column fraction
12400        STMIA   r4!, {r5-r6}            ; Write the updated coordinates
12410        B       trans_add_loop          ; Keep looping until all processed
12420
12430    ]
12440NEXT
12450
12460REM Save the resulting module
12470SYS "OS_File", 10, filename$, &ffA,, code%, code% + P%
12480END
12490
12500REM The name and corresponding type of a pointer
12510DEFFNpointer(name$, type%)
12520    [OPT opt%
12530        EQUS    name$ + STRING$(12 - LEN(name$), CHR$0)
12540        EQUD    type%
12550    ]
12560= 0
12570
12580REM Literal fixed point coordinate pair
12590DEFFNcoordinate(row, column)
12600    [OPT opt%
12610        EQUD    INT(row * (1 << 16))
12620        EQUD    INT(column * (1 << 16))
12630    ]
12640= 0
12650
12660REM Read a word from a non-aligned address
12670DEFFNldru(rd, ra, rb, rc)
12680    [OPT opt%
12690        BIC     rb, ra, #3              ; Get word aligned address 
12700        LDMIA   rb, {rd, rc}            ; Get 64 bits containing answer
12710        AND     rb, ra, #3              ; Correction factor in bytes
12720        MOVS    rb, rb, LSL#3           ; and in bits, so check if aligned
12730        MOVNE   rd, rd, LSR rb          ; If not, produce bottom bits of result
12740        RSBNE   rb, rb, #32             ; Get other shift amount
12750        ORRNE   rd, rd, rc, LSL rb      ; Combine two halves for result
12760    ]
12770= 0

� File        : CrazySrc
� Date        : 10-Jun-98
)� Author      : � A.Thoukydides, 1997
(2� Description : Change the pointer appearance.
2E�               This is inspired by MouseP written by Andrew Bolt
<M�               from the *Info section of Acorn User magazine, June 1997.
F
P&� Modified    : Nick Kennedy, 1998
ZS�               This now works on pre RiscOS 3.60 machines, and exits correctly
d;�               if there is an error on initialisation.
n
x+� The filename to save the module under
�filename$ = "CrazyPoint"
�
�,� Allocate memory to assemble the module
�code_size% = &2000
�� code% code_size%
�
�:� Interval between updates in centiseconds (minimum 2)
�interval=4
�
�� Pointer types
�ptr_unknown = 0
�ptr_single = 1
�ptr_double = 2
ptr_caret = 3
ptr_menu = 4

"� Pointer colours
,colour_trans = 0
6colour_cyan = &55
@colour_blue = &aa
Jcolour_red = &ff
Tcolour_trans_cyan = &11
^colour_trans_blue = &22
hcolour_trans_red = &33
r
|� Usage of workspace
�ws_internal = 0
�ws_types = 4
�ws_hpos = 12
�ws_vpos = 16
�ws_xeig = 20
�ws_yeig = 24
�ws_ceig = 28
�ws_filtn = 32
�ws_filtv = 36
�ws_cogr = 40
�ws_cogc = 44
�ws_friction = 48
�ws_spring = 52
ws_force = 56
ws_ptr_block = 60 + 2
)ws_ptr_block_shape = ws_ptr_block + 1
&)ws_ptr_block_width = ws_ptr_block + 2
0*ws_ptr_block_height = ws_ptr_block + 3
:+ws_ptr_block_activex = ws_ptr_block + 4
D+ws_ptr_block_activey = ws_ptr_block + 5
N(ws_ptr_block_data = ws_ptr_block + 6
X!ws_buffer = ws_ptr_block + 10
bws_buffer_size = 256
l,ws_ptr_data = ws_buffer + ws_buffer_size
vws_ptr_data_size = 256
�,ws_size = ws_ptr_data + ws_ptr_data_size
�
�� Multi-pass assembly
�� opt% = 12 � 14 � 2
�    P% = 0
�    O% = code%
�    L% = code% + code_size%
�    [OPT opt%
�
�        ; Module header
�8        EQUD    0                       ; Start code
�A        EQUD    initialisation          ; Initialisation code
�?        EQUD    finalisation            ; Finalisation code
B        EQUD    service                 ; Service call handler
:        EQUD    title                   ; Title string
9        EQUD    help                    ; Help string
 D        EQUD    command                 ; Help and command table
*C        EQUD    0                       ; SWI chunk base number
4>        EQUD    0                       ; SWI handler code
>@        EQUD    0                       ; SWI decoding table
H?        EQUD    0                       ; SWI decoding code
R
\        ; Title string
f".title  EQUS    "CrazyPointer"
p        EQUB    0
z
�
�        ; Help string
�?.help   EQUS    "Crazy Pointer" + �9 + "1.02 (10 Jun 1998)"
�7        EQUS    " " + �169 + " A.Thoukydides, 1997"
�        EQUB    0
�        ALIGN
�        
�,        ; Help and command keyword table
�.command
�:        EQUS    "CrazyPointer"          ; Command name
�        EQUB    0
�        ALIGN
�<        EQUD    0                       ; Offset to code
>        EQUD    &0                      ; Information word
F        EQUD    0                       ; Offset to syntax message
A        EQUD    command_help            ; Offset to help text
$        
.:        EQUS    "CrazyPointerWobble"    ; Command name
8        EQUB    0
B        ALIGN
L<        EQUD    command_wobble          ; Offset to code
V>        EQUD    &00070001               ; Information word
`F        EQUD    command_wobble_syntax   ; Offset to syntax message
jA        EQUD    command_wobble_help     ; Offset to help text
t        
~L        EQUB    0                       ; Terminate the list of keywords
�
�/        ; Help for the CrazyPointer keyword
�.command_help
�E        EQUS    "Crazy Pointer provides animated mouse pointers."
�P        EQUS    " Replacements are provided for the standard, double-click,"
�*        EQUS    " and caret pointers."
�        EQUB    13
�N        EQUS    "This module is inspired by MouseP written by Andrew Bolt"
�R        EQUS    " and published in the June 1997 *Info section of Acorn User."
�        EQUB    0
�        ALIGN
�
-        ; The *CrazyPointerWobble command

.command_wobble
=        STMFD   r13!, {r14}             ; Stack registers
F        SUB     r13, r13, #48           ; Reserve some stack space
(I        LDR     r12, [r12]              ; Obtain pointer to workspace
2K        MOV     r1, r0                  ; Copy the command tail pointer
<K        ADR     r0, command_wobble_def  ; Pointer to keyword definition
FF        MOV     r2, r13                 ; Pointer to output buffer
PG        MOV     r3, #48                 ; Size of the output buffer
ZE        SWI     "XOS_ReadArgs"          ; Scan the command string
dJ        BVS     command_wobble_done     ; Return from handler if error
nI        LDR     r0, [r2], #4            ; Check if wobble is disabled
xF        TEQ     r0, #0                  ; Is wobble being disabled
�T        BNE     command_wobble_disable  ; Disable the pointer wobble if required
�C        LDR     r0, [r2], #4            ; Read friction pointer
�C        TEQ     r0, #0                  ; Was a value specified
�B        BEQ     command_wobble_spring   ; Skip this bit if not
�;        LDRB    r1, [r0], #1            ; Read the type
�E        TEQ     r1, #0                  ; Is the value an integer
�F        BNE     command_wobble_fail     ; Generate an error if not
�D        �ldru(1, 0, 3, 4)              ; Read the friction value
�F        STR     r1, [r12, #ws_friction] ; Store the friction value
�.command_wobble_spring
�A        LDR     r0, [r2], #4            ; Read spring pointer
�C        TEQ     r0, #0                  ; Was a value specified
�B        BEQ     command_wobble_force    ; Skip this bit if not
;        LDRB    r1, [r0], #1            ; Read the type
E        TEQ     r1, #0                  ; Is the value an integer
F        BNE     command_wobble_fail     ; Generate an error if not
"B        �ldru(1, 0, 3, 4)              ; Read the spring value
,D        STR     r1, [r12, #ws_spring]   ; Store the spring value
6.command_wobble_force
@@        LDR     r0, [r2], #4            ; Read force pointer
JC        TEQ     r0, #0                  ; Was a value specified
TB        BEQ     command_wobble_done     ; Skip this bit if not
^;        LDRB    r1, [r0], #1            ; Read the type
hE        TEQ     r1, #0                  ; Is the value an integer
rF        BNE     command_wobble_fail     ; Generate an error if not
|A        �ldru(1, 0, 3, 4)              ; Read the force value
�C        STR     r1, [r12, #ws_force]    ; Store the force value
�.command_wobble_done
�O        ADD     r13, r13, #48           ; Skip back over the reserved space
�M        LDMFD   r13!, {pc}              ; Return from the command handler
�.command_wobble_disable
�H        MOV     r0, #0                  ; Value to clear filter with
�G        STR     r0, [r12, #ws_filtn]    ; Clear any existing wibble
�P        STR     r0, [r12, #ws_filtv]    ; Clear any existing wibble velocity
�E        MOV     r0, #32                 ; Value to disable wobble
�H        STR     r0, [r12, #ws_force]    ; Clear the force multiplier
�M        B       command_wobble_done     ; Return from the command handler
�.command_wobble_fail
�D        ADR     r0, command_wobble_error; Pointer to error block
P        CMP     pc, #&80000000          ; Set the overflow flag for an error
M        B       command_wobble_done     ; Return from the command handler
.command_wobble_error
&        EQUD    0
00        EQUS    "Invalid command parameters"
:        EQUB    0
D        ALIGN
N.command_wobble_def
X<        EQUS    "nowobble/s,friction/e,spring/e,force/e"
b        EQUB    0
l.command_wobble_help
vI        EQUS    "*CrazyPointerWobble allows the pointer wobble to be"
�=        EQUS    " controlled by setting three constants."
�R        EQUS    " These are all specified on a logarithmic scale in the range"
�D        EQUS    " 0 to 10, with a value of 5 being the default."
�        EQUB    13
�.command_wobble_syntax
�=        EQUS    "Syntax: *CrazyPointerWobble [-nowobble]"
�,        EQUS    " [[-friction] <value>]"
�*        EQUS    " [[-spring] <value>]"
�)        EQUS    " [[-force] <value>]"
�        EQUB    0
�        ALIGN
�
�!        ; Initialisation code
.initialisation
=        STMFD   r13!, {r11, r14}        ; Stack registers
I        MOV     r0, #6                  ; Reason code to claim memory
 L        MOV     r3, #ws_size            ; The size of workspace required
*I        SWI     "XOS_Module"            ; Claim some module workspace
4D        MOVVS   r11, r0                 ; Copy any error pointer
>K        BVS     fail_ws                 ; Fail if an error was produced
HE        STR     r2, [r12]               ; Store workspace pointer
RH        MOV     r12, r2                 ; Copy the workspace pointer
\G        MOV     r0, #0                  ; Value to clear flags with
fO        STR     r0, [r12, #ws_internal] ; Clear the internal operation flag
pN        STRB    r0, [r12, #ws_ptr_block]; Reason code to set pointer shape
zN        STRB    r0, [r12, #ws_ptr_block_activex]; Store horizontal hotspot
�L        STRB    r0, [r12, #ws_ptr_block_activey]; Store vertical hotspot
�A        STR     r0, [r12, #ws_filtn]    ; Initially no wibble
�J        STR     r0, [r12, #ws_filtv]    ; Initially no wibble velocity
�G        MOV     r0, #5                  ; The default configuration
�B        STR     r0, [r12, #ws_friction] ; The default friction
�I        STR     r0, [r12, #ws_spring]   ; The default spring strength
�?        STR     r0, [r12, #ws_force]    ; The default force
�G        MVN     r0, #&9f000             ; Initial centre row offset
�J        STR     r0, [r12, #ws_cogr]     ; Initial row offset to centre
�J        MVN     r0, #&4a000             ; Initial centre column offset
�M        STR     r0, [r12, #ws_cogc]     ; Initial column offset to centre
�Q        MOV     r0, #ptr_unknown        ; Most pointers are unknown initially
�F        STRB    r0, [r12, #ws_types]    ; Shape 0 is not a pointer
	@        STRB    r0, [r12, #ws_types + 2]; Shape 2 is unknown
	@        STRB    r0, [r12, #ws_types + 3]; Shape 3 is unknown
	@        STRB    r0, [r12, #ws_types + 4]; Shape 4 is unknown
	$J        MOV     r0, #ptr_single         ; The standard desktop pointer
	.P        STRB    r0, [r12, #ws_types + 1]; Assume shape 1 is the standard one
	8G        MOV     r0, #8                  ; Width of pointer in bytes
	BJ        STRB    r0, [r12, #ws_ptr_block_width]; Store width of pointer
	LI        MOV     r0, #32                 ; Height of pointer in pixels
	VL        STRB    r0, [r12, #ws_ptr_block_height]; Store height of pointer
	`M        ADD     r0, r12, #ws_ptr_data   ; Pointer to pointer data        
	jL        STR     r0, [r12, #ws_ptr_block_data]; Store pointer to the data
	tR        MOV     r0, #21                 ; Reason code to read pointer position
	~A        ADD     r1, r12, #ws_buffer     ; Pointer to a buffer
	�R        MOV     r2, #6                  ; Reason code to read pointer position
	�I        STRB    r2, [r1]                ; Store reason code in buffer
	�C        SWI     "XOS_Word"              ; Read pointer position
	�D        MOVVS   r11, r0                 ; Copy any error pointer
	�K        BVS     fail_position           ; Fail if an error was produced
	�M        LDRB    r2, [r1, #1]            ; Read LSB of horizontal position
	�M        LDRB    r3, [r1, #2]            ; Read MSB of horizontal position
	�H        �R     r2, r2, r3, ASL#8       ; Combine horizontal position
	�N        MOV     r2, r2, ASL#16          ; Scale the horizontal position up
	�S        STR     r2, [r12, #ws_hpos]     ; Store the initial horizontal position
	�K        LDRB    r2, [r1, #3]            ; Read LSB of vertical position
	�K        LDRB    r3, [r1, #4]            ; Read MSB of vertical position
F        �R     r2, r2, r3, ASL#8       ; Combine vertical position

L        MOV     r2, r2, ASL#16          ; Scale the vertical position up
Q        STR     r2, [r12, #ws_vpos]     ; Store the initial vertical position
E        BL      read_vdu                ; Read the pixel scalings
(D        MOVVS   r11, r0                 ; Copy any error pointer
2K        BVS     fail_vdu                ; Fail if an error was produced
<V        MOV     r0, #interval-1         ; Time interval of 'interval' centiseconds
FK        ADR     r1, update              ; Address of the update routine
PN        MOV     r2, r12                 ; Value of r12 used by the handler
ZD        SWI     "XOS_CallEvery"         ; Claim the event vector
dD        MOVVS   r11, r0                 ; Copy any error pointer
nK        BVS     fail_eventv             ; Fail if an error was produced
xJ        MOV     r0, #&1f                ; Number of the SpriteV vector
�L        ADR     r1, spritev_handler     ; Address of the handler routine
�N        MOV     r2, r12                 ; Value of r12 used by the handler
�J        SWI     "XOS_Claim"             ; Claim the OS_SpriteOp vector
�D        MOVVS   r11, r0                 ; Copy any error pointer
�K        BVS     fail_spritev            ; Fail if an error was produced
�H        MOV     r0, #&07                ; Number of the WordV vector
�L        ADR     r1, wordv_handler       ; Address of the handler routine
�N        MOV     r2, r12                 ; Value of r12 used by the handler
�F        SWI     "XOS_Claim"             ; Claim the OS_Word vector
�D        MOVVS   r11, r0                 ; Copy any error pointer
�K        BVS     fail_wordv              ; Fail if an error was produced
�M;       MOV     r0, #14                 ; OS_Byte code to enable an event
�D;       MOV     r1, #4                  ; The vsync event number
L;       SWI     "XOS_Byte"              ; Enable the vertical sync event
D;       MOVVS   r11, r0                 ; Copy any error pointer
K;       BVS     fail_vsync              ; Fail if an error was produced
"?        LDMFD   r13!, {r11, pc}         ; Return to RISC OS
,
6        ; Finalisation code
@.finalisation
J=        STMFD   r13!, {r11, r14}        ; Stack registers
TF        LDR     r12, [r12]              ; Obtain workspace pointer
^E        MOV     r11, #0                 ; Clear the error pointer
hO;        MOV     r0, #13                 ; OS_Byte code to disable an event
rE;        MOV     r1, #4                  ; The vsync event number
|N;        SWI     "XOS_Byte"              ; Disable the vertical sync event
�K        BVS     exit                    ; Exit if an error was produced
�.fail_vsync
�H        MOV     r0, #&07                ; Number of the WordV vector
�L        ADR     r1, wordv_handler       ; Address of the handler routine
�N        MOV     r2, r12                 ; Value of r12 used by the handler
�H        SWI     "XOS_Release"           ; Release the OS_Word vector
�K        BVS     exit                    ; Exit if an error was produced
�.fail_wordv
�J        MOV     r0, #&1f                ; Number of the SpriteV vector
�L        ADR     r1, spritev_handler     ; Address of the handler routine
�N        MOV     r2, r12                 ; Value of r12 used by the handler
�L        SWI     "XOS_Release"           ; Release the OS_SpriteOp vector
�K        BVS     exit                    ; Exit if an error was produced
.fail_spritev
K        ADR     r0, update              ; Address of the update routine
N        MOV     r1, r12                 ; Value of r12 used by the handler
&E        SWI     "XOS_RemoveTickerEvent" ; Remove the ticker event
0K        BVS     exit                    ; Exit if an error was produced
:.fail_eventv
D
.fail_vdu
N.fail_position
XK        MOV     r0, #7                  ; Reason code to release memory
bH        MOV     r2, r12                 ; Copy the workspace pointer
lC        SWI     "XOS_Module"            ; Release the workspace
vK        BVS     exit                    ; Exit if an error was produced
�.fail_ws
�G        TEQ     r11, #0                 ; Is there an error pointer
�G        BEQ     exit                    ; Exit without error if not
�D        MOV     r0, r11                 ; Copy the error pointer
�C        CMP     pc, #&80000000          ; Set the overflow flag
�?.exit   LDMFD   r13!, {r11, pc}         ; Return to RISC OS
�
�"        ; Service call handler
�.service
�@        TEQ     r1, #&46                ; Service_ModeChange
�O        MOVNES  pc, r14                 ; Reject unrecognised calls quickly
�F        LDR     r12, [r12]              ; Obtain workspace pointer
�@        TEQ     r1, #&46                ; Service_ModeChange

N        BEQ     service_mode_change     ; Jump to handler for mode changes



!        ; Handle mode changes

 .service_mode_change

*=        STMFD   r13!, {r14}             ; Stack registers

4D        BL      read_vdu                ; Read the pixel scaling

>F        LDMFD   r13!, {pc}^             ; Return from service call

H

R%        ; Read the pixel scalings

\
.read_vdu

f=        STMFD   r13!, {r0-r3, r14}      ; Stack registers

pM        MVN     r0, #0                  ; Read variables for current mode

zL        MOV     r1, #4                  ; Variable number for XEigFactor

�G        SWI     "XOS_ReadModeVariable"  ; Read the XEigFactor value

�G        MOV     r3, r2                  ; Copy the XEigFactor value

�L        MOV     r1, #5                  ; Variable number for YEigFactor

�G        SWI     "XOS_ReadModeVariable"  ; Read the YEigFactor value

�O        MOV     r0, #0                  ; Initialise the common eigen value

�.read_vdu_loop

�D        TEQ     r2, #0                  ; Is the YEigFactor zero

�D        TEQNE   r3, #0                  ; Is the XEigFactor zero

�S        BEQ     read_vdu_done           ; Exit loop if common component removed

�H        ADD     r0, r0, #1              ; Increment common component

�B        SUB     r2, r2, #1              ; Decrement YEigFactor

�B        SUB     r3, r3, #1              ; Decrement XEigFactor

�I        B       read_vdu_loop           ; Keep looping until finished
.read_vdu_done
J        STR     r0, [r12, #ws_ceig]     ; Store the common eigen value
K        STR     r3, [r12, #ws_xeig]     ; Store the adjusted XEigFactor
$K        STR     r2, [r12, #ws_yeig]     ; Store the adjusted YEigFactor
.D        LDMFD   r13!, {r0-r3, pc}^      ; Return from subroutine
8
B$        ; EventV handler routine
L.eventv_handler
V>;        STMFD   r13!, {r8-r9, r14}      ; Stack registers
`O;        MOV     r9, pc                  ; Save the current status and mode
jI;        �R     r8, r9, #3              ; Derive the SVC-mode version
t=;        TEQP    r8, #0                  ; Enter SVC mode
~K;        MOV     r0, r0                  ; Allow the processor to adapt
�;;        STMFD   r13!, {r14}             ; Save r14_svc
�G;        BL      update                  ; Update the pointer shape
�>;        LDMFD   r13!, {r14}             ; Restore r14_svc
�R;        TEQP    r9, #0                  ; Reenter the original processor mode
�Q;        MOV     r0, r0                  ; Allow the processor to adapt again
�?;        LDMFD   r13!, {r8-r9, pc}^      ; Pass on the call
�
�%        ; SpriteV handler routine
�.spritev_handler
�=        STMFD   r13!, {r2, r8-r11, r14} ; Stack registers
�D        �     r8, r0, #&ff            ; Mask out the reason code
�R        TEQ     r8, #36                 ; Reason code to set the pointer shape
R        BNE     spritev_handler_done    ; Not interested in other reason codes

H        TST     r3, #&10                ; Is the shape being changed
F        BNE     spritev_handler_done    ; Not interested otherwise
G        �     r8, r0, #&300           ; Get register interpretation
(K        TEQ     r8, #512                ; Is it a pointer to the sprite
2I        ADDEQ   r2, r2, #4              ; Advance pointer to the name
<Q        ADR     r8, pointers_start      ; Pointer to the first reference name
F.spritev_handler_loop
PL        MOV     r9, #0                  ; Check from the first character
Z.spritev_handler_char
dI        LDRB    r10, [r2, r9]           ; Read pointer name character
nK        LDRB    r11, [r8, r9]           ; Read reference name character
xL        TEQ     r11, #0                 ; Is it the end of the reference
�E        BEQ     spritev_handler_found   ; Complete match if it is
�E        TEQ     r10, r11                ; Do the characters match
�O        BNE     spritev_handler_next    ; Skip to the next reference if not
�K        ADD     r9, r9, #1              ; Advance to the next character
�Q        TEQ     r9, #12                 ; Maximum length is twelve characters
�O        BEQ     spritev_handler_found   ; All matched if reached this point
�I        B       spritev_handler_char    ; Loop for the next character
�.spritev_handler_next
�H        ADD     r8, r8, #16             ; Advance to the next record
�L        ADR     r9, pointers_end        ; Pointer to the end of the list
�F        TEQ     r8, r9                  ; Has the end been reached
�L        BNE     spritev_handler_loop    ; There is another name to check
�F        MOV     r2, #0                  ; No matching pointer name
.spritev_handler_checked
F        �     r8, r3, #&f             ; Extract the pointer number
D        ADD     r8, r8, #ws_types       ; Offset to type details
"D        STRB    r2, [r12, r8]           ; Store the pointer type
,G        TEQ     r2, #0                  ; Was a pointer match found
6L        �RNE   r3, r3, #&10            ; Clear the shape definition flag
@.spritev_handler_done
JM        LDMFD   r13!, {r2, r8-r11, pc}^ ; Pass on to the original routine
T.spritev_handler_found
^D        LDR     r2, [r8, #12]           ; Read the pointer index
h>        B       spritev_handler_checked ; Handle the match
r
|!        ; Known pointer names
�.pointers_start
�/        �pointer("ptr_default", ptr_single)
�.        �pointer("ptr_double", ptr_double)
�,        �pointer("ptr_write", ptr_caret)
�,        �pointer("ptr_caret", ptr_caret)
�,        �pointer("idc_ibeam", ptr_caret)
�*        �pointer("ptr_menu", ptr_menu)
�.pointers_end
�
�#        ; WordV handler routine
�.wordv_handler
�T        TEQ     r0, #21                 ; The reason code for pointer operations
�H        MOVNES  pc, r14                 ; Pass on other reason codes
=        STMFD   r13!, {r0-r1, r14}      ; Stack registers
E        LDRB    r0, [r1]                ; Get the sub reason code
O        TEQ     r0, #0                  ; Reason code to define the pointer
&R        BNE     wordv_handler_done      ; Not interested in other reason codes
0D        LDR     r0, [r12, #ws_internal] ; Read the internal flag
:I        TEQ     r0, #0                  ; Is it an internal operation
DH        BNE     wordv_handler_done      ; Skip the next bit if it is
NC        LDRB    r0, [r1, #1]            ; Read the shape number
XD        ADD     r0, r0, #ws_types       ; Offset to type details
bN        MOV     r1, #ptr_unknown        ; Code for an unknown pointer type
lN        STRB    r1, [r12, r0]           ; Set this pointer type to unknown
v.wordv_handler_done
�>        LDMFD   r13!, {r0-r1, pc}^      ; Pass on the call
�
�3        ; Update the shape of the mouse pointer
�=.update STMFD   r13!, {r0-r5, r14}      ; Stack registers
�O        MOV     r0, #106                ; Reason code to read pointer shape
�P        MOV     r1, #&7f                ; Invalid shape number to force read
�S        SWI     "XOS_Byte"              ; Read the current pointer shape number
�Q        BVS     update_done             ; No update pointer if error produced
�K        STRB    r1, [r12, #ws_ptr_block_shape]; Store the pointer shape
�C        TST     r1, #&80                ; Is the pointer linked
�>        BNE     update_done             ; No update if not
�D        ADD     r1, r1, #ws_types       ; Offset to type details
�S        LDRB    r3, [r12, r1]           ; Discover the type of pointer required
R        MOV     r0, #21                 ; Reason code to read pointer position
A        ADD     r1, r12, #ws_buffer     ; Pointer to a buffer
R        MOV     r2, #6                  ; Reason code to read pointer position
 I        STRB    r2, [r1]                ; Store reason code in buffer
*C        SWI     "XOS_Word"              ; Read pointer position
4Q        BVS     update_done             ; No update pointer if error produced
>E        MOV     r0, r3                  ; Copy pointer shape type
HM        LDRB    r4, [r1, #1]            ; Read LSB of horizontal position
RM        LDRB    r5, [r1, #2]            ; Read MSB of horizontal position
\H        �R     r4, r4, r5, ASL#8       ; Combine horizontal position
fN        MOV     r4, r4, ASL#16          ; Scale the horizontal position up
pO        LDR     r5, [r12, #ws_hpos]     ; Read previous horizontal position
zK        SUB     r2, r4, r5              ; Calculate horizontal movement
�L        MOV     r2, r2, ASR#1           ; Reduce the horizontal position
�P        ADD     r4, r5, r2              ; And modify the last known position
�K        LDRB    r3, [r1, #3]            ; Read LSB of vertical position
�K        LDRB    r5, [r1, #4]            ; Read MSB of vertical position
�F        �R     r3, r3, r5, ASL#8       ; Combine vertical position
�L        MOV     r3, r3, ASL#16          ; Scale the vertical position up
�M        LDR     r5, [r12, #ws_vpos]     ; Read previous vertical position
�I        SUB     r1, r5, r3              ; Calculate vertical movement
�J        MOV     r1, r1, ASR#1           ; Reduce the vertical movement
�P        SUB     r3, r5, r1              ; And modify the last known position
�Q        STR     r3, [r12, #ws_vpos]     ; Store the updated vertical position
�S        STR     r4, [r12, #ws_hpos]     ; Store the updated horizontal position
�I        LDR     r3, [r12, #ws_ceig]     ; Read the common eigen value
A        MOV     r4, #1                  ; Value to be shifted
=        MOV     r4, r4, ASL r3          ; The eigen value
P        ADD     r1, r1, r4, ASR#1       ; Improve vertical movement rounding
$R        ADD     r2, r2, r4, ASR#1       ; Improve horizontal movement rounding
.I        MOV     r1, r1, ASR r3          ; Scale the vertical movement
8K        MOV     r2, r2, ASR r3          ; Scale the horizontal movement
BN        ADR     r14, update_plot        ; Return address to update pointer
LJ        ADD     pc, pc, r0, LSL#2       ; Jump to the relevant routine
VP        MOV     r0, r0                  ; This instruction is never executed
`@        B       update_done             ; Shape 0 is unknown
jI        B       update_single           ; Shape 1 is a single pointer
tO        B       update_double           ; Shape 2 is a double click pointer
~Q        B       update_write            ; Shape 3 is a caret or writable icon
�J        B       update_menu             ; Shape 4 is a popup menu icon
�.update_plot
�N        MOV     r0, #21                 ; Reason code to set pointer shape
�H        ADD     r1, r12, #ws_ptr_block  ; Pointer to parameter block
�C        STR     r0, [r12, #ws_internal] ; Set the internal flag
�@        SWI     "XOS_Word"              ; Define the pointer
�P        BVS     update_done             ; Skip the rest in an error produced
�K        MOV     r0, #106                ; Reason code to select pointer
�H        LDRB    r1, [r12, #ws_ptr_block_shape]; Get the shape number
�A        SWI     "XOS_Byte"              ; Refresh the pointer
�.update_done
�J        MOV     r0, #0                  ; Value to clear the flag with
E        STR     r0, [r12, #ws_internal] ; Clear the internal flag

H        LDMFD   r13!, {r0-r5, pc}^      ; Return from the subroutine

J        ; Generate a standard pointer shape that has moved by (r2, r1)
(.update_standard
2=        STMFD   r13!, {r0, r3-r8, r14}  ; Stack registers
<N        LDR     r5, [r12, #ws_cogr]     ; Read previous row pointer centre
FQ        LDR     r6, [r12, #ws_cogc]     ; Read previous column pointer centre
PK        MOV     r7, #0                  ; Start by assuming no movement
ZE        TEQ     r1, #0                  ; Is there any row motion
dH        TEQEQ   r2, #0                  ; Is there any column motion
nN        BEQ     update_standard_still   ; Do not change direction if still
xJ        ADD     r5, r5, r1              ; Calculate the new row offset
�M        ADD     r6, r6, r2              ; Calculate the new column offset
�F        MOV     r0, r5, ASR#8           ; Scale the new row offset
�G        MUL     r1, r0, r0              ; Square the new row offset
�I        MOV     r0, r6, ASR#8           ; Scale the new column offset
�J        MUL     r2, r0, r0              ; Square the new column offset
�=        ADD     r0, r1, r2              ; Sum the squares
�K        BL      sqrt                    ; Calculate the new tail length
�J        MOV     r0, r0, ASL#8           ; Scale the new length back up
�I        SUB     r7, r0, #11<<16         ; Subtract the nominal length
�E        MOV     r0, r5                  ; Copy the new row offset
�H        MOV     r1, r6                  ; Copy the new column offset
�I        BL      normalise               ; Normalise the offset length
�K        MOV     r2, #11                 ; The required tail mass length
C        MUL     r5, r2, r0              ; The scaled row offset
F        MUL     r6, r2, r1              ; The scaled column offset
J        STR     r5, [r12, #ws_cogr]     ; Store the updated row centre
"M        STR     r6, [r12, #ws_cogc]     ; Store the updated column centre
,.update_standard_still
6N        MOV     r0, r7, ASR#3           ; Copy and scale the length offset
@G        BL      update_filter           ; Update the pointer wibble
JM        ADD     r0, r0, r0, ASL#2       ; Multiply the length offset by 5
TE        MOV     r7, #11<<16             ; The nominal tail length
^O        ADD     r7, r7, r0              ; Add the wibble to the tail length
hT        MOV     r0, #7                  ; Number of coordinates in pointer shape
rI        ADR     r1, update_standard_basic; Pointer to the basic shape
|P        ADR     r2, update_standard_length; Pointer to the length adjustment
�K        MOV     r3, r7                  ; Copy the required head length
�O        ADD     r4, r12, #ws_buffer     ; Pointer to the destination buffer
�J        BL      trans_add               ; Set the required head length
�R        MOV     r1, r4                  ; New source buffer is previous output
�N        ADR     r2, update_standard_tail; Pointer to tail width adjustment
�=        STMFD   r13!, {r0-r1}           ; Stack registers
�J        MOV     r0, #100<<16            ; Area to divide by the length
�C        MOV     r1, r7, ASR#16          ; Scale the tail length
�G        RSB     r1, r1, #21             ; Calculate the tail length
�M        BL      divide                  ; Calculate the tail width offset
�H        MOV     r3, r0                  ; Copy the tail width offset
�?        LDMFD   r13!, {r0-r1}           ; Restore registers
�L        BL      trans_add               ; Set the width of the tail base
N        ADR     r2, update_standard_head; Pointer to head width adjustment
=        STMFD   r13!, {r0-r1}           ; Stack registers
J        MOV     r0, #132<<16            ; Area to divide by the length
&C        MOV     r1, r7, ASR#16          ; Scale the tail length
0M        BL      divide                  ; Calculate the head width offset
:H        MOV     r3, r0                  ; Copy the head width offset
D?        LDMFD   r13!, {r0-r1}           ; Restore registers
NN        BL      trans_add               ; Set the width of the header base
XR        MOV     r2, r1                  ; Destination coordinates are the same
bO        MOV     r3, r5                  ; Row component of desired vertical
lR        MOV     r4, r6                  ; Column component of desired vertical
vL        BL      trans_rotate            ; Rotate the pointer as required
�S        BL      trans_fit               ; Scale the coordinates for the pointer
�G        MOV     r1, r0                  ; Copy the number of points
�D        LDMFD   r13!, {r0, r3-r8, pc}   ; Return from subroutine
�E.update_standard_basic                  ; The basic pointer shape
�        �coordinate(0, 0)
�        �coordinate(0, 0)
�        �coordinate(0, 2)
�        �coordinate(21, -2)
�        �coordinate(21, 2)
�        �coordinate(0, -2)
�        �coordinate(0, 0)
�O.update_standard_length                 ; Offsets to change the head length
�        �coordinate(0, 0)
        �coordinate(1, 0)
        �coordinate(1, 0)
        �coordinate(0, 0)
         �coordinate(0, 0)
*        �coordinate(1, 0)
4        �coordinate(1, 0)
>N.update_standard_tail                   ; Offsets to change the tail width
H        �coordinate(0, 0)
R        �coordinate(0, 0)
\        �coordinate(0, 0)
f        �coordinate(0, 0.5)
p         �coordinate(0, -0.5)
z        �coordinate(0, 0)
�        �coordinate(0, 0)
�N.update_standard_head                   ; Offsets to change the head width
�        �coordinate(0, 0)
�        �coordinate(0, 0.5)
�        �coordinate(0, 0)
�        �coordinate(0, 0)
�        �coordinate(0, 0)
�        �coordinate(0, 0)
�         �coordinate(0, -0.5)
�
�F        ; Plot a single pointer type r0 that has moved by (r2, r1)
�.update_single
�=        STMFD   r13!, {r0-r2, r14}      ; Stack registers
I        BL      update_standard         ; Construct the pointer shape
G        MOV     r0, #colour_trans       ; Background is transparent
I        BL      plot_fill               ; Clear the pointer initially
$O        MOV     r0, #colour_blue        ; Fill the interior with solid blue
.F        BL      plot_poly_fill          ; Plot the filled interior
8I        MOV     r0, #colour_cyan        ; Outline the pointer in cyan
BF        BL      plot_poly_line          ; Plot the pointer outline
LD        LDMFD   r13!, {r0-r2, pc}       ; Return from subroutine
V
`L        ; Plot a double click pointer type r0 that has moved by (r2, r1)
j.update_double
t=        STMFD   r13!, {r0-r2, r14}      ; Stack registers
~I        BL      update_standard         ; Construct the pointer shape
�G        MOV     r0, #colour_trans       ; Background is transparent
�I        BL      plot_fill               ; Clear the pointer initially
�Q        MOV     r0, #colour_trans_blue  ; Fill interior with transparent blue
�F        BL      plot_poly_fill          ; Plot the filled interior
�I        MOV     r0, #colour_cyan        ; Outline the pointer in cyan
�F        BL      plot_poly_line          ; Plot the pointer outline
�D        LDMFD   r13!, {r0-r2, pc}       ; Return from subroutine
�
�E        ; Plot a caret pointer type r0 that has moved by (r2, r1)
�.update_write
�=        STMFD   r13!, {r0-r6, r14}      ; Stack registers
�K        MOV     r0, r2, ASR#3           ; Value to update position with
?        BL      update_filter           ; Filter the update

D        MOV     r3, r0, ASL#2           ; Copy the filter output
C        MOV     r0, #22                 ; Number of coordinates
H        ADR     r1, update_write_basic  ; The required pointer shape
(Q        ADR     r2, update_write_horizontal; Changes to add horizontal motion
2K        ADD     r4, r12, #ws_buffer     ; Pointer to destination buffer
<I        BL      trans_add               ; Add the motion to the shape
FA        MOV     r1, r4                  ; Copy buffer pointer
PQ        MOV     r2, r1                  ; Use the same buffer for the results
ZS        BL      trans_fit               ; Scale the coordinates for the pointer
dG        MOV     r1, r0                  ; Copy the number of points
nG        MOV     r0, #colour_trans       ; Background is transparent
xI        BL      plot_fill               ; Clear the pointer initially
�K        MOV     r0, #colour_blue        ; Fill interior with solid blue
�F        BL      plot_poly_fill          ; Plot the filled interior
�I        MOV     r0, #colour_cyan        ; Outline the pointer in cyan
�F        BL      plot_poly_line          ; Plot the pointer outline
�D        LDMFD   r13!, {r0-r6, pc}       ; Return from subroutine
�E.update_write_basic                     ; The basic pointer shape
�         �coordinate(-10, -4)
�         �coordinate(-10, -2)
�        �coordinate(-8, 0)
�        �coordinate(-10, 2)
�        �coordinate(-10, 4)
�        �coordinate(-8, 4)
�        �coordinate(-7, 1)
        �coordinate(-2, 1)
        �coordinate(2, 1)
        �coordinate(6, 1)
"        �coordinate(7, 4)
,        �coordinate(9, 4)
6        �coordinate(9, 2)
@        �coordinate(7, 0)
J        �coordinate(9, -2)
T        �coordinate(9, -4)
^        �coordinate(7, -4)
h        �coordinate(6, -1)
r        �coordinate(2, -1)
|        �coordinate(-2, -1)
�        �coordinate(-7, -1)
�        �coordinate(-8, -4)
�M.update_write_horizontal                ; Offsets to distort horizontally
�         �coordinate(0.6, -1)
�"        �coordinate(0.3, -0.8)
�         �coordinate(0, -0.6)
�#        �coordinate(-0.3, -0.8)
�!        �coordinate(-0.6, -1)
�!        �coordinate(-0.6, -1)
�$        �coordinate(-0.15, -0.5)
�"        �coordinate(-0.15, -0)
�!        �coordinate(0.15, -0)
�#        �coordinate(0.15, -0.5)
         �coordinate(0.6, -1)
         �coordinate(0.6, -1)
"        �coordinate(0.3, -0.8)
&         �coordinate(0, -0.6)
0#        �coordinate(-0.3, -0.8)
:!        �coordinate(-0.6, -1)
D!        �coordinate(-0.6, -1)
N$        �coordinate(-0.15, -0.5)
X"        �coordinate(-0.15, -0)
b!        �coordinate(0.15, -0)
l#        �coordinate(0.15, -0.5)
v         �coordinate(0.6, -1)
�
�D        ; Plot a menu pointer type r0 that has moved by (r2, r1)
�.update_menu
�=        STMFD   r13!, {r0-r4, r14}      ; Stack registers
�I        LDR     r3, [r12, #ws_cogr]     ; Read previous row direction
�L        LDR     r4, [r12, #ws_cogc]     ; Read previous column direction
�J        TEQ     r1, #0                  ; Is there any vertical motion
�L        TEQEQ   r2, #0                  ; Is there any horizontal motion
�N        BEQ     update_menu_still       ; Do not change direction if still
�F        ADD     r0, r3, r1, ASR#3       ; Update the row direction
�I        ADD     r1, r4, r2, ASR#3       ; Update the column direction
�L        BL      normalise               ; Normalise the direction vector
�D        MOV     r3, r0                  ; Copy the row direction
G        MOV     r4, r1                  ; Copy the column direction
I        STR     r3, [r12, #ws_cogr]     ; Store the new row direction
L        STR     r4, [r12, #ws_cogc]     ; Store the new column direction
 .update_menu_still
*K        MOV     r0, #8                  ; Number of points to transform
4J        ADR     r1, update_menu_frame   ; Pointer to source cordinates
>K        ADD     r2, r12, #ws_buffer     ; Pointer to destination buffer
HS        BL      trans_fit               ; Scale the coordinates for the pointer
RK        ADD     r2, r2, r0, LSL#3       ; Pointer to destination buffer
\O        MOV     r0, #9                  ; Number of points in pointer shape
fK        ADR     r1, update_menu_ptr     ; Pointer to source coordinates
pL        BL      trans_rotate            ; Rotate the pointer as required
zR        MOV     r1, r2                  ; Source buffer is same as destination
�S        BL      trans_fit               ; Scale the coordinates for the pointer
�G        MOV     r0, #colour_trans       ; Background is transparent
�K        ADD     r2, r12, #ws_buffer     ; Pointer to coordinates buffer
�I        BL      plot_fill               ; Clear the pointer initially
�Q        MOV     r1, #4                  ; Number of coordinates in menu shape
�K        MOV     r0, #colour_trans_blue  ; Fill interior with solid blue
�F        BL      plot_poly_fill          ; Plot the filled interior
�I        MOV     r0, #colour_cyan        ; Outline the pointer in cyan
�F        BL      plot_poly_line          ; Plot the pointer outline
�I        MOV     r0, #colour_trans_cyan  ; Outline the pointer in cyan
�G        ADD     r2, r2, r1, LSL#3       ; Pointer to interior shape
�D        BL      plot_poly_fill          ; Plot the menu interior
�F        ADD     r2, r2, r1, LSL#3       ; Pointer to pointer shape
K        MOV     r0, #colour_blue        ; Fill interior with solid blue
T        MOV     r1, #9                  ; Number of coordinates in pointer shape
F        BL      plot_poly_fill          ; Plot the filled interior
$I        MOV     r0, #colour_cyan        ; Outline the pointer in cyan
.F        BL      plot_poly_line          ; Plot the pointer outline
8D        LDMFD   r13!, {r0-r4, pc}       ; Return from subroutine
BK.update_menu_frame                      ; The outside frame of the menu
L        �coordinate(-3, 0)
V        �coordinate(-3, 16)
`        �coordinate(20, 16)
j        �coordinate(20, 0)
tF.update_menu_entries                    ; The interior of the menu
~        �coordinate(0.5, 1)
�         �coordinate(0.5, 14)
�!        �coordinate(18.5, 14)
�         �coordinate(18.5, 1)
�?.update_menu_ptr                        ; The pointer shape
�        �coordinate(1, 0)
�        �coordinate(5, 4)
�        �coordinate(6, 4)
�        �coordinate(6, 2)
�        �coordinate(11, 2)
�        �coordinate(11, -2)
�        �coordinate(6, -2)
�        �coordinate(6, -4)
        �coordinate(5, -4)


<        ; Apply an underdamped filter to the value in r0
.update_filter
(=        STMFD   r13!, {r1-r3, r14}      ; Stack registers
2C        LDR     r1, [r12, #ws_filtn]    ; Get previous position
<C        LDR     r2, [r12, #ws_filtv]    ; Get previous velocity
FD        LDR     r3, [r12, #ws_friction] ; The amount of friction
PF        RSB     r3, r3, #10             ; Convert to a shift value
ZA        SUB     r2, r2, r2, ASR r3      ; Apply some friction
dA        LDR     r3, [r12, #ws_spring]   ; The spring constant
nF        RSB     r3, r3, #11             ; Convert to a shift value
xK        SUB     r2, r2, r1, ASR r3      ; Include the restorative force
�R        ADD     r1, r1, r2              ; Add part of velocity to the position
�B        LDR     r3, [r12, #ws_force]    ; The force multiplier
�F        RSBS    r3, r3, #13             ; Convert to a shift value
�J        MOVMI   r0, #0                  ; No wibble if result negative
�A        MOV     r0, r0, ASR r3          ; Scale the new input
�?        ADD     r0, r1, r0, ASL#8       ; Add the new input
�G        MOV     r1, #1<<16              ; The maximum allowed value
�D        CMP     r0, r1                  ; Compare to the maximum
�J        MOVGT   r0, r1                  ; Enforce the maximum position
�R        CMPGT   r2, #0                  ; Clip the velocity if maximum reached
�F        MOVGT   r2, #0                  ; Set the velocity to zero
�G        RSB     r1, r1, #0              ; The minimum allowed value
�D        CMP     r0, r1                  ; Compare to the mimimum
A        MOVLT   r0, r1                  ; Enforce the minimum
R        CMPLT   r2, #0                  ; Clip the velocity if minimum reached
F        MOVLT   r2, #0                  ; Set the velocity to zero
"C        MOVS    r1, r0                  ; Copy the new position
,Q        RSBMI   r1, r1, #0              ; Ensure copy of position is positive
6F        CMP     r1, #1<<8               ; Minimum visible position
@S        MOVLT   r2, r2, ASR#1           ; Increase friction when small movement
JD        STR     r0, [r12, #ws_filtn]    ; Store the new position
TD        STR     r2, [r12, #ws_filtv]    ; Store the new velocity
^.update_filter_done
hD        LDMFD   r13!, {r1-r3, pc}       ; Return from subroutine
r
|8        ; Fill the pointer image data with colour r0
�.plot_fill
�=        STMFD   r13!, {r0-r2, r14}      ; Stack registers
�N        BL      colour_expand           ; Expand the colour to fill a word
�I        ADD     r1, r12, #ws_ptr_data   ; Start of pointer image data
�E        MOV     r2, #32                 ; Number of rows to clear
�.plot_fill_loop
�P        SUBS    r2, r2, #1              ; Decrement number of rows remaining
�R        LDMMIFD r13!, {r0-r2, pc}       ; Return from subroutine when finished
�P        STR     r0, [r1], #4            ; Set this word of the pointer image
�P        STR     r0, [r1], #4            ; Set this word of the pointer image
�T        MOV     r0, r0, ROR#2           ; Rotate pattern by a pixel for next row
�D        B       plot_fill_loop          ; Loop for the next word
�
 K        ; Plot a horizontal line in colour r0 from (r2, r1) to (r3, r1)
 
.plot_row
 =        STMFD   r13!, {r0-r4, r14}      ; Stack registers
 &M        LDRB    r4, [r12, #ws_ptr_block_activex]; Read horizontal hotspot
 0G        ADD     r2, r2, r4              ; Set the horizontal origin
 :G        ADD     r3, r3, r4              ; Set the horizontal origin
 DK        LDRB    r4, [r12, #ws_ptr_block_activey]; Read vertical hotspot
 NE        ADD     r1, r1, r4              ; Set the vertical origin
 XO        CMP     r2, r3                  ; Place limits in the correct order
 bC        MOVGT   r4, r2                  ; Make a temporary copy
 l=        MOVGT   r2, r3                  ; Swap the limits
 vK        MOVGT   r3, r4                  ; Copy the temporary value back
 �C        CMP     r1, #0                  ; Check lower row limit
 �M        BLT     plot_row_done           ; No plotting if before first row
 �C        CMP     r1, #31                 ; Check upper row limit
 �K        BGT     plot_row_done           ; No plotting if after last row
 �N        BL      colour_expand           ; Expand the colour to fill a word
 �G        TST     r1, #1                  ; Is it an odd numbered row
 �L        MOVNE   r0, r0, ROR#2           ; Rotate colour pattern if it is
 �A        ADD     r4, r12, r1, ASL#3      ; Calculate row start
 �G        ADD     r4, r4, #ws_ptr_data    ; Include data start offset
 �J        LDR     r1, [r4]                ; Read the existing first word
 �D        BL      plot_row_word           ; Process the first word
 �J        STR     r1, [r4]                ; Store the updated first word
 �G        SUB     r2, r2, #16             ; Adjust the start position
!E        SUB     r3, r3, #16             ; Adjust the end position
!K        LDR     r1, [r4, #4]!           ; Read the existing second word
!E        BL      plot_row_word           ; Process the second word
! K        STR     r1, [r4]                ; Store the updated second word
!*.plot_row_done
!4D        LDMFD   r13!, {r0-r4, pc}       ; Return from subroutine
!>.plot_row_word
!H=        STMFD   r13!, {r2-r4, r14}      ; Stack registers
!RE        CMP     r2, #0                  ; Range check lower limit
!\D        MOVLT   r2, #0                  ; Start from first pixel
!fE        CMP     r3, #15                 ; Range check upper limit
!pC        MOVGT   r3, #15                 ; End at the last pixel
!zM        SUB     r3, r3, r2              ; Difference between the two ends
!�I        ADD     r3, r3, #1              ; Convert to number of pixels
!�G        MOV     r4, r2, ASL#1           ; Convert start to rotation
!�E        MOV     r2, #3                  ; Mask for a single pixel
!�O        MOV     r2, r2, LSL r4          ; Mask for the first pixel position
!�E        MOV     r4, #0                  ; No pixels set initially
!�.plot_row_word_loop
!�H        SUBS    r3, r3, #1              ; Decrement number of pixels
!�I        BMI     plot_row_word_done      ; Escape the loop if finished
!�K        �R     r4, r4, r2              ; Include this pixel in the mask
!�G        MOV     r2, r2, LSL#2           ; Advance to the next pixel
!�E        B       plot_row_word_loop      ; Loop for the next pixel
!�.plot_row_word_done
!�A        BIC     r1, r1, r4              ; Clear pixels to set
";        �     r4, r4, r0              ; Colour the mask
"O        �R     r1, r1, r4              ; Include the new pixels in the word
"D        LDMFD   r13!, {r2-r4, pc}       ; Return from subroutine
"$
".:        ; Plot a single point in colour r0 at (r2, r1)
"8.plot_point
"B=        STMFD   r13!, {r0-r3, r14}      ; Stack registers
"LM        LDRB    r3, [r12, #ws_ptr_block_activex]; Read horizontal hotspot
"VG        ADD     r2, r2, r3              ; Set the horizontal origin
"`K        LDRB    r3, [r12, #ws_ptr_block_activey]; Read vertical hotspot
"jE        ADD     r1, r1, r3              ; Set the vertical origin
"tC        CMP     r1, #0                  ; Check lower row limit
"~F        CMPGE   r2, #0                  ; Check lower column limit
"�P        BLT     plot_point_done         ; No plotting if below visible range
"�C        CMP     r1, #31                 ; Check upper row limit
"�F        CMPLE   r2, #31                 ; Check upper column limit
"�P        BGT     plot_point_done         ; No plotting if above visible range
"�N        BL      colour_expand           ; Expand the colour to fill a word
"�G        TST     r1, #1                  ; Is it an odd numbered row
"�L        MOVNE   r0, r0, ROR#2           ; Rotate colour pattern if it is
"�A        ADD     r1, r12, r1, ASL#3      ; Calculate row start
"�G        ADD     r1, r1, #ws_ptr_data    ; Include data start offset
"�L        TST     r2, #&10                ; Should the second word be used
"�B        ADDNE   r1, r1, #4              ; Advance if it should
"�A        �     r2, r2, #&f             ; Pixel within the word
#C        ADD     r2, r2, r2              ; Convert to a rotation
#
E        MOV     r3, #3                  ; Mask for a single pixel
#L        MOV     r3, r3, LSL r2          ; Rotate to the correct position
#H        �     r0, r0, r3              ; Mask out the required colour
#(J        LDR     r2, [r1]                ; Read the existing image word
#2G        BIC     r2, r2, r3              ; Clear the pixel to be set
#<D        �R     r2, r2, r0              ; Set the required colour
#FE        STR     r2, [r1]                ; Strore the updated word
#P.plot_point_done
#ZD        LDMFD   r13!, {r0-r3, pc}       ; Return from subroutine
#d
#nI        ; Plot a midpoint line in colour r0 from (r2, r1) to (r4, r3)
#x.plot_line
#�=        STMFD   r13!, {r0-r7, r14}      ; Stack registers
#�L        MOV     r5, #0                  ; Start with default coordinates
#�B        SUBS    r1, r1, r3              ; Change in row number
#�L        RSBMI   r3, r3, #0              ; Reflect start point vertically
#�J        RSBMI   r1, r1, #0              ; Reflect change in row number
#�A        �RMI   r5, r5, #2              ; Record vertical flip
#�E        SUBS    r2, r2, r4              ; Change in column number
#�N        RSBMI   r4, r4, #0              ; Reflect start point horizontally
#�M        RSBMI   r2, r2, #0              ; Reflect change in column number
#�C        �RMI   r5, r5, #4              ; Record horizontal flip
#�A        CMP     r2, r1                  ; Check slope of line
#�F        MOVGT   r6, r3                  ; Copy original row number
#�B        MOVGT   r3, r4                  ; Swap row with column
$@        MOVGT   r4, r6                  ; Set new row number
$F        MOVGT   r6, r1                  ; Copy original row change
$B        MOVGT   r1, r2                  ; Swap row with column
$"@        MOVGT   r2, r6                  ; Set new row change
$,G        �RGT   r5, r5, #1              ; Record coordinate reversal
$6G        ADD     r6, r2, r2              ; Horizontal step increment
$@M        SUB     r7, r6, r1              ; Initial decision variable value
$JM        SUB     r2, r2, r1              ; Half of diagonal step increment
$TE        ADD     r2, r2, r2              ; Diagonal step increment
$^E        ADD     r1, r3, r1              ; The last point to plot 
$h.plot_line_loop
$rN        BL      plot_line_point         ; Plot the first point of the line
$|H        CMP     r3, r1                  ; Has the line been finished
$�R        LDMGEFD r13!, {r0-r7, pc}       ; Return from subroutine when finished
$�I        CMP     r7, #0                  ; Check the decision variable
$�I        ADDLE   r7, r7, r6              ; Increment decision variable
$�I        ADDGT   r7, r7, r2              ; Increment decision variable
$�G        ADDGT   r4, r4, #1              ; Perform the diagonal step
$�G        ADD     r3, r3, #1              ; Advance to the next pixel
$�E        B       plot_line_loop          ; Loop for the next pixel
$�.plot_line_point
$�=        STMFD   r13!, {r1-r2, r14}      ; Stack registers
$�L        TST     r5, #1                  ; Have coordinates been reversed
$�>        �Q   r1, r3                  ; Copy unreversed row
$�A        �Q   r2, r4                  ; Copy unreversed column
$�?        MOVNE   r1, r4                  ; Copy reversed row
%B        MOVNE   r2, r3                  ; Copy reversed column
%B        TST     r5, #2                  ; Has row been negated
%D        RSBNE   r1, r1, #0              ; Negate row if required
%&E        TST     r5, #4                  ; Has column been negated
%0G        RSBNE   r2, r2, #0              ; Negate column if required
%:<        BL      plot_point              ; Plot the point
%DD        LDMFD   r13!, {r1-r2, pc}       ; Return from subroutine
%N
%XR        ; Plot a closed polyline in colour r0 using r1 vertices starting at r2
%b.plot_poly_line
%l=        STMFD   r13!, {r0-r7, r14}      ; Stack registers
%vK        MOV     r5, r2                  ; Pointer to the current vertex
%�P        MOV     r6, r2                  ; Keep a pointer to the first vertex
%�E        MOV     r7, r1                  ; Copy number of segments
%�.plot_poly_line_loop
%�J        SUBS    r7, r7, #1              ; Decrement remaining segments
%�R        LDMMIFD r13!, {r0-r7, pc}       ; Return from subroutine when finished
%�I        LDMIA   r5!, {r1-r2}            ; Read line start coordinates
%�O        �Q   r5, r6                  ; Wrap around to the start for the end
%�G        LDMIA   r5, {r3-r4}             ; Read line end coordinates
%�<        BL      plot_line               ; Plot this line
%�L        B       plot_poly_line_loop     ; Loop for the next line segment
%�
%�J        ; Fill a polygon in colour r0 using r1 vertices starting at r2
%�.plot_poly_fill
&=        STMFD   r13!, {r0-r6, r14}      ; Stack registers
&L        SUB     r13, r13, r1, LSL#4     ; Reserve space for edge details
&G        MOV     r3, r13                 ; Copy edge details pointer
& M        SUB     r13, r13, r1, LSL#2     ; Reserve space for intersections
&*H        MOV     r4, r13                 ; Copy intersections pointer
&4I        BL      plot_poly_fill_preprocess; Construct the edge details
&>.plot_poly_fill_loop
&HH        MOV     r2, #0                  ; No intersections found yet
&RI        BL      plot_poly_fill_inter    ; Find any intersecting edges
&\B        BL      plot_poly_fill_plot     ; Perform the plotting
&fE        ADD     r5, r5, #1              ; Advance to the next row
&pK        CMP     r5, r6                  ; Has the last row been reached
&zE        BLE     plot_poly_fill_loop     ; Loop until all finished
&�.plot_poly_fill_done
&�M        ADD     r13, r13, r1, LSL#2     ; Release the intersections space
&�L        ADD     r13, r13, r1, LSL#4     ; Release the edge details space
&�D        LDMFD   r13!, {r0-r6, pc}       ; Return from subroutine
&�.plot_poly_fill_preprocess
&�?        STMFD   r13!, {r0-r4, r7-r10, r14}; Stack registers
&�I        LDR     r5, [r2]                ; Initialise first row number
&�H        LDR     r6, [r2]                ; Initialise last row number
&�A        MOV     r0, r2                  ; Copy vertex pointer
&�#.plot_poly_fill_preprocess_loop
&�G        SUBS    r1, r1, #1              ; Decrement number of edges
&�S        LDMMIFD r13!, {r0-r4, r7-r10, pc}; Return from subroutine when finished
&�I        LDMIA   r0!, {r7-r8}            ; Read line start coordinates
'O        �Q   r0, r2                  ; Wrap around to the start for the end
'G        LDMIA   r0, {r9-r10}            ; Read line end coordinates
'O        CMP     r7, r9                  ; Do the coordinates need reversing
'$I        MOVGT   r4, r7                  ; Copy first row to temporary
'.>        MOVGT   r7, r9                  ; Swap row numbers
'8@        MOVGT   r9, r4                  ; Set end row number
'BL        MOVGT   r4, r8                  ; Copy first column to temporary
'LA        MOVGT   r8, r10                 ; Swap column numbers
'VC        MOVGT   r10, r4                 ; Set end column number
'`D        CMP     r7, r5                  ; Compare with first row
'jQ        MOVLT   r5, r7                  ; Update first row number is required
'tC        CMP     r9, r6                  ; Compare with last row
'~P        MOVGT   r6, r9                  ; Update last row number is required
'�@        MOV     r8, r8, ASL#16          ; Scale start column
'�>        MOV     r10, r10, ASL#16        ; Scale end column
'�D        STR     r7, [r3]                ; Store start row number
'�B        STR     r9, [r3, #4]            ; Store end row number
'�G        STR     r8, [r3, #8]            ; Store start column number
'�=        STMFD   r13!, {r0-r1}           ; Stack registers
'�D        SUB     r0, r10, r8             ; Required column change
'�A        SUBS    r1, r9, r7              ; Required row change
'�@        �Q   r0, #0                  ; Fake horizontal lines
'�H        BLNE    divide                  ; Calculate column increment
'�G        STR     r0, [r3, #12]           ; Store start column number
'�?        LDMFD   r13!, {r0-r1}           ; Restore registers
(J        ADD     r3, r3, #16             ; Advance edge details pointer
(
J        B       plot_poly_fill_preprocess_loop; Loop for the next edge
(.plot_poly_fill_inter
(>        STMFD   r13!, {r0-r1, r3-r9, r14}; Stack registers
((.plot_poly_fill_inter_loop
(2G        SUBS    r1, r1, #1              ; Decrement number of edges
(<R        LDMMIFD r13!, {r0-r1, r3-r9, pc}; Return from subroutine when finished
(FL        LDMIA   r3!, {r6-r9}            ; Read the details for this edge
(PG        CMP     r6, r5                  ; Is start row early enough
(ZH        BGT     plot_poly_fill_inter_loop; Loop for next edge if not
(dD        CMP     r7, r5                  ; Is end row late enough
(nH        BLE     plot_poly_fill_inter_loop; Loop for next edge if not
(xO        SUB     r6, r5, r6              ; Number of rows from start of edge
(�H        MLA     r8, r6, r9, r8          ; Calculate intercept column
(�H        MOV     r0, r8, ASR#16          ; Scale the intercept column
(�S        ADD     r6, r4, r2, LSL#2       ; The next available intersection entry
(� .plot_poly_fill_inter_insert
(�K        TEQ     r4, r6                  ; Is this the start of the list
(�M        BEQ     plot_poly_fill_inter_done; Exit loop if the start reached
(�L        LDR     r7, [r6, #-4]           ; Read the previous intersection
(�P        CMP     r0, r7                  ; Should this intersection be ealier
(�O        STRLT   r7, [r6], #-4           ; Shuffle down to next intersection
(�/        BLT     plot_poly_fill_inter_insert
(�.plot_poly_fill_inter_done
(�Q        STR     r0, [r6]                ; Store this intersection in the list
(�J        ADD     r2, r2, #1              ; Increment intersection count
)A        B       plot_poly_fill_inter_loop; Loop for next edge
).plot_poly_fill_plot
)=        STMFD   r13!, {r1-r5, r14}      ; Stack registers
)"=        MOV     r1, r5                  ; Copy row number
),J        MOV     r5, r2, LSR#1           ; Calculate number of segments
)6.plot_poly_fill_plot_loop
)@E        SUBS    r5, r5, #1              ; Decrement segment count
)JD        LDMMIFD r13!, {r1-r5, pc}       ; Return from subroutine
)TB        LDMIA   r4!, {r2-r3}            ; Read segment details
)^H        ADD     r2, r2, #1              ; Advance the start position
)hD        CMP     r2, r3                  ; Is the segment visible
)rJ        BLLE    plot_row                ; Plot this segment if visible
)|G        B       plot_poly_fill_plot_loop; Loop for the next segment
)�
)�F        ; Expand a single byte colour description into a full word
)�.colour_expand
)�>        �R     r0, r0, r0, LSL#8       ; Expand to 16 bits
)�>        �R     r0, r0, r0, LSL#16      ; Expand to 32 bits
)�D        MOV     pc, r14                 ; Return from subroutine
)�
)�(        ; Divide r0 by r1 to give r0
)�=.divide STMFD   r13!, {r2-r3, r14}      ; Stack registers
)�B        CMP     r0, #0                  ; Is dividend negative
)�I        RSBMI   r0, r0, #0              ; Ensure dividend is positive
)�B        BL      divide_unsigned         ; Perform the division
)�L        RSBMI   r0, r0, #0              ; Correct the sign of the result
*D        LDMFD   r13!, {r2-r3, pc}       ; Return from subroutine
*.divide_unsigned
*>        MOV     r3, r1                  ; Copy the divisor
*&T        CMP     r3, r0, LSR#1           ; Is divisor larger than double dividend
*0.divide_unsigned_double
*:@        MOVLS   r3, r3, LSL#1           ; Double the divisor
*DT        CMPLS   r3, r0, LSR#1           ; Is divisor larger than double dividend
*NL        BLS     divide_unsigned_double  ; Loop again if not large enough
*X@        MOV     r2, #0                  ; Clear the quotient
*b.divide_unsigned_loop
*lK        CMP     r0, r3                  ; Can the divisor be subtracted
*vJ        SUBCS   r0, r0, r3              ; Subtract divisor if possible
*�Q        ADC     r2, r2, r2              ; Double quotient and add the new bit
*�?        MOV     r3, r3, LSR#1           ; Halve the divisor
*�T        CMP     r3, r1                  ; Has the original divisor been exceeded
*�@        BCS     divide_unsigned_loop    ; Loop if it has not
*�=        MOV     r0, r2                  ; Copy the result
*�D        MOVS    pc, r14                 ; Return from subroutine
*�
*�O        ; Calculate the square root of an unsigned integer in r0 to give r0
*�=.sqrt   STMFD   r13!, {r1-r4, r14}      ; Stack registers
*�G        MOV     r1, r0                  ; Copy the original integer
*�C        MOV     r0, #0                  ; Initialise the result
*�C        MOV     r2, #1<<15              ; The first bit to test
*�.sqrt_loop
+H        �R     r3, r0, r2              ; Construct the current guess
+F        MUL     r4, r3, r3              ; Square the current guess
+M        CMP     r4, r1                  ; Compare with the required value
+ P        MOVLS   r0, r3                  ; Keep the current guess if suitable
+*E        MOVS    r2, r2, LSR#1           ; Advance to the next bit
+4H        BNE     sqrt_loop               ; Loop until all bits tested
+>D        LDMFD   r13!, {r1-r4, pc}       ; Return from subroutine
+H
+RF        ; Normalise a vector (r0, r1) to have a magnitude of 1<<16
+\.normalise
+f=        STMFD   r13!, {r2-r5, r14}      ; Stack registers
+pH        TEQ     r0, #0                  ; Check horizontal component
+zF        TEQEQ   r1, #0                  ; Check vertical component
+�N        BEQ     normalise_done          ; Unable to normalise zero vectors
+�K        MOVS    r2, r0                  ; Copy the horizontal component
+�B        RSBMI   r0, r0, #0              ; Keep a positive copy
+�I        MOVS    r3, r1                  ; Copy the vertical component
+�B        RSBMI   r1, r1, #0              ; Keep a positive copy
+�.normalise_prescale
+�O        TST     r0, #1<<30              ; Is the horizontal component large
+�M        TSTEQ   r1, #1<<30              ; Is the vertical component large
+�G        BNE     normalise_prescale_done ; Skip loop if large enough
+�M        MOV     r2, r2, ASL#1           ; Double the horizontal component
+�R        MOV     r0, r0, ASL#1           ; Double the horizontal component copy
+�K        MOV     r3, r3, ASL#1           ; Double the vertical component
+�P        MOV     r1, r1, ASL#1           ; Double the vertical component copy
,E        B       normalise_prescale      ; Loop until large enough
,.normalise_prescale_done
,M        MOV     r4, r2, ASR#16          ; Scale down horizontal component
,$K        MOV     r5, r3, ASR#16          ; Scale down vertical component
,.M        MUL     r0, r4, r4              ; Square the horizontal component
,8K        MUL     r1, r5, r5              ; Square the vertical component
,BL        ADD     r0, r0, r1              ; Sum the squares of the lengths
,LP        BL      sqrt                    ; Calculate the length of the vector
,V@        TEQ     r0, #0                  ; Is the length zero
,`A        �Q   r0, #1                  ; Force a minimum length
,jF        MOV     r1, r0                  ; Copy length to divide by
,tI        MOV     r0, r3                  ; Copy the vertical component
,~J        BL      divide                  ; Scale the vertical component
,�Q        MOV     r3, r0                  ; Store the scaled vertical component
,�K        MOV     r0, r2                  ; Copy the horizontal component
,�L        BL      divide                  ; Scale the horizontal component
,�S        MOV     r1, r3                  ; Restore the scaled vertical component
,�.normalise_done
,�D        LDMFD   r13!, {r2-r5, pc}       ; Return from subroutine
,�
,�T        ; Scale and translate r0 coordinates from at r1 to at r2 for the pointer
,�.trans_fit
,�=        STMFD   r13!, {r0-r10, r14}     ; Stack registers
,�K        MOV     r3, #0                  ; Initialise minimum row number
,�K        MOV     r4, #0                  ; Initialise maximum row number
-N        MOV     r5, #0                  ; Initialise minimum column number
-
N        MOV     r6, #0                  ; Initialise maximum column number
-G        LDR     r9, [r12, #ws_yeig]     ; Read the YEigFactor value
-G        LDR     r10, [r12, #ws_xeig]    ; Read the XEigFactor value
-(.trans_fit_loop
-2M        SUBS    r0, r0, #1              ; Decrement number of coordinates
-<Q        BMI     trans_fit_hotspot       ; Exit loop when all coordinates done
-FK        LDMIA   r1!, {r7-r8}            ; Read the next coordinate pair
-PI        ADD     r7, r7, #1<<15          ; Improve horizontal rounding
-ZA        MOV     r7, r7, ASR#16          ; Scale column number
-dG        MOV     r7, r7, ASR r9          ; Scale by eigen value also
-nI        ADD     r8, r8, #1<<15          ; Improve horizontal rounding
-xA        MOV     r8, r8, ASR#16          ; Scale column number
-�G        MOV     r8, r8, ASR r10         ; Scale by eigen value also
-�O        STMIA   r2!, {r7-r8}            ; Write the transformed coordinates
-�F        CMP     r7, r3                  ; Compare with minimum row
-�L        MOVLT   r3, r7                  ; Update minimum row if required
-�F        CMP     r7, r4                  ; Compare with maximum row
-�L        MOVGT   r4, r7                  ; Update maximum row if required
-�I        CMP     r8, r5                  ; Compare with minimum column
-�O        MOVLT   r5, r8                  ; Update minimum column if required
-�I        CMP     r8, r6                  ; Compare with maximum column
-�O        MOVGT   r6, r8                  ; Update maximum column if required
-�O        B       trans_fit_loop          ; Loop for the next coordinate pair
-�.trans_fit_hotspot
-�P        LDRB    r0, [r12, #ws_ptr_block_activey]; Read last vertical hotspot
.R        LDRB    r1, [r12, #ws_ptr_block_activex]; Read last horizontal hotspot
.E        ADD     r7, r4, r0              ; Calculate last used row
.R        RSBS    r7, r7, #31             ; Number of spare pixels at the bottom
."K        ADDMI   r0, r0, r7              ; Force last row within pointer
.,F        ADDS    r7, r3, r0              ; Calculate first used row
.6L        SUBMI   r0, r0, r7              ; Force first row within pointer
.@K        CMP     r0, #0                  ; Is hotspot within the pointer
.JF        MOVLT   r0, #0                  ; Hotspot must be positive
.TK        CMP     r0, #31                 ; Is hotspot within the pointer
.^P        MOVGT   r0, #31                 ; Restrict hotspot to within pointer
.hH        ADD     r8, r6, r1              ; Calculate last used column
.rQ        RSBS    r8, r8, #31             ; Number of spare pixels at the right
.|N        ADDMI   r1, r1, r8              ; Force last column within pointer
.�I        ADDS    r8, r5, r1              ; Calculate first used column
.�O        SUBMI   r1, r1, r8              ; Force first column within pointer
.�K        CMP     r1, #0                  ; Is hotspot within the pointer
.�F        MOVLT   r1, #0                  ; Hotspot must be positive
.�K        CMP     r1, #31                 ; Is hotspot within the pointer
.�P        MOVGT   r1, #31                 ; Restrict hotspot to within pointer
.�L        STRB    r0, [r12, #ws_ptr_block_activey]; Store vertical hotspot
.�N        STRB    r1, [r12, #ws_ptr_block_activex]; Store horizontal hotspot
.�.trans_fit_done
.�D        LDMFD   r13!, {r0-r10, pc}      ; Return from subroutine
.�
.�N        ; Rotate r0 coordinates from at r1 to at r2 with vertical (r4, r3)
.�.trans_rotate
/=        STMFD   r13!, {r0-r8, r14}      ; Stack registers
/=        STMFD   r13!, {r0-r1}           ; Stack registers
/?        MOV     r0, r3                  ; Copy vertical row
/&B        MOV     r1, r4                  ; Copy vertical column
/0K        BL      normalise               ; Normalise the vertical vector
/:K        MOV     r3, r0, ASR#8           ; Copy and scale normalised row
/DN        MOV     r4, r1, ASR#8           ; Copy and scale normalised column
/N?        LDMFD   r13!, {r0-r1}           ; Restore registers
/X.trans_rotate_loop
/bM        SUBS    r0, r0, #1              ; Decrement number of coordinates
/lR        LDMMIFD r13!, {r0-r8, pc}       ; Return from subroutine when finished
/vK        LDMIA   r1!, {r5-r6}            ; Read the next coordinate pair
/�E        MOV     r5, r5, ASR#8           ; Prescale the row number
/�H        MOV     r6, r6, ASR#8           ; Prescale the column number
/�?        MUL     r7, r5, r3              ; Rotate row to row
/�J        RSB     r7, r7, #0              ; Correct sign of row rotation
/�B        MUL     r8, r5, r4              ; Rotate row to column
/�B        MLA     r7, r6, r4, r7          ; Rotate column to row
/�E        MLA     r8, r6, r3, r8          ; Rotate column to column
/�M        RSB     r8, r8, #0              ; Correct sign of column rotation
/�O        STMIA   r2!, {r7-r8}            ; Write the transformed coordinates
/�N        B       trans_rotate_loop       ; Keep looping until all processed
/�
/�R        ; Add r0 coordinates at r1 to r3 fraction of those at r2 to give at r4
/�.trans_add
0=        STMFD   r13!, {r0-r8, r14}      ; Stack registers
0L        MOV     r3, r3, ASR#8           ; Prescale the required fraction
0.trans_add_loop
0 M        SUBS    r0, r0, #1              ; Decrement number of coordinates
0*R        LDMMIFD r13!, {r0-r8, pc}       ; Return from subroutine when finished
04K        LDMIA   r1!, {r5-r6}            ; Read the original coordinates
0>F        LDMIA   r2!, {r7-r8}            ; Read the new coordinates
0HI        MOV     r7, r7, ASR#8           ; Prescale the new row number
0RL        MOV     r8, r8, ASR#8           ; Prescale the new column number
0\K        MLA     r5, r7, r3, r5          ; Add the required row fraction
0fN        MLA     r6, r8, r3, r6          ; Add the required column fraction
0pK        STMIA   r4!, {r5-r6}            ; Write the updated coordinates
0zN        B       trans_add_loop          ; Keep looping until all processed
0�
0�	    ]
0��
0�
0�� Save the resulting module
0�9ș "OS_File", 10, filename$, &ffA,, code%, code% + P%
0��
0�
0�2� The name and corresponding type of a pointer
0�ݤpointer(name$, type%)
0�    [OPT opt%
0�/        EQUS    name$ + �12 - �(name$), �0)
0�        EQUD    type%
1	    ]
1= 0
1
1$)� Literal fixed point coordinate pair
1.ݤcoordinate(row, column)
18    [OPT opt%
1B&        EQUD    �(row * (1 << 16))
1L)        EQUD    �(column * (1 << 16))
1V	    ]
1`= 0
1j
1t,� Read a word from a non-aligned address
1~ݤldru(rd, ra, rb, rc)
1�    [OPT opt%
1�G        BIC     rb, ra, #3              ; Get word aligned address 
1�K        LDMIA   rb, {rd, rc}            ; Get 64 bits containing answer
1�F        �     rb, ra, #3              ; Correction factor in bytes
1�N        MOVS    rb, rb, LSL#3           ; and in bits, so check if aligned
1�S        MOVNE   rd, rd, LSR rb          ; If not, produce bottom bits of result
1�D        RSBNE   rb, rb, #32             ; Get other shift amount
1�J        �RNE   rd, rd, rc, LSL rb      ; Combine two halves for result
1�	    ]
1�= 0
�
00000000  0d 00 0a 1c f4 20 46 69  6c 65 20 20 20 20 20 20  |..... File      |
00000010  20 20 3a 20 43 72 61 7a  79 53 72 63 0d 00 14 1d  |  : CrazySrc....|
00000020  f4 20 44 61 74 65 20 20  20 20 20 20 20 20 3a 20  |. Date        : |
00000030  31 30 2d 4a 75 6e 2d 39  38 0d 00 1e 29 f4 20 41  |10-Jun-98...). A|
00000040  75 74 68 6f 72 20 20 20  20 20 20 3a 20 a9 20 41  |uthor      : . A|
00000050  2e 54 68 6f 75 6b 79 64  69 64 65 73 2c 20 31 39  |.Thoukydides, 19|
00000060  39 37 0d 00 28 32 f4 20  44 65 73 63 72 69 70 74  |97..(2. Descript|
00000070  69 6f 6e 20 3a 20 43 68  61 6e 67 65 20 74 68 65  |ion : Change the|
00000080  20 70 6f 69 6e 74 65 72  20 61 70 70 65 61 72 61  | pointer appeara|
00000090  6e 63 65 2e 0d 00 32 45  f4 20 20 20 20 20 20 20  |nce...2E.       |
000000a0  20 20 20 20 20 20 20 20  54 68 69 73 20 69 73 20  |        This is |
000000b0  69 6e 73 70 69 72 65 64  20 62 79 20 4d 6f 75 73  |inspired by Mous|
000000c0  65 50 20 77 72 69 74 74  65 6e 20 62 79 20 41 6e  |eP written by An|
000000d0  64 72 65 77 20 42 6f 6c  74 0d 00 3c 4d f4 20 20  |drew Bolt..<M.  |
000000e0  20 20 20 20 20 20 20 20  20 20 20 20 20 66 72 6f  |             fro|
000000f0  6d 20 74 68 65 20 2a 49  6e 66 6f 20 73 65 63 74  |m the *Info sect|
00000100  69 6f 6e 20 6f 66 20 41  63 6f 72 6e 20 55 73 65  |ion of Acorn Use|
00000110  72 20 6d 61 67 61 7a 69  6e 65 2c 20 4a 75 6e 65  |r magazine, June|
00000120  20 31 39 39 37 2e 0d 00  46 04 0d 00 50 26 f4 20  | 1997...F...P&. |
00000130  4d 6f 64 69 66 69 65 64  20 20 20 20 3a 20 4e 69  |Modified    : Ni|
00000140  63 6b 20 4b 65 6e 6e 65  64 79 2c 20 31 39 39 38  |ck Kennedy, 1998|
00000150  0d 00 5a 53 f4 20 20 20  20 20 20 20 20 20 20 20  |..ZS.           |
00000160  20 20 20 20 54 68 69 73  20 6e 6f 77 20 77 6f 72  |    This now wor|
00000170  6b 73 20 6f 6e 20 70 72  65 20 52 69 73 63 4f 53  |ks on pre RiscOS|
00000180  20 33 2e 36 30 20 6d 61  63 68 69 6e 65 73 2c 20  | 3.60 machines, |
00000190  61 6e 64 20 65 78 69 74  73 20 63 6f 72 72 65 63  |and exits correc|
000001a0  74 6c 79 0d 00 64 3b f4  20 20 20 20 20 20 20 20  |tly..d;.        |
000001b0  20 20 20 20 20 20 20 69  66 20 74 68 65 72 65 20  |       if there |
000001c0  69 73 20 61 6e 20 65 72  72 6f 72 20 6f 6e 20 69  |is an error on i|
000001d0  6e 69 74 69 61 6c 69 73  61 74 69 6f 6e 2e 0d 00  |nitialisation...|
000001e0  6e 04 0d 00 78 2b f4 20  54 68 65 20 66 69 6c 65  |n...x+. The file|
000001f0  6e 61 6d 65 20 74 6f 20  73 61 76 65 20 74 68 65  |name to save the|
00000200  20 6d 6f 64 75 6c 65 20  75 6e 64 65 72 0d 00 82  | module under...|
00000210  1c 66 69 6c 65 6e 61 6d  65 24 20 3d 20 22 43 72  |.filename$ = "Cr|
00000220  61 7a 79 50 6f 69 6e 74  22 0d 00 8c 04 0d 00 96  |azyPoint".......|
00000230  2c f4 20 41 6c 6c 6f 63  61 74 65 20 6d 65 6d 6f  |,. Allocate memo|
00000240  72 79 20 74 6f 20 61 73  73 65 6d 62 6c 65 20 74  |ry to assemble t|
00000250  68 65 20 6d 6f 64 75 6c  65 0d 00 a0 16 63 6f 64  |he module....cod|
00000260  65 5f 73 69 7a 65 25 20  3d 20 26 32 30 30 30 0d  |e_size% = &2000.|
00000270  00 aa 16 de 20 63 6f 64  65 25 20 63 6f 64 65 5f  |.... code% code_|
00000280  73 69 7a 65 25 0d 00 b4  04 0d 00 be 3a f4 20 49  |size%.......:. I|
00000290  6e 74 65 72 76 61 6c 20  62 65 74 77 65 65 6e 20  |nterval between |
000002a0  75 70 64 61 74 65 73 20  69 6e 20 63 65 6e 74 69  |updates in centi|
000002b0  73 65 63 6f 6e 64 73 20  28 6d 69 6e 69 6d 75 6d  |seconds (minimum|
000002c0  20 32 29 0d 00 c8 0e 69  6e 74 65 72 76 61 6c 3d  | 2)....interval=|
000002d0  34 0d 00 d2 04 0d 00 dc  13 f4 20 50 6f 69 6e 74  |4......... Point|
000002e0  65 72 20 74 79 70 65 73  0d 00 e6 13 70 74 72 5f  |er types....ptr_|
000002f0  75 6e 6b 6e 6f 77 6e 20  3d 20 30 0d 00 f0 12 70  |unknown = 0....p|
00000300  74 72 5f 73 69 6e 67 6c  65 20 3d 20 31 0d 00 fa  |tr_single = 1...|
00000310  12 70 74 72 5f 64 6f 75  62 6c 65 20 3d 20 32 0d  |.ptr_double = 2.|
00000320  01 04 11 70 74 72 5f 63  61 72 65 74 20 3d 20 33  |...ptr_caret = 3|
00000330  0d 01 0e 10 70 74 72 5f  6d 65 6e 75 20 3d 20 34  |....ptr_menu = 4|
00000340  0d 01 18 04 0d 01 22 15  f4 20 50 6f 69 6e 74 65  |......".. Pointe|
00000350  72 20 63 6f 6c 6f 75 72  73 0d 01 2c 14 63 6f 6c  |r colours..,.col|
00000360  6f 75 72 5f 74 72 61 6e  73 20 3d 20 30 0d 01 36  |our_trans = 0..6|
00000370  15 63 6f 6c 6f 75 72 5f  63 79 61 6e 20 3d 20 26  |.colour_cyan = &|
00000380  35 35 0d 01 40 15 63 6f  6c 6f 75 72 5f 62 6c 75  |55..@.colour_blu|
00000390  65 20 3d 20 26 61 61 0d  01 4a 14 63 6f 6c 6f 75  |e = &aa..J.colou|
000003a0  72 5f 72 65 64 20 3d 20  26 66 66 0d 01 54 1b 63  |r_red = &ff..T.c|
000003b0  6f 6c 6f 75 72 5f 74 72  61 6e 73 5f 63 79 61 6e  |olour_trans_cyan|
000003c0  20 3d 20 26 31 31 0d 01  5e 1b 63 6f 6c 6f 75 72  | = &11..^.colour|
000003d0  5f 74 72 61 6e 73 5f 62  6c 75 65 20 3d 20 26 32  |_trans_blue = &2|
000003e0  32 0d 01 68 1a 63 6f 6c  6f 75 72 5f 74 72 61 6e  |2..h.colour_tran|
000003f0  73 5f 72 65 64 20 3d 20  26 33 33 0d 01 72 04 0d  |s_red = &33..r..|
00000400  01 7c 18 f4 20 55 73 61  67 65 20 6f 66 20 77 6f  |.|.. Usage of wo|
00000410  72 6b 73 70 61 63 65 0d  01 86 13 77 73 5f 69 6e  |rkspace....ws_in|
00000420  74 65 72 6e 61 6c 20 3d  20 30 0d 01 90 10 77 73  |ternal = 0....ws|
00000430  5f 74 79 70 65 73 20 3d  20 34 0d 01 9a 10 77 73  |_types = 4....ws|
00000440  5f 68 70 6f 73 20 3d 20  31 32 0d 01 a4 10 77 73  |_hpos = 12....ws|
00000450  5f 76 70 6f 73 20 3d 20  31 36 0d 01 ae 10 77 73  |_vpos = 16....ws|
00000460  5f 78 65 69 67 20 3d 20  32 30 0d 01 b8 10 77 73  |_xeig = 20....ws|
00000470  5f 79 65 69 67 20 3d 20  32 34 0d 01 c2 10 77 73  |_yeig = 24....ws|
00000480  5f 63 65 69 67 20 3d 20  32 38 0d 01 cc 11 77 73  |_ceig = 28....ws|
00000490  5f 66 69 6c 74 6e 20 3d  20 33 32 0d 01 d6 11 77  |_filtn = 32....w|
000004a0  73 5f 66 69 6c 74 76 20  3d 20 33 36 0d 01 e0 10  |s_filtv = 36....|
000004b0  77 73 5f 63 6f 67 72 20  3d 20 34 30 0d 01 ea 10  |ws_cogr = 40....|
000004c0  77 73 5f 63 6f 67 63 20  3d 20 34 34 0d 01 f4 14  |ws_cogc = 44....|
000004d0  77 73 5f 66 72 69 63 74  69 6f 6e 20 3d 20 34 38  |ws_friction = 48|
000004e0  0d 01 fe 12 77 73 5f 73  70 72 69 6e 67 20 3d 20  |....ws_spring = |
000004f0  35 32 0d 02 08 11 77 73  5f 66 6f 72 63 65 20 3d  |52....ws_force =|
00000500  20 35 36 0d 02 12 19 77  73 5f 70 74 72 5f 62 6c  | 56....ws_ptr_bl|
00000510  6f 63 6b 20 3d 20 36 30  20 2b 20 32 0d 02 1c 29  |ock = 60 + 2...)|
00000520  77 73 5f 70 74 72 5f 62  6c 6f 63 6b 5f 73 68 61  |ws_ptr_block_sha|
00000530  70 65 20 3d 20 77 73 5f  70 74 72 5f 62 6c 6f 63  |pe = ws_ptr_bloc|
00000540  6b 20 2b 20 31 0d 02 26  29 77 73 5f 70 74 72 5f  |k + 1..&)ws_ptr_|
00000550  62 6c 6f 63 6b 5f 77 69  64 74 68 20 3d 20 77 73  |block_width = ws|
00000560  5f 70 74 72 5f 62 6c 6f  63 6b 20 2b 20 32 0d 02  |_ptr_block + 2..|
00000570  30 2a 77 73 5f 70 74 72  5f 62 6c 6f 63 6b 5f 68  |0*ws_ptr_block_h|
00000580  65 69 67 68 74 20 3d 20  77 73 5f 70 74 72 5f 62  |eight = ws_ptr_b|
00000590  6c 6f 63 6b 20 2b 20 33  0d 02 3a 2b 77 73 5f 70  |lock + 3..:+ws_p|
000005a0  74 72 5f 62 6c 6f 63 6b  5f 61 63 74 69 76 65 78  |tr_block_activex|
000005b0  20 3d 20 77 73 5f 70 74  72 5f 62 6c 6f 63 6b 20  | = ws_ptr_block |
000005c0  2b 20 34 0d 02 44 2b 77  73 5f 70 74 72 5f 62 6c  |+ 4..D+ws_ptr_bl|
000005d0  6f 63 6b 5f 61 63 74 69  76 65 79 20 3d 20 77 73  |ock_activey = ws|
000005e0  5f 70 74 72 5f 62 6c 6f  63 6b 20 2b 20 35 0d 02  |_ptr_block + 5..|
000005f0  4e 28 77 73 5f 70 74 72  5f 62 6c 6f 63 6b 5f 64  |N(ws_ptr_block_d|
00000600  61 74 61 20 3d 20 77 73  5f 70 74 72 5f 62 6c 6f  |ata = ws_ptr_blo|
00000610  63 6b 20 2b 20 36 0d 02  58 21 77 73 5f 62 75 66  |ck + 6..X!ws_buf|
00000620  66 65 72 20 3d 20 77 73  5f 70 74 72 5f 62 6c 6f  |fer = ws_ptr_blo|
00000630  63 6b 20 2b 20 31 30 0d  02 62 18 77 73 5f 62 75  |ck + 10..b.ws_bu|
00000640  66 66 65 72 5f 73 69 7a  65 20 3d 20 32 35 36 0d  |ffer_size = 256.|
00000650  02 6c 2c 77 73 5f 70 74  72 5f 64 61 74 61 20 3d  |.l,ws_ptr_data =|
00000660  20 77 73 5f 62 75 66 66  65 72 20 2b 20 77 73 5f  | ws_buffer + ws_|
00000670  62 75 66 66 65 72 5f 73  69 7a 65 0d 02 76 1a 77  |buffer_size..v.w|
00000680  73 5f 70 74 72 5f 64 61  74 61 5f 73 69 7a 65 20  |s_ptr_data_size |
00000690  3d 20 32 35 36 0d 02 80  2c 77 73 5f 73 69 7a 65  |= 256...,ws_size|
000006a0  20 3d 20 77 73 5f 70 74  72 5f 64 61 74 61 20 2b  | = ws_ptr_data +|
000006b0  20 77 73 5f 70 74 72 5f  64 61 74 61 5f 73 69 7a  | ws_ptr_data_siz|
000006c0  65 0d 02 8a 04 0d 02 94  19 f4 20 4d 75 6c 74 69  |e......... Multi|
000006d0  2d 70 61 73 73 20 61 73  73 65 6d 62 6c 79 0d 02  |-pass assembly..|
000006e0  9e 18 e3 20 6f 70 74 25  20 3d 20 31 32 20 b8 20  |... opt% = 12 . |
000006f0  31 34 20 88 20 32 0d 02  a8 0e 20 20 20 20 50 25  |14 . 2....    P%|
00000700  20 3d 20 30 0d 02 b2 12  20 20 20 20 4f 25 20 3d  | = 0....    O% =|
00000710  20 63 6f 64 65 25 0d 02  bc 1f 20 20 20 20 4c 25  | code%....    L%|
00000720  20 3d 20 63 6f 64 65 25  20 2b 20 63 6f 64 65 5f  | = code% + code_|
00000730  73 69 7a 65 25 0d 02 c6  11 20 20 20 20 5b 4f 50  |size%....    [OP|
00000740  54 20 6f 70 74 25 0d 02  d0 04 0d 02 da 1b 20 20  |T opt%........  |
00000750  20 20 20 20 20 20 3b 20  4d 6f 64 75 6c 65 20 68  |      ; Module h|
00000760  65 61 64 65 72 0d 02 e4  38 20 20 20 20 20 20 20  |eader...8       |
00000770  20 45 51 55 44 20 20 20  20 30 20 20 20 20 20 20  | EQUD    0      |
00000780  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000790  20 3b 20 53 74 61 72 74  20 63 6f 64 65 0d 02 ee  | ; Start code...|
000007a0  41 20 20 20 20 20 20 20  20 45 51 55 44 20 20 20  |A        EQUD   |
000007b0  20 69 6e 69 74 69 61 6c  69 73 61 74 69 6f 6e 20  | initialisation |
000007c0  20 20 20 20 20 20 20 20  20 3b 20 49 6e 69 74 69  |         ; Initi|
000007d0  61 6c 69 73 61 74 69 6f  6e 20 63 6f 64 65 0d 02  |alisation code..|
000007e0  f8 3f 20 20 20 20 20 20  20 20 45 51 55 44 20 20  |.?        EQUD  |
000007f0  20 20 66 69 6e 61 6c 69  73 61 74 69 6f 6e 20 20  |  finalisation  |
00000800  20 20 20 20 20 20 20 20  20 20 3b 20 46 69 6e 61  |          ; Fina|
00000810  6c 69 73 61 74 69 6f 6e  20 63 6f 64 65 0d 03 02  |lisation code...|
00000820  42 20 20 20 20 20 20 20  20 45 51 55 44 20 20 20  |B        EQUD   |
00000830  20 73 65 72 76 69 63 65  20 20 20 20 20 20 20 20  | service        |
00000840  20 20 20 20 20 20 20 20  20 3b 20 53 65 72 76 69  |         ; Servi|
00000850  63 65 20 63 61 6c 6c 20  68 61 6e 64 6c 65 72 0d  |ce call handler.|
00000860  03 0c 3a 20 20 20 20 20  20 20 20 45 51 55 44 20  |..:        EQUD |
00000870  20 20 20 74 69 74 6c 65  20 20 20 20 20 20 20 20  |   title        |
00000880  20 20 20 20 20 20 20 20  20 20 20 3b 20 54 69 74  |           ; Tit|
00000890  6c 65 20 73 74 72 69 6e  67 0d 03 16 39 20 20 20  |le string...9   |
000008a0  20 20 20 20 20 45 51 55  44 20 20 20 20 68 65 6c  |     EQUD    hel|
000008b0  70 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |p               |
000008c0  20 20 20 20 20 3b 20 48  65 6c 70 20 73 74 72 69  |     ; Help stri|
000008d0  6e 67 0d 03 20 44 20 20  20 20 20 20 20 20 45 51  |ng.. D        EQ|
000008e0  55 44 20 20 20 20 63 6f  6d 6d 61 6e 64 20 20 20  |UD    command   |
000008f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00000900  48 65 6c 70 20 61 6e 64  20 63 6f 6d 6d 61 6e 64  |Help and command|
00000910  20 74 61 62 6c 65 0d 03  2a 43 20 20 20 20 20 20  | table..*C      |
00000920  20 20 45 51 55 44 20 20  20 20 30 20 20 20 20 20  |  EQUD    0     |
00000930  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000940  20 20 3b 20 53 57 49 20  63 68 75 6e 6b 20 62 61  |  ; SWI chunk ba|
00000950  73 65 20 6e 75 6d 62 65  72 0d 03 34 3e 20 20 20  |se number..4>   |
00000960  20 20 20 20 20 45 51 55  44 20 20 20 20 30 20 20  |     EQUD    0  |
00000970  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000980  20 20 20 20 20 3b 20 53  57 49 20 68 61 6e 64 6c  |     ; SWI handl|
00000990  65 72 20 63 6f 64 65 0d  03 3e 40 20 20 20 20 20  |er code..>@     |
000009a0  20 20 20 45 51 55 44 20  20 20 20 30 20 20 20 20  |   EQUD    0    |
000009b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000009c0  20 20 20 3b 20 53 57 49  20 64 65 63 6f 64 69 6e  |   ; SWI decodin|
000009d0  67 20 74 61 62 6c 65 0d  03 48 3f 20 20 20 20 20  |g table..H?     |
000009e0  20 20 20 45 51 55 44 20  20 20 20 30 20 20 20 20  |   EQUD    0    |
000009f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000a00  20 20 20 3b 20 53 57 49  20 64 65 63 6f 64 69 6e  |   ; SWI decodin|
00000a10  67 20 63 6f 64 65 0d 03  52 04 0d 03 5c 1a 20 20  |g code..R...\.  |
00000a20  20 20 20 20 20 20 3b 20  54 69 74 6c 65 20 73 74  |      ; Title st|
00000a30  72 69 6e 67 0d 03 66 22  2e 74 69 74 6c 65 20 20  |ring..f".title  |
00000a40  45 51 55 53 20 20 20 20  22 43 72 61 7a 79 50 6f  |EQUS    "CrazyPo|
00000a50  69 6e 74 65 72 22 0d 03  70 15 20 20 20 20 20 20  |inter"..p.      |
00000a60  20 20 45 51 55 42 20 20  20 20 30 0d 03 7a 04 0d  |  EQUB    0..z..|
00000a70  03 84 04 0d 03 8e 19 20  20 20 20 20 20 20 20 3b  |.......        ;|
00000a80  20 48 65 6c 70 20 73 74  72 69 6e 67 0d 03 98 3f  | Help string...?|
00000a90  2e 68 65 6c 70 20 20 20  45 51 55 53 20 20 20 20  |.help   EQUS    |
00000aa0  22 43 72 61 7a 79 20 50  6f 69 6e 74 65 72 22 20  |"Crazy Pointer" |
00000ab0  2b 20 bd 39 20 2b 20 22  31 2e 30 32 20 28 31 30  |+ .9 + "1.02 (10|
00000ac0  20 4a 75 6e 20 31 39 39  38 29 22 0d 03 a2 37 20  | Jun 1998)"...7 |
00000ad0  20 20 20 20 20 20 20 45  51 55 53 20 20 20 20 22  |       EQUS    "|
00000ae0  20 22 20 2b 20 bd 31 36  39 20 2b 20 22 20 41 2e  | " + .169 + " A.|
00000af0  54 68 6f 75 6b 79 64 69  64 65 73 2c 20 31 39 39  |Thoukydides, 199|
00000b00  37 22 0d 03 ac 15 20 20  20 20 20 20 20 20 45 51  |7"....        EQ|
00000b10  55 42 20 20 20 20 30 0d  03 b6 11 20 20 20 20 20  |UB    0....     |
00000b20  20 20 20 41 4c 49 47 4e  0d 03 c0 0c 20 20 20 20  |   ALIGN....    |
00000b30  20 20 20 20 0d 03 ca 2c  20 20 20 20 20 20 20 20  |    ...,        |
00000b40  3b 20 48 65 6c 70 20 61  6e 64 20 63 6f 6d 6d 61  |; Help and comma|
00000b50  6e 64 20 6b 65 79 77 6f  72 64 20 74 61 62 6c 65  |nd keyword table|
00000b60  0d 03 d4 0c 2e 63 6f 6d  6d 61 6e 64 0d 03 de 3a  |.....command...:|
00000b70  20 20 20 20 20 20 20 20  45 51 55 53 20 20 20 20  |        EQUS    |
00000b80  22 43 72 61 7a 79 50 6f  69 6e 74 65 72 22 20 20  |"CrazyPointer"  |
00000b90  20 20 20 20 20 20 20 20  3b 20 43 6f 6d 6d 61 6e  |        ; Comman|
00000ba0  64 20 6e 61 6d 65 0d 03  e8 15 20 20 20 20 20 20  |d name....      |
00000bb0  20 20 45 51 55 42 20 20  20 20 30 0d 03 f2 11 20  |  EQUB    0.... |
00000bc0  20 20 20 20 20 20 20 41  4c 49 47 4e 0d 03 fc 3c  |       ALIGN...<|
00000bd0  20 20 20 20 20 20 20 20  45 51 55 44 20 20 20 20  |        EQUD    |
00000be0  30 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |0               |
00000bf0  20 20 20 20 20 20 20 20  3b 20 4f 66 66 73 65 74  |        ; Offset|
00000c00  20 74 6f 20 63 6f 64 65  0d 04 06 3e 20 20 20 20  | to code...>    |
00000c10  20 20 20 20 45 51 55 44  20 20 20 20 26 30 20 20  |    EQUD    &0  |
00000c20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000c30  20 20 20 20 3b 20 49 6e  66 6f 72 6d 61 74 69 6f  |    ; Informatio|
00000c40  6e 20 77 6f 72 64 0d 04  10 46 20 20 20 20 20 20  |n word...F      |
00000c50  20 20 45 51 55 44 20 20  20 20 30 20 20 20 20 20  |  EQUD    0     |
00000c60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000c70  20 20 3b 20 4f 66 66 73  65 74 20 74 6f 20 73 79  |  ; Offset to sy|
00000c80  6e 74 61 78 20 6d 65 73  73 61 67 65 0d 04 1a 41  |ntax message...A|
00000c90  20 20 20 20 20 20 20 20  45 51 55 44 20 20 20 20  |        EQUD    |
00000ca0  63 6f 6d 6d 61 6e 64 5f  68 65 6c 70 20 20 20 20  |command_help    |
00000cb0  20 20 20 20 20 20 20 20  3b 20 4f 66 66 73 65 74  |        ; Offset|
00000cc0  20 74 6f 20 68 65 6c 70  20 74 65 78 74 0d 04 24  | to help text..$|
00000cd0  0c 20 20 20 20 20 20 20  20 0d 04 2e 3a 20 20 20  |.        ...:   |
00000ce0  20 20 20 20 20 45 51 55  53 20 20 20 20 22 43 72  |     EQUS    "Cr|
00000cf0  61 7a 79 50 6f 69 6e 74  65 72 57 6f 62 62 6c 65  |azyPointerWobble|
00000d00  22 20 20 20 20 3b 20 43  6f 6d 6d 61 6e 64 20 6e  |"    ; Command n|
00000d10  61 6d 65 0d 04 38 15 20  20 20 20 20 20 20 20 45  |ame..8.        E|
00000d20  51 55 42 20 20 20 20 30  0d 04 42 11 20 20 20 20  |QUB    0..B.    |
00000d30  20 20 20 20 41 4c 49 47  4e 0d 04 4c 3c 20 20 20  |    ALIGN..L<   |
00000d40  20 20 20 20 20 45 51 55  44 20 20 20 20 63 6f 6d  |     EQUD    com|
00000d50  6d 61 6e 64 5f 77 6f 62  62 6c 65 20 20 20 20 20  |mand_wobble     |
00000d60  20 20 20 20 20 3b 20 4f  66 66 73 65 74 20 74 6f  |     ; Offset to|
00000d70  20 63 6f 64 65 0d 04 56  3e 20 20 20 20 20 20 20  | code..V>       |
00000d80  20 45 51 55 44 20 20 20  20 26 30 30 30 37 30 30  | EQUD    &000700|
00000d90  30 31 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |01              |
00000da0  20 3b 20 49 6e 66 6f 72  6d 61 74 69 6f 6e 20 77  | ; Information w|
00000db0  6f 72 64 0d 04 60 46 20  20 20 20 20 20 20 20 45  |ord..`F        E|
00000dc0  51 55 44 20 20 20 20 63  6f 6d 6d 61 6e 64 5f 77  |QUD    command_w|
00000dd0  6f 62 62 6c 65 5f 73 79  6e 74 61 78 20 20 20 3b  |obble_syntax   ;|
00000de0  20 4f 66 66 73 65 74 20  74 6f 20 73 79 6e 74 61  | Offset to synta|
00000df0  78 20 6d 65 73 73 61 67  65 0d 04 6a 41 20 20 20  |x message..jA   |
00000e00  20 20 20 20 20 45 51 55  44 20 20 20 20 63 6f 6d  |     EQUD    com|
00000e10  6d 61 6e 64 5f 77 6f 62  62 6c 65 5f 68 65 6c 70  |mand_wobble_help|
00000e20  20 20 20 20 20 3b 20 4f  66 66 73 65 74 20 74 6f  |     ; Offset to|
00000e30  20 68 65 6c 70 20 74 65  78 74 0d 04 74 0c 20 20  | help text..t.  |
00000e40  20 20 20 20 20 20 0d 04  7e 4c 20 20 20 20 20 20  |      ..~L      |
00000e50  20 20 45 51 55 42 20 20  20 20 30 20 20 20 20 20  |  EQUB    0     |
00000e60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000e70  20 20 3b 20 54 65 72 6d  69 6e 61 74 65 20 74 68  |  ; Terminate th|
00000e80  65 20 6c 69 73 74 20 6f  66 20 6b 65 79 77 6f 72  |e list of keywor|
00000e90  64 73 0d 04 88 04 0d 04  92 2f 20 20 20 20 20 20  |ds......./      |
00000ea0  20 20 3b 20 48 65 6c 70  20 66 6f 72 20 74 68 65  |  ; Help for the|
00000eb0  20 43 72 61 7a 79 50 6f  69 6e 74 65 72 20 6b 65  | CrazyPointer ke|
00000ec0  79 77 6f 72 64 0d 04 9c  11 2e 63 6f 6d 6d 61 6e  |yword.....comman|
00000ed0  64 5f 68 65 6c 70 0d 04  a6 45 20 20 20 20 20 20  |d_help...E      |
00000ee0  20 20 45 51 55 53 20 20  20 20 22 43 72 61 7a 79  |  EQUS    "Crazy|
00000ef0  20 50 6f 69 6e 74 65 72  20 70 72 6f 76 69 64 65  | Pointer provide|
00000f00  73 20 61 6e 69 6d 61 74  65 64 20 6d 6f 75 73 65  |s animated mouse|
00000f10  20 70 6f 69 6e 74 65 72  73 2e 22 0d 04 b0 50 20  | pointers."...P |
00000f20  20 20 20 20 20 20 20 45  51 55 53 20 20 20 20 22  |       EQUS    "|
00000f30  20 52 65 70 6c 61 63 65  6d 65 6e 74 73 20 61 72  | Replacements ar|
00000f40  65 20 70 72 6f 76 69 64  65 64 20 66 6f 72 20 74  |e provided for t|
00000f50  68 65 20 73 74 61 6e 64  61 72 64 2c 20 64 6f 75  |he standard, dou|
00000f60  62 6c 65 2d 63 6c 69 63  6b 2c 22 0d 04 ba 2a 20  |ble-click,"...* |
00000f70  20 20 20 20 20 20 20 45  51 55 53 20 20 20 20 22  |       EQUS    "|
00000f80  20 61 6e 64 20 63 61 72  65 74 20 70 6f 69 6e 74  | and caret point|
00000f90  65 72 73 2e 22 0d 04 c4  16 20 20 20 20 20 20 20  |ers."....       |
00000fa0  20 45 51 55 42 20 20 20  20 31 33 0d 04 ce 4e 20  | EQUB    13...N |
00000fb0  20 20 20 20 20 20 20 45  51 55 53 20 20 20 20 22  |       EQUS    "|
00000fc0  54 68 69 73 20 6d 6f 64  75 6c 65 20 69 73 20 69  |This module is i|
00000fd0  6e 73 70 69 72 65 64 20  62 79 20 4d 6f 75 73 65  |nspired by Mouse|
00000fe0  50 20 77 72 69 74 74 65  6e 20 62 79 20 41 6e 64  |P written by And|
00000ff0  72 65 77 20 42 6f 6c 74  22 0d 04 d8 52 20 20 20  |rew Bolt"...R   |
00001000  20 20 20 20 20 45 51 55  53 20 20 20 20 22 20 61  |     EQUS    " a|
00001010  6e 64 20 70 75 62 6c 69  73 68 65 64 20 69 6e 20  |nd published in |
00001020  74 68 65 20 4a 75 6e 65  20 31 39 39 37 20 2a 49  |the June 1997 *I|
00001030  6e 66 6f 20 73 65 63 74  69 6f 6e 20 6f 66 20 41  |nfo section of A|
00001040  63 6f 72 6e 20 55 73 65  72 2e 22 0d 04 e2 15 20  |corn User.".... |
00001050  20 20 20 20 20 20 20 45  51 55 42 20 20 20 20 30  |       EQUB    0|
00001060  0d 04 ec 11 20 20 20 20  20 20 20 20 41 4c 49 47  |....        ALIG|
00001070  4e 0d 04 f6 04 0d 05 00  2d 20 20 20 20 20 20 20  |N.......-       |
00001080  20 3b 20 54 68 65 20 2a  43 72 61 7a 79 50 6f 69  | ; The *CrazyPoi|
00001090  6e 74 65 72 57 6f 62 62  6c 65 20 63 6f 6d 6d 61  |nterWobble comma|
000010a0  6e 64 0d 05 0a 13 2e 63  6f 6d 6d 61 6e 64 5f 77  |nd.....command_w|
000010b0  6f 62 62 6c 65 0d 05 14  3d 20 20 20 20 20 20 20  |obble...=       |
000010c0  20 53 54 4d 46 44 20 20  20 72 31 33 21 2c 20 7b  | STMFD   r13!, {|
000010d0  72 31 34 7d 20 20 20 20  20 20 20 20 20 20 20 20  |r14}            |
000010e0  20 3b 20 53 74 61 63 6b  20 72 65 67 69 73 74 65  | ; Stack registe|
000010f0  72 73 0d 05 1e 46 20 20  20 20 20 20 20 20 53 55  |rs...F        SU|
00001100  42 20 20 20 20 20 72 31  33 2c 20 72 31 33 2c 20  |B     r13, r13, |
00001110  23 34 38 20 20 20 20 20  20 20 20 20 20 20 3b 20  |#48           ; |
00001120  52 65 73 65 72 76 65 20  73 6f 6d 65 20 73 74 61  |Reserve some sta|
00001130  63 6b 20 73 70 61 63 65  0d 05 28 49 20 20 20 20  |ck space..(I    |
00001140  20 20 20 20 4c 44 52 20  20 20 20 20 72 31 32 2c  |    LDR     r12,|
00001150  20 5b 72 31 32 5d 20 20  20 20 20 20 20 20 20 20  | [r12]          |
00001160  20 20 20 20 3b 20 4f 62  74 61 69 6e 20 70 6f 69  |    ; Obtain poi|
00001170  6e 74 65 72 20 74 6f 20  77 6f 72 6b 73 70 61 63  |nter to workspac|
00001180  65 0d 05 32 4b 20 20 20  20 20 20 20 20 4d 4f 56  |e..2K        MOV|
00001190  20 20 20 20 20 72 31 2c  20 72 30 20 20 20 20 20  |     r1, r0     |
000011a0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 43  |             ; C|
000011b0  6f 70 79 20 74 68 65 20  63 6f 6d 6d 61 6e 64 20  |opy the command |
000011c0  74 61 69 6c 20 70 6f 69  6e 74 65 72 0d 05 3c 4b  |tail pointer..<K|
000011d0  20 20 20 20 20 20 20 20  41 44 52 20 20 20 20 20  |        ADR     |
000011e0  72 30 2c 20 63 6f 6d 6d  61 6e 64 5f 77 6f 62 62  |r0, command_wobb|
000011f0  6c 65 5f 64 65 66 20 20  3b 20 50 6f 69 6e 74 65  |le_def  ; Pointe|
00001200  72 20 74 6f 20 6b 65 79  77 6f 72 64 20 64 65 66  |r to keyword def|
00001210  69 6e 69 74 69 6f 6e 0d  05 46 46 20 20 20 20 20  |inition..FF     |
00001220  20 20 20 4d 4f 56 20 20  20 20 20 72 32 2c 20 72  |   MOV     r2, r|
00001230  31 33 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |13              |
00001240  20 20 20 3b 20 50 6f 69  6e 74 65 72 20 74 6f 20  |   ; Pointer to |
00001250  6f 75 74 70 75 74 20 62  75 66 66 65 72 0d 05 50  |output buffer..P|
00001260  47 20 20 20 20 20 20 20  20 4d 4f 56 20 20 20 20  |G        MOV    |
00001270  20 72 33 2c 20 23 34 38  20 20 20 20 20 20 20 20  | r3, #48        |
00001280  20 20 20 20 20 20 20 20  20 3b 20 53 69 7a 65 20  |         ; Size |
00001290  6f 66 20 74 68 65 20 6f  75 74 70 75 74 20 62 75  |of the output bu|
000012a0  66 66 65 72 0d 05 5a 45  20 20 20 20 20 20 20 20  |ffer..ZE        |
000012b0  53 57 49 20 20 20 20 20  22 58 4f 53 5f 52 65 61  |SWI     "XOS_Rea|
000012c0  64 41 72 67 73 22 20 20  20 20 20 20 20 20 20 20  |dArgs"          |
000012d0  3b 20 53 63 61 6e 20 74  68 65 20 63 6f 6d 6d 61  |; Scan the comma|
000012e0  6e 64 20 73 74 72 69 6e  67 0d 05 64 4a 20 20 20  |nd string..dJ   |
000012f0  20 20 20 20 20 42 56 53  20 20 20 20 20 63 6f 6d  |     BVS     com|
00001300  6d 61 6e 64 5f 77 6f 62  62 6c 65 5f 64 6f 6e 65  |mand_wobble_done|
00001310  20 20 20 20 20 3b 20 52  65 74 75 72 6e 20 66 72  |     ; Return fr|
00001320  6f 6d 20 68 61 6e 64 6c  65 72 20 69 66 20 65 72  |om handler if er|
00001330  72 6f 72 0d 05 6e 49 20  20 20 20 20 20 20 20 4c  |ror..nI        L|
00001340  44 52 20 20 20 20 20 72  30 2c 20 5b 72 32 5d 2c  |DR     r0, [r2],|
00001350  20 23 34 20 20 20 20 20  20 20 20 20 20 20 20 3b  | #4            ;|
00001360  20 43 68 65 63 6b 20 69  66 20 77 6f 62 62 6c 65  | Check if wobble|
00001370  20 69 73 20 64 69 73 61  62 6c 65 64 0d 05 78 46  | is disabled..xF|
00001380  20 20 20 20 20 20 20 20  54 45 51 20 20 20 20 20  |        TEQ     |
00001390  72 30 2c 20 23 30 20 20  20 20 20 20 20 20 20 20  |r0, #0          |
000013a0  20 20 20 20 20 20 20 20  3b 20 49 73 20 77 6f 62  |        ; Is wob|
000013b0  62 6c 65 20 62 65 69 6e  67 20 64 69 73 61 62 6c  |ble being disabl|
000013c0  65 64 0d 05 82 54 20 20  20 20 20 20 20 20 42 4e  |ed...T        BN|
000013d0  45 20 20 20 20 20 63 6f  6d 6d 61 6e 64 5f 77 6f  |E     command_wo|
000013e0  62 62 6c 65 5f 64 69 73  61 62 6c 65 20 20 3b 20  |bble_disable  ; |
000013f0  44 69 73 61 62 6c 65 20  74 68 65 20 70 6f 69 6e  |Disable the poin|
00001400  74 65 72 20 77 6f 62 62  6c 65 20 69 66 20 72 65  |ter wobble if re|
00001410  71 75 69 72 65 64 0d 05  8c 43 20 20 20 20 20 20  |quired...C      |
00001420  20 20 4c 44 52 20 20 20  20 20 72 30 2c 20 5b 72  |  LDR     r0, [r|
00001430  32 5d 2c 20 23 34 20 20  20 20 20 20 20 20 20 20  |2], #4          |
00001440  20 20 3b 20 52 65 61 64  20 66 72 69 63 74 69 6f  |  ; Read frictio|
00001450  6e 20 70 6f 69 6e 74 65  72 0d 05 96 43 20 20 20  |n pointer...C   |
00001460  20 20 20 20 20 54 45 51  20 20 20 20 20 72 30 2c  |     TEQ     r0,|
00001470  20 23 30 20 20 20 20 20  20 20 20 20 20 20 20 20  | #0             |
00001480  20 20 20 20 20 3b 20 57  61 73 20 61 20 76 61 6c  |     ; Was a val|
00001490  75 65 20 73 70 65 63 69  66 69 65 64 0d 05 a0 42  |ue specified...B|
000014a0  20 20 20 20 20 20 20 20  42 45 51 20 20 20 20 20  |        BEQ     |
000014b0  63 6f 6d 6d 61 6e 64 5f  77 6f 62 62 6c 65 5f 73  |command_wobble_s|
000014c0  70 72 69 6e 67 20 20 20  3b 20 53 6b 69 70 20 74  |pring   ; Skip t|
000014d0  68 69 73 20 62 69 74 20  69 66 20 6e 6f 74 0d 05  |his bit if not..|
000014e0  aa 3b 20 20 20 20 20 20  20 20 4c 44 52 42 20 20  |.;        LDRB  |
000014f0  20 20 72 31 2c 20 5b 72  30 5d 2c 20 23 31 20 20  |  r1, [r0], #1  |
00001500  20 20 20 20 20 20 20 20  20 20 3b 20 52 65 61 64  |          ; Read|
00001510  20 74 68 65 20 74 79 70  65 0d 05 b4 45 20 20 20  | the type...E   |
00001520  20 20 20 20 20 54 45 51  20 20 20 20 20 72 31 2c  |     TEQ     r1,|
00001530  20 23 30 20 20 20 20 20  20 20 20 20 20 20 20 20  | #0             |
00001540  20 20 20 20 20 3b 20 49  73 20 74 68 65 20 76 61  |     ; Is the va|
00001550  6c 75 65 20 61 6e 20 69  6e 74 65 67 65 72 0d 05  |lue an integer..|
00001560  be 46 20 20 20 20 20 20  20 20 42 4e 45 20 20 20  |.F        BNE   |
00001570  20 20 63 6f 6d 6d 61 6e  64 5f 77 6f 62 62 6c 65  |  command_wobble|
00001580  5f 66 61 69 6c 20 20 20  20 20 3b 20 47 65 6e 65  |_fail     ; Gene|
00001590  72 61 74 65 20 61 6e 20  65 72 72 6f 72 20 69 66  |rate an error if|
000015a0  20 6e 6f 74 0d 05 c8 44  20 20 20 20 20 20 20 20  | not...D        |
000015b0  a4 6c 64 72 75 28 31 2c  20 30 2c 20 33 2c 20 34  |.ldru(1, 0, 3, 4|
000015c0  29 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |)              ;|
000015d0  20 52 65 61 64 20 74 68  65 20 66 72 69 63 74 69  | Read the fricti|
000015e0  6f 6e 20 76 61 6c 75 65  0d 05 d2 46 20 20 20 20  |on value...F    |
000015f0  20 20 20 20 53 54 52 20  20 20 20 20 72 31 2c 20  |    STR     r1, |
00001600  5b 72 31 32 2c 20 23 77  73 5f 66 72 69 63 74 69  |[r12, #ws_fricti|
00001610  6f 6e 5d 20 3b 20 53 74  6f 72 65 20 74 68 65 20  |on] ; Store the |
00001620  66 72 69 63 74 69 6f 6e  20 76 61 6c 75 65 0d 05  |friction value..|
00001630  dc 1a 2e 63 6f 6d 6d 61  6e 64 5f 77 6f 62 62 6c  |...command_wobbl|
00001640  65 5f 73 70 72 69 6e 67  0d 05 e6 41 20 20 20 20  |e_spring...A    |
00001650  20 20 20 20 4c 44 52 20  20 20 20 20 72 30 2c 20  |    LDR     r0, |
00001660  5b 72 32 5d 2c 20 23 34  20 20 20 20 20 20 20 20  |[r2], #4        |
00001670  20 20 20 20 3b 20 52 65  61 64 20 73 70 72 69 6e  |    ; Read sprin|
00001680  67 20 70 6f 69 6e 74 65  72 0d 05 f0 43 20 20 20  |g pointer...C   |
00001690  20 20 20 20 20 54 45 51  20 20 20 20 20 72 30 2c  |     TEQ     r0,|
000016a0  20 23 30 20 20 20 20 20  20 20 20 20 20 20 20 20  | #0             |
000016b0  20 20 20 20 20 3b 20 57  61 73 20 61 20 76 61 6c  |     ; Was a val|
000016c0  75 65 20 73 70 65 63 69  66 69 65 64 0d 05 fa 42  |ue specified...B|
000016d0  20 20 20 20 20 20 20 20  42 45 51 20 20 20 20 20  |        BEQ     |
000016e0  63 6f 6d 6d 61 6e 64 5f  77 6f 62 62 6c 65 5f 66  |command_wobble_f|
000016f0  6f 72 63 65 20 20 20 20  3b 20 53 6b 69 70 20 74  |orce    ; Skip t|
00001700  68 69 73 20 62 69 74 20  69 66 20 6e 6f 74 0d 06  |his bit if not..|
00001710  04 3b 20 20 20 20 20 20  20 20 4c 44 52 42 20 20  |.;        LDRB  |
00001720  20 20 72 31 2c 20 5b 72  30 5d 2c 20 23 31 20 20  |  r1, [r0], #1  |
00001730  20 20 20 20 20 20 20 20  20 20 3b 20 52 65 61 64  |          ; Read|
00001740  20 74 68 65 20 74 79 70  65 0d 06 0e 45 20 20 20  | the type...E   |
00001750  20 20 20 20 20 54 45 51  20 20 20 20 20 72 31 2c  |     TEQ     r1,|
00001760  20 23 30 20 20 20 20 20  20 20 20 20 20 20 20 20  | #0             |
00001770  20 20 20 20 20 3b 20 49  73 20 74 68 65 20 76 61  |     ; Is the va|
00001780  6c 75 65 20 61 6e 20 69  6e 74 65 67 65 72 0d 06  |lue an integer..|
00001790  18 46 20 20 20 20 20 20  20 20 42 4e 45 20 20 20  |.F        BNE   |
000017a0  20 20 63 6f 6d 6d 61 6e  64 5f 77 6f 62 62 6c 65  |  command_wobble|
000017b0  5f 66 61 69 6c 20 20 20  20 20 3b 20 47 65 6e 65  |_fail     ; Gene|
000017c0  72 61 74 65 20 61 6e 20  65 72 72 6f 72 20 69 66  |rate an error if|
000017d0  20 6e 6f 74 0d 06 22 42  20 20 20 20 20 20 20 20  | not.."B        |
000017e0  a4 6c 64 72 75 28 31 2c  20 30 2c 20 33 2c 20 34  |.ldru(1, 0, 3, 4|
000017f0  29 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |)              ;|
00001800  20 52 65 61 64 20 74 68  65 20 73 70 72 69 6e 67  | Read the spring|
00001810  20 76 61 6c 75 65 0d 06  2c 44 20 20 20 20 20 20  | value..,D      |
00001820  20 20 53 54 52 20 20 20  20 20 72 31 2c 20 5b 72  |  STR     r1, [r|
00001830  31 32 2c 20 23 77 73 5f  73 70 72 69 6e 67 5d 20  |12, #ws_spring] |
00001840  20 20 3b 20 53 74 6f 72  65 20 74 68 65 20 73 70  |  ; Store the sp|
00001850  72 69 6e 67 20 76 61 6c  75 65 0d 06 36 19 2e 63  |ring value..6..c|
00001860  6f 6d 6d 61 6e 64 5f 77  6f 62 62 6c 65 5f 66 6f  |ommand_wobble_fo|
00001870  72 63 65 0d 06 40 40 20  20 20 20 20 20 20 20 4c  |rce..@@        L|
00001880  44 52 20 20 20 20 20 72  30 2c 20 5b 72 32 5d 2c  |DR     r0, [r2],|
00001890  20 23 34 20 20 20 20 20  20 20 20 20 20 20 20 3b  | #4            ;|
000018a0  20 52 65 61 64 20 66 6f  72 63 65 20 70 6f 69 6e  | Read force poin|
000018b0  74 65 72 0d 06 4a 43 20  20 20 20 20 20 20 20 54  |ter..JC        T|
000018c0  45 51 20 20 20 20 20 72  30 2c 20 23 30 20 20 20  |EQ     r0, #0   |
000018d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
000018e0  20 57 61 73 20 61 20 76  61 6c 75 65 20 73 70 65  | Was a value spe|
000018f0  63 69 66 69 65 64 0d 06  54 42 20 20 20 20 20 20  |cified..TB      |
00001900  20 20 42 45 51 20 20 20  20 20 63 6f 6d 6d 61 6e  |  BEQ     comman|
00001910  64 5f 77 6f 62 62 6c 65  5f 64 6f 6e 65 20 20 20  |d_wobble_done   |
00001920  20 20 3b 20 53 6b 69 70  20 74 68 69 73 20 62 69  |  ; Skip this bi|
00001930  74 20 69 66 20 6e 6f 74  0d 06 5e 3b 20 20 20 20  |t if not..^;    |
00001940  20 20 20 20 4c 44 52 42  20 20 20 20 72 31 2c 20  |    LDRB    r1, |
00001950  5b 72 30 5d 2c 20 23 31  20 20 20 20 20 20 20 20  |[r0], #1        |
00001960  20 20 20 20 3b 20 52 65  61 64 20 74 68 65 20 74  |    ; Read the t|
00001970  79 70 65 0d 06 68 45 20  20 20 20 20 20 20 20 54  |ype..hE        T|
00001980  45 51 20 20 20 20 20 72  31 2c 20 23 30 20 20 20  |EQ     r1, #0   |
00001990  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
000019a0  20 49 73 20 74 68 65 20  76 61 6c 75 65 20 61 6e  | Is the value an|
000019b0  20 69 6e 74 65 67 65 72  0d 06 72 46 20 20 20 20  | integer..rF    |
000019c0  20 20 20 20 42 4e 45 20  20 20 20 20 63 6f 6d 6d  |    BNE     comm|
000019d0  61 6e 64 5f 77 6f 62 62  6c 65 5f 66 61 69 6c 20  |and_wobble_fail |
000019e0  20 20 20 20 3b 20 47 65  6e 65 72 61 74 65 20 61  |    ; Generate a|
000019f0  6e 20 65 72 72 6f 72 20  69 66 20 6e 6f 74 0d 06  |n error if not..|
00001a00  7c 41 20 20 20 20 20 20  20 20 a4 6c 64 72 75 28  ||A        .ldru(|
00001a10  31 2c 20 30 2c 20 33 2c  20 34 29 20 20 20 20 20  |1, 0, 3, 4)     |
00001a20  20 20 20 20 20 20 20 20  20 3b 20 52 65 61 64 20  |         ; Read |
00001a30  74 68 65 20 66 6f 72 63  65 20 76 61 6c 75 65 0d  |the force value.|
00001a40  06 86 43 20 20 20 20 20  20 20 20 53 54 52 20 20  |..C        STR  |
00001a50  20 20 20 72 31 2c 20 5b  72 31 32 2c 20 23 77 73  |   r1, [r12, #ws|
00001a60  5f 66 6f 72 63 65 5d 20  20 20 20 3b 20 53 74 6f  |_force]    ; Sto|
00001a70  72 65 20 74 68 65 20 66  6f 72 63 65 20 76 61 6c  |re the force val|
00001a80  75 65 0d 06 90 18 2e 63  6f 6d 6d 61 6e 64 5f 77  |ue.....command_w|
00001a90  6f 62 62 6c 65 5f 64 6f  6e 65 0d 06 9a 4f 20 20  |obble_done...O  |
00001aa0  20 20 20 20 20 20 41 44  44 20 20 20 20 20 72 31  |      ADD     r1|
00001ab0  33 2c 20 72 31 33 2c 20  23 34 38 20 20 20 20 20  |3, r13, #48     |
00001ac0  20 20 20 20 20 20 3b 20  53 6b 69 70 20 62 61 63  |      ; Skip bac|
00001ad0  6b 20 6f 76 65 72 20 74  68 65 20 72 65 73 65 72  |k over the reser|
00001ae0  76 65 64 20 73 70 61 63  65 0d 06 a4 4d 20 20 20  |ved space...M   |
00001af0  20 20 20 20 20 4c 44 4d  46 44 20 20 20 72 31 33  |     LDMFD   r13|
00001b00  21 2c 20 7b 70 63 7d 20  20 20 20 20 20 20 20 20  |!, {pc}         |
00001b10  20 20 20 20 20 3b 20 52  65 74 75 72 6e 20 66 72  |     ; Return fr|
00001b20  6f 6d 20 74 68 65 20 63  6f 6d 6d 61 6e 64 20 68  |om the command h|
00001b30  61 6e 64 6c 65 72 0d 06  ae 1b 2e 63 6f 6d 6d 61  |andler.....comma|
00001b40  6e 64 5f 77 6f 62 62 6c  65 5f 64 69 73 61 62 6c  |nd_wobble_disabl|
00001b50  65 0d 06 b8 48 20 20 20  20 20 20 20 20 4d 4f 56  |e...H        MOV|
00001b60  20 20 20 20 20 72 30 2c  20 23 30 20 20 20 20 20  |     r0, #0     |
00001b70  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 56  |             ; V|
00001b80  61 6c 75 65 20 74 6f 20  63 6c 65 61 72 20 66 69  |alue to clear fi|
00001b90  6c 74 65 72 20 77 69 74  68 0d 06 c2 47 20 20 20  |lter with...G   |
00001ba0  20 20 20 20 20 53 54 52  20 20 20 20 20 72 30 2c  |     STR     r0,|
00001bb0  20 5b 72 31 32 2c 20 23  77 73 5f 66 69 6c 74 6e  | [r12, #ws_filtn|
00001bc0  5d 20 20 20 20 3b 20 43  6c 65 61 72 20 61 6e 79  |]    ; Clear any|
00001bd0  20 65 78 69 73 74 69 6e  67 20 77 69 62 62 6c 65  | existing wibble|
00001be0  0d 06 cc 50 20 20 20 20  20 20 20 20 53 54 52 20  |...P        STR |
00001bf0  20 20 20 20 72 30 2c 20  5b 72 31 32 2c 20 23 77  |    r0, [r12, #w|
00001c00  73 5f 66 69 6c 74 76 5d  20 20 20 20 3b 20 43 6c  |s_filtv]    ; Cl|
00001c10  65 61 72 20 61 6e 79 20  65 78 69 73 74 69 6e 67  |ear any existing|
00001c20  20 77 69 62 62 6c 65 20  76 65 6c 6f 63 69 74 79  | wibble velocity|
00001c30  0d 06 d6 45 20 20 20 20  20 20 20 20 4d 4f 56 20  |...E        MOV |
00001c40  20 20 20 20 72 30 2c 20  23 33 32 20 20 20 20 20  |    r0, #32     |
00001c50  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 56 61  |            ; Va|
00001c60  6c 75 65 20 74 6f 20 64  69 73 61 62 6c 65 20 77  |lue to disable w|
00001c70  6f 62 62 6c 65 0d 06 e0  48 20 20 20 20 20 20 20  |obble...H       |
00001c80  20 53 54 52 20 20 20 20  20 72 30 2c 20 5b 72 31  | STR     r0, [r1|
00001c90  32 2c 20 23 77 73 5f 66  6f 72 63 65 5d 20 20 20  |2, #ws_force]   |
00001ca0  20 3b 20 43 6c 65 61 72  20 74 68 65 20 66 6f 72  | ; Clear the for|
00001cb0  63 65 20 6d 75 6c 74 69  70 6c 69 65 72 0d 06 ea  |ce multiplier...|
00001cc0  4d 20 20 20 20 20 20 20  20 42 20 20 20 20 20 20  |M        B      |
00001cd0  20 63 6f 6d 6d 61 6e 64  5f 77 6f 62 62 6c 65 5f  | command_wobble_|
00001ce0  64 6f 6e 65 20 20 20 20  20 3b 20 52 65 74 75 72  |done     ; Retur|
00001cf0  6e 20 66 72 6f 6d 20 74  68 65 20 63 6f 6d 6d 61  |n from the comma|
00001d00  6e 64 20 68 61 6e 64 6c  65 72 0d 06 f4 18 2e 63  |nd handler.....c|
00001d10  6f 6d 6d 61 6e 64 5f 77  6f 62 62 6c 65 5f 66 61  |ommand_wobble_fa|
00001d20  69 6c 0d 06 fe 44 20 20  20 20 20 20 20 20 41 44  |il...D        AD|
00001d30  52 20 20 20 20 20 72 30  2c 20 63 6f 6d 6d 61 6e  |R     r0, comman|
00001d40  64 5f 77 6f 62 62 6c 65  5f 65 72 72 6f 72 3b 20  |d_wobble_error; |
00001d50  50 6f 69 6e 74 65 72 20  74 6f 20 65 72 72 6f 72  |Pointer to error|
00001d60  20 62 6c 6f 63 6b 0d 07  08 50 20 20 20 20 20 20  | block...P      |
00001d70  20 20 43 4d 50 20 20 20  20 20 70 63 2c 20 23 26  |  CMP     pc, #&|
00001d80  38 30 30 30 30 30 30 30  20 20 20 20 20 20 20 20  |80000000        |
00001d90  20 20 3b 20 53 65 74 20  74 68 65 20 6f 76 65 72  |  ; Set the over|
00001da0  66 6c 6f 77 20 66 6c 61  67 20 66 6f 72 20 61 6e  |flow flag for an|
00001db0  20 65 72 72 6f 72 0d 07  12 4d 20 20 20 20 20 20  | error...M      |
00001dc0  20 20 42 20 20 20 20 20  20 20 63 6f 6d 6d 61 6e  |  B       comman|
00001dd0  64 5f 77 6f 62 62 6c 65  5f 64 6f 6e 65 20 20 20  |d_wobble_done   |
00001de0  20 20 3b 20 52 65 74 75  72 6e 20 66 72 6f 6d 20  |  ; Return from |
00001df0  74 68 65 20 63 6f 6d 6d  61 6e 64 20 68 61 6e 64  |the command hand|
00001e00  6c 65 72 0d 07 1c 19 2e  63 6f 6d 6d 61 6e 64 5f  |ler.....command_|
00001e10  77 6f 62 62 6c 65 5f 65  72 72 6f 72 0d 07 26 15  |wobble_error..&.|
00001e20  20 20 20 20 20 20 20 20  45 51 55 44 20 20 20 20  |        EQUD    |
00001e30  30 0d 07 30 30 20 20 20  20 20 20 20 20 45 51 55  |0..00        EQU|
00001e40  53 20 20 20 20 22 49 6e  76 61 6c 69 64 20 63 6f  |S    "Invalid co|
00001e50  6d 6d 61 6e 64 20 70 61  72 61 6d 65 74 65 72 73  |mmand parameters|
00001e60  22 0d 07 3a 15 20 20 20  20 20 20 20 20 45 51 55  |"..:.        EQU|
00001e70  42 20 20 20 20 30 0d 07  44 11 20 20 20 20 20 20  |B    0..D.      |
00001e80  20 20 41 4c 49 47 4e 0d  07 4e 17 2e 63 6f 6d 6d  |  ALIGN..N..comm|
00001e90  61 6e 64 5f 77 6f 62 62  6c 65 5f 64 65 66 0d 07  |and_wobble_def..|
00001ea0  58 3c 20 20 20 20 20 20  20 20 45 51 55 53 20 20  |X<        EQUS  |
00001eb0  20 20 22 6e 6f 77 6f 62  62 6c 65 2f 73 2c 66 72  |  "nowobble/s,fr|
00001ec0  69 63 74 69 6f 6e 2f 65  2c 73 70 72 69 6e 67 2f  |iction/e,spring/|
00001ed0  65 2c 66 6f 72 63 65 2f  65 22 0d 07 62 15 20 20  |e,force/e"..b.  |
00001ee0  20 20 20 20 20 20 45 51  55 42 20 20 20 20 30 0d  |      EQUB    0.|
00001ef0  07 6c 18 2e 63 6f 6d 6d  61 6e 64 5f 77 6f 62 62  |.l..command_wobb|
00001f00  6c 65 5f 68 65 6c 70 0d  07 76 49 20 20 20 20 20  |le_help..vI     |
00001f10  20 20 20 45 51 55 53 20  20 20 20 22 2a 43 72 61  |   EQUS    "*Cra|
00001f20  7a 79 50 6f 69 6e 74 65  72 57 6f 62 62 6c 65 20  |zyPointerWobble |
00001f30  61 6c 6c 6f 77 73 20 74  68 65 20 70 6f 69 6e 74  |allows the point|
00001f40  65 72 20 77 6f 62 62 6c  65 20 74 6f 20 62 65 22  |er wobble to be"|
00001f50  0d 07 80 3d 20 20 20 20  20 20 20 20 45 51 55 53  |...=        EQUS|
00001f60  20 20 20 20 22 20 63 6f  6e 74 72 6f 6c 6c 65 64  |    " controlled|
00001f70  20 62 79 20 73 65 74 74  69 6e 67 20 74 68 72 65  | by setting thre|
00001f80  65 20 63 6f 6e 73 74 61  6e 74 73 2e 22 0d 07 8a  |e constants."...|
00001f90  52 20 20 20 20 20 20 20  20 45 51 55 53 20 20 20  |R        EQUS   |
00001fa0  20 22 20 54 68 65 73 65  20 61 72 65 20 61 6c 6c  | " These are all|
00001fb0  20 73 70 65 63 69 66 69  65 64 20 6f 6e 20 61 20  | specified on a |
00001fc0  6c 6f 67 61 72 69 74 68  6d 69 63 20 73 63 61 6c  |logarithmic scal|
00001fd0  65 20 69 6e 20 74 68 65  20 72 61 6e 67 65 22 0d  |e in the range".|
00001fe0  07 94 44 20 20 20 20 20  20 20 20 45 51 55 53 20  |..D        EQUS |
00001ff0  20 20 20 22 20 30 20 74  6f 20 31 30 2c 20 77 69  |   " 0 to 10, wi|
00002000  74 68 20 61 20 76 61 6c  75 65 20 6f 66 20 35 20  |th a value of 5 |
00002010  62 65 69 6e 67 20 74 68  65 20 64 65 66 61 75 6c  |being the defaul|
00002020  74 2e 22 0d 07 9e 16 20  20 20 20 20 20 20 20 45  |t."....        E|
00002030  51 55 42 20 20 20 20 31  33 0d 07 a8 1a 2e 63 6f  |QUB    13.....co|
00002040  6d 6d 61 6e 64 5f 77 6f  62 62 6c 65 5f 73 79 6e  |mmand_wobble_syn|
00002050  74 61 78 0d 07 b2 3d 20  20 20 20 20 20 20 20 45  |tax...=        E|
00002060  51 55 53 20 20 20 20 22  53 79 6e 74 61 78 3a 20  |QUS    "Syntax: |
00002070  2a 43 72 61 7a 79 50 6f  69 6e 74 65 72 57 6f 62  |*CrazyPointerWob|
00002080  62 6c 65 20 5b 2d 6e 6f  77 6f 62 62 6c 65 5d 22  |ble [-nowobble]"|
00002090  0d 07 bc 2c 20 20 20 20  20 20 20 20 45 51 55 53  |...,        EQUS|
000020a0  20 20 20 20 22 20 5b 5b  2d 66 72 69 63 74 69 6f  |    " [[-frictio|
000020b0  6e 5d 20 3c 76 61 6c 75  65 3e 5d 22 0d 07 c6 2a  |n] <value>]"...*|
000020c0  20 20 20 20 20 20 20 20  45 51 55 53 20 20 20 20  |        EQUS    |
000020d0  22 20 5b 5b 2d 73 70 72  69 6e 67 5d 20 3c 76 61  |" [[-spring] <va|
000020e0  6c 75 65 3e 5d 22 0d 07  d0 29 20 20 20 20 20 20  |lue>]"...)      |
000020f0  20 20 45 51 55 53 20 20  20 20 22 20 5b 5b 2d 66  |  EQUS    " [[-f|
00002100  6f 72 63 65 5d 20 3c 76  61 6c 75 65 3e 5d 22 0d  |orce] <value>]".|
00002110  07 da 15 20 20 20 20 20  20 20 20 45 51 55 42 20  |...        EQUB |
00002120  20 20 20 30 0d 07 e4 11  20 20 20 20 20 20 20 20  |   0....        |
00002130  41 4c 49 47 4e 0d 07 ee  04 0d 07 f8 21 20 20 20  |ALIGN.......!   |
00002140  20 20 20 20 20 3b 20 49  6e 69 74 69 61 6c 69 73  |     ; Initialis|
00002150  61 74 69 6f 6e 20 63 6f  64 65 0d 08 02 13 2e 69  |ation code.....i|
00002160  6e 69 74 69 61 6c 69 73  61 74 69 6f 6e 0d 08 0c  |nitialisation...|
00002170  3d 20 20 20 20 20 20 20  20 53 54 4d 46 44 20 20  |=        STMFD  |
00002180  20 72 31 33 21 2c 20 7b  72 31 31 2c 20 72 31 34  | r13!, {r11, r14|
00002190  7d 20 20 20 20 20 20 20  20 3b 20 53 74 61 63 6b  |}        ; Stack|
000021a0  20 72 65 67 69 73 74 65  72 73 0d 08 16 49 20 20  | registers...I  |
000021b0  20 20 20 20 20 20 4d 4f  56 20 20 20 20 20 72 30  |      MOV     r0|
000021c0  2c 20 23 36 20 20 20 20  20 20 20 20 20 20 20 20  |, #6            |
000021d0  20 20 20 20 20 20 3b 20  52 65 61 73 6f 6e 20 63  |      ; Reason c|
000021e0  6f 64 65 20 74 6f 20 63  6c 61 69 6d 20 6d 65 6d  |ode to claim mem|
000021f0  6f 72 79 0d 08 20 4c 20  20 20 20 20 20 20 20 4d  |ory.. L        M|
00002200  4f 56 20 20 20 20 20 72  33 2c 20 23 77 73 5f 73  |OV     r3, #ws_s|
00002210  69 7a 65 20 20 20 20 20  20 20 20 20 20 20 20 3b  |ize            ;|
00002220  20 54 68 65 20 73 69 7a  65 20 6f 66 20 77 6f 72  | The size of wor|
00002230  6b 73 70 61 63 65 20 72  65 71 75 69 72 65 64 0d  |kspace required.|
00002240  08 2a 49 20 20 20 20 20  20 20 20 53 57 49 20 20  |.*I        SWI  |
00002250  20 20 20 22 58 4f 53 5f  4d 6f 64 75 6c 65 22 20  |   "XOS_Module" |
00002260  20 20 20 20 20 20 20 20  20 20 20 3b 20 43 6c 61  |           ; Cla|
00002270  69 6d 20 73 6f 6d 65 20  6d 6f 64 75 6c 65 20 77  |im some module w|
00002280  6f 72 6b 73 70 61 63 65  0d 08 34 44 20 20 20 20  |orkspace..4D    |
00002290  20 20 20 20 4d 4f 56 56  53 20 20 20 72 31 31 2c  |    MOVVS   r11,|
000022a0  20 72 30 20 20 20 20 20  20 20 20 20 20 20 20 20  | r0             |
000022b0  20 20 20 20 3b 20 43 6f  70 79 20 61 6e 79 20 65  |    ; Copy any e|
000022c0  72 72 6f 72 20 70 6f 69  6e 74 65 72 0d 08 3e 4b  |rror pointer..>K|
000022d0  20 20 20 20 20 20 20 20  42 56 53 20 20 20 20 20  |        BVS     |
000022e0  66 61 69 6c 5f 77 73 20  20 20 20 20 20 20 20 20  |fail_ws         |
000022f0  20 20 20 20 20 20 20 20  3b 20 46 61 69 6c 20 69  |        ; Fail i|
00002300  66 20 61 6e 20 65 72 72  6f 72 20 77 61 73 20 70  |f an error was p|
00002310  72 6f 64 75 63 65 64 0d  08 48 45 20 20 20 20 20  |roduced..HE     |
00002320  20 20 20 53 54 52 20 20  20 20 20 72 32 2c 20 5b  |   STR     r2, [|
00002330  72 31 32 5d 20 20 20 20  20 20 20 20 20 20 20 20  |r12]            |
00002340  20 20 20 3b 20 53 74 6f  72 65 20 77 6f 72 6b 73  |   ; Store works|
00002350  70 61 63 65 20 70 6f 69  6e 74 65 72 0d 08 52 48  |pace pointer..RH|
00002360  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
00002370  72 31 32 2c 20 72 32 20  20 20 20 20 20 20 20 20  |r12, r2         |
00002380  20 20 20 20 20 20 20 20  3b 20 43 6f 70 79 20 74  |        ; Copy t|
00002390  68 65 20 77 6f 72 6b 73  70 61 63 65 20 70 6f 69  |he workspace poi|
000023a0  6e 74 65 72 0d 08 5c 47  20 20 20 20 20 20 20 20  |nter..\G        |
000023b0  4d 4f 56 20 20 20 20 20  72 30 2c 20 23 30 20 20  |MOV     r0, #0  |
000023c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000023d0  3b 20 56 61 6c 75 65 20  74 6f 20 63 6c 65 61 72  |; Value to clear|
000023e0  20 66 6c 61 67 73 20 77  69 74 68 0d 08 66 4f 20  | flags with..fO |
000023f0  20 20 20 20 20 20 20 53  54 52 20 20 20 20 20 72  |       STR     r|
00002400  30 2c 20 5b 72 31 32 2c  20 23 77 73 5f 69 6e 74  |0, [r12, #ws_int|
00002410  65 72 6e 61 6c 5d 20 3b  20 43 6c 65 61 72 20 74  |ernal] ; Clear t|
00002420  68 65 20 69 6e 74 65 72  6e 61 6c 20 6f 70 65 72  |he internal oper|
00002430  61 74 69 6f 6e 20 66 6c  61 67 0d 08 70 4e 20 20  |ation flag..pN  |
00002440  20 20 20 20 20 20 53 54  52 42 20 20 20 20 72 30  |      STRB    r0|
00002450  2c 20 5b 72 31 32 2c 20  23 77 73 5f 70 74 72 5f  |, [r12, #ws_ptr_|
00002460  62 6c 6f 63 6b 5d 3b 20  52 65 61 73 6f 6e 20 63  |block]; Reason c|
00002470  6f 64 65 20 74 6f 20 73  65 74 20 70 6f 69 6e 74  |ode to set point|
00002480  65 72 20 73 68 61 70 65  0d 08 7a 4e 20 20 20 20  |er shape..zN    |
00002490  20 20 20 20 53 54 52 42  20 20 20 20 72 30 2c 20  |    STRB    r0, |
000024a0  5b 72 31 32 2c 20 23 77  73 5f 70 74 72 5f 62 6c  |[r12, #ws_ptr_bl|
000024b0  6f 63 6b 5f 61 63 74 69  76 65 78 5d 3b 20 53 74  |ock_activex]; St|
000024c0  6f 72 65 20 68 6f 72 69  7a 6f 6e 74 61 6c 20 68  |ore horizontal h|
000024d0  6f 74 73 70 6f 74 0d 08  84 4c 20 20 20 20 20 20  |otspot...L      |
000024e0  20 20 53 54 52 42 20 20  20 20 72 30 2c 20 5b 72  |  STRB    r0, [r|
000024f0  31 32 2c 20 23 77 73 5f  70 74 72 5f 62 6c 6f 63  |12, #ws_ptr_bloc|
00002500  6b 5f 61 63 74 69 76 65  79 5d 3b 20 53 74 6f 72  |k_activey]; Stor|
00002510  65 20 76 65 72 74 69 63  61 6c 20 68 6f 74 73 70  |e vertical hotsp|
00002520  6f 74 0d 08 8e 41 20 20  20 20 20 20 20 20 53 54  |ot...A        ST|
00002530  52 20 20 20 20 20 72 30  2c 20 5b 72 31 32 2c 20  |R     r0, [r12, |
00002540  23 77 73 5f 66 69 6c 74  6e 5d 20 20 20 20 3b 20  |#ws_filtn]    ; |
00002550  49 6e 69 74 69 61 6c 6c  79 20 6e 6f 20 77 69 62  |Initially no wib|
00002560  62 6c 65 0d 08 98 4a 20  20 20 20 20 20 20 20 53  |ble...J        S|
00002570  54 52 20 20 20 20 20 72  30 2c 20 5b 72 31 32 2c  |TR     r0, [r12,|
00002580  20 23 77 73 5f 66 69 6c  74 76 5d 20 20 20 20 3b  | #ws_filtv]    ;|
00002590  20 49 6e 69 74 69 61 6c  6c 79 20 6e 6f 20 77 69  | Initially no wi|
000025a0  62 62 6c 65 20 76 65 6c  6f 63 69 74 79 0d 08 a2  |bble velocity...|
000025b0  47 20 20 20 20 20 20 20  20 4d 4f 56 20 20 20 20  |G        MOV    |
000025c0  20 72 30 2c 20 23 35 20  20 20 20 20 20 20 20 20  | r0, #5         |
000025d0  20 20 20 20 20 20 20 20  20 3b 20 54 68 65 20 64  |         ; The d|
000025e0  65 66 61 75 6c 74 20 63  6f 6e 66 69 67 75 72 61  |efault configura|
000025f0  74 69 6f 6e 0d 08 ac 42  20 20 20 20 20 20 20 20  |tion...B        |
00002600  53 54 52 20 20 20 20 20  72 30 2c 20 5b 72 31 32  |STR     r0, [r12|
00002610  2c 20 23 77 73 5f 66 72  69 63 74 69 6f 6e 5d 20  |, #ws_friction] |
00002620  3b 20 54 68 65 20 64 65  66 61 75 6c 74 20 66 72  |; The default fr|
00002630  69 63 74 69 6f 6e 0d 08  b6 49 20 20 20 20 20 20  |iction...I      |
00002640  20 20 53 54 52 20 20 20  20 20 72 30 2c 20 5b 72  |  STR     r0, [r|
00002650  31 32 2c 20 23 77 73 5f  73 70 72 69 6e 67 5d 20  |12, #ws_spring] |
00002660  20 20 3b 20 54 68 65 20  64 65 66 61 75 6c 74 20  |  ; The default |
00002670  73 70 72 69 6e 67 20 73  74 72 65 6e 67 74 68 0d  |spring strength.|
00002680  08 c0 3f 20 20 20 20 20  20 20 20 53 54 52 20 20  |..?        STR  |
00002690  20 20 20 72 30 2c 20 5b  72 31 32 2c 20 23 77 73  |   r0, [r12, #ws|
000026a0  5f 66 6f 72 63 65 5d 20  20 20 20 3b 20 54 68 65  |_force]    ; The|
000026b0  20 64 65 66 61 75 6c 74  20 66 6f 72 63 65 0d 08  | default force..|
000026c0  ca 47 20 20 20 20 20 20  20 20 4d 56 4e 20 20 20  |.G        MVN   |
000026d0  20 20 72 30 2c 20 23 26  39 66 30 30 30 20 20 20  |  r0, #&9f000   |
000026e0  20 20 20 20 20 20 20 20  20 20 3b 20 49 6e 69 74  |          ; Init|
000026f0  69 61 6c 20 63 65 6e 74  72 65 20 72 6f 77 20 6f  |ial centre row o|
00002700  66 66 73 65 74 0d 08 d4  4a 20 20 20 20 20 20 20  |ffset...J       |
00002710  20 53 54 52 20 20 20 20  20 72 30 2c 20 5b 72 31  | STR     r0, [r1|
00002720  32 2c 20 23 77 73 5f 63  6f 67 72 5d 20 20 20 20  |2, #ws_cogr]    |
00002730  20 3b 20 49 6e 69 74 69  61 6c 20 72 6f 77 20 6f  | ; Initial row o|
00002740  66 66 73 65 74 20 74 6f  20 63 65 6e 74 72 65 0d  |ffset to centre.|
00002750  08 de 4a 20 20 20 20 20  20 20 20 4d 56 4e 20 20  |..J        MVN  |
00002760  20 20 20 72 30 2c 20 23  26 34 61 30 30 30 20 20  |   r0, #&4a000  |
00002770  20 20 20 20 20 20 20 20  20 20 20 3b 20 49 6e 69  |           ; Ini|
00002780  74 69 61 6c 20 63 65 6e  74 72 65 20 63 6f 6c 75  |tial centre colu|
00002790  6d 6e 20 6f 66 66 73 65  74 0d 08 e8 4d 20 20 20  |mn offset...M   |
000027a0  20 20 20 20 20 53 54 52  20 20 20 20 20 72 30 2c  |     STR     r0,|
000027b0  20 5b 72 31 32 2c 20 23  77 73 5f 63 6f 67 63 5d  | [r12, #ws_cogc]|
000027c0  20 20 20 20 20 3b 20 49  6e 69 74 69 61 6c 20 63  |     ; Initial c|
000027d0  6f 6c 75 6d 6e 20 6f 66  66 73 65 74 20 74 6f 20  |olumn offset to |
000027e0  63 65 6e 74 72 65 0d 08  f2 51 20 20 20 20 20 20  |centre...Q      |
000027f0  20 20 4d 4f 56 20 20 20  20 20 72 30 2c 20 23 70  |  MOV     r0, #p|
00002800  74 72 5f 75 6e 6b 6e 6f  77 6e 20 20 20 20 20 20  |tr_unknown      |
00002810  20 20 3b 20 4d 6f 73 74  20 70 6f 69 6e 74 65 72  |  ; Most pointer|
00002820  73 20 61 72 65 20 75 6e  6b 6e 6f 77 6e 20 69 6e  |s are unknown in|
00002830  69 74 69 61 6c 6c 79 0d  08 fc 46 20 20 20 20 20  |itially...F     |
00002840  20 20 20 53 54 52 42 20  20 20 20 72 30 2c 20 5b  |   STRB    r0, [|
00002850  72 31 32 2c 20 23 77 73  5f 74 79 70 65 73 5d 20  |r12, #ws_types] |
00002860  20 20 20 3b 20 53 68 61  70 65 20 30 20 69 73 20  |   ; Shape 0 is |
00002870  6e 6f 74 20 61 20 70 6f  69 6e 74 65 72 0d 09 06  |not a pointer...|
00002880  40 20 20 20 20 20 20 20  20 53 54 52 42 20 20 20  |@        STRB   |
00002890  20 72 30 2c 20 5b 72 31  32 2c 20 23 77 73 5f 74  | r0, [r12, #ws_t|
000028a0  79 70 65 73 20 2b 20 32  5d 3b 20 53 68 61 70 65  |ypes + 2]; Shape|
000028b0  20 32 20 69 73 20 75 6e  6b 6e 6f 77 6e 0d 09 10  | 2 is unknown...|
000028c0  40 20 20 20 20 20 20 20  20 53 54 52 42 20 20 20  |@        STRB   |
000028d0  20 72 30 2c 20 5b 72 31  32 2c 20 23 77 73 5f 74  | r0, [r12, #ws_t|
000028e0  79 70 65 73 20 2b 20 33  5d 3b 20 53 68 61 70 65  |ypes + 3]; Shape|
000028f0  20 33 20 69 73 20 75 6e  6b 6e 6f 77 6e 0d 09 1a  | 3 is unknown...|
00002900  40 20 20 20 20 20 20 20  20 53 54 52 42 20 20 20  |@        STRB   |
00002910  20 72 30 2c 20 5b 72 31  32 2c 20 23 77 73 5f 74  | r0, [r12, #ws_t|
00002920  79 70 65 73 20 2b 20 34  5d 3b 20 53 68 61 70 65  |ypes + 4]; Shape|
00002930  20 34 20 69 73 20 75 6e  6b 6e 6f 77 6e 0d 09 24  | 4 is unknown..$|
00002940  4a 20 20 20 20 20 20 20  20 4d 4f 56 20 20 20 20  |J        MOV    |
00002950  20 72 30 2c 20 23 70 74  72 5f 73 69 6e 67 6c 65  | r0, #ptr_single|
00002960  20 20 20 20 20 20 20 20  20 3b 20 54 68 65 20 73  |         ; The s|
00002970  74 61 6e 64 61 72 64 20  64 65 73 6b 74 6f 70 20  |tandard desktop |
00002980  70 6f 69 6e 74 65 72 0d  09 2e 50 20 20 20 20 20  |pointer...P     |
00002990  20 20 20 53 54 52 42 20  20 20 20 72 30 2c 20 5b  |   STRB    r0, [|
000029a0  72 31 32 2c 20 23 77 73  5f 74 79 70 65 73 20 2b  |r12, #ws_types +|
000029b0  20 31 5d 3b 20 41 73 73  75 6d 65 20 73 68 61 70  | 1]; Assume shap|
000029c0  65 20 31 20 69 73 20 74  68 65 20 73 74 61 6e 64  |e 1 is the stand|
000029d0  61 72 64 20 6f 6e 65 0d  09 38 47 20 20 20 20 20  |ard one..8G     |
000029e0  20 20 20 4d 4f 56 20 20  20 20 20 72 30 2c 20 23  |   MOV     r0, #|
000029f0  38 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |8               |
00002a00  20 20 20 3b 20 57 69 64  74 68 20 6f 66 20 70 6f  |   ; Width of po|
00002a10  69 6e 74 65 72 20 69 6e  20 62 79 74 65 73 0d 09  |inter in bytes..|
00002a20  42 4a 20 20 20 20 20 20  20 20 53 54 52 42 20 20  |BJ        STRB  |
00002a30  20 20 72 30 2c 20 5b 72  31 32 2c 20 23 77 73 5f  |  r0, [r12, #ws_|
00002a40  70 74 72 5f 62 6c 6f 63  6b 5f 77 69 64 74 68 5d  |ptr_block_width]|
00002a50  3b 20 53 74 6f 72 65 20  77 69 64 74 68 20 6f 66  |; Store width of|
00002a60  20 70 6f 69 6e 74 65 72  0d 09 4c 49 20 20 20 20  | pointer..LI    |
00002a70  20 20 20 20 4d 4f 56 20  20 20 20 20 72 30 2c 20  |    MOV     r0, |
00002a80  23 33 32 20 20 20 20 20  20 20 20 20 20 20 20 20  |#32             |
00002a90  20 20 20 20 3b 20 48 65  69 67 68 74 20 6f 66 20  |    ; Height of |
00002aa0  70 6f 69 6e 74 65 72 20  69 6e 20 70 69 78 65 6c  |pointer in pixel|
00002ab0  73 0d 09 56 4c 20 20 20  20 20 20 20 20 53 54 52  |s..VL        STR|
00002ac0  42 20 20 20 20 72 30 2c  20 5b 72 31 32 2c 20 23  |B    r0, [r12, #|
00002ad0  77 73 5f 70 74 72 5f 62  6c 6f 63 6b 5f 68 65 69  |ws_ptr_block_hei|
00002ae0  67 68 74 5d 3b 20 53 74  6f 72 65 20 68 65 69 67  |ght]; Store heig|
00002af0  68 74 20 6f 66 20 70 6f  69 6e 74 65 72 0d 09 60  |ht of pointer..`|
00002b00  4d 20 20 20 20 20 20 20  20 41 44 44 20 20 20 20  |M        ADD    |
00002b10  20 72 30 2c 20 72 31 32  2c 20 23 77 73 5f 70 74  | r0, r12, #ws_pt|
00002b20  72 5f 64 61 74 61 20 20  20 3b 20 50 6f 69 6e 74  |r_data   ; Point|
00002b30  65 72 20 74 6f 20 70 6f  69 6e 74 65 72 20 64 61  |er to pointer da|
00002b40  74 61 20 20 20 20 20 20  20 20 0d 09 6a 4c 20 20  |ta        ..jL  |
00002b50  20 20 20 20 20 20 53 54  52 20 20 20 20 20 72 30  |      STR     r0|
00002b60  2c 20 5b 72 31 32 2c 20  23 77 73 5f 70 74 72 5f  |, [r12, #ws_ptr_|
00002b70  62 6c 6f 63 6b 5f 64 61  74 61 5d 3b 20 53 74 6f  |block_data]; Sto|
00002b80  72 65 20 70 6f 69 6e 74  65 72 20 74 6f 20 74 68  |re pointer to th|
00002b90  65 20 64 61 74 61 0d 09  74 52 20 20 20 20 20 20  |e data..tR      |
00002ba0  20 20 4d 4f 56 20 20 20  20 20 72 30 2c 20 23 32  |  MOV     r0, #2|
00002bb0  31 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |1               |
00002bc0  20 20 3b 20 52 65 61 73  6f 6e 20 63 6f 64 65 20  |  ; Reason code |
00002bd0  74 6f 20 72 65 61 64 20  70 6f 69 6e 74 65 72 20  |to read pointer |
00002be0  70 6f 73 69 74 69 6f 6e  0d 09 7e 41 20 20 20 20  |position..~A    |
00002bf0  20 20 20 20 41 44 44 20  20 20 20 20 72 31 2c 20  |    ADD     r1, |
00002c00  72 31 32 2c 20 23 77 73  5f 62 75 66 66 65 72 20  |r12, #ws_buffer |
00002c10  20 20 20 20 3b 20 50 6f  69 6e 74 65 72 20 74 6f  |    ; Pointer to|
00002c20  20 61 20 62 75 66 66 65  72 0d 09 88 52 20 20 20  | a buffer...R   |
00002c30  20 20 20 20 20 4d 4f 56  20 20 20 20 20 72 32 2c  |     MOV     r2,|
00002c40  20 23 36 20 20 20 20 20  20 20 20 20 20 20 20 20  | #6             |
00002c50  20 20 20 20 20 3b 20 52  65 61 73 6f 6e 20 63 6f  |     ; Reason co|
00002c60  64 65 20 74 6f 20 72 65  61 64 20 70 6f 69 6e 74  |de to read point|
00002c70  65 72 20 70 6f 73 69 74  69 6f 6e 0d 09 92 49 20  |er position...I |
00002c80  20 20 20 20 20 20 20 53  54 52 42 20 20 20 20 72  |       STRB    r|
00002c90  32 2c 20 5b 72 31 5d 20  20 20 20 20 20 20 20 20  |2, [r1]         |
00002ca0  20 20 20 20 20 20 20 3b  20 53 74 6f 72 65 20 72  |       ; Store r|
00002cb0  65 61 73 6f 6e 20 63 6f  64 65 20 69 6e 20 62 75  |eason code in bu|
00002cc0  66 66 65 72 0d 09 9c 43  20 20 20 20 20 20 20 20  |ffer...C        |
00002cd0  53 57 49 20 20 20 20 20  22 58 4f 53 5f 57 6f 72  |SWI     "XOS_Wor|
00002ce0  64 22 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |d"              |
00002cf0  3b 20 52 65 61 64 20 70  6f 69 6e 74 65 72 20 70  |; Read pointer p|
00002d00  6f 73 69 74 69 6f 6e 0d  09 a6 44 20 20 20 20 20  |osition...D     |
00002d10  20 20 20 4d 4f 56 56 53  20 20 20 72 31 31 2c 20  |   MOVVS   r11, |
00002d20  72 30 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r0              |
00002d30  20 20 20 3b 20 43 6f 70  79 20 61 6e 79 20 65 72  |   ; Copy any er|
00002d40  72 6f 72 20 70 6f 69 6e  74 65 72 0d 09 b0 4b 20  |ror pointer...K |
00002d50  20 20 20 20 20 20 20 42  56 53 20 20 20 20 20 66  |       BVS     f|
00002d60  61 69 6c 5f 70 6f 73 69  74 69 6f 6e 20 20 20 20  |ail_position    |
00002d70  20 20 20 20 20 20 20 3b  20 46 61 69 6c 20 69 66  |       ; Fail if|
00002d80  20 61 6e 20 65 72 72 6f  72 20 77 61 73 20 70 72  | an error was pr|
00002d90  6f 64 75 63 65 64 0d 09  ba 4d 20 20 20 20 20 20  |oduced...M      |
00002da0  20 20 4c 44 52 42 20 20  20 20 72 32 2c 20 5b 72  |  LDRB    r2, [r|
00002db0  31 2c 20 23 31 5d 20 20  20 20 20 20 20 20 20 20  |1, #1]          |
00002dc0  20 20 3b 20 52 65 61 64  20 4c 53 42 20 6f 66 20  |  ; Read LSB of |
00002dd0  68 6f 72 69 7a 6f 6e 74  61 6c 20 70 6f 73 69 74  |horizontal posit|
00002de0  69 6f 6e 0d 09 c4 4d 20  20 20 20 20 20 20 20 4c  |ion...M        L|
00002df0  44 52 42 20 20 20 20 72  33 2c 20 5b 72 31 2c 20  |DRB    r3, [r1, |
00002e00  23 32 5d 20 20 20 20 20  20 20 20 20 20 20 20 3b  |#2]            ;|
00002e10  20 52 65 61 64 20 4d 53  42 20 6f 66 20 68 6f 72  | Read MSB of hor|
00002e20  69 7a 6f 6e 74 61 6c 20  70 6f 73 69 74 69 6f 6e  |izontal position|
00002e30  0d 09 ce 48 20 20 20 20  20 20 20 20 84 52 20 20  |...H        .R  |
00002e40  20 20 20 72 32 2c 20 72  32 2c 20 72 33 2c 20 41  |   r2, r2, r3, A|
00002e50  53 4c 23 38 20 20 20 20  20 20 20 3b 20 43 6f 6d  |SL#8       ; Com|
00002e60  62 69 6e 65 20 68 6f 72  69 7a 6f 6e 74 61 6c 20  |bine horizontal |
00002e70  70 6f 73 69 74 69 6f 6e  0d 09 d8 4e 20 20 20 20  |position...N    |
00002e80  20 20 20 20 4d 4f 56 20  20 20 20 20 72 32 2c 20  |    MOV     r2, |
00002e90  72 32 2c 20 41 53 4c 23  31 36 20 20 20 20 20 20  |r2, ASL#16      |
00002ea0  20 20 20 20 3b 20 53 63  61 6c 65 20 74 68 65 20  |    ; Scale the |
00002eb0  68 6f 72 69 7a 6f 6e 74  61 6c 20 70 6f 73 69 74  |horizontal posit|
00002ec0  69 6f 6e 20 75 70 0d 09  e2 53 20 20 20 20 20 20  |ion up...S      |
00002ed0  20 20 53 54 52 20 20 20  20 20 72 32 2c 20 5b 72  |  STR     r2, [r|
00002ee0  31 32 2c 20 23 77 73 5f  68 70 6f 73 5d 20 20 20  |12, #ws_hpos]   |
00002ef0  20 20 3b 20 53 74 6f 72  65 20 74 68 65 20 69 6e  |  ; Store the in|
00002f00  69 74 69 61 6c 20 68 6f  72 69 7a 6f 6e 74 61 6c  |itial horizontal|
00002f10  20 70 6f 73 69 74 69 6f  6e 0d 09 ec 4b 20 20 20  | position...K   |
00002f20  20 20 20 20 20 4c 44 52  42 20 20 20 20 72 32 2c  |     LDRB    r2,|
00002f30  20 5b 72 31 2c 20 23 33  5d 20 20 20 20 20 20 20  | [r1, #3]       |
00002f40  20 20 20 20 20 3b 20 52  65 61 64 20 4c 53 42 20  |     ; Read LSB |
00002f50  6f 66 20 76 65 72 74 69  63 61 6c 20 70 6f 73 69  |of vertical posi|
00002f60  74 69 6f 6e 0d 09 f6 4b  20 20 20 20 20 20 20 20  |tion...K        |
00002f70  4c 44 52 42 20 20 20 20  72 33 2c 20 5b 72 31 2c  |LDRB    r3, [r1,|
00002f80  20 23 34 5d 20 20 20 20  20 20 20 20 20 20 20 20  | #4]            |
00002f90  3b 20 52 65 61 64 20 4d  53 42 20 6f 66 20 76 65  |; Read MSB of ve|
00002fa0  72 74 69 63 61 6c 20 70  6f 73 69 74 69 6f 6e 0d  |rtical position.|
00002fb0  0a 00 46 20 20 20 20 20  20 20 20 84 52 20 20 20  |..F        .R   |
00002fc0  20 20 72 32 2c 20 72 32  2c 20 72 33 2c 20 41 53  |  r2, r2, r3, AS|
00002fd0  4c 23 38 20 20 20 20 20  20 20 3b 20 43 6f 6d 62  |L#8       ; Comb|
00002fe0  69 6e 65 20 76 65 72 74  69 63 61 6c 20 70 6f 73  |ine vertical pos|
00002ff0  69 74 69 6f 6e 0d 0a 0a  4c 20 20 20 20 20 20 20  |ition...L       |
00003000  20 4d 4f 56 20 20 20 20  20 72 32 2c 20 72 32 2c  | MOV     r2, r2,|
00003010  20 41 53 4c 23 31 36 20  20 20 20 20 20 20 20 20  | ASL#16         |
00003020  20 3b 20 53 63 61 6c 65  20 74 68 65 20 76 65 72  | ; Scale the ver|
00003030  74 69 63 61 6c 20 70 6f  73 69 74 69 6f 6e 20 75  |tical position u|
00003040  70 0d 0a 14 51 20 20 20  20 20 20 20 20 53 54 52  |p...Q        STR|
00003050  20 20 20 20 20 72 32 2c  20 5b 72 31 32 2c 20 23  |     r2, [r12, #|
00003060  77 73 5f 76 70 6f 73 5d  20 20 20 20 20 3b 20 53  |ws_vpos]     ; S|
00003070  74 6f 72 65 20 74 68 65  20 69 6e 69 74 69 61 6c  |tore the initial|
00003080  20 76 65 72 74 69 63 61  6c 20 70 6f 73 69 74 69  | vertical positi|
00003090  6f 6e 0d 0a 1e 45 20 20  20 20 20 20 20 20 42 4c  |on...E        BL|
000030a0  20 20 20 20 20 20 72 65  61 64 5f 76 64 75 20 20  |      read_vdu  |
000030b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
000030c0  52 65 61 64 20 74 68 65  20 70 69 78 65 6c 20 73  |Read the pixel s|
000030d0  63 61 6c 69 6e 67 73 0d  0a 28 44 20 20 20 20 20  |calings..(D     |
000030e0  20 20 20 4d 4f 56 56 53  20 20 20 72 31 31 2c 20  |   MOVVS   r11, |
000030f0  72 30 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r0              |
00003100  20 20 20 3b 20 43 6f 70  79 20 61 6e 79 20 65 72  |   ; Copy any er|
00003110  72 6f 72 20 70 6f 69 6e  74 65 72 0d 0a 32 4b 20  |ror pointer..2K |
00003120  20 20 20 20 20 20 20 42  56 53 20 20 20 20 20 66  |       BVS     f|
00003130  61 69 6c 5f 76 64 75 20  20 20 20 20 20 20 20 20  |ail_vdu         |
00003140  20 20 20 20 20 20 20 3b  20 46 61 69 6c 20 69 66  |       ; Fail if|
00003150  20 61 6e 20 65 72 72 6f  72 20 77 61 73 20 70 72  | an error was pr|
00003160  6f 64 75 63 65 64 0d 0a  3c 56 20 20 20 20 20 20  |oduced..<V      |
00003170  20 20 4d 4f 56 20 20 20  20 20 72 30 2c 20 23 69  |  MOV     r0, #i|
00003180  6e 74 65 72 76 61 6c 2d  31 20 20 20 20 20 20 20  |nterval-1       |
00003190  20 20 3b 20 54 69 6d 65  20 69 6e 74 65 72 76 61  |  ; Time interva|
000031a0  6c 20 6f 66 20 27 69 6e  74 65 72 76 61 6c 27 20  |l of 'interval' |
000031b0  63 65 6e 74 69 73 65 63  6f 6e 64 73 0d 0a 46 4b  |centiseconds..FK|
000031c0  20 20 20 20 20 20 20 20  41 44 52 20 20 20 20 20  |        ADR     |
000031d0  72 31 2c 20 75 70 64 61  74 65 20 20 20 20 20 20  |r1, update      |
000031e0  20 20 20 20 20 20 20 20  3b 20 41 64 64 72 65 73  |        ; Addres|
000031f0  73 20 6f 66 20 74 68 65  20 75 70 64 61 74 65 20  |s of the update |
00003200  72 6f 75 74 69 6e 65 0d  0a 50 4e 20 20 20 20 20  |routine..PN     |
00003210  20 20 20 4d 4f 56 20 20  20 20 20 72 32 2c 20 72  |   MOV     r2, r|
00003220  31 32 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |12              |
00003230  20 20 20 3b 20 56 61 6c  75 65 20 6f 66 20 72 31  |   ; Value of r1|
00003240  32 20 75 73 65 64 20 62  79 20 74 68 65 20 68 61  |2 used by the ha|
00003250  6e 64 6c 65 72 0d 0a 5a  44 20 20 20 20 20 20 20  |ndler..ZD       |
00003260  20 53 57 49 20 20 20 20  20 22 58 4f 53 5f 43 61  | SWI     "XOS_Ca|
00003270  6c 6c 45 76 65 72 79 22  20 20 20 20 20 20 20 20  |llEvery"        |
00003280  20 3b 20 43 6c 61 69 6d  20 74 68 65 20 65 76 65  | ; Claim the eve|
00003290  6e 74 20 76 65 63 74 6f  72 0d 0a 64 44 20 20 20  |nt vector..dD   |
000032a0  20 20 20 20 20 4d 4f 56  56 53 20 20 20 72 31 31  |     MOVVS   r11|
000032b0  2c 20 72 30 20 20 20 20  20 20 20 20 20 20 20 20  |, r0            |
000032c0  20 20 20 20 20 3b 20 43  6f 70 79 20 61 6e 79 20  |     ; Copy any |
000032d0  65 72 72 6f 72 20 70 6f  69 6e 74 65 72 0d 0a 6e  |error pointer..n|
000032e0  4b 20 20 20 20 20 20 20  20 42 56 53 20 20 20 20  |K        BVS    |
000032f0  20 66 61 69 6c 5f 65 76  65 6e 74 76 20 20 20 20  | fail_eventv    |
00003300  20 20 20 20 20 20 20 20  20 3b 20 46 61 69 6c 20  |         ; Fail |
00003310  69 66 20 61 6e 20 65 72  72 6f 72 20 77 61 73 20  |if an error was |
00003320  70 72 6f 64 75 63 65 64  0d 0a 78 4a 20 20 20 20  |produced..xJ    |
00003330  20 20 20 20 4d 4f 56 20  20 20 20 20 72 30 2c 20  |    MOV     r0, |
00003340  23 26 31 66 20 20 20 20  20 20 20 20 20 20 20 20  |#&1f            |
00003350  20 20 20 20 3b 20 4e 75  6d 62 65 72 20 6f 66 20  |    ; Number of |
00003360  74 68 65 20 53 70 72 69  74 65 56 20 76 65 63 74  |the SpriteV vect|
00003370  6f 72 0d 0a 82 4c 20 20  20 20 20 20 20 20 41 44  |or...L        AD|
00003380  52 20 20 20 20 20 72 31  2c 20 73 70 72 69 74 65  |R     r1, sprite|
00003390  76 5f 68 61 6e 64 6c 65  72 20 20 20 20 20 3b 20  |v_handler     ; |
000033a0  41 64 64 72 65 73 73 20  6f 66 20 74 68 65 20 68  |Address of the h|
000033b0  61 6e 64 6c 65 72 20 72  6f 75 74 69 6e 65 0d 0a  |andler routine..|
000033c0  8c 4e 20 20 20 20 20 20  20 20 4d 4f 56 20 20 20  |.N        MOV   |
000033d0  20 20 72 32 2c 20 72 31  32 20 20 20 20 20 20 20  |  r2, r12       |
000033e0  20 20 20 20 20 20 20 20  20 20 3b 20 56 61 6c 75  |          ; Valu|
000033f0  65 20 6f 66 20 72 31 32  20 75 73 65 64 20 62 79  |e of r12 used by|
00003400  20 74 68 65 20 68 61 6e  64 6c 65 72 0d 0a 96 4a  | the handler...J|
00003410  20 20 20 20 20 20 20 20  53 57 49 20 20 20 20 20  |        SWI     |
00003420  22 58 4f 53 5f 43 6c 61  69 6d 22 20 20 20 20 20  |"XOS_Claim"     |
00003430  20 20 20 20 20 20 20 20  3b 20 43 6c 61 69 6d 20  |        ; Claim |
00003440  74 68 65 20 4f 53 5f 53  70 72 69 74 65 4f 70 20  |the OS_SpriteOp |
00003450  76 65 63 74 6f 72 0d 0a  a0 44 20 20 20 20 20 20  |vector...D      |
00003460  20 20 4d 4f 56 56 53 20  20 20 72 31 31 2c 20 72  |  MOVVS   r11, r|
00003470  30 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |0               |
00003480  20 20 3b 20 43 6f 70 79  20 61 6e 79 20 65 72 72  |  ; Copy any err|
00003490  6f 72 20 70 6f 69 6e 74  65 72 0d 0a aa 4b 20 20  |or pointer...K  |
000034a0  20 20 20 20 20 20 42 56  53 20 20 20 20 20 66 61  |      BVS     fa|
000034b0  69 6c 5f 73 70 72 69 74  65 76 20 20 20 20 20 20  |il_spritev      |
000034c0  20 20 20 20 20 20 3b 20  46 61 69 6c 20 69 66 20  |      ; Fail if |
000034d0  61 6e 20 65 72 72 6f 72  20 77 61 73 20 70 72 6f  |an error was pro|
000034e0  64 75 63 65 64 0d 0a b4  48 20 20 20 20 20 20 20  |duced...H       |
000034f0  20 4d 4f 56 20 20 20 20  20 72 30 2c 20 23 26 30  | MOV     r0, #&0|
00003500  37 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |7               |
00003510  20 3b 20 4e 75 6d 62 65  72 20 6f 66 20 74 68 65  | ; Number of the|
00003520  20 57 6f 72 64 56 20 76  65 63 74 6f 72 0d 0a be  | WordV vector...|
00003530  4c 20 20 20 20 20 20 20  20 41 44 52 20 20 20 20  |L        ADR    |
00003540  20 72 31 2c 20 77 6f 72  64 76 5f 68 61 6e 64 6c  | r1, wordv_handl|
00003550  65 72 20 20 20 20 20 20  20 3b 20 41 64 64 72 65  |er       ; Addre|
00003560  73 73 20 6f 66 20 74 68  65 20 68 61 6e 64 6c 65  |ss of the handle|
00003570  72 20 72 6f 75 74 69 6e  65 0d 0a c8 4e 20 20 20  |r routine...N   |
00003580  20 20 20 20 20 4d 4f 56  20 20 20 20 20 72 32 2c  |     MOV     r2,|
00003590  20 72 31 32 20 20 20 20  20 20 20 20 20 20 20 20  | r12            |
000035a0  20 20 20 20 20 3b 20 56  61 6c 75 65 20 6f 66 20  |     ; Value of |
000035b0  72 31 32 20 75 73 65 64  20 62 79 20 74 68 65 20  |r12 used by the |
000035c0  68 61 6e 64 6c 65 72 0d  0a d2 46 20 20 20 20 20  |handler...F     |
000035d0  20 20 20 53 57 49 20 20  20 20 20 22 58 4f 53 5f  |   SWI     "XOS_|
000035e0  43 6c 61 69 6d 22 20 20  20 20 20 20 20 20 20 20  |Claim"          |
000035f0  20 20 20 3b 20 43 6c 61  69 6d 20 74 68 65 20 4f  |   ; Claim the O|
00003600  53 5f 57 6f 72 64 20 76  65 63 74 6f 72 0d 0a dc  |S_Word vector...|
00003610  44 20 20 20 20 20 20 20  20 4d 4f 56 56 53 20 20  |D        MOVVS  |
00003620  20 72 31 31 2c 20 72 30  20 20 20 20 20 20 20 20  | r11, r0        |
00003630  20 20 20 20 20 20 20 20  20 3b 20 43 6f 70 79 20  |         ; Copy |
00003640  61 6e 79 20 65 72 72 6f  72 20 70 6f 69 6e 74 65  |any error pointe|
00003650  72 0d 0a e6 4b 20 20 20  20 20 20 20 20 42 56 53  |r...K        BVS|
00003660  20 20 20 20 20 66 61 69  6c 5f 77 6f 72 64 76 20  |     fail_wordv |
00003670  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 46  |             ; F|
00003680  61 69 6c 20 69 66 20 61  6e 20 65 72 72 6f 72 20  |ail if an error |
00003690  77 61 73 20 70 72 6f 64  75 63 65 64 0d 0a f0 4d  |was produced...M|
000036a0  3b 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |;       MOV     |
000036b0  72 30 2c 20 23 31 34 20  20 20 20 20 20 20 20 20  |r0, #14         |
000036c0  20 20 20 20 20 20 20 20  3b 20 4f 53 5f 42 79 74  |        ; OS_Byt|
000036d0  65 20 63 6f 64 65 20 74  6f 20 65 6e 61 62 6c 65  |e code to enable|
000036e0  20 61 6e 20 65 76 65 6e  74 0d 0a fa 44 3b 20 20  | an event...D;  |
000036f0  20 20 20 20 20 4d 4f 56  20 20 20 20 20 72 31 2c  |     MOV     r1,|
00003700  20 23 34 20 20 20 20 20  20 20 20 20 20 20 20 20  | #4             |
00003710  20 20 20 20 20 3b 20 54  68 65 20 76 73 79 6e 63  |     ; The vsync|
00003720  20 65 76 65 6e 74 20 6e  75 6d 62 65 72 0d 0b 04  | event number...|
00003730  4c 3b 20 20 20 20 20 20  20 53 57 49 20 20 20 20  |L;       SWI    |
00003740  20 22 58 4f 53 5f 42 79  74 65 22 20 20 20 20 20  | "XOS_Byte"     |
00003750  20 20 20 20 20 20 20 20  20 3b 20 45 6e 61 62 6c  |         ; Enabl|
00003760  65 20 74 68 65 20 76 65  72 74 69 63 61 6c 20 73  |e the vertical s|
00003770  79 6e 63 20 65 76 65 6e  74 0d 0b 0e 44 3b 20 20  |ync event...D;  |
00003780  20 20 20 20 20 4d 4f 56  56 53 20 20 20 72 31 31  |     MOVVS   r11|
00003790  2c 20 72 30 20 20 20 20  20 20 20 20 20 20 20 20  |, r0            |
000037a0  20 20 20 20 20 3b 20 43  6f 70 79 20 61 6e 79 20  |     ; Copy any |
000037b0  65 72 72 6f 72 20 70 6f  69 6e 74 65 72 0d 0b 18  |error pointer...|
000037c0  4b 3b 20 20 20 20 20 20  20 42 56 53 20 20 20 20  |K;       BVS    |
000037d0  20 66 61 69 6c 5f 76 73  79 6e 63 20 20 20 20 20  | fail_vsync     |
000037e0  20 20 20 20 20 20 20 20  20 3b 20 46 61 69 6c 20  |         ; Fail |
000037f0  69 66 20 61 6e 20 65 72  72 6f 72 20 77 61 73 20  |if an error was |
00003800  70 72 6f 64 75 63 65 64  0d 0b 22 3f 20 20 20 20  |produced.."?    |
00003810  20 20 20 20 4c 44 4d 46  44 20 20 20 72 31 33 21  |    LDMFD   r13!|
00003820  2c 20 7b 72 31 31 2c 20  70 63 7d 20 20 20 20 20  |, {r11, pc}     |
00003830  20 20 20 20 3b 20 52 65  74 75 72 6e 20 74 6f 20  |    ; Return to |
00003840  52 49 53 43 20 4f 53 0d  0b 2c 04 0d 0b 36 1f 20  |RISC OS..,...6. |
00003850  20 20 20 20 20 20 20 3b  20 46 69 6e 61 6c 69 73  |       ; Finalis|
00003860  61 74 69 6f 6e 20 63 6f  64 65 0d 0b 40 11 2e 66  |ation code..@..f|
00003870  69 6e 61 6c 69 73 61 74  69 6f 6e 0d 0b 4a 3d 20  |inalisation..J= |
00003880  20 20 20 20 20 20 20 53  54 4d 46 44 20 20 20 72  |       STMFD   r|
00003890  31 33 21 2c 20 7b 72 31  31 2c 20 72 31 34 7d 20  |13!, {r11, r14} |
000038a0  20 20 20 20 20 20 20 3b  20 53 74 61 63 6b 20 72  |       ; Stack r|
000038b0  65 67 69 73 74 65 72 73  0d 0b 54 46 20 20 20 20  |egisters..TF    |
000038c0  20 20 20 20 4c 44 52 20  20 20 20 20 72 31 32 2c  |    LDR     r12,|
000038d0  20 5b 72 31 32 5d 20 20  20 20 20 20 20 20 20 20  | [r12]          |
000038e0  20 20 20 20 3b 20 4f 62  74 61 69 6e 20 77 6f 72  |    ; Obtain wor|
000038f0  6b 73 70 61 63 65 20 70  6f 69 6e 74 65 72 0d 0b  |kspace pointer..|
00003900  5e 45 20 20 20 20 20 20  20 20 4d 4f 56 20 20 20  |^E        MOV   |
00003910  20 20 72 31 31 2c 20 23  30 20 20 20 20 20 20 20  |  r11, #0       |
00003920  20 20 20 20 20 20 20 20  20 20 3b 20 43 6c 65 61  |          ; Clea|
00003930  72 20 74 68 65 20 65 72  72 6f 72 20 70 6f 69 6e  |r the error poin|
00003940  74 65 72 0d 0b 68 4f 3b  20 20 20 20 20 20 20 20  |ter..hO;        |
00003950  4d 4f 56 20 20 20 20 20  72 30 2c 20 23 31 33 20  |MOV     r0, #13 |
00003960  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003970  3b 20 4f 53 5f 42 79 74  65 20 63 6f 64 65 20 74  |; OS_Byte code t|
00003980  6f 20 64 69 73 61 62 6c  65 20 61 6e 20 65 76 65  |o disable an eve|
00003990  6e 74 0d 0b 72 45 3b 20  20 20 20 20 20 20 20 4d  |nt..rE;        M|
000039a0  4f 56 20 20 20 20 20 72  31 2c 20 23 34 20 20 20  |OV     r1, #4   |
000039b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
000039c0  20 54 68 65 20 76 73 79  6e 63 20 65 76 65 6e 74  | The vsync event|
000039d0  20 6e 75 6d 62 65 72 0d  0b 7c 4e 3b 20 20 20 20  | number..|N;    |
000039e0  20 20 20 20 53 57 49 20  20 20 20 20 22 58 4f 53  |    SWI     "XOS|
000039f0  5f 42 79 74 65 22 20 20  20 20 20 20 20 20 20 20  |_Byte"          |
00003a00  20 20 20 20 3b 20 44 69  73 61 62 6c 65 20 74 68  |    ; Disable th|
00003a10  65 20 76 65 72 74 69 63  61 6c 20 73 79 6e 63 20  |e vertical sync |
00003a20  65 76 65 6e 74 0d 0b 86  4b 20 20 20 20 20 20 20  |event...K       |
00003a30  20 42 56 53 20 20 20 20  20 65 78 69 74 20 20 20  | BVS     exit   |
00003a40  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003a50  20 3b 20 45 78 69 74 20  69 66 20 61 6e 20 65 72  | ; Exit if an er|
00003a60  72 6f 72 20 77 61 73 20  70 72 6f 64 75 63 65 64  |ror was produced|
00003a70  0d 0b 90 0f 2e 66 61 69  6c 5f 76 73 79 6e 63 0d  |.....fail_vsync.|
00003a80  0b 9a 48 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |..H        MOV  |
00003a90  20 20 20 72 30 2c 20 23  26 30 37 20 20 20 20 20  |   r0, #&07     |
00003aa0  20 20 20 20 20 20 20 20  20 20 20 3b 20 4e 75 6d  |           ; Num|
00003ab0  62 65 72 20 6f 66 20 74  68 65 20 57 6f 72 64 56  |ber of the WordV|
00003ac0  20 76 65 63 74 6f 72 0d  0b a4 4c 20 20 20 20 20  | vector...L     |
00003ad0  20 20 20 41 44 52 20 20  20 20 20 72 31 2c 20 77  |   ADR     r1, w|
00003ae0  6f 72 64 76 5f 68 61 6e  64 6c 65 72 20 20 20 20  |ordv_handler    |
00003af0  20 20 20 3b 20 41 64 64  72 65 73 73 20 6f 66 20  |   ; Address of |
00003b00  74 68 65 20 68 61 6e 64  6c 65 72 20 72 6f 75 74  |the handler rout|
00003b10  69 6e 65 0d 0b ae 4e 20  20 20 20 20 20 20 20 4d  |ine...N        M|
00003b20  4f 56 20 20 20 20 20 72  32 2c 20 72 31 32 20 20  |OV     r2, r12  |
00003b30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00003b40  20 56 61 6c 75 65 20 6f  66 20 72 31 32 20 75 73  | Value of r12 us|
00003b50  65 64 20 62 79 20 74 68  65 20 68 61 6e 64 6c 65  |ed by the handle|
00003b60  72 0d 0b b8 48 20 20 20  20 20 20 20 20 53 57 49  |r...H        SWI|
00003b70  20 20 20 20 20 22 58 4f  53 5f 52 65 6c 65 61 73  |     "XOS_Releas|
00003b80  65 22 20 20 20 20 20 20  20 20 20 20 20 3b 20 52  |e"           ; R|
00003b90  65 6c 65 61 73 65 20 74  68 65 20 4f 53 5f 57 6f  |elease the OS_Wo|
00003ba0  72 64 20 76 65 63 74 6f  72 0d 0b c2 4b 20 20 20  |rd vector...K   |
00003bb0  20 20 20 20 20 42 56 53  20 20 20 20 20 65 78 69  |     BVS     exi|
00003bc0  74 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |t               |
00003bd0  20 20 20 20 20 3b 20 45  78 69 74 20 69 66 20 61  |     ; Exit if a|
00003be0  6e 20 65 72 72 6f 72 20  77 61 73 20 70 72 6f 64  |n error was prod|
00003bf0  75 63 65 64 0d 0b cc 0f  2e 66 61 69 6c 5f 77 6f  |uced.....fail_wo|
00003c00  72 64 76 0d 0b d6 4a 20  20 20 20 20 20 20 20 4d  |rdv...J        M|
00003c10  4f 56 20 20 20 20 20 72  30 2c 20 23 26 31 66 20  |OV     r0, #&1f |
00003c20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00003c30  20 4e 75 6d 62 65 72 20  6f 66 20 74 68 65 20 53  | Number of the S|
00003c40  70 72 69 74 65 56 20 76  65 63 74 6f 72 0d 0b e0  |priteV vector...|
00003c50  4c 20 20 20 20 20 20 20  20 41 44 52 20 20 20 20  |L        ADR    |
00003c60  20 72 31 2c 20 73 70 72  69 74 65 76 5f 68 61 6e  | r1, spritev_han|
00003c70  64 6c 65 72 20 20 20 20  20 3b 20 41 64 64 72 65  |dler     ; Addre|
00003c80  73 73 20 6f 66 20 74 68  65 20 68 61 6e 64 6c 65  |ss of the handle|
00003c90  72 20 72 6f 75 74 69 6e  65 0d 0b ea 4e 20 20 20  |r routine...N   |
00003ca0  20 20 20 20 20 4d 4f 56  20 20 20 20 20 72 32 2c  |     MOV     r2,|
00003cb0  20 72 31 32 20 20 20 20  20 20 20 20 20 20 20 20  | r12            |
00003cc0  20 20 20 20 20 3b 20 56  61 6c 75 65 20 6f 66 20  |     ; Value of |
00003cd0  72 31 32 20 75 73 65 64  20 62 79 20 74 68 65 20  |r12 used by the |
00003ce0  68 61 6e 64 6c 65 72 0d  0b f4 4c 20 20 20 20 20  |handler...L     |
00003cf0  20 20 20 53 57 49 20 20  20 20 20 22 58 4f 53 5f  |   SWI     "XOS_|
00003d00  52 65 6c 65 61 73 65 22  20 20 20 20 20 20 20 20  |Release"        |
00003d10  20 20 20 3b 20 52 65 6c  65 61 73 65 20 74 68 65  |   ; Release the|
00003d20  20 4f 53 5f 53 70 72 69  74 65 4f 70 20 76 65 63  | OS_SpriteOp vec|
00003d30  74 6f 72 0d 0b fe 4b 20  20 20 20 20 20 20 20 42  |tor...K        B|
00003d40  56 53 20 20 20 20 20 65  78 69 74 20 20 20 20 20  |VS     exit     |
00003d50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00003d60  20 45 78 69 74 20 69 66  20 61 6e 20 65 72 72 6f  | Exit if an erro|
00003d70  72 20 77 61 73 20 70 72  6f 64 75 63 65 64 0d 0c  |r was produced..|
00003d80  08 11 2e 66 61 69 6c 5f  73 70 72 69 74 65 76 0d  |...fail_spritev.|
00003d90  0c 12 4b 20 20 20 20 20  20 20 20 41 44 52 20 20  |..K        ADR  |
00003da0  20 20 20 72 30 2c 20 75  70 64 61 74 65 20 20 20  |   r0, update   |
00003db0  20 20 20 20 20 20 20 20  20 20 20 3b 20 41 64 64  |           ; Add|
00003dc0  72 65 73 73 20 6f 66 20  74 68 65 20 75 70 64 61  |ress of the upda|
00003dd0  74 65 20 72 6f 75 74 69  6e 65 0d 0c 1c 4e 20 20  |te routine...N  |
00003de0  20 20 20 20 20 20 4d 4f  56 20 20 20 20 20 72 31  |      MOV     r1|
00003df0  2c 20 72 31 32 20 20 20  20 20 20 20 20 20 20 20  |, r12           |
00003e00  20 20 20 20 20 20 3b 20  56 61 6c 75 65 20 6f 66  |      ; Value of|
00003e10  20 72 31 32 20 75 73 65  64 20 62 79 20 74 68 65  | r12 used by the|
00003e20  20 68 61 6e 64 6c 65 72  0d 0c 26 45 20 20 20 20  | handler..&E    |
00003e30  20 20 20 20 53 57 49 20  20 20 20 20 22 58 4f 53  |    SWI     "XOS|
00003e40  5f 52 65 6d 6f 76 65 54  69 63 6b 65 72 45 76 65  |_RemoveTickerEve|
00003e50  6e 74 22 20 3b 20 52 65  6d 6f 76 65 20 74 68 65  |nt" ; Remove the|
00003e60  20 74 69 63 6b 65 72 20  65 76 65 6e 74 0d 0c 30  | ticker event..0|
00003e70  4b 20 20 20 20 20 20 20  20 42 56 53 20 20 20 20  |K        BVS    |
00003e80  20 65 78 69 74 20 20 20  20 20 20 20 20 20 20 20  | exit           |
00003e90  20 20 20 20 20 20 20 20  20 3b 20 45 78 69 74 20  |         ; Exit |
00003ea0  69 66 20 61 6e 20 65 72  72 6f 72 20 77 61 73 20  |if an error was |
00003eb0  70 72 6f 64 75 63 65 64  0d 0c 3a 10 2e 66 61 69  |produced..:..fai|
00003ec0  6c 5f 65 76 65 6e 74 76  0d 0c 44 0d 2e 66 61 69  |l_eventv..D..fai|
00003ed0  6c 5f 76 64 75 0d 0c 4e  12 2e 66 61 69 6c 5f 70  |l_vdu..N..fail_p|
00003ee0  6f 73 69 74 69 6f 6e 0d  0c 58 4b 20 20 20 20 20  |osition..XK     |
00003ef0  20 20 20 4d 4f 56 20 20  20 20 20 72 30 2c 20 23  |   MOV     r0, #|
00003f00  37 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |7               |
00003f10  20 20 20 3b 20 52 65 61  73 6f 6e 20 63 6f 64 65  |   ; Reason code|
00003f20  20 74 6f 20 72 65 6c 65  61 73 65 20 6d 65 6d 6f  | to release memo|
00003f30  72 79 0d 0c 62 48 20 20  20 20 20 20 20 20 4d 4f  |ry..bH        MO|
00003f40  56 20 20 20 20 20 72 32  2c 20 72 31 32 20 20 20  |V     r2, r12   |
00003f50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00003f60  43 6f 70 79 20 74 68 65  20 77 6f 72 6b 73 70 61  |Copy the workspa|
00003f70  63 65 20 70 6f 69 6e 74  65 72 0d 0c 6c 43 20 20  |ce pointer..lC  |
00003f80  20 20 20 20 20 20 53 57  49 20 20 20 20 20 22 58  |      SWI     "X|
00003f90  4f 53 5f 4d 6f 64 75 6c  65 22 20 20 20 20 20 20  |OS_Module"      |
00003fa0  20 20 20 20 20 20 3b 20  52 65 6c 65 61 73 65 20  |      ; Release |
00003fb0  74 68 65 20 77 6f 72 6b  73 70 61 63 65 0d 0c 76  |the workspace..v|
00003fc0  4b 20 20 20 20 20 20 20  20 42 56 53 20 20 20 20  |K        BVS    |
00003fd0  20 65 78 69 74 20 20 20  20 20 20 20 20 20 20 20  | exit           |
00003fe0  20 20 20 20 20 20 20 20  20 3b 20 45 78 69 74 20  |         ; Exit |
00003ff0  69 66 20 61 6e 20 65 72  72 6f 72 20 77 61 73 20  |if an error was |
00004000  70 72 6f 64 75 63 65 64  0d 0c 80 0c 2e 66 61 69  |produced.....fai|
00004010  6c 5f 77 73 0d 0c 8a 47  20 20 20 20 20 20 20 20  |l_ws...G        |
00004020  54 45 51 20 20 20 20 20  72 31 31 2c 20 23 30 20  |TEQ     r11, #0 |
00004030  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004040  3b 20 49 73 20 74 68 65  72 65 20 61 6e 20 65 72  |; Is there an er|
00004050  72 6f 72 20 70 6f 69 6e  74 65 72 0d 0c 94 47 20  |ror pointer...G |
00004060  20 20 20 20 20 20 20 42  45 51 20 20 20 20 20 65  |       BEQ     e|
00004070  78 69 74 20 20 20 20 20  20 20 20 20 20 20 20 20  |xit             |
00004080  20 20 20 20 20 20 20 3b  20 45 78 69 74 20 77 69  |       ; Exit wi|
00004090  74 68 6f 75 74 20 65 72  72 6f 72 20 69 66 20 6e  |thout error if n|
000040a0  6f 74 0d 0c 9e 44 20 20  20 20 20 20 20 20 4d 4f  |ot...D        MO|
000040b0  56 20 20 20 20 20 72 30  2c 20 72 31 31 20 20 20  |V     r0, r11   |
000040c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
000040d0  43 6f 70 79 20 74 68 65  20 65 72 72 6f 72 20 70  |Copy the error p|
000040e0  6f 69 6e 74 65 72 0d 0c  a8 43 20 20 20 20 20 20  |ointer...C      |
000040f0  20 20 43 4d 50 20 20 20  20 20 70 63 2c 20 23 26  |  CMP     pc, #&|
00004100  38 30 30 30 30 30 30 30  20 20 20 20 20 20 20 20  |80000000        |
00004110  20 20 3b 20 53 65 74 20  74 68 65 20 6f 76 65 72  |  ; Set the over|
00004120  66 6c 6f 77 20 66 6c 61  67 0d 0c b2 3f 2e 65 78  |flow flag...?.ex|
00004130  69 74 20 20 20 4c 44 4d  46 44 20 20 20 72 31 33  |it   LDMFD   r13|
00004140  21 2c 20 7b 72 31 31 2c  20 70 63 7d 20 20 20 20  |!, {r11, pc}    |
00004150  20 20 20 20 20 3b 20 52  65 74 75 72 6e 20 74 6f  |     ; Return to|
00004160  20 52 49 53 43 20 4f 53  0d 0c bc 04 0d 0c c6 22  | RISC OS......."|
00004170  20 20 20 20 20 20 20 20  3b 20 53 65 72 76 69 63  |        ; Servic|
00004180  65 20 63 61 6c 6c 20 68  61 6e 64 6c 65 72 0d 0c  |e call handler..|
00004190  d0 0c 2e 73 65 72 76 69  63 65 0d 0c da 40 20 20  |...service...@  |
000041a0  20 20 20 20 20 20 54 45  51 20 20 20 20 20 72 31  |      TEQ     r1|
000041b0  2c 20 23 26 34 36 20 20  20 20 20 20 20 20 20 20  |, #&46          |
000041c0  20 20 20 20 20 20 3b 20  53 65 72 76 69 63 65 5f  |      ; Service_|
000041d0  4d 6f 64 65 43 68 61 6e  67 65 0d 0c e4 4f 20 20  |ModeChange...O  |
000041e0  20 20 20 20 20 20 4d 4f  56 4e 45 53 20 20 70 63  |      MOVNES  pc|
000041f0  2c 20 72 31 34 20 20 20  20 20 20 20 20 20 20 20  |, r14           |
00004200  20 20 20 20 20 20 3b 20  52 65 6a 65 63 74 20 75  |      ; Reject u|
00004210  6e 72 65 63 6f 67 6e 69  73 65 64 20 63 61 6c 6c  |nrecognised call|
00004220  73 20 71 75 69 63 6b 6c  79 0d 0c ee 46 20 20 20  |s quickly...F   |
00004230  20 20 20 20 20 4c 44 52  20 20 20 20 20 72 31 32  |     LDR     r12|
00004240  2c 20 5b 72 31 32 5d 20  20 20 20 20 20 20 20 20  |, [r12]         |
00004250  20 20 20 20 20 3b 20 4f  62 74 61 69 6e 20 77 6f  |     ; Obtain wo|
00004260  72 6b 73 70 61 63 65 20  70 6f 69 6e 74 65 72 0d  |rkspace pointer.|
00004270  0c f8 40 20 20 20 20 20  20 20 20 54 45 51 20 20  |..@        TEQ  |
00004280  20 20 20 72 31 2c 20 23  26 34 36 20 20 20 20 20  |   r1, #&46     |
00004290  20 20 20 20 20 20 20 20  20 20 20 3b 20 53 65 72  |           ; Ser|
000042a0  76 69 63 65 5f 4d 6f 64  65 43 68 61 6e 67 65 0d  |vice_ModeChange.|
000042b0  0d 02 4e 20 20 20 20 20  20 20 20 42 45 51 20 20  |..N        BEQ  |
000042c0  20 20 20 73 65 72 76 69  63 65 5f 6d 6f 64 65 5f  |   service_mode_|
000042d0  63 68 61 6e 67 65 20 20  20 20 20 3b 20 4a 75 6d  |change     ; Jum|
000042e0  70 20 74 6f 20 68 61 6e  64 6c 65 72 20 66 6f 72  |p to handler for|
000042f0  20 6d 6f 64 65 20 63 68  61 6e 67 65 73 0d 0d 0c  | mode changes...|
00004300  04 0d 0d 16 21 20 20 20  20 20 20 20 20 3b 20 48  |....!        ; H|
00004310  61 6e 64 6c 65 20 6d 6f  64 65 20 63 68 61 6e 67  |andle mode chang|
00004320  65 73 0d 0d 20 18 2e 73  65 72 76 69 63 65 5f 6d  |es.. ..service_m|
00004330  6f 64 65 5f 63 68 61 6e  67 65 0d 0d 2a 3d 20 20  |ode_change..*=  |
00004340  20 20 20 20 20 20 53 54  4d 46 44 20 20 20 72 31  |      STMFD   r1|
00004350  33 21 2c 20 7b 72 31 34  7d 20 20 20 20 20 20 20  |3!, {r14}       |
00004360  20 20 20 20 20 20 3b 20  53 74 61 63 6b 20 72 65  |      ; Stack re|
00004370  67 69 73 74 65 72 73 0d  0d 34 44 20 20 20 20 20  |gisters..4D     |
00004380  20 20 20 42 4c 20 20 20  20 20 20 72 65 61 64 5f  |   BL      read_|
00004390  76 64 75 20 20 20 20 20  20 20 20 20 20 20 20 20  |vdu             |
000043a0  20 20 20 3b 20 52 65 61  64 20 74 68 65 20 70 69  |   ; Read the pi|
000043b0  78 65 6c 20 73 63 61 6c  69 6e 67 0d 0d 3e 46 20  |xel scaling..>F |
000043c0  20 20 20 20 20 20 20 4c  44 4d 46 44 20 20 20 72  |       LDMFD   r|
000043d0  31 33 21 2c 20 7b 70 63  7d 5e 20 20 20 20 20 20  |13!, {pc}^      |
000043e0  20 20 20 20 20 20 20 3b  20 52 65 74 75 72 6e 20  |       ; Return |
000043f0  66 72 6f 6d 20 73 65 72  76 69 63 65 20 63 61 6c  |from service cal|
00004400  6c 0d 0d 48 04 0d 0d 52  25 20 20 20 20 20 20 20  |l..H...R%       |
00004410  20 3b 20 52 65 61 64 20  74 68 65 20 70 69 78 65  | ; Read the pixe|
00004420  6c 20 73 63 61 6c 69 6e  67 73 0d 0d 5c 0d 2e 72  |l scalings..\..r|
00004430  65 61 64 5f 76 64 75 0d  0d 66 3d 20 20 20 20 20  |ead_vdu..f=     |
00004440  20 20 20 53 54 4d 46 44  20 20 20 72 31 33 21 2c  |   STMFD   r13!,|
00004450  20 7b 72 30 2d 72 33 2c  20 72 31 34 7d 20 20 20  | {r0-r3, r14}   |
00004460  20 20 20 3b 20 53 74 61  63 6b 20 72 65 67 69 73  |   ; Stack regis|
00004470  74 65 72 73 0d 0d 70 4d  20 20 20 20 20 20 20 20  |ters..pM        |
00004480  4d 56 4e 20 20 20 20 20  72 30 2c 20 23 30 20 20  |MVN     r0, #0  |
00004490  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000044a0  3b 20 52 65 61 64 20 76  61 72 69 61 62 6c 65 73  |; Read variables|
000044b0  20 66 6f 72 20 63 75 72  72 65 6e 74 20 6d 6f 64  | for current mod|
000044c0  65 0d 0d 7a 4c 20 20 20  20 20 20 20 20 4d 4f 56  |e..zL        MOV|
000044d0  20 20 20 20 20 72 31 2c  20 23 34 20 20 20 20 20  |     r1, #4     |
000044e0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 56  |             ; V|
000044f0  61 72 69 61 62 6c 65 20  6e 75 6d 62 65 72 20 66  |ariable number f|
00004500  6f 72 20 58 45 69 67 46  61 63 74 6f 72 0d 0d 84  |or XEigFactor...|
00004510  47 20 20 20 20 20 20 20  20 53 57 49 20 20 20 20  |G        SWI    |
00004520  20 22 58 4f 53 5f 52 65  61 64 4d 6f 64 65 56 61  | "XOS_ReadModeVa|
00004530  72 69 61 62 6c 65 22 20  20 3b 20 52 65 61 64 20  |riable"  ; Read |
00004540  74 68 65 20 58 45 69 67  46 61 63 74 6f 72 20 76  |the XEigFactor v|
00004550  61 6c 75 65 0d 0d 8e 47  20 20 20 20 20 20 20 20  |alue...G        |
00004560  4d 4f 56 20 20 20 20 20  72 33 2c 20 72 32 20 20  |MOV     r3, r2  |
00004570  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004580  3b 20 43 6f 70 79 20 74  68 65 20 58 45 69 67 46  |; Copy the XEigF|
00004590  61 63 74 6f 72 20 76 61  6c 75 65 0d 0d 98 4c 20  |actor value...L |
000045a0  20 20 20 20 20 20 20 4d  4f 56 20 20 20 20 20 72  |       MOV     r|
000045b0  31 2c 20 23 35 20 20 20  20 20 20 20 20 20 20 20  |1, #5           |
000045c0  20 20 20 20 20 20 20 3b  20 56 61 72 69 61 62 6c  |       ; Variabl|
000045d0  65 20 6e 75 6d 62 65 72  20 66 6f 72 20 59 45 69  |e number for YEi|
000045e0  67 46 61 63 74 6f 72 0d  0d a2 47 20 20 20 20 20  |gFactor...G     |
000045f0  20 20 20 53 57 49 20 20  20 20 20 22 58 4f 53 5f  |   SWI     "XOS_|
00004600  52 65 61 64 4d 6f 64 65  56 61 72 69 61 62 6c 65  |ReadModeVariable|
00004610  22 20 20 3b 20 52 65 61  64 20 74 68 65 20 59 45  |"  ; Read the YE|
00004620  69 67 46 61 63 74 6f 72  20 76 61 6c 75 65 0d 0d  |igFactor value..|
00004630  ac 4f 20 20 20 20 20 20  20 20 4d 4f 56 20 20 20  |.O        MOV   |
00004640  20 20 72 30 2c 20 23 30  20 20 20 20 20 20 20 20  |  r0, #0        |
00004650  20 20 20 20 20 20 20 20  20 20 3b 20 49 6e 69 74  |          ; Init|
00004660  69 61 6c 69 73 65 20 74  68 65 20 63 6f 6d 6d 6f  |ialise the commo|
00004670  6e 20 65 69 67 65 6e 20  76 61 6c 75 65 0d 0d b6  |n eigen value...|
00004680  12 2e 72 65 61 64 5f 76  64 75 5f 6c 6f 6f 70 0d  |..read_vdu_loop.|
00004690  0d c0 44 20 20 20 20 20  20 20 20 54 45 51 20 20  |..D        TEQ  |
000046a0  20 20 20 72 32 2c 20 23  30 20 20 20 20 20 20 20  |   r2, #0       |
000046b0  20 20 20 20 20 20 20 20  20 20 20 3b 20 49 73 20  |           ; Is |
000046c0  74 68 65 20 59 45 69 67  46 61 63 74 6f 72 20 7a  |the YEigFactor z|
000046d0  65 72 6f 0d 0d ca 44 20  20 20 20 20 20 20 20 54  |ero...D        T|
000046e0  45 51 4e 45 20 20 20 72  33 2c 20 23 30 20 20 20  |EQNE   r3, #0   |
000046f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00004700  20 49 73 20 74 68 65 20  58 45 69 67 46 61 63 74  | Is the XEigFact|
00004710  6f 72 20 7a 65 72 6f 0d  0d d4 53 20 20 20 20 20  |or zero...S     |
00004720  20 20 20 42 45 51 20 20  20 20 20 72 65 61 64 5f  |   BEQ     read_|
00004730  76 64 75 5f 64 6f 6e 65  20 20 20 20 20 20 20 20  |vdu_done        |
00004740  20 20 20 3b 20 45 78 69  74 20 6c 6f 6f 70 20 69  |   ; Exit loop i|
00004750  66 20 63 6f 6d 6d 6f 6e  20 63 6f 6d 70 6f 6e 65  |f common compone|
00004760  6e 74 20 72 65 6d 6f 76  65 64 0d 0d de 48 20 20  |nt removed...H  |
00004770  20 20 20 20 20 20 41 44  44 20 20 20 20 20 72 30  |      ADD     r0|
00004780  2c 20 72 30 2c 20 23 31  20 20 20 20 20 20 20 20  |, r0, #1        |
00004790  20 20 20 20 20 20 3b 20  49 6e 63 72 65 6d 65 6e  |      ; Incremen|
000047a0  74 20 63 6f 6d 6d 6f 6e  20 63 6f 6d 70 6f 6e 65  |t common compone|
000047b0  6e 74 0d 0d e8 42 20 20  20 20 20 20 20 20 53 55  |nt...B        SU|
000047c0  42 20 20 20 20 20 72 32  2c 20 72 32 2c 20 23 31  |B     r2, r2, #1|
000047d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
000047e0  44 65 63 72 65 6d 65 6e  74 20 59 45 69 67 46 61  |Decrement YEigFa|
000047f0  63 74 6f 72 0d 0d f2 42  20 20 20 20 20 20 20 20  |ctor...B        |
00004800  53 55 42 20 20 20 20 20  72 33 2c 20 72 33 2c 20  |SUB     r3, r3, |
00004810  23 31 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |#1              |
00004820  3b 20 44 65 63 72 65 6d  65 6e 74 20 58 45 69 67  |; Decrement XEig|
00004830  46 61 63 74 6f 72 0d 0d  fc 49 20 20 20 20 20 20  |Factor...I      |
00004840  20 20 42 20 20 20 20 20  20 20 72 65 61 64 5f 76  |  B       read_v|
00004850  64 75 5f 6c 6f 6f 70 20  20 20 20 20 20 20 20 20  |du_loop         |
00004860  20 20 3b 20 4b 65 65 70  20 6c 6f 6f 70 69 6e 67  |  ; Keep looping|
00004870  20 75 6e 74 69 6c 20 66  69 6e 69 73 68 65 64 0d  | until finished.|
00004880  0e 06 12 2e 72 65 61 64  5f 76 64 75 5f 64 6f 6e  |....read_vdu_don|
00004890  65 0d 0e 10 4a 20 20 20  20 20 20 20 20 53 54 52  |e...J        STR|
000048a0  20 20 20 20 20 72 30 2c  20 5b 72 31 32 2c 20 23  |     r0, [r12, #|
000048b0  77 73 5f 63 65 69 67 5d  20 20 20 20 20 3b 20 53  |ws_ceig]     ; S|
000048c0  74 6f 72 65 20 74 68 65  20 63 6f 6d 6d 6f 6e 20  |tore the common |
000048d0  65 69 67 65 6e 20 76 61  6c 75 65 0d 0e 1a 4b 20  |eigen value...K |
000048e0  20 20 20 20 20 20 20 53  54 52 20 20 20 20 20 72  |       STR     r|
000048f0  33 2c 20 5b 72 31 32 2c  20 23 77 73 5f 78 65 69  |3, [r12, #ws_xei|
00004900  67 5d 20 20 20 20 20 3b  20 53 74 6f 72 65 20 74  |g]     ; Store t|
00004910  68 65 20 61 64 6a 75 73  74 65 64 20 58 45 69 67  |he adjusted XEig|
00004920  46 61 63 74 6f 72 0d 0e  24 4b 20 20 20 20 20 20  |Factor..$K      |
00004930  20 20 53 54 52 20 20 20  20 20 72 32 2c 20 5b 72  |  STR     r2, [r|
00004940  31 32 2c 20 23 77 73 5f  79 65 69 67 5d 20 20 20  |12, #ws_yeig]   |
00004950  20 20 3b 20 53 74 6f 72  65 20 74 68 65 20 61 64  |  ; Store the ad|
00004960  6a 75 73 74 65 64 20 59  45 69 67 46 61 63 74 6f  |justed YEigFacto|
00004970  72 0d 0e 2e 44 20 20 20  20 20 20 20 20 4c 44 4d  |r...D        LDM|
00004980  46 44 20 20 20 72 31 33  21 2c 20 7b 72 30 2d 72  |FD   r13!, {r0-r|
00004990  33 2c 20 70 63 7d 5e 20  20 20 20 20 20 3b 20 52  |3, pc}^      ; R|
000049a0  65 74 75 72 6e 20 66 72  6f 6d 20 73 75 62 72 6f  |eturn from subro|
000049b0  75 74 69 6e 65 0d 0e 38  04 0d 0e 42 24 20 20 20  |utine..8...B$   |
000049c0  20 20 20 20 20 3b 20 45  76 65 6e 74 56 20 68 61  |     ; EventV ha|
000049d0  6e 64 6c 65 72 20 72 6f  75 74 69 6e 65 0d 0e 4c  |ndler routine..L|
000049e0  13 2e 65 76 65 6e 74 76  5f 68 61 6e 64 6c 65 72  |..eventv_handler|
000049f0  0d 0e 56 3e 3b 20 20 20  20 20 20 20 20 53 54 4d  |..V>;        STM|
00004a00  46 44 20 20 20 72 31 33  21 2c 20 7b 72 38 2d 72  |FD   r13!, {r8-r|
00004a10  39 2c 20 72 31 34 7d 20  20 20 20 20 20 3b 20 53  |9, r14}      ; S|
00004a20  74 61 63 6b 20 72 65 67  69 73 74 65 72 73 0d 0e  |tack registers..|
00004a30  60 4f 3b 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |`O;        MOV  |
00004a40  20 20 20 72 39 2c 20 70  63 20 20 20 20 20 20 20  |   r9, pc       |
00004a50  20 20 20 20 20 20 20 20  20 20 20 3b 20 53 61 76  |           ; Sav|
00004a60  65 20 74 68 65 20 63 75  72 72 65 6e 74 20 73 74  |e the current st|
00004a70  61 74 75 73 20 61 6e 64  20 6d 6f 64 65 0d 0e 6a  |atus and mode..j|
00004a80  49 3b 20 20 20 20 20 20  20 20 84 52 20 20 20 20  |I;        .R    |
00004a90  20 72 38 2c 20 72 39 2c  20 23 33 20 20 20 20 20  | r8, r9, #3     |
00004aa0  20 20 20 20 20 20 20 20  20 3b 20 44 65 72 69 76  |         ; Deriv|
00004ab0  65 20 74 68 65 20 53 56  43 2d 6d 6f 64 65 20 76  |e the SVC-mode v|
00004ac0  65 72 73 69 6f 6e 0d 0e  74 3d 3b 20 20 20 20 20  |ersion..t=;     |
00004ad0  20 20 20 54 45 51 50 20  20 20 20 72 38 2c 20 23  |   TEQP    r8, #|
00004ae0  30 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |0               |
00004af0  20 20 20 3b 20 45 6e 74  65 72 20 53 56 43 20 6d  |   ; Enter SVC m|
00004b00  6f 64 65 0d 0e 7e 4b 3b  20 20 20 20 20 20 20 20  |ode..~K;        |
00004b10  4d 4f 56 20 20 20 20 20  72 30 2c 20 72 30 20 20  |MOV     r0, r0  |
00004b20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004b30  3b 20 41 6c 6c 6f 77 20  74 68 65 20 70 72 6f 63  |; Allow the proc|
00004b40  65 73 73 6f 72 20 74 6f  20 61 64 61 70 74 0d 0e  |essor to adapt..|
00004b50  88 3b 3b 20 20 20 20 20  20 20 20 53 54 4d 46 44  |.;;        STMFD|
00004b60  20 20 20 72 31 33 21 2c  20 7b 72 31 34 7d 20 20  |   r13!, {r14}  |
00004b70  20 20 20 20 20 20 20 20  20 20 20 3b 20 53 61 76  |           ; Sav|
00004b80  65 20 72 31 34 5f 73 76  63 0d 0e 92 47 3b 20 20  |e r14_svc...G;  |
00004b90  20 20 20 20 20 20 42 4c  20 20 20 20 20 20 75 70  |      BL      up|
00004ba0  64 61 74 65 20 20 20 20  20 20 20 20 20 20 20 20  |date            |
00004bb0  20 20 20 20 20 20 3b 20  55 70 64 61 74 65 20 74  |      ; Update t|
00004bc0  68 65 20 70 6f 69 6e 74  65 72 20 73 68 61 70 65  |he pointer shape|
00004bd0  0d 0e 9c 3e 3b 20 20 20  20 20 20 20 20 4c 44 4d  |...>;        LDM|
00004be0  46 44 20 20 20 72 31 33  21 2c 20 7b 72 31 34 7d  |FD   r13!, {r14}|
00004bf0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 52  |             ; R|
00004c00  65 73 74 6f 72 65 20 72  31 34 5f 73 76 63 0d 0e  |estore r14_svc..|
00004c10  a6 52 3b 20 20 20 20 20  20 20 20 54 45 51 50 20  |.R;        TEQP |
00004c20  20 20 20 72 39 2c 20 23  30 20 20 20 20 20 20 20  |   r9, #0       |
00004c30  20 20 20 20 20 20 20 20  20 20 20 3b 20 52 65 65  |           ; Ree|
00004c40  6e 74 65 72 20 74 68 65  20 6f 72 69 67 69 6e 61  |nter the origina|
00004c50  6c 20 70 72 6f 63 65 73  73 6f 72 20 6d 6f 64 65  |l processor mode|
00004c60  0d 0e b0 51 3b 20 20 20  20 20 20 20 20 4d 4f 56  |...Q;        MOV|
00004c70  20 20 20 20 20 72 30 2c  20 72 30 20 20 20 20 20  |     r0, r0     |
00004c80  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 41  |             ; A|
00004c90  6c 6c 6f 77 20 74 68 65  20 70 72 6f 63 65 73 73  |llow the process|
00004ca0  6f 72 20 74 6f 20 61 64  61 70 74 20 61 67 61 69  |or to adapt agai|
00004cb0  6e 0d 0e ba 3f 3b 20 20  20 20 20 20 20 20 4c 44  |n...?;        LD|
00004cc0  4d 46 44 20 20 20 72 31  33 21 2c 20 7b 72 38 2d  |MFD   r13!, {r8-|
00004cd0  72 39 2c 20 70 63 7d 5e  20 20 20 20 20 20 3b 20  |r9, pc}^      ; |
00004ce0  50 61 73 73 20 6f 6e 20  74 68 65 20 63 61 6c 6c  |Pass on the call|
00004cf0  0d 0e c4 04 0d 0e ce 25  20 20 20 20 20 20 20 20  |.......%        |
00004d00  3b 20 53 70 72 69 74 65  56 20 68 61 6e 64 6c 65  |; SpriteV handle|
00004d10  72 20 72 6f 75 74 69 6e  65 0d 0e d8 14 2e 73 70  |r routine.....sp|
00004d20  72 69 74 65 76 5f 68 61  6e 64 6c 65 72 0d 0e e2  |ritev_handler...|
00004d30  3d 20 20 20 20 20 20 20  20 53 54 4d 46 44 20 20  |=        STMFD  |
00004d40  20 72 31 33 21 2c 20 7b  72 32 2c 20 72 38 2d 72  | r13!, {r2, r8-r|
00004d50  31 31 2c 20 72 31 34 7d  20 3b 20 53 74 61 63 6b  |11, r14} ; Stack|
00004d60  20 72 65 67 69 73 74 65  72 73 0d 0e ec 44 20 20  | registers...D  |
00004d70  20 20 20 20 20 20 80 20  20 20 20 20 72 38 2c 20  |      .     r8, |
00004d80  72 30 2c 20 23 26 66 66  20 20 20 20 20 20 20 20  |r0, #&ff        |
00004d90  20 20 20 20 3b 20 4d 61  73 6b 20 6f 75 74 20 74  |    ; Mask out t|
00004da0  68 65 20 72 65 61 73 6f  6e 20 63 6f 64 65 0d 0e  |he reason code..|
00004db0  f6 52 20 20 20 20 20 20  20 20 54 45 51 20 20 20  |.R        TEQ   |
00004dc0  20 20 72 38 2c 20 23 33  36 20 20 20 20 20 20 20  |  r8, #36       |
00004dd0  20 20 20 20 20 20 20 20  20 20 3b 20 52 65 61 73  |          ; Reas|
00004de0  6f 6e 20 63 6f 64 65 20  74 6f 20 73 65 74 20 74  |on code to set t|
00004df0  68 65 20 70 6f 69 6e 74  65 72 20 73 68 61 70 65  |he pointer shape|
00004e00  0d 0f 00 52 20 20 20 20  20 20 20 20 42 4e 45 20  |...R        BNE |
00004e10  20 20 20 20 73 70 72 69  74 65 76 5f 68 61 6e 64  |    spritev_hand|
00004e20  6c 65 72 5f 64 6f 6e 65  20 20 20 20 3b 20 4e 6f  |ler_done    ; No|
00004e30  74 20 69 6e 74 65 72 65  73 74 65 64 20 69 6e 20  |t interested in |
00004e40  6f 74 68 65 72 20 72 65  61 73 6f 6e 20 63 6f 64  |other reason cod|
00004e50  65 73 0d 0f 0a 48 20 20  20 20 20 20 20 20 54 53  |es...H        TS|
00004e60  54 20 20 20 20 20 72 33  2c 20 23 26 31 30 20 20  |T     r3, #&10  |
00004e70  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00004e80  49 73 20 74 68 65 20 73  68 61 70 65 20 62 65 69  |Is the shape bei|
00004e90  6e 67 20 63 68 61 6e 67  65 64 0d 0f 14 46 20 20  |ng changed...F  |
00004ea0  20 20 20 20 20 20 42 4e  45 20 20 20 20 20 73 70  |      BNE     sp|
00004eb0  72 69 74 65 76 5f 68 61  6e 64 6c 65 72 5f 64 6f  |ritev_handler_do|
00004ec0  6e 65 20 20 20 20 3b 20  4e 6f 74 20 69 6e 74 65  |ne    ; Not inte|
00004ed0  72 65 73 74 65 64 20 6f  74 68 65 72 77 69 73 65  |rested otherwise|
00004ee0  0d 0f 1e 47 20 20 20 20  20 20 20 20 80 20 20 20  |...G        .   |
00004ef0  20 20 72 38 2c 20 72 30  2c 20 23 26 33 30 30 20  |  r8, r0, #&300 |
00004f00  20 20 20 20 20 20 20 20  20 20 3b 20 47 65 74 20  |          ; Get |
00004f10  72 65 67 69 73 74 65 72  20 69 6e 74 65 72 70 72  |register interpr|
00004f20  65 74 61 74 69 6f 6e 0d  0f 28 4b 20 20 20 20 20  |etation..(K     |
00004f30  20 20 20 54 45 51 20 20  20 20 20 72 38 2c 20 23  |   TEQ     r8, #|
00004f40  35 31 32 20 20 20 20 20  20 20 20 20 20 20 20 20  |512             |
00004f50  20 20 20 3b 20 49 73 20  69 74 20 61 20 70 6f 69  |   ; Is it a poi|
00004f60  6e 74 65 72 20 74 6f 20  74 68 65 20 73 70 72 69  |nter to the spri|
00004f70  74 65 0d 0f 32 49 20 20  20 20 20 20 20 20 41 44  |te..2I        AD|
00004f80  44 45 51 20 20 20 72 32  2c 20 72 32 2c 20 23 34  |DEQ   r2, r2, #4|
00004f90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00004fa0  41 64 76 61 6e 63 65 20  70 6f 69 6e 74 65 72 20  |Advance pointer |
00004fb0  74 6f 20 74 68 65 20 6e  61 6d 65 0d 0f 3c 51 20  |to the name..<Q |
00004fc0  20 20 20 20 20 20 20 41  44 52 20 20 20 20 20 72  |       ADR     r|
00004fd0  38 2c 20 70 6f 69 6e 74  65 72 73 5f 73 74 61 72  |8, pointers_star|
00004fe0  74 20 20 20 20 20 20 3b  20 50 6f 69 6e 74 65 72  |t      ; Pointer|
00004ff0  20 74 6f 20 74 68 65 20  66 69 72 73 74 20 72 65  | to the first re|
00005000  66 65 72 65 6e 63 65 20  6e 61 6d 65 0d 0f 46 19  |ference name..F.|
00005010  2e 73 70 72 69 74 65 76  5f 68 61 6e 64 6c 65 72  |.spritev_handler|
00005020  5f 6c 6f 6f 70 0d 0f 50  4c 20 20 20 20 20 20 20  |_loop..PL       |
00005030  20 4d 4f 56 20 20 20 20  20 72 39 2c 20 23 30 20  | MOV     r9, #0 |
00005040  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005050  20 3b 20 43 68 65 63 6b  20 66 72 6f 6d 20 74 68  | ; Check from th|
00005060  65 20 66 69 72 73 74 20  63 68 61 72 61 63 74 65  |e first characte|
00005070  72 0d 0f 5a 19 2e 73 70  72 69 74 65 76 5f 68 61  |r..Z..spritev_ha|
00005080  6e 64 6c 65 72 5f 63 68  61 72 0d 0f 64 49 20 20  |ndler_char..dI  |
00005090  20 20 20 20 20 20 4c 44  52 42 20 20 20 20 72 31  |      LDRB    r1|
000050a0  30 2c 20 5b 72 32 2c 20  72 39 5d 20 20 20 20 20  |0, [r2, r9]     |
000050b0  20 20 20 20 20 20 3b 20  52 65 61 64 20 70 6f 69  |      ; Read poi|
000050c0  6e 74 65 72 20 6e 61 6d  65 20 63 68 61 72 61 63  |nter name charac|
000050d0  74 65 72 0d 0f 6e 4b 20  20 20 20 20 20 20 20 4c  |ter..nK        L|
000050e0  44 52 42 20 20 20 20 72  31 31 2c 20 5b 72 38 2c  |DRB    r11, [r8,|
000050f0  20 72 39 5d 20 20 20 20  20 20 20 20 20 20 20 3b  | r9]           ;|
00005100  20 52 65 61 64 20 72 65  66 65 72 65 6e 63 65 20  | Read reference |
00005110  6e 61 6d 65 20 63 68 61  72 61 63 74 65 72 0d 0f  |name character..|
00005120  78 4c 20 20 20 20 20 20  20 20 54 45 51 20 20 20  |xL        TEQ   |
00005130  20 20 72 31 31 2c 20 23  30 20 20 20 20 20 20 20  |  r11, #0       |
00005140  20 20 20 20 20 20 20 20  20 20 3b 20 49 73 20 69  |          ; Is i|
00005150  74 20 74 68 65 20 65 6e  64 20 6f 66 20 74 68 65  |t the end of the|
00005160  20 72 65 66 65 72 65 6e  63 65 0d 0f 82 45 20 20  | reference...E  |
00005170  20 20 20 20 20 20 42 45  51 20 20 20 20 20 73 70  |      BEQ     sp|
00005180  72 69 74 65 76 5f 68 61  6e 64 6c 65 72 5f 66 6f  |ritev_handler_fo|
00005190  75 6e 64 20 20 20 3b 20  43 6f 6d 70 6c 65 74 65  |und   ; Complete|
000051a0  20 6d 61 74 63 68 20 69  66 20 69 74 20 69 73 0d  | match if it is.|
000051b0  0f 8c 45 20 20 20 20 20  20 20 20 54 45 51 20 20  |..E        TEQ  |
000051c0  20 20 20 72 31 30 2c 20  72 31 31 20 20 20 20 20  |   r10, r11     |
000051d0  20 20 20 20 20 20 20 20  20 20 20 3b 20 44 6f 20  |           ; Do |
000051e0  74 68 65 20 63 68 61 72  61 63 74 65 72 73 20 6d  |the characters m|
000051f0  61 74 63 68 0d 0f 96 4f  20 20 20 20 20 20 20 20  |atch...O        |
00005200  42 4e 45 20 20 20 20 20  73 70 72 69 74 65 76 5f  |BNE     spritev_|
00005210  68 61 6e 64 6c 65 72 5f  6e 65 78 74 20 20 20 20  |handler_next    |
00005220  3b 20 53 6b 69 70 20 74  6f 20 74 68 65 20 6e 65  |; Skip to the ne|
00005230  78 74 20 72 65 66 65 72  65 6e 63 65 20 69 66 20  |xt reference if |
00005240  6e 6f 74 0d 0f a0 4b 20  20 20 20 20 20 20 20 41  |not...K        A|
00005250  44 44 20 20 20 20 20 72  39 2c 20 72 39 2c 20 23  |DD     r9, r9, #|
00005260  31 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |1              ;|
00005270  20 41 64 76 61 6e 63 65  20 74 6f 20 74 68 65 20  | Advance to the |
00005280  6e 65 78 74 20 63 68 61  72 61 63 74 65 72 0d 0f  |next character..|
00005290  aa 51 20 20 20 20 20 20  20 20 54 45 51 20 20 20  |.Q        TEQ   |
000052a0  20 20 72 39 2c 20 23 31  32 20 20 20 20 20 20 20  |  r9, #12       |
000052b0  20 20 20 20 20 20 20 20  20 20 3b 20 4d 61 78 69  |          ; Maxi|
000052c0  6d 75 6d 20 6c 65 6e 67  74 68 20 69 73 20 74 77  |mum length is tw|
000052d0  65 6c 76 65 20 63 68 61  72 61 63 74 65 72 73 0d  |elve characters.|
000052e0  0f b4 4f 20 20 20 20 20  20 20 20 42 45 51 20 20  |..O        BEQ  |
000052f0  20 20 20 73 70 72 69 74  65 76 5f 68 61 6e 64 6c  |   spritev_handl|
00005300  65 72 5f 66 6f 75 6e 64  20 20 20 3b 20 41 6c 6c  |er_found   ; All|
00005310  20 6d 61 74 63 68 65 64  20 69 66 20 72 65 61 63  | matched if reac|
00005320  68 65 64 20 74 68 69 73  20 70 6f 69 6e 74 0d 0f  |hed this point..|
00005330  be 49 20 20 20 20 20 20  20 20 42 20 20 20 20 20  |.I        B     |
00005340  20 20 73 70 72 69 74 65  76 5f 68 61 6e 64 6c 65  |  spritev_handle|
00005350  72 5f 63 68 61 72 20 20  20 20 3b 20 4c 6f 6f 70  |r_char    ; Loop|
00005360  20 66 6f 72 20 74 68 65  20 6e 65 78 74 20 63 68  | for the next ch|
00005370  61 72 61 63 74 65 72 0d  0f c8 19 2e 73 70 72 69  |aracter.....spri|
00005380  74 65 76 5f 68 61 6e 64  6c 65 72 5f 6e 65 78 74  |tev_handler_next|
00005390  0d 0f d2 48 20 20 20 20  20 20 20 20 41 44 44 20  |...H        ADD |
000053a0  20 20 20 20 72 38 2c 20  72 38 2c 20 23 31 36 20  |    r8, r8, #16 |
000053b0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 41 64  |            ; Ad|
000053c0  76 61 6e 63 65 20 74 6f  20 74 68 65 20 6e 65 78  |vance to the nex|
000053d0  74 20 72 65 63 6f 72 64  0d 0f dc 4c 20 20 20 20  |t record...L    |
000053e0  20 20 20 20 41 44 52 20  20 20 20 20 72 39 2c 20  |    ADR     r9, |
000053f0  70 6f 69 6e 74 65 72 73  5f 65 6e 64 20 20 20 20  |pointers_end    |
00005400  20 20 20 20 3b 20 50 6f  69 6e 74 65 72 20 74 6f  |    ; Pointer to|
00005410  20 74 68 65 20 65 6e 64  20 6f 66 20 74 68 65 20  | the end of the |
00005420  6c 69 73 74 0d 0f e6 46  20 20 20 20 20 20 20 20  |list...F        |
00005430  54 45 51 20 20 20 20 20  72 38 2c 20 72 39 20 20  |TEQ     r8, r9  |
00005440  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005450  3b 20 48 61 73 20 74 68  65 20 65 6e 64 20 62 65  |; Has the end be|
00005460  65 6e 20 72 65 61 63 68  65 64 0d 0f f0 4c 20 20  |en reached...L  |
00005470  20 20 20 20 20 20 42 4e  45 20 20 20 20 20 73 70  |      BNE     sp|
00005480  72 69 74 65 76 5f 68 61  6e 64 6c 65 72 5f 6c 6f  |ritev_handler_lo|
00005490  6f 70 20 20 20 20 3b 20  54 68 65 72 65 20 69 73  |op    ; There is|
000054a0  20 61 6e 6f 74 68 65 72  20 6e 61 6d 65 20 74 6f  | another name to|
000054b0  20 63 68 65 63 6b 0d 0f  fa 46 20 20 20 20 20 20  | check...F      |
000054c0  20 20 4d 4f 56 20 20 20  20 20 72 32 2c 20 23 30  |  MOV     r2, #0|
000054d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000054e0  20 20 3b 20 4e 6f 20 6d  61 74 63 68 69 6e 67 20  |  ; No matching |
000054f0  70 6f 69 6e 74 65 72 20  6e 61 6d 65 0d 10 04 1c  |pointer name....|
00005500  2e 73 70 72 69 74 65 76  5f 68 61 6e 64 6c 65 72  |.spritev_handler|
00005510  5f 63 68 65 63 6b 65 64  0d 10 0e 46 20 20 20 20  |_checked...F    |
00005520  20 20 20 20 80 20 20 20  20 20 72 38 2c 20 72 33  |    .     r8, r3|
00005530  2c 20 23 26 66 20 20 20  20 20 20 20 20 20 20 20  |, #&f           |
00005540  20 20 3b 20 45 78 74 72  61 63 74 20 74 68 65 20  |  ; Extract the |
00005550  70 6f 69 6e 74 65 72 20  6e 75 6d 62 65 72 0d 10  |pointer number..|
00005560  18 44 20 20 20 20 20 20  20 20 41 44 44 20 20 20  |.D        ADD   |
00005570  20 20 72 38 2c 20 72 38  2c 20 23 77 73 5f 74 79  |  r8, r8, #ws_ty|
00005580  70 65 73 20 20 20 20 20  20 20 3b 20 4f 66 66 73  |pes       ; Offs|
00005590  65 74 20 74 6f 20 74 79  70 65 20 64 65 74 61 69  |et to type detai|
000055a0  6c 73 0d 10 22 44 20 20  20 20 20 20 20 20 53 54  |ls.."D        ST|
000055b0  52 42 20 20 20 20 72 32  2c 20 5b 72 31 32 2c 20  |RB    r2, [r12, |
000055c0  72 38 5d 20 20 20 20 20  20 20 20 20 20 20 3b 20  |r8]           ; |
000055d0  53 74 6f 72 65 20 74 68  65 20 70 6f 69 6e 74 65  |Store the pointe|
000055e0  72 20 74 79 70 65 0d 10  2c 47 20 20 20 20 20 20  |r type..,G      |
000055f0  20 20 54 45 51 20 20 20  20 20 72 32 2c 20 23 30  |  TEQ     r2, #0|
00005600  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005610  20 20 3b 20 57 61 73 20  61 20 70 6f 69 6e 74 65  |  ; Was a pointe|
00005620  72 20 6d 61 74 63 68 20  66 6f 75 6e 64 0d 10 36  |r match found..6|
00005630  4c 20 20 20 20 20 20 20  20 84 52 4e 45 20 20 20  |L        .RNE   |
00005640  72 33 2c 20 72 33 2c 20  23 26 31 30 20 20 20 20  |r3, r3, #&10    |
00005650  20 20 20 20 20 20 20 20  3b 20 43 6c 65 61 72 20  |        ; Clear |
00005660  74 68 65 20 73 68 61 70  65 20 64 65 66 69 6e 69  |the shape defini|
00005670  74 69 6f 6e 20 66 6c 61  67 0d 10 40 19 2e 73 70  |tion flag..@..sp|
00005680  72 69 74 65 76 5f 68 61  6e 64 6c 65 72 5f 64 6f  |ritev_handler_do|
00005690  6e 65 0d 10 4a 4d 20 20  20 20 20 20 20 20 4c 44  |ne..JM        LD|
000056a0  4d 46 44 20 20 20 72 31  33 21 2c 20 7b 72 32 2c  |MFD   r13!, {r2,|
000056b0  20 72 38 2d 72 31 31 2c  20 70 63 7d 5e 20 3b 20  | r8-r11, pc}^ ; |
000056c0  50 61 73 73 20 6f 6e 20  74 6f 20 74 68 65 20 6f  |Pass on to the o|
000056d0  72 69 67 69 6e 61 6c 20  72 6f 75 74 69 6e 65 0d  |riginal routine.|
000056e0  10 54 1a 2e 73 70 72 69  74 65 76 5f 68 61 6e 64  |.T..spritev_hand|
000056f0  6c 65 72 5f 66 6f 75 6e  64 0d 10 5e 44 20 20 20  |ler_found..^D   |
00005700  20 20 20 20 20 4c 44 52  20 20 20 20 20 72 32 2c  |     LDR     r2,|
00005710  20 5b 72 38 2c 20 23 31  32 5d 20 20 20 20 20 20  | [r8, #12]      |
00005720  20 20 20 20 20 3b 20 52  65 61 64 20 74 68 65 20  |     ; Read the |
00005730  70 6f 69 6e 74 65 72 20  69 6e 64 65 78 0d 10 68  |pointer index..h|
00005740  3e 20 20 20 20 20 20 20  20 42 20 20 20 20 20 20  |>        B      |
00005750  20 73 70 72 69 74 65 76  5f 68 61 6e 64 6c 65 72  | spritev_handler|
00005760  5f 63 68 65 63 6b 65 64  20 3b 20 48 61 6e 64 6c  |_checked ; Handl|
00005770  65 20 74 68 65 20 6d 61  74 63 68 0d 10 72 04 0d  |e the match..r..|
00005780  10 7c 21 20 20 20 20 20  20 20 20 3b 20 4b 6e 6f  |.|!        ; Kno|
00005790  77 6e 20 70 6f 69 6e 74  65 72 20 6e 61 6d 65 73  |wn pointer names|
000057a0  0d 10 86 13 2e 70 6f 69  6e 74 65 72 73 5f 73 74  |.....pointers_st|
000057b0  61 72 74 0d 10 90 2f 20  20 20 20 20 20 20 20 a4  |art.../        .|
000057c0  70 6f 69 6e 74 65 72 28  22 70 74 72 5f 64 65 66  |pointer("ptr_def|
000057d0  61 75 6c 74 22 2c 20 70  74 72 5f 73 69 6e 67 6c  |ault", ptr_singl|
000057e0  65 29 0d 10 9a 2e 20 20  20 20 20 20 20 20 a4 70  |e)....        .p|
000057f0  6f 69 6e 74 65 72 28 22  70 74 72 5f 64 6f 75 62  |ointer("ptr_doub|
00005800  6c 65 22 2c 20 70 74 72  5f 64 6f 75 62 6c 65 29  |le", ptr_double)|
00005810  0d 10 a4 2c 20 20 20 20  20 20 20 20 a4 70 6f 69  |...,        .poi|
00005820  6e 74 65 72 28 22 70 74  72 5f 77 72 69 74 65 22  |nter("ptr_write"|
00005830  2c 20 70 74 72 5f 63 61  72 65 74 29 0d 10 ae 2c  |, ptr_caret)...,|
00005840  20 20 20 20 20 20 20 20  a4 70 6f 69 6e 74 65 72  |        .pointer|
00005850  28 22 70 74 72 5f 63 61  72 65 74 22 2c 20 70 74  |("ptr_caret", pt|
00005860  72 5f 63 61 72 65 74 29  0d 10 b8 2c 20 20 20 20  |r_caret)...,    |
00005870  20 20 20 20 a4 70 6f 69  6e 74 65 72 28 22 69 64  |    .pointer("id|
00005880  63 5f 69 62 65 61 6d 22  2c 20 70 74 72 5f 63 61  |c_ibeam", ptr_ca|
00005890  72 65 74 29 0d 10 c2 2a  20 20 20 20 20 20 20 20  |ret)...*        |
000058a0  a4 70 6f 69 6e 74 65 72  28 22 70 74 72 5f 6d 65  |.pointer("ptr_me|
000058b0  6e 75 22 2c 20 70 74 72  5f 6d 65 6e 75 29 0d 10  |nu", ptr_menu)..|
000058c0  cc 11 2e 70 6f 69 6e 74  65 72 73 5f 65 6e 64 0d  |...pointers_end.|
000058d0  10 d6 04 0d 10 e0 23 20  20 20 20 20 20 20 20 3b  |......#        ;|
000058e0  20 57 6f 72 64 56 20 68  61 6e 64 6c 65 72 20 72  | WordV handler r|
000058f0  6f 75 74 69 6e 65 0d 10  ea 12 2e 77 6f 72 64 76  |outine.....wordv|
00005900  5f 68 61 6e 64 6c 65 72  0d 10 f4 54 20 20 20 20  |_handler...T    |
00005910  20 20 20 20 54 45 51 20  20 20 20 20 72 30 2c 20  |    TEQ     r0, |
00005920  23 32 31 20 20 20 20 20  20 20 20 20 20 20 20 20  |#21             |
00005930  20 20 20 20 3b 20 54 68  65 20 72 65 61 73 6f 6e  |    ; The reason|
00005940  20 63 6f 64 65 20 66 6f  72 20 70 6f 69 6e 74 65  | code for pointe|
00005950  72 20 6f 70 65 72 61 74  69 6f 6e 73 0d 10 fe 48  |r operations...H|
00005960  20 20 20 20 20 20 20 20  4d 4f 56 4e 45 53 20 20  |        MOVNES  |
00005970  70 63 2c 20 72 31 34 20  20 20 20 20 20 20 20 20  |pc, r14         |
00005980  20 20 20 20 20 20 20 20  3b 20 50 61 73 73 20 6f  |        ; Pass o|
00005990  6e 20 6f 74 68 65 72 20  72 65 61 73 6f 6e 20 63  |n other reason c|
000059a0  6f 64 65 73 0d 11 08 3d  20 20 20 20 20 20 20 20  |odes...=        |
000059b0  53 54 4d 46 44 20 20 20  72 31 33 21 2c 20 7b 72  |STMFD   r13!, {r|
000059c0  30 2d 72 31 2c 20 72 31  34 7d 20 20 20 20 20 20  |0-r1, r14}      |
000059d0  3b 20 53 74 61 63 6b 20  72 65 67 69 73 74 65 72  |; Stack register|
000059e0  73 0d 11 12 45 20 20 20  20 20 20 20 20 4c 44 52  |s...E        LDR|
000059f0  42 20 20 20 20 72 30 2c  20 5b 72 31 5d 20 20 20  |B    r0, [r1]   |
00005a00  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 47  |             ; G|
00005a10  65 74 20 74 68 65 20 73  75 62 20 72 65 61 73 6f  |et the sub reaso|
00005a20  6e 20 63 6f 64 65 0d 11  1c 4f 20 20 20 20 20 20  |n code...O      |
00005a30  20 20 54 45 51 20 20 20  20 20 72 30 2c 20 23 30  |  TEQ     r0, #0|
00005a40  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005a50  20 20 3b 20 52 65 61 73  6f 6e 20 63 6f 64 65 20  |  ; Reason code |
00005a60  74 6f 20 64 65 66 69 6e  65 20 74 68 65 20 70 6f  |to define the po|
00005a70  69 6e 74 65 72 0d 11 26  52 20 20 20 20 20 20 20  |inter..&R       |
00005a80  20 42 4e 45 20 20 20 20  20 77 6f 72 64 76 5f 68  | BNE     wordv_h|
00005a90  61 6e 64 6c 65 72 5f 64  6f 6e 65 20 20 20 20 20  |andler_done     |
00005aa0  20 3b 20 4e 6f 74 20 69  6e 74 65 72 65 73 74 65  | ; Not intereste|
00005ab0  64 20 69 6e 20 6f 74 68  65 72 20 72 65 61 73 6f  |d in other reaso|
00005ac0  6e 20 63 6f 64 65 73 0d  11 30 44 20 20 20 20 20  |n codes..0D     |
00005ad0  20 20 20 4c 44 52 20 20  20 20 20 72 30 2c 20 5b  |   LDR     r0, [|
00005ae0  72 31 32 2c 20 23 77 73  5f 69 6e 74 65 72 6e 61  |r12, #ws_interna|
00005af0  6c 5d 20 3b 20 52 65 61  64 20 74 68 65 20 69 6e  |l] ; Read the in|
00005b00  74 65 72 6e 61 6c 20 66  6c 61 67 0d 11 3a 49 20  |ternal flag..:I |
00005b10  20 20 20 20 20 20 20 54  45 51 20 20 20 20 20 72  |       TEQ     r|
00005b20  30 2c 20 23 30 20 20 20  20 20 20 20 20 20 20 20  |0, #0           |
00005b30  20 20 20 20 20 20 20 3b  20 49 73 20 69 74 20 61  |       ; Is it a|
00005b40  6e 20 69 6e 74 65 72 6e  61 6c 20 6f 70 65 72 61  |n internal opera|
00005b50  74 69 6f 6e 0d 11 44 48  20 20 20 20 20 20 20 20  |tion..DH        |
00005b60  42 4e 45 20 20 20 20 20  77 6f 72 64 76 5f 68 61  |BNE     wordv_ha|
00005b70  6e 64 6c 65 72 5f 64 6f  6e 65 20 20 20 20 20 20  |ndler_done      |
00005b80  3b 20 53 6b 69 70 20 74  68 65 20 6e 65 78 74 20  |; Skip the next |
00005b90  62 69 74 20 69 66 20 69  74 20 69 73 0d 11 4e 43  |bit if it is..NC|
00005ba0  20 20 20 20 20 20 20 20  4c 44 52 42 20 20 20 20  |        LDRB    |
00005bb0  72 30 2c 20 5b 72 31 2c  20 23 31 5d 20 20 20 20  |r0, [r1, #1]    |
00005bc0  20 20 20 20 20 20 20 20  3b 20 52 65 61 64 20 74  |        ; Read t|
00005bd0  68 65 20 73 68 61 70 65  20 6e 75 6d 62 65 72 0d  |he shape number.|
00005be0  11 58 44 20 20 20 20 20  20 20 20 41 44 44 20 20  |.XD        ADD  |
00005bf0  20 20 20 72 30 2c 20 72  30 2c 20 23 77 73 5f 74  |   r0, r0, #ws_t|
00005c00  79 70 65 73 20 20 20 20  20 20 20 3b 20 4f 66 66  |ypes       ; Off|
00005c10  73 65 74 20 74 6f 20 74  79 70 65 20 64 65 74 61  |set to type deta|
00005c20  69 6c 73 0d 11 62 4e 20  20 20 20 20 20 20 20 4d  |ils..bN        M|
00005c30  4f 56 20 20 20 20 20 72  31 2c 20 23 70 74 72 5f  |OV     r1, #ptr_|
00005c40  75 6e 6b 6e 6f 77 6e 20  20 20 20 20 20 20 20 3b  |unknown        ;|
00005c50  20 43 6f 64 65 20 66 6f  72 20 61 6e 20 75 6e 6b  | Code for an unk|
00005c60  6e 6f 77 6e 20 70 6f 69  6e 74 65 72 20 74 79 70  |nown pointer typ|
00005c70  65 0d 11 6c 4e 20 20 20  20 20 20 20 20 53 54 52  |e..lN        STR|
00005c80  42 20 20 20 20 72 31 2c  20 5b 72 31 32 2c 20 72  |B    r1, [r12, r|
00005c90  30 5d 20 20 20 20 20 20  20 20 20 20 20 3b 20 53  |0]           ; S|
00005ca0  65 74 20 74 68 69 73 20  70 6f 69 6e 74 65 72 20  |et this pointer |
00005cb0  74 79 70 65 20 74 6f 20  75 6e 6b 6e 6f 77 6e 0d  |type to unknown.|
00005cc0  11 76 17 2e 77 6f 72 64  76 5f 68 61 6e 64 6c 65  |.v..wordv_handle|
00005cd0  72 5f 64 6f 6e 65 0d 11  80 3e 20 20 20 20 20 20  |r_done...>      |
00005ce0  20 20 4c 44 4d 46 44 20  20 20 72 31 33 21 2c 20  |  LDMFD   r13!, |
00005cf0  7b 72 30 2d 72 31 2c 20  70 63 7d 5e 20 20 20 20  |{r0-r1, pc}^    |
00005d00  20 20 3b 20 50 61 73 73  20 6f 6e 20 74 68 65 20  |  ; Pass on the |
00005d10  63 61 6c 6c 0d 11 8a 04  0d 11 94 33 20 20 20 20  |call.......3    |
00005d20  20 20 20 20 3b 20 55 70  64 61 74 65 20 74 68 65  |    ; Update the|
00005d30  20 73 68 61 70 65 20 6f  66 20 74 68 65 20 6d 6f  | shape of the mo|
00005d40  75 73 65 20 70 6f 69 6e  74 65 72 0d 11 9e 3d 2e  |use pointer...=.|
00005d50  75 70 64 61 74 65 20 53  54 4d 46 44 20 20 20 72  |update STMFD   r|
00005d60  31 33 21 2c 20 7b 72 30  2d 72 35 2c 20 72 31 34  |13!, {r0-r5, r14|
00005d70  7d 20 20 20 20 20 20 3b  20 53 74 61 63 6b 20 72  |}      ; Stack r|
00005d80  65 67 69 73 74 65 72 73  0d 11 a8 4f 20 20 20 20  |egisters...O    |
00005d90  20 20 20 20 4d 4f 56 20  20 20 20 20 72 30 2c 20  |    MOV     r0, |
00005da0  23 31 30 36 20 20 20 20  20 20 20 20 20 20 20 20  |#106            |
00005db0  20 20 20 20 3b 20 52 65  61 73 6f 6e 20 63 6f 64  |    ; Reason cod|
00005dc0  65 20 74 6f 20 72 65 61  64 20 70 6f 69 6e 74 65  |e to read pointe|
00005dd0  72 20 73 68 61 70 65 0d  11 b2 50 20 20 20 20 20  |r shape...P     |
00005de0  20 20 20 4d 4f 56 20 20  20 20 20 72 31 2c 20 23  |   MOV     r1, #|
00005df0  26 37 66 20 20 20 20 20  20 20 20 20 20 20 20 20  |&7f             |
00005e00  20 20 20 3b 20 49 6e 76  61 6c 69 64 20 73 68 61  |   ; Invalid sha|
00005e10  70 65 20 6e 75 6d 62 65  72 20 74 6f 20 66 6f 72  |pe number to for|
00005e20  63 65 20 72 65 61 64 0d  11 bc 53 20 20 20 20 20  |ce read...S     |
00005e30  20 20 20 53 57 49 20 20  20 20 20 22 58 4f 53 5f  |   SWI     "XOS_|
00005e40  42 79 74 65 22 20 20 20  20 20 20 20 20 20 20 20  |Byte"           |
00005e50  20 20 20 3b 20 52 65 61  64 20 74 68 65 20 63 75  |   ; Read the cu|
00005e60  72 72 65 6e 74 20 70 6f  69 6e 74 65 72 20 73 68  |rrent pointer sh|
00005e70  61 70 65 20 6e 75 6d 62  65 72 0d 11 c6 51 20 20  |ape number...Q  |
00005e80  20 20 20 20 20 20 42 56  53 20 20 20 20 20 75 70  |      BVS     up|
00005e90  64 61 74 65 5f 64 6f 6e  65 20 20 20 20 20 20 20  |date_done       |
00005ea0  20 20 20 20 20 20 3b 20  4e 6f 20 75 70 64 61 74  |      ; No updat|
00005eb0  65 20 70 6f 69 6e 74 65  72 20 69 66 20 65 72 72  |e pointer if err|
00005ec0  6f 72 20 70 72 6f 64 75  63 65 64 0d 11 d0 4b 20  |or produced...K |
00005ed0  20 20 20 20 20 20 20 53  54 52 42 20 20 20 20 72  |       STRB    r|
00005ee0  31 2c 20 5b 72 31 32 2c  20 23 77 73 5f 70 74 72  |1, [r12, #ws_ptr|
00005ef0  5f 62 6c 6f 63 6b 5f 73  68 61 70 65 5d 3b 20 53  |_block_shape]; S|
00005f00  74 6f 72 65 20 74 68 65  20 70 6f 69 6e 74 65 72  |tore the pointer|
00005f10  20 73 68 61 70 65 0d 11  da 43 20 20 20 20 20 20  | shape...C      |
00005f20  20 20 54 53 54 20 20 20  20 20 72 31 2c 20 23 26  |  TST     r1, #&|
00005f30  38 30 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |80              |
00005f40  20 20 3b 20 49 73 20 74  68 65 20 70 6f 69 6e 74  |  ; Is the point|
00005f50  65 72 20 6c 69 6e 6b 65  64 0d 11 e4 3e 20 20 20  |er linked...>   |
00005f60  20 20 20 20 20 42 4e 45  20 20 20 20 20 75 70 64  |     BNE     upd|
00005f70  61 74 65 5f 64 6f 6e 65  20 20 20 20 20 20 20 20  |ate_done        |
00005f80  20 20 20 20 20 3b 20 4e  6f 20 75 70 64 61 74 65  |     ; No update|
00005f90  20 69 66 20 6e 6f 74 0d  11 ee 44 20 20 20 20 20  | if not...D     |
00005fa0  20 20 20 41 44 44 20 20  20 20 20 72 31 2c 20 72  |   ADD     r1, r|
00005fb0  31 2c 20 23 77 73 5f 74  79 70 65 73 20 20 20 20  |1, #ws_types    |
00005fc0  20 20 20 3b 20 4f 66 66  73 65 74 20 74 6f 20 74  |   ; Offset to t|
00005fd0  79 70 65 20 64 65 74 61  69 6c 73 0d 11 f8 53 20  |ype details...S |
00005fe0  20 20 20 20 20 20 20 4c  44 52 42 20 20 20 20 72  |       LDRB    r|
00005ff0  33 2c 20 5b 72 31 32 2c  20 72 31 5d 20 20 20 20  |3, [r12, r1]    |
00006000  20 20 20 20 20 20 20 3b  20 44 69 73 63 6f 76 65  |       ; Discove|
00006010  72 20 74 68 65 20 74 79  70 65 20 6f 66 20 70 6f  |r the type of po|
00006020  69 6e 74 65 72 20 72 65  71 75 69 72 65 64 0d 12  |inter required..|
00006030  02 52 20 20 20 20 20 20  20 20 4d 4f 56 20 20 20  |.R        MOV   |
00006040  20 20 72 30 2c 20 23 32  31 20 20 20 20 20 20 20  |  r0, #21       |
00006050  20 20 20 20 20 20 20 20  20 20 3b 20 52 65 61 73  |          ; Reas|
00006060  6f 6e 20 63 6f 64 65 20  74 6f 20 72 65 61 64 20  |on code to read |
00006070  70 6f 69 6e 74 65 72 20  70 6f 73 69 74 69 6f 6e  |pointer position|
00006080  0d 12 0c 41 20 20 20 20  20 20 20 20 41 44 44 20  |...A        ADD |
00006090  20 20 20 20 72 31 2c 20  72 31 32 2c 20 23 77 73  |    r1, r12, #ws|
000060a0  5f 62 75 66 66 65 72 20  20 20 20 20 3b 20 50 6f  |_buffer     ; Po|
000060b0  69 6e 74 65 72 20 74 6f  20 61 20 62 75 66 66 65  |inter to a buffe|
000060c0  72 0d 12 16 52 20 20 20  20 20 20 20 20 4d 4f 56  |r...R        MOV|
000060d0  20 20 20 20 20 72 32 2c  20 23 36 20 20 20 20 20  |     r2, #6     |
000060e0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 52  |             ; R|
000060f0  65 61 73 6f 6e 20 63 6f  64 65 20 74 6f 20 72 65  |eason code to re|
00006100  61 64 20 70 6f 69 6e 74  65 72 20 70 6f 73 69 74  |ad pointer posit|
00006110  69 6f 6e 0d 12 20 49 20  20 20 20 20 20 20 20 53  |ion.. I        S|
00006120  54 52 42 20 20 20 20 72  32 2c 20 5b 72 31 5d 20  |TRB    r2, [r1] |
00006130  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00006140  20 53 74 6f 72 65 20 72  65 61 73 6f 6e 20 63 6f  | Store reason co|
00006150  64 65 20 69 6e 20 62 75  66 66 65 72 0d 12 2a 43  |de in buffer..*C|
00006160  20 20 20 20 20 20 20 20  53 57 49 20 20 20 20 20  |        SWI     |
00006170  22 58 4f 53 5f 57 6f 72  64 22 20 20 20 20 20 20  |"XOS_Word"      |
00006180  20 20 20 20 20 20 20 20  3b 20 52 65 61 64 20 70  |        ; Read p|
00006190  6f 69 6e 74 65 72 20 70  6f 73 69 74 69 6f 6e 0d  |ointer position.|
000061a0  12 34 51 20 20 20 20 20  20 20 20 42 56 53 20 20  |.4Q        BVS  |
000061b0  20 20 20 75 70 64 61 74  65 5f 64 6f 6e 65 20 20  |   update_done  |
000061c0  20 20 20 20 20 20 20 20  20 20 20 3b 20 4e 6f 20  |           ; No |
000061d0  75 70 64 61 74 65 20 70  6f 69 6e 74 65 72 20 69  |update pointer i|
000061e0  66 20 65 72 72 6f 72 20  70 72 6f 64 75 63 65 64  |f error produced|
000061f0  0d 12 3e 45 20 20 20 20  20 20 20 20 4d 4f 56 20  |..>E        MOV |
00006200  20 20 20 20 72 30 2c 20  72 33 20 20 20 20 20 20  |    r0, r3      |
00006210  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 43 6f  |            ; Co|
00006220  70 79 20 70 6f 69 6e 74  65 72 20 73 68 61 70 65  |py pointer shape|
00006230  20 74 79 70 65 0d 12 48  4d 20 20 20 20 20 20 20  | type..HM       |
00006240  20 4c 44 52 42 20 20 20  20 72 34 2c 20 5b 72 31  | LDRB    r4, [r1|
00006250  2c 20 23 31 5d 20 20 20  20 20 20 20 20 20 20 20  |, #1]           |
00006260  20 3b 20 52 65 61 64 20  4c 53 42 20 6f 66 20 68  | ; Read LSB of h|
00006270  6f 72 69 7a 6f 6e 74 61  6c 20 70 6f 73 69 74 69  |orizontal positi|
00006280  6f 6e 0d 12 52 4d 20 20  20 20 20 20 20 20 4c 44  |on..RM        LD|
00006290  52 42 20 20 20 20 72 35  2c 20 5b 72 31 2c 20 23  |RB    r5, [r1, #|
000062a0  32 5d 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |2]            ; |
000062b0  52 65 61 64 20 4d 53 42  20 6f 66 20 68 6f 72 69  |Read MSB of hori|
000062c0  7a 6f 6e 74 61 6c 20 70  6f 73 69 74 69 6f 6e 0d  |zontal position.|
000062d0  12 5c 48 20 20 20 20 20  20 20 20 84 52 20 20 20  |.\H        .R   |
000062e0  20 20 72 34 2c 20 72 34  2c 20 72 35 2c 20 41 53  |  r4, r4, r5, AS|
000062f0  4c 23 38 20 20 20 20 20  20 20 3b 20 43 6f 6d 62  |L#8       ; Comb|
00006300  69 6e 65 20 68 6f 72 69  7a 6f 6e 74 61 6c 20 70  |ine horizontal p|
00006310  6f 73 69 74 69 6f 6e 0d  12 66 4e 20 20 20 20 20  |osition..fN     |
00006320  20 20 20 4d 4f 56 20 20  20 20 20 72 34 2c 20 72  |   MOV     r4, r|
00006330  34 2c 20 41 53 4c 23 31  36 20 20 20 20 20 20 20  |4, ASL#16       |
00006340  20 20 20 3b 20 53 63 61  6c 65 20 74 68 65 20 68  |   ; Scale the h|
00006350  6f 72 69 7a 6f 6e 74 61  6c 20 70 6f 73 69 74 69  |orizontal positi|
00006360  6f 6e 20 75 70 0d 12 70  4f 20 20 20 20 20 20 20  |on up..pO       |
00006370  20 4c 44 52 20 20 20 20  20 72 35 2c 20 5b 72 31  | LDR     r5, [r1|
00006380  32 2c 20 23 77 73 5f 68  70 6f 73 5d 20 20 20 20  |2, #ws_hpos]    |
00006390  20 3b 20 52 65 61 64 20  70 72 65 76 69 6f 75 73  | ; Read previous|
000063a0  20 68 6f 72 69 7a 6f 6e  74 61 6c 20 70 6f 73 69  | horizontal posi|
000063b0  74 69 6f 6e 0d 12 7a 4b  20 20 20 20 20 20 20 20  |tion..zK        |
000063c0  53 55 42 20 20 20 20 20  72 32 2c 20 72 34 2c 20  |SUB     r2, r4, |
000063d0  72 35 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r5              |
000063e0  3b 20 43 61 6c 63 75 6c  61 74 65 20 68 6f 72 69  |; Calculate hori|
000063f0  7a 6f 6e 74 61 6c 20 6d  6f 76 65 6d 65 6e 74 0d  |zontal movement.|
00006400  12 84 4c 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |..L        MOV  |
00006410  20 20 20 72 32 2c 20 72  32 2c 20 41 53 52 23 31  |   r2, r2, ASR#1|
00006420  20 20 20 20 20 20 20 20  20 20 20 3b 20 52 65 64  |           ; Red|
00006430  75 63 65 20 74 68 65 20  68 6f 72 69 7a 6f 6e 74  |uce the horizont|
00006440  61 6c 20 70 6f 73 69 74  69 6f 6e 0d 12 8e 50 20  |al position...P |
00006450  20 20 20 20 20 20 20 41  44 44 20 20 20 20 20 72  |       ADD     r|
00006460  34 2c 20 72 35 2c 20 72  32 20 20 20 20 20 20 20  |4, r5, r2       |
00006470  20 20 20 20 20 20 20 3b  20 41 6e 64 20 6d 6f 64  |       ; And mod|
00006480  69 66 79 20 74 68 65 20  6c 61 73 74 20 6b 6e 6f  |ify the last kno|
00006490  77 6e 20 70 6f 73 69 74  69 6f 6e 0d 12 98 4b 20  |wn position...K |
000064a0  20 20 20 20 20 20 20 4c  44 52 42 20 20 20 20 72  |       LDRB    r|
000064b0  33 2c 20 5b 72 31 2c 20  23 33 5d 20 20 20 20 20  |3, [r1, #3]     |
000064c0  20 20 20 20 20 20 20 3b  20 52 65 61 64 20 4c 53  |       ; Read LS|
000064d0  42 20 6f 66 20 76 65 72  74 69 63 61 6c 20 70 6f  |B of vertical po|
000064e0  73 69 74 69 6f 6e 0d 12  a2 4b 20 20 20 20 20 20  |sition...K      |
000064f0  20 20 4c 44 52 42 20 20  20 20 72 35 2c 20 5b 72  |  LDRB    r5, [r|
00006500  31 2c 20 23 34 5d 20 20  20 20 20 20 20 20 20 20  |1, #4]          |
00006510  20 20 3b 20 52 65 61 64  20 4d 53 42 20 6f 66 20  |  ; Read MSB of |
00006520  76 65 72 74 69 63 61 6c  20 70 6f 73 69 74 69 6f  |vertical positio|
00006530  6e 0d 12 ac 46 20 20 20  20 20 20 20 20 84 52 20  |n...F        .R |
00006540  20 20 20 20 72 33 2c 20  72 33 2c 20 72 35 2c 20  |    r3, r3, r5, |
00006550  41 53 4c 23 38 20 20 20  20 20 20 20 3b 20 43 6f  |ASL#8       ; Co|
00006560  6d 62 69 6e 65 20 76 65  72 74 69 63 61 6c 20 70  |mbine vertical p|
00006570  6f 73 69 74 69 6f 6e 0d  12 b6 4c 20 20 20 20 20  |osition...L     |
00006580  20 20 20 4d 4f 56 20 20  20 20 20 72 33 2c 20 72  |   MOV     r3, r|
00006590  33 2c 20 41 53 4c 23 31  36 20 20 20 20 20 20 20  |3, ASL#16       |
000065a0  20 20 20 3b 20 53 63 61  6c 65 20 74 68 65 20 76  |   ; Scale the v|
000065b0  65 72 74 69 63 61 6c 20  70 6f 73 69 74 69 6f 6e  |ertical position|
000065c0  20 75 70 0d 12 c0 4d 20  20 20 20 20 20 20 20 4c  | up...M        L|
000065d0  44 52 20 20 20 20 20 72  35 2c 20 5b 72 31 32 2c  |DR     r5, [r12,|
000065e0  20 23 77 73 5f 76 70 6f  73 5d 20 20 20 20 20 3b  | #ws_vpos]     ;|
000065f0  20 52 65 61 64 20 70 72  65 76 69 6f 75 73 20 76  | Read previous v|
00006600  65 72 74 69 63 61 6c 20  70 6f 73 69 74 69 6f 6e  |ertical position|
00006610  0d 12 ca 49 20 20 20 20  20 20 20 20 53 55 42 20  |...I        SUB |
00006620  20 20 20 20 72 31 2c 20  72 35 2c 20 72 33 20 20  |    r1, r5, r3  |
00006630  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 43 61  |            ; Ca|
00006640  6c 63 75 6c 61 74 65 20  76 65 72 74 69 63 61 6c  |lculate vertical|
00006650  20 6d 6f 76 65 6d 65 6e  74 0d 12 d4 4a 20 20 20  | movement...J   |
00006660  20 20 20 20 20 4d 4f 56  20 20 20 20 20 72 31 2c  |     MOV     r1,|
00006670  20 72 31 2c 20 41 53 52  23 31 20 20 20 20 20 20  | r1, ASR#1      |
00006680  20 20 20 20 20 3b 20 52  65 64 75 63 65 20 74 68  |     ; Reduce th|
00006690  65 20 76 65 72 74 69 63  61 6c 20 6d 6f 76 65 6d  |e vertical movem|
000066a0  65 6e 74 0d 12 de 50 20  20 20 20 20 20 20 20 53  |ent...P        S|
000066b0  55 42 20 20 20 20 20 72  33 2c 20 72 35 2c 20 72  |UB     r3, r5, r|
000066c0  31 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |1              ;|
000066d0  20 41 6e 64 20 6d 6f 64  69 66 79 20 74 68 65 20  | And modify the |
000066e0  6c 61 73 74 20 6b 6e 6f  77 6e 20 70 6f 73 69 74  |last known posit|
000066f0  69 6f 6e 0d 12 e8 51 20  20 20 20 20 20 20 20 53  |ion...Q        S|
00006700  54 52 20 20 20 20 20 72  33 2c 20 5b 72 31 32 2c  |TR     r3, [r12,|
00006710  20 23 77 73 5f 76 70 6f  73 5d 20 20 20 20 20 3b  | #ws_vpos]     ;|
00006720  20 53 74 6f 72 65 20 74  68 65 20 75 70 64 61 74  | Store the updat|
00006730  65 64 20 76 65 72 74 69  63 61 6c 20 70 6f 73 69  |ed vertical posi|
00006740  74 69 6f 6e 0d 12 f2 53  20 20 20 20 20 20 20 20  |tion...S        |
00006750  53 54 52 20 20 20 20 20  72 34 2c 20 5b 72 31 32  |STR     r4, [r12|
00006760  2c 20 23 77 73 5f 68 70  6f 73 5d 20 20 20 20 20  |, #ws_hpos]     |
00006770  3b 20 53 74 6f 72 65 20  74 68 65 20 75 70 64 61  |; Store the upda|
00006780  74 65 64 20 68 6f 72 69  7a 6f 6e 74 61 6c 20 70  |ted horizontal p|
00006790  6f 73 69 74 69 6f 6e 0d  12 fc 49 20 20 20 20 20  |osition...I     |
000067a0  20 20 20 4c 44 52 20 20  20 20 20 72 33 2c 20 5b  |   LDR     r3, [|
000067b0  72 31 32 2c 20 23 77 73  5f 63 65 69 67 5d 20 20  |r12, #ws_ceig]  |
000067c0  20 20 20 3b 20 52 65 61  64 20 74 68 65 20 63 6f  |   ; Read the co|
000067d0  6d 6d 6f 6e 20 65 69 67  65 6e 20 76 61 6c 75 65  |mmon eigen value|
000067e0  0d 13 06 41 20 20 20 20  20 20 20 20 4d 4f 56 20  |...A        MOV |
000067f0  20 20 20 20 72 34 2c 20  23 31 20 20 20 20 20 20  |    r4, #1      |
00006800  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 56 61  |            ; Va|
00006810  6c 75 65 20 74 6f 20 62  65 20 73 68 69 66 74 65  |lue to be shifte|
00006820  64 0d 13 10 3d 20 20 20  20 20 20 20 20 4d 4f 56  |d...=        MOV|
00006830  20 20 20 20 20 72 34 2c  20 72 34 2c 20 41 53 4c  |     r4, r4, ASL|
00006840  20 72 33 20 20 20 20 20  20 20 20 20 20 3b 20 54  | r3          ; T|
00006850  68 65 20 65 69 67 65 6e  20 76 61 6c 75 65 0d 13  |he eigen value..|
00006860  1a 50 20 20 20 20 20 20  20 20 41 44 44 20 20 20  |.P        ADD   |
00006870  20 20 72 31 2c 20 72 31  2c 20 72 34 2c 20 41 53  |  r1, r1, r4, AS|
00006880  52 23 31 20 20 20 20 20  20 20 3b 20 49 6d 70 72  |R#1       ; Impr|
00006890  6f 76 65 20 76 65 72 74  69 63 61 6c 20 6d 6f 76  |ove vertical mov|
000068a0  65 6d 65 6e 74 20 72 6f  75 6e 64 69 6e 67 0d 13  |ement rounding..|
000068b0  24 52 20 20 20 20 20 20  20 20 41 44 44 20 20 20  |$R        ADD   |
000068c0  20 20 72 32 2c 20 72 32  2c 20 72 34 2c 20 41 53  |  r2, r2, r4, AS|
000068d0  52 23 31 20 20 20 20 20  20 20 3b 20 49 6d 70 72  |R#1       ; Impr|
000068e0  6f 76 65 20 68 6f 72 69  7a 6f 6e 74 61 6c 20 6d  |ove horizontal m|
000068f0  6f 76 65 6d 65 6e 74 20  72 6f 75 6e 64 69 6e 67  |ovement rounding|
00006900  0d 13 2e 49 20 20 20 20  20 20 20 20 4d 4f 56 20  |...I        MOV |
00006910  20 20 20 20 72 31 2c 20  72 31 2c 20 41 53 52 20  |    r1, r1, ASR |
00006920  72 33 20 20 20 20 20 20  20 20 20 20 3b 20 53 63  |r3          ; Sc|
00006930  61 6c 65 20 74 68 65 20  76 65 72 74 69 63 61 6c  |ale the vertical|
00006940  20 6d 6f 76 65 6d 65 6e  74 0d 13 38 4b 20 20 20  | movement..8K   |
00006950  20 20 20 20 20 4d 4f 56  20 20 20 20 20 72 32 2c  |     MOV     r2,|
00006960  20 72 32 2c 20 41 53 52  20 72 33 20 20 20 20 20  | r2, ASR r3     |
00006970  20 20 20 20 20 3b 20 53  63 61 6c 65 20 74 68 65  |     ; Scale the|
00006980  20 68 6f 72 69 7a 6f 6e  74 61 6c 20 6d 6f 76 65  | horizontal move|
00006990  6d 65 6e 74 0d 13 42 4e  20 20 20 20 20 20 20 20  |ment..BN        |
000069a0  41 44 52 20 20 20 20 20  72 31 34 2c 20 75 70 64  |ADR     r14, upd|
000069b0  61 74 65 5f 70 6c 6f 74  20 20 20 20 20 20 20 20  |ate_plot        |
000069c0  3b 20 52 65 74 75 72 6e  20 61 64 64 72 65 73 73  |; Return address|
000069d0  20 74 6f 20 75 70 64 61  74 65 20 70 6f 69 6e 74  | to update point|
000069e0  65 72 0d 13 4c 4a 20 20  20 20 20 20 20 20 41 44  |er..LJ        AD|
000069f0  44 20 20 20 20 20 70 63  2c 20 70 63 2c 20 72 30  |D     pc, pc, r0|
00006a00  2c 20 4c 53 4c 23 32 20  20 20 20 20 20 20 3b 20  |, LSL#2       ; |
00006a10  4a 75 6d 70 20 74 6f 20  74 68 65 20 72 65 6c 65  |Jump to the rele|
00006a20  76 61 6e 74 20 72 6f 75  74 69 6e 65 0d 13 56 50  |vant routine..VP|
00006a30  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
00006a40  72 30 2c 20 72 30 20 20  20 20 20 20 20 20 20 20  |r0, r0          |
00006a50  20 20 20 20 20 20 20 20  3b 20 54 68 69 73 20 69  |        ; This i|
00006a60  6e 73 74 72 75 63 74 69  6f 6e 20 69 73 20 6e 65  |nstruction is ne|
00006a70  76 65 72 20 65 78 65 63  75 74 65 64 0d 13 60 40  |ver executed..`@|
00006a80  20 20 20 20 20 20 20 20  42 20 20 20 20 20 20 20  |        B       |
00006a90  75 70 64 61 74 65 5f 64  6f 6e 65 20 20 20 20 20  |update_done     |
00006aa0  20 20 20 20 20 20 20 20  3b 20 53 68 61 70 65 20  |        ; Shape |
00006ab0  30 20 69 73 20 75 6e 6b  6e 6f 77 6e 0d 13 6a 49  |0 is unknown..jI|
00006ac0  20 20 20 20 20 20 20 20  42 20 20 20 20 20 20 20  |        B       |
00006ad0  75 70 64 61 74 65 5f 73  69 6e 67 6c 65 20 20 20  |update_single   |
00006ae0  20 20 20 20 20 20 20 20  3b 20 53 68 61 70 65 20  |        ; Shape |
00006af0  31 20 69 73 20 61 20 73  69 6e 67 6c 65 20 70 6f  |1 is a single po|
00006b00  69 6e 74 65 72 0d 13 74  4f 20 20 20 20 20 20 20  |inter..tO       |
00006b10  20 42 20 20 20 20 20 20  20 75 70 64 61 74 65 5f  | B       update_|
00006b20  64 6f 75 62 6c 65 20 20  20 20 20 20 20 20 20 20  |double          |
00006b30  20 3b 20 53 68 61 70 65  20 32 20 69 73 20 61 20  | ; Shape 2 is a |
00006b40  64 6f 75 62 6c 65 20 63  6c 69 63 6b 20 70 6f 69  |double click poi|
00006b50  6e 74 65 72 0d 13 7e 51  20 20 20 20 20 20 20 20  |nter..~Q        |
00006b60  42 20 20 20 20 20 20 20  75 70 64 61 74 65 5f 77  |B       update_w|
00006b70  72 69 74 65 20 20 20 20  20 20 20 20 20 20 20 20  |rite            |
00006b80  3b 20 53 68 61 70 65 20  33 20 69 73 20 61 20 63  |; Shape 3 is a c|
00006b90  61 72 65 74 20 6f 72 20  77 72 69 74 61 62 6c 65  |aret or writable|
00006ba0  20 69 63 6f 6e 0d 13 88  4a 20 20 20 20 20 20 20  | icon...J       |
00006bb0  20 42 20 20 20 20 20 20  20 75 70 64 61 74 65 5f  | B       update_|
00006bc0  6d 65 6e 75 20 20 20 20  20 20 20 20 20 20 20 20  |menu            |
00006bd0  20 3b 20 53 68 61 70 65  20 34 20 69 73 20 61 20  | ; Shape 4 is a |
00006be0  70 6f 70 75 70 20 6d 65  6e 75 20 69 63 6f 6e 0d  |popup menu icon.|
00006bf0  13 92 10 2e 75 70 64 61  74 65 5f 70 6c 6f 74 0d  |....update_plot.|
00006c00  13 9c 4e 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |..N        MOV  |
00006c10  20 20 20 72 30 2c 20 23  32 31 20 20 20 20 20 20  |   r0, #21      |
00006c20  20 20 20 20 20 20 20 20  20 20 20 3b 20 52 65 61  |           ; Rea|
00006c30  73 6f 6e 20 63 6f 64 65  20 74 6f 20 73 65 74 20  |son code to set |
00006c40  70 6f 69 6e 74 65 72 20  73 68 61 70 65 0d 13 a6  |pointer shape...|
00006c50  48 20 20 20 20 20 20 20  20 41 44 44 20 20 20 20  |H        ADD    |
00006c60  20 72 31 2c 20 72 31 32  2c 20 23 77 73 5f 70 74  | r1, r12, #ws_pt|
00006c70  72 5f 62 6c 6f 63 6b 20  20 3b 20 50 6f 69 6e 74  |r_block  ; Point|
00006c80  65 72 20 74 6f 20 70 61  72 61 6d 65 74 65 72 20  |er to parameter |
00006c90  62 6c 6f 63 6b 0d 13 b0  43 20 20 20 20 20 20 20  |block...C       |
00006ca0  20 53 54 52 20 20 20 20  20 72 30 2c 20 5b 72 31  | STR     r0, [r1|
00006cb0  32 2c 20 23 77 73 5f 69  6e 74 65 72 6e 61 6c 5d  |2, #ws_internal]|
00006cc0  20 3b 20 53 65 74 20 74  68 65 20 69 6e 74 65 72  | ; Set the inter|
00006cd0  6e 61 6c 20 66 6c 61 67  0d 13 ba 40 20 20 20 20  |nal flag...@    |
00006ce0  20 20 20 20 53 57 49 20  20 20 20 20 22 58 4f 53  |    SWI     "XOS|
00006cf0  5f 57 6f 72 64 22 20 20  20 20 20 20 20 20 20 20  |_Word"          |
00006d00  20 20 20 20 3b 20 44 65  66 69 6e 65 20 74 68 65  |    ; Define the|
00006d10  20 70 6f 69 6e 74 65 72  0d 13 c4 50 20 20 20 20  | pointer...P    |
00006d20  20 20 20 20 42 56 53 20  20 20 20 20 75 70 64 61  |    BVS     upda|
00006d30  74 65 5f 64 6f 6e 65 20  20 20 20 20 20 20 20 20  |te_done         |
00006d40  20 20 20 20 3b 20 53 6b  69 70 20 74 68 65 20 72  |    ; Skip the r|
00006d50  65 73 74 20 69 6e 20 61  6e 20 65 72 72 6f 72 20  |est in an error |
00006d60  70 72 6f 64 75 63 65 64  0d 13 ce 4b 20 20 20 20  |produced...K    |
00006d70  20 20 20 20 4d 4f 56 20  20 20 20 20 72 30 2c 20  |    MOV     r0, |
00006d80  23 31 30 36 20 20 20 20  20 20 20 20 20 20 20 20  |#106            |
00006d90  20 20 20 20 3b 20 52 65  61 73 6f 6e 20 63 6f 64  |    ; Reason cod|
00006da0  65 20 74 6f 20 73 65 6c  65 63 74 20 70 6f 69 6e  |e to select poin|
00006db0  74 65 72 0d 13 d8 48 20  20 20 20 20 20 20 20 4c  |ter...H        L|
00006dc0  44 52 42 20 20 20 20 72  31 2c 20 5b 72 31 32 2c  |DRB    r1, [r12,|
00006dd0  20 23 77 73 5f 70 74 72  5f 62 6c 6f 63 6b 5f 73  | #ws_ptr_block_s|
00006de0  68 61 70 65 5d 3b 20 47  65 74 20 74 68 65 20 73  |hape]; Get the s|
00006df0  68 61 70 65 20 6e 75 6d  62 65 72 0d 13 e2 41 20  |hape number...A |
00006e00  20 20 20 20 20 20 20 53  57 49 20 20 20 20 20 22  |       SWI     "|
00006e10  58 4f 53 5f 42 79 74 65  22 20 20 20 20 20 20 20  |XOS_Byte"       |
00006e20  20 20 20 20 20 20 20 3b  20 52 65 66 72 65 73 68  |       ; Refresh|
00006e30  20 74 68 65 20 70 6f 69  6e 74 65 72 0d 13 ec 10  | the pointer....|
00006e40  2e 75 70 64 61 74 65 5f  64 6f 6e 65 0d 13 f6 4a  |.update_done...J|
00006e50  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
00006e60  72 30 2c 20 23 30 20 20  20 20 20 20 20 20 20 20  |r0, #0          |
00006e70  20 20 20 20 20 20 20 20  3b 20 56 61 6c 75 65 20  |        ; Value |
00006e80  74 6f 20 63 6c 65 61 72  20 74 68 65 20 66 6c 61  |to clear the fla|
00006e90  67 20 77 69 74 68 0d 14  00 45 20 20 20 20 20 20  |g with...E      |
00006ea0  20 20 53 54 52 20 20 20  20 20 72 30 2c 20 5b 72  |  STR     r0, [r|
00006eb0  31 32 2c 20 23 77 73 5f  69 6e 74 65 72 6e 61 6c  |12, #ws_internal|
00006ec0  5d 20 3b 20 43 6c 65 61  72 20 74 68 65 20 69 6e  |] ; Clear the in|
00006ed0  74 65 72 6e 61 6c 20 66  6c 61 67 0d 14 0a 48 20  |ternal flag...H |
00006ee0  20 20 20 20 20 20 20 4c  44 4d 46 44 20 20 20 72  |       LDMFD   r|
00006ef0  31 33 21 2c 20 7b 72 30  2d 72 35 2c 20 70 63 7d  |13!, {r0-r5, pc}|
00006f00  5e 20 20 20 20 20 20 3b  20 52 65 74 75 72 6e 20  |^      ; Return |
00006f10  66 72 6f 6d 20 74 68 65  20 73 75 62 72 6f 75 74  |from the subrout|
00006f20  69 6e 65 0d 14 14 04 0d  14 1e 4a 20 20 20 20 20  |ine.......J     |
00006f30  20 20 20 3b 20 47 65 6e  65 72 61 74 65 20 61 20  |   ; Generate a |
00006f40  73 74 61 6e 64 61 72 64  20 70 6f 69 6e 74 65 72  |standard pointer|
00006f50  20 73 68 61 70 65 20 74  68 61 74 20 68 61 73 20  | shape that has |
00006f60  6d 6f 76 65 64 20 62 79  20 28 72 32 2c 20 72 31  |moved by (r2, r1|
00006f70  29 0d 14 28 14 2e 75 70  64 61 74 65 5f 73 74 61  |)..(..update_sta|
00006f80  6e 64 61 72 64 0d 14 32  3d 20 20 20 20 20 20 20  |ndard..2=       |
00006f90  20 53 54 4d 46 44 20 20  20 72 31 33 21 2c 20 7b  | STMFD   r13!, {|
00006fa0  72 30 2c 20 72 33 2d 72  38 2c 20 72 31 34 7d 20  |r0, r3-r8, r14} |
00006fb0  20 3b 20 53 74 61 63 6b  20 72 65 67 69 73 74 65  | ; Stack registe|
00006fc0  72 73 0d 14 3c 4e 20 20  20 20 20 20 20 20 4c 44  |rs..<N        LD|
00006fd0  52 20 20 20 20 20 72 35  2c 20 5b 72 31 32 2c 20  |R     r5, [r12, |
00006fe0  23 77 73 5f 63 6f 67 72  5d 20 20 20 20 20 3b 20  |#ws_cogr]     ; |
00006ff0  52 65 61 64 20 70 72 65  76 69 6f 75 73 20 72 6f  |Read previous ro|
00007000  77 20 70 6f 69 6e 74 65  72 20 63 65 6e 74 72 65  |w pointer centre|
00007010  0d 14 46 51 20 20 20 20  20 20 20 20 4c 44 52 20  |..FQ        LDR |
00007020  20 20 20 20 72 36 2c 20  5b 72 31 32 2c 20 23 77  |    r6, [r12, #w|
00007030  73 5f 63 6f 67 63 5d 20  20 20 20 20 3b 20 52 65  |s_cogc]     ; Re|
00007040  61 64 20 70 72 65 76 69  6f 75 73 20 63 6f 6c 75  |ad previous colu|
00007050  6d 6e 20 70 6f 69 6e 74  65 72 20 63 65 6e 74 72  |mn pointer centr|
00007060  65 0d 14 50 4b 20 20 20  20 20 20 20 20 4d 4f 56  |e..PK        MOV|
00007070  20 20 20 20 20 72 37 2c  20 23 30 20 20 20 20 20  |     r7, #0     |
00007080  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 53  |             ; S|
00007090  74 61 72 74 20 62 79 20  61 73 73 75 6d 69 6e 67  |tart by assuming|
000070a0  20 6e 6f 20 6d 6f 76 65  6d 65 6e 74 0d 14 5a 45  | no movement..ZE|
000070b0  20 20 20 20 20 20 20 20  54 45 51 20 20 20 20 20  |        TEQ     |
000070c0  72 31 2c 20 23 30 20 20  20 20 20 20 20 20 20 20  |r1, #0          |
000070d0  20 20 20 20 20 20 20 20  3b 20 49 73 20 74 68 65  |        ; Is the|
000070e0  72 65 20 61 6e 79 20 72  6f 77 20 6d 6f 74 69 6f  |re any row motio|
000070f0  6e 0d 14 64 48 20 20 20  20 20 20 20 20 54 45 51  |n..dH        TEQ|
00007100  45 51 20 20 20 72 32 2c  20 23 30 20 20 20 20 20  |EQ   r2, #0     |
00007110  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 49  |             ; I|
00007120  73 20 74 68 65 72 65 20  61 6e 79 20 63 6f 6c 75  |s there any colu|
00007130  6d 6e 20 6d 6f 74 69 6f  6e 0d 14 6e 4e 20 20 20  |mn motion..nN   |
00007140  20 20 20 20 20 42 45 51  20 20 20 20 20 75 70 64  |     BEQ     upd|
00007150  61 74 65 5f 73 74 61 6e  64 61 72 64 5f 73 74 69  |ate_standard_sti|
00007160  6c 6c 20 20 20 3b 20 44  6f 20 6e 6f 74 20 63 68  |ll   ; Do not ch|
00007170  61 6e 67 65 20 64 69 72  65 63 74 69 6f 6e 20 69  |ange direction i|
00007180  66 20 73 74 69 6c 6c 0d  14 78 4a 20 20 20 20 20  |f still..xJ     |
00007190  20 20 20 41 44 44 20 20  20 20 20 72 35 2c 20 72  |   ADD     r5, r|
000071a0  35 2c 20 72 31 20 20 20  20 20 20 20 20 20 20 20  |5, r1           |
000071b0  20 20 20 3b 20 43 61 6c  63 75 6c 61 74 65 20 74  |   ; Calculate t|
000071c0  68 65 20 6e 65 77 20 72  6f 77 20 6f 66 66 73 65  |he new row offse|
000071d0  74 0d 14 82 4d 20 20 20  20 20 20 20 20 41 44 44  |t...M        ADD|
000071e0  20 20 20 20 20 72 36 2c  20 72 36 2c 20 72 32 20  |     r6, r6, r2 |
000071f0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 43  |             ; C|
00007200  61 6c 63 75 6c 61 74 65  20 74 68 65 20 6e 65 77  |alculate the new|
00007210  20 63 6f 6c 75 6d 6e 20  6f 66 66 73 65 74 0d 14  | column offset..|
00007220  8c 46 20 20 20 20 20 20  20 20 4d 4f 56 20 20 20  |.F        MOV   |
00007230  20 20 72 30 2c 20 72 35  2c 20 41 53 52 23 38 20  |  r0, r5, ASR#8 |
00007240  20 20 20 20 20 20 20 20  20 20 3b 20 53 63 61 6c  |          ; Scal|
00007250  65 20 74 68 65 20 6e 65  77 20 72 6f 77 20 6f 66  |e the new row of|
00007260  66 73 65 74 0d 14 96 47  20 20 20 20 20 20 20 20  |fset...G        |
00007270  4d 55 4c 20 20 20 20 20  72 31 2c 20 72 30 2c 20  |MUL     r1, r0, |
00007280  72 30 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r0              |
00007290  3b 20 53 71 75 61 72 65  20 74 68 65 20 6e 65 77  |; Square the new|
000072a0  20 72 6f 77 20 6f 66 66  73 65 74 0d 14 a0 49 20  | row offset...I |
000072b0  20 20 20 20 20 20 20 4d  4f 56 20 20 20 20 20 72  |       MOV     r|
000072c0  30 2c 20 72 36 2c 20 41  53 52 23 38 20 20 20 20  |0, r6, ASR#8    |
000072d0  20 20 20 20 20 20 20 3b  20 53 63 61 6c 65 20 74  |       ; Scale t|
000072e0  68 65 20 6e 65 77 20 63  6f 6c 75 6d 6e 20 6f 66  |he new column of|
000072f0  66 73 65 74 0d 14 aa 4a  20 20 20 20 20 20 20 20  |fset...J        |
00007300  4d 55 4c 20 20 20 20 20  72 32 2c 20 72 30 2c 20  |MUL     r2, r0, |
00007310  72 30 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r0              |
00007320  3b 20 53 71 75 61 72 65  20 74 68 65 20 6e 65 77  |; Square the new|
00007330  20 63 6f 6c 75 6d 6e 20  6f 66 66 73 65 74 0d 14  | column offset..|
00007340  b4 3d 20 20 20 20 20 20  20 20 41 44 44 20 20 20  |.=        ADD   |
00007350  20 20 72 30 2c 20 72 31  2c 20 72 32 20 20 20 20  |  r0, r1, r2    |
00007360  20 20 20 20 20 20 20 20  20 20 3b 20 53 75 6d 20  |          ; Sum |
00007370  74 68 65 20 73 71 75 61  72 65 73 0d 14 be 4b 20  |the squares...K |
00007380  20 20 20 20 20 20 20 42  4c 20 20 20 20 20 20 73  |       BL      s|
00007390  71 72 74 20 20 20 20 20  20 20 20 20 20 20 20 20  |qrt             |
000073a0  20 20 20 20 20 20 20 3b  20 43 61 6c 63 75 6c 61  |       ; Calcula|
000073b0  74 65 20 74 68 65 20 6e  65 77 20 74 61 69 6c 20  |te the new tail |
000073c0  6c 65 6e 67 74 68 0d 14  c8 4a 20 20 20 20 20 20  |length...J      |
000073d0  20 20 4d 4f 56 20 20 20  20 20 72 30 2c 20 72 30  |  MOV     r0, r0|
000073e0  2c 20 41 53 4c 23 38 20  20 20 20 20 20 20 20 20  |, ASL#8         |
000073f0  20 20 3b 20 53 63 61 6c  65 20 74 68 65 20 6e 65  |  ; Scale the ne|
00007400  77 20 6c 65 6e 67 74 68  20 62 61 63 6b 20 75 70  |w length back up|
00007410  0d 14 d2 49 20 20 20 20  20 20 20 20 53 55 42 20  |...I        SUB |
00007420  20 20 20 20 72 37 2c 20  72 30 2c 20 23 31 31 3c  |    r7, r0, #11<|
00007430  3c 31 36 20 20 20 20 20  20 20 20 20 3b 20 53 75  |<16         ; Su|
00007440  62 74 72 61 63 74 20 74  68 65 20 6e 6f 6d 69 6e  |btract the nomin|
00007450  61 6c 20 6c 65 6e 67 74  68 0d 14 dc 45 20 20 20  |al length...E   |
00007460  20 20 20 20 20 4d 4f 56  20 20 20 20 20 72 30 2c  |     MOV     r0,|
00007470  20 72 35 20 20 20 20 20  20 20 20 20 20 20 20 20  | r5             |
00007480  20 20 20 20 20 3b 20 43  6f 70 79 20 74 68 65 20  |     ; Copy the |
00007490  6e 65 77 20 72 6f 77 20  6f 66 66 73 65 74 0d 14  |new row offset..|
000074a0  e6 48 20 20 20 20 20 20  20 20 4d 4f 56 20 20 20  |.H        MOV   |
000074b0  20 20 72 31 2c 20 72 36  20 20 20 20 20 20 20 20  |  r1, r6        |
000074c0  20 20 20 20 20 20 20 20  20 20 3b 20 43 6f 70 79  |          ; Copy|
000074d0  20 74 68 65 20 6e 65 77  20 63 6f 6c 75 6d 6e 20  | the new column |
000074e0  6f 66 66 73 65 74 0d 14  f0 49 20 20 20 20 20 20  |offset...I      |
000074f0  20 20 42 4c 20 20 20 20  20 20 6e 6f 72 6d 61 6c  |  BL      normal|
00007500  69 73 65 20 20 20 20 20  20 20 20 20 20 20 20 20  |ise             |
00007510  20 20 3b 20 4e 6f 72 6d  61 6c 69 73 65 20 74 68  |  ; Normalise th|
00007520  65 20 6f 66 66 73 65 74  20 6c 65 6e 67 74 68 0d  |e offset length.|
00007530  14 fa 4b 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |..K        MOV  |
00007540  20 20 20 72 32 2c 20 23  31 31 20 20 20 20 20 20  |   r2, #11      |
00007550  20 20 20 20 20 20 20 20  20 20 20 3b 20 54 68 65  |           ; The|
00007560  20 72 65 71 75 69 72 65  64 20 74 61 69 6c 20 6d  | required tail m|
00007570  61 73 73 20 6c 65 6e 67  74 68 0d 15 04 43 20 20  |ass length...C  |
00007580  20 20 20 20 20 20 4d 55  4c 20 20 20 20 20 72 35  |      MUL     r5|
00007590  2c 20 72 32 2c 20 72 30  20 20 20 20 20 20 20 20  |, r2, r0        |
000075a0  20 20 20 20 20 20 3b 20  54 68 65 20 73 63 61 6c  |      ; The scal|
000075b0  65 64 20 72 6f 77 20 6f  66 66 73 65 74 0d 15 0e  |ed row offset...|
000075c0  46 20 20 20 20 20 20 20  20 4d 55 4c 20 20 20 20  |F        MUL    |
000075d0  20 72 36 2c 20 72 32 2c  20 72 31 20 20 20 20 20  | r6, r2, r1     |
000075e0  20 20 20 20 20 20 20 20  20 3b 20 54 68 65 20 73  |         ; The s|
000075f0  63 61 6c 65 64 20 63 6f  6c 75 6d 6e 20 6f 66 66  |caled column off|
00007600  73 65 74 0d 15 18 4a 20  20 20 20 20 20 20 20 53  |set...J        S|
00007610  54 52 20 20 20 20 20 72  35 2c 20 5b 72 31 32 2c  |TR     r5, [r12,|
00007620  20 23 77 73 5f 63 6f 67  72 5d 20 20 20 20 20 3b  | #ws_cogr]     ;|
00007630  20 53 74 6f 72 65 20 74  68 65 20 75 70 64 61 74  | Store the updat|
00007640  65 64 20 72 6f 77 20 63  65 6e 74 72 65 0d 15 22  |ed row centre.."|
00007650  4d 20 20 20 20 20 20 20  20 53 54 52 20 20 20 20  |M        STR    |
00007660  20 72 36 2c 20 5b 72 31  32 2c 20 23 77 73 5f 63  | r6, [r12, #ws_c|
00007670  6f 67 63 5d 20 20 20 20  20 3b 20 53 74 6f 72 65  |ogc]     ; Store|
00007680  20 74 68 65 20 75 70 64  61 74 65 64 20 63 6f 6c  | the updated col|
00007690  75 6d 6e 20 63 65 6e 74  72 65 0d 15 2c 1a 2e 75  |umn centre..,..u|
000076a0  70 64 61 74 65 5f 73 74  61 6e 64 61 72 64 5f 73  |pdate_standard_s|
000076b0  74 69 6c 6c 0d 15 36 4e  20 20 20 20 20 20 20 20  |till..6N        |
000076c0  4d 4f 56 20 20 20 20 20  72 30 2c 20 72 37 2c 20  |MOV     r0, r7, |
000076d0  41 53 52 23 33 20 20 20  20 20 20 20 20 20 20 20  |ASR#3           |
000076e0  3b 20 43 6f 70 79 20 61  6e 64 20 73 63 61 6c 65  |; Copy and scale|
000076f0  20 74 68 65 20 6c 65 6e  67 74 68 20 6f 66 66 73  | the length offs|
00007700  65 74 0d 15 40 47 20 20  20 20 20 20 20 20 42 4c  |et..@G        BL|
00007710  20 20 20 20 20 20 75 70  64 61 74 65 5f 66 69 6c  |      update_fil|
00007720  74 65 72 20 20 20 20 20  20 20 20 20 20 20 3b 20  |ter           ; |
00007730  55 70 64 61 74 65 20 74  68 65 20 70 6f 69 6e 74  |Update the point|
00007740  65 72 20 77 69 62 62 6c  65 0d 15 4a 4d 20 20 20  |er wibble..JM   |
00007750  20 20 20 20 20 41 44 44  20 20 20 20 20 72 30 2c  |     ADD     r0,|
00007760  20 72 30 2c 20 72 30 2c  20 41 53 4c 23 32 20 20  | r0, r0, ASL#2  |
00007770  20 20 20 20 20 3b 20 4d  75 6c 74 69 70 6c 79 20  |     ; Multiply |
00007780  74 68 65 20 6c 65 6e 67  74 68 20 6f 66 66 73 65  |the length offse|
00007790  74 20 62 79 20 35 0d 15  54 45 20 20 20 20 20 20  |t by 5..TE      |
000077a0  20 20 4d 4f 56 20 20 20  20 20 72 37 2c 20 23 31  |  MOV     r7, #1|
000077b0  31 3c 3c 31 36 20 20 20  20 20 20 20 20 20 20 20  |1<<16           |
000077c0  20 20 3b 20 54 68 65 20  6e 6f 6d 69 6e 61 6c 20  |  ; The nominal |
000077d0  74 61 69 6c 20 6c 65 6e  67 74 68 0d 15 5e 4f 20  |tail length..^O |
000077e0  20 20 20 20 20 20 20 41  44 44 20 20 20 20 20 72  |       ADD     r|
000077f0  37 2c 20 72 37 2c 20 72  30 20 20 20 20 20 20 20  |7, r7, r0       |
00007800  20 20 20 20 20 20 20 3b  20 41 64 64 20 74 68 65  |       ; Add the|
00007810  20 77 69 62 62 6c 65 20  74 6f 20 74 68 65 20 74  | wibble to the t|
00007820  61 69 6c 20 6c 65 6e 67  74 68 0d 15 68 54 20 20  |ail length..hT  |
00007830  20 20 20 20 20 20 4d 4f  56 20 20 20 20 20 72 30  |      MOV     r0|
00007840  2c 20 23 37 20 20 20 20  20 20 20 20 20 20 20 20  |, #7            |
00007850  20 20 20 20 20 20 3b 20  4e 75 6d 62 65 72 20 6f  |      ; Number o|
00007860  66 20 63 6f 6f 72 64 69  6e 61 74 65 73 20 69 6e  |f coordinates in|
00007870  20 70 6f 69 6e 74 65 72  20 73 68 61 70 65 0d 15  | pointer shape..|
00007880  72 49 20 20 20 20 20 20  20 20 41 44 52 20 20 20  |rI        ADR   |
00007890  20 20 72 31 2c 20 75 70  64 61 74 65 5f 73 74 61  |  r1, update_sta|
000078a0  6e 64 61 72 64 5f 62 61  73 69 63 3b 20 50 6f 69  |ndard_basic; Poi|
000078b0  6e 74 65 72 20 74 6f 20  74 68 65 20 62 61 73 69  |nter to the basi|
000078c0  63 20 73 68 61 70 65 0d  15 7c 50 20 20 20 20 20  |c shape..|P     |
000078d0  20 20 20 41 44 52 20 20  20 20 20 72 32 2c 20 75  |   ADR     r2, u|
000078e0  70 64 61 74 65 5f 73 74  61 6e 64 61 72 64 5f 6c  |pdate_standard_l|
000078f0  65 6e 67 74 68 3b 20 50  6f 69 6e 74 65 72 20 74  |ength; Pointer t|
00007900  6f 20 74 68 65 20 6c 65  6e 67 74 68 20 61 64 6a  |o the length adj|
00007910  75 73 74 6d 65 6e 74 0d  15 86 4b 20 20 20 20 20  |ustment...K     |
00007920  20 20 20 4d 4f 56 20 20  20 20 20 72 33 2c 20 72  |   MOV     r3, r|
00007930  37 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |7               |
00007940  20 20 20 3b 20 43 6f 70  79 20 74 68 65 20 72 65  |   ; Copy the re|
00007950  71 75 69 72 65 64 20 68  65 61 64 20 6c 65 6e 67  |quired head leng|
00007960  74 68 0d 15 90 4f 20 20  20 20 20 20 20 20 41 44  |th...O        AD|
00007970  44 20 20 20 20 20 72 34  2c 20 72 31 32 2c 20 23  |D     r4, r12, #|
00007980  77 73 5f 62 75 66 66 65  72 20 20 20 20 20 3b 20  |ws_buffer     ; |
00007990  50 6f 69 6e 74 65 72 20  74 6f 20 74 68 65 20 64  |Pointer to the d|
000079a0  65 73 74 69 6e 61 74 69  6f 6e 20 62 75 66 66 65  |estination buffe|
000079b0  72 0d 15 9a 4a 20 20 20  20 20 20 20 20 42 4c 20  |r...J        BL |
000079c0  20 20 20 20 20 74 72 61  6e 73 5f 61 64 64 20 20  |     trans_add  |
000079d0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 53  |             ; S|
000079e0  65 74 20 74 68 65 20 72  65 71 75 69 72 65 64 20  |et the required |
000079f0  68 65 61 64 20 6c 65 6e  67 74 68 0d 15 a4 52 20  |head length...R |
00007a00  20 20 20 20 20 20 20 4d  4f 56 20 20 20 20 20 72  |       MOV     r|
00007a10  31 2c 20 72 34 20 20 20  20 20 20 20 20 20 20 20  |1, r4           |
00007a20  20 20 20 20 20 20 20 3b  20 4e 65 77 20 73 6f 75  |       ; New sou|
00007a30  72 63 65 20 62 75 66 66  65 72 20 69 73 20 70 72  |rce buffer is pr|
00007a40  65 76 69 6f 75 73 20 6f  75 74 70 75 74 0d 15 ae  |evious output...|
00007a50  4e 20 20 20 20 20 20 20  20 41 44 52 20 20 20 20  |N        ADR    |
00007a60  20 72 32 2c 20 75 70 64  61 74 65 5f 73 74 61 6e  | r2, update_stan|
00007a70  64 61 72 64 5f 74 61 69  6c 3b 20 50 6f 69 6e 74  |dard_tail; Point|
00007a80  65 72 20 74 6f 20 74 61  69 6c 20 77 69 64 74 68  |er to tail width|
00007a90  20 61 64 6a 75 73 74 6d  65 6e 74 0d 15 b8 3d 20  | adjustment...= |
00007aa0  20 20 20 20 20 20 20 53  54 4d 46 44 20 20 20 72  |       STMFD   r|
00007ab0  31 33 21 2c 20 7b 72 30  2d 72 31 7d 20 20 20 20  |13!, {r0-r1}    |
00007ac0  20 20 20 20 20 20 20 3b  20 53 74 61 63 6b 20 72  |       ; Stack r|
00007ad0  65 67 69 73 74 65 72 73  0d 15 c2 4a 20 20 20 20  |egisters...J    |
00007ae0  20 20 20 20 4d 4f 56 20  20 20 20 20 72 30 2c 20  |    MOV     r0, |
00007af0  23 31 30 30 3c 3c 31 36  20 20 20 20 20 20 20 20  |#100<<16        |
00007b00  20 20 20 20 3b 20 41 72  65 61 20 74 6f 20 64 69  |    ; Area to di|
00007b10  76 69 64 65 20 62 79 20  74 68 65 20 6c 65 6e 67  |vide by the leng|
00007b20  74 68 0d 15 cc 43 20 20  20 20 20 20 20 20 4d 4f  |th...C        MO|
00007b30  56 20 20 20 20 20 72 31  2c 20 72 37 2c 20 41 53  |V     r1, r7, AS|
00007b40  52 23 31 36 20 20 20 20  20 20 20 20 20 20 3b 20  |R#16          ; |
00007b50  53 63 61 6c 65 20 74 68  65 20 74 61 69 6c 20 6c  |Scale the tail l|
00007b60  65 6e 67 74 68 0d 15 d6  47 20 20 20 20 20 20 20  |ength...G       |
00007b70  20 52 53 42 20 20 20 20  20 72 31 2c 20 72 31 2c  | RSB     r1, r1,|
00007b80  20 23 32 31 20 20 20 20  20 20 20 20 20 20 20 20  | #21            |
00007b90  20 3b 20 43 61 6c 63 75  6c 61 74 65 20 74 68 65  | ; Calculate the|
00007ba0  20 74 61 69 6c 20 6c 65  6e 67 74 68 0d 15 e0 4d  | tail length...M|
00007bb0  20 20 20 20 20 20 20 20  42 4c 20 20 20 20 20 20  |        BL      |
00007bc0  64 69 76 69 64 65 20 20  20 20 20 20 20 20 20 20  |divide          |
00007bd0  20 20 20 20 20 20 20 20  3b 20 43 61 6c 63 75 6c  |        ; Calcul|
00007be0  61 74 65 20 74 68 65 20  74 61 69 6c 20 77 69 64  |ate the tail wid|
00007bf0  74 68 20 6f 66 66 73 65  74 0d 15 ea 48 20 20 20  |th offset...H   |
00007c00  20 20 20 20 20 4d 4f 56  20 20 20 20 20 72 33 2c  |     MOV     r3,|
00007c10  20 72 30 20 20 20 20 20  20 20 20 20 20 20 20 20  | r0             |
00007c20  20 20 20 20 20 3b 20 43  6f 70 79 20 74 68 65 20  |     ; Copy the |
00007c30  74 61 69 6c 20 77 69 64  74 68 20 6f 66 66 73 65  |tail width offse|
00007c40  74 0d 15 f4 3f 20 20 20  20 20 20 20 20 4c 44 4d  |t...?        LDM|
00007c50  46 44 20 20 20 72 31 33  21 2c 20 7b 72 30 2d 72  |FD   r13!, {r0-r|
00007c60  31 7d 20 20 20 20 20 20  20 20 20 20 20 3b 20 52  |1}           ; R|
00007c70  65 73 74 6f 72 65 20 72  65 67 69 73 74 65 72 73  |estore registers|
00007c80  0d 15 fe 4c 20 20 20 20  20 20 20 20 42 4c 20 20  |...L        BL  |
00007c90  20 20 20 20 74 72 61 6e  73 5f 61 64 64 20 20 20  |    trans_add   |
00007ca0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 53 65  |            ; Se|
00007cb0  74 20 74 68 65 20 77 69  64 74 68 20 6f 66 20 74  |t the width of t|
00007cc0  68 65 20 74 61 69 6c 20  62 61 73 65 0d 16 08 4e  |he tail base...N|
00007cd0  20 20 20 20 20 20 20 20  41 44 52 20 20 20 20 20  |        ADR     |
00007ce0  72 32 2c 20 75 70 64 61  74 65 5f 73 74 61 6e 64  |r2, update_stand|
00007cf0  61 72 64 5f 68 65 61 64  3b 20 50 6f 69 6e 74 65  |ard_head; Pointe|
00007d00  72 20 74 6f 20 68 65 61  64 20 77 69 64 74 68 20  |r to head width |
00007d10  61 64 6a 75 73 74 6d 65  6e 74 0d 16 12 3d 20 20  |adjustment...=  |
00007d20  20 20 20 20 20 20 53 54  4d 46 44 20 20 20 72 31  |      STMFD   r1|
00007d30  33 21 2c 20 7b 72 30 2d  72 31 7d 20 20 20 20 20  |3!, {r0-r1}     |
00007d40  20 20 20 20 20 20 3b 20  53 74 61 63 6b 20 72 65  |      ; Stack re|
00007d50  67 69 73 74 65 72 73 0d  16 1c 4a 20 20 20 20 20  |gisters...J     |
00007d60  20 20 20 4d 4f 56 20 20  20 20 20 72 30 2c 20 23  |   MOV     r0, #|
00007d70  31 33 32 3c 3c 31 36 20  20 20 20 20 20 20 20 20  |132<<16         |
00007d80  20 20 20 3b 20 41 72 65  61 20 74 6f 20 64 69 76  |   ; Area to div|
00007d90  69 64 65 20 62 79 20 74  68 65 20 6c 65 6e 67 74  |ide by the lengt|
00007da0  68 0d 16 26 43 20 20 20  20 20 20 20 20 4d 4f 56  |h..&C        MOV|
00007db0  20 20 20 20 20 72 31 2c  20 72 37 2c 20 41 53 52  |     r1, r7, ASR|
00007dc0  23 31 36 20 20 20 20 20  20 20 20 20 20 3b 20 53  |#16          ; S|
00007dd0  63 61 6c 65 20 74 68 65  20 74 61 69 6c 20 6c 65  |cale the tail le|
00007de0  6e 67 74 68 0d 16 30 4d  20 20 20 20 20 20 20 20  |ngth..0M        |
00007df0  42 4c 20 20 20 20 20 20  64 69 76 69 64 65 20 20  |BL      divide  |
00007e00  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00007e10  3b 20 43 61 6c 63 75 6c  61 74 65 20 74 68 65 20  |; Calculate the |
00007e20  68 65 61 64 20 77 69 64  74 68 20 6f 66 66 73 65  |head width offse|
00007e30  74 0d 16 3a 48 20 20 20  20 20 20 20 20 4d 4f 56  |t..:H        MOV|
00007e40  20 20 20 20 20 72 33 2c  20 72 30 20 20 20 20 20  |     r3, r0     |
00007e50  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 43  |             ; C|
00007e60  6f 70 79 20 74 68 65 20  68 65 61 64 20 77 69 64  |opy the head wid|
00007e70  74 68 20 6f 66 66 73 65  74 0d 16 44 3f 20 20 20  |th offset..D?   |
00007e80  20 20 20 20 20 4c 44 4d  46 44 20 20 20 72 31 33  |     LDMFD   r13|
00007e90  21 2c 20 7b 72 30 2d 72  31 7d 20 20 20 20 20 20  |!, {r0-r1}      |
00007ea0  20 20 20 20 20 3b 20 52  65 73 74 6f 72 65 20 72  |     ; Restore r|
00007eb0  65 67 69 73 74 65 72 73  0d 16 4e 4e 20 20 20 20  |egisters..NN    |
00007ec0  20 20 20 20 42 4c 20 20  20 20 20 20 74 72 61 6e  |    BL      tran|
00007ed0  73 5f 61 64 64 20 20 20  20 20 20 20 20 20 20 20  |s_add           |
00007ee0  20 20 20 20 3b 20 53 65  74 20 74 68 65 20 77 69  |    ; Set the wi|
00007ef0  64 74 68 20 6f 66 20 74  68 65 20 68 65 61 64 65  |dth of the heade|
00007f00  72 20 62 61 73 65 0d 16  58 52 20 20 20 20 20 20  |r base..XR      |
00007f10  20 20 4d 4f 56 20 20 20  20 20 72 32 2c 20 72 31  |  MOV     r2, r1|
00007f20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00007f30  20 20 3b 20 44 65 73 74  69 6e 61 74 69 6f 6e 20  |  ; Destination |
00007f40  63 6f 6f 72 64 69 6e 61  74 65 73 20 61 72 65 20  |coordinates are |
00007f50  74 68 65 20 73 61 6d 65  0d 16 62 4f 20 20 20 20  |the same..bO    |
00007f60  20 20 20 20 4d 4f 56 20  20 20 20 20 72 33 2c 20  |    MOV     r3, |
00007f70  72 35 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r5              |
00007f80  20 20 20 20 3b 20 52 6f  77 20 63 6f 6d 70 6f 6e  |    ; Row compon|
00007f90  65 6e 74 20 6f 66 20 64  65 73 69 72 65 64 20 76  |ent of desired v|
00007fa0  65 72 74 69 63 61 6c 0d  16 6c 52 20 20 20 20 20  |ertical..lR     |
00007fb0  20 20 20 4d 4f 56 20 20  20 20 20 72 34 2c 20 72  |   MOV     r4, r|
00007fc0  36 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |6               |
00007fd0  20 20 20 3b 20 43 6f 6c  75 6d 6e 20 63 6f 6d 70  |   ; Column comp|
00007fe0  6f 6e 65 6e 74 20 6f 66  20 64 65 73 69 72 65 64  |onent of desired|
00007ff0  20 76 65 72 74 69 63 61  6c 0d 16 76 4c 20 20 20  | vertical..vL   |
00008000  20 20 20 20 20 42 4c 20  20 20 20 20 20 74 72 61  |     BL      tra|
00008010  6e 73 5f 72 6f 74 61 74  65 20 20 20 20 20 20 20  |ns_rotate       |
00008020  20 20 20 20 20 3b 20 52  6f 74 61 74 65 20 74 68  |     ; Rotate th|
00008030  65 20 70 6f 69 6e 74 65  72 20 61 73 20 72 65 71  |e pointer as req|
00008040  75 69 72 65 64 0d 16 80  53 20 20 20 20 20 20 20  |uired...S       |
00008050  20 42 4c 20 20 20 20 20  20 74 72 61 6e 73 5f 66  | BL      trans_f|
00008060  69 74 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |it              |
00008070  20 3b 20 53 63 61 6c 65  20 74 68 65 20 63 6f 6f  | ; Scale the coo|
00008080  72 64 69 6e 61 74 65 73  20 66 6f 72 20 74 68 65  |rdinates for the|
00008090  20 70 6f 69 6e 74 65 72  0d 16 8a 47 20 20 20 20  | pointer...G    |
000080a0  20 20 20 20 4d 4f 56 20  20 20 20 20 72 31 2c 20  |    MOV     r1, |
000080b0  72 30 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r0              |
000080c0  20 20 20 20 3b 20 43 6f  70 79 20 74 68 65 20 6e  |    ; Copy the n|
000080d0  75 6d 62 65 72 20 6f 66  20 70 6f 69 6e 74 73 0d  |umber of points.|
000080e0  16 94 44 20 20 20 20 20  20 20 20 4c 44 4d 46 44  |..D        LDMFD|
000080f0  20 20 20 72 31 33 21 2c  20 7b 72 30 2c 20 72 33  |   r13!, {r0, r3|
00008100  2d 72 38 2c 20 70 63 7d  20 20 20 3b 20 52 65 74  |-r8, pc}   ; Ret|
00008110  75 72 6e 20 66 72 6f 6d  20 73 75 62 72 6f 75 74  |urn from subrout|
00008120  69 6e 65 0d 16 9e 45 2e  75 70 64 61 74 65 5f 73  |ine...E.update_s|
00008130  74 61 6e 64 61 72 64 5f  62 61 73 69 63 20 20 20  |tandard_basic   |
00008140  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00008150  20 54 68 65 20 62 61 73  69 63 20 70 6f 69 6e 74  | The basic point|
00008160  65 72 20 73 68 61 70 65  0d 16 a8 1d 20 20 20 20  |er shape....    |
00008170  20 20 20 20 a4 63 6f 6f  72 64 69 6e 61 74 65 28  |    .coordinate(|
00008180  30 2c 20 30 29 0d 16 b2  1d 20 20 20 20 20 20 20  |0, 0)....       |
00008190  20 a4 63 6f 6f 72 64 69  6e 61 74 65 28 30 2c 20  | .coordinate(0, |
000081a0  30 29 0d 16 bc 1d 20 20  20 20 20 20 20 20 a4 63  |0)....        .c|
000081b0  6f 6f 72 64 69 6e 61 74  65 28 30 2c 20 32 29 0d  |oordinate(0, 2).|
000081c0  16 c6 1f 20 20 20 20 20  20 20 20 a4 63 6f 6f 72  |...        .coor|
000081d0  64 69 6e 61 74 65 28 32  31 2c 20 2d 32 29 0d 16  |dinate(21, -2)..|
000081e0  d0 1e 20 20 20 20 20 20  20 20 a4 63 6f 6f 72 64  |..        .coord|
000081f0  69 6e 61 74 65 28 32 31  2c 20 32 29 0d 16 da 1e  |inate(21, 2)....|
00008200  20 20 20 20 20 20 20 20  a4 63 6f 6f 72 64 69 6e  |        .coordin|
00008210  61 74 65 28 30 2c 20 2d  32 29 0d 16 e4 1d 20 20  |ate(0, -2)....  |
00008220  20 20 20 20 20 20 a4 63  6f 6f 72 64 69 6e 61 74  |      .coordinat|
00008230  65 28 30 2c 20 30 29 0d  16 ee 4f 2e 75 70 64 61  |e(0, 0)...O.upda|
00008240  74 65 5f 73 74 61 6e 64  61 72 64 5f 6c 65 6e 67  |te_standard_leng|
00008250  74 68 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |th              |
00008260  20 20 20 3b 20 4f 66 66  73 65 74 73 20 74 6f 20  |   ; Offsets to |
00008270  63 68 61 6e 67 65 20 74  68 65 20 68 65 61 64 20  |change the head |
00008280  6c 65 6e 67 74 68 0d 16  f8 1d 20 20 20 20 20 20  |length....      |
00008290  20 20 a4 63 6f 6f 72 64  69 6e 61 74 65 28 30 2c  |  .coordinate(0,|
000082a0  20 30 29 0d 17 02 1d 20  20 20 20 20 20 20 20 a4  | 0)....        .|
000082b0  63 6f 6f 72 64 69 6e 61  74 65 28 31 2c 20 30 29  |coordinate(1, 0)|
000082c0  0d 17 0c 1d 20 20 20 20  20 20 20 20 a4 63 6f 6f  |....        .coo|
000082d0  72 64 69 6e 61 74 65 28  31 2c 20 30 29 0d 17 16  |rdinate(1, 0)...|
000082e0  1d 20 20 20 20 20 20 20  20 a4 63 6f 6f 72 64 69  |.        .coordi|
000082f0  6e 61 74 65 28 30 2c 20  30 29 0d 17 20 1d 20 20  |nate(0, 0).. .  |
00008300  20 20 20 20 20 20 a4 63  6f 6f 72 64 69 6e 61 74  |      .coordinat|
00008310  65 28 30 2c 20 30 29 0d  17 2a 1d 20 20 20 20 20  |e(0, 0)..*.     |
00008320  20 20 20 a4 63 6f 6f 72  64 69 6e 61 74 65 28 31  |   .coordinate(1|
00008330  2c 20 30 29 0d 17 34 1d  20 20 20 20 20 20 20 20  |, 0)..4.        |
00008340  a4 63 6f 6f 72 64 69 6e  61 74 65 28 31 2c 20 30  |.coordinate(1, 0|
00008350  29 0d 17 3e 4e 2e 75 70  64 61 74 65 5f 73 74 61  |)..>N.update_sta|
00008360  6e 64 61 72 64 5f 74 61  69 6c 20 20 20 20 20 20  |ndard_tail      |
00008370  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 4f  |             ; O|
00008380  66 66 73 65 74 73 20 74  6f 20 63 68 61 6e 67 65  |ffsets to change|
00008390  20 74 68 65 20 74 61 69  6c 20 77 69 64 74 68 0d  | the tail width.|
000083a0  17 48 1d 20 20 20 20 20  20 20 20 a4 63 6f 6f 72  |.H.        .coor|
000083b0  64 69 6e 61 74 65 28 30  2c 20 30 29 0d 17 52 1d  |dinate(0, 0)..R.|
000083c0  20 20 20 20 20 20 20 20  a4 63 6f 6f 72 64 69 6e  |        .coordin|
000083d0  61 74 65 28 30 2c 20 30  29 0d 17 5c 1d 20 20 20  |ate(0, 0)..\.   |
000083e0  20 20 20 20 20 a4 63 6f  6f 72 64 69 6e 61 74 65  |     .coordinate|
000083f0  28 30 2c 20 30 29 0d 17  66 1f 20 20 20 20 20 20  |(0, 0)..f.      |
00008400  20 20 a4 63 6f 6f 72 64  69 6e 61 74 65 28 30 2c  |  .coordinate(0,|
00008410  20 30 2e 35 29 0d 17 70  20 20 20 20 20 20 20 20  | 0.5)..p        |
00008420  20 a4 63 6f 6f 72 64 69  6e 61 74 65 28 30 2c 20  | .coordinate(0, |
00008430  2d 30 2e 35 29 0d 17 7a  1d 20 20 20 20 20 20 20  |-0.5)..z.       |
00008440  20 a4 63 6f 6f 72 64 69  6e 61 74 65 28 30 2c 20  | .coordinate(0, |
00008450  30 29 0d 17 84 1d 20 20  20 20 20 20 20 20 a4 63  |0)....        .c|
00008460  6f 6f 72 64 69 6e 61 74  65 28 30 2c 20 30 29 0d  |oordinate(0, 0).|
00008470  17 8e 4e 2e 75 70 64 61  74 65 5f 73 74 61 6e 64  |..N.update_stand|
00008480  61 72 64 5f 68 65 61 64  20 20 20 20 20 20 20 20  |ard_head        |
00008490  20 20 20 20 20 20 20 20  20 20 20 3b 20 4f 66 66  |           ; Off|
000084a0  73 65 74 73 20 74 6f 20  63 68 61 6e 67 65 20 74  |sets to change t|
000084b0  68 65 20 68 65 61 64 20  77 69 64 74 68 0d 17 98  |he head width...|
000084c0  1d 20 20 20 20 20 20 20  20 a4 63 6f 6f 72 64 69  |.        .coordi|
000084d0  6e 61 74 65 28 30 2c 20  30 29 0d 17 a2 1f 20 20  |nate(0, 0)....  |
000084e0  20 20 20 20 20 20 a4 63  6f 6f 72 64 69 6e 61 74  |      .coordinat|
000084f0  65 28 30 2c 20 30 2e 35  29 0d 17 ac 1d 20 20 20  |e(0, 0.5)....   |
00008500  20 20 20 20 20 a4 63 6f  6f 72 64 69 6e 61 74 65  |     .coordinate|
00008510  28 30 2c 20 30 29 0d 17  b6 1d 20 20 20 20 20 20  |(0, 0)....      |
00008520  20 20 a4 63 6f 6f 72 64  69 6e 61 74 65 28 30 2c  |  .coordinate(0,|
00008530  20 30 29 0d 17 c0 1d 20  20 20 20 20 20 20 20 a4  | 0)....        .|
00008540  63 6f 6f 72 64 69 6e 61  74 65 28 30 2c 20 30 29  |coordinate(0, 0)|
00008550  0d 17 ca 1d 20 20 20 20  20 20 20 20 a4 63 6f 6f  |....        .coo|
00008560  72 64 69 6e 61 74 65 28  30 2c 20 30 29 0d 17 d4  |rdinate(0, 0)...|
00008570  20 20 20 20 20 20 20 20  20 a4 63 6f 6f 72 64 69  |         .coordi|
00008580  6e 61 74 65 28 30 2c 20  2d 30 2e 35 29 0d 17 de  |nate(0, -0.5)...|
00008590  04 0d 17 e8 46 20 20 20  20 20 20 20 20 3b 20 50  |....F        ; P|
000085a0  6c 6f 74 20 61 20 73 69  6e 67 6c 65 20 70 6f 69  |lot a single poi|
000085b0  6e 74 65 72 20 74 79 70  65 20 72 30 20 74 68 61  |nter type r0 tha|
000085c0  74 20 68 61 73 20 6d 6f  76 65 64 20 62 79 20 28  |t has moved by (|
000085d0  72 32 2c 20 72 31 29 0d  17 f2 12 2e 75 70 64 61  |r2, r1).....upda|
000085e0  74 65 5f 73 69 6e 67 6c  65 0d 17 fc 3d 20 20 20  |te_single...=   |
000085f0  20 20 20 20 20 53 54 4d  46 44 20 20 20 72 31 33  |     STMFD   r13|
00008600  21 2c 20 7b 72 30 2d 72  32 2c 20 72 31 34 7d 20  |!, {r0-r2, r14} |
00008610  20 20 20 20 20 3b 20 53  74 61 63 6b 20 72 65 67  |     ; Stack reg|
00008620  69 73 74 65 72 73 0d 18  06 49 20 20 20 20 20 20  |isters...I      |
00008630  20 20 42 4c 20 20 20 20  20 20 75 70 64 61 74 65  |  BL      update|
00008640  5f 73 74 61 6e 64 61 72  64 20 20 20 20 20 20 20  |_standard       |
00008650  20 20 3b 20 43 6f 6e 73  74 72 75 63 74 20 74 68  |  ; Construct th|
00008660  65 20 70 6f 69 6e 74 65  72 20 73 68 61 70 65 0d  |e pointer shape.|
00008670  18 10 47 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |..G        MOV  |
00008680  20 20 20 72 30 2c 20 23  63 6f 6c 6f 75 72 5f 74  |   r0, #colour_t|
00008690  72 61 6e 73 20 20 20 20  20 20 20 3b 20 42 61 63  |rans       ; Bac|
000086a0  6b 67 72 6f 75 6e 64 20  69 73 20 74 72 61 6e 73  |kground is trans|
000086b0  70 61 72 65 6e 74 0d 18  1a 49 20 20 20 20 20 20  |parent...I      |
000086c0  20 20 42 4c 20 20 20 20  20 20 70 6c 6f 74 5f 66  |  BL      plot_f|
000086d0  69 6c 6c 20 20 20 20 20  20 20 20 20 20 20 20 20  |ill             |
000086e0  20 20 3b 20 43 6c 65 61  72 20 74 68 65 20 70 6f  |  ; Clear the po|
000086f0  69 6e 74 65 72 20 69 6e  69 74 69 61 6c 6c 79 0d  |inter initially.|
00008700  18 24 4f 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |.$O        MOV  |
00008710  20 20 20 72 30 2c 20 23  63 6f 6c 6f 75 72 5f 62  |   r0, #colour_b|
00008720  6c 75 65 20 20 20 20 20  20 20 20 3b 20 46 69 6c  |lue        ; Fil|
00008730  6c 20 74 68 65 20 69 6e  74 65 72 69 6f 72 20 77  |l the interior w|
00008740  69 74 68 20 73 6f 6c 69  64 20 62 6c 75 65 0d 18  |ith solid blue..|
00008750  2e 46 20 20 20 20 20 20  20 20 42 4c 20 20 20 20  |.F        BL    |
00008760  20 20 70 6c 6f 74 5f 70  6f 6c 79 5f 66 69 6c 6c  |  plot_poly_fill|
00008770  20 20 20 20 20 20 20 20  20 20 3b 20 50 6c 6f 74  |          ; Plot|
00008780  20 74 68 65 20 66 69 6c  6c 65 64 20 69 6e 74 65  | the filled inte|
00008790  72 69 6f 72 0d 18 38 49  20 20 20 20 20 20 20 20  |rior..8I        |
000087a0  4d 4f 56 20 20 20 20 20  72 30 2c 20 23 63 6f 6c  |MOV     r0, #col|
000087b0  6f 75 72 5f 63 79 61 6e  20 20 20 20 20 20 20 20  |our_cyan        |
000087c0  3b 20 4f 75 74 6c 69 6e  65 20 74 68 65 20 70 6f  |; Outline the po|
000087d0  69 6e 74 65 72 20 69 6e  20 63 79 61 6e 0d 18 42  |inter in cyan..B|
000087e0  46 20 20 20 20 20 20 20  20 42 4c 20 20 20 20 20  |F        BL     |
000087f0  20 70 6c 6f 74 5f 70 6f  6c 79 5f 6c 69 6e 65 20  | plot_poly_line |
00008800  20 20 20 20 20 20 20 20  20 3b 20 50 6c 6f 74 20  |         ; Plot |
00008810  74 68 65 20 70 6f 69 6e  74 65 72 20 6f 75 74 6c  |the pointer outl|
00008820  69 6e 65 0d 18 4c 44 20  20 20 20 20 20 20 20 4c  |ine..LD        L|
00008830  44 4d 46 44 20 20 20 72  31 33 21 2c 20 7b 72 30  |DMFD   r13!, {r0|
00008840  2d 72 32 2c 20 70 63 7d  20 20 20 20 20 20 20 3b  |-r2, pc}       ;|
00008850  20 52 65 74 75 72 6e 20  66 72 6f 6d 20 73 75 62  | Return from sub|
00008860  72 6f 75 74 69 6e 65 0d  18 56 04 0d 18 60 4c 20  |routine..V...`L |
00008870  20 20 20 20 20 20 20 3b  20 50 6c 6f 74 20 61 20  |       ; Plot a |
00008880  64 6f 75 62 6c 65 20 63  6c 69 63 6b 20 70 6f 69  |double click poi|
00008890  6e 74 65 72 20 74 79 70  65 20 72 30 20 74 68 61  |nter type r0 tha|
000088a0  74 20 68 61 73 20 6d 6f  76 65 64 20 62 79 20 28  |t has moved by (|
000088b0  72 32 2c 20 72 31 29 0d  18 6a 12 2e 75 70 64 61  |r2, r1)..j..upda|
000088c0  74 65 5f 64 6f 75 62 6c  65 0d 18 74 3d 20 20 20  |te_double..t=   |
000088d0  20 20 20 20 20 53 54 4d  46 44 20 20 20 72 31 33  |     STMFD   r13|
000088e0  21 2c 20 7b 72 30 2d 72  32 2c 20 72 31 34 7d 20  |!, {r0-r2, r14} |
000088f0  20 20 20 20 20 3b 20 53  74 61 63 6b 20 72 65 67  |     ; Stack reg|
00008900  69 73 74 65 72 73 0d 18  7e 49 20 20 20 20 20 20  |isters..~I      |
00008910  20 20 42 4c 20 20 20 20  20 20 75 70 64 61 74 65  |  BL      update|
00008920  5f 73 74 61 6e 64 61 72  64 20 20 20 20 20 20 20  |_standard       |
00008930  20 20 3b 20 43 6f 6e 73  74 72 75 63 74 20 74 68  |  ; Construct th|
00008940  65 20 70 6f 69 6e 74 65  72 20 73 68 61 70 65 0d  |e pointer shape.|
00008950  18 88 47 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |..G        MOV  |
00008960  20 20 20 72 30 2c 20 23  63 6f 6c 6f 75 72 5f 74  |   r0, #colour_t|
00008970  72 61 6e 73 20 20 20 20  20 20 20 3b 20 42 61 63  |rans       ; Bac|
00008980  6b 67 72 6f 75 6e 64 20  69 73 20 74 72 61 6e 73  |kground is trans|
00008990  70 61 72 65 6e 74 0d 18  92 49 20 20 20 20 20 20  |parent...I      |
000089a0  20 20 42 4c 20 20 20 20  20 20 70 6c 6f 74 5f 66  |  BL      plot_f|
000089b0  69 6c 6c 20 20 20 20 20  20 20 20 20 20 20 20 20  |ill             |
000089c0  20 20 3b 20 43 6c 65 61  72 20 74 68 65 20 70 6f  |  ; Clear the po|
000089d0  69 6e 74 65 72 20 69 6e  69 74 69 61 6c 6c 79 0d  |inter initially.|
000089e0  18 9c 51 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |..Q        MOV  |
000089f0  20 20 20 72 30 2c 20 23  63 6f 6c 6f 75 72 5f 74  |   r0, #colour_t|
00008a00  72 61 6e 73 5f 62 6c 75  65 20 20 3b 20 46 69 6c  |rans_blue  ; Fil|
00008a10  6c 20 69 6e 74 65 72 69  6f 72 20 77 69 74 68 20  |l interior with |
00008a20  74 72 61 6e 73 70 61 72  65 6e 74 20 62 6c 75 65  |transparent blue|
00008a30  0d 18 a6 46 20 20 20 20  20 20 20 20 42 4c 20 20  |...F        BL  |
00008a40  20 20 20 20 70 6c 6f 74  5f 70 6f 6c 79 5f 66 69  |    plot_poly_fi|
00008a50  6c 6c 20 20 20 20 20 20  20 20 20 20 3b 20 50 6c  |ll          ; Pl|
00008a60  6f 74 20 74 68 65 20 66  69 6c 6c 65 64 20 69 6e  |ot the filled in|
00008a70  74 65 72 69 6f 72 0d 18  b0 49 20 20 20 20 20 20  |terior...I      |
00008a80  20 20 4d 4f 56 20 20 20  20 20 72 30 2c 20 23 63  |  MOV     r0, #c|
00008a90  6f 6c 6f 75 72 5f 63 79  61 6e 20 20 20 20 20 20  |olour_cyan      |
00008aa0  20 20 3b 20 4f 75 74 6c  69 6e 65 20 74 68 65 20  |  ; Outline the |
00008ab0  70 6f 69 6e 74 65 72 20  69 6e 20 63 79 61 6e 0d  |pointer in cyan.|
00008ac0  18 ba 46 20 20 20 20 20  20 20 20 42 4c 20 20 20  |..F        BL   |
00008ad0  20 20 20 70 6c 6f 74 5f  70 6f 6c 79 5f 6c 69 6e  |   plot_poly_lin|
00008ae0  65 20 20 20 20 20 20 20  20 20 20 3b 20 50 6c 6f  |e          ; Plo|
00008af0  74 20 74 68 65 20 70 6f  69 6e 74 65 72 20 6f 75  |t the pointer ou|
00008b00  74 6c 69 6e 65 0d 18 c4  44 20 20 20 20 20 20 20  |tline...D       |
00008b10  20 4c 44 4d 46 44 20 20  20 72 31 33 21 2c 20 7b  | LDMFD   r13!, {|
00008b20  72 30 2d 72 32 2c 20 70  63 7d 20 20 20 20 20 20  |r0-r2, pc}      |
00008b30  20 3b 20 52 65 74 75 72  6e 20 66 72 6f 6d 20 73  | ; Return from s|
00008b40  75 62 72 6f 75 74 69 6e  65 0d 18 ce 04 0d 18 d8  |ubroutine.......|
00008b50  45 20 20 20 20 20 20 20  20 3b 20 50 6c 6f 74 20  |E        ; Plot |
00008b60  61 20 63 61 72 65 74 20  70 6f 69 6e 74 65 72 20  |a caret pointer |
00008b70  74 79 70 65 20 72 30 20  74 68 61 74 20 68 61 73  |type r0 that has|
00008b80  20 6d 6f 76 65 64 20 62  79 20 28 72 32 2c 20 72  | moved by (r2, r|
00008b90  31 29 0d 18 e2 11 2e 75  70 64 61 74 65 5f 77 72  |1).....update_wr|
00008ba0  69 74 65 0d 18 ec 3d 20  20 20 20 20 20 20 20 53  |ite...=        S|
00008bb0  54 4d 46 44 20 20 20 72  31 33 21 2c 20 7b 72 30  |TMFD   r13!, {r0|
00008bc0  2d 72 36 2c 20 72 31 34  7d 20 20 20 20 20 20 3b  |-r6, r14}      ;|
00008bd0  20 53 74 61 63 6b 20 72  65 67 69 73 74 65 72 73  | Stack registers|
00008be0  0d 18 f6 4b 20 20 20 20  20 20 20 20 4d 4f 56 20  |...K        MOV |
00008bf0  20 20 20 20 72 30 2c 20  72 32 2c 20 41 53 52 23  |    r0, r2, ASR#|
00008c00  33 20 20 20 20 20 20 20  20 20 20 20 3b 20 56 61  |3           ; Va|
00008c10  6c 75 65 20 74 6f 20 75  70 64 61 74 65 20 70 6f  |lue to update po|
00008c20  73 69 74 69 6f 6e 20 77  69 74 68 0d 19 00 3f 20  |sition with...? |
00008c30  20 20 20 20 20 20 20 42  4c 20 20 20 20 20 20 75  |       BL      u|
00008c40  70 64 61 74 65 5f 66 69  6c 74 65 72 20 20 20 20  |pdate_filter    |
00008c50  20 20 20 20 20 20 20 3b  20 46 69 6c 74 65 72 20  |       ; Filter |
00008c60  74 68 65 20 75 70 64 61  74 65 0d 19 0a 44 20 20  |the update...D  |
00008c70  20 20 20 20 20 20 4d 4f  56 20 20 20 20 20 72 33  |      MOV     r3|
00008c80  2c 20 72 30 2c 20 41 53  4c 23 32 20 20 20 20 20  |, r0, ASL#2     |
00008c90  20 20 20 20 20 20 3b 20  43 6f 70 79 20 74 68 65  |      ; Copy the|
00008ca0  20 66 69 6c 74 65 72 20  6f 75 74 70 75 74 0d 19  | filter output..|
00008cb0  14 43 20 20 20 20 20 20  20 20 4d 4f 56 20 20 20  |.C        MOV   |
00008cc0  20 20 72 30 2c 20 23 32  32 20 20 20 20 20 20 20  |  r0, #22       |
00008cd0  20 20 20 20 20 20 20 20  20 20 3b 20 4e 75 6d 62  |          ; Numb|
00008ce0  65 72 20 6f 66 20 63 6f  6f 72 64 69 6e 61 74 65  |er of coordinate|
00008cf0  73 0d 19 1e 48 20 20 20  20 20 20 20 20 41 44 52  |s...H        ADR|
00008d00  20 20 20 20 20 72 31 2c  20 75 70 64 61 74 65 5f  |     r1, update_|
00008d10  77 72 69 74 65 5f 62 61  73 69 63 20 20 3b 20 54  |write_basic  ; T|
00008d20  68 65 20 72 65 71 75 69  72 65 64 20 70 6f 69 6e  |he required poin|
00008d30  74 65 72 20 73 68 61 70  65 0d 19 28 51 20 20 20  |ter shape..(Q   |
00008d40  20 20 20 20 20 41 44 52  20 20 20 20 20 72 32 2c  |     ADR     r2,|
00008d50  20 75 70 64 61 74 65 5f  77 72 69 74 65 5f 68 6f  | update_write_ho|
00008d60  72 69 7a 6f 6e 74 61 6c  3b 20 43 68 61 6e 67 65  |rizontal; Change|
00008d70  73 20 74 6f 20 61 64 64  20 68 6f 72 69 7a 6f 6e  |s to add horizon|
00008d80  74 61 6c 20 6d 6f 74 69  6f 6e 0d 19 32 4b 20 20  |tal motion..2K  |
00008d90  20 20 20 20 20 20 41 44  44 20 20 20 20 20 72 34  |      ADD     r4|
00008da0  2c 20 72 31 32 2c 20 23  77 73 5f 62 75 66 66 65  |, r12, #ws_buffe|
00008db0  72 20 20 20 20 20 3b 20  50 6f 69 6e 74 65 72 20  |r     ; Pointer |
00008dc0  74 6f 20 64 65 73 74 69  6e 61 74 69 6f 6e 20 62  |to destination b|
00008dd0  75 66 66 65 72 0d 19 3c  49 20 20 20 20 20 20 20  |uffer..<I       |
00008de0  20 42 4c 20 20 20 20 20  20 74 72 61 6e 73 5f 61  | BL      trans_a|
00008df0  64 64 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |dd              |
00008e00  20 3b 20 41 64 64 20 74  68 65 20 6d 6f 74 69 6f  | ; Add the motio|
00008e10  6e 20 74 6f 20 74 68 65  20 73 68 61 70 65 0d 19  |n to the shape..|
00008e20  46 41 20 20 20 20 20 20  20 20 4d 4f 56 20 20 20  |FA        MOV   |
00008e30  20 20 72 31 2c 20 72 34  20 20 20 20 20 20 20 20  |  r1, r4        |
00008e40  20 20 20 20 20 20 20 20  20 20 3b 20 43 6f 70 79  |          ; Copy|
00008e50  20 62 75 66 66 65 72 20  70 6f 69 6e 74 65 72 0d  | buffer pointer.|
00008e60  19 50 51 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |.PQ        MOV  |
00008e70  20 20 20 72 32 2c 20 72  31 20 20 20 20 20 20 20  |   r2, r1       |
00008e80  20 20 20 20 20 20 20 20  20 20 20 3b 20 55 73 65  |           ; Use|
00008e90  20 74 68 65 20 73 61 6d  65 20 62 75 66 66 65 72  | the same buffer|
00008ea0  20 66 6f 72 20 74 68 65  20 72 65 73 75 6c 74 73  | for the results|
00008eb0  0d 19 5a 53 20 20 20 20  20 20 20 20 42 4c 20 20  |..ZS        BL  |
00008ec0  20 20 20 20 74 72 61 6e  73 5f 66 69 74 20 20 20  |    trans_fit   |
00008ed0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 53 63  |            ; Sc|
00008ee0  61 6c 65 20 74 68 65 20  63 6f 6f 72 64 69 6e 61  |ale the coordina|
00008ef0  74 65 73 20 66 6f 72 20  74 68 65 20 70 6f 69 6e  |tes for the poin|
00008f00  74 65 72 0d 19 64 47 20  20 20 20 20 20 20 20 4d  |ter..dG        M|
00008f10  4f 56 20 20 20 20 20 72  31 2c 20 72 30 20 20 20  |OV     r1, r0   |
00008f20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00008f30  20 43 6f 70 79 20 74 68  65 20 6e 75 6d 62 65 72  | Copy the number|
00008f40  20 6f 66 20 70 6f 69 6e  74 73 0d 19 6e 47 20 20  | of points..nG  |
00008f50  20 20 20 20 20 20 4d 4f  56 20 20 20 20 20 72 30  |      MOV     r0|
00008f60  2c 20 23 63 6f 6c 6f 75  72 5f 74 72 61 6e 73 20  |, #colour_trans |
00008f70  20 20 20 20 20 20 3b 20  42 61 63 6b 67 72 6f 75  |      ; Backgrou|
00008f80  6e 64 20 69 73 20 74 72  61 6e 73 70 61 72 65 6e  |nd is transparen|
00008f90  74 0d 19 78 49 20 20 20  20 20 20 20 20 42 4c 20  |t..xI        BL |
00008fa0  20 20 20 20 20 70 6c 6f  74 5f 66 69 6c 6c 20 20  |     plot_fill  |
00008fb0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 43  |             ; C|
00008fc0  6c 65 61 72 20 74 68 65  20 70 6f 69 6e 74 65 72  |lear the pointer|
00008fd0  20 69 6e 69 74 69 61 6c  6c 79 0d 19 82 4b 20 20  | initially...K  |
00008fe0  20 20 20 20 20 20 4d 4f  56 20 20 20 20 20 72 30  |      MOV     r0|
00008ff0  2c 20 23 63 6f 6c 6f 75  72 5f 62 6c 75 65 20 20  |, #colour_blue  |
00009000  20 20 20 20 20 20 3b 20  46 69 6c 6c 20 69 6e 74  |      ; Fill int|
00009010  65 72 69 6f 72 20 77 69  74 68 20 73 6f 6c 69 64  |erior with solid|
00009020  20 62 6c 75 65 0d 19 8c  46 20 20 20 20 20 20 20  | blue...F       |
00009030  20 42 4c 20 20 20 20 20  20 70 6c 6f 74 5f 70 6f  | BL      plot_po|
00009040  6c 79 5f 66 69 6c 6c 20  20 20 20 20 20 20 20 20  |ly_fill         |
00009050  20 3b 20 50 6c 6f 74 20  74 68 65 20 66 69 6c 6c  | ; Plot the fill|
00009060  65 64 20 69 6e 74 65 72  69 6f 72 0d 19 96 49 20  |ed interior...I |
00009070  20 20 20 20 20 20 20 4d  4f 56 20 20 20 20 20 72  |       MOV     r|
00009080  30 2c 20 23 63 6f 6c 6f  75 72 5f 63 79 61 6e 20  |0, #colour_cyan |
00009090  20 20 20 20 20 20 20 3b  20 4f 75 74 6c 69 6e 65  |       ; Outline|
000090a0  20 74 68 65 20 70 6f 69  6e 74 65 72 20 69 6e 20  | the pointer in |
000090b0  63 79 61 6e 0d 19 a0 46  20 20 20 20 20 20 20 20  |cyan...F        |
000090c0  42 4c 20 20 20 20 20 20  70 6c 6f 74 5f 70 6f 6c  |BL      plot_pol|
000090d0  79 5f 6c 69 6e 65 20 20  20 20 20 20 20 20 20 20  |y_line          |
000090e0  3b 20 50 6c 6f 74 20 74  68 65 20 70 6f 69 6e 74  |; Plot the point|
000090f0  65 72 20 6f 75 74 6c 69  6e 65 0d 19 aa 44 20 20  |er outline...D  |
00009100  20 20 20 20 20 20 4c 44  4d 46 44 20 20 20 72 31  |      LDMFD   r1|
00009110  33 21 2c 20 7b 72 30 2d  72 36 2c 20 70 63 7d 20  |3!, {r0-r6, pc} |
00009120  20 20 20 20 20 20 3b 20  52 65 74 75 72 6e 20 66  |      ; Return f|
00009130  72 6f 6d 20 73 75 62 72  6f 75 74 69 6e 65 0d 19  |rom subroutine..|
00009140  b4 45 2e 75 70 64 61 74  65 5f 77 72 69 74 65 5f  |.E.update_write_|
00009150  62 61 73 69 63 20 20 20  20 20 20 20 20 20 20 20  |basic           |
00009160  20 20 20 20 20 20 20 20  20 20 3b 20 54 68 65 20  |          ; The |
00009170  62 61 73 69 63 20 70 6f  69 6e 74 65 72 20 73 68  |basic pointer sh|
00009180  61 70 65 0d 19 be 20 20  20 20 20 20 20 20 20 a4  |ape...         .|
00009190  63 6f 6f 72 64 69 6e 61  74 65 28 2d 31 30 2c 20  |coordinate(-10, |
000091a0  2d 34 29 0d 19 c8 20 20  20 20 20 20 20 20 20 a4  |-4)...         .|
000091b0  63 6f 6f 72 64 69 6e 61  74 65 28 2d 31 30 2c 20  |coordinate(-10, |
000091c0  2d 32 29 0d 19 d2 1e 20  20 20 20 20 20 20 20 a4  |-2)....        .|
000091d0  63 6f 6f 72 64 69 6e 61  74 65 28 2d 38 2c 20 30  |coordinate(-8, 0|
000091e0  29 0d 19 dc 1f 20 20 20  20 20 20 20 20 a4 63 6f  |)....        .co|
000091f0  6f 72 64 69 6e 61 74 65  28 2d 31 30 2c 20 32 29  |ordinate(-10, 2)|
00009200  0d 19 e6 1f 20 20 20 20  20 20 20 20 a4 63 6f 6f  |....        .coo|
00009210  72 64 69 6e 61 74 65 28  2d 31 30 2c 20 34 29 0d  |rdinate(-10, 4).|
00009220  19 f0 1e 20 20 20 20 20  20 20 20 a4 63 6f 6f 72  |...        .coor|
00009230  64 69 6e 61 74 65 28 2d  38 2c 20 34 29 0d 19 fa  |dinate(-8, 4)...|
00009240  1e 20 20 20 20 20 20 20  20 a4 63 6f 6f 72 64 69  |.        .coordi|
00009250  6e 61 74 65 28 2d 37 2c  20 31 29 0d 1a 04 1e 20  |nate(-7, 1).... |
00009260  20 20 20 20 20 20 20 a4  63 6f 6f 72 64 69 6e 61  |       .coordina|
00009270  74 65 28 2d 32 2c 20 31  29 0d 1a 0e 1d 20 20 20  |te(-2, 1)....   |
00009280  20 20 20 20 20 a4 63 6f  6f 72 64 69 6e 61 74 65  |     .coordinate|
00009290  28 32 2c 20 31 29 0d 1a  18 1d 20 20 20 20 20 20  |(2, 1)....      |
000092a0  20 20 a4 63 6f 6f 72 64  69 6e 61 74 65 28 36 2c  |  .coordinate(6,|
000092b0  20 31 29 0d 1a 22 1d 20  20 20 20 20 20 20 20 a4  | 1)..".        .|
000092c0  63 6f 6f 72 64 69 6e 61  74 65 28 37 2c 20 34 29  |coordinate(7, 4)|
000092d0  0d 1a 2c 1d 20 20 20 20  20 20 20 20 a4 63 6f 6f  |..,.        .coo|
000092e0  72 64 69 6e 61 74 65 28  39 2c 20 34 29 0d 1a 36  |rdinate(9, 4)..6|
000092f0  1d 20 20 20 20 20 20 20  20 a4 63 6f 6f 72 64 69  |.        .coordi|
00009300  6e 61 74 65 28 39 2c 20  32 29 0d 1a 40 1d 20 20  |nate(9, 2)..@.  |
00009310  20 20 20 20 20 20 a4 63  6f 6f 72 64 69 6e 61 74  |      .coordinat|
00009320  65 28 37 2c 20 30 29 0d  1a 4a 1e 20 20 20 20 20  |e(7, 0)..J.     |
00009330  20 20 20 a4 63 6f 6f 72  64 69 6e 61 74 65 28 39  |   .coordinate(9|
00009340  2c 20 2d 32 29 0d 1a 54  1e 20 20 20 20 20 20 20  |, -2)..T.       |
00009350  20 a4 63 6f 6f 72 64 69  6e 61 74 65 28 39 2c 20  | .coordinate(9, |
00009360  2d 34 29 0d 1a 5e 1e 20  20 20 20 20 20 20 20 a4  |-4)..^.        .|
00009370  63 6f 6f 72 64 69 6e 61  74 65 28 37 2c 20 2d 34  |coordinate(7, -4|
00009380  29 0d 1a 68 1e 20 20 20  20 20 20 20 20 a4 63 6f  |)..h.        .co|
00009390  6f 72 64 69 6e 61 74 65  28 36 2c 20 2d 31 29 0d  |ordinate(6, -1).|
000093a0  1a 72 1e 20 20 20 20 20  20 20 20 a4 63 6f 6f 72  |.r.        .coor|
000093b0  64 69 6e 61 74 65 28 32  2c 20 2d 31 29 0d 1a 7c  |dinate(2, -1)..||
000093c0  1f 20 20 20 20 20 20 20  20 a4 63 6f 6f 72 64 69  |.        .coordi|
000093d0  6e 61 74 65 28 2d 32 2c  20 2d 31 29 0d 1a 86 1f  |nate(-2, -1)....|
000093e0  20 20 20 20 20 20 20 20  a4 63 6f 6f 72 64 69 6e  |        .coordin|
000093f0  61 74 65 28 2d 37 2c 20  2d 31 29 0d 1a 90 1f 20  |ate(-7, -1).... |
00009400  20 20 20 20 20 20 20 a4  63 6f 6f 72 64 69 6e 61  |       .coordina|
00009410  74 65 28 2d 38 2c 20 2d  34 29 0d 1a 9a 4d 2e 75  |te(-8, -4)...M.u|
00009420  70 64 61 74 65 5f 77 72  69 74 65 5f 68 6f 72 69  |pdate_write_hori|
00009430  7a 6f 6e 74 61 6c 20 20  20 20 20 20 20 20 20 20  |zontal          |
00009440  20 20 20 20 20 20 3b 20  4f 66 66 73 65 74 73 20  |      ; Offsets |
00009450  74 6f 20 64 69 73 74 6f  72 74 20 68 6f 72 69 7a  |to distort horiz|
00009460  6f 6e 74 61 6c 6c 79 0d  1a a4 20 20 20 20 20 20  |ontally...      |
00009470  20 20 20 a4 63 6f 6f 72  64 69 6e 61 74 65 28 30  |   .coordinate(0|
00009480  2e 36 2c 20 2d 31 29 0d  1a ae 22 20 20 20 20 20  |.6, -1)..."     |
00009490  20 20 20 a4 63 6f 6f 72  64 69 6e 61 74 65 28 30  |   .coordinate(0|
000094a0  2e 33 2c 20 2d 30 2e 38  29 0d 1a b8 20 20 20 20  |.3, -0.8)...    |
000094b0  20 20 20 20 20 a4 63 6f  6f 72 64 69 6e 61 74 65  |     .coordinate|
000094c0  28 30 2c 20 2d 30 2e 36  29 0d 1a c2 23 20 20 20  |(0, -0.6)...#   |
000094d0  20 20 20 20 20 a4 63 6f  6f 72 64 69 6e 61 74 65  |     .coordinate|
000094e0  28 2d 30 2e 33 2c 20 2d  30 2e 38 29 0d 1a cc 21  |(-0.3, -0.8)...!|
000094f0  20 20 20 20 20 20 20 20  a4 63 6f 6f 72 64 69 6e  |        .coordin|
00009500  61 74 65 28 2d 30 2e 36  2c 20 2d 31 29 0d 1a d6  |ate(-0.6, -1)...|
00009510  21 20 20 20 20 20 20 20  20 a4 63 6f 6f 72 64 69  |!        .coordi|
00009520  6e 61 74 65 28 2d 30 2e  36 2c 20 2d 31 29 0d 1a  |nate(-0.6, -1)..|
00009530  e0 24 20 20 20 20 20 20  20 20 a4 63 6f 6f 72 64  |.$        .coord|
00009540  69 6e 61 74 65 28 2d 30  2e 31 35 2c 20 2d 30 2e  |inate(-0.15, -0.|
00009550  35 29 0d 1a ea 22 20 20  20 20 20 20 20 20 a4 63  |5)..."        .c|
00009560  6f 6f 72 64 69 6e 61 74  65 28 2d 30 2e 31 35 2c  |oordinate(-0.15,|
00009570  20 2d 30 29 0d 1a f4 21  20 20 20 20 20 20 20 20  | -0)...!        |
00009580  a4 63 6f 6f 72 64 69 6e  61 74 65 28 30 2e 31 35  |.coordinate(0.15|
00009590  2c 20 2d 30 29 0d 1a fe  23 20 20 20 20 20 20 20  |, -0)...#       |
000095a0  20 a4 63 6f 6f 72 64 69  6e 61 74 65 28 30 2e 31  | .coordinate(0.1|
000095b0  35 2c 20 2d 30 2e 35 29  0d 1b 08 20 20 20 20 20  |5, -0.5)...     |
000095c0  20 20 20 20 a4 63 6f 6f  72 64 69 6e 61 74 65 28  |    .coordinate(|
000095d0  30 2e 36 2c 20 2d 31 29  0d 1b 12 20 20 20 20 20  |0.6, -1)...     |
000095e0  20 20 20 20 a4 63 6f 6f  72 64 69 6e 61 74 65 28  |    .coordinate(|
000095f0  30 2e 36 2c 20 2d 31 29  0d 1b 1c 22 20 20 20 20  |0.6, -1)..."    |
00009600  20 20 20 20 a4 63 6f 6f  72 64 69 6e 61 74 65 28  |    .coordinate(|
00009610  30 2e 33 2c 20 2d 30 2e  38 29 0d 1b 26 20 20 20  |0.3, -0.8)..&   |
00009620  20 20 20 20 20 20 a4 63  6f 6f 72 64 69 6e 61 74  |      .coordinat|
00009630  65 28 30 2c 20 2d 30 2e  36 29 0d 1b 30 23 20 20  |e(0, -0.6)..0#  |
00009640  20 20 20 20 20 20 a4 63  6f 6f 72 64 69 6e 61 74  |      .coordinat|
00009650  65 28 2d 30 2e 33 2c 20  2d 30 2e 38 29 0d 1b 3a  |e(-0.3, -0.8)..:|
00009660  21 20 20 20 20 20 20 20  20 a4 63 6f 6f 72 64 69  |!        .coordi|
00009670  6e 61 74 65 28 2d 30 2e  36 2c 20 2d 31 29 0d 1b  |nate(-0.6, -1)..|
00009680  44 21 20 20 20 20 20 20  20 20 a4 63 6f 6f 72 64  |D!        .coord|
00009690  69 6e 61 74 65 28 2d 30  2e 36 2c 20 2d 31 29 0d  |inate(-0.6, -1).|
000096a0  1b 4e 24 20 20 20 20 20  20 20 20 a4 63 6f 6f 72  |.N$        .coor|
000096b0  64 69 6e 61 74 65 28 2d  30 2e 31 35 2c 20 2d 30  |dinate(-0.15, -0|
000096c0  2e 35 29 0d 1b 58 22 20  20 20 20 20 20 20 20 a4  |.5)..X"        .|
000096d0  63 6f 6f 72 64 69 6e 61  74 65 28 2d 30 2e 31 35  |coordinate(-0.15|
000096e0  2c 20 2d 30 29 0d 1b 62  21 20 20 20 20 20 20 20  |, -0)..b!       |
000096f0  20 a4 63 6f 6f 72 64 69  6e 61 74 65 28 30 2e 31  | .coordinate(0.1|
00009700  35 2c 20 2d 30 29 0d 1b  6c 23 20 20 20 20 20 20  |5, -0)..l#      |
00009710  20 20 a4 63 6f 6f 72 64  69 6e 61 74 65 28 30 2e  |  .coordinate(0.|
00009720  31 35 2c 20 2d 30 2e 35  29 0d 1b 76 20 20 20 20  |15, -0.5)..v    |
00009730  20 20 20 20 20 a4 63 6f  6f 72 64 69 6e 61 74 65  |     .coordinate|
00009740  28 30 2e 36 2c 20 2d 31  29 0d 1b 80 04 0d 1b 8a  |(0.6, -1).......|
00009750  44 20 20 20 20 20 20 20  20 3b 20 50 6c 6f 74 20  |D        ; Plot |
00009760  61 20 6d 65 6e 75 20 70  6f 69 6e 74 65 72 20 74  |a menu pointer t|
00009770  79 70 65 20 72 30 20 74  68 61 74 20 68 61 73 20  |ype r0 that has |
00009780  6d 6f 76 65 64 20 62 79  20 28 72 32 2c 20 72 31  |moved by (r2, r1|
00009790  29 0d 1b 94 10 2e 75 70  64 61 74 65 5f 6d 65 6e  |).....update_men|
000097a0  75 0d 1b 9e 3d 20 20 20  20 20 20 20 20 53 54 4d  |u...=        STM|
000097b0  46 44 20 20 20 72 31 33  21 2c 20 7b 72 30 2d 72  |FD   r13!, {r0-r|
000097c0  34 2c 20 72 31 34 7d 20  20 20 20 20 20 3b 20 53  |4, r14}      ; S|
000097d0  74 61 63 6b 20 72 65 67  69 73 74 65 72 73 0d 1b  |tack registers..|
000097e0  a8 49 20 20 20 20 20 20  20 20 4c 44 52 20 20 20  |.I        LDR   |
000097f0  20 20 72 33 2c 20 5b 72  31 32 2c 20 23 77 73 5f  |  r3, [r12, #ws_|
00009800  63 6f 67 72 5d 20 20 20  20 20 3b 20 52 65 61 64  |cogr]     ; Read|
00009810  20 70 72 65 76 69 6f 75  73 20 72 6f 77 20 64 69  | previous row di|
00009820  72 65 63 74 69 6f 6e 0d  1b b2 4c 20 20 20 20 20  |rection...L     |
00009830  20 20 20 4c 44 52 20 20  20 20 20 72 34 2c 20 5b  |   LDR     r4, [|
00009840  72 31 32 2c 20 23 77 73  5f 63 6f 67 63 5d 20 20  |r12, #ws_cogc]  |
00009850  20 20 20 3b 20 52 65 61  64 20 70 72 65 76 69 6f  |   ; Read previo|
00009860  75 73 20 63 6f 6c 75 6d  6e 20 64 69 72 65 63 74  |us column direct|
00009870  69 6f 6e 0d 1b bc 4a 20  20 20 20 20 20 20 20 54  |ion...J        T|
00009880  45 51 20 20 20 20 20 72  31 2c 20 23 30 20 20 20  |EQ     r1, #0   |
00009890  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
000098a0  20 49 73 20 74 68 65 72  65 20 61 6e 79 20 76 65  | Is there any ve|
000098b0  72 74 69 63 61 6c 20 6d  6f 74 69 6f 6e 0d 1b c6  |rtical motion...|
000098c0  4c 20 20 20 20 20 20 20  20 54 45 51 45 51 20 20  |L        TEQEQ  |
000098d0  20 72 32 2c 20 23 30 20  20 20 20 20 20 20 20 20  | r2, #0         |
000098e0  20 20 20 20 20 20 20 20  20 3b 20 49 73 20 74 68  |         ; Is th|
000098f0  65 72 65 20 61 6e 79 20  68 6f 72 69 7a 6f 6e 74  |ere any horizont|
00009900  61 6c 20 6d 6f 74 69 6f  6e 0d 1b d0 4e 20 20 20  |al motion...N   |
00009910  20 20 20 20 20 42 45 51  20 20 20 20 20 75 70 64  |     BEQ     upd|
00009920  61 74 65 5f 6d 65 6e 75  5f 73 74 69 6c 6c 20 20  |ate_menu_still  |
00009930  20 20 20 20 20 3b 20 44  6f 20 6e 6f 74 20 63 68  |     ; Do not ch|
00009940  61 6e 67 65 20 64 69 72  65 63 74 69 6f 6e 20 69  |ange direction i|
00009950  66 20 73 74 69 6c 6c 0d  1b da 46 20 20 20 20 20  |f still...F     |
00009960  20 20 20 41 44 44 20 20  20 20 20 72 30 2c 20 72  |   ADD     r0, r|
00009970  33 2c 20 72 31 2c 20 41  53 52 23 33 20 20 20 20  |3, r1, ASR#3    |
00009980  20 20 20 3b 20 55 70 64  61 74 65 20 74 68 65 20  |   ; Update the |
00009990  72 6f 77 20 64 69 72 65  63 74 69 6f 6e 0d 1b e4  |row direction...|
000099a0  49 20 20 20 20 20 20 20  20 41 44 44 20 20 20 20  |I        ADD    |
000099b0  20 72 31 2c 20 72 34 2c  20 72 32 2c 20 41 53 52  | r1, r4, r2, ASR|
000099c0  23 33 20 20 20 20 20 20  20 3b 20 55 70 64 61 74  |#3       ; Updat|
000099d0  65 20 74 68 65 20 63 6f  6c 75 6d 6e 20 64 69 72  |e the column dir|
000099e0  65 63 74 69 6f 6e 0d 1b  ee 4c 20 20 20 20 20 20  |ection...L      |
000099f0  20 20 42 4c 20 20 20 20  20 20 6e 6f 72 6d 61 6c  |  BL      normal|
00009a00  69 73 65 20 20 20 20 20  20 20 20 20 20 20 20 20  |ise             |
00009a10  20 20 3b 20 4e 6f 72 6d  61 6c 69 73 65 20 74 68  |  ; Normalise th|
00009a20  65 20 64 69 72 65 63 74  69 6f 6e 20 76 65 63 74  |e direction vect|
00009a30  6f 72 0d 1b f8 44 20 20  20 20 20 20 20 20 4d 4f  |or...D        MO|
00009a40  56 20 20 20 20 20 72 33  2c 20 72 30 20 20 20 20  |V     r3, r0    |
00009a50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00009a60  43 6f 70 79 20 74 68 65  20 72 6f 77 20 64 69 72  |Copy the row dir|
00009a70  65 63 74 69 6f 6e 0d 1c  02 47 20 20 20 20 20 20  |ection...G      |
00009a80  20 20 4d 4f 56 20 20 20  20 20 72 34 2c 20 72 31  |  MOV     r4, r1|
00009a90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00009aa0  20 20 3b 20 43 6f 70 79  20 74 68 65 20 63 6f 6c  |  ; Copy the col|
00009ab0  75 6d 6e 20 64 69 72 65  63 74 69 6f 6e 0d 1c 0c  |umn direction...|
00009ac0  49 20 20 20 20 20 20 20  20 53 54 52 20 20 20 20  |I        STR    |
00009ad0  20 72 33 2c 20 5b 72 31  32 2c 20 23 77 73 5f 63  | r3, [r12, #ws_c|
00009ae0  6f 67 72 5d 20 20 20 20  20 3b 20 53 74 6f 72 65  |ogr]     ; Store|
00009af0  20 74 68 65 20 6e 65 77  20 72 6f 77 20 64 69 72  | the new row dir|
00009b00  65 63 74 69 6f 6e 0d 1c  16 4c 20 20 20 20 20 20  |ection...L      |
00009b10  20 20 53 54 52 20 20 20  20 20 72 34 2c 20 5b 72  |  STR     r4, [r|
00009b20  31 32 2c 20 23 77 73 5f  63 6f 67 63 5d 20 20 20  |12, #ws_cogc]   |
00009b30  20 20 3b 20 53 74 6f 72  65 20 74 68 65 20 6e 65  |  ; Store the ne|
00009b40  77 20 63 6f 6c 75 6d 6e  20 64 69 72 65 63 74 69  |w column directi|
00009b50  6f 6e 0d 1c 20 16 2e 75  70 64 61 74 65 5f 6d 65  |on.. ..update_me|
00009b60  6e 75 5f 73 74 69 6c 6c  0d 1c 2a 4b 20 20 20 20  |nu_still..*K    |
00009b70  20 20 20 20 4d 4f 56 20  20 20 20 20 72 30 2c 20  |    MOV     r0, |
00009b80  23 38 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |#8              |
00009b90  20 20 20 20 3b 20 4e 75  6d 62 65 72 20 6f 66 20  |    ; Number of |
00009ba0  70 6f 69 6e 74 73 20 74  6f 20 74 72 61 6e 73 66  |points to transf|
00009bb0  6f 72 6d 0d 1c 34 4a 20  20 20 20 20 20 20 20 41  |orm..4J        A|
00009bc0  44 52 20 20 20 20 20 72  31 2c 20 75 70 64 61 74  |DR     r1, updat|
00009bd0  65 5f 6d 65 6e 75 5f 66  72 61 6d 65 20 20 20 3b  |e_menu_frame   ;|
00009be0  20 50 6f 69 6e 74 65 72  20 74 6f 20 73 6f 75 72  | Pointer to sour|
00009bf0  63 65 20 63 6f 72 64 69  6e 61 74 65 73 0d 1c 3e  |ce cordinates..>|
00009c00  4b 20 20 20 20 20 20 20  20 41 44 44 20 20 20 20  |K        ADD    |
00009c10  20 72 32 2c 20 72 31 32  2c 20 23 77 73 5f 62 75  | r2, r12, #ws_bu|
00009c20  66 66 65 72 20 20 20 20  20 3b 20 50 6f 69 6e 74  |ffer     ; Point|
00009c30  65 72 20 74 6f 20 64 65  73 74 69 6e 61 74 69 6f  |er to destinatio|
00009c40  6e 20 62 75 66 66 65 72  0d 1c 48 53 20 20 20 20  |n buffer..HS    |
00009c50  20 20 20 20 42 4c 20 20  20 20 20 20 74 72 61 6e  |    BL      tran|
00009c60  73 5f 66 69 74 20 20 20  20 20 20 20 20 20 20 20  |s_fit           |
00009c70  20 20 20 20 3b 20 53 63  61 6c 65 20 74 68 65 20  |    ; Scale the |
00009c80  63 6f 6f 72 64 69 6e 61  74 65 73 20 66 6f 72 20  |coordinates for |
00009c90  74 68 65 20 70 6f 69 6e  74 65 72 0d 1c 52 4b 20  |the pointer..RK |
00009ca0  20 20 20 20 20 20 20 41  44 44 20 20 20 20 20 72  |       ADD     r|
00009cb0  32 2c 20 72 32 2c 20 72  30 2c 20 4c 53 4c 23 33  |2, r2, r0, LSL#3|
00009cc0  20 20 20 20 20 20 20 3b  20 50 6f 69 6e 74 65 72  |       ; Pointer|
00009cd0  20 74 6f 20 64 65 73 74  69 6e 61 74 69 6f 6e 20  | to destination |
00009ce0  62 75 66 66 65 72 0d 1c  5c 4f 20 20 20 20 20 20  |buffer..\O      |
00009cf0  20 20 4d 4f 56 20 20 20  20 20 72 30 2c 20 23 39  |  MOV     r0, #9|
00009d00  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00009d10  20 20 3b 20 4e 75 6d 62  65 72 20 6f 66 20 70 6f  |  ; Number of po|
00009d20  69 6e 74 73 20 69 6e 20  70 6f 69 6e 74 65 72 20  |ints in pointer |
00009d30  73 68 61 70 65 0d 1c 66  4b 20 20 20 20 20 20 20  |shape..fK       |
00009d40  20 41 44 52 20 20 20 20  20 72 31 2c 20 75 70 64  | ADR     r1, upd|
00009d50  61 74 65 5f 6d 65 6e 75  5f 70 74 72 20 20 20 20  |ate_menu_ptr    |
00009d60  20 3b 20 50 6f 69 6e 74  65 72 20 74 6f 20 73 6f  | ; Pointer to so|
00009d70  75 72 63 65 20 63 6f 6f  72 64 69 6e 61 74 65 73  |urce coordinates|
00009d80  0d 1c 70 4c 20 20 20 20  20 20 20 20 42 4c 20 20  |..pL        BL  |
00009d90  20 20 20 20 74 72 61 6e  73 5f 72 6f 74 61 74 65  |    trans_rotate|
00009da0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 52 6f  |            ; Ro|
00009db0  74 61 74 65 20 74 68 65  20 70 6f 69 6e 74 65 72  |tate the pointer|
00009dc0  20 61 73 20 72 65 71 75  69 72 65 64 0d 1c 7a 52  | as required..zR|
00009dd0  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
00009de0  72 31 2c 20 72 32 20 20  20 20 20 20 20 20 20 20  |r1, r2          |
00009df0  20 20 20 20 20 20 20 20  3b 20 53 6f 75 72 63 65  |        ; Source|
00009e00  20 62 75 66 66 65 72 20  69 73 20 73 61 6d 65 20  | buffer is same |
00009e10  61 73 20 64 65 73 74 69  6e 61 74 69 6f 6e 0d 1c  |as destination..|
00009e20  84 53 20 20 20 20 20 20  20 20 42 4c 20 20 20 20  |.S        BL    |
00009e30  20 20 74 72 61 6e 73 5f  66 69 74 20 20 20 20 20  |  trans_fit     |
00009e40  20 20 20 20 20 20 20 20  20 20 3b 20 53 63 61 6c  |          ; Scal|
00009e50  65 20 74 68 65 20 63 6f  6f 72 64 69 6e 61 74 65  |e the coordinate|
00009e60  73 20 66 6f 72 20 74 68  65 20 70 6f 69 6e 74 65  |s for the pointe|
00009e70  72 0d 1c 8e 47 20 20 20  20 20 20 20 20 4d 4f 56  |r...G        MOV|
00009e80  20 20 20 20 20 72 30 2c  20 23 63 6f 6c 6f 75 72  |     r0, #colour|
00009e90  5f 74 72 61 6e 73 20 20  20 20 20 20 20 3b 20 42  |_trans       ; B|
00009ea0  61 63 6b 67 72 6f 75 6e  64 20 69 73 20 74 72 61  |ackground is tra|
00009eb0  6e 73 70 61 72 65 6e 74  0d 1c 98 4b 20 20 20 20  |nsparent...K    |
00009ec0  20 20 20 20 41 44 44 20  20 20 20 20 72 32 2c 20  |    ADD     r2, |
00009ed0  72 31 32 2c 20 23 77 73  5f 62 75 66 66 65 72 20  |r12, #ws_buffer |
00009ee0  20 20 20 20 3b 20 50 6f  69 6e 74 65 72 20 74 6f  |    ; Pointer to|
00009ef0  20 63 6f 6f 72 64 69 6e  61 74 65 73 20 62 75 66  | coordinates buf|
00009f00  66 65 72 0d 1c a2 49 20  20 20 20 20 20 20 20 42  |fer...I        B|
00009f10  4c 20 20 20 20 20 20 70  6c 6f 74 5f 66 69 6c 6c  |L      plot_fill|
00009f20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00009f30  20 43 6c 65 61 72 20 74  68 65 20 70 6f 69 6e 74  | Clear the point|
00009f40  65 72 20 69 6e 69 74 69  61 6c 6c 79 0d 1c ac 51  |er initially...Q|
00009f50  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
00009f60  72 31 2c 20 23 34 20 20  20 20 20 20 20 20 20 20  |r1, #4          |
00009f70  20 20 20 20 20 20 20 20  3b 20 4e 75 6d 62 65 72  |        ; Number|
00009f80  20 6f 66 20 63 6f 6f 72  64 69 6e 61 74 65 73 20  | of coordinates |
00009f90  69 6e 20 6d 65 6e 75 20  73 68 61 70 65 0d 1c b6  |in menu shape...|
00009fa0  4b 20 20 20 20 20 20 20  20 4d 4f 56 20 20 20 20  |K        MOV    |
00009fb0  20 72 30 2c 20 23 63 6f  6c 6f 75 72 5f 74 72 61  | r0, #colour_tra|
00009fc0  6e 73 5f 62 6c 75 65 20  20 3b 20 46 69 6c 6c 20  |ns_blue  ; Fill |
00009fd0  69 6e 74 65 72 69 6f 72  20 77 69 74 68 20 73 6f  |interior with so|
00009fe0  6c 69 64 20 62 6c 75 65  0d 1c c0 46 20 20 20 20  |lid blue...F    |
00009ff0  20 20 20 20 42 4c 20 20  20 20 20 20 70 6c 6f 74  |    BL      plot|
0000a000  5f 70 6f 6c 79 5f 66 69  6c 6c 20 20 20 20 20 20  |_poly_fill      |
0000a010  20 20 20 20 3b 20 50 6c  6f 74 20 74 68 65 20 66  |    ; Plot the f|
0000a020  69 6c 6c 65 64 20 69 6e  74 65 72 69 6f 72 0d 1c  |illed interior..|
0000a030  ca 49 20 20 20 20 20 20  20 20 4d 4f 56 20 20 20  |.I        MOV   |
0000a040  20 20 72 30 2c 20 23 63  6f 6c 6f 75 72 5f 63 79  |  r0, #colour_cy|
0000a050  61 6e 20 20 20 20 20 20  20 20 3b 20 4f 75 74 6c  |an        ; Outl|
0000a060  69 6e 65 20 74 68 65 20  70 6f 69 6e 74 65 72 20  |ine the pointer |
0000a070  69 6e 20 63 79 61 6e 0d  1c d4 46 20 20 20 20 20  |in cyan...F     |
0000a080  20 20 20 42 4c 20 20 20  20 20 20 70 6c 6f 74 5f  |   BL      plot_|
0000a090  70 6f 6c 79 5f 6c 69 6e  65 20 20 20 20 20 20 20  |poly_line       |
0000a0a0  20 20 20 3b 20 50 6c 6f  74 20 74 68 65 20 70 6f  |   ; Plot the po|
0000a0b0  69 6e 74 65 72 20 6f 75  74 6c 69 6e 65 0d 1c de  |inter outline...|
0000a0c0  49 20 20 20 20 20 20 20  20 4d 4f 56 20 20 20 20  |I        MOV    |
0000a0d0  20 72 30 2c 20 23 63 6f  6c 6f 75 72 5f 74 72 61  | r0, #colour_tra|
0000a0e0  6e 73 5f 63 79 61 6e 20  20 3b 20 4f 75 74 6c 69  |ns_cyan  ; Outli|
0000a0f0  6e 65 20 74 68 65 20 70  6f 69 6e 74 65 72 20 69  |ne the pointer i|
0000a100  6e 20 63 79 61 6e 0d 1c  e8 47 20 20 20 20 20 20  |n cyan...G      |
0000a110  20 20 41 44 44 20 20 20  20 20 72 32 2c 20 72 32  |  ADD     r2, r2|
0000a120  2c 20 72 31 2c 20 4c 53  4c 23 33 20 20 20 20 20  |, r1, LSL#3     |
0000a130  20 20 3b 20 50 6f 69 6e  74 65 72 20 74 6f 20 69  |  ; Pointer to i|
0000a140  6e 74 65 72 69 6f 72 20  73 68 61 70 65 0d 1c f2  |nterior shape...|
0000a150  44 20 20 20 20 20 20 20  20 42 4c 20 20 20 20 20  |D        BL     |
0000a160  20 70 6c 6f 74 5f 70 6f  6c 79 5f 66 69 6c 6c 20  | plot_poly_fill |
0000a170  20 20 20 20 20 20 20 20  20 3b 20 50 6c 6f 74 20  |         ; Plot |
0000a180  74 68 65 20 6d 65 6e 75  20 69 6e 74 65 72 69 6f  |the menu interio|
0000a190  72 0d 1c fc 46 20 20 20  20 20 20 20 20 41 44 44  |r...F        ADD|
0000a1a0  20 20 20 20 20 72 32 2c  20 72 32 2c 20 72 31 2c  |     r2, r2, r1,|
0000a1b0  20 4c 53 4c 23 33 20 20  20 20 20 20 20 3b 20 50  | LSL#3       ; P|
0000a1c0  6f 69 6e 74 65 72 20 74  6f 20 70 6f 69 6e 74 65  |ointer to pointe|
0000a1d0  72 20 73 68 61 70 65 0d  1d 06 4b 20 20 20 20 20  |r shape...K     |
0000a1e0  20 20 20 4d 4f 56 20 20  20 20 20 72 30 2c 20 23  |   MOV     r0, #|
0000a1f0  63 6f 6c 6f 75 72 5f 62  6c 75 65 20 20 20 20 20  |colour_blue     |
0000a200  20 20 20 3b 20 46 69 6c  6c 20 69 6e 74 65 72 69  |   ; Fill interi|
0000a210  6f 72 20 77 69 74 68 20  73 6f 6c 69 64 20 62 6c  |or with solid bl|
0000a220  75 65 0d 1d 10 54 20 20  20 20 20 20 20 20 4d 4f  |ue...T        MO|
0000a230  56 20 20 20 20 20 72 31  2c 20 23 39 20 20 20 20  |V     r1, #9    |
0000a240  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
0000a250  4e 75 6d 62 65 72 20 6f  66 20 63 6f 6f 72 64 69  |Number of coordi|
0000a260  6e 61 74 65 73 20 69 6e  20 70 6f 69 6e 74 65 72  |nates in pointer|
0000a270  20 73 68 61 70 65 0d 1d  1a 46 20 20 20 20 20 20  | shape...F      |
0000a280  20 20 42 4c 20 20 20 20  20 20 70 6c 6f 74 5f 70  |  BL      plot_p|
0000a290  6f 6c 79 5f 66 69 6c 6c  20 20 20 20 20 20 20 20  |oly_fill        |
0000a2a0  20 20 3b 20 50 6c 6f 74  20 74 68 65 20 66 69 6c  |  ; Plot the fil|
0000a2b0  6c 65 64 20 69 6e 74 65  72 69 6f 72 0d 1d 24 49  |led interior..$I|
0000a2c0  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
0000a2d0  72 30 2c 20 23 63 6f 6c  6f 75 72 5f 63 79 61 6e  |r0, #colour_cyan|
0000a2e0  20 20 20 20 20 20 20 20  3b 20 4f 75 74 6c 69 6e  |        ; Outlin|
0000a2f0  65 20 74 68 65 20 70 6f  69 6e 74 65 72 20 69 6e  |e the pointer in|
0000a300  20 63 79 61 6e 0d 1d 2e  46 20 20 20 20 20 20 20  | cyan...F       |
0000a310  20 42 4c 20 20 20 20 20  20 70 6c 6f 74 5f 70 6f  | BL      plot_po|
0000a320  6c 79 5f 6c 69 6e 65 20  20 20 20 20 20 20 20 20  |ly_line         |
0000a330  20 3b 20 50 6c 6f 74 20  74 68 65 20 70 6f 69 6e  | ; Plot the poin|
0000a340  74 65 72 20 6f 75 74 6c  69 6e 65 0d 1d 38 44 20  |ter outline..8D |
0000a350  20 20 20 20 20 20 20 4c  44 4d 46 44 20 20 20 72  |       LDMFD   r|
0000a360  31 33 21 2c 20 7b 72 30  2d 72 34 2c 20 70 63 7d  |13!, {r0-r4, pc}|
0000a370  20 20 20 20 20 20 20 3b  20 52 65 74 75 72 6e 20  |       ; Return |
0000a380  66 72 6f 6d 20 73 75 62  72 6f 75 74 69 6e 65 0d  |from subroutine.|
0000a390  1d 42 4b 2e 75 70 64 61  74 65 5f 6d 65 6e 75 5f  |.BK.update_menu_|
0000a3a0  66 72 61 6d 65 20 20 20  20 20 20 20 20 20 20 20  |frame           |
0000a3b0  20 20 20 20 20 20 20 20  20 20 20 3b 20 54 68 65  |           ; The|
0000a3c0  20 6f 75 74 73 69 64 65  20 66 72 61 6d 65 20 6f  | outside frame o|
0000a3d0  66 20 74 68 65 20 6d 65  6e 75 0d 1d 4c 1e 20 20  |f the menu..L.  |
0000a3e0  20 20 20 20 20 20 a4 63  6f 6f 72 64 69 6e 61 74  |      .coordinat|
0000a3f0  65 28 2d 33 2c 20 30 29  0d 1d 56 1f 20 20 20 20  |e(-3, 0)..V.    |
0000a400  20 20 20 20 a4 63 6f 6f  72 64 69 6e 61 74 65 28  |    .coordinate(|
0000a410  2d 33 2c 20 31 36 29 0d  1d 60 1f 20 20 20 20 20  |-3, 16)..`.     |
0000a420  20 20 20 a4 63 6f 6f 72  64 69 6e 61 74 65 28 32  |   .coordinate(2|
0000a430  30 2c 20 31 36 29 0d 1d  6a 1e 20 20 20 20 20 20  |0, 16)..j.      |
0000a440  20 20 a4 63 6f 6f 72 64  69 6e 61 74 65 28 32 30  |  .coordinate(20|
0000a450  2c 20 30 29 0d 1d 74 46  2e 75 70 64 61 74 65 5f  |, 0)..tF.update_|
0000a460  6d 65 6e 75 5f 65 6e 74  72 69 65 73 20 20 20 20  |menu_entries    |
0000a470  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000a480  3b 20 54 68 65 20 69 6e  74 65 72 69 6f 72 20 6f  |; The interior o|
0000a490  66 20 74 68 65 20 6d 65  6e 75 0d 1d 7e 1f 20 20  |f the menu..~.  |
0000a4a0  20 20 20 20 20 20 a4 63  6f 6f 72 64 69 6e 61 74  |      .coordinat|
0000a4b0  65 28 30 2e 35 2c 20 31  29 0d 1d 88 20 20 20 20  |e(0.5, 1)...    |
0000a4c0  20 20 20 20 20 a4 63 6f  6f 72 64 69 6e 61 74 65  |     .coordinate|
0000a4d0  28 30 2e 35 2c 20 31 34  29 0d 1d 92 21 20 20 20  |(0.5, 14)...!   |
0000a4e0  20 20 20 20 20 a4 63 6f  6f 72 64 69 6e 61 74 65  |     .coordinate|
0000a4f0  28 31 38 2e 35 2c 20 31  34 29 0d 1d 9c 20 20 20  |(18.5, 14)...   |
0000a500  20 20 20 20 20 20 a4 63  6f 6f 72 64 69 6e 61 74  |      .coordinat|
0000a510  65 28 31 38 2e 35 2c 20  31 29 0d 1d a6 3f 2e 75  |e(18.5, 1)...?.u|
0000a520  70 64 61 74 65 5f 6d 65  6e 75 5f 70 74 72 20 20  |pdate_menu_ptr  |
0000a530  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000a540  20 20 20 20 20 20 3b 20  54 68 65 20 70 6f 69 6e  |      ; The poin|
0000a550  74 65 72 20 73 68 61 70  65 0d 1d b0 1d 20 20 20  |ter shape....   |
0000a560  20 20 20 20 20 a4 63 6f  6f 72 64 69 6e 61 74 65  |     .coordinate|
0000a570  28 31 2c 20 30 29 0d 1d  ba 1d 20 20 20 20 20 20  |(1, 0)....      |
0000a580  20 20 a4 63 6f 6f 72 64  69 6e 61 74 65 28 35 2c  |  .coordinate(5,|
0000a590  20 34 29 0d 1d c4 1d 20  20 20 20 20 20 20 20 a4  | 4)....        .|
0000a5a0  63 6f 6f 72 64 69 6e 61  74 65 28 36 2c 20 34 29  |coordinate(6, 4)|
0000a5b0  0d 1d ce 1d 20 20 20 20  20 20 20 20 a4 63 6f 6f  |....        .coo|
0000a5c0  72 64 69 6e 61 74 65 28  36 2c 20 32 29 0d 1d d8  |rdinate(6, 2)...|
0000a5d0  1e 20 20 20 20 20 20 20  20 a4 63 6f 6f 72 64 69  |.        .coordi|
0000a5e0  6e 61 74 65 28 31 31 2c  20 32 29 0d 1d e2 1f 20  |nate(11, 2).... |
0000a5f0  20 20 20 20 20 20 20 a4  63 6f 6f 72 64 69 6e 61  |       .coordina|
0000a600  74 65 28 31 31 2c 20 2d  32 29 0d 1d ec 1e 20 20  |te(11, -2)....  |
0000a610  20 20 20 20 20 20 a4 63  6f 6f 72 64 69 6e 61 74  |      .coordinat|
0000a620  65 28 36 2c 20 2d 32 29  0d 1d f6 1e 20 20 20 20  |e(6, -2)....    |
0000a630  20 20 20 20 a4 63 6f 6f  72 64 69 6e 61 74 65 28  |    .coordinate(|
0000a640  36 2c 20 2d 34 29 0d 1e  00 1e 20 20 20 20 20 20  |6, -4)....      |
0000a650  20 20 a4 63 6f 6f 72 64  69 6e 61 74 65 28 35 2c  |  .coordinate(5,|
0000a660  20 2d 34 29 0d 1e 0a 04  0d 1e 14 3c 20 20 20 20  | -4).......<    |
0000a670  20 20 20 20 3b 20 41 70  70 6c 79 20 61 6e 20 75  |    ; Apply an u|
0000a680  6e 64 65 72 64 61 6d 70  65 64 20 66 69 6c 74 65  |nderdamped filte|
0000a690  72 20 74 6f 20 74 68 65  20 76 61 6c 75 65 20 69  |r to the value i|
0000a6a0  6e 20 72 30 0d 1e 1e 12  2e 75 70 64 61 74 65 5f  |n r0.....update_|
0000a6b0  66 69 6c 74 65 72 0d 1e  28 3d 20 20 20 20 20 20  |filter..(=      |
0000a6c0  20 20 53 54 4d 46 44 20  20 20 72 31 33 21 2c 20  |  STMFD   r13!, |
0000a6d0  7b 72 31 2d 72 33 2c 20  72 31 34 7d 20 20 20 20  |{r1-r3, r14}    |
0000a6e0  20 20 3b 20 53 74 61 63  6b 20 72 65 67 69 73 74  |  ; Stack regist|
0000a6f0  65 72 73 0d 1e 32 43 20  20 20 20 20 20 20 20 4c  |ers..2C        L|
0000a700  44 52 20 20 20 20 20 72  31 2c 20 5b 72 31 32 2c  |DR     r1, [r12,|
0000a710  20 23 77 73 5f 66 69 6c  74 6e 5d 20 20 20 20 3b  | #ws_filtn]    ;|
0000a720  20 47 65 74 20 70 72 65  76 69 6f 75 73 20 70 6f  | Get previous po|
0000a730  73 69 74 69 6f 6e 0d 1e  3c 43 20 20 20 20 20 20  |sition..<C      |
0000a740  20 20 4c 44 52 20 20 20  20 20 72 32 2c 20 5b 72  |  LDR     r2, [r|
0000a750  31 32 2c 20 23 77 73 5f  66 69 6c 74 76 5d 20 20  |12, #ws_filtv]  |
0000a760  20 20 3b 20 47 65 74 20  70 72 65 76 69 6f 75 73  |  ; Get previous|
0000a770  20 76 65 6c 6f 63 69 74  79 0d 1e 46 44 20 20 20  | velocity..FD   |
0000a780  20 20 20 20 20 4c 44 52  20 20 20 20 20 72 33 2c  |     LDR     r3,|
0000a790  20 5b 72 31 32 2c 20 23  77 73 5f 66 72 69 63 74  | [r12, #ws_frict|
0000a7a0  69 6f 6e 5d 20 3b 20 54  68 65 20 61 6d 6f 75 6e  |ion] ; The amoun|
0000a7b0  74 20 6f 66 20 66 72 69  63 74 69 6f 6e 0d 1e 50  |t of friction..P|
0000a7c0  46 20 20 20 20 20 20 20  20 52 53 42 20 20 20 20  |F        RSB    |
0000a7d0  20 72 33 2c 20 72 33 2c  20 23 31 30 20 20 20 20  | r3, r3, #10    |
0000a7e0  20 20 20 20 20 20 20 20  20 3b 20 43 6f 6e 76 65  |         ; Conve|
0000a7f0  72 74 20 74 6f 20 61 20  73 68 69 66 74 20 76 61  |rt to a shift va|
0000a800  6c 75 65 0d 1e 5a 41 20  20 20 20 20 20 20 20 53  |lue..ZA        S|
0000a810  55 42 20 20 20 20 20 72  32 2c 20 72 32 2c 20 72  |UB     r2, r2, r|
0000a820  32 2c 20 41 53 52 20 72  33 20 20 20 20 20 20 3b  |2, ASR r3      ;|
0000a830  20 41 70 70 6c 79 20 73  6f 6d 65 20 66 72 69 63  | Apply some fric|
0000a840  74 69 6f 6e 0d 1e 64 41  20 20 20 20 20 20 20 20  |tion..dA        |
0000a850  4c 44 52 20 20 20 20 20  72 33 2c 20 5b 72 31 32  |LDR     r3, [r12|
0000a860  2c 20 23 77 73 5f 73 70  72 69 6e 67 5d 20 20 20  |, #ws_spring]   |
0000a870  3b 20 54 68 65 20 73 70  72 69 6e 67 20 63 6f 6e  |; The spring con|
0000a880  73 74 61 6e 74 0d 1e 6e  46 20 20 20 20 20 20 20  |stant..nF       |
0000a890  20 52 53 42 20 20 20 20  20 72 33 2c 20 72 33 2c  | RSB     r3, r3,|
0000a8a0  20 23 31 31 20 20 20 20  20 20 20 20 20 20 20 20  | #11            |
0000a8b0  20 3b 20 43 6f 6e 76 65  72 74 20 74 6f 20 61 20  | ; Convert to a |
0000a8c0  73 68 69 66 74 20 76 61  6c 75 65 0d 1e 78 4b 20  |shift value..xK |
0000a8d0  20 20 20 20 20 20 20 53  55 42 20 20 20 20 20 72  |       SUB     r|
0000a8e0  32 2c 20 72 32 2c 20 72  31 2c 20 41 53 52 20 72  |2, r2, r1, ASR r|
0000a8f0  33 20 20 20 20 20 20 3b  20 49 6e 63 6c 75 64 65  |3      ; Include|
0000a900  20 74 68 65 20 72 65 73  74 6f 72 61 74 69 76 65  | the restorative|
0000a910  20 66 6f 72 63 65 0d 1e  82 52 20 20 20 20 20 20  | force...R      |
0000a920  20 20 41 44 44 20 20 20  20 20 72 31 2c 20 72 31  |  ADD     r1, r1|
0000a930  2c 20 72 32 20 20 20 20  20 20 20 20 20 20 20 20  |, r2            |
0000a940  20 20 3b 20 41 64 64 20  70 61 72 74 20 6f 66 20  |  ; Add part of |
0000a950  76 65 6c 6f 63 69 74 79  20 74 6f 20 74 68 65 20  |velocity to the |
0000a960  70 6f 73 69 74 69 6f 6e  0d 1e 8c 42 20 20 20 20  |position...B    |
0000a970  20 20 20 20 4c 44 52 20  20 20 20 20 72 33 2c 20  |    LDR     r3, |
0000a980  5b 72 31 32 2c 20 23 77  73 5f 66 6f 72 63 65 5d  |[r12, #ws_force]|
0000a990  20 20 20 20 3b 20 54 68  65 20 66 6f 72 63 65 20  |    ; The force |
0000a9a0  6d 75 6c 74 69 70 6c 69  65 72 0d 1e 96 46 20 20  |multiplier...F  |
0000a9b0  20 20 20 20 20 20 52 53  42 53 20 20 20 20 72 33  |      RSBS    r3|
0000a9c0  2c 20 72 33 2c 20 23 31  33 20 20 20 20 20 20 20  |, r3, #13       |
0000a9d0  20 20 20 20 20 20 3b 20  43 6f 6e 76 65 72 74 20  |      ; Convert |
0000a9e0  74 6f 20 61 20 73 68 69  66 74 20 76 61 6c 75 65  |to a shift value|
0000a9f0  0d 1e a0 4a 20 20 20 20  20 20 20 20 4d 4f 56 4d  |...J        MOVM|
0000aa00  49 20 20 20 72 30 2c 20  23 30 20 20 20 20 20 20  |I   r0, #0      |
0000aa10  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 4e 6f  |            ; No|
0000aa20  20 77 69 62 62 6c 65 20  69 66 20 72 65 73 75 6c  | wibble if resul|
0000aa30  74 20 6e 65 67 61 74 69  76 65 0d 1e aa 41 20 20  |t negative...A  |
0000aa40  20 20 20 20 20 20 4d 4f  56 20 20 20 20 20 72 30  |      MOV     r0|
0000aa50  2c 20 72 30 2c 20 41 53  52 20 72 33 20 20 20 20  |, r0, ASR r3    |
0000aa60  20 20 20 20 20 20 3b 20  53 63 61 6c 65 20 74 68  |      ; Scale th|
0000aa70  65 20 6e 65 77 20 69 6e  70 75 74 0d 1e b4 3f 20  |e new input...? |
0000aa80  20 20 20 20 20 20 20 41  44 44 20 20 20 20 20 72  |       ADD     r|
0000aa90  30 2c 20 72 31 2c 20 72  30 2c 20 41 53 4c 23 38  |0, r1, r0, ASL#8|
0000aaa0  20 20 20 20 20 20 20 3b  20 41 64 64 20 74 68 65  |       ; Add the|
0000aab0  20 6e 65 77 20 69 6e 70  75 74 0d 1e be 47 20 20  | new input...G  |
0000aac0  20 20 20 20 20 20 4d 4f  56 20 20 20 20 20 72 31  |      MOV     r1|
0000aad0  2c 20 23 31 3c 3c 31 36  20 20 20 20 20 20 20 20  |, #1<<16        |
0000aae0  20 20 20 20 20 20 3b 20  54 68 65 20 6d 61 78 69  |      ; The maxi|
0000aaf0  6d 75 6d 20 61 6c 6c 6f  77 65 64 20 76 61 6c 75  |mum allowed valu|
0000ab00  65 0d 1e c8 44 20 20 20  20 20 20 20 20 43 4d 50  |e...D        CMP|
0000ab10  20 20 20 20 20 72 30 2c  20 72 31 20 20 20 20 20  |     r0, r1     |
0000ab20  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 43  |             ; C|
0000ab30  6f 6d 70 61 72 65 20 74  6f 20 74 68 65 20 6d 61  |ompare to the ma|
0000ab40  78 69 6d 75 6d 0d 1e d2  4a 20 20 20 20 20 20 20  |ximum...J       |
0000ab50  20 4d 4f 56 47 54 20 20  20 72 30 2c 20 72 31 20  | MOVGT   r0, r1 |
0000ab60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000ab70  20 3b 20 45 6e 66 6f 72  63 65 20 74 68 65 20 6d  | ; Enforce the m|
0000ab80  61 78 69 6d 75 6d 20 70  6f 73 69 74 69 6f 6e 0d  |aximum position.|
0000ab90  1e dc 52 20 20 20 20 20  20 20 20 43 4d 50 47 54  |..R        CMPGT|
0000aba0  20 20 20 72 32 2c 20 23  30 20 20 20 20 20 20 20  |   r2, #0       |
0000abb0  20 20 20 20 20 20 20 20  20 20 20 3b 20 43 6c 69  |           ; Cli|
0000abc0  70 20 74 68 65 20 76 65  6c 6f 63 69 74 79 20 69  |p the velocity i|
0000abd0  66 20 6d 61 78 69 6d 75  6d 20 72 65 61 63 68 65  |f maximum reache|
0000abe0  64 0d 1e e6 46 20 20 20  20 20 20 20 20 4d 4f 56  |d...F        MOV|
0000abf0  47 54 20 20 20 72 32 2c  20 23 30 20 20 20 20 20  |GT   r2, #0     |
0000ac00  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 53  |             ; S|
0000ac10  65 74 20 74 68 65 20 76  65 6c 6f 63 69 74 79 20  |et the velocity |
0000ac20  74 6f 20 7a 65 72 6f 0d  1e f0 47 20 20 20 20 20  |to zero...G     |
0000ac30  20 20 20 52 53 42 20 20  20 20 20 72 31 2c 20 72  |   RSB     r1, r|
0000ac40  31 2c 20 23 30 20 20 20  20 20 20 20 20 20 20 20  |1, #0           |
0000ac50  20 20 20 3b 20 54 68 65  20 6d 69 6e 69 6d 75 6d  |   ; The minimum|
0000ac60  20 61 6c 6c 6f 77 65 64  20 76 61 6c 75 65 0d 1e  | allowed value..|
0000ac70  fa 44 20 20 20 20 20 20  20 20 43 4d 50 20 20 20  |.D        CMP   |
0000ac80  20 20 72 30 2c 20 72 31  20 20 20 20 20 20 20 20  |  r0, r1        |
0000ac90  20 20 20 20 20 20 20 20  20 20 3b 20 43 6f 6d 70  |          ; Comp|
0000aca0  61 72 65 20 74 6f 20 74  68 65 20 6d 69 6d 69 6d  |are to the mimim|
0000acb0  75 6d 0d 1f 04 41 20 20  20 20 20 20 20 20 4d 4f  |um...A        MO|
0000acc0  56 4c 54 20 20 20 72 30  2c 20 72 31 20 20 20 20  |VLT   r0, r1    |
0000acd0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
0000ace0  45 6e 66 6f 72 63 65 20  74 68 65 20 6d 69 6e 69  |Enforce the mini|
0000acf0  6d 75 6d 0d 1f 0e 52 20  20 20 20 20 20 20 20 43  |mum...R        C|
0000ad00  4d 50 4c 54 20 20 20 72  32 2c 20 23 30 20 20 20  |MPLT   r2, #0   |
0000ad10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
0000ad20  20 43 6c 69 70 20 74 68  65 20 76 65 6c 6f 63 69  | Clip the veloci|
0000ad30  74 79 20 69 66 20 6d 69  6e 69 6d 75 6d 20 72 65  |ty if minimum re|
0000ad40  61 63 68 65 64 0d 1f 18  46 20 20 20 20 20 20 20  |ached...F       |
0000ad50  20 4d 4f 56 4c 54 20 20  20 72 32 2c 20 23 30 20  | MOVLT   r2, #0 |
0000ad60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000ad70  20 3b 20 53 65 74 20 74  68 65 20 76 65 6c 6f 63  | ; Set the veloc|
0000ad80  69 74 79 20 74 6f 20 7a  65 72 6f 0d 1f 22 43 20  |ity to zero.."C |
0000ad90  20 20 20 20 20 20 20 4d  4f 56 53 20 20 20 20 72  |       MOVS    r|
0000ada0  31 2c 20 72 30 20 20 20  20 20 20 20 20 20 20 20  |1, r0           |
0000adb0  20 20 20 20 20 20 20 3b  20 43 6f 70 79 20 74 68  |       ; Copy th|
0000adc0  65 20 6e 65 77 20 70 6f  73 69 74 69 6f 6e 0d 1f  |e new position..|
0000add0  2c 51 20 20 20 20 20 20  20 20 52 53 42 4d 49 20  |,Q        RSBMI |
0000ade0  20 20 72 31 2c 20 72 31  2c 20 23 30 20 20 20 20  |  r1, r1, #0    |
0000adf0  20 20 20 20 20 20 20 20  20 20 3b 20 45 6e 73 75  |          ; Ensu|
0000ae00  72 65 20 63 6f 70 79 20  6f 66 20 70 6f 73 69 74  |re copy of posit|
0000ae10  69 6f 6e 20 69 73 20 70  6f 73 69 74 69 76 65 0d  |ion is positive.|
0000ae20  1f 36 46 20 20 20 20 20  20 20 20 43 4d 50 20 20  |.6F        CMP  |
0000ae30  20 20 20 72 31 2c 20 23  31 3c 3c 38 20 20 20 20  |   r1, #1<<8    |
0000ae40  20 20 20 20 20 20 20 20  20 20 20 3b 20 4d 69 6e  |           ; Min|
0000ae50  69 6d 75 6d 20 76 69 73  69 62 6c 65 20 70 6f 73  |imum visible pos|
0000ae60  69 74 69 6f 6e 0d 1f 40  53 20 20 20 20 20 20 20  |ition..@S       |
0000ae70  20 4d 4f 56 4c 54 20 20  20 72 32 2c 20 72 32 2c  | MOVLT   r2, r2,|
0000ae80  20 41 53 52 23 31 20 20  20 20 20 20 20 20 20 20  | ASR#1          |
0000ae90  20 3b 20 49 6e 63 72 65  61 73 65 20 66 72 69 63  | ; Increase fric|
0000aea0  74 69 6f 6e 20 77 68 65  6e 20 73 6d 61 6c 6c 20  |tion when small |
0000aeb0  6d 6f 76 65 6d 65 6e 74  0d 1f 4a 44 20 20 20 20  |movement..JD    |
0000aec0  20 20 20 20 53 54 52 20  20 20 20 20 72 30 2c 20  |    STR     r0, |
0000aed0  5b 72 31 32 2c 20 23 77  73 5f 66 69 6c 74 6e 5d  |[r12, #ws_filtn]|
0000aee0  20 20 20 20 3b 20 53 74  6f 72 65 20 74 68 65 20  |    ; Store the |
0000aef0  6e 65 77 20 70 6f 73 69  74 69 6f 6e 0d 1f 54 44  |new position..TD|
0000af00  20 20 20 20 20 20 20 20  53 54 52 20 20 20 20 20  |        STR     |
0000af10  72 32 2c 20 5b 72 31 32  2c 20 23 77 73 5f 66 69  |r2, [r12, #ws_fi|
0000af20  6c 74 76 5d 20 20 20 20  3b 20 53 74 6f 72 65 20  |ltv]    ; Store |
0000af30  74 68 65 20 6e 65 77 20  76 65 6c 6f 63 69 74 79  |the new velocity|
0000af40  0d 1f 5e 17 2e 75 70 64  61 74 65 5f 66 69 6c 74  |..^..update_filt|
0000af50  65 72 5f 64 6f 6e 65 0d  1f 68 44 20 20 20 20 20  |er_done..hD     |
0000af60  20 20 20 4c 44 4d 46 44  20 20 20 72 31 33 21 2c  |   LDMFD   r13!,|
0000af70  20 7b 72 31 2d 72 33 2c  20 70 63 7d 20 20 20 20  | {r1-r3, pc}    |
0000af80  20 20 20 3b 20 52 65 74  75 72 6e 20 66 72 6f 6d  |   ; Return from|
0000af90  20 73 75 62 72 6f 75 74  69 6e 65 0d 1f 72 04 0d  | subroutine..r..|
0000afa0  1f 7c 38 20 20 20 20 20  20 20 20 3b 20 46 69 6c  |.|8        ; Fil|
0000afb0  6c 20 74 68 65 20 70 6f  69 6e 74 65 72 20 69 6d  |l the pointer im|
0000afc0  61 67 65 20 64 61 74 61  20 77 69 74 68 20 63 6f  |age data with co|
0000afd0  6c 6f 75 72 20 72 30 0d  1f 86 0e 2e 70 6c 6f 74  |lour r0.....plot|
0000afe0  5f 66 69 6c 6c 0d 1f 90  3d 20 20 20 20 20 20 20  |_fill...=       |
0000aff0  20 53 54 4d 46 44 20 20  20 72 31 33 21 2c 20 7b  | STMFD   r13!, {|
0000b000  72 30 2d 72 32 2c 20 72  31 34 7d 20 20 20 20 20  |r0-r2, r14}     |
0000b010  20 3b 20 53 74 61 63 6b  20 72 65 67 69 73 74 65  | ; Stack registe|
0000b020  72 73 0d 1f 9a 4e 20 20  20 20 20 20 20 20 42 4c  |rs...N        BL|
0000b030  20 20 20 20 20 20 63 6f  6c 6f 75 72 5f 65 78 70  |      colour_exp|
0000b040  61 6e 64 20 20 20 20 20  20 20 20 20 20 20 3b 20  |and           ; |
0000b050  45 78 70 61 6e 64 20 74  68 65 20 63 6f 6c 6f 75  |Expand the colou|
0000b060  72 20 74 6f 20 66 69 6c  6c 20 61 20 77 6f 72 64  |r to fill a word|
0000b070  0d 1f a4 49 20 20 20 20  20 20 20 20 41 44 44 20  |...I        ADD |
0000b080  20 20 20 20 72 31 2c 20  72 31 32 2c 20 23 77 73  |    r1, r12, #ws|
0000b090  5f 70 74 72 5f 64 61 74  61 20 20 20 3b 20 53 74  |_ptr_data   ; St|
0000b0a0  61 72 74 20 6f 66 20 70  6f 69 6e 74 65 72 20 69  |art of pointer i|
0000b0b0  6d 61 67 65 20 64 61 74  61 0d 1f ae 45 20 20 20  |mage data...E   |
0000b0c0  20 20 20 20 20 4d 4f 56  20 20 20 20 20 72 32 2c  |     MOV     r2,|
0000b0d0  20 23 33 32 20 20 20 20  20 20 20 20 20 20 20 20  | #32            |
0000b0e0  20 20 20 20 20 3b 20 4e  75 6d 62 65 72 20 6f 66  |     ; Number of|
0000b0f0  20 72 6f 77 73 20 74 6f  20 63 6c 65 61 72 0d 1f  | rows to clear..|
0000b100  b8 13 2e 70 6c 6f 74 5f  66 69 6c 6c 5f 6c 6f 6f  |...plot_fill_loo|
0000b110  70 0d 1f c2 50 20 20 20  20 20 20 20 20 53 55 42  |p...P        SUB|
0000b120  53 20 20 20 20 72 32 2c  20 72 32 2c 20 23 31 20  |S    r2, r2, #1 |
0000b130  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 44  |             ; D|
0000b140  65 63 72 65 6d 65 6e 74  20 6e 75 6d 62 65 72 20  |ecrement number |
0000b150  6f 66 20 72 6f 77 73 20  72 65 6d 61 69 6e 69 6e  |of rows remainin|
0000b160  67 0d 1f cc 52 20 20 20  20 20 20 20 20 4c 44 4d  |g...R        LDM|
0000b170  4d 49 46 44 20 72 31 33  21 2c 20 7b 72 30 2d 72  |MIFD r13!, {r0-r|
0000b180  32 2c 20 70 63 7d 20 20  20 20 20 20 20 3b 20 52  |2, pc}       ; R|
0000b190  65 74 75 72 6e 20 66 72  6f 6d 20 73 75 62 72 6f  |eturn from subro|
0000b1a0  75 74 69 6e 65 20 77 68  65 6e 20 66 69 6e 69 73  |utine when finis|
0000b1b0  68 65 64 0d 1f d6 50 20  20 20 20 20 20 20 20 53  |hed...P        S|
0000b1c0  54 52 20 20 20 20 20 72  30 2c 20 5b 72 31 5d 2c  |TR     r0, [r1],|
0000b1d0  20 23 34 20 20 20 20 20  20 20 20 20 20 20 20 3b  | #4            ;|
0000b1e0  20 53 65 74 20 74 68 69  73 20 77 6f 72 64 20 6f  | Set this word o|
0000b1f0  66 20 74 68 65 20 70 6f  69 6e 74 65 72 20 69 6d  |f the pointer im|
0000b200  61 67 65 0d 1f e0 50 20  20 20 20 20 20 20 20 53  |age...P        S|
0000b210  54 52 20 20 20 20 20 72  30 2c 20 5b 72 31 5d 2c  |TR     r0, [r1],|
0000b220  20 23 34 20 20 20 20 20  20 20 20 20 20 20 20 3b  | #4            ;|
0000b230  20 53 65 74 20 74 68 69  73 20 77 6f 72 64 20 6f  | Set this word o|
0000b240  66 20 74 68 65 20 70 6f  69 6e 74 65 72 20 69 6d  |f the pointer im|
0000b250  61 67 65 0d 1f ea 54 20  20 20 20 20 20 20 20 4d  |age...T        M|
0000b260  4f 56 20 20 20 20 20 72  30 2c 20 72 30 2c 20 52  |OV     r0, r0, R|
0000b270  4f 52 23 32 20 20 20 20  20 20 20 20 20 20 20 3b  |OR#2           ;|
0000b280  20 52 6f 74 61 74 65 20  70 61 74 74 65 72 6e 20  | Rotate pattern |
0000b290  62 79 20 61 20 70 69 78  65 6c 20 66 6f 72 20 6e  |by a pixel for n|
0000b2a0  65 78 74 20 72 6f 77 0d  1f f4 44 20 20 20 20 20  |ext row...D     |
0000b2b0  20 20 20 42 20 20 20 20  20 20 20 70 6c 6f 74 5f  |   B       plot_|
0000b2c0  66 69 6c 6c 5f 6c 6f 6f  70 20 20 20 20 20 20 20  |fill_loop       |
0000b2d0  20 20 20 3b 20 4c 6f 6f  70 20 66 6f 72 20 74 68  |   ; Loop for th|
0000b2e0  65 20 6e 65 78 74 20 77  6f 72 64 0d 1f fe 04 0d  |e next word.....|
0000b2f0  20 08 4b 20 20 20 20 20  20 20 20 3b 20 50 6c 6f  | .K        ; Plo|
0000b300  74 20 61 20 68 6f 72 69  7a 6f 6e 74 61 6c 20 6c  |t a horizontal l|
0000b310  69 6e 65 20 69 6e 20 63  6f 6c 6f 75 72 20 72 30  |ine in colour r0|
0000b320  20 66 72 6f 6d 20 28 72  32 2c 20 72 31 29 20 74  | from (r2, r1) t|
0000b330  6f 20 28 72 33 2c 20 72  31 29 0d 20 12 0d 2e 70  |o (r3, r1). ...p|
0000b340  6c 6f 74 5f 72 6f 77 0d  20 1c 3d 20 20 20 20 20  |lot_row. .=     |
0000b350  20 20 20 53 54 4d 46 44  20 20 20 72 31 33 21 2c  |   STMFD   r13!,|
0000b360  20 7b 72 30 2d 72 34 2c  20 72 31 34 7d 20 20 20  | {r0-r4, r14}   |
0000b370  20 20 20 3b 20 53 74 61  63 6b 20 72 65 67 69 73  |   ; Stack regis|
0000b380  74 65 72 73 0d 20 26 4d  20 20 20 20 20 20 20 20  |ters. &M        |
0000b390  4c 44 52 42 20 20 20 20  72 34 2c 20 5b 72 31 32  |LDRB    r4, [r12|
0000b3a0  2c 20 23 77 73 5f 70 74  72 5f 62 6c 6f 63 6b 5f  |, #ws_ptr_block_|
0000b3b0  61 63 74 69 76 65 78 5d  3b 20 52 65 61 64 20 68  |activex]; Read h|
0000b3c0  6f 72 69 7a 6f 6e 74 61  6c 20 68 6f 74 73 70 6f  |orizontal hotspo|
0000b3d0  74 0d 20 30 47 20 20 20  20 20 20 20 20 41 44 44  |t. 0G        ADD|
0000b3e0  20 20 20 20 20 72 32 2c  20 72 32 2c 20 72 34 20  |     r2, r2, r4 |
0000b3f0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 53  |             ; S|
0000b400  65 74 20 74 68 65 20 68  6f 72 69 7a 6f 6e 74 61  |et the horizonta|
0000b410  6c 20 6f 72 69 67 69 6e  0d 20 3a 47 20 20 20 20  |l origin. :G    |
0000b420  20 20 20 20 41 44 44 20  20 20 20 20 72 33 2c 20  |    ADD     r3, |
0000b430  72 33 2c 20 72 34 20 20  20 20 20 20 20 20 20 20  |r3, r4          |
0000b440  20 20 20 20 3b 20 53 65  74 20 74 68 65 20 68 6f  |    ; Set the ho|
0000b450  72 69 7a 6f 6e 74 61 6c  20 6f 72 69 67 69 6e 0d  |rizontal origin.|
0000b460  20 44 4b 20 20 20 20 20  20 20 20 4c 44 52 42 20  | DK        LDRB |
0000b470  20 20 20 72 34 2c 20 5b  72 31 32 2c 20 23 77 73  |   r4, [r12, #ws|
0000b480  5f 70 74 72 5f 62 6c 6f  63 6b 5f 61 63 74 69 76  |_ptr_block_activ|
0000b490  65 79 5d 3b 20 52 65 61  64 20 76 65 72 74 69 63  |ey]; Read vertic|
0000b4a0  61 6c 20 68 6f 74 73 70  6f 74 0d 20 4e 45 20 20  |al hotspot. NE  |
0000b4b0  20 20 20 20 20 20 41 44  44 20 20 20 20 20 72 31  |      ADD     r1|
0000b4c0  2c 20 72 31 2c 20 72 34  20 20 20 20 20 20 20 20  |, r1, r4        |
0000b4d0  20 20 20 20 20 20 3b 20  53 65 74 20 74 68 65 20  |      ; Set the |
0000b4e0  76 65 72 74 69 63 61 6c  20 6f 72 69 67 69 6e 0d  |vertical origin.|
0000b4f0  20 58 4f 20 20 20 20 20  20 20 20 43 4d 50 20 20  | XO        CMP  |
0000b500  20 20 20 72 32 2c 20 72  33 20 20 20 20 20 20 20  |   r2, r3       |
0000b510  20 20 20 20 20 20 20 20  20 20 20 3b 20 50 6c 61  |           ; Pla|
0000b520  63 65 20 6c 69 6d 69 74  73 20 69 6e 20 74 68 65  |ce limits in the|
0000b530  20 63 6f 72 72 65 63 74  20 6f 72 64 65 72 0d 20  | correct order. |
0000b540  62 43 20 20 20 20 20 20  20 20 4d 4f 56 47 54 20  |bC        MOVGT |
0000b550  20 20 72 34 2c 20 72 32  20 20 20 20 20 20 20 20  |  r4, r2        |
0000b560  20 20 20 20 20 20 20 20  20 20 3b 20 4d 61 6b 65  |          ; Make|
0000b570  20 61 20 74 65 6d 70 6f  72 61 72 79 20 63 6f 70  | a temporary cop|
0000b580  79 0d 20 6c 3d 20 20 20  20 20 20 20 20 4d 4f 56  |y. l=        MOV|
0000b590  47 54 20 20 20 72 32 2c  20 72 33 20 20 20 20 20  |GT   r2, r3     |
0000b5a0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 53  |             ; S|
0000b5b0  77 61 70 20 74 68 65 20  6c 69 6d 69 74 73 0d 20  |wap the limits. |
0000b5c0  76 4b 20 20 20 20 20 20  20 20 4d 4f 56 47 54 20  |vK        MOVGT |
0000b5d0  20 20 72 33 2c 20 72 34  20 20 20 20 20 20 20 20  |  r3, r4        |
0000b5e0  20 20 20 20 20 20 20 20  20 20 3b 20 43 6f 70 79  |          ; Copy|
0000b5f0  20 74 68 65 20 74 65 6d  70 6f 72 61 72 79 20 76  | the temporary v|
0000b600  61 6c 75 65 20 62 61 63  6b 0d 20 80 43 20 20 20  |alue back. .C   |
0000b610  20 20 20 20 20 43 4d 50  20 20 20 20 20 72 31 2c  |     CMP     r1,|
0000b620  20 23 30 20 20 20 20 20  20 20 20 20 20 20 20 20  | #0             |
0000b630  20 20 20 20 20 3b 20 43  68 65 63 6b 20 6c 6f 77  |     ; Check low|
0000b640  65 72 20 72 6f 77 20 6c  69 6d 69 74 0d 20 8a 4d  |er row limit. .M|
0000b650  20 20 20 20 20 20 20 20  42 4c 54 20 20 20 20 20  |        BLT     |
0000b660  70 6c 6f 74 5f 72 6f 77  5f 64 6f 6e 65 20 20 20  |plot_row_done   |
0000b670  20 20 20 20 20 20 20 20  3b 20 4e 6f 20 70 6c 6f  |        ; No plo|
0000b680  74 74 69 6e 67 20 69 66  20 62 65 66 6f 72 65 20  |tting if before |
0000b690  66 69 72 73 74 20 72 6f  77 0d 20 94 43 20 20 20  |first row. .C   |
0000b6a0  20 20 20 20 20 43 4d 50  20 20 20 20 20 72 31 2c  |     CMP     r1,|
0000b6b0  20 23 33 31 20 20 20 20  20 20 20 20 20 20 20 20  | #31            |
0000b6c0  20 20 20 20 20 3b 20 43  68 65 63 6b 20 75 70 70  |     ; Check upp|
0000b6d0  65 72 20 72 6f 77 20 6c  69 6d 69 74 0d 20 9e 4b  |er row limit. .K|
0000b6e0  20 20 20 20 20 20 20 20  42 47 54 20 20 20 20 20  |        BGT     |
0000b6f0  70 6c 6f 74 5f 72 6f 77  5f 64 6f 6e 65 20 20 20  |plot_row_done   |
0000b700  20 20 20 20 20 20 20 20  3b 20 4e 6f 20 70 6c 6f  |        ; No plo|
0000b710  74 74 69 6e 67 20 69 66  20 61 66 74 65 72 20 6c  |tting if after l|
0000b720  61 73 74 20 72 6f 77 0d  20 a8 4e 20 20 20 20 20  |ast row. .N     |
0000b730  20 20 20 42 4c 20 20 20  20 20 20 63 6f 6c 6f 75  |   BL      colou|
0000b740  72 5f 65 78 70 61 6e 64  20 20 20 20 20 20 20 20  |r_expand        |
0000b750  20 20 20 3b 20 45 78 70  61 6e 64 20 74 68 65 20  |   ; Expand the |
0000b760  63 6f 6c 6f 75 72 20 74  6f 20 66 69 6c 6c 20 61  |colour to fill a|
0000b770  20 77 6f 72 64 0d 20 b2  47 20 20 20 20 20 20 20  | word. .G       |
0000b780  20 54 53 54 20 20 20 20  20 72 31 2c 20 23 31 20  | TST     r1, #1 |
0000b790  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000b7a0  20 3b 20 49 73 20 69 74  20 61 6e 20 6f 64 64 20  | ; Is it an odd |
0000b7b0  6e 75 6d 62 65 72 65 64  20 72 6f 77 0d 20 bc 4c  |numbered row. .L|
0000b7c0  20 20 20 20 20 20 20 20  4d 4f 56 4e 45 20 20 20  |        MOVNE   |
0000b7d0  72 30 2c 20 72 30 2c 20  52 4f 52 23 32 20 20 20  |r0, r0, ROR#2   |
0000b7e0  20 20 20 20 20 20 20 20  3b 20 52 6f 74 61 74 65  |        ; Rotate|
0000b7f0  20 63 6f 6c 6f 75 72 20  70 61 74 74 65 72 6e 20  | colour pattern |
0000b800  69 66 20 69 74 20 69 73  0d 20 c6 41 20 20 20 20  |if it is. .A    |
0000b810  20 20 20 20 41 44 44 20  20 20 20 20 72 34 2c 20  |    ADD     r4, |
0000b820  72 31 32 2c 20 72 31 2c  20 41 53 4c 23 33 20 20  |r12, r1, ASL#3  |
0000b830  20 20 20 20 3b 20 43 61  6c 63 75 6c 61 74 65 20  |    ; Calculate |
0000b840  72 6f 77 20 73 74 61 72  74 0d 20 d0 47 20 20 20  |row start. .G   |
0000b850  20 20 20 20 20 41 44 44  20 20 20 20 20 72 34 2c  |     ADD     r4,|
0000b860  20 72 34 2c 20 23 77 73  5f 70 74 72 5f 64 61 74  | r4, #ws_ptr_dat|
0000b870  61 20 20 20 20 3b 20 49  6e 63 6c 75 64 65 20 64  |a    ; Include d|
0000b880  61 74 61 20 73 74 61 72  74 20 6f 66 66 73 65 74  |ata start offset|
0000b890  0d 20 da 4a 20 20 20 20  20 20 20 20 4c 44 52 20  |. .J        LDR |
0000b8a0  20 20 20 20 72 31 2c 20  5b 72 34 5d 20 20 20 20  |    r1, [r4]    |
0000b8b0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 52 65  |            ; Re|
0000b8c0  61 64 20 74 68 65 20 65  78 69 73 74 69 6e 67 20  |ad the existing |
0000b8d0  66 69 72 73 74 20 77 6f  72 64 0d 20 e4 44 20 20  |first word. .D  |
0000b8e0  20 20 20 20 20 20 42 4c  20 20 20 20 20 20 70 6c  |      BL      pl|
0000b8f0  6f 74 5f 72 6f 77 5f 77  6f 72 64 20 20 20 20 20  |ot_row_word     |
0000b900  20 20 20 20 20 20 3b 20  50 72 6f 63 65 73 73 20  |      ; Process |
0000b910  74 68 65 20 66 69 72 73  74 20 77 6f 72 64 0d 20  |the first word. |
0000b920  ee 4a 20 20 20 20 20 20  20 20 53 54 52 20 20 20  |.J        STR   |
0000b930  20 20 72 31 2c 20 5b 72  34 5d 20 20 20 20 20 20  |  r1, [r4]      |
0000b940  20 20 20 20 20 20 20 20  20 20 3b 20 53 74 6f 72  |          ; Stor|
0000b950  65 20 74 68 65 20 75 70  64 61 74 65 64 20 66 69  |e the updated fi|
0000b960  72 73 74 20 77 6f 72 64  0d 20 f8 47 20 20 20 20  |rst word. .G    |
0000b970  20 20 20 20 53 55 42 20  20 20 20 20 72 32 2c 20  |    SUB     r2, |
0000b980  72 32 2c 20 23 31 36 20  20 20 20 20 20 20 20 20  |r2, #16         |
0000b990  20 20 20 20 3b 20 41 64  6a 75 73 74 20 74 68 65  |    ; Adjust the|
0000b9a0  20 73 74 61 72 74 20 70  6f 73 69 74 69 6f 6e 0d  | start position.|
0000b9b0  21 02 45 20 20 20 20 20  20 20 20 53 55 42 20 20  |!.E        SUB  |
0000b9c0  20 20 20 72 33 2c 20 72  33 2c 20 23 31 36 20 20  |   r3, r3, #16  |
0000b9d0  20 20 20 20 20 20 20 20  20 20 20 3b 20 41 64 6a  |           ; Adj|
0000b9e0  75 73 74 20 74 68 65 20  65 6e 64 20 70 6f 73 69  |ust the end posi|
0000b9f0  74 69 6f 6e 0d 21 0c 4b  20 20 20 20 20 20 20 20  |tion.!.K        |
0000ba00  4c 44 52 20 20 20 20 20  72 31 2c 20 5b 72 34 2c  |LDR     r1, [r4,|
0000ba10  20 23 34 5d 21 20 20 20  20 20 20 20 20 20 20 20  | #4]!           |
0000ba20  3b 20 52 65 61 64 20 74  68 65 20 65 78 69 73 74  |; Read the exist|
0000ba30  69 6e 67 20 73 65 63 6f  6e 64 20 77 6f 72 64 0d  |ing second word.|
0000ba40  21 16 45 20 20 20 20 20  20 20 20 42 4c 20 20 20  |!.E        BL   |
0000ba50  20 20 20 70 6c 6f 74 5f  72 6f 77 5f 77 6f 72 64  |   plot_row_word|
0000ba60  20 20 20 20 20 20 20 20  20 20 20 3b 20 50 72 6f  |           ; Pro|
0000ba70  63 65 73 73 20 74 68 65  20 73 65 63 6f 6e 64 20  |cess the second |
0000ba80  77 6f 72 64 0d 21 20 4b  20 20 20 20 20 20 20 20  |word.! K        |
0000ba90  53 54 52 20 20 20 20 20  72 31 2c 20 5b 72 34 5d  |STR     r1, [r4]|
0000baa0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000bab0  3b 20 53 74 6f 72 65 20  74 68 65 20 75 70 64 61  |; Store the upda|
0000bac0  74 65 64 20 73 65 63 6f  6e 64 20 77 6f 72 64 0d  |ted second word.|
0000bad0  21 2a 12 2e 70 6c 6f 74  5f 72 6f 77 5f 64 6f 6e  |!*..plot_row_don|
0000bae0  65 0d 21 34 44 20 20 20  20 20 20 20 20 4c 44 4d  |e.!4D        LDM|
0000baf0  46 44 20 20 20 72 31 33  21 2c 20 7b 72 30 2d 72  |FD   r13!, {r0-r|
0000bb00  34 2c 20 70 63 7d 20 20  20 20 20 20 20 3b 20 52  |4, pc}       ; R|
0000bb10  65 74 75 72 6e 20 66 72  6f 6d 20 73 75 62 72 6f  |eturn from subro|
0000bb20  75 74 69 6e 65 0d 21 3e  12 2e 70 6c 6f 74 5f 72  |utine.!>..plot_r|
0000bb30  6f 77 5f 77 6f 72 64 0d  21 48 3d 20 20 20 20 20  |ow_word.!H=     |
0000bb40  20 20 20 53 54 4d 46 44  20 20 20 72 31 33 21 2c  |   STMFD   r13!,|
0000bb50  20 7b 72 32 2d 72 34 2c  20 72 31 34 7d 20 20 20  | {r2-r4, r14}   |
0000bb60  20 20 20 3b 20 53 74 61  63 6b 20 72 65 67 69 73  |   ; Stack regis|
0000bb70  74 65 72 73 0d 21 52 45  20 20 20 20 20 20 20 20  |ters.!RE        |
0000bb80  43 4d 50 20 20 20 20 20  72 32 2c 20 23 30 20 20  |CMP     r2, #0  |
0000bb90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000bba0  3b 20 52 61 6e 67 65 20  63 68 65 63 6b 20 6c 6f  |; Range check lo|
0000bbb0  77 65 72 20 6c 69 6d 69  74 0d 21 5c 44 20 20 20  |wer limit.!\D   |
0000bbc0  20 20 20 20 20 4d 4f 56  4c 54 20 20 20 72 32 2c  |     MOVLT   r2,|
0000bbd0  20 23 30 20 20 20 20 20  20 20 20 20 20 20 20 20  | #0             |
0000bbe0  20 20 20 20 20 3b 20 53  74 61 72 74 20 66 72 6f  |     ; Start fro|
0000bbf0  6d 20 66 69 72 73 74 20  70 69 78 65 6c 0d 21 66  |m first pixel.!f|
0000bc00  45 20 20 20 20 20 20 20  20 43 4d 50 20 20 20 20  |E        CMP    |
0000bc10  20 72 33 2c 20 23 31 35  20 20 20 20 20 20 20 20  | r3, #15        |
0000bc20  20 20 20 20 20 20 20 20  20 3b 20 52 61 6e 67 65  |         ; Range|
0000bc30  20 63 68 65 63 6b 20 75  70 70 65 72 20 6c 69 6d  | check upper lim|
0000bc40  69 74 0d 21 70 43 20 20  20 20 20 20 20 20 4d 4f  |it.!pC        MO|
0000bc50  56 47 54 20 20 20 72 33  2c 20 23 31 35 20 20 20  |VGT   r3, #15   |
0000bc60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
0000bc70  45 6e 64 20 61 74 20 74  68 65 20 6c 61 73 74 20  |End at the last |
0000bc80  70 69 78 65 6c 0d 21 7a  4d 20 20 20 20 20 20 20  |pixel.!zM       |
0000bc90  20 53 55 42 20 20 20 20  20 72 33 2c 20 72 33 2c  | SUB     r3, r3,|
0000bca0  20 72 32 20 20 20 20 20  20 20 20 20 20 20 20 20  | r2             |
0000bcb0  20 3b 20 44 69 66 66 65  72 65 6e 63 65 20 62 65  | ; Difference be|
0000bcc0  74 77 65 65 6e 20 74 68  65 20 74 77 6f 20 65 6e  |tween the two en|
0000bcd0  64 73 0d 21 84 49 20 20  20 20 20 20 20 20 41 44  |ds.!.I        AD|
0000bce0  44 20 20 20 20 20 72 33  2c 20 72 33 2c 20 23 31  |D     r3, r3, #1|
0000bcf0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
0000bd00  43 6f 6e 76 65 72 74 20  74 6f 20 6e 75 6d 62 65  |Convert to numbe|
0000bd10  72 20 6f 66 20 70 69 78  65 6c 73 0d 21 8e 47 20  |r of pixels.!.G |
0000bd20  20 20 20 20 20 20 20 4d  4f 56 20 20 20 20 20 72  |       MOV     r|
0000bd30  34 2c 20 72 32 2c 20 41  53 4c 23 31 20 20 20 20  |4, r2, ASL#1    |
0000bd40  20 20 20 20 20 20 20 3b  20 43 6f 6e 76 65 72 74  |       ; Convert|
0000bd50  20 73 74 61 72 74 20 74  6f 20 72 6f 74 61 74 69  | start to rotati|
0000bd60  6f 6e 0d 21 98 45 20 20  20 20 20 20 20 20 4d 4f  |on.!.E        MO|
0000bd70  56 20 20 20 20 20 72 32  2c 20 23 33 20 20 20 20  |V     r2, #3    |
0000bd80  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
0000bd90  4d 61 73 6b 20 66 6f 72  20 61 20 73 69 6e 67 6c  |Mask for a singl|
0000bda0  65 20 70 69 78 65 6c 0d  21 a2 4f 20 20 20 20 20  |e pixel.!.O     |
0000bdb0  20 20 20 4d 4f 56 20 20  20 20 20 72 32 2c 20 72  |   MOV     r2, r|
0000bdc0  32 2c 20 4c 53 4c 20 72  34 20 20 20 20 20 20 20  |2, LSL r4       |
0000bdd0  20 20 20 3b 20 4d 61 73  6b 20 66 6f 72 20 74 68  |   ; Mask for th|
0000bde0  65 20 66 69 72 73 74 20  70 69 78 65 6c 20 70 6f  |e first pixel po|
0000bdf0  73 69 74 69 6f 6e 0d 21  ac 45 20 20 20 20 20 20  |sition.!.E      |
0000be00  20 20 4d 4f 56 20 20 20  20 20 72 34 2c 20 23 30  |  MOV     r4, #0|
0000be10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000be20  20 20 3b 20 4e 6f 20 70  69 78 65 6c 73 20 73 65  |  ; No pixels se|
0000be30  74 20 69 6e 69 74 69 61  6c 6c 79 0d 21 b6 17 2e  |t initially.!...|
0000be40  70 6c 6f 74 5f 72 6f 77  5f 77 6f 72 64 5f 6c 6f  |plot_row_word_lo|
0000be50  6f 70 0d 21 c0 48 20 20  20 20 20 20 20 20 53 55  |op.!.H        SU|
0000be60  42 53 20 20 20 20 72 33  2c 20 72 33 2c 20 23 31  |BS    r3, r3, #1|
0000be70  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
0000be80  44 65 63 72 65 6d 65 6e  74 20 6e 75 6d 62 65 72  |Decrement number|
0000be90  20 6f 66 20 70 69 78 65  6c 73 0d 21 ca 49 20 20  | of pixels.!.I  |
0000bea0  20 20 20 20 20 20 42 4d  49 20 20 20 20 20 70 6c  |      BMI     pl|
0000beb0  6f 74 5f 72 6f 77 5f 77  6f 72 64 5f 64 6f 6e 65  |ot_row_word_done|
0000bec0  20 20 20 20 20 20 3b 20  45 73 63 61 70 65 20 74  |      ; Escape t|
0000bed0  68 65 20 6c 6f 6f 70 20  69 66 20 66 69 6e 69 73  |he loop if finis|
0000bee0  68 65 64 0d 21 d4 4b 20  20 20 20 20 20 20 20 84  |hed.!.K        .|
0000bef0  52 20 20 20 20 20 72 34  2c 20 72 34 2c 20 72 32  |R     r4, r4, r2|
0000bf00  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
0000bf10  49 6e 63 6c 75 64 65 20  74 68 69 73 20 70 69 78  |Include this pix|
0000bf20  65 6c 20 69 6e 20 74 68  65 20 6d 61 73 6b 0d 21  |el in the mask.!|
0000bf30  de 47 20 20 20 20 20 20  20 20 4d 4f 56 20 20 20  |.G        MOV   |
0000bf40  20 20 72 32 2c 20 72 32  2c 20 4c 53 4c 23 32 20  |  r2, r2, LSL#2 |
0000bf50  20 20 20 20 20 20 20 20  20 20 3b 20 41 64 76 61  |          ; Adva|
0000bf60  6e 63 65 20 74 6f 20 74  68 65 20 6e 65 78 74 20  |nce to the next |
0000bf70  70 69 78 65 6c 0d 21 e8  45 20 20 20 20 20 20 20  |pixel.!.E       |
0000bf80  20 42 20 20 20 20 20 20  20 70 6c 6f 74 5f 72 6f  | B       plot_ro|
0000bf90  77 5f 77 6f 72 64 5f 6c  6f 6f 70 20 20 20 20 20  |w_word_loop     |
0000bfa0  20 3b 20 4c 6f 6f 70 20  66 6f 72 20 74 68 65 20  | ; Loop for the |
0000bfb0  6e 65 78 74 20 70 69 78  65 6c 0d 21 f2 17 2e 70  |next pixel.!...p|
0000bfc0  6c 6f 74 5f 72 6f 77 5f  77 6f 72 64 5f 64 6f 6e  |lot_row_word_don|
0000bfd0  65 0d 21 fc 41 20 20 20  20 20 20 20 20 42 49 43  |e.!.A        BIC|
0000bfe0  20 20 20 20 20 72 31 2c  20 72 31 2c 20 72 34 20  |     r1, r1, r4 |
0000bff0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 43  |             ; C|
0000c000  6c 65 61 72 20 70 69 78  65 6c 73 20 74 6f 20 73  |lear pixels to s|
0000c010  65 74 0d 22 06 3b 20 20  20 20 20 20 20 20 80 20  |et.".;        . |
0000c020  20 20 20 20 72 34 2c 20  72 34 2c 20 72 30 20 20  |    r4, r4, r0  |
0000c030  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 43 6f  |            ; Co|
0000c040  6c 6f 75 72 20 74 68 65  20 6d 61 73 6b 0d 22 10  |lour the mask.".|
0000c050  4f 20 20 20 20 20 20 20  20 84 52 20 20 20 20 20  |O        .R     |
0000c060  72 31 2c 20 72 31 2c 20  72 34 20 20 20 20 20 20  |r1, r1, r4      |
0000c070  20 20 20 20 20 20 20 20  3b 20 49 6e 63 6c 75 64  |        ; Includ|
0000c080  65 20 74 68 65 20 6e 65  77 20 70 69 78 65 6c 73  |e the new pixels|
0000c090  20 69 6e 20 74 68 65 20  77 6f 72 64 0d 22 1a 44  | in the word.".D|
0000c0a0  20 20 20 20 20 20 20 20  4c 44 4d 46 44 20 20 20  |        LDMFD   |
0000c0b0  72 31 33 21 2c 20 7b 72  32 2d 72 34 2c 20 70 63  |r13!, {r2-r4, pc|
0000c0c0  7d 20 20 20 20 20 20 20  3b 20 52 65 74 75 72 6e  |}       ; Return|
0000c0d0  20 66 72 6f 6d 20 73 75  62 72 6f 75 74 69 6e 65  | from subroutine|
0000c0e0  0d 22 24 04 0d 22 2e 3a  20 20 20 20 20 20 20 20  |."$..".:        |
0000c0f0  3b 20 50 6c 6f 74 20 61  20 73 69 6e 67 6c 65 20  |; Plot a single |
0000c100  70 6f 69 6e 74 20 69 6e  20 63 6f 6c 6f 75 72 20  |point in colour |
0000c110  72 30 20 61 74 20 28 72  32 2c 20 72 31 29 0d 22  |r0 at (r2, r1)."|
0000c120  38 0f 2e 70 6c 6f 74 5f  70 6f 69 6e 74 0d 22 42  |8..plot_point."B|
0000c130  3d 20 20 20 20 20 20 20  20 53 54 4d 46 44 20 20  |=        STMFD  |
0000c140  20 72 31 33 21 2c 20 7b  72 30 2d 72 33 2c 20 72  | r13!, {r0-r3, r|
0000c150  31 34 7d 20 20 20 20 20  20 3b 20 53 74 61 63 6b  |14}      ; Stack|
0000c160  20 72 65 67 69 73 74 65  72 73 0d 22 4c 4d 20 20  | registers."LM  |
0000c170  20 20 20 20 20 20 4c 44  52 42 20 20 20 20 72 33  |      LDRB    r3|
0000c180  2c 20 5b 72 31 32 2c 20  23 77 73 5f 70 74 72 5f  |, [r12, #ws_ptr_|
0000c190  62 6c 6f 63 6b 5f 61 63  74 69 76 65 78 5d 3b 20  |block_activex]; |
0000c1a0  52 65 61 64 20 68 6f 72  69 7a 6f 6e 74 61 6c 20  |Read horizontal |
0000c1b0  68 6f 74 73 70 6f 74 0d  22 56 47 20 20 20 20 20  |hotspot."VG     |
0000c1c0  20 20 20 41 44 44 20 20  20 20 20 72 32 2c 20 72  |   ADD     r2, r|
0000c1d0  32 2c 20 72 33 20 20 20  20 20 20 20 20 20 20 20  |2, r3           |
0000c1e0  20 20 20 3b 20 53 65 74  20 74 68 65 20 68 6f 72  |   ; Set the hor|
0000c1f0  69 7a 6f 6e 74 61 6c 20  6f 72 69 67 69 6e 0d 22  |izontal origin."|
0000c200  60 4b 20 20 20 20 20 20  20 20 4c 44 52 42 20 20  |`K        LDRB  |
0000c210  20 20 72 33 2c 20 5b 72  31 32 2c 20 23 77 73 5f  |  r3, [r12, #ws_|
0000c220  70 74 72 5f 62 6c 6f 63  6b 5f 61 63 74 69 76 65  |ptr_block_active|
0000c230  79 5d 3b 20 52 65 61 64  20 76 65 72 74 69 63 61  |y]; Read vertica|
0000c240  6c 20 68 6f 74 73 70 6f  74 0d 22 6a 45 20 20 20  |l hotspot."jE   |
0000c250  20 20 20 20 20 41 44 44  20 20 20 20 20 72 31 2c  |     ADD     r1,|
0000c260  20 72 31 2c 20 72 33 20  20 20 20 20 20 20 20 20  | r1, r3         |
0000c270  20 20 20 20 20 3b 20 53  65 74 20 74 68 65 20 76  |     ; Set the v|
0000c280  65 72 74 69 63 61 6c 20  6f 72 69 67 69 6e 0d 22  |ertical origin."|
0000c290  74 43 20 20 20 20 20 20  20 20 43 4d 50 20 20 20  |tC        CMP   |
0000c2a0  20 20 72 31 2c 20 23 30  20 20 20 20 20 20 20 20  |  r1, #0        |
0000c2b0  20 20 20 20 20 20 20 20  20 20 3b 20 43 68 65 63  |          ; Chec|
0000c2c0  6b 20 6c 6f 77 65 72 20  72 6f 77 20 6c 69 6d 69  |k lower row limi|
0000c2d0  74 0d 22 7e 46 20 20 20  20 20 20 20 20 43 4d 50  |t."~F        CMP|
0000c2e0  47 45 20 20 20 72 32 2c  20 23 30 20 20 20 20 20  |GE   r2, #0     |
0000c2f0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 43  |             ; C|
0000c300  68 65 63 6b 20 6c 6f 77  65 72 20 63 6f 6c 75 6d  |heck lower colum|
0000c310  6e 20 6c 69 6d 69 74 0d  22 88 50 20 20 20 20 20  |n limit.".P     |
0000c320  20 20 20 42 4c 54 20 20  20 20 20 70 6c 6f 74 5f  |   BLT     plot_|
0000c330  70 6f 69 6e 74 5f 64 6f  6e 65 20 20 20 20 20 20  |point_done      |
0000c340  20 20 20 3b 20 4e 6f 20  70 6c 6f 74 74 69 6e 67  |   ; No plotting|
0000c350  20 69 66 20 62 65 6c 6f  77 20 76 69 73 69 62 6c  | if below visibl|
0000c360  65 20 72 61 6e 67 65 0d  22 92 43 20 20 20 20 20  |e range.".C     |
0000c370  20 20 20 43 4d 50 20 20  20 20 20 72 31 2c 20 23  |   CMP     r1, #|
0000c380  33 31 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |31              |
0000c390  20 20 20 3b 20 43 68 65  63 6b 20 75 70 70 65 72  |   ; Check upper|
0000c3a0  20 72 6f 77 20 6c 69 6d  69 74 0d 22 9c 46 20 20  | row limit.".F  |
0000c3b0  20 20 20 20 20 20 43 4d  50 4c 45 20 20 20 72 32  |      CMPLE   r2|
0000c3c0  2c 20 23 33 31 20 20 20  20 20 20 20 20 20 20 20  |, #31           |
0000c3d0  20 20 20 20 20 20 3b 20  43 68 65 63 6b 20 75 70  |      ; Check up|
0000c3e0  70 65 72 20 63 6f 6c 75  6d 6e 20 6c 69 6d 69 74  |per column limit|
0000c3f0  0d 22 a6 50 20 20 20 20  20 20 20 20 42 47 54 20  |.".P        BGT |
0000c400  20 20 20 20 70 6c 6f 74  5f 70 6f 69 6e 74 5f 64  |    plot_point_d|
0000c410  6f 6e 65 20 20 20 20 20  20 20 20 20 3b 20 4e 6f  |one         ; No|
0000c420  20 70 6c 6f 74 74 69 6e  67 20 69 66 20 61 62 6f  | plotting if abo|
0000c430  76 65 20 76 69 73 69 62  6c 65 20 72 61 6e 67 65  |ve visible range|
0000c440  0d 22 b0 4e 20 20 20 20  20 20 20 20 42 4c 20 20  |.".N        BL  |
0000c450  20 20 20 20 63 6f 6c 6f  75 72 5f 65 78 70 61 6e  |    colour_expan|
0000c460  64 20 20 20 20 20 20 20  20 20 20 20 3b 20 45 78  |d           ; Ex|
0000c470  70 61 6e 64 20 74 68 65  20 63 6f 6c 6f 75 72 20  |pand the colour |
0000c480  74 6f 20 66 69 6c 6c 20  61 20 77 6f 72 64 0d 22  |to fill a word."|
0000c490  ba 47 20 20 20 20 20 20  20 20 54 53 54 20 20 20  |.G        TST   |
0000c4a0  20 20 72 31 2c 20 23 31  20 20 20 20 20 20 20 20  |  r1, #1        |
0000c4b0  20 20 20 20 20 20 20 20  20 20 3b 20 49 73 20 69  |          ; Is i|
0000c4c0  74 20 61 6e 20 6f 64 64  20 6e 75 6d 62 65 72 65  |t an odd numbere|
0000c4d0  64 20 72 6f 77 0d 22 c4  4c 20 20 20 20 20 20 20  |d row.".L       |
0000c4e0  20 4d 4f 56 4e 45 20 20  20 72 30 2c 20 72 30 2c  | MOVNE   r0, r0,|
0000c4f0  20 52 4f 52 23 32 20 20  20 20 20 20 20 20 20 20  | ROR#2          |
0000c500  20 3b 20 52 6f 74 61 74  65 20 63 6f 6c 6f 75 72  | ; Rotate colour|
0000c510  20 70 61 74 74 65 72 6e  20 69 66 20 69 74 20 69  | pattern if it i|
0000c520  73 0d 22 ce 41 20 20 20  20 20 20 20 20 41 44 44  |s.".A        ADD|
0000c530  20 20 20 20 20 72 31 2c  20 72 31 32 2c 20 72 31  |     r1, r12, r1|
0000c540  2c 20 41 53 4c 23 33 20  20 20 20 20 20 3b 20 43  |, ASL#3      ; C|
0000c550  61 6c 63 75 6c 61 74 65  20 72 6f 77 20 73 74 61  |alculate row sta|
0000c560  72 74 0d 22 d8 47 20 20  20 20 20 20 20 20 41 44  |rt.".G        AD|
0000c570  44 20 20 20 20 20 72 31  2c 20 72 31 2c 20 23 77  |D     r1, r1, #w|
0000c580  73 5f 70 74 72 5f 64 61  74 61 20 20 20 20 3b 20  |s_ptr_data    ; |
0000c590  49 6e 63 6c 75 64 65 20  64 61 74 61 20 73 74 61  |Include data sta|
0000c5a0  72 74 20 6f 66 66 73 65  74 0d 22 e2 4c 20 20 20  |rt offset.".L   |
0000c5b0  20 20 20 20 20 54 53 54  20 20 20 20 20 72 32 2c  |     TST     r2,|
0000c5c0  20 23 26 31 30 20 20 20  20 20 20 20 20 20 20 20  | #&10           |
0000c5d0  20 20 20 20 20 3b 20 53  68 6f 75 6c 64 20 74 68  |     ; Should th|
0000c5e0  65 20 73 65 63 6f 6e 64  20 77 6f 72 64 20 62 65  |e second word be|
0000c5f0  20 75 73 65 64 0d 22 ec  42 20 20 20 20 20 20 20  | used.".B       |
0000c600  20 41 44 44 4e 45 20 20  20 72 31 2c 20 72 31 2c  | ADDNE   r1, r1,|
0000c610  20 23 34 20 20 20 20 20  20 20 20 20 20 20 20 20  | #4             |
0000c620  20 3b 20 41 64 76 61 6e  63 65 20 69 66 20 69 74  | ; Advance if it|
0000c630  20 73 68 6f 75 6c 64 0d  22 f6 41 20 20 20 20 20  | should.".A     |
0000c640  20 20 20 80 20 20 20 20  20 72 32 2c 20 72 32 2c  |   .     r2, r2,|
0000c650  20 23 26 66 20 20 20 20  20 20 20 20 20 20 20 20  | #&f            |
0000c660  20 3b 20 50 69 78 65 6c  20 77 69 74 68 69 6e 20  | ; Pixel within |
0000c670  74 68 65 20 77 6f 72 64  0d 23 00 43 20 20 20 20  |the word.#.C    |
0000c680  20 20 20 20 41 44 44 20  20 20 20 20 72 32 2c 20  |    ADD     r2, |
0000c690  72 32 2c 20 72 32 20 20  20 20 20 20 20 20 20 20  |r2, r2          |
0000c6a0  20 20 20 20 3b 20 43 6f  6e 76 65 72 74 20 74 6f  |    ; Convert to|
0000c6b0  20 61 20 72 6f 74 61 74  69 6f 6e 0d 23 0a 45 20  | a rotation.#.E |
0000c6c0  20 20 20 20 20 20 20 4d  4f 56 20 20 20 20 20 72  |       MOV     r|
0000c6d0  33 2c 20 23 33 20 20 20  20 20 20 20 20 20 20 20  |3, #3           |
0000c6e0  20 20 20 20 20 20 20 3b  20 4d 61 73 6b 20 66 6f  |       ; Mask fo|
0000c6f0  72 20 61 20 73 69 6e 67  6c 65 20 70 69 78 65 6c  |r a single pixel|
0000c700  0d 23 14 4c 20 20 20 20  20 20 20 20 4d 4f 56 20  |.#.L        MOV |
0000c710  20 20 20 20 72 33 2c 20  72 33 2c 20 4c 53 4c 20  |    r3, r3, LSL |
0000c720  72 32 20 20 20 20 20 20  20 20 20 20 3b 20 52 6f  |r2          ; Ro|
0000c730  74 61 74 65 20 74 6f 20  74 68 65 20 63 6f 72 72  |tate to the corr|
0000c740  65 63 74 20 70 6f 73 69  74 69 6f 6e 0d 23 1e 48  |ect position.#.H|
0000c750  20 20 20 20 20 20 20 20  80 20 20 20 20 20 72 30  |        .     r0|
0000c760  2c 20 72 30 2c 20 72 33  20 20 20 20 20 20 20 20  |, r0, r3        |
0000c770  20 20 20 20 20 20 3b 20  4d 61 73 6b 20 6f 75 74  |      ; Mask out|
0000c780  20 74 68 65 20 72 65 71  75 69 72 65 64 20 63 6f  | the required co|
0000c790  6c 6f 75 72 0d 23 28 4a  20 20 20 20 20 20 20 20  |lour.#(J        |
0000c7a0  4c 44 52 20 20 20 20 20  72 32 2c 20 5b 72 31 5d  |LDR     r2, [r1]|
0000c7b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000c7c0  3b 20 52 65 61 64 20 74  68 65 20 65 78 69 73 74  |; Read the exist|
0000c7d0  69 6e 67 20 69 6d 61 67  65 20 77 6f 72 64 0d 23  |ing image word.#|
0000c7e0  32 47 20 20 20 20 20 20  20 20 42 49 43 20 20 20  |2G        BIC   |
0000c7f0  20 20 72 32 2c 20 72 32  2c 20 72 33 20 20 20 20  |  r2, r2, r3    |
0000c800  20 20 20 20 20 20 20 20  20 20 3b 20 43 6c 65 61  |          ; Clea|
0000c810  72 20 74 68 65 20 70 69  78 65 6c 20 74 6f 20 62  |r the pixel to b|
0000c820  65 20 73 65 74 0d 23 3c  44 20 20 20 20 20 20 20  |e set.#<D       |
0000c830  20 84 52 20 20 20 20 20  72 32 2c 20 72 32 2c 20  | .R     r2, r2, |
0000c840  72 30 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r0              |
0000c850  3b 20 53 65 74 20 74 68  65 20 72 65 71 75 69 72  |; Set the requir|
0000c860  65 64 20 63 6f 6c 6f 75  72 0d 23 46 45 20 20 20  |ed colour.#FE   |
0000c870  20 20 20 20 20 53 54 52  20 20 20 20 20 72 32 2c  |     STR     r2,|
0000c880  20 5b 72 31 5d 20 20 20  20 20 20 20 20 20 20 20  | [r1]           |
0000c890  20 20 20 20 20 3b 20 53  74 72 6f 72 65 20 74 68  |     ; Strore th|
0000c8a0  65 20 75 70 64 61 74 65  64 20 77 6f 72 64 0d 23  |e updated word.#|
0000c8b0  50 14 2e 70 6c 6f 74 5f  70 6f 69 6e 74 5f 64 6f  |P..plot_point_do|
0000c8c0  6e 65 0d 23 5a 44 20 20  20 20 20 20 20 20 4c 44  |ne.#ZD        LD|
0000c8d0  4d 46 44 20 20 20 72 31  33 21 2c 20 7b 72 30 2d  |MFD   r13!, {r0-|
0000c8e0  72 33 2c 20 70 63 7d 20  20 20 20 20 20 20 3b 20  |r3, pc}       ; |
0000c8f0  52 65 74 75 72 6e 20 66  72 6f 6d 20 73 75 62 72  |Return from subr|
0000c900  6f 75 74 69 6e 65 0d 23  64 04 0d 23 6e 49 20 20  |outine.#d..#nI  |
0000c910  20 20 20 20 20 20 3b 20  50 6c 6f 74 20 61 20 6d  |      ; Plot a m|
0000c920  69 64 70 6f 69 6e 74 20  6c 69 6e 65 20 69 6e 20  |idpoint line in |
0000c930  63 6f 6c 6f 75 72 20 72  30 20 66 72 6f 6d 20 28  |colour r0 from (|
0000c940  72 32 2c 20 72 31 29 20  74 6f 20 28 72 34 2c 20  |r2, r1) to (r4, |
0000c950  72 33 29 0d 23 78 0e 2e  70 6c 6f 74 5f 6c 69 6e  |r3).#x..plot_lin|
0000c960  65 0d 23 82 3d 20 20 20  20 20 20 20 20 53 54 4d  |e.#.=        STM|
0000c970  46 44 20 20 20 72 31 33  21 2c 20 7b 72 30 2d 72  |FD   r13!, {r0-r|
0000c980  37 2c 20 72 31 34 7d 20  20 20 20 20 20 3b 20 53  |7, r14}      ; S|
0000c990  74 61 63 6b 20 72 65 67  69 73 74 65 72 73 0d 23  |tack registers.#|
0000c9a0  8c 4c 20 20 20 20 20 20  20 20 4d 4f 56 20 20 20  |.L        MOV   |
0000c9b0  20 20 72 35 2c 20 23 30  20 20 20 20 20 20 20 20  |  r5, #0        |
0000c9c0  20 20 20 20 20 20 20 20  20 20 3b 20 53 74 61 72  |          ; Star|
0000c9d0  74 20 77 69 74 68 20 64  65 66 61 75 6c 74 20 63  |t with default c|
0000c9e0  6f 6f 72 64 69 6e 61 74  65 73 0d 23 96 42 20 20  |oordinates.#.B  |
0000c9f0  20 20 20 20 20 20 53 55  42 53 20 20 20 20 72 31  |      SUBS    r1|
0000ca00  2c 20 72 31 2c 20 72 33  20 20 20 20 20 20 20 20  |, r1, r3        |
0000ca10  20 20 20 20 20 20 3b 20  43 68 61 6e 67 65 20 69  |      ; Change i|
0000ca20  6e 20 72 6f 77 20 6e 75  6d 62 65 72 0d 23 a0 4c  |n row number.#.L|
0000ca30  20 20 20 20 20 20 20 20  52 53 42 4d 49 20 20 20  |        RSBMI   |
0000ca40  72 33 2c 20 72 33 2c 20  23 30 20 20 20 20 20 20  |r3, r3, #0      |
0000ca50  20 20 20 20 20 20 20 20  3b 20 52 65 66 6c 65 63  |        ; Reflec|
0000ca60  74 20 73 74 61 72 74 20  70 6f 69 6e 74 20 76 65  |t start point ve|
0000ca70  72 74 69 63 61 6c 6c 79  0d 23 aa 4a 20 20 20 20  |rtically.#.J    |
0000ca80  20 20 20 20 52 53 42 4d  49 20 20 20 72 31 2c 20  |    RSBMI   r1, |
0000ca90  72 31 2c 20 23 30 20 20  20 20 20 20 20 20 20 20  |r1, #0          |
0000caa0  20 20 20 20 3b 20 52 65  66 6c 65 63 74 20 63 68  |    ; Reflect ch|
0000cab0  61 6e 67 65 20 69 6e 20  72 6f 77 20 6e 75 6d 62  |ange in row numb|
0000cac0  65 72 0d 23 b4 41 20 20  20 20 20 20 20 20 84 52  |er.#.A        .R|
0000cad0  4d 49 20 20 20 72 35 2c  20 72 35 2c 20 23 32 20  |MI   r5, r5, #2 |
0000cae0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 52  |             ; R|
0000caf0  65 63 6f 72 64 20 76 65  72 74 69 63 61 6c 20 66  |ecord vertical f|
0000cb00  6c 69 70 0d 23 be 45 20  20 20 20 20 20 20 20 53  |lip.#.E        S|
0000cb10  55 42 53 20 20 20 20 72  32 2c 20 72 32 2c 20 72  |UBS    r2, r2, r|
0000cb20  34 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |4              ;|
0000cb30  20 43 68 61 6e 67 65 20  69 6e 20 63 6f 6c 75 6d  | Change in colum|
0000cb40  6e 20 6e 75 6d 62 65 72  0d 23 c8 4e 20 20 20 20  |n number.#.N    |
0000cb50  20 20 20 20 52 53 42 4d  49 20 20 20 72 34 2c 20  |    RSBMI   r4, |
0000cb60  72 34 2c 20 23 30 20 20  20 20 20 20 20 20 20 20  |r4, #0          |
0000cb70  20 20 20 20 3b 20 52 65  66 6c 65 63 74 20 73 74  |    ; Reflect st|
0000cb80  61 72 74 20 70 6f 69 6e  74 20 68 6f 72 69 7a 6f  |art point horizo|
0000cb90  6e 74 61 6c 6c 79 0d 23  d2 4d 20 20 20 20 20 20  |ntally.#.M      |
0000cba0  20 20 52 53 42 4d 49 20  20 20 72 32 2c 20 72 32  |  RSBMI   r2, r2|
0000cbb0  2c 20 23 30 20 20 20 20  20 20 20 20 20 20 20 20  |, #0            |
0000cbc0  20 20 3b 20 52 65 66 6c  65 63 74 20 63 68 61 6e  |  ; Reflect chan|
0000cbd0  67 65 20 69 6e 20 63 6f  6c 75 6d 6e 20 6e 75 6d  |ge in column num|
0000cbe0  62 65 72 0d 23 dc 43 20  20 20 20 20 20 20 20 84  |ber.#.C        .|
0000cbf0  52 4d 49 20 20 20 72 35  2c 20 72 35 2c 20 23 34  |RMI   r5, r5, #4|
0000cc00  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
0000cc10  52 65 63 6f 72 64 20 68  6f 72 69 7a 6f 6e 74 61  |Record horizonta|
0000cc20  6c 20 66 6c 69 70 0d 23  e6 41 20 20 20 20 20 20  |l flip.#.A      |
0000cc30  20 20 43 4d 50 20 20 20  20 20 72 32 2c 20 72 31  |  CMP     r2, r1|
0000cc40  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000cc50  20 20 3b 20 43 68 65 63  6b 20 73 6c 6f 70 65 20  |  ; Check slope |
0000cc60  6f 66 20 6c 69 6e 65 0d  23 f0 46 20 20 20 20 20  |of line.#.F     |
0000cc70  20 20 20 4d 4f 56 47 54  20 20 20 72 36 2c 20 72  |   MOVGT   r6, r|
0000cc80  33 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |3               |
0000cc90  20 20 20 3b 20 43 6f 70  79 20 6f 72 69 67 69 6e  |   ; Copy origin|
0000cca0  61 6c 20 72 6f 77 20 6e  75 6d 62 65 72 0d 23 fa  |al row number.#.|
0000ccb0  42 20 20 20 20 20 20 20  20 4d 4f 56 47 54 20 20  |B        MOVGT  |
0000ccc0  20 72 33 2c 20 72 34 20  20 20 20 20 20 20 20 20  | r3, r4         |
0000ccd0  20 20 20 20 20 20 20 20  20 3b 20 53 77 61 70 20  |         ; Swap |
0000cce0  72 6f 77 20 77 69 74 68  20 63 6f 6c 75 6d 6e 0d  |row with column.|
0000ccf0  24 04 40 20 20 20 20 20  20 20 20 4d 4f 56 47 54  |$.@        MOVGT|
0000cd00  20 20 20 72 34 2c 20 72  36 20 20 20 20 20 20 20  |   r4, r6       |
0000cd10  20 20 20 20 20 20 20 20  20 20 20 3b 20 53 65 74  |           ; Set|
0000cd20  20 6e 65 77 20 72 6f 77  20 6e 75 6d 62 65 72 0d  | new row number.|
0000cd30  24 0e 46 20 20 20 20 20  20 20 20 4d 4f 56 47 54  |$.F        MOVGT|
0000cd40  20 20 20 72 36 2c 20 72  31 20 20 20 20 20 20 20  |   r6, r1       |
0000cd50  20 20 20 20 20 20 20 20  20 20 20 3b 20 43 6f 70  |           ; Cop|
0000cd60  79 20 6f 72 69 67 69 6e  61 6c 20 72 6f 77 20 63  |y original row c|
0000cd70  68 61 6e 67 65 0d 24 18  42 20 20 20 20 20 20 20  |hange.$.B       |
0000cd80  20 4d 4f 56 47 54 20 20  20 72 31 2c 20 72 32 20  | MOVGT   r1, r2 |
0000cd90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000cda0  20 3b 20 53 77 61 70 20  72 6f 77 20 77 69 74 68  | ; Swap row with|
0000cdb0  20 63 6f 6c 75 6d 6e 0d  24 22 40 20 20 20 20 20  | column.$"@     |
0000cdc0  20 20 20 4d 4f 56 47 54  20 20 20 72 32 2c 20 72  |   MOVGT   r2, r|
0000cdd0  36 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |6               |
0000cde0  20 20 20 3b 20 53 65 74  20 6e 65 77 20 72 6f 77  |   ; Set new row|
0000cdf0  20 63 68 61 6e 67 65 0d  24 2c 47 20 20 20 20 20  | change.$,G     |
0000ce00  20 20 20 84 52 47 54 20  20 20 72 35 2c 20 72 35  |   .RGT   r5, r5|
0000ce10  2c 20 23 31 20 20 20 20  20 20 20 20 20 20 20 20  |, #1            |
0000ce20  20 20 3b 20 52 65 63 6f  72 64 20 63 6f 6f 72 64  |  ; Record coord|
0000ce30  69 6e 61 74 65 20 72 65  76 65 72 73 61 6c 0d 24  |inate reversal.$|
0000ce40  36 47 20 20 20 20 20 20  20 20 41 44 44 20 20 20  |6G        ADD   |
0000ce50  20 20 72 36 2c 20 72 32  2c 20 72 32 20 20 20 20  |  r6, r2, r2    |
0000ce60  20 20 20 20 20 20 20 20  20 20 3b 20 48 6f 72 69  |          ; Hori|
0000ce70  7a 6f 6e 74 61 6c 20 73  74 65 70 20 69 6e 63 72  |zontal step incr|
0000ce80  65 6d 65 6e 74 0d 24 40  4d 20 20 20 20 20 20 20  |ement.$@M       |
0000ce90  20 53 55 42 20 20 20 20  20 72 37 2c 20 72 36 2c  | SUB     r7, r6,|
0000cea0  20 72 31 20 20 20 20 20  20 20 20 20 20 20 20 20  | r1             |
0000ceb0  20 3b 20 49 6e 69 74 69  61 6c 20 64 65 63 69 73  | ; Initial decis|
0000cec0  69 6f 6e 20 76 61 72 69  61 62 6c 65 20 76 61 6c  |ion variable val|
0000ced0  75 65 0d 24 4a 4d 20 20  20 20 20 20 20 20 53 55  |ue.$JM        SU|
0000cee0  42 20 20 20 20 20 72 32  2c 20 72 32 2c 20 72 31  |B     r2, r2, r1|
0000cef0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
0000cf00  48 61 6c 66 20 6f 66 20  64 69 61 67 6f 6e 61 6c  |Half of diagonal|
0000cf10  20 73 74 65 70 20 69 6e  63 72 65 6d 65 6e 74 0d  | step increment.|
0000cf20  24 54 45 20 20 20 20 20  20 20 20 41 44 44 20 20  |$TE        ADD  |
0000cf30  20 20 20 72 32 2c 20 72  32 2c 20 72 32 20 20 20  |   r2, r2, r2   |
0000cf40  20 20 20 20 20 20 20 20  20 20 20 3b 20 44 69 61  |           ; Dia|
0000cf50  67 6f 6e 61 6c 20 73 74  65 70 20 69 6e 63 72 65  |gonal step incre|
0000cf60  6d 65 6e 74 0d 24 5e 45  20 20 20 20 20 20 20 20  |ment.$^E        |
0000cf70  41 44 44 20 20 20 20 20  72 31 2c 20 72 33 2c 20  |ADD     r1, r3, |
0000cf80  72 31 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r1              |
0000cf90  3b 20 54 68 65 20 6c 61  73 74 20 70 6f 69 6e 74  |; The last point|
0000cfa0  20 74 6f 20 70 6c 6f 74  20 0d 24 68 13 2e 70 6c  | to plot .$h..pl|
0000cfb0  6f 74 5f 6c 69 6e 65 5f  6c 6f 6f 70 0d 24 72 4e  |ot_line_loop.$rN|
0000cfc0  20 20 20 20 20 20 20 20  42 4c 20 20 20 20 20 20  |        BL      |
0000cfd0  70 6c 6f 74 5f 6c 69 6e  65 5f 70 6f 69 6e 74 20  |plot_line_point |
0000cfe0  20 20 20 20 20 20 20 20  3b 20 50 6c 6f 74 20 74  |        ; Plot t|
0000cff0  68 65 20 66 69 72 73 74  20 70 6f 69 6e 74 20 6f  |he first point o|
0000d000  66 20 74 68 65 20 6c 69  6e 65 0d 24 7c 48 20 20  |f the line.$|H  |
0000d010  20 20 20 20 20 20 43 4d  50 20 20 20 20 20 72 33  |      CMP     r3|
0000d020  2c 20 72 31 20 20 20 20  20 20 20 20 20 20 20 20  |, r1            |
0000d030  20 20 20 20 20 20 3b 20  48 61 73 20 74 68 65 20  |      ; Has the |
0000d040  6c 69 6e 65 20 62 65 65  6e 20 66 69 6e 69 73 68  |line been finish|
0000d050  65 64 0d 24 86 52 20 20  20 20 20 20 20 20 4c 44  |ed.$.R        LD|
0000d060  4d 47 45 46 44 20 72 31  33 21 2c 20 7b 72 30 2d  |MGEFD r13!, {r0-|
0000d070  72 37 2c 20 70 63 7d 20  20 20 20 20 20 20 3b 20  |r7, pc}       ; |
0000d080  52 65 74 75 72 6e 20 66  72 6f 6d 20 73 75 62 72  |Return from subr|
0000d090  6f 75 74 69 6e 65 20 77  68 65 6e 20 66 69 6e 69  |outine when fini|
0000d0a0  73 68 65 64 0d 24 90 49  20 20 20 20 20 20 20 20  |shed.$.I        |
0000d0b0  43 4d 50 20 20 20 20 20  72 37 2c 20 23 30 20 20  |CMP     r7, #0  |
0000d0c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000d0d0  3b 20 43 68 65 63 6b 20  74 68 65 20 64 65 63 69  |; Check the deci|
0000d0e0  73 69 6f 6e 20 76 61 72  69 61 62 6c 65 0d 24 9a  |sion variable.$.|
0000d0f0  49 20 20 20 20 20 20 20  20 41 44 44 4c 45 20 20  |I        ADDLE  |
0000d100  20 72 37 2c 20 72 37 2c  20 72 36 20 20 20 20 20  | r7, r7, r6     |
0000d110  20 20 20 20 20 20 20 20  20 3b 20 49 6e 63 72 65  |         ; Incre|
0000d120  6d 65 6e 74 20 64 65 63  69 73 69 6f 6e 20 76 61  |ment decision va|
0000d130  72 69 61 62 6c 65 0d 24  a4 49 20 20 20 20 20 20  |riable.$.I      |
0000d140  20 20 41 44 44 47 54 20  20 20 72 37 2c 20 72 37  |  ADDGT   r7, r7|
0000d150  2c 20 72 32 20 20 20 20  20 20 20 20 20 20 20 20  |, r2            |
0000d160  20 20 3b 20 49 6e 63 72  65 6d 65 6e 74 20 64 65  |  ; Increment de|
0000d170  63 69 73 69 6f 6e 20 76  61 72 69 61 62 6c 65 0d  |cision variable.|
0000d180  24 ae 47 20 20 20 20 20  20 20 20 41 44 44 47 54  |$.G        ADDGT|
0000d190  20 20 20 72 34 2c 20 72  34 2c 20 23 31 20 20 20  |   r4, r4, #1   |
0000d1a0  20 20 20 20 20 20 20 20  20 20 20 3b 20 50 65 72  |           ; Per|
0000d1b0  66 6f 72 6d 20 74 68 65  20 64 69 61 67 6f 6e 61  |form the diagona|
0000d1c0  6c 20 73 74 65 70 0d 24  b8 47 20 20 20 20 20 20  |l step.$.G      |
0000d1d0  20 20 41 44 44 20 20 20  20 20 72 33 2c 20 72 33  |  ADD     r3, r3|
0000d1e0  2c 20 23 31 20 20 20 20  20 20 20 20 20 20 20 20  |, #1            |
0000d1f0  20 20 3b 20 41 64 76 61  6e 63 65 20 74 6f 20 74  |  ; Advance to t|
0000d200  68 65 20 6e 65 78 74 20  70 69 78 65 6c 0d 24 c2  |he next pixel.$.|
0000d210  45 20 20 20 20 20 20 20  20 42 20 20 20 20 20 20  |E        B      |
0000d220  20 70 6c 6f 74 5f 6c 69  6e 65 5f 6c 6f 6f 70 20  | plot_line_loop |
0000d230  20 20 20 20 20 20 20 20  20 3b 20 4c 6f 6f 70 20  |         ; Loop |
0000d240  66 6f 72 20 74 68 65 20  6e 65 78 74 20 70 69 78  |for the next pix|
0000d250  65 6c 0d 24 cc 14 2e 70  6c 6f 74 5f 6c 69 6e 65  |el.$...plot_line|
0000d260  5f 70 6f 69 6e 74 0d 24  d6 3d 20 20 20 20 20 20  |_point.$.=      |
0000d270  20 20 53 54 4d 46 44 20  20 20 72 31 33 21 2c 20  |  STMFD   r13!, |
0000d280  7b 72 31 2d 72 32 2c 20  72 31 34 7d 20 20 20 20  |{r1-r2, r14}    |
0000d290  20 20 3b 20 53 74 61 63  6b 20 72 65 67 69 73 74  |  ; Stack regist|
0000d2a0  65 72 73 0d 24 e0 4c 20  20 20 20 20 20 20 20 54  |ers.$.L        T|
0000d2b0  53 54 20 20 20 20 20 72  35 2c 20 23 31 20 20 20  |ST     r5, #1   |
0000d2c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
0000d2d0  20 48 61 76 65 20 63 6f  6f 72 64 69 6e 61 74 65  | Have coordinate|
0000d2e0  73 20 62 65 65 6e 20 72  65 76 65 72 73 65 64 0d  |s been reversed.|
0000d2f0  24 ea 3e 20 20 20 20 20  20 20 20 ec 51 20 20 20  |$.>        .Q   |
0000d300  72 31 2c 20 72 33 20 20  20 20 20 20 20 20 20 20  |r1, r3          |
0000d310  20 20 20 20 20 20 20 20  3b 20 43 6f 70 79 20 75  |        ; Copy u|
0000d320  6e 72 65 76 65 72 73 65  64 20 72 6f 77 0d 24 f4  |nreversed row.$.|
0000d330  41 20 20 20 20 20 20 20  20 ec 51 20 20 20 72 32  |A        .Q   r2|
0000d340  2c 20 72 34 20 20 20 20  20 20 20 20 20 20 20 20  |, r4            |
0000d350  20 20 20 20 20 20 3b 20  43 6f 70 79 20 75 6e 72  |      ; Copy unr|
0000d360  65 76 65 72 73 65 64 20  63 6f 6c 75 6d 6e 0d 24  |eversed column.$|
0000d370  fe 3f 20 20 20 20 20 20  20 20 4d 4f 56 4e 45 20  |.?        MOVNE |
0000d380  20 20 72 31 2c 20 72 34  20 20 20 20 20 20 20 20  |  r1, r4        |
0000d390  20 20 20 20 20 20 20 20  20 20 3b 20 43 6f 70 79  |          ; Copy|
0000d3a0  20 72 65 76 65 72 73 65  64 20 72 6f 77 0d 25 08  | reversed row.%.|
0000d3b0  42 20 20 20 20 20 20 20  20 4d 4f 56 4e 45 20 20  |B        MOVNE  |
0000d3c0  20 72 32 2c 20 72 33 20  20 20 20 20 20 20 20 20  | r2, r3         |
0000d3d0  20 20 20 20 20 20 20 20  20 3b 20 43 6f 70 79 20  |         ; Copy |
0000d3e0  72 65 76 65 72 73 65 64  20 63 6f 6c 75 6d 6e 0d  |reversed column.|
0000d3f0  25 12 42 20 20 20 20 20  20 20 20 54 53 54 20 20  |%.B        TST  |
0000d400  20 20 20 72 35 2c 20 23  32 20 20 20 20 20 20 20  |   r5, #2       |
0000d410  20 20 20 20 20 20 20 20  20 20 20 3b 20 48 61 73  |           ; Has|
0000d420  20 72 6f 77 20 62 65 65  6e 20 6e 65 67 61 74 65  | row been negate|
0000d430  64 0d 25 1c 44 20 20 20  20 20 20 20 20 52 53 42  |d.%.D        RSB|
0000d440  4e 45 20 20 20 72 31 2c  20 72 31 2c 20 23 30 20  |NE   r1, r1, #0 |
0000d450  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 4e  |             ; N|
0000d460  65 67 61 74 65 20 72 6f  77 20 69 66 20 72 65 71  |egate row if req|
0000d470  75 69 72 65 64 0d 25 26  45 20 20 20 20 20 20 20  |uired.%&E       |
0000d480  20 54 53 54 20 20 20 20  20 72 35 2c 20 23 34 20  | TST     r5, #4 |
0000d490  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000d4a0  20 3b 20 48 61 73 20 63  6f 6c 75 6d 6e 20 62 65  | ; Has column be|
0000d4b0  65 6e 20 6e 65 67 61 74  65 64 0d 25 30 47 20 20  |en negated.%0G  |
0000d4c0  20 20 20 20 20 20 52 53  42 4e 45 20 20 20 72 32  |      RSBNE   r2|
0000d4d0  2c 20 72 32 2c 20 23 30  20 20 20 20 20 20 20 20  |, r2, #0        |
0000d4e0  20 20 20 20 20 20 3b 20  4e 65 67 61 74 65 20 63  |      ; Negate c|
0000d4f0  6f 6c 75 6d 6e 20 69 66  20 72 65 71 75 69 72 65  |olumn if require|
0000d500  64 0d 25 3a 3c 20 20 20  20 20 20 20 20 42 4c 20  |d.%:<        BL |
0000d510  20 20 20 20 20 70 6c 6f  74 5f 70 6f 69 6e 74 20  |     plot_point |
0000d520  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 50  |             ; P|
0000d530  6c 6f 74 20 74 68 65 20  70 6f 69 6e 74 0d 25 44  |lot the point.%D|
0000d540  44 20 20 20 20 20 20 20  20 4c 44 4d 46 44 20 20  |D        LDMFD  |
0000d550  20 72 31 33 21 2c 20 7b  72 31 2d 72 32 2c 20 70  | r13!, {r1-r2, p|
0000d560  63 7d 20 20 20 20 20 20  20 3b 20 52 65 74 75 72  |c}       ; Retur|
0000d570  6e 20 66 72 6f 6d 20 73  75 62 72 6f 75 74 69 6e  |n from subroutin|
0000d580  65 0d 25 4e 04 0d 25 58  52 20 20 20 20 20 20 20  |e.%N..%XR       |
0000d590  20 3b 20 50 6c 6f 74 20  61 20 63 6c 6f 73 65 64  | ; Plot a closed|
0000d5a0  20 70 6f 6c 79 6c 69 6e  65 20 69 6e 20 63 6f 6c  | polyline in col|
0000d5b0  6f 75 72 20 72 30 20 75  73 69 6e 67 20 72 31 20  |our r0 using r1 |
0000d5c0  76 65 72 74 69 63 65 73  20 73 74 61 72 74 69 6e  |vertices startin|
0000d5d0  67 20 61 74 20 72 32 0d  25 62 13 2e 70 6c 6f 74  |g at r2.%b..plot|
0000d5e0  5f 70 6f 6c 79 5f 6c 69  6e 65 0d 25 6c 3d 20 20  |_poly_line.%l=  |
0000d5f0  20 20 20 20 20 20 53 54  4d 46 44 20 20 20 72 31  |      STMFD   r1|
0000d600  33 21 2c 20 7b 72 30 2d  72 37 2c 20 72 31 34 7d  |3!, {r0-r7, r14}|
0000d610  20 20 20 20 20 20 3b 20  53 74 61 63 6b 20 72 65  |      ; Stack re|
0000d620  67 69 73 74 65 72 73 0d  25 76 4b 20 20 20 20 20  |gisters.%vK     |
0000d630  20 20 20 4d 4f 56 20 20  20 20 20 72 35 2c 20 72  |   MOV     r5, r|
0000d640  32 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |2               |
0000d650  20 20 20 3b 20 50 6f 69  6e 74 65 72 20 74 6f 20  |   ; Pointer to |
0000d660  74 68 65 20 63 75 72 72  65 6e 74 20 76 65 72 74  |the current vert|
0000d670  65 78 0d 25 80 50 20 20  20 20 20 20 20 20 4d 4f  |ex.%.P        MO|
0000d680  56 20 20 20 20 20 72 36  2c 20 72 32 20 20 20 20  |V     r6, r2    |
0000d690  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
0000d6a0  4b 65 65 70 20 61 20 70  6f 69 6e 74 65 72 20 74  |Keep a pointer t|
0000d6b0  6f 20 74 68 65 20 66 69  72 73 74 20 76 65 72 74  |o the first vert|
0000d6c0  65 78 0d 25 8a 45 20 20  20 20 20 20 20 20 4d 4f  |ex.%.E        MO|
0000d6d0  56 20 20 20 20 20 72 37  2c 20 72 31 20 20 20 20  |V     r7, r1    |
0000d6e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
0000d6f0  43 6f 70 79 20 6e 75 6d  62 65 72 20 6f 66 20 73  |Copy number of s|
0000d700  65 67 6d 65 6e 74 73 0d  25 94 18 2e 70 6c 6f 74  |egments.%...plot|
0000d710  5f 70 6f 6c 79 5f 6c 69  6e 65 5f 6c 6f 6f 70 0d  |_poly_line_loop.|
0000d720  25 9e 4a 20 20 20 20 20  20 20 20 53 55 42 53 20  |%.J        SUBS |
0000d730  20 20 20 72 37 2c 20 72  37 2c 20 23 31 20 20 20  |   r7, r7, #1   |
0000d740  20 20 20 20 20 20 20 20  20 20 20 3b 20 44 65 63  |           ; Dec|
0000d750  72 65 6d 65 6e 74 20 72  65 6d 61 69 6e 69 6e 67  |rement remaining|
0000d760  20 73 65 67 6d 65 6e 74  73 0d 25 a8 52 20 20 20  | segments.%.R   |
0000d770  20 20 20 20 20 4c 44 4d  4d 49 46 44 20 72 31 33  |     LDMMIFD r13|
0000d780  21 2c 20 7b 72 30 2d 72  37 2c 20 70 63 7d 20 20  |!, {r0-r7, pc}  |
0000d790  20 20 20 20 20 3b 20 52  65 74 75 72 6e 20 66 72  |     ; Return fr|
0000d7a0  6f 6d 20 73 75 62 72 6f  75 74 69 6e 65 20 77 68  |om subroutine wh|
0000d7b0  65 6e 20 66 69 6e 69 73  68 65 64 0d 25 b2 49 20  |en finished.%.I |
0000d7c0  20 20 20 20 20 20 20 4c  44 4d 49 41 20 20 20 72  |       LDMIA   r|
0000d7d0  35 21 2c 20 7b 72 31 2d  72 32 7d 20 20 20 20 20  |5!, {r1-r2}     |
0000d7e0  20 20 20 20 20 20 20 3b  20 52 65 61 64 20 6c 69  |       ; Read li|
0000d7f0  6e 65 20 73 74 61 72 74  20 63 6f 6f 72 64 69 6e  |ne start coordin|
0000d800  61 74 65 73 0d 25 bc 4f  20 20 20 20 20 20 20 20  |ates.%.O        |
0000d810  ec 51 20 20 20 72 35 2c  20 72 36 20 20 20 20 20  |.Q   r5, r6     |
0000d820  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 57  |             ; W|
0000d830  72 61 70 20 61 72 6f 75  6e 64 20 74 6f 20 74 68  |rap around to th|
0000d840  65 20 73 74 61 72 74 20  66 6f 72 20 74 68 65 20  |e start for the |
0000d850  65 6e 64 0d 25 c6 47 20  20 20 20 20 20 20 20 4c  |end.%.G        L|
0000d860  44 4d 49 41 20 20 20 72  35 2c 20 7b 72 33 2d 72  |DMIA   r5, {r3-r|
0000d870  34 7d 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |4}             ;|
0000d880  20 52 65 61 64 20 6c 69  6e 65 20 65 6e 64 20 63  | Read line end c|
0000d890  6f 6f 72 64 69 6e 61 74  65 73 0d 25 d0 3c 20 20  |oordinates.%.<  |
0000d8a0  20 20 20 20 20 20 42 4c  20 20 20 20 20 20 70 6c  |      BL      pl|
0000d8b0  6f 74 5f 6c 69 6e 65 20  20 20 20 20 20 20 20 20  |ot_line         |
0000d8c0  20 20 20 20 20 20 3b 20  50 6c 6f 74 20 74 68 69  |      ; Plot thi|
0000d8d0  73 20 6c 69 6e 65 0d 25  da 4c 20 20 20 20 20 20  |s line.%.L      |
0000d8e0  20 20 42 20 20 20 20 20  20 20 70 6c 6f 74 5f 70  |  B       plot_p|
0000d8f0  6f 6c 79 5f 6c 69 6e 65  5f 6c 6f 6f 70 20 20 20  |oly_line_loop   |
0000d900  20 20 3b 20 4c 6f 6f 70  20 66 6f 72 20 74 68 65  |  ; Loop for the|
0000d910  20 6e 65 78 74 20 6c 69  6e 65 20 73 65 67 6d 65  | next line segme|
0000d920  6e 74 0d 25 e4 04 0d 25  ee 4a 20 20 20 20 20 20  |nt.%...%.J      |
0000d930  20 20 3b 20 46 69 6c 6c  20 61 20 70 6f 6c 79 67  |  ; Fill a polyg|
0000d940  6f 6e 20 69 6e 20 63 6f  6c 6f 75 72 20 72 30 20  |on in colour r0 |
0000d950  75 73 69 6e 67 20 72 31  20 76 65 72 74 69 63 65  |using r1 vertice|
0000d960  73 20 73 74 61 72 74 69  6e 67 20 61 74 20 72 32  |s starting at r2|
0000d970  0d 25 f8 13 2e 70 6c 6f  74 5f 70 6f 6c 79 5f 66  |.%...plot_poly_f|
0000d980  69 6c 6c 0d 26 02 3d 20  20 20 20 20 20 20 20 53  |ill.&.=        S|
0000d990  54 4d 46 44 20 20 20 72  31 33 21 2c 20 7b 72 30  |TMFD   r13!, {r0|
0000d9a0  2d 72 36 2c 20 72 31 34  7d 20 20 20 20 20 20 3b  |-r6, r14}      ;|
0000d9b0  20 53 74 61 63 6b 20 72  65 67 69 73 74 65 72 73  | Stack registers|
0000d9c0  0d 26 0c 4c 20 20 20 20  20 20 20 20 53 55 42 20  |.&.L        SUB |
0000d9d0  20 20 20 20 72 31 33 2c  20 72 31 33 2c 20 72 31  |    r13, r13, r1|
0000d9e0  2c 20 4c 53 4c 23 34 20  20 20 20 20 3b 20 52 65  |, LSL#4     ; Re|
0000d9f0  73 65 72 76 65 20 73 70  61 63 65 20 66 6f 72 20  |serve space for |
0000da00  65 64 67 65 20 64 65 74  61 69 6c 73 0d 26 16 47  |edge details.&.G|
0000da10  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
0000da20  72 33 2c 20 72 31 33 20  20 20 20 20 20 20 20 20  |r3, r13         |
0000da30  20 20 20 20 20 20 20 20  3b 20 43 6f 70 79 20 65  |        ; Copy e|
0000da40  64 67 65 20 64 65 74 61  69 6c 73 20 70 6f 69 6e  |dge details poin|
0000da50  74 65 72 0d 26 20 4d 20  20 20 20 20 20 20 20 53  |ter.& M        S|
0000da60  55 42 20 20 20 20 20 72  31 33 2c 20 72 31 33 2c  |UB     r13, r13,|
0000da70  20 72 31 2c 20 4c 53 4c  23 32 20 20 20 20 20 3b  | r1, LSL#2     ;|
0000da80  20 52 65 73 65 72 76 65  20 73 70 61 63 65 20 66  | Reserve space f|
0000da90  6f 72 20 69 6e 74 65 72  73 65 63 74 69 6f 6e 73  |or intersections|
0000daa0  0d 26 2a 48 20 20 20 20  20 20 20 20 4d 4f 56 20  |.&*H        MOV |
0000dab0  20 20 20 20 72 34 2c 20  72 31 33 20 20 20 20 20  |    r4, r13     |
0000dac0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 43 6f  |            ; Co|
0000dad0  70 79 20 69 6e 74 65 72  73 65 63 74 69 6f 6e 73  |py intersections|
0000dae0  20 70 6f 69 6e 74 65 72  0d 26 34 49 20 20 20 20  | pointer.&4I    |
0000daf0  20 20 20 20 42 4c 20 20  20 20 20 20 70 6c 6f 74  |    BL      plot|
0000db00  5f 70 6f 6c 79 5f 66 69  6c 6c 5f 70 72 65 70 72  |_poly_fill_prepr|
0000db10  6f 63 65 73 73 3b 20 43  6f 6e 73 74 72 75 63 74  |ocess; Construct|
0000db20  20 74 68 65 20 65 64 67  65 20 64 65 74 61 69 6c  | the edge detail|
0000db30  73 0d 26 3e 18 2e 70 6c  6f 74 5f 70 6f 6c 79 5f  |s.&>..plot_poly_|
0000db40  66 69 6c 6c 5f 6c 6f 6f  70 0d 26 48 48 20 20 20  |fill_loop.&HH   |
0000db50  20 20 20 20 20 4d 4f 56  20 20 20 20 20 72 32 2c  |     MOV     r2,|
0000db60  20 23 30 20 20 20 20 20  20 20 20 20 20 20 20 20  | #0             |
0000db70  20 20 20 20 20 3b 20 4e  6f 20 69 6e 74 65 72 73  |     ; No inters|
0000db80  65 63 74 69 6f 6e 73 20  66 6f 75 6e 64 20 79 65  |ections found ye|
0000db90  74 0d 26 52 49 20 20 20  20 20 20 20 20 42 4c 20  |t.&RI        BL |
0000dba0  20 20 20 20 20 70 6c 6f  74 5f 70 6f 6c 79 5f 66  |     plot_poly_f|
0000dbb0  69 6c 6c 5f 69 6e 74 65  72 20 20 20 20 3b 20 46  |ill_inter    ; F|
0000dbc0  69 6e 64 20 61 6e 79 20  69 6e 74 65 72 73 65 63  |ind any intersec|
0000dbd0  74 69 6e 67 20 65 64 67  65 73 0d 26 5c 42 20 20  |ting edges.&\B  |
0000dbe0  20 20 20 20 20 20 42 4c  20 20 20 20 20 20 70 6c  |      BL      pl|
0000dbf0  6f 74 5f 70 6f 6c 79 5f  66 69 6c 6c 5f 70 6c 6f  |ot_poly_fill_plo|
0000dc00  74 20 20 20 20 20 3b 20  50 65 72 66 6f 72 6d 20  |t     ; Perform |
0000dc10  74 68 65 20 70 6c 6f 74  74 69 6e 67 0d 26 66 45  |the plotting.&fE|
0000dc20  20 20 20 20 20 20 20 20  41 44 44 20 20 20 20 20  |        ADD     |
0000dc30  72 35 2c 20 72 35 2c 20  23 31 20 20 20 20 20 20  |r5, r5, #1      |
0000dc40  20 20 20 20 20 20 20 20  3b 20 41 64 76 61 6e 63  |        ; Advanc|
0000dc50  65 20 74 6f 20 74 68 65  20 6e 65 78 74 20 72 6f  |e to the next ro|
0000dc60  77 0d 26 70 4b 20 20 20  20 20 20 20 20 43 4d 50  |w.&pK        CMP|
0000dc70  20 20 20 20 20 72 35 2c  20 72 36 20 20 20 20 20  |     r5, r6     |
0000dc80  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 48  |             ; H|
0000dc90  61 73 20 74 68 65 20 6c  61 73 74 20 72 6f 77 20  |as the last row |
0000dca0  62 65 65 6e 20 72 65 61  63 68 65 64 0d 26 7a 45  |been reached.&zE|
0000dcb0  20 20 20 20 20 20 20 20  42 4c 45 20 20 20 20 20  |        BLE     |
0000dcc0  70 6c 6f 74 5f 70 6f 6c  79 5f 66 69 6c 6c 5f 6c  |plot_poly_fill_l|
0000dcd0  6f 6f 70 20 20 20 20 20  3b 20 4c 6f 6f 70 20 75  |oop     ; Loop u|
0000dce0  6e 74 69 6c 20 61 6c 6c  20 66 69 6e 69 73 68 65  |ntil all finishe|
0000dcf0  64 0d 26 84 18 2e 70 6c  6f 74 5f 70 6f 6c 79 5f  |d.&...plot_poly_|
0000dd00  66 69 6c 6c 5f 64 6f 6e  65 0d 26 8e 4d 20 20 20  |fill_done.&.M   |
0000dd10  20 20 20 20 20 41 44 44  20 20 20 20 20 72 31 33  |     ADD     r13|
0000dd20  2c 20 72 31 33 2c 20 72  31 2c 20 4c 53 4c 23 32  |, r13, r1, LSL#2|
0000dd30  20 20 20 20 20 3b 20 52  65 6c 65 61 73 65 20 74  |     ; Release t|
0000dd40  68 65 20 69 6e 74 65 72  73 65 63 74 69 6f 6e 73  |he intersections|
0000dd50  20 73 70 61 63 65 0d 26  98 4c 20 20 20 20 20 20  | space.&.L      |
0000dd60  20 20 41 44 44 20 20 20  20 20 72 31 33 2c 20 72  |  ADD     r13, r|
0000dd70  31 33 2c 20 72 31 2c 20  4c 53 4c 23 34 20 20 20  |13, r1, LSL#4   |
0000dd80  20 20 3b 20 52 65 6c 65  61 73 65 20 74 68 65 20  |  ; Release the |
0000dd90  65 64 67 65 20 64 65 74  61 69 6c 73 20 73 70 61  |edge details spa|
0000dda0  63 65 0d 26 a2 44 20 20  20 20 20 20 20 20 4c 44  |ce.&.D        LD|
0000ddb0  4d 46 44 20 20 20 72 31  33 21 2c 20 7b 72 30 2d  |MFD   r13!, {r0-|
0000ddc0  72 36 2c 20 70 63 7d 20  20 20 20 20 20 20 3b 20  |r6, pc}       ; |
0000ddd0  52 65 74 75 72 6e 20 66  72 6f 6d 20 73 75 62 72  |Return from subr|
0000dde0  6f 75 74 69 6e 65 0d 26  ac 1e 2e 70 6c 6f 74 5f  |outine.&...plot_|
0000ddf0  70 6f 6c 79 5f 66 69 6c  6c 5f 70 72 65 70 72 6f  |poly_fill_prepro|
0000de00  63 65 73 73 0d 26 b6 3f  20 20 20 20 20 20 20 20  |cess.&.?        |
0000de10  53 54 4d 46 44 20 20 20  72 31 33 21 2c 20 7b 72  |STMFD   r13!, {r|
0000de20  30 2d 72 34 2c 20 72 37  2d 72 31 30 2c 20 72 31  |0-r4, r7-r10, r1|
0000de30  34 7d 3b 20 53 74 61 63  6b 20 72 65 67 69 73 74  |4}; Stack regist|
0000de40  65 72 73 0d 26 c0 49 20  20 20 20 20 20 20 20 4c  |ers.&.I        L|
0000de50  44 52 20 20 20 20 20 72  35 2c 20 5b 72 32 5d 20  |DR     r5, [r2] |
0000de60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
0000de70  20 49 6e 69 74 69 61 6c  69 73 65 20 66 69 72 73  | Initialise firs|
0000de80  74 20 72 6f 77 20 6e 75  6d 62 65 72 0d 26 ca 48  |t row number.&.H|
0000de90  20 20 20 20 20 20 20 20  4c 44 52 20 20 20 20 20  |        LDR     |
0000dea0  72 36 2c 20 5b 72 32 5d  20 20 20 20 20 20 20 20  |r6, [r2]        |
0000deb0  20 20 20 20 20 20 20 20  3b 20 49 6e 69 74 69 61  |        ; Initia|
0000dec0  6c 69 73 65 20 6c 61 73  74 20 72 6f 77 20 6e 75  |lise last row nu|
0000ded0  6d 62 65 72 0d 26 d4 41  20 20 20 20 20 20 20 20  |mber.&.A        |
0000dee0  4d 4f 56 20 20 20 20 20  72 30 2c 20 72 32 20 20  |MOV     r0, r2  |
0000def0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000df00  3b 20 43 6f 70 79 20 76  65 72 74 65 78 20 70 6f  |; Copy vertex po|
0000df10  69 6e 74 65 72 0d 26 de  23 2e 70 6c 6f 74 5f 70  |inter.&.#.plot_p|
0000df20  6f 6c 79 5f 66 69 6c 6c  5f 70 72 65 70 72 6f 63  |oly_fill_preproc|
0000df30  65 73 73 5f 6c 6f 6f 70  0d 26 e8 47 20 20 20 20  |ess_loop.&.G    |
0000df40  20 20 20 20 53 55 42 53  20 20 20 20 72 31 2c 20  |    SUBS    r1, |
0000df50  72 31 2c 20 23 31 20 20  20 20 20 20 20 20 20 20  |r1, #1          |
0000df60  20 20 20 20 3b 20 44 65  63 72 65 6d 65 6e 74 20  |    ; Decrement |
0000df70  6e 75 6d 62 65 72 20 6f  66 20 65 64 67 65 73 0d  |number of edges.|
0000df80  26 f2 53 20 20 20 20 20  20 20 20 4c 44 4d 4d 49  |&.S        LDMMI|
0000df90  46 44 20 72 31 33 21 2c  20 7b 72 30 2d 72 34 2c  |FD r13!, {r0-r4,|
0000dfa0  20 72 37 2d 72 31 30 2c  20 70 63 7d 3b 20 52 65  | r7-r10, pc}; Re|
0000dfb0  74 75 72 6e 20 66 72 6f  6d 20 73 75 62 72 6f 75  |turn from subrou|
0000dfc0  74 69 6e 65 20 77 68 65  6e 20 66 69 6e 69 73 68  |tine when finish|
0000dfd0  65 64 0d 26 fc 49 20 20  20 20 20 20 20 20 4c 44  |ed.&.I        LD|
0000dfe0  4d 49 41 20 20 20 72 30  21 2c 20 7b 72 37 2d 72  |MIA   r0!, {r7-r|
0000dff0  38 7d 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |8}            ; |
0000e000  52 65 61 64 20 6c 69 6e  65 20 73 74 61 72 74 20  |Read line start |
0000e010  63 6f 6f 72 64 69 6e 61  74 65 73 0d 27 06 4f 20  |coordinates.'.O |
0000e020  20 20 20 20 20 20 20 ec  51 20 20 20 72 30 2c 20  |       .Q   r0, |
0000e030  72 32 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r2              |
0000e040  20 20 20 20 3b 20 57 72  61 70 20 61 72 6f 75 6e  |    ; Wrap aroun|
0000e050  64 20 74 6f 20 74 68 65  20 73 74 61 72 74 20 66  |d to the start f|
0000e060  6f 72 20 74 68 65 20 65  6e 64 0d 27 10 47 20 20  |or the end.'.G  |
0000e070  20 20 20 20 20 20 4c 44  4d 49 41 20 20 20 72 30  |      LDMIA   r0|
0000e080  2c 20 7b 72 39 2d 72 31  30 7d 20 20 20 20 20 20  |, {r9-r10}      |
0000e090  20 20 20 20 20 20 3b 20  52 65 61 64 20 6c 69 6e  |      ; Read lin|
0000e0a0  65 20 65 6e 64 20 63 6f  6f 72 64 69 6e 61 74 65  |e end coordinate|
0000e0b0  73 0d 27 1a 4f 20 20 20  20 20 20 20 20 43 4d 50  |s.'.O        CMP|
0000e0c0  20 20 20 20 20 72 37 2c  20 72 39 20 20 20 20 20  |     r7, r9     |
0000e0d0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 44  |             ; D|
0000e0e0  6f 20 74 68 65 20 63 6f  6f 72 64 69 6e 61 74 65  |o the coordinate|
0000e0f0  73 20 6e 65 65 64 20 72  65 76 65 72 73 69 6e 67  |s need reversing|
0000e100  0d 27 24 49 20 20 20 20  20 20 20 20 4d 4f 56 47  |.'$I        MOVG|
0000e110  54 20 20 20 72 34 2c 20  72 37 20 20 20 20 20 20  |T   r4, r7      |
0000e120  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 43 6f  |            ; Co|
0000e130  70 79 20 66 69 72 73 74  20 72 6f 77 20 74 6f 20  |py first row to |
0000e140  74 65 6d 70 6f 72 61 72  79 0d 27 2e 3e 20 20 20  |temporary.'.>   |
0000e150  20 20 20 20 20 4d 4f 56  47 54 20 20 20 72 37 2c  |     MOVGT   r7,|
0000e160  20 72 39 20 20 20 20 20  20 20 20 20 20 20 20 20  | r9             |
0000e170  20 20 20 20 20 3b 20 53  77 61 70 20 72 6f 77 20  |     ; Swap row |
0000e180  6e 75 6d 62 65 72 73 0d  27 38 40 20 20 20 20 20  |numbers.'8@     |
0000e190  20 20 20 4d 4f 56 47 54  20 20 20 72 39 2c 20 72  |   MOVGT   r9, r|
0000e1a0  34 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |4               |
0000e1b0  20 20 20 3b 20 53 65 74  20 65 6e 64 20 72 6f 77  |   ; Set end row|
0000e1c0  20 6e 75 6d 62 65 72 0d  27 42 4c 20 20 20 20 20  | number.'BL     |
0000e1d0  20 20 20 4d 4f 56 47 54  20 20 20 72 34 2c 20 72  |   MOVGT   r4, r|
0000e1e0  38 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |8               |
0000e1f0  20 20 20 3b 20 43 6f 70  79 20 66 69 72 73 74 20  |   ; Copy first |
0000e200  63 6f 6c 75 6d 6e 20 74  6f 20 74 65 6d 70 6f 72  |column to tempor|
0000e210  61 72 79 0d 27 4c 41 20  20 20 20 20 20 20 20 4d  |ary.'LA        M|
0000e220  4f 56 47 54 20 20 20 72  38 2c 20 72 31 30 20 20  |OVGT   r8, r10  |
0000e230  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
0000e240  20 53 77 61 70 20 63 6f  6c 75 6d 6e 20 6e 75 6d  | Swap column num|
0000e250  62 65 72 73 0d 27 56 43  20 20 20 20 20 20 20 20  |bers.'VC        |
0000e260  4d 4f 56 47 54 20 20 20  72 31 30 2c 20 72 34 20  |MOVGT   r10, r4 |
0000e270  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000e280  3b 20 53 65 74 20 65 6e  64 20 63 6f 6c 75 6d 6e  |; Set end column|
0000e290  20 6e 75 6d 62 65 72 0d  27 60 44 20 20 20 20 20  | number.'`D     |
0000e2a0  20 20 20 43 4d 50 20 20  20 20 20 72 37 2c 20 72  |   CMP     r7, r|
0000e2b0  35 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |5               |
0000e2c0  20 20 20 3b 20 43 6f 6d  70 61 72 65 20 77 69 74  |   ; Compare wit|
0000e2d0  68 20 66 69 72 73 74 20  72 6f 77 0d 27 6a 51 20  |h first row.'jQ |
0000e2e0  20 20 20 20 20 20 20 4d  4f 56 4c 54 20 20 20 72  |       MOVLT   r|
0000e2f0  35 2c 20 72 37 20 20 20  20 20 20 20 20 20 20 20  |5, r7           |
0000e300  20 20 20 20 20 20 20 3b  20 55 70 64 61 74 65 20  |       ; Update |
0000e310  66 69 72 73 74 20 72 6f  77 20 6e 75 6d 62 65 72  |first row number|
0000e320  20 69 73 20 72 65 71 75  69 72 65 64 0d 27 74 43  | is required.'tC|
0000e330  20 20 20 20 20 20 20 20  43 4d 50 20 20 20 20 20  |        CMP     |
0000e340  72 39 2c 20 72 36 20 20  20 20 20 20 20 20 20 20  |r9, r6          |
0000e350  20 20 20 20 20 20 20 20  3b 20 43 6f 6d 70 61 72  |        ; Compar|
0000e360  65 20 77 69 74 68 20 6c  61 73 74 20 72 6f 77 0d  |e with last row.|
0000e370  27 7e 50 20 20 20 20 20  20 20 20 4d 4f 56 47 54  |'~P        MOVGT|
0000e380  20 20 20 72 36 2c 20 72  39 20 20 20 20 20 20 20  |   r6, r9       |
0000e390  20 20 20 20 20 20 20 20  20 20 20 3b 20 55 70 64  |           ; Upd|
0000e3a0  61 74 65 20 6c 61 73 74  20 72 6f 77 20 6e 75 6d  |ate last row num|
0000e3b0  62 65 72 20 69 73 20 72  65 71 75 69 72 65 64 0d  |ber is required.|
0000e3c0  27 88 40 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |'.@        MOV  |
0000e3d0  20 20 20 72 38 2c 20 72  38 2c 20 41 53 4c 23 31  |   r8, r8, ASL#1|
0000e3e0  36 20 20 20 20 20 20 20  20 20 20 3b 20 53 63 61  |6          ; Sca|
0000e3f0  6c 65 20 73 74 61 72 74  20 63 6f 6c 75 6d 6e 0d  |le start column.|
0000e400  27 92 3e 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |'.>        MOV  |
0000e410  20 20 20 72 31 30 2c 20  72 31 30 2c 20 41 53 4c  |   r10, r10, ASL|
0000e420  23 31 36 20 20 20 20 20  20 20 20 3b 20 53 63 61  |#16        ; Sca|
0000e430  6c 65 20 65 6e 64 20 63  6f 6c 75 6d 6e 0d 27 9c  |le end column.'.|
0000e440  44 20 20 20 20 20 20 20  20 53 54 52 20 20 20 20  |D        STR    |
0000e450  20 72 37 2c 20 5b 72 33  5d 20 20 20 20 20 20 20  | r7, [r3]       |
0000e460  20 20 20 20 20 20 20 20  20 3b 20 53 74 6f 72 65  |         ; Store|
0000e470  20 73 74 61 72 74 20 72  6f 77 20 6e 75 6d 62 65  | start row numbe|
0000e480  72 0d 27 a6 42 20 20 20  20 20 20 20 20 53 54 52  |r.'.B        STR|
0000e490  20 20 20 20 20 72 39 2c  20 5b 72 33 2c 20 23 34  |     r9, [r3, #4|
0000e4a0  5d 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 53  |]            ; S|
0000e4b0  74 6f 72 65 20 65 6e 64  20 72 6f 77 20 6e 75 6d  |tore end row num|
0000e4c0  62 65 72 0d 27 b0 47 20  20 20 20 20 20 20 20 53  |ber.'.G        S|
0000e4d0  54 52 20 20 20 20 20 72  38 2c 20 5b 72 33 2c 20  |TR     r8, [r3, |
0000e4e0  23 38 5d 20 20 20 20 20  20 20 20 20 20 20 20 3b  |#8]            ;|
0000e4f0  20 53 74 6f 72 65 20 73  74 61 72 74 20 63 6f 6c  | Store start col|
0000e500  75 6d 6e 20 6e 75 6d 62  65 72 0d 27 ba 3d 20 20  |umn number.'.=  |
0000e510  20 20 20 20 20 20 53 54  4d 46 44 20 20 20 72 31  |      STMFD   r1|
0000e520  33 21 2c 20 7b 72 30 2d  72 31 7d 20 20 20 20 20  |3!, {r0-r1}     |
0000e530  20 20 20 20 20 20 3b 20  53 74 61 63 6b 20 72 65  |      ; Stack re|
0000e540  67 69 73 74 65 72 73 0d  27 c4 44 20 20 20 20 20  |gisters.'.D     |
0000e550  20 20 20 53 55 42 20 20  20 20 20 72 30 2c 20 72  |   SUB     r0, r|
0000e560  31 30 2c 20 72 38 20 20  20 20 20 20 20 20 20 20  |10, r8          |
0000e570  20 20 20 3b 20 52 65 71  75 69 72 65 64 20 63 6f  |   ; Required co|
0000e580  6c 75 6d 6e 20 63 68 61  6e 67 65 0d 27 ce 41 20  |lumn change.'.A |
0000e590  20 20 20 20 20 20 20 53  55 42 53 20 20 20 20 72  |       SUBS    r|
0000e5a0  31 2c 20 72 39 2c 20 72  37 20 20 20 20 20 20 20  |1, r9, r7       |
0000e5b0  20 20 20 20 20 20 20 3b  20 52 65 71 75 69 72 65  |       ; Require|
0000e5c0  64 20 72 6f 77 20 63 68  61 6e 67 65 0d 27 d8 40  |d row change.'.@|
0000e5d0  20 20 20 20 20 20 20 20  ec 51 20 20 20 72 30 2c  |        .Q   r0,|
0000e5e0  20 23 30 20 20 20 20 20  20 20 20 20 20 20 20 20  | #0             |
0000e5f0  20 20 20 20 20 3b 20 46  61 6b 65 20 68 6f 72 69  |     ; Fake hori|
0000e600  7a 6f 6e 74 61 6c 20 6c  69 6e 65 73 0d 27 e2 48  |zontal lines.'.H|
0000e610  20 20 20 20 20 20 20 20  42 4c 4e 45 20 20 20 20  |        BLNE    |
0000e620  64 69 76 69 64 65 20 20  20 20 20 20 20 20 20 20  |divide          |
0000e630  20 20 20 20 20 20 20 20  3b 20 43 61 6c 63 75 6c  |        ; Calcul|
0000e640  61 74 65 20 63 6f 6c 75  6d 6e 20 69 6e 63 72 65  |ate column incre|
0000e650  6d 65 6e 74 0d 27 ec 47  20 20 20 20 20 20 20 20  |ment.'.G        |
0000e660  53 54 52 20 20 20 20 20  72 30 2c 20 5b 72 33 2c  |STR     r0, [r3,|
0000e670  20 23 31 32 5d 20 20 20  20 20 20 20 20 20 20 20  | #12]           |
0000e680  3b 20 53 74 6f 72 65 20  73 74 61 72 74 20 63 6f  |; Store start co|
0000e690  6c 75 6d 6e 20 6e 75 6d  62 65 72 0d 27 f6 3f 20  |lumn number.'.? |
0000e6a0  20 20 20 20 20 20 20 4c  44 4d 46 44 20 20 20 72  |       LDMFD   r|
0000e6b0  31 33 21 2c 20 7b 72 30  2d 72 31 7d 20 20 20 20  |13!, {r0-r1}    |
0000e6c0  20 20 20 20 20 20 20 3b  20 52 65 73 74 6f 72 65  |       ; Restore|
0000e6d0  20 72 65 67 69 73 74 65  72 73 0d 28 00 4a 20 20  | registers.(.J  |
0000e6e0  20 20 20 20 20 20 41 44  44 20 20 20 20 20 72 33  |      ADD     r3|
0000e6f0  2c 20 72 33 2c 20 23 31  36 20 20 20 20 20 20 20  |, r3, #16       |
0000e700  20 20 20 20 20 20 3b 20  41 64 76 61 6e 63 65 20  |      ; Advance |
0000e710  65 64 67 65 20 64 65 74  61 69 6c 73 20 70 6f 69  |edge details poi|
0000e720  6e 74 65 72 0d 28 0a 4a  20 20 20 20 20 20 20 20  |nter.(.J        |
0000e730  42 20 20 20 20 20 20 20  70 6c 6f 74 5f 70 6f 6c  |B       plot_pol|
0000e740  79 5f 66 69 6c 6c 5f 70  72 65 70 72 6f 63 65 73  |y_fill_preproces|
0000e750  73 5f 6c 6f 6f 70 3b 20  4c 6f 6f 70 20 66 6f 72  |s_loop; Loop for|
0000e760  20 74 68 65 20 6e 65 78  74 20 65 64 67 65 0d 28  | the next edge.(|
0000e770  14 19 2e 70 6c 6f 74 5f  70 6f 6c 79 5f 66 69 6c  |...plot_poly_fil|
0000e780  6c 5f 69 6e 74 65 72 0d  28 1e 3e 20 20 20 20 20  |l_inter.(.>     |
0000e790  20 20 20 53 54 4d 46 44  20 20 20 72 31 33 21 2c  |   STMFD   r13!,|
0000e7a0  20 7b 72 30 2d 72 31 2c  20 72 33 2d 72 39 2c 20  | {r0-r1, r3-r9, |
0000e7b0  72 31 34 7d 3b 20 53 74  61 63 6b 20 72 65 67 69  |r14}; Stack regi|
0000e7c0  73 74 65 72 73 0d 28 28  1e 2e 70 6c 6f 74 5f 70  |sters.((..plot_p|
0000e7d0  6f 6c 79 5f 66 69 6c 6c  5f 69 6e 74 65 72 5f 6c  |oly_fill_inter_l|
0000e7e0  6f 6f 70 0d 28 32 47 20  20 20 20 20 20 20 20 53  |oop.(2G        S|
0000e7f0  55 42 53 20 20 20 20 72  31 2c 20 72 31 2c 20 23  |UBS    r1, r1, #|
0000e800  31 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |1              ;|
0000e810  20 44 65 63 72 65 6d 65  6e 74 20 6e 75 6d 62 65  | Decrement numbe|
0000e820  72 20 6f 66 20 65 64 67  65 73 0d 28 3c 52 20 20  |r of edges.(<R  |
0000e830  20 20 20 20 20 20 4c 44  4d 4d 49 46 44 20 72 31  |      LDMMIFD r1|
0000e840  33 21 2c 20 7b 72 30 2d  72 31 2c 20 72 33 2d 72  |3!, {r0-r1, r3-r|
0000e850  39 2c 20 70 63 7d 3b 20  52 65 74 75 72 6e 20 66  |9, pc}; Return f|
0000e860  72 6f 6d 20 73 75 62 72  6f 75 74 69 6e 65 20 77  |rom subroutine w|
0000e870  68 65 6e 20 66 69 6e 69  73 68 65 64 0d 28 46 4c  |hen finished.(FL|
0000e880  20 20 20 20 20 20 20 20  4c 44 4d 49 41 20 20 20  |        LDMIA   |
0000e890  72 33 21 2c 20 7b 72 36  2d 72 39 7d 20 20 20 20  |r3!, {r6-r9}    |
0000e8a0  20 20 20 20 20 20 20 20  3b 20 52 65 61 64 20 74  |        ; Read t|
0000e8b0  68 65 20 64 65 74 61 69  6c 73 20 66 6f 72 20 74  |he details for t|
0000e8c0  68 69 73 20 65 64 67 65  0d 28 50 47 20 20 20 20  |his edge.(PG    |
0000e8d0  20 20 20 20 43 4d 50 20  20 20 20 20 72 36 2c 20  |    CMP     r6, |
0000e8e0  72 35 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r5              |
0000e8f0  20 20 20 20 3b 20 49 73  20 73 74 61 72 74 20 72  |    ; Is start r|
0000e900  6f 77 20 65 61 72 6c 79  20 65 6e 6f 75 67 68 0d  |ow early enough.|
0000e910  28 5a 48 20 20 20 20 20  20 20 20 42 47 54 20 20  |(ZH        BGT  |
0000e920  20 20 20 70 6c 6f 74 5f  70 6f 6c 79 5f 66 69 6c  |   plot_poly_fil|
0000e930  6c 5f 69 6e 74 65 72 5f  6c 6f 6f 70 3b 20 4c 6f  |l_inter_loop; Lo|
0000e940  6f 70 20 66 6f 72 20 6e  65 78 74 20 65 64 67 65  |op for next edge|
0000e950  20 69 66 20 6e 6f 74 0d  28 64 44 20 20 20 20 20  | if not.(dD     |
0000e960  20 20 20 43 4d 50 20 20  20 20 20 72 37 2c 20 72  |   CMP     r7, r|
0000e970  35 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |5               |
0000e980  20 20 20 3b 20 49 73 20  65 6e 64 20 72 6f 77 20  |   ; Is end row |
0000e990  6c 61 74 65 20 65 6e 6f  75 67 68 0d 28 6e 48 20  |late enough.(nH |
0000e9a0  20 20 20 20 20 20 20 42  4c 45 20 20 20 20 20 70  |       BLE     p|
0000e9b0  6c 6f 74 5f 70 6f 6c 79  5f 66 69 6c 6c 5f 69 6e  |lot_poly_fill_in|
0000e9c0  74 65 72 5f 6c 6f 6f 70  3b 20 4c 6f 6f 70 20 66  |ter_loop; Loop f|
0000e9d0  6f 72 20 6e 65 78 74 20  65 64 67 65 20 69 66 20  |or next edge if |
0000e9e0  6e 6f 74 0d 28 78 4f 20  20 20 20 20 20 20 20 53  |not.(xO        S|
0000e9f0  55 42 20 20 20 20 20 72  36 2c 20 72 35 2c 20 72  |UB     r6, r5, r|
0000ea00  36 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |6              ;|
0000ea10  20 4e 75 6d 62 65 72 20  6f 66 20 72 6f 77 73 20  | Number of rows |
0000ea20  66 72 6f 6d 20 73 74 61  72 74 20 6f 66 20 65 64  |from start of ed|
0000ea30  67 65 0d 28 82 48 20 20  20 20 20 20 20 20 4d 4c  |ge.(.H        ML|
0000ea40  41 20 20 20 20 20 72 38  2c 20 72 36 2c 20 72 39  |A     r8, r6, r9|
0000ea50  2c 20 72 38 20 20 20 20  20 20 20 20 20 20 3b 20  |, r8          ; |
0000ea60  43 61 6c 63 75 6c 61 74  65 20 69 6e 74 65 72 63  |Calculate interc|
0000ea70  65 70 74 20 63 6f 6c 75  6d 6e 0d 28 8c 48 20 20  |ept column.(.H  |
0000ea80  20 20 20 20 20 20 4d 4f  56 20 20 20 20 20 72 30  |      MOV     r0|
0000ea90  2c 20 72 38 2c 20 41 53  52 23 31 36 20 20 20 20  |, r8, ASR#16    |
0000eaa0  20 20 20 20 20 20 3b 20  53 63 61 6c 65 20 74 68  |      ; Scale th|
0000eab0  65 20 69 6e 74 65 72 63  65 70 74 20 63 6f 6c 75  |e intercept colu|
0000eac0  6d 6e 0d 28 96 53 20 20  20 20 20 20 20 20 41 44  |mn.(.S        AD|
0000ead0  44 20 20 20 20 20 72 36  2c 20 72 34 2c 20 72 32  |D     r6, r4, r2|
0000eae0  2c 20 4c 53 4c 23 32 20  20 20 20 20 20 20 3b 20  |, LSL#2       ; |
0000eaf0  54 68 65 20 6e 65 78 74  20 61 76 61 69 6c 61 62  |The next availab|
0000eb00  6c 65 20 69 6e 74 65 72  73 65 63 74 69 6f 6e 20  |le intersection |
0000eb10  65 6e 74 72 79 0d 28 a0  20 2e 70 6c 6f 74 5f 70  |entry.(. .plot_p|
0000eb20  6f 6c 79 5f 66 69 6c 6c  5f 69 6e 74 65 72 5f 69  |oly_fill_inter_i|
0000eb30  6e 73 65 72 74 0d 28 aa  4b 20 20 20 20 20 20 20  |nsert.(.K       |
0000eb40  20 54 45 51 20 20 20 20  20 72 34 2c 20 72 36 20  | TEQ     r4, r6 |
0000eb50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000eb60  20 3b 20 49 73 20 74 68  69 73 20 74 68 65 20 73  | ; Is this the s|
0000eb70  74 61 72 74 20 6f 66 20  74 68 65 20 6c 69 73 74  |tart of the list|
0000eb80  0d 28 b4 4d 20 20 20 20  20 20 20 20 42 45 51 20  |.(.M        BEQ |
0000eb90  20 20 20 20 70 6c 6f 74  5f 70 6f 6c 79 5f 66 69  |    plot_poly_fi|
0000eba0  6c 6c 5f 69 6e 74 65 72  5f 64 6f 6e 65 3b 20 45  |ll_inter_done; E|
0000ebb0  78 69 74 20 6c 6f 6f 70  20 69 66 20 74 68 65 20  |xit loop if the |
0000ebc0  73 74 61 72 74 20 72 65  61 63 68 65 64 0d 28 be  |start reached.(.|
0000ebd0  4c 20 20 20 20 20 20 20  20 4c 44 52 20 20 20 20  |L        LDR    |
0000ebe0  20 72 37 2c 20 5b 72 36  2c 20 23 2d 34 5d 20 20  | r7, [r6, #-4]  |
0000ebf0  20 20 20 20 20 20 20 20  20 3b 20 52 65 61 64 20  |         ; Read |
0000ec00  74 68 65 20 70 72 65 76  69 6f 75 73 20 69 6e 74  |the previous int|
0000ec10  65 72 73 65 63 74 69 6f  6e 0d 28 c8 50 20 20 20  |ersection.(.P   |
0000ec20  20 20 20 20 20 43 4d 50  20 20 20 20 20 72 30 2c  |     CMP     r0,|
0000ec30  20 72 37 20 20 20 20 20  20 20 20 20 20 20 20 20  | r7             |
0000ec40  20 20 20 20 20 3b 20 53  68 6f 75 6c 64 20 74 68  |     ; Should th|
0000ec50  69 73 20 69 6e 74 65 72  73 65 63 74 69 6f 6e 20  |is intersection |
0000ec60  62 65 20 65 61 6c 69 65  72 0d 28 d2 4f 20 20 20  |be ealier.(.O   |
0000ec70  20 20 20 20 20 53 54 52  4c 54 20 20 20 72 37 2c  |     STRLT   r7,|
0000ec80  20 5b 72 36 5d 2c 20 23  2d 34 20 20 20 20 20 20  | [r6], #-4      |
0000ec90  20 20 20 20 20 3b 20 53  68 75 66 66 6c 65 20 64  |     ; Shuffle d|
0000eca0  6f 77 6e 20 74 6f 20 6e  65 78 74 20 69 6e 74 65  |own to next inte|
0000ecb0  72 73 65 63 74 69 6f 6e  0d 28 dc 2f 20 20 20 20  |rsection.(./    |
0000ecc0  20 20 20 20 42 4c 54 20  20 20 20 20 70 6c 6f 74  |    BLT     plot|
0000ecd0  5f 70 6f 6c 79 5f 66 69  6c 6c 5f 69 6e 74 65 72  |_poly_fill_inter|
0000ece0  5f 69 6e 73 65 72 74 0d  28 e6 1e 2e 70 6c 6f 74  |_insert.(...plot|
0000ecf0  5f 70 6f 6c 79 5f 66 69  6c 6c 5f 69 6e 74 65 72  |_poly_fill_inter|
0000ed00  5f 64 6f 6e 65 0d 28 f0  51 20 20 20 20 20 20 20  |_done.(.Q       |
0000ed10  20 53 54 52 20 20 20 20  20 72 30 2c 20 5b 72 36  | STR     r0, [r6|
0000ed20  5d 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |]               |
0000ed30  20 3b 20 53 74 6f 72 65  20 74 68 69 73 20 69 6e  | ; Store this in|
0000ed40  74 65 72 73 65 63 74 69  6f 6e 20 69 6e 20 74 68  |tersection in th|
0000ed50  65 20 6c 69 73 74 0d 28  fa 4a 20 20 20 20 20 20  |e list.(.J      |
0000ed60  20 20 41 44 44 20 20 20  20 20 72 32 2c 20 72 32  |  ADD     r2, r2|
0000ed70  2c 20 23 31 20 20 20 20  20 20 20 20 20 20 20 20  |, #1            |
0000ed80  20 20 3b 20 49 6e 63 72  65 6d 65 6e 74 20 69 6e  |  ; Increment in|
0000ed90  74 65 72 73 65 63 74 69  6f 6e 20 63 6f 75 6e 74  |tersection count|
0000eda0  0d 29 04 41 20 20 20 20  20 20 20 20 42 20 20 20  |.).A        B   |
0000edb0  20 20 20 20 70 6c 6f 74  5f 70 6f 6c 79 5f 66 69  |    plot_poly_fi|
0000edc0  6c 6c 5f 69 6e 74 65 72  5f 6c 6f 6f 70 3b 20 4c  |ll_inter_loop; L|
0000edd0  6f 6f 70 20 66 6f 72 20  6e 65 78 74 20 65 64 67  |oop for next edg|
0000ede0  65 0d 29 0e 18 2e 70 6c  6f 74 5f 70 6f 6c 79 5f  |e.)...plot_poly_|
0000edf0  66 69 6c 6c 5f 70 6c 6f  74 0d 29 18 3d 20 20 20  |fill_plot.).=   |
0000ee00  20 20 20 20 20 53 54 4d  46 44 20 20 20 72 31 33  |     STMFD   r13|
0000ee10  21 2c 20 7b 72 31 2d 72  35 2c 20 72 31 34 7d 20  |!, {r1-r5, r14} |
0000ee20  20 20 20 20 20 3b 20 53  74 61 63 6b 20 72 65 67  |     ; Stack reg|
0000ee30  69 73 74 65 72 73 0d 29  22 3d 20 20 20 20 20 20  |isters.)"=      |
0000ee40  20 20 4d 4f 56 20 20 20  20 20 72 31 2c 20 72 35  |  MOV     r1, r5|
0000ee50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000ee60  20 20 3b 20 43 6f 70 79  20 72 6f 77 20 6e 75 6d  |  ; Copy row num|
0000ee70  62 65 72 0d 29 2c 4a 20  20 20 20 20 20 20 20 4d  |ber.),J        M|
0000ee80  4f 56 20 20 20 20 20 72  35 2c 20 72 32 2c 20 4c  |OV     r5, r2, L|
0000ee90  53 52 23 31 20 20 20 20  20 20 20 20 20 20 20 3b  |SR#1           ;|
0000eea0  20 43 61 6c 63 75 6c 61  74 65 20 6e 75 6d 62 65  | Calculate numbe|
0000eeb0  72 20 6f 66 20 73 65 67  6d 65 6e 74 73 0d 29 36  |r of segments.)6|
0000eec0  1d 2e 70 6c 6f 74 5f 70  6f 6c 79 5f 66 69 6c 6c  |..plot_poly_fill|
0000eed0  5f 70 6c 6f 74 5f 6c 6f  6f 70 0d 29 40 45 20 20  |_plot_loop.)@E  |
0000eee0  20 20 20 20 20 20 53 55  42 53 20 20 20 20 72 35  |      SUBS    r5|
0000eef0  2c 20 72 35 2c 20 23 31  20 20 20 20 20 20 20 20  |, r5, #1        |
0000ef00  20 20 20 20 20 20 3b 20  44 65 63 72 65 6d 65 6e  |      ; Decremen|
0000ef10  74 20 73 65 67 6d 65 6e  74 20 63 6f 75 6e 74 0d  |t segment count.|
0000ef20  29 4a 44 20 20 20 20 20  20 20 20 4c 44 4d 4d 49  |)JD        LDMMI|
0000ef30  46 44 20 72 31 33 21 2c  20 7b 72 31 2d 72 35 2c  |FD r13!, {r1-r5,|
0000ef40  20 70 63 7d 20 20 20 20  20 20 20 3b 20 52 65 74  | pc}       ; Ret|
0000ef50  75 72 6e 20 66 72 6f 6d  20 73 75 62 72 6f 75 74  |urn from subrout|
0000ef60  69 6e 65 0d 29 54 42 20  20 20 20 20 20 20 20 4c  |ine.)TB        L|
0000ef70  44 4d 49 41 20 20 20 72  34 21 2c 20 7b 72 32 2d  |DMIA   r4!, {r2-|
0000ef80  72 33 7d 20 20 20 20 20  20 20 20 20 20 20 20 3b  |r3}            ;|
0000ef90  20 52 65 61 64 20 73 65  67 6d 65 6e 74 20 64 65  | Read segment de|
0000efa0  74 61 69 6c 73 0d 29 5e  48 20 20 20 20 20 20 20  |tails.)^H       |
0000efb0  20 41 44 44 20 20 20 20  20 72 32 2c 20 72 32 2c  | ADD     r2, r2,|
0000efc0  20 23 31 20 20 20 20 20  20 20 20 20 20 20 20 20  | #1             |
0000efd0  20 3b 20 41 64 76 61 6e  63 65 20 74 68 65 20 73  | ; Advance the s|
0000efe0  74 61 72 74 20 70 6f 73  69 74 69 6f 6e 0d 29 68  |tart position.)h|
0000eff0  44 20 20 20 20 20 20 20  20 43 4d 50 20 20 20 20  |D        CMP    |
0000f000  20 72 32 2c 20 72 33 20  20 20 20 20 20 20 20 20  | r2, r3         |
0000f010  20 20 20 20 20 20 20 20  20 3b 20 49 73 20 74 68  |         ; Is th|
0000f020  65 20 73 65 67 6d 65 6e  74 20 76 69 73 69 62 6c  |e segment visibl|
0000f030  65 0d 29 72 4a 20 20 20  20 20 20 20 20 42 4c 4c  |e.)rJ        BLL|
0000f040  45 20 20 20 20 70 6c 6f  74 5f 72 6f 77 20 20 20  |E    plot_row   |
0000f050  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 50  |             ; P|
0000f060  6c 6f 74 20 74 68 69 73  20 73 65 67 6d 65 6e 74  |lot this segment|
0000f070  20 69 66 20 76 69 73 69  62 6c 65 0d 29 7c 47 20  | if visible.)|G |
0000f080  20 20 20 20 20 20 20 42  20 20 20 20 20 20 20 70  |       B       p|
0000f090  6c 6f 74 5f 70 6f 6c 79  5f 66 69 6c 6c 5f 70 6c  |lot_poly_fill_pl|
0000f0a0  6f 74 5f 6c 6f 6f 70 3b  20 4c 6f 6f 70 20 66 6f  |ot_loop; Loop fo|
0000f0b0  72 20 74 68 65 20 6e 65  78 74 20 73 65 67 6d 65  |r the next segme|
0000f0c0  6e 74 0d 29 86 04 0d 29  90 46 20 20 20 20 20 20  |nt.)...).F      |
0000f0d0  20 20 3b 20 45 78 70 61  6e 64 20 61 20 73 69 6e  |  ; Expand a sin|
0000f0e0  67 6c 65 20 62 79 74 65  20 63 6f 6c 6f 75 72 20  |gle byte colour |
0000f0f0  64 65 73 63 72 69 70 74  69 6f 6e 20 69 6e 74 6f  |description into|
0000f100  20 61 20 66 75 6c 6c 20  77 6f 72 64 0d 29 9a 12  | a full word.)..|
0000f110  2e 63 6f 6c 6f 75 72 5f  65 78 70 61 6e 64 0d 29  |.colour_expand.)|
0000f120  a4 3e 20 20 20 20 20 20  20 20 84 52 20 20 20 20  |.>        .R    |
0000f130  20 72 30 2c 20 72 30 2c  20 72 30 2c 20 4c 53 4c  | r0, r0, r0, LSL|
0000f140  23 38 20 20 20 20 20 20  20 3b 20 45 78 70 61 6e  |#8       ; Expan|
0000f150  64 20 74 6f 20 31 36 20  62 69 74 73 0d 29 ae 3e  |d to 16 bits.).>|
0000f160  20 20 20 20 20 20 20 20  84 52 20 20 20 20 20 72  |        .R     r|
0000f170  30 2c 20 72 30 2c 20 72  30 2c 20 4c 53 4c 23 31  |0, r0, r0, LSL#1|
0000f180  36 20 20 20 20 20 20 3b  20 45 78 70 61 6e 64 20  |6      ; Expand |
0000f190  74 6f 20 33 32 20 62 69  74 73 0d 29 b8 44 20 20  |to 32 bits.).D  |
0000f1a0  20 20 20 20 20 20 4d 4f  56 20 20 20 20 20 70 63  |      MOV     pc|
0000f1b0  2c 20 72 31 34 20 20 20  20 20 20 20 20 20 20 20  |, r14           |
0000f1c0  20 20 20 20 20 20 3b 20  52 65 74 75 72 6e 20 66  |      ; Return f|
0000f1d0  72 6f 6d 20 73 75 62 72  6f 75 74 69 6e 65 0d 29  |rom subroutine.)|
0000f1e0  c2 04 0d 29 cc 28 20 20  20 20 20 20 20 20 3b 20  |...).(        ; |
0000f1f0  44 69 76 69 64 65 20 72  30 20 62 79 20 72 31 20  |Divide r0 by r1 |
0000f200  74 6f 20 67 69 76 65 20  72 30 0d 29 d6 3d 2e 64  |to give r0.).=.d|
0000f210  69 76 69 64 65 20 53 54  4d 46 44 20 20 20 72 31  |ivide STMFD   r1|
0000f220  33 21 2c 20 7b 72 32 2d  72 33 2c 20 72 31 34 7d  |3!, {r2-r3, r14}|
0000f230  20 20 20 20 20 20 3b 20  53 74 61 63 6b 20 72 65  |      ; Stack re|
0000f240  67 69 73 74 65 72 73 0d  29 e0 42 20 20 20 20 20  |gisters.).B     |
0000f250  20 20 20 43 4d 50 20 20  20 20 20 72 30 2c 20 23  |   CMP     r0, #|
0000f260  30 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |0               |
0000f270  20 20 20 3b 20 49 73 20  64 69 76 69 64 65 6e 64  |   ; Is dividend|
0000f280  20 6e 65 67 61 74 69 76  65 0d 29 ea 49 20 20 20  | negative.).I   |
0000f290  20 20 20 20 20 52 53 42  4d 49 20 20 20 72 30 2c  |     RSBMI   r0,|
0000f2a0  20 72 30 2c 20 23 30 20  20 20 20 20 20 20 20 20  | r0, #0         |
0000f2b0  20 20 20 20 20 3b 20 45  6e 73 75 72 65 20 64 69  |     ; Ensure di|
0000f2c0  76 69 64 65 6e 64 20 69  73 20 70 6f 73 69 74 69  |vidend is positi|
0000f2d0  76 65 0d 29 f4 42 20 20  20 20 20 20 20 20 42 4c  |ve.).B        BL|
0000f2e0  20 20 20 20 20 20 64 69  76 69 64 65 5f 75 6e 73  |      divide_uns|
0000f2f0  69 67 6e 65 64 20 20 20  20 20 20 20 20 20 3b 20  |igned         ; |
0000f300  50 65 72 66 6f 72 6d 20  74 68 65 20 64 69 76 69  |Perform the divi|
0000f310  73 69 6f 6e 0d 29 fe 4c  20 20 20 20 20 20 20 20  |sion.).L        |
0000f320  52 53 42 4d 49 20 20 20  72 30 2c 20 72 30 2c 20  |RSBMI   r0, r0, |
0000f330  23 30 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |#0              |
0000f340  3b 20 43 6f 72 72 65 63  74 20 74 68 65 20 73 69  |; Correct the si|
0000f350  67 6e 20 6f 66 20 74 68  65 20 72 65 73 75 6c 74  |gn of the result|
0000f360  0d 2a 08 44 20 20 20 20  20 20 20 20 4c 44 4d 46  |.*.D        LDMF|
0000f370  44 20 20 20 72 31 33 21  2c 20 7b 72 32 2d 72 33  |D   r13!, {r2-r3|
0000f380  2c 20 70 63 7d 20 20 20  20 20 20 20 3b 20 52 65  |, pc}       ; Re|
0000f390  74 75 72 6e 20 66 72 6f  6d 20 73 75 62 72 6f 75  |turn from subrou|
0000f3a0  74 69 6e 65 0d 2a 12 14  2e 64 69 76 69 64 65 5f  |tine.*...divide_|
0000f3b0  75 6e 73 69 67 6e 65 64  0d 2a 1c 3e 20 20 20 20  |unsigned.*.>    |
0000f3c0  20 20 20 20 4d 4f 56 20  20 20 20 20 72 33 2c 20  |    MOV     r3, |
0000f3d0  72 31 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r1              |
0000f3e0  20 20 20 20 3b 20 43 6f  70 79 20 74 68 65 20 64  |    ; Copy the d|
0000f3f0  69 76 69 73 6f 72 0d 2a  26 54 20 20 20 20 20 20  |ivisor.*&T      |
0000f400  20 20 43 4d 50 20 20 20  20 20 72 33 2c 20 72 30  |  CMP     r3, r0|
0000f410  2c 20 4c 53 52 23 31 20  20 20 20 20 20 20 20 20  |, LSR#1         |
0000f420  20 20 3b 20 49 73 20 64  69 76 69 73 6f 72 20 6c  |  ; Is divisor l|
0000f430  61 72 67 65 72 20 74 68  61 6e 20 64 6f 75 62 6c  |arger than doubl|
0000f440  65 20 64 69 76 69 64 65  6e 64 0d 2a 30 1b 2e 64  |e dividend.*0..d|
0000f450  69 76 69 64 65 5f 75 6e  73 69 67 6e 65 64 5f 64  |ivide_unsigned_d|
0000f460  6f 75 62 6c 65 0d 2a 3a  40 20 20 20 20 20 20 20  |ouble.*:@       |
0000f470  20 4d 4f 56 4c 53 20 20  20 72 33 2c 20 72 33 2c  | MOVLS   r3, r3,|
0000f480  20 4c 53 4c 23 31 20 20  20 20 20 20 20 20 20 20  | LSL#1          |
0000f490  20 3b 20 44 6f 75 62 6c  65 20 74 68 65 20 64 69  | ; Double the di|
0000f4a0  76 69 73 6f 72 0d 2a 44  54 20 20 20 20 20 20 20  |visor.*DT       |
0000f4b0  20 43 4d 50 4c 53 20 20  20 72 33 2c 20 72 30 2c  | CMPLS   r3, r0,|
0000f4c0  20 4c 53 52 23 31 20 20  20 20 20 20 20 20 20 20  | LSR#1          |
0000f4d0  20 3b 20 49 73 20 64 69  76 69 73 6f 72 20 6c 61  | ; Is divisor la|
0000f4e0  72 67 65 72 20 74 68 61  6e 20 64 6f 75 62 6c 65  |rger than double|
0000f4f0  20 64 69 76 69 64 65 6e  64 0d 2a 4e 4c 20 20 20  | dividend.*NL   |
0000f500  20 20 20 20 20 42 4c 53  20 20 20 20 20 64 69 76  |     BLS     div|
0000f510  69 64 65 5f 75 6e 73 69  67 6e 65 64 5f 64 6f 75  |ide_unsigned_dou|
0000f520  62 6c 65 20 20 3b 20 4c  6f 6f 70 20 61 67 61 69  |ble  ; Loop agai|
0000f530  6e 20 69 66 20 6e 6f 74  20 6c 61 72 67 65 20 65  |n if not large e|
0000f540  6e 6f 75 67 68 0d 2a 58  40 20 20 20 20 20 20 20  |nough.*X@       |
0000f550  20 4d 4f 56 20 20 20 20  20 72 32 2c 20 23 30 20  | MOV     r2, #0 |
0000f560  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000f570  20 3b 20 43 6c 65 61 72  20 74 68 65 20 71 75 6f  | ; Clear the quo|
0000f580  74 69 65 6e 74 0d 2a 62  19 2e 64 69 76 69 64 65  |tient.*b..divide|
0000f590  5f 75 6e 73 69 67 6e 65  64 5f 6c 6f 6f 70 0d 2a  |_unsigned_loop.*|
0000f5a0  6c 4b 20 20 20 20 20 20  20 20 43 4d 50 20 20 20  |lK        CMP   |
0000f5b0  20 20 72 30 2c 20 72 33  20 20 20 20 20 20 20 20  |  r0, r3        |
0000f5c0  20 20 20 20 20 20 20 20  20 20 3b 20 43 61 6e 20  |          ; Can |
0000f5d0  74 68 65 20 64 69 76 69  73 6f 72 20 62 65 20 73  |the divisor be s|
0000f5e0  75 62 74 72 61 63 74 65  64 0d 2a 76 4a 20 20 20  |ubtracted.*vJ   |
0000f5f0  20 20 20 20 20 53 55 42  43 53 20 20 20 72 30 2c  |     SUBCS   r0,|
0000f600  20 72 30 2c 20 72 33 20  20 20 20 20 20 20 20 20  | r0, r3         |
0000f610  20 20 20 20 20 3b 20 53  75 62 74 72 61 63 74 20  |     ; Subtract |
0000f620  64 69 76 69 73 6f 72 20  69 66 20 70 6f 73 73 69  |divisor if possi|
0000f630  62 6c 65 0d 2a 80 51 20  20 20 20 20 20 20 20 41  |ble.*.Q        A|
0000f640  44 43 20 20 20 20 20 72  32 2c 20 72 32 2c 20 72  |DC     r2, r2, r|
0000f650  32 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |2              ;|
0000f660  20 44 6f 75 62 6c 65 20  71 75 6f 74 69 65 6e 74  | Double quotient|
0000f670  20 61 6e 64 20 61 64 64  20 74 68 65 20 6e 65 77  | and add the new|
0000f680  20 62 69 74 0d 2a 8a 3f  20 20 20 20 20 20 20 20  | bit.*.?        |
0000f690  4d 4f 56 20 20 20 20 20  72 33 2c 20 72 33 2c 20  |MOV     r3, r3, |
0000f6a0  4c 53 52 23 31 20 20 20  20 20 20 20 20 20 20 20  |LSR#1           |
0000f6b0  3b 20 48 61 6c 76 65 20  74 68 65 20 64 69 76 69  |; Halve the divi|
0000f6c0  73 6f 72 0d 2a 94 54 20  20 20 20 20 20 20 20 43  |sor.*.T        C|
0000f6d0  4d 50 20 20 20 20 20 72  33 2c 20 72 31 20 20 20  |MP     r3, r1   |
0000f6e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
0000f6f0  20 48 61 73 20 74 68 65  20 6f 72 69 67 69 6e 61  | Has the origina|
0000f700  6c 20 64 69 76 69 73 6f  72 20 62 65 65 6e 20 65  |l divisor been e|
0000f710  78 63 65 65 64 65 64 0d  2a 9e 40 20 20 20 20 20  |xceeded.*.@     |
0000f720  20 20 20 42 43 53 20 20  20 20 20 64 69 76 69 64  |   BCS     divid|
0000f730  65 5f 75 6e 73 69 67 6e  65 64 5f 6c 6f 6f 70 20  |e_unsigned_loop |
0000f740  20 20 20 3b 20 4c 6f 6f  70 20 69 66 20 69 74 20  |   ; Loop if it |
0000f750  68 61 73 20 6e 6f 74 0d  2a a8 3d 20 20 20 20 20  |has not.*.=     |
0000f760  20 20 20 4d 4f 56 20 20  20 20 20 72 30 2c 20 72  |   MOV     r0, r|
0000f770  32 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |2               |
0000f780  20 20 20 3b 20 43 6f 70  79 20 74 68 65 20 72 65  |   ; Copy the re|
0000f790  73 75 6c 74 0d 2a b2 44  20 20 20 20 20 20 20 20  |sult.*.D        |
0000f7a0  4d 4f 56 53 20 20 20 20  70 63 2c 20 72 31 34 20  |MOVS    pc, r14 |
0000f7b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000f7c0  3b 20 52 65 74 75 72 6e  20 66 72 6f 6d 20 73 75  |; Return from su|
0000f7d0  62 72 6f 75 74 69 6e 65  0d 2a bc 04 0d 2a c6 4f  |broutine.*...*.O|
0000f7e0  20 20 20 20 20 20 20 20  3b 20 43 61 6c 63 75 6c  |        ; Calcul|
0000f7f0  61 74 65 20 74 68 65 20  73 71 75 61 72 65 20 72  |ate the square r|
0000f800  6f 6f 74 20 6f 66 20 61  6e 20 75 6e 73 69 67 6e  |oot of an unsign|
0000f810  65 64 20 69 6e 74 65 67  65 72 20 69 6e 20 72 30  |ed integer in r0|
0000f820  20 74 6f 20 67 69 76 65  20 72 30 0d 2a d0 3d 2e  | to give r0.*.=.|
0000f830  73 71 72 74 20 20 20 53  54 4d 46 44 20 20 20 72  |sqrt   STMFD   r|
0000f840  31 33 21 2c 20 7b 72 31  2d 72 34 2c 20 72 31 34  |13!, {r1-r4, r14|
0000f850  7d 20 20 20 20 20 20 3b  20 53 74 61 63 6b 20 72  |}      ; Stack r|
0000f860  65 67 69 73 74 65 72 73  0d 2a da 47 20 20 20 20  |egisters.*.G    |
0000f870  20 20 20 20 4d 4f 56 20  20 20 20 20 72 31 2c 20  |    MOV     r1, |
0000f880  72 30 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r0              |
0000f890  20 20 20 20 3b 20 43 6f  70 79 20 74 68 65 20 6f  |    ; Copy the o|
0000f8a0  72 69 67 69 6e 61 6c 20  69 6e 74 65 67 65 72 0d  |riginal integer.|
0000f8b0  2a e4 43 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |*.C        MOV  |
0000f8c0  20 20 20 72 30 2c 20 23  30 20 20 20 20 20 20 20  |   r0, #0       |
0000f8d0  20 20 20 20 20 20 20 20  20 20 20 3b 20 49 6e 69  |           ; Ini|
0000f8e0  74 69 61 6c 69 73 65 20  74 68 65 20 72 65 73 75  |tialise the resu|
0000f8f0  6c 74 0d 2a ee 43 20 20  20 20 20 20 20 20 4d 4f  |lt.*.C        MO|
0000f900  56 20 20 20 20 20 72 32  2c 20 23 31 3c 3c 31 35  |V     r2, #1<<15|
0000f910  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
0000f920  54 68 65 20 66 69 72 73  74 20 62 69 74 20 74 6f  |The first bit to|
0000f930  20 74 65 73 74 0d 2a f8  0e 2e 73 71 72 74 5f 6c  | test.*...sqrt_l|
0000f940  6f 6f 70 0d 2b 02 48 20  20 20 20 20 20 20 20 84  |oop.+.H        .|
0000f950  52 20 20 20 20 20 72 33  2c 20 72 30 2c 20 72 32  |R     r3, r0, r2|
0000f960  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
0000f970  43 6f 6e 73 74 72 75 63  74 20 74 68 65 20 63 75  |Construct the cu|
0000f980  72 72 65 6e 74 20 67 75  65 73 73 0d 2b 0c 46 20  |rrent guess.+.F |
0000f990  20 20 20 20 20 20 20 4d  55 4c 20 20 20 20 20 72  |       MUL     r|
0000f9a0  34 2c 20 72 33 2c 20 72  33 20 20 20 20 20 20 20  |4, r3, r3       |
0000f9b0  20 20 20 20 20 20 20 3b  20 53 71 75 61 72 65 20  |       ; Square |
0000f9c0  74 68 65 20 63 75 72 72  65 6e 74 20 67 75 65 73  |the current gues|
0000f9d0  73 0d 2b 16 4d 20 20 20  20 20 20 20 20 43 4d 50  |s.+.M        CMP|
0000f9e0  20 20 20 20 20 72 34 2c  20 72 31 20 20 20 20 20  |     r4, r1     |
0000f9f0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 43  |             ; C|
0000fa00  6f 6d 70 61 72 65 20 77  69 74 68 20 74 68 65 20  |ompare with the |
0000fa10  72 65 71 75 69 72 65 64  20 76 61 6c 75 65 0d 2b  |required value.+|
0000fa20  20 50 20 20 20 20 20 20  20 20 4d 4f 56 4c 53 20  | P        MOVLS |
0000fa30  20 20 72 30 2c 20 72 33  20 20 20 20 20 20 20 20  |  r0, r3        |
0000fa40  20 20 20 20 20 20 20 20  20 20 3b 20 4b 65 65 70  |          ; Keep|
0000fa50  20 74 68 65 20 63 75 72  72 65 6e 74 20 67 75 65  | the current gue|
0000fa60  73 73 20 69 66 20 73 75  69 74 61 62 6c 65 0d 2b  |ss if suitable.+|
0000fa70  2a 45 20 20 20 20 20 20  20 20 4d 4f 56 53 20 20  |*E        MOVS  |
0000fa80  20 20 72 32 2c 20 72 32  2c 20 4c 53 52 23 31 20  |  r2, r2, LSR#1 |
0000fa90  20 20 20 20 20 20 20 20  20 20 3b 20 41 64 76 61  |          ; Adva|
0000faa0  6e 63 65 20 74 6f 20 74  68 65 20 6e 65 78 74 20  |nce to the next |
0000fab0  62 69 74 0d 2b 34 48 20  20 20 20 20 20 20 20 42  |bit.+4H        B|
0000fac0  4e 45 20 20 20 20 20 73  71 72 74 5f 6c 6f 6f 70  |NE     sqrt_loop|
0000fad0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
0000fae0  20 4c 6f 6f 70 20 75 6e  74 69 6c 20 61 6c 6c 20  | Loop until all |
0000faf0  62 69 74 73 20 74 65 73  74 65 64 0d 2b 3e 44 20  |bits tested.+>D |
0000fb00  20 20 20 20 20 20 20 4c  44 4d 46 44 20 20 20 72  |       LDMFD   r|
0000fb10  31 33 21 2c 20 7b 72 31  2d 72 34 2c 20 70 63 7d  |13!, {r1-r4, pc}|
0000fb20  20 20 20 20 20 20 20 3b  20 52 65 74 75 72 6e 20  |       ; Return |
0000fb30  66 72 6f 6d 20 73 75 62  72 6f 75 74 69 6e 65 0d  |from subroutine.|
0000fb40  2b 48 04 0d 2b 52 46 20  20 20 20 20 20 20 20 3b  |+H..+RF        ;|
0000fb50  20 4e 6f 72 6d 61 6c 69  73 65 20 61 20 76 65 63  | Normalise a vec|
0000fb60  74 6f 72 20 28 72 30 2c  20 72 31 29 20 74 6f 20  |tor (r0, r1) to |
0000fb70  68 61 76 65 20 61 20 6d  61 67 6e 69 74 75 64 65  |have a magnitude|
0000fb80  20 6f 66 20 31 3c 3c 31  36 0d 2b 5c 0e 2e 6e 6f  | of 1<<16.+\..no|
0000fb90  72 6d 61 6c 69 73 65 0d  2b 66 3d 20 20 20 20 20  |rmalise.+f=     |
0000fba0  20 20 20 53 54 4d 46 44  20 20 20 72 31 33 21 2c  |   STMFD   r13!,|
0000fbb0  20 7b 72 32 2d 72 35 2c  20 72 31 34 7d 20 20 20  | {r2-r5, r14}   |
0000fbc0  20 20 20 3b 20 53 74 61  63 6b 20 72 65 67 69 73  |   ; Stack regis|
0000fbd0  74 65 72 73 0d 2b 70 48  20 20 20 20 20 20 20 20  |ters.+pH        |
0000fbe0  54 45 51 20 20 20 20 20  72 30 2c 20 23 30 20 20  |TEQ     r0, #0  |
0000fbf0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000fc00  3b 20 43 68 65 63 6b 20  68 6f 72 69 7a 6f 6e 74  |; Check horizont|
0000fc10  61 6c 20 63 6f 6d 70 6f  6e 65 6e 74 0d 2b 7a 46  |al component.+zF|
0000fc20  20 20 20 20 20 20 20 20  54 45 51 45 51 20 20 20  |        TEQEQ   |
0000fc30  72 31 2c 20 23 30 20 20  20 20 20 20 20 20 20 20  |r1, #0          |
0000fc40  20 20 20 20 20 20 20 20  3b 20 43 68 65 63 6b 20  |        ; Check |
0000fc50  76 65 72 74 69 63 61 6c  20 63 6f 6d 70 6f 6e 65  |vertical compone|
0000fc60  6e 74 0d 2b 84 4e 20 20  20 20 20 20 20 20 42 45  |nt.+.N        BE|
0000fc70  51 20 20 20 20 20 6e 6f  72 6d 61 6c 69 73 65 5f  |Q     normalise_|
0000fc80  64 6f 6e 65 20 20 20 20  20 20 20 20 20 20 3b 20  |done          ; |
0000fc90  55 6e 61 62 6c 65 20 74  6f 20 6e 6f 72 6d 61 6c  |Unable to normal|
0000fca0  69 73 65 20 7a 65 72 6f  20 76 65 63 74 6f 72 73  |ise zero vectors|
0000fcb0  0d 2b 8e 4b 20 20 20 20  20 20 20 20 4d 4f 56 53  |.+.K        MOVS|
0000fcc0  20 20 20 20 72 32 2c 20  72 30 20 20 20 20 20 20  |    r2, r0      |
0000fcd0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 43 6f  |            ; Co|
0000fce0  70 79 20 74 68 65 20 68  6f 72 69 7a 6f 6e 74 61  |py the horizonta|
0000fcf0  6c 20 63 6f 6d 70 6f 6e  65 6e 74 0d 2b 98 42 20  |l component.+.B |
0000fd00  20 20 20 20 20 20 20 52  53 42 4d 49 20 20 20 72  |       RSBMI   r|
0000fd10  30 2c 20 72 30 2c 20 23  30 20 20 20 20 20 20 20  |0, r0, #0       |
0000fd20  20 20 20 20 20 20 20 3b  20 4b 65 65 70 20 61 20  |       ; Keep a |
0000fd30  70 6f 73 69 74 69 76 65  20 63 6f 70 79 0d 2b a2  |positive copy.+.|
0000fd40  49 20 20 20 20 20 20 20  20 4d 4f 56 53 20 20 20  |I        MOVS   |
0000fd50  20 72 33 2c 20 72 31 20  20 20 20 20 20 20 20 20  | r3, r1         |
0000fd60  20 20 20 20 20 20 20 20  20 3b 20 43 6f 70 79 20  |         ; Copy |
0000fd70  74 68 65 20 76 65 72 74  69 63 61 6c 20 63 6f 6d  |the vertical com|
0000fd80  70 6f 6e 65 6e 74 0d 2b  ac 42 20 20 20 20 20 20  |ponent.+.B      |
0000fd90  20 20 52 53 42 4d 49 20  20 20 72 31 2c 20 72 31  |  RSBMI   r1, r1|
0000fda0  2c 20 23 30 20 20 20 20  20 20 20 20 20 20 20 20  |, #0            |
0000fdb0  20 20 3b 20 4b 65 65 70  20 61 20 70 6f 73 69 74  |  ; Keep a posit|
0000fdc0  69 76 65 20 63 6f 70 79  0d 2b b6 17 2e 6e 6f 72  |ive copy.+...nor|
0000fdd0  6d 61 6c 69 73 65 5f 70  72 65 73 63 61 6c 65 0d  |malise_prescale.|
0000fde0  2b c0 4f 20 20 20 20 20  20 20 20 54 53 54 20 20  |+.O        TST  |
0000fdf0  20 20 20 72 30 2c 20 23  31 3c 3c 33 30 20 20 20  |   r0, #1<<30   |
0000fe00  20 20 20 20 20 20 20 20  20 20 20 3b 20 49 73 20  |           ; Is |
0000fe10  74 68 65 20 68 6f 72 69  7a 6f 6e 74 61 6c 20 63  |the horizontal c|
0000fe20  6f 6d 70 6f 6e 65 6e 74  20 6c 61 72 67 65 0d 2b  |omponent large.+|
0000fe30  ca 4d 20 20 20 20 20 20  20 20 54 53 54 45 51 20  |.M        TSTEQ |
0000fe40  20 20 72 31 2c 20 23 31  3c 3c 33 30 20 20 20 20  |  r1, #1<<30    |
0000fe50  20 20 20 20 20 20 20 20  20 20 3b 20 49 73 20 74  |          ; Is t|
0000fe60  68 65 20 76 65 72 74 69  63 61 6c 20 63 6f 6d 70  |he vertical comp|
0000fe70  6f 6e 65 6e 74 20 6c 61  72 67 65 0d 2b d4 47 20  |onent large.+.G |
0000fe80  20 20 20 20 20 20 20 42  4e 45 20 20 20 20 20 6e  |       BNE     n|
0000fe90  6f 72 6d 61 6c 69 73 65  5f 70 72 65 73 63 61 6c  |ormalise_prescal|
0000fea0  65 5f 64 6f 6e 65 20 3b  20 53 6b 69 70 20 6c 6f  |e_done ; Skip lo|
0000feb0  6f 70 20 69 66 20 6c 61  72 67 65 20 65 6e 6f 75  |op if large enou|
0000fec0  67 68 0d 2b de 4d 20 20  20 20 20 20 20 20 4d 4f  |gh.+.M        MO|
0000fed0  56 20 20 20 20 20 72 32  2c 20 72 32 2c 20 41 53  |V     r2, r2, AS|
0000fee0  4c 23 31 20 20 20 20 20  20 20 20 20 20 20 3b 20  |L#1           ; |
0000fef0  44 6f 75 62 6c 65 20 74  68 65 20 68 6f 72 69 7a  |Double the horiz|
0000ff00  6f 6e 74 61 6c 20 63 6f  6d 70 6f 6e 65 6e 74 0d  |ontal component.|
0000ff10  2b e8 52 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |+.R        MOV  |
0000ff20  20 20 20 72 30 2c 20 72  30 2c 20 41 53 4c 23 31  |   r0, r0, ASL#1|
0000ff30  20 20 20 20 20 20 20 20  20 20 20 3b 20 44 6f 75  |           ; Dou|
0000ff40  62 6c 65 20 74 68 65 20  68 6f 72 69 7a 6f 6e 74  |ble the horizont|
0000ff50  61 6c 20 63 6f 6d 70 6f  6e 65 6e 74 20 63 6f 70  |al component cop|
0000ff60  79 0d 2b f2 4b 20 20 20  20 20 20 20 20 4d 4f 56  |y.+.K        MOV|
0000ff70  20 20 20 20 20 72 33 2c  20 72 33 2c 20 41 53 4c  |     r3, r3, ASL|
0000ff80  23 31 20 20 20 20 20 20  20 20 20 20 20 3b 20 44  |#1           ; D|
0000ff90  6f 75 62 6c 65 20 74 68  65 20 76 65 72 74 69 63  |ouble the vertic|
0000ffa0  61 6c 20 63 6f 6d 70 6f  6e 65 6e 74 0d 2b fc 50  |al component.+.P|
0000ffb0  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
0000ffc0  72 31 2c 20 72 31 2c 20  41 53 4c 23 31 20 20 20  |r1, r1, ASL#1   |
0000ffd0  20 20 20 20 20 20 20 20  3b 20 44 6f 75 62 6c 65  |        ; Double|
0000ffe0  20 74 68 65 20 76 65 72  74 69 63 61 6c 20 63 6f  | the vertical co|
0000fff0  6d 70 6f 6e 65 6e 74 20  63 6f 70 79 0d 2c 06 45  |mponent copy.,.E|
00010000  20 20 20 20 20 20 20 20  42 20 20 20 20 20 20 20  |        B       |
00010010  6e 6f 72 6d 61 6c 69 73  65 5f 70 72 65 73 63 61  |normalise_presca|
00010020  6c 65 20 20 20 20 20 20  3b 20 4c 6f 6f 70 20 75  |le      ; Loop u|
00010030  6e 74 69 6c 20 6c 61 72  67 65 20 65 6e 6f 75 67  |ntil large enoug|
00010040  68 0d 2c 10 1c 2e 6e 6f  72 6d 61 6c 69 73 65 5f  |h.,...normalise_|
00010050  70 72 65 73 63 61 6c 65  5f 64 6f 6e 65 0d 2c 1a  |prescale_done.,.|
00010060  4d 20 20 20 20 20 20 20  20 4d 4f 56 20 20 20 20  |M        MOV    |
00010070  20 72 34 2c 20 72 32 2c  20 41 53 52 23 31 36 20  | r4, r2, ASR#16 |
00010080  20 20 20 20 20 20 20 20  20 3b 20 53 63 61 6c 65  |         ; Scale|
00010090  20 64 6f 77 6e 20 68 6f  72 69 7a 6f 6e 74 61 6c  | down horizontal|
000100a0  20 63 6f 6d 70 6f 6e 65  6e 74 0d 2c 24 4b 20 20  | component.,$K  |
000100b0  20 20 20 20 20 20 4d 4f  56 20 20 20 20 20 72 35  |      MOV     r5|
000100c0  2c 20 72 33 2c 20 41 53  52 23 31 36 20 20 20 20  |, r3, ASR#16    |
000100d0  20 20 20 20 20 20 3b 20  53 63 61 6c 65 20 64 6f  |      ; Scale do|
000100e0  77 6e 20 76 65 72 74 69  63 61 6c 20 63 6f 6d 70  |wn vertical comp|
000100f0  6f 6e 65 6e 74 0d 2c 2e  4d 20 20 20 20 20 20 20  |onent.,.M       |
00010100  20 4d 55 4c 20 20 20 20  20 72 30 2c 20 72 34 2c  | MUL     r0, r4,|
00010110  20 72 34 20 20 20 20 20  20 20 20 20 20 20 20 20  | r4             |
00010120  20 3b 20 53 71 75 61 72  65 20 74 68 65 20 68 6f  | ; Square the ho|
00010130  72 69 7a 6f 6e 74 61 6c  20 63 6f 6d 70 6f 6e 65  |rizontal compone|
00010140  6e 74 0d 2c 38 4b 20 20  20 20 20 20 20 20 4d 55  |nt.,8K        MU|
00010150  4c 20 20 20 20 20 72 31  2c 20 72 35 2c 20 72 35  |L     r1, r5, r5|
00010160  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00010170  53 71 75 61 72 65 20 74  68 65 20 76 65 72 74 69  |Square the verti|
00010180  63 61 6c 20 63 6f 6d 70  6f 6e 65 6e 74 0d 2c 42  |cal component.,B|
00010190  4c 20 20 20 20 20 20 20  20 41 44 44 20 20 20 20  |L        ADD    |
000101a0  20 72 30 2c 20 72 30 2c  20 72 31 20 20 20 20 20  | r0, r0, r1     |
000101b0  20 20 20 20 20 20 20 20  20 3b 20 53 75 6d 20 74  |         ; Sum t|
000101c0  68 65 20 73 71 75 61 72  65 73 20 6f 66 20 74 68  |he squares of th|
000101d0  65 20 6c 65 6e 67 74 68  73 0d 2c 4c 50 20 20 20  |e lengths.,LP   |
000101e0  20 20 20 20 20 42 4c 20  20 20 20 20 20 73 71 72  |     BL      sqr|
000101f0  74 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |t               |
00010200  20 20 20 20 20 3b 20 43  61 6c 63 75 6c 61 74 65  |     ; Calculate|
00010210  20 74 68 65 20 6c 65 6e  67 74 68 20 6f 66 20 74  | the length of t|
00010220  68 65 20 76 65 63 74 6f  72 0d 2c 56 40 20 20 20  |he vector.,V@   |
00010230  20 20 20 20 20 54 45 51  20 20 20 20 20 72 30 2c  |     TEQ     r0,|
00010240  20 23 30 20 20 20 20 20  20 20 20 20 20 20 20 20  | #0             |
00010250  20 20 20 20 20 3b 20 49  73 20 74 68 65 20 6c 65  |     ; Is the le|
00010260  6e 67 74 68 20 7a 65 72  6f 0d 2c 60 41 20 20 20  |ngth zero.,`A   |
00010270  20 20 20 20 20 ec 51 20  20 20 72 30 2c 20 23 31  |     .Q   r0, #1|
00010280  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00010290  20 20 3b 20 46 6f 72 63  65 20 61 20 6d 69 6e 69  |  ; Force a mini|
000102a0  6d 75 6d 20 6c 65 6e 67  74 68 0d 2c 6a 46 20 20  |mum length.,jF  |
000102b0  20 20 20 20 20 20 4d 4f  56 20 20 20 20 20 72 31  |      MOV     r1|
000102c0  2c 20 72 30 20 20 20 20  20 20 20 20 20 20 20 20  |, r0            |
000102d0  20 20 20 20 20 20 3b 20  43 6f 70 79 20 6c 65 6e  |      ; Copy len|
000102e0  67 74 68 20 74 6f 20 64  69 76 69 64 65 20 62 79  |gth to divide by|
000102f0  0d 2c 74 49 20 20 20 20  20 20 20 20 4d 4f 56 20  |.,tI        MOV |
00010300  20 20 20 20 72 30 2c 20  72 33 20 20 20 20 20 20  |    r0, r3      |
00010310  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 43 6f  |            ; Co|
00010320  70 79 20 74 68 65 20 76  65 72 74 69 63 61 6c 20  |py the vertical |
00010330  63 6f 6d 70 6f 6e 65 6e  74 0d 2c 7e 4a 20 20 20  |component.,~J   |
00010340  20 20 20 20 20 42 4c 20  20 20 20 20 20 64 69 76  |     BL      div|
00010350  69 64 65 20 20 20 20 20  20 20 20 20 20 20 20 20  |ide             |
00010360  20 20 20 20 20 3b 20 53  63 61 6c 65 20 74 68 65  |     ; Scale the|
00010370  20 76 65 72 74 69 63 61  6c 20 63 6f 6d 70 6f 6e  | vertical compon|
00010380  65 6e 74 0d 2c 88 51 20  20 20 20 20 20 20 20 4d  |ent.,.Q        M|
00010390  4f 56 20 20 20 20 20 72  33 2c 20 72 30 20 20 20  |OV     r3, r0   |
000103a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
000103b0  20 53 74 6f 72 65 20 74  68 65 20 73 63 61 6c 65  | Store the scale|
000103c0  64 20 76 65 72 74 69 63  61 6c 20 63 6f 6d 70 6f  |d vertical compo|
000103d0  6e 65 6e 74 0d 2c 92 4b  20 20 20 20 20 20 20 20  |nent.,.K        |
000103e0  4d 4f 56 20 20 20 20 20  72 30 2c 20 72 32 20 20  |MOV     r0, r2  |
000103f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00010400  3b 20 43 6f 70 79 20 74  68 65 20 68 6f 72 69 7a  |; Copy the horiz|
00010410  6f 6e 74 61 6c 20 63 6f  6d 70 6f 6e 65 6e 74 0d  |ontal component.|
00010420  2c 9c 4c 20 20 20 20 20  20 20 20 42 4c 20 20 20  |,.L        BL   |
00010430  20 20 20 64 69 76 69 64  65 20 20 20 20 20 20 20  |   divide       |
00010440  20 20 20 20 20 20 20 20  20 20 20 3b 20 53 63 61  |           ; Sca|
00010450  6c 65 20 74 68 65 20 68  6f 72 69 7a 6f 6e 74 61  |le the horizonta|
00010460  6c 20 63 6f 6d 70 6f 6e  65 6e 74 0d 2c a6 53 20  |l component.,.S |
00010470  20 20 20 20 20 20 20 4d  4f 56 20 20 20 20 20 72  |       MOV     r|
00010480  31 2c 20 72 33 20 20 20  20 20 20 20 20 20 20 20  |1, r3           |
00010490  20 20 20 20 20 20 20 3b  20 52 65 73 74 6f 72 65  |       ; Restore|
000104a0  20 74 68 65 20 73 63 61  6c 65 64 20 76 65 72 74  | the scaled vert|
000104b0  69 63 61 6c 20 63 6f 6d  70 6f 6e 65 6e 74 0d 2c  |ical component.,|
000104c0  b0 13 2e 6e 6f 72 6d 61  6c 69 73 65 5f 64 6f 6e  |...normalise_don|
000104d0  65 0d 2c ba 44 20 20 20  20 20 20 20 20 4c 44 4d  |e.,.D        LDM|
000104e0  46 44 20 20 20 72 31 33  21 2c 20 7b 72 32 2d 72  |FD   r13!, {r2-r|
000104f0  35 2c 20 70 63 7d 20 20  20 20 20 20 20 3b 20 52  |5, pc}       ; R|
00010500  65 74 75 72 6e 20 66 72  6f 6d 20 73 75 62 72 6f  |eturn from subro|
00010510  75 74 69 6e 65 0d 2c c4  04 0d 2c ce 54 20 20 20  |utine.,...,.T   |
00010520  20 20 20 20 20 3b 20 53  63 61 6c 65 20 61 6e 64  |     ; Scale and|
00010530  20 74 72 61 6e 73 6c 61  74 65 20 72 30 20 63 6f  | translate r0 co|
00010540  6f 72 64 69 6e 61 74 65  73 20 66 72 6f 6d 20 61  |ordinates from a|
00010550  74 20 72 31 20 74 6f 20  61 74 20 72 32 20 66 6f  |t r1 to at r2 fo|
00010560  72 20 74 68 65 20 70 6f  69 6e 74 65 72 0d 2c d8  |r the pointer.,.|
00010570  0e 2e 74 72 61 6e 73 5f  66 69 74 0d 2c e2 3d 20  |..trans_fit.,.= |
00010580  20 20 20 20 20 20 20 53  54 4d 46 44 20 20 20 72  |       STMFD   r|
00010590  31 33 21 2c 20 7b 72 30  2d 72 31 30 2c 20 72 31  |13!, {r0-r10, r1|
000105a0  34 7d 20 20 20 20 20 3b  20 53 74 61 63 6b 20 72  |4}     ; Stack r|
000105b0  65 67 69 73 74 65 72 73  0d 2c ec 4b 20 20 20 20  |egisters.,.K    |
000105c0  20 20 20 20 4d 4f 56 20  20 20 20 20 72 33 2c 20  |    MOV     r3, |
000105d0  23 30 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |#0              |
000105e0  20 20 20 20 3b 20 49 6e  69 74 69 61 6c 69 73 65  |    ; Initialise|
000105f0  20 6d 69 6e 69 6d 75 6d  20 72 6f 77 20 6e 75 6d  | minimum row num|
00010600  62 65 72 0d 2c f6 4b 20  20 20 20 20 20 20 20 4d  |ber.,.K        M|
00010610  4f 56 20 20 20 20 20 72  34 2c 20 23 30 20 20 20  |OV     r4, #0   |
00010620  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00010630  20 49 6e 69 74 69 61 6c  69 73 65 20 6d 61 78 69  | Initialise maxi|
00010640  6d 75 6d 20 72 6f 77 20  6e 75 6d 62 65 72 0d 2d  |mum row number.-|
00010650  00 4e 20 20 20 20 20 20  20 20 4d 4f 56 20 20 20  |.N        MOV   |
00010660  20 20 72 35 2c 20 23 30  20 20 20 20 20 20 20 20  |  r5, #0        |
00010670  20 20 20 20 20 20 20 20  20 20 3b 20 49 6e 69 74  |          ; Init|
00010680  69 61 6c 69 73 65 20 6d  69 6e 69 6d 75 6d 20 63  |ialise minimum c|
00010690  6f 6c 75 6d 6e 20 6e 75  6d 62 65 72 0d 2d 0a 4e  |olumn number.-.N|
000106a0  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
000106b0  72 36 2c 20 23 30 20 20  20 20 20 20 20 20 20 20  |r6, #0          |
000106c0  20 20 20 20 20 20 20 20  3b 20 49 6e 69 74 69 61  |        ; Initia|
000106d0  6c 69 73 65 20 6d 61 78  69 6d 75 6d 20 63 6f 6c  |lise maximum col|
000106e0  75 6d 6e 20 6e 75 6d 62  65 72 0d 2d 14 47 20 20  |umn number.-.G  |
000106f0  20 20 20 20 20 20 4c 44  52 20 20 20 20 20 72 39  |      LDR     r9|
00010700  2c 20 5b 72 31 32 2c 20  23 77 73 5f 79 65 69 67  |, [r12, #ws_yeig|
00010710  5d 20 20 20 20 20 3b 20  52 65 61 64 20 74 68 65  |]     ; Read the|
00010720  20 59 45 69 67 46 61 63  74 6f 72 20 76 61 6c 75  | YEigFactor valu|
00010730  65 0d 2d 1e 47 20 20 20  20 20 20 20 20 4c 44 52  |e.-.G        LDR|
00010740  20 20 20 20 20 72 31 30  2c 20 5b 72 31 32 2c 20  |     r10, [r12, |
00010750  23 77 73 5f 78 65 69 67  5d 20 20 20 20 3b 20 52  |#ws_xeig]    ; R|
00010760  65 61 64 20 74 68 65 20  58 45 69 67 46 61 63 74  |ead the XEigFact|
00010770  6f 72 20 76 61 6c 75 65  0d 2d 28 13 2e 74 72 61  |or value.-(..tra|
00010780  6e 73 5f 66 69 74 5f 6c  6f 6f 70 0d 2d 32 4d 20  |ns_fit_loop.-2M |
00010790  20 20 20 20 20 20 20 53  55 42 53 20 20 20 20 72  |       SUBS    r|
000107a0  30 2c 20 72 30 2c 20 23  31 20 20 20 20 20 20 20  |0, r0, #1       |
000107b0  20 20 20 20 20 20 20 3b  20 44 65 63 72 65 6d 65  |       ; Decreme|
000107c0  6e 74 20 6e 75 6d 62 65  72 20 6f 66 20 63 6f 6f  |nt number of coo|
000107d0  72 64 69 6e 61 74 65 73  0d 2d 3c 51 20 20 20 20  |rdinates.-<Q    |
000107e0  20 20 20 20 42 4d 49 20  20 20 20 20 74 72 61 6e  |    BMI     tran|
000107f0  73 5f 66 69 74 5f 68 6f  74 73 70 6f 74 20 20 20  |s_fit_hotspot   |
00010800  20 20 20 20 3b 20 45 78  69 74 20 6c 6f 6f 70 20  |    ; Exit loop |
00010810  77 68 65 6e 20 61 6c 6c  20 63 6f 6f 72 64 69 6e  |when all coordin|
00010820  61 74 65 73 20 64 6f 6e  65 0d 2d 46 4b 20 20 20  |ates done.-FK   |
00010830  20 20 20 20 20 4c 44 4d  49 41 20 20 20 72 31 21  |     LDMIA   r1!|
00010840  2c 20 7b 72 37 2d 72 38  7d 20 20 20 20 20 20 20  |, {r7-r8}       |
00010850  20 20 20 20 20 3b 20 52  65 61 64 20 74 68 65 20  |     ; Read the |
00010860  6e 65 78 74 20 63 6f 6f  72 64 69 6e 61 74 65 20  |next coordinate |
00010870  70 61 69 72 0d 2d 50 49  20 20 20 20 20 20 20 20  |pair.-PI        |
00010880  41 44 44 20 20 20 20 20  72 37 2c 20 72 37 2c 20  |ADD     r7, r7, |
00010890  23 31 3c 3c 31 35 20 20  20 20 20 20 20 20 20 20  |#1<<15          |
000108a0  3b 20 49 6d 70 72 6f 76  65 20 68 6f 72 69 7a 6f  |; Improve horizo|
000108b0  6e 74 61 6c 20 72 6f 75  6e 64 69 6e 67 0d 2d 5a  |ntal rounding.-Z|
000108c0  41 20 20 20 20 20 20 20  20 4d 4f 56 20 20 20 20  |A        MOV    |
000108d0  20 72 37 2c 20 72 37 2c  20 41 53 52 23 31 36 20  | r7, r7, ASR#16 |
000108e0  20 20 20 20 20 20 20 20  20 3b 20 53 63 61 6c 65  |         ; Scale|
000108f0  20 63 6f 6c 75 6d 6e 20  6e 75 6d 62 65 72 0d 2d  | column number.-|
00010900  64 47 20 20 20 20 20 20  20 20 4d 4f 56 20 20 20  |dG        MOV   |
00010910  20 20 72 37 2c 20 72 37  2c 20 41 53 52 20 72 39  |  r7, r7, ASR r9|
00010920  20 20 20 20 20 20 20 20  20 20 3b 20 53 63 61 6c  |          ; Scal|
00010930  65 20 62 79 20 65 69 67  65 6e 20 76 61 6c 75 65  |e by eigen value|
00010940  20 61 6c 73 6f 0d 2d 6e  49 20 20 20 20 20 20 20  | also.-nI       |
00010950  20 41 44 44 20 20 20 20  20 72 38 2c 20 72 38 2c  | ADD     r8, r8,|
00010960  20 23 31 3c 3c 31 35 20  20 20 20 20 20 20 20 20  | #1<<15         |
00010970  20 3b 20 49 6d 70 72 6f  76 65 20 68 6f 72 69 7a  | ; Improve horiz|
00010980  6f 6e 74 61 6c 20 72 6f  75 6e 64 69 6e 67 0d 2d  |ontal rounding.-|
00010990  78 41 20 20 20 20 20 20  20 20 4d 4f 56 20 20 20  |xA        MOV   |
000109a0  20 20 72 38 2c 20 72 38  2c 20 41 53 52 23 31 36  |  r8, r8, ASR#16|
000109b0  20 20 20 20 20 20 20 20  20 20 3b 20 53 63 61 6c  |          ; Scal|
000109c0  65 20 63 6f 6c 75 6d 6e  20 6e 75 6d 62 65 72 0d  |e column number.|
000109d0  2d 82 47 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |-.G        MOV  |
000109e0  20 20 20 72 38 2c 20 72  38 2c 20 41 53 52 20 72  |   r8, r8, ASR r|
000109f0  31 30 20 20 20 20 20 20  20 20 20 3b 20 53 63 61  |10         ; Sca|
00010a00  6c 65 20 62 79 20 65 69  67 65 6e 20 76 61 6c 75  |le by eigen valu|
00010a10  65 20 61 6c 73 6f 0d 2d  8c 4f 20 20 20 20 20 20  |e also.-.O      |
00010a20  20 20 53 54 4d 49 41 20  20 20 72 32 21 2c 20 7b  |  STMIA   r2!, {|
00010a30  72 37 2d 72 38 7d 20 20  20 20 20 20 20 20 20 20  |r7-r8}          |
00010a40  20 20 3b 20 57 72 69 74  65 20 74 68 65 20 74 72  |  ; Write the tr|
00010a50  61 6e 73 66 6f 72 6d 65  64 20 63 6f 6f 72 64 69  |ansformed coordi|
00010a60  6e 61 74 65 73 0d 2d 96  46 20 20 20 20 20 20 20  |nates.-.F       |
00010a70  20 43 4d 50 20 20 20 20  20 72 37 2c 20 72 33 20  | CMP     r7, r3 |
00010a80  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00010a90  20 3b 20 43 6f 6d 70 61  72 65 20 77 69 74 68 20  | ; Compare with |
00010aa0  6d 69 6e 69 6d 75 6d 20  72 6f 77 0d 2d a0 4c 20  |minimum row.-.L |
00010ab0  20 20 20 20 20 20 20 4d  4f 56 4c 54 20 20 20 72  |       MOVLT   r|
00010ac0  33 2c 20 72 37 20 20 20  20 20 20 20 20 20 20 20  |3, r7           |
00010ad0  20 20 20 20 20 20 20 3b  20 55 70 64 61 74 65 20  |       ; Update |
00010ae0  6d 69 6e 69 6d 75 6d 20  72 6f 77 20 69 66 20 72  |minimum row if r|
00010af0  65 71 75 69 72 65 64 0d  2d aa 46 20 20 20 20 20  |equired.-.F     |
00010b00  20 20 20 43 4d 50 20 20  20 20 20 72 37 2c 20 72  |   CMP     r7, r|
00010b10  34 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |4               |
00010b20  20 20 20 3b 20 43 6f 6d  70 61 72 65 20 77 69 74  |   ; Compare wit|
00010b30  68 20 6d 61 78 69 6d 75  6d 20 72 6f 77 0d 2d b4  |h maximum row.-.|
00010b40  4c 20 20 20 20 20 20 20  20 4d 4f 56 47 54 20 20  |L        MOVGT  |
00010b50  20 72 34 2c 20 72 37 20  20 20 20 20 20 20 20 20  | r4, r7         |
00010b60  20 20 20 20 20 20 20 20  20 3b 20 55 70 64 61 74  |         ; Updat|
00010b70  65 20 6d 61 78 69 6d 75  6d 20 72 6f 77 20 69 66  |e maximum row if|
00010b80  20 72 65 71 75 69 72 65  64 0d 2d be 49 20 20 20  | required.-.I   |
00010b90  20 20 20 20 20 43 4d 50  20 20 20 20 20 72 38 2c  |     CMP     r8,|
00010ba0  20 72 35 20 20 20 20 20  20 20 20 20 20 20 20 20  | r5             |
00010bb0  20 20 20 20 20 3b 20 43  6f 6d 70 61 72 65 20 77  |     ; Compare w|
00010bc0  69 74 68 20 6d 69 6e 69  6d 75 6d 20 63 6f 6c 75  |ith minimum colu|
00010bd0  6d 6e 0d 2d c8 4f 20 20  20 20 20 20 20 20 4d 4f  |mn.-.O        MO|
00010be0  56 4c 54 20 20 20 72 35  2c 20 72 38 20 20 20 20  |VLT   r5, r8    |
00010bf0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00010c00  55 70 64 61 74 65 20 6d  69 6e 69 6d 75 6d 20 63  |Update minimum c|
00010c10  6f 6c 75 6d 6e 20 69 66  20 72 65 71 75 69 72 65  |olumn if require|
00010c20  64 0d 2d d2 49 20 20 20  20 20 20 20 20 43 4d 50  |d.-.I        CMP|
00010c30  20 20 20 20 20 72 38 2c  20 72 36 20 20 20 20 20  |     r8, r6     |
00010c40  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 43  |             ; C|
00010c50  6f 6d 70 61 72 65 20 77  69 74 68 20 6d 61 78 69  |ompare with maxi|
00010c60  6d 75 6d 20 63 6f 6c 75  6d 6e 0d 2d dc 4f 20 20  |mum column.-.O  |
00010c70  20 20 20 20 20 20 4d 4f  56 47 54 20 20 20 72 36  |      MOVGT   r6|
00010c80  2c 20 72 38 20 20 20 20  20 20 20 20 20 20 20 20  |, r8            |
00010c90  20 20 20 20 20 20 3b 20  55 70 64 61 74 65 20 6d  |      ; Update m|
00010ca0  61 78 69 6d 75 6d 20 63  6f 6c 75 6d 6e 20 69 66  |aximum column if|
00010cb0  20 72 65 71 75 69 72 65  64 0d 2d e6 4f 20 20 20  | required.-.O   |
00010cc0  20 20 20 20 20 42 20 20  20 20 20 20 20 74 72 61  |     B       tra|
00010cd0  6e 73 5f 66 69 74 5f 6c  6f 6f 70 20 20 20 20 20  |ns_fit_loop     |
00010ce0  20 20 20 20 20 3b 20 4c  6f 6f 70 20 66 6f 72 20  |     ; Loop for |
00010cf0  74 68 65 20 6e 65 78 74  20 63 6f 6f 72 64 69 6e  |the next coordin|
00010d00  61 74 65 20 70 61 69 72  0d 2d f0 16 2e 74 72 61  |ate pair.-...tra|
00010d10  6e 73 5f 66 69 74 5f 68  6f 74 73 70 6f 74 0d 2d  |ns_fit_hotspot.-|
00010d20  fa 50 20 20 20 20 20 20  20 20 4c 44 52 42 20 20  |.P        LDRB  |
00010d30  20 20 72 30 2c 20 5b 72  31 32 2c 20 23 77 73 5f  |  r0, [r12, #ws_|
00010d40  70 74 72 5f 62 6c 6f 63  6b 5f 61 63 74 69 76 65  |ptr_block_active|
00010d50  79 5d 3b 20 52 65 61 64  20 6c 61 73 74 20 76 65  |y]; Read last ve|
00010d60  72 74 69 63 61 6c 20 68  6f 74 73 70 6f 74 0d 2e  |rtical hotspot..|
00010d70  04 52 20 20 20 20 20 20  20 20 4c 44 52 42 20 20  |.R        LDRB  |
00010d80  20 20 72 31 2c 20 5b 72  31 32 2c 20 23 77 73 5f  |  r1, [r12, #ws_|
00010d90  70 74 72 5f 62 6c 6f 63  6b 5f 61 63 74 69 76 65  |ptr_block_active|
00010da0  78 5d 3b 20 52 65 61 64  20 6c 61 73 74 20 68 6f  |x]; Read last ho|
00010db0  72 69 7a 6f 6e 74 61 6c  20 68 6f 74 73 70 6f 74  |rizontal hotspot|
00010dc0  0d 2e 0e 45 20 20 20 20  20 20 20 20 41 44 44 20  |...E        ADD |
00010dd0  20 20 20 20 72 37 2c 20  72 34 2c 20 72 30 20 20  |    r7, r4, r0  |
00010de0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 43 61  |            ; Ca|
00010df0  6c 63 75 6c 61 74 65 20  6c 61 73 74 20 75 73 65  |lculate last use|
00010e00  64 20 72 6f 77 0d 2e 18  52 20 20 20 20 20 20 20  |d row...R       |
00010e10  20 52 53 42 53 20 20 20  20 72 37 2c 20 72 37 2c  | RSBS    r7, r7,|
00010e20  20 23 33 31 20 20 20 20  20 20 20 20 20 20 20 20  | #31            |
00010e30  20 3b 20 4e 75 6d 62 65  72 20 6f 66 20 73 70 61  | ; Number of spa|
00010e40  72 65 20 70 69 78 65 6c  73 20 61 74 20 74 68 65  |re pixels at the|
00010e50  20 62 6f 74 74 6f 6d 0d  2e 22 4b 20 20 20 20 20  | bottom.."K     |
00010e60  20 20 20 41 44 44 4d 49  20 20 20 72 30 2c 20 72  |   ADDMI   r0, r|
00010e70  30 2c 20 72 37 20 20 20  20 20 20 20 20 20 20 20  |0, r7           |
00010e80  20 20 20 3b 20 46 6f 72  63 65 20 6c 61 73 74 20  |   ; Force last |
00010e90  72 6f 77 20 77 69 74 68  69 6e 20 70 6f 69 6e 74  |row within point|
00010ea0  65 72 0d 2e 2c 46 20 20  20 20 20 20 20 20 41 44  |er..,F        AD|
00010eb0  44 53 20 20 20 20 72 37  2c 20 72 33 2c 20 72 30  |DS    r7, r3, r0|
00010ec0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00010ed0  43 61 6c 63 75 6c 61 74  65 20 66 69 72 73 74 20  |Calculate first |
00010ee0  75 73 65 64 20 72 6f 77  0d 2e 36 4c 20 20 20 20  |used row..6L    |
00010ef0  20 20 20 20 53 55 42 4d  49 20 20 20 72 30 2c 20  |    SUBMI   r0, |
00010f00  72 30 2c 20 72 37 20 20  20 20 20 20 20 20 20 20  |r0, r7          |
00010f10  20 20 20 20 3b 20 46 6f  72 63 65 20 66 69 72 73  |    ; Force firs|
00010f20  74 20 72 6f 77 20 77 69  74 68 69 6e 20 70 6f 69  |t row within poi|
00010f30  6e 74 65 72 0d 2e 40 4b  20 20 20 20 20 20 20 20  |nter..@K        |
00010f40  43 4d 50 20 20 20 20 20  72 30 2c 20 23 30 20 20  |CMP     r0, #0  |
00010f50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00010f60  3b 20 49 73 20 68 6f 74  73 70 6f 74 20 77 69 74  |; Is hotspot wit|
00010f70  68 69 6e 20 74 68 65 20  70 6f 69 6e 74 65 72 0d  |hin the pointer.|
00010f80  2e 4a 46 20 20 20 20 20  20 20 20 4d 4f 56 4c 54  |.JF        MOVLT|
00010f90  20 20 20 72 30 2c 20 23  30 20 20 20 20 20 20 20  |   r0, #0       |
00010fa0  20 20 20 20 20 20 20 20  20 20 20 3b 20 48 6f 74  |           ; Hot|
00010fb0  73 70 6f 74 20 6d 75 73  74 20 62 65 20 70 6f 73  |spot must be pos|
00010fc0  69 74 69 76 65 0d 2e 54  4b 20 20 20 20 20 20 20  |itive..TK       |
00010fd0  20 43 4d 50 20 20 20 20  20 72 30 2c 20 23 33 31  | CMP     r0, #31|
00010fe0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00010ff0  20 3b 20 49 73 20 68 6f  74 73 70 6f 74 20 77 69  | ; Is hotspot wi|
00011000  74 68 69 6e 20 74 68 65  20 70 6f 69 6e 74 65 72  |thin the pointer|
00011010  0d 2e 5e 50 20 20 20 20  20 20 20 20 4d 4f 56 47  |..^P        MOVG|
00011020  54 20 20 20 72 30 2c 20  23 33 31 20 20 20 20 20  |T   r0, #31     |
00011030  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 52 65  |            ; Re|
00011040  73 74 72 69 63 74 20 68  6f 74 73 70 6f 74 20 74  |strict hotspot t|
00011050  6f 20 77 69 74 68 69 6e  20 70 6f 69 6e 74 65 72  |o within pointer|
00011060  0d 2e 68 48 20 20 20 20  20 20 20 20 41 44 44 20  |..hH        ADD |
00011070  20 20 20 20 72 38 2c 20  72 36 2c 20 72 31 20 20  |    r8, r6, r1  |
00011080  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 43 61  |            ; Ca|
00011090  6c 63 75 6c 61 74 65 20  6c 61 73 74 20 75 73 65  |lculate last use|
000110a0  64 20 63 6f 6c 75 6d 6e  0d 2e 72 51 20 20 20 20  |d column..rQ    |
000110b0  20 20 20 20 52 53 42 53  20 20 20 20 72 38 2c 20  |    RSBS    r8, |
000110c0  72 38 2c 20 23 33 31 20  20 20 20 20 20 20 20 20  |r8, #31         |
000110d0  20 20 20 20 3b 20 4e 75  6d 62 65 72 20 6f 66 20  |    ; Number of |
000110e0  73 70 61 72 65 20 70 69  78 65 6c 73 20 61 74 20  |spare pixels at |
000110f0  74 68 65 20 72 69 67 68  74 0d 2e 7c 4e 20 20 20  |the right..|N   |
00011100  20 20 20 20 20 41 44 44  4d 49 20 20 20 72 31 2c  |     ADDMI   r1,|
00011110  20 72 31 2c 20 72 38 20  20 20 20 20 20 20 20 20  | r1, r8         |
00011120  20 20 20 20 20 3b 20 46  6f 72 63 65 20 6c 61 73  |     ; Force las|
00011130  74 20 63 6f 6c 75 6d 6e  20 77 69 74 68 69 6e 20  |t column within |
00011140  70 6f 69 6e 74 65 72 0d  2e 86 49 20 20 20 20 20  |pointer...I     |
00011150  20 20 20 41 44 44 53 20  20 20 20 72 38 2c 20 72  |   ADDS    r8, r|
00011160  35 2c 20 72 31 20 20 20  20 20 20 20 20 20 20 20  |5, r1           |
00011170  20 20 20 3b 20 43 61 6c  63 75 6c 61 74 65 20 66  |   ; Calculate f|
00011180  69 72 73 74 20 75 73 65  64 20 63 6f 6c 75 6d 6e  |irst used column|
00011190  0d 2e 90 4f 20 20 20 20  20 20 20 20 53 55 42 4d  |...O        SUBM|
000111a0  49 20 20 20 72 31 2c 20  72 31 2c 20 72 38 20 20  |I   r1, r1, r8  |
000111b0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 46 6f  |            ; Fo|
000111c0  72 63 65 20 66 69 72 73  74 20 63 6f 6c 75 6d 6e  |rce first column|
000111d0  20 77 69 74 68 69 6e 20  70 6f 69 6e 74 65 72 0d  | within pointer.|
000111e0  2e 9a 4b 20 20 20 20 20  20 20 20 43 4d 50 20 20  |..K        CMP  |
000111f0  20 20 20 72 31 2c 20 23  30 20 20 20 20 20 20 20  |   r1, #0       |
00011200  20 20 20 20 20 20 20 20  20 20 20 3b 20 49 73 20  |           ; Is |
00011210  68 6f 74 73 70 6f 74 20  77 69 74 68 69 6e 20 74  |hotspot within t|
00011220  68 65 20 70 6f 69 6e 74  65 72 0d 2e a4 46 20 20  |he pointer...F  |
00011230  20 20 20 20 20 20 4d 4f  56 4c 54 20 20 20 72 31  |      MOVLT   r1|
00011240  2c 20 23 30 20 20 20 20  20 20 20 20 20 20 20 20  |, #0            |
00011250  20 20 20 20 20 20 3b 20  48 6f 74 73 70 6f 74 20  |      ; Hotspot |
00011260  6d 75 73 74 20 62 65 20  70 6f 73 69 74 69 76 65  |must be positive|
00011270  0d 2e ae 4b 20 20 20 20  20 20 20 20 43 4d 50 20  |...K        CMP |
00011280  20 20 20 20 72 31 2c 20  23 33 31 20 20 20 20 20  |    r1, #31     |
00011290  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 49 73  |            ; Is|
000112a0  20 68 6f 74 73 70 6f 74  20 77 69 74 68 69 6e 20  | hotspot within |
000112b0  74 68 65 20 70 6f 69 6e  74 65 72 0d 2e b8 50 20  |the pointer...P |
000112c0  20 20 20 20 20 20 20 4d  4f 56 47 54 20 20 20 72  |       MOVGT   r|
000112d0  31 2c 20 23 33 31 20 20  20 20 20 20 20 20 20 20  |1, #31          |
000112e0  20 20 20 20 20 20 20 3b  20 52 65 73 74 72 69 63  |       ; Restric|
000112f0  74 20 68 6f 74 73 70 6f  74 20 74 6f 20 77 69 74  |t hotspot to wit|
00011300  68 69 6e 20 70 6f 69 6e  74 65 72 0d 2e c2 4c 20  |hin pointer...L |
00011310  20 20 20 20 20 20 20 53  54 52 42 20 20 20 20 72  |       STRB    r|
00011320  30 2c 20 5b 72 31 32 2c  20 23 77 73 5f 70 74 72  |0, [r12, #ws_ptr|
00011330  5f 62 6c 6f 63 6b 5f 61  63 74 69 76 65 79 5d 3b  |_block_activey];|
00011340  20 53 74 6f 72 65 20 76  65 72 74 69 63 61 6c 20  | Store vertical |
00011350  68 6f 74 73 70 6f 74 0d  2e cc 4e 20 20 20 20 20  |hotspot...N     |
00011360  20 20 20 53 54 52 42 20  20 20 20 72 31 2c 20 5b  |   STRB    r1, [|
00011370  72 31 32 2c 20 23 77 73  5f 70 74 72 5f 62 6c 6f  |r12, #ws_ptr_blo|
00011380  63 6b 5f 61 63 74 69 76  65 78 5d 3b 20 53 74 6f  |ck_activex]; Sto|
00011390  72 65 20 68 6f 72 69 7a  6f 6e 74 61 6c 20 68 6f  |re horizontal ho|
000113a0  74 73 70 6f 74 0d 2e d6  13 2e 74 72 61 6e 73 5f  |tspot.....trans_|
000113b0  66 69 74 5f 64 6f 6e 65  0d 2e e0 44 20 20 20 20  |fit_done...D    |
000113c0  20 20 20 20 4c 44 4d 46  44 20 20 20 72 31 33 21  |    LDMFD   r13!|
000113d0  2c 20 7b 72 30 2d 72 31  30 2c 20 70 63 7d 20 20  |, {r0-r10, pc}  |
000113e0  20 20 20 20 3b 20 52 65  74 75 72 6e 20 66 72 6f  |    ; Return fro|
000113f0  6d 20 73 75 62 72 6f 75  74 69 6e 65 0d 2e ea 04  |m subroutine....|
00011400  0d 2e f4 4e 20 20 20 20  20 20 20 20 3b 20 52 6f  |...N        ; Ro|
00011410  74 61 74 65 20 72 30 20  63 6f 6f 72 64 69 6e 61  |tate r0 coordina|
00011420  74 65 73 20 66 72 6f 6d  20 61 74 20 72 31 20 74  |tes from at r1 t|
00011430  6f 20 61 74 20 72 32 20  77 69 74 68 20 76 65 72  |o at r2 with ver|
00011440  74 69 63 61 6c 20 28 72  34 2c 20 72 33 29 0d 2e  |tical (r4, r3)..|
00011450  fe 11 2e 74 72 61 6e 73  5f 72 6f 74 61 74 65 0d  |...trans_rotate.|
00011460  2f 08 3d 20 20 20 20 20  20 20 20 53 54 4d 46 44  |/.=        STMFD|
00011470  20 20 20 72 31 33 21 2c  20 7b 72 30 2d 72 38 2c  |   r13!, {r0-r8,|
00011480  20 72 31 34 7d 20 20 20  20 20 20 3b 20 53 74 61  | r14}      ; Sta|
00011490  63 6b 20 72 65 67 69 73  74 65 72 73 0d 2f 12 3d  |ck registers./.=|
000114a0  20 20 20 20 20 20 20 20  53 54 4d 46 44 20 20 20  |        STMFD   |
000114b0  72 31 33 21 2c 20 7b 72  30 2d 72 31 7d 20 20 20  |r13!, {r0-r1}   |
000114c0  20 20 20 20 20 20 20 20  3b 20 53 74 61 63 6b 20  |        ; Stack |
000114d0  72 65 67 69 73 74 65 72  73 0d 2f 1c 3f 20 20 20  |registers./.?   |
000114e0  20 20 20 20 20 4d 4f 56  20 20 20 20 20 72 30 2c  |     MOV     r0,|
000114f0  20 72 33 20 20 20 20 20  20 20 20 20 20 20 20 20  | r3             |
00011500  20 20 20 20 20 3b 20 43  6f 70 79 20 76 65 72 74  |     ; Copy vert|
00011510  69 63 61 6c 20 72 6f 77  0d 2f 26 42 20 20 20 20  |ical row./&B    |
00011520  20 20 20 20 4d 4f 56 20  20 20 20 20 72 31 2c 20  |    MOV     r1, |
00011530  72 34 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r4              |
00011540  20 20 20 20 3b 20 43 6f  70 79 20 76 65 72 74 69  |    ; Copy verti|
00011550  63 61 6c 20 63 6f 6c 75  6d 6e 0d 2f 30 4b 20 20  |cal column./0K  |
00011560  20 20 20 20 20 20 42 4c  20 20 20 20 20 20 6e 6f  |      BL      no|
00011570  72 6d 61 6c 69 73 65 20  20 20 20 20 20 20 20 20  |rmalise         |
00011580  20 20 20 20 20 20 3b 20  4e 6f 72 6d 61 6c 69 73  |      ; Normalis|
00011590  65 20 74 68 65 20 76 65  72 74 69 63 61 6c 20 76  |e the vertical v|
000115a0  65 63 74 6f 72 0d 2f 3a  4b 20 20 20 20 20 20 20  |ector./:K       |
000115b0  20 4d 4f 56 20 20 20 20  20 72 33 2c 20 72 30 2c  | MOV     r3, r0,|
000115c0  20 41 53 52 23 38 20 20  20 20 20 20 20 20 20 20  | ASR#8          |
000115d0  20 3b 20 43 6f 70 79 20  61 6e 64 20 73 63 61 6c  | ; Copy and scal|
000115e0  65 20 6e 6f 72 6d 61 6c  69 73 65 64 20 72 6f 77  |e normalised row|
000115f0  0d 2f 44 4e 20 20 20 20  20 20 20 20 4d 4f 56 20  |./DN        MOV |
00011600  20 20 20 20 72 34 2c 20  72 31 2c 20 41 53 52 23  |    r4, r1, ASR#|
00011610  38 20 20 20 20 20 20 20  20 20 20 20 3b 20 43 6f  |8           ; Co|
00011620  70 79 20 61 6e 64 20 73  63 61 6c 65 20 6e 6f 72  |py and scale nor|
00011630  6d 61 6c 69 73 65 64 20  63 6f 6c 75 6d 6e 0d 2f  |malised column./|
00011640  4e 3f 20 20 20 20 20 20  20 20 4c 44 4d 46 44 20  |N?        LDMFD |
00011650  20 20 72 31 33 21 2c 20  7b 72 30 2d 72 31 7d 20  |  r13!, {r0-r1} |
00011660  20 20 20 20 20 20 20 20  20 20 3b 20 52 65 73 74  |          ; Rest|
00011670  6f 72 65 20 72 65 67 69  73 74 65 72 73 0d 2f 58  |ore registers./X|
00011680  16 2e 74 72 61 6e 73 5f  72 6f 74 61 74 65 5f 6c  |..trans_rotate_l|
00011690  6f 6f 70 0d 2f 62 4d 20  20 20 20 20 20 20 20 53  |oop./bM        S|
000116a0  55 42 53 20 20 20 20 72  30 2c 20 72 30 2c 20 23  |UBS    r0, r0, #|
000116b0  31 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |1              ;|
000116c0  20 44 65 63 72 65 6d 65  6e 74 20 6e 75 6d 62 65  | Decrement numbe|
000116d0  72 20 6f 66 20 63 6f 6f  72 64 69 6e 61 74 65 73  |r of coordinates|
000116e0  0d 2f 6c 52 20 20 20 20  20 20 20 20 4c 44 4d 4d  |./lR        LDMM|
000116f0  49 46 44 20 72 31 33 21  2c 20 7b 72 30 2d 72 38  |IFD r13!, {r0-r8|
00011700  2c 20 70 63 7d 20 20 20  20 20 20 20 3b 20 52 65  |, pc}       ; Re|
00011710  74 75 72 6e 20 66 72 6f  6d 20 73 75 62 72 6f 75  |turn from subrou|
00011720  74 69 6e 65 20 77 68 65  6e 20 66 69 6e 69 73 68  |tine when finish|
00011730  65 64 0d 2f 76 4b 20 20  20 20 20 20 20 20 4c 44  |ed./vK        LD|
00011740  4d 49 41 20 20 20 72 31  21 2c 20 7b 72 35 2d 72  |MIA   r1!, {r5-r|
00011750  36 7d 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |6}            ; |
00011760  52 65 61 64 20 74 68 65  20 6e 65 78 74 20 63 6f  |Read the next co|
00011770  6f 72 64 69 6e 61 74 65  20 70 61 69 72 0d 2f 80  |ordinate pair./.|
00011780  45 20 20 20 20 20 20 20  20 4d 4f 56 20 20 20 20  |E        MOV    |
00011790  20 72 35 2c 20 72 35 2c  20 41 53 52 23 38 20 20  | r5, r5, ASR#8  |
000117a0  20 20 20 20 20 20 20 20  20 3b 20 50 72 65 73 63  |         ; Presc|
000117b0  61 6c 65 20 74 68 65 20  72 6f 77 20 6e 75 6d 62  |ale the row numb|
000117c0  65 72 0d 2f 8a 48 20 20  20 20 20 20 20 20 4d 4f  |er./.H        MO|
000117d0  56 20 20 20 20 20 72 36  2c 20 72 36 2c 20 41 53  |V     r6, r6, AS|
000117e0  52 23 38 20 20 20 20 20  20 20 20 20 20 20 3b 20  |R#8           ; |
000117f0  50 72 65 73 63 61 6c 65  20 74 68 65 20 63 6f 6c  |Prescale the col|
00011800  75 6d 6e 20 6e 75 6d 62  65 72 0d 2f 94 3f 20 20  |umn number./.?  |
00011810  20 20 20 20 20 20 4d 55  4c 20 20 20 20 20 72 37  |      MUL     r7|
00011820  2c 20 72 35 2c 20 72 33  20 20 20 20 20 20 20 20  |, r5, r3        |
00011830  20 20 20 20 20 20 3b 20  52 6f 74 61 74 65 20 72  |      ; Rotate r|
00011840  6f 77 20 74 6f 20 72 6f  77 0d 2f 9e 4a 20 20 20  |ow to row./.J   |
00011850  20 20 20 20 20 52 53 42  20 20 20 20 20 72 37 2c  |     RSB     r7,|
00011860  20 72 37 2c 20 23 30 20  20 20 20 20 20 20 20 20  | r7, #0         |
00011870  20 20 20 20 20 3b 20 43  6f 72 72 65 63 74 20 73  |     ; Correct s|
00011880  69 67 6e 20 6f 66 20 72  6f 77 20 72 6f 74 61 74  |ign of row rotat|
00011890  69 6f 6e 0d 2f a8 42 20  20 20 20 20 20 20 20 4d  |ion./.B        M|
000118a0  55 4c 20 20 20 20 20 72  38 2c 20 72 35 2c 20 72  |UL     r8, r5, r|
000118b0  34 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |4              ;|
000118c0  20 52 6f 74 61 74 65 20  72 6f 77 20 74 6f 20 63  | Rotate row to c|
000118d0  6f 6c 75 6d 6e 0d 2f b2  42 20 20 20 20 20 20 20  |olumn./.B       |
000118e0  20 4d 4c 41 20 20 20 20  20 72 37 2c 20 72 36 2c  | MLA     r7, r6,|
000118f0  20 72 34 2c 20 72 37 20  20 20 20 20 20 20 20 20  | r4, r7         |
00011900  20 3b 20 52 6f 74 61 74  65 20 63 6f 6c 75 6d 6e  | ; Rotate column|
00011910  20 74 6f 20 72 6f 77 0d  2f bc 45 20 20 20 20 20  | to row./.E     |
00011920  20 20 20 4d 4c 41 20 20  20 20 20 72 38 2c 20 72  |   MLA     r8, r|
00011930  36 2c 20 72 33 2c 20 72  38 20 20 20 20 20 20 20  |6, r3, r8       |
00011940  20 20 20 3b 20 52 6f 74  61 74 65 20 63 6f 6c 75  |   ; Rotate colu|
00011950  6d 6e 20 74 6f 20 63 6f  6c 75 6d 6e 0d 2f c6 4d  |mn to column./.M|
00011960  20 20 20 20 20 20 20 20  52 53 42 20 20 20 20 20  |        RSB     |
00011970  72 38 2c 20 72 38 2c 20  23 30 20 20 20 20 20 20  |r8, r8, #0      |
00011980  20 20 20 20 20 20 20 20  3b 20 43 6f 72 72 65 63  |        ; Correc|
00011990  74 20 73 69 67 6e 20 6f  66 20 63 6f 6c 75 6d 6e  |t sign of column|
000119a0  20 72 6f 74 61 74 69 6f  6e 0d 2f d0 4f 20 20 20  | rotation./.O   |
000119b0  20 20 20 20 20 53 54 4d  49 41 20 20 20 72 32 21  |     STMIA   r2!|
000119c0  2c 20 7b 72 37 2d 72 38  7d 20 20 20 20 20 20 20  |, {r7-r8}       |
000119d0  20 20 20 20 20 3b 20 57  72 69 74 65 20 74 68 65  |     ; Write the|
000119e0  20 74 72 61 6e 73 66 6f  72 6d 65 64 20 63 6f 6f  | transformed coo|
000119f0  72 64 69 6e 61 74 65 73  0d 2f da 4e 20 20 20 20  |rdinates./.N    |
00011a00  20 20 20 20 42 20 20 20  20 20 20 20 74 72 61 6e  |    B       tran|
00011a10  73 5f 72 6f 74 61 74 65  5f 6c 6f 6f 70 20 20 20  |s_rotate_loop   |
00011a20  20 20 20 20 3b 20 4b 65  65 70 20 6c 6f 6f 70 69  |    ; Keep loopi|
00011a30  6e 67 20 75 6e 74 69 6c  20 61 6c 6c 20 70 72 6f  |ng until all pro|
00011a40  63 65 73 73 65 64 0d 2f  e4 04 0d 2f ee 52 20 20  |cessed./.../.R  |
00011a50  20 20 20 20 20 20 3b 20  41 64 64 20 72 30 20 63  |      ; Add r0 c|
00011a60  6f 6f 72 64 69 6e 61 74  65 73 20 61 74 20 72 31  |oordinates at r1|
00011a70  20 74 6f 20 72 33 20 66  72 61 63 74 69 6f 6e 20  | to r3 fraction |
00011a80  6f 66 20 74 68 6f 73 65  20 61 74 20 72 32 20 74  |of those at r2 t|
00011a90  6f 20 67 69 76 65 20 61  74 20 72 34 0d 2f f8 0e  |o give at r4./..|
00011aa0  2e 74 72 61 6e 73 5f 61  64 64 0d 30 02 3d 20 20  |.trans_add.0.=  |
00011ab0  20 20 20 20 20 20 53 54  4d 46 44 20 20 20 72 31  |      STMFD   r1|
00011ac0  33 21 2c 20 7b 72 30 2d  72 38 2c 20 72 31 34 7d  |3!, {r0-r8, r14}|
00011ad0  20 20 20 20 20 20 3b 20  53 74 61 63 6b 20 72 65  |      ; Stack re|
00011ae0  67 69 73 74 65 72 73 0d  30 0c 4c 20 20 20 20 20  |gisters.0.L     |
00011af0  20 20 20 4d 4f 56 20 20  20 20 20 72 33 2c 20 72  |   MOV     r3, r|
00011b00  33 2c 20 41 53 52 23 38  20 20 20 20 20 20 20 20  |3, ASR#8        |
00011b10  20 20 20 3b 20 50 72 65  73 63 61 6c 65 20 74 68  |   ; Prescale th|
00011b20  65 20 72 65 71 75 69 72  65 64 20 66 72 61 63 74  |e required fract|
00011b30  69 6f 6e 0d 30 16 13 2e  74 72 61 6e 73 5f 61 64  |ion.0...trans_ad|
00011b40  64 5f 6c 6f 6f 70 0d 30  20 4d 20 20 20 20 20 20  |d_loop.0 M      |
00011b50  20 20 53 55 42 53 20 20  20 20 72 30 2c 20 72 30  |  SUBS    r0, r0|
00011b60  2c 20 23 31 20 20 20 20  20 20 20 20 20 20 20 20  |, #1            |
00011b70  20 20 3b 20 44 65 63 72  65 6d 65 6e 74 20 6e 75  |  ; Decrement nu|
00011b80  6d 62 65 72 20 6f 66 20  63 6f 6f 72 64 69 6e 61  |mber of coordina|
00011b90  74 65 73 0d 30 2a 52 20  20 20 20 20 20 20 20 4c  |tes.0*R        L|
00011ba0  44 4d 4d 49 46 44 20 72  31 33 21 2c 20 7b 72 30  |DMMIFD r13!, {r0|
00011bb0  2d 72 38 2c 20 70 63 7d  20 20 20 20 20 20 20 3b  |-r8, pc}       ;|
00011bc0  20 52 65 74 75 72 6e 20  66 72 6f 6d 20 73 75 62  | Return from sub|
00011bd0  72 6f 75 74 69 6e 65 20  77 68 65 6e 20 66 69 6e  |routine when fin|
00011be0  69 73 68 65 64 0d 30 34  4b 20 20 20 20 20 20 20  |ished.04K       |
00011bf0  20 4c 44 4d 49 41 20 20  20 72 31 21 2c 20 7b 72  | LDMIA   r1!, {r|
00011c00  35 2d 72 36 7d 20 20 20  20 20 20 20 20 20 20 20  |5-r6}           |
00011c10  20 3b 20 52 65 61 64 20  74 68 65 20 6f 72 69 67  | ; Read the orig|
00011c20  69 6e 61 6c 20 63 6f 6f  72 64 69 6e 61 74 65 73  |inal coordinates|
00011c30  0d 30 3e 46 20 20 20 20  20 20 20 20 4c 44 4d 49  |.0>F        LDMI|
00011c40  41 20 20 20 72 32 21 2c  20 7b 72 37 2d 72 38 7d  |A   r2!, {r7-r8}|
00011c50  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 52 65  |            ; Re|
00011c60  61 64 20 74 68 65 20 6e  65 77 20 63 6f 6f 72 64  |ad the new coord|
00011c70  69 6e 61 74 65 73 0d 30  48 49 20 20 20 20 20 20  |inates.0HI      |
00011c80  20 20 4d 4f 56 20 20 20  20 20 72 37 2c 20 72 37  |  MOV     r7, r7|
00011c90  2c 20 41 53 52 23 38 20  20 20 20 20 20 20 20 20  |, ASR#8         |
00011ca0  20 20 3b 20 50 72 65 73  63 61 6c 65 20 74 68 65  |  ; Prescale the|
00011cb0  20 6e 65 77 20 72 6f 77  20 6e 75 6d 62 65 72 0d  | new row number.|
00011cc0  30 52 4c 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |0RL        MOV  |
00011cd0  20 20 20 72 38 2c 20 72  38 2c 20 41 53 52 23 38  |   r8, r8, ASR#8|
00011ce0  20 20 20 20 20 20 20 20  20 20 20 3b 20 50 72 65  |           ; Pre|
00011cf0  73 63 61 6c 65 20 74 68  65 20 6e 65 77 20 63 6f  |scale the new co|
00011d00  6c 75 6d 6e 20 6e 75 6d  62 65 72 0d 30 5c 4b 20  |lumn number.0\K |
00011d10  20 20 20 20 20 20 20 4d  4c 41 20 20 20 20 20 72  |       MLA     r|
00011d20  35 2c 20 72 37 2c 20 72  33 2c 20 72 35 20 20 20  |5, r7, r3, r5   |
00011d30  20 20 20 20 20 20 20 3b  20 41 64 64 20 74 68 65  |       ; Add the|
00011d40  20 72 65 71 75 69 72 65  64 20 72 6f 77 20 66 72  | required row fr|
00011d50  61 63 74 69 6f 6e 0d 30  66 4e 20 20 20 20 20 20  |action.0fN      |
00011d60  20 20 4d 4c 41 20 20 20  20 20 72 36 2c 20 72 38  |  MLA     r6, r8|
00011d70  2c 20 72 33 2c 20 72 36  20 20 20 20 20 20 20 20  |, r3, r6        |
00011d80  20 20 3b 20 41 64 64 20  74 68 65 20 72 65 71 75  |  ; Add the requ|
00011d90  69 72 65 64 20 63 6f 6c  75 6d 6e 20 66 72 61 63  |ired column frac|
00011da0  74 69 6f 6e 0d 30 70 4b  20 20 20 20 20 20 20 20  |tion.0pK        |
00011db0  53 54 4d 49 41 20 20 20  72 34 21 2c 20 7b 72 35  |STMIA   r4!, {r5|
00011dc0  2d 72 36 7d 20 20 20 20  20 20 20 20 20 20 20 20  |-r6}            |
00011dd0  3b 20 57 72 69 74 65 20  74 68 65 20 75 70 64 61  |; Write the upda|
00011de0  74 65 64 20 63 6f 6f 72  64 69 6e 61 74 65 73 0d  |ted coordinates.|
00011df0  30 7a 4e 20 20 20 20 20  20 20 20 42 20 20 20 20  |0zN        B    |
00011e00  20 20 20 74 72 61 6e 73  5f 61 64 64 5f 6c 6f 6f  |   trans_add_loo|
00011e10  70 20 20 20 20 20 20 20  20 20 20 3b 20 4b 65 65  |p          ; Kee|
00011e20  70 20 6c 6f 6f 70 69 6e  67 20 75 6e 74 69 6c 20  |p looping until |
00011e30  61 6c 6c 20 70 72 6f 63  65 73 73 65 64 0d 30 84  |all processed.0.|
00011e40  04 0d 30 8e 09 20 20 20  20 5d 0d 30 98 05 ed 0d  |..0..    ].0....|
00011e50  30 a2 04 0d 30 ac 1f f4  20 53 61 76 65 20 74 68  |0...0... Save th|
00011e60  65 20 72 65 73 75 6c 74  69 6e 67 20 6d 6f 64 75  |e resulting modu|
00011e70  6c 65 0d 30 b6 39 c8 99  20 22 4f 53 5f 46 69 6c  |le.0.9.. "OS_Fil|
00011e80  65 22 2c 20 31 30 2c 20  66 69 6c 65 6e 61 6d 65  |e", 10, filename|
00011e90  24 2c 20 26 66 66 41 2c  2c 20 63 6f 64 65 25 2c  |$, &ffA,, code%,|
00011ea0  20 63 6f 64 65 25 20 2b  20 50 25 0d 30 c0 05 e0  | code% + P%.0...|
00011eb0  0d 30 ca 04 0d 30 d4 32  f4 20 54 68 65 20 6e 61  |.0...0.2. The na|
00011ec0  6d 65 20 61 6e 64 20 63  6f 72 72 65 73 70 6f 6e  |me and correspon|
00011ed0  64 69 6e 67 20 74 79 70  65 20 6f 66 20 61 20 70  |ding type of a p|
00011ee0  6f 69 6e 74 65 72 0d 30  de 1b dd a4 70 6f 69 6e  |ointer.0....poin|
00011ef0  74 65 72 28 6e 61 6d 65  24 2c 20 74 79 70 65 25  |ter(name$, type%|
00011f00  29 0d 30 e8 11 20 20 20  20 5b 4f 50 54 20 6f 70  |).0..    [OPT op|
00011f10  74 25 0d 30 f2 2f 20 20  20 20 20 20 20 20 45 51  |t%.0./        EQ|
00011f20  55 53 20 20 20 20 6e 61  6d 65 24 20 2b 20 c4 31  |US    name$ + .1|
00011f30  32 20 2d 20 a9 28 6e 61  6d 65 24 29 2c 20 bd 30  |2 - .(name$), .0|
00011f40  29 0d 30 fc 19 20 20 20  20 20 20 20 20 45 51 55  |).0..        EQU|
00011f50  44 20 20 20 20 74 79 70  65 25 0d 31 06 09 20 20  |D    type%.1..  |
00011f60  20 20 5d 0d 31 10 07 3d  20 30 0d 31 1a 04 0d 31  |  ].1..= 0.1...1|
00011f70  24 29 f4 20 4c 69 74 65  72 61 6c 20 66 69 78 65  |$). Literal fixe|
00011f80  64 20 70 6f 69 6e 74 20  63 6f 6f 72 64 69 6e 61  |d point coordina|
00011f90  74 65 20 70 61 69 72 0d  31 2e 1d dd a4 63 6f 6f  |te pair.1....coo|
00011fa0  72 64 69 6e 61 74 65 28  72 6f 77 2c 20 63 6f 6c  |rdinate(row, col|
00011fb0  75 6d 6e 29 0d 31 38 11  20 20 20 20 5b 4f 50 54  |umn).18.    [OPT|
00011fc0  20 6f 70 74 25 0d 31 42  26 20 20 20 20 20 20 20  | opt%.1B&       |
00011fd0  20 45 51 55 44 20 20 20  20 a8 28 72 6f 77 20 2a  | EQUD    .(row *|
00011fe0  20 28 31 20 3c 3c 20 31  36 29 29 0d 31 4c 29 20  | (1 << 16)).1L) |
00011ff0  20 20 20 20 20 20 20 45  51 55 44 20 20 20 20 a8  |       EQUD    .|
00012000  28 63 6f 6c 75 6d 6e 20  2a 20 28 31 20 3c 3c 20  |(column * (1 << |
00012010  31 36 29 29 0d 31 56 09  20 20 20 20 5d 0d 31 60  |16)).1V.    ].1`|
00012020  07 3d 20 30 0d 31 6a 04  0d 31 74 2c f4 20 52 65  |.= 0.1j..1t,. Re|
00012030  61 64 20 61 20 77 6f 72  64 20 66 72 6f 6d 20 61  |ad a word from a|
00012040  20 6e 6f 6e 2d 61 6c 69  67 6e 65 64 20 61 64 64  | non-aligned add|
00012050  72 65 73 73 0d 31 7e 1a  dd a4 6c 64 72 75 28 72  |ress.1~...ldru(r|
00012060  64 2c 20 72 61 2c 20 72  62 2c 20 72 63 29 0d 31  |d, ra, rb, rc).1|
00012070  88 11 20 20 20 20 5b 4f  50 54 20 6f 70 74 25 0d  |..    [OPT opt%.|
00012080  31 92 47 20 20 20 20 20  20 20 20 42 49 43 20 20  |1.G        BIC  |
00012090  20 20 20 72 62 2c 20 72  61 2c 20 23 33 20 20 20  |   rb, ra, #3   |
000120a0  20 20 20 20 20 20 20 20  20 20 20 3b 20 47 65 74  |           ; Get|
000120b0  20 77 6f 72 64 20 61 6c  69 67 6e 65 64 20 61 64  | word aligned ad|
000120c0  64 72 65 73 73 20 0d 31  9c 4b 20 20 20 20 20 20  |dress .1.K      |
000120d0  20 20 4c 44 4d 49 41 20  20 20 72 62 2c 20 7b 72  |  LDMIA   rb, {r|
000120e0  64 2c 20 72 63 7d 20 20  20 20 20 20 20 20 20 20  |d, rc}          |
000120f0  20 20 3b 20 47 65 74 20  36 34 20 62 69 74 73 20  |  ; Get 64 bits |
00012100  63 6f 6e 74 61 69 6e 69  6e 67 20 61 6e 73 77 65  |containing answe|
00012110  72 0d 31 a6 46 20 20 20  20 20 20 20 20 80 20 20  |r.1.F        .  |
00012120  20 20 20 72 62 2c 20 72  61 2c 20 23 33 20 20 20  |   rb, ra, #3   |
00012130  20 20 20 20 20 20 20 20  20 20 20 3b 20 43 6f 72  |           ; Cor|
00012140  72 65 63 74 69 6f 6e 20  66 61 63 74 6f 72 20 69  |rection factor i|
00012150  6e 20 62 79 74 65 73 0d  31 b0 4e 20 20 20 20 20  |n bytes.1.N     |
00012160  20 20 20 4d 4f 56 53 20  20 20 20 72 62 2c 20 72  |   MOVS    rb, r|
00012170  62 2c 20 4c 53 4c 23 33  20 20 20 20 20 20 20 20  |b, LSL#3        |
00012180  20 20 20 3b 20 61 6e 64  20 69 6e 20 62 69 74 73  |   ; and in bits|
00012190  2c 20 73 6f 20 63 68 65  63 6b 20 69 66 20 61 6c  |, so check if al|
000121a0  69 67 6e 65 64 0d 31 ba  53 20 20 20 20 20 20 20  |igned.1.S       |
000121b0  20 4d 4f 56 4e 45 20 20  20 72 64 2c 20 72 64 2c  | MOVNE   rd, rd,|
000121c0  20 4c 53 52 20 72 62 20  20 20 20 20 20 20 20 20  | LSR rb         |
000121d0  20 3b 20 49 66 20 6e 6f  74 2c 20 70 72 6f 64 75  | ; If not, produ|
000121e0  63 65 20 62 6f 74 74 6f  6d 20 62 69 74 73 20 6f  |ce bottom bits o|
000121f0  66 20 72 65 73 75 6c 74  0d 31 c4 44 20 20 20 20  |f result.1.D    |
00012200  20 20 20 20 52 53 42 4e  45 20 20 20 72 62 2c 20  |    RSBNE   rb, |
00012210  72 62 2c 20 23 33 32 20  20 20 20 20 20 20 20 20  |rb, #32         |
00012220  20 20 20 20 3b 20 47 65  74 20 6f 74 68 65 72 20  |    ; Get other |
00012230  73 68 69 66 74 20 61 6d  6f 75 6e 74 0d 31 ce 4a  |shift amount.1.J|
00012240  20 20 20 20 20 20 20 20  84 52 4e 45 20 20 20 72  |        .RNE   r|
00012250  64 2c 20 72 64 2c 20 72  63 2c 20 4c 53 4c 20 72  |d, rd, rc, LSL r|
00012260  62 20 20 20 20 20 20 3b  20 43 6f 6d 62 69 6e 65  |b      ; Combine|
00012270  20 74 77 6f 20 68 61 6c  76 65 73 20 66 6f 72 20  | two halves for |
00012280  72 65 73 75 6c 74 0d 31  d8 09 20 20 20 20 5d 0d  |result.1..    ].|
00012290  31 e2 07 3d 20 30 0d ff                           |1..= 0..|
00012298